Mercurial > otakunoraifu
comparison scn2k/scn2k_text.cc @ 58:0aaa5bb3dde5
Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
author | Thibaut GIRKA <thib@sitedethib.com> |
---|---|
date | Fri, 18 Dec 2009 14:25:56 +0100 |
parents | 6d9146f56ccf |
children | 36d92d21300f |
comparison
equal
deleted
inserted
replaced
57:6d9146f56ccf | 58:0aaa5bb3dde5 |
---|---|
69 ** | 69 ** |
70 ** Text(implementation) | 70 ** Text(implementation) |
71 */ | 71 */ |
72 Text::Text(Event::Container& _event, PicContainer& _parent) : | 72 Text::Text(Event::Container& _event, PicContainer& _parent) : |
73 text(0),status(Text::NORMAL), status_saved(Text::NORMAL), status_mask(Text::NORMAL), ruby_text_flag(false), | 73 text(0),status(Text::NORMAL), status_saved(Text::NORMAL), status_mask(Text::NORMAL), ruby_text_flag(false), |
74 old_time(0), base_time(0), text_window_number(0), text_parsing(false), skip_mode(SKIP_NO), save_selectcount(0), sel_widget(0), | 74 old_time(0), text_window_number(0), text_parsing(false), skip_mode(SKIP_NO), save_selectcount(0), sel_widget(0), |
75 backlog_widget(0), parent(_parent), event(_event), | 75 backlog_widget(0), parent(_parent), event(_event), |
76 kcursor(0), sel_bg1(0), sel_bg2(0), sel_bg_rect(0,0,0,0) { | 76 kcursor(0), sel_bg1(0), sel_bg2(0), sel_bg_rect(0,0,0,0) { |
77 config = AyuSysConfig::GetInstance(); | 77 config = AyuSysConfig::GetInstance(); |
78 int i; | 78 int i; |
79 for (i=0; i<32; i++) { | 79 for (i=0; i<32; i++) { |
99 RegisterCommand(0, 3, 102, "TextWindow", (CmdImpl) &Text::impl_TextWindow); | 99 RegisterCommand(0, 3, 102, "TextWindow", (CmdImpl) &Text::impl_TextWindow); |
100 RegisterCommand(0, 3, 103, "FastText", NULL);//FIXME: (CmdImpl) &Text::impl_FastText); | 100 RegisterCommand(0, 3, 103, "FastText", NULL);//FIXME: (CmdImpl) &Text::impl_FastText); |
101 RegisterCommand(0, 3, 104, "NormalText", NULL); | 101 RegisterCommand(0, 3, 104, "NormalText", NULL); |
102 RegisterCommand(0, 3, 152, "msgClear", (CmdImpl) &Text::impl_msgClear); | 102 RegisterCommand(0, 3, 152, "msgClear", (CmdImpl) &Text::impl_msgClear); |
103 | 103 |
104 RegisterCommand(1, 4, 2600, "DefMessageSpeed", (CmdImpl) &Text::impl_GetDefConfig); | |
105 RegisterCommand(1, 4, 2601, "DefMessageNoWait", (CmdImpl) &Text::impl_GetDefConfig); | |
106 RegisterCommand(1, 4, 2604, "DefAutoMode", (CmdImpl) &Text::impl_GetDefConfig); | |
107 RegisterCommand(1, 4, 2605, "DefAutoCharTime", (CmdImpl) &Text::impl_GetDefConfig); | |
108 RegisterCommand(1, 4, 2606, "DefAutoBaseTime", (CmdImpl) &Text::impl_GetDefConfig); | |
109 | |
110 RegisterCommand(1, 4, 2323, "MessageSpeed", (CmdImpl) &Text::impl_GetConfig); | |
111 RegisterCommand(1, 4, 2324, "MessageNoWait", (CmdImpl) &Text::impl_GetConfig); | |
112 RegisterCommand(1, 4, 2350, "AutoMode", (CmdImpl) &Text::impl_GetConfig); | |
113 RegisterCommand(1, 4, 2351, "AutoCharTime", (CmdImpl) &Text::impl_GetConfig); | |
114 RegisterCommand(1, 4, 2352, "AutoBaseTime", (CmdImpl) &Text::impl_GetConfig); | |
115 | |
116 RegisterCommand(1, 4, 2223, "SetMessageSpeed", (CmdImpl) &Text::impl_SetConfig); | |
117 RegisterCommand(1, 4, 2224, "SetMessageNoWait", (CmdImpl) &Text::impl_SetConfig); | |
118 RegisterCommand(1, 4, 2250, "SetAutoMode", (CmdImpl) &Text::impl_SetConfig); | |
119 RegisterCommand(1, 4, 2251, "SetAutoCharTime", (CmdImpl) &Text::impl_SetConfig); | |
120 RegisterCommand(1, 4, 2252, "SetAutoBaseTime", (CmdImpl) &Text::impl_SetConfig); | |
121 | |
122 RegisterCommand(1, 4, 1300, "GetName", (CmdImpl) &Text::impl_GetName); | |
123 RegisterCommand(1, 4, 1301, "SetName", (CmdImpl) &Text::impl_SetName); | |
124 RegisterCommand(1, 4, 1310, "GetLocalName", (CmdImpl) &Text::impl_GetLocalName); | |
125 RegisterCommand(1, 4, 1311, "SetLocalName", (CmdImpl) &Text::impl_SetLocalName); | |
126 | |
104 RegisterCommand(0, 2, 1, "select", (CmdImpl) &Text::impl_createSelect); | 127 RegisterCommand(0, 2, 1, "select", (CmdImpl) &Text::impl_createSelect); |
105 RegisterCommand(0, 2, 3, "select2?", (CmdImpl) &Text::impl_createSelect); //FIXME: What difference with select? | 128 RegisterCommand(0, 2, 3, "select2?", (CmdImpl) &Text::impl_createSelect); //FIXME: What difference with select? |
106 | 129 |
107 RegisterCommand(0, 4, 1000, "ShowBackground", (CmdImpl) &Text::impl_ShowBackground); | 130 RegisterCommand(0, 4, 1000, "ShowBackground", (CmdImpl) &Text::impl_ShowBackground); |
108 RegisterCommand(0, 4, 1100, "SetSkipMode", (CmdImpl) &Text::impl_SetSkipMode); | 131 RegisterCommand(0, 4, 1100, "SetSkipMode", (CmdImpl) &Text::impl_SetSkipMode); |
132 | |
133 RegisterCommand(1, 4, 2260, "SetWindowAttrR", (CmdImpl) &Text::impl_SetWindowAttr); | |
134 RegisterCommand(1, 4, 2261, "SetWindowAttrG", (CmdImpl) &Text::impl_SetWindowAttr); | |
135 RegisterCommand(1, 4, 2262, "SetWindowAttrB", (CmdImpl) &Text::impl_SetWindowAttr); | |
136 RegisterCommand(1, 4, 2263, "SetWindowAttrA", (CmdImpl) &Text::impl_SetWindowAttr); | |
137 RegisterCommand(1, 4, 2264, "SetWindowAttrF", (CmdImpl) &Text::impl_SetWindowAttr); | |
138 RegisterCommand(1, 4, 2267, "SetWindowAttr", (CmdImpl) &Text::impl_SetWindowAttr); | |
139 RegisterCommand(1, 4, 2367, "GetWindowAttr", (CmdImpl) &Text::impl_GetWindowAttr); | |
140 RegisterCommand(1, 4, 2617, "DefWindowAttr", (CmdImpl) &Text::impl_GetWindowAttr); | |
141 | |
109 RegisterCommand(1, 4, 100, "wait", (CmdImpl) &Text::impl_Wait); | 142 RegisterCommand(1, 4, 100, "wait", (CmdImpl) &Text::impl_Wait); |
110 RegisterCommand(1, 4, 111, "time", (CmdImpl) &Text::impl_Wait); | 143 RegisterCommand(1, 4, 111, "time", (CmdImpl) &Text::impl_Wait); |
111 RegisterCommand(1, 4, 121, "timeEx", (CmdImpl) &Text::impl_Wait); | 144 RegisterCommand(1, 4, 121, "timeEx", (CmdImpl) &Text::impl_Wait); |
112 | |
113 RegisterCommand(1, 4, 101, "waitC", (CmdImpl) &Text::impl_Wait); | 145 RegisterCommand(1, 4, 101, "waitC", (CmdImpl) &Text::impl_Wait); |
114 RegisterCommand(1, 4, 112, "timeC", (CmdImpl) &Text::impl_Wait); | 146 RegisterCommand(1, 4, 112, "timeC", (CmdImpl) &Text::impl_Wait); |
115 RegisterCommand(1, 4, 131, "GetClick", (CmdImpl) &Text::impl_GetClick); | 147 RegisterCommand(1, 4, 131, "GetClick", (CmdImpl) &Text::impl_GetClick); |
116 | 148 |
149 RegisterCommand(1, 4, 364, "PauseCursor", (CmdImpl) &Text::impl_PauseCursor); | |
150 RegisterCommand(1, 4, 3009, "load", (CmdImpl) &Text::impl_load); | |
151 | |
152 RegisterCommand(1, 4, 500, "InitFrame", (CmdImpl) &Text::impl_InitFrame); | |
117 RegisterCommand(1, 4, 510, "ReadFrame", (CmdImpl) &Text::impl_ReadFrame); | 153 RegisterCommand(1, 4, 510, "ReadFrame", (CmdImpl) &Text::impl_ReadFrame); |
154 RegisterCommand(1, 4, 620, "InitExFrames", (CmdImpl) &Text::impl_InitFrames); | |
155 RegisterCommand(1, 4, 624, "InitExFramesDecel", NULL); | |
156 RegisterCommand(1, 4, 630, "ReadExFrames", (CmdImpl) &Text::impl_ReadFrames); | |
157 | |
158 RegisterCommand(1, 4, 110, "ResetTimer", (CmdImpl) &Text::impl_ResetTimer); | |
159 RegisterCommand(1, 4, 120, "ResetExTimer", (CmdImpl) &Text::impl_ResetTimer); | |
160 RegisterCommand(1, 4, 114, "Timer", (CmdImpl) &Text::impl_Timer); | |
161 | |
162 RegisterCommand(1, 4, 800, "index_series", (CmdImpl) &Text::impl_index_series); | |
163 | |
164 RegisterCommand(1, 4, 1000, "rnd", (CmdImpl) &Text::impl_rnd); | |
165 RegisterCommand(1, 4, 1001, "pcnt", (CmdImpl) &Text::impl_pcnt); | |
166 RegisterCommand(1, 4, 1002, "abs", (CmdImpl) &Text::impl_abs); | |
167 RegisterCommand(1, 4, 1003, "power", NULL); | |
168 RegisterCommand(1, 4, 1004, "sin", NULL); | |
169 RegisterCommand(1, 4, 1007, "min", (CmdImpl) &Text::impl_min); | |
170 RegisterCommand(1, 4, 1008, "max", (CmdImpl) &Text::impl_max); | |
171 RegisterCommand(1, 4, 1009, "constrain", (CmdImpl) &Text::impl_constrain); | |
118 } | 172 } |
119 | 173 |
120 Text::~Text() { | 174 Text::~Text() { |
121 if (sel_widget != NULL) | 175 if (sel_widget != NULL) |
122 delete sel_widget; | 176 delete sel_widget; |
731 } | 785 } |
732 | 786 |
733 if (cmd.cmd_type != CMD_OTHER) return; | 787 if (cmd.cmd_type != CMD_OTHER) return; |
734 | 788 |
735 CommandHandler::Exec(cmd); | 789 CommandHandler::Exec(cmd); |
736 | |
737 //RegisterCommand(1, 4, 110, "ResetTimer", NULL); | |
738 //RegisterCommand(1, 4, 120, "ResetExTimer", NULL); | |
739 if (cmd.cmd1 == 1 && cmd.cmd2 == 4) { | |
740 /* ウェイト関連命令 */ | |
741 if (cmd.cmd3 == 0x6e || cmd.cmd3 == 0x78) { // set basetime | |
742 if (cmd.cmd4 == 1) { | |
743 eprintf("set basetime\n"); | |
744 base_time = old_time; | |
745 cmd.clear(); | |
746 } else if (cmd.cmd4 == 0) { // n-th base time | |
747 int index = cmd.args[0].value; | |
748 eprintf("set basetime (%d)\n",index); | |
749 TimerAtom& atom = timer_var[index]; | |
750 atom.from = 0; | |
751 atom.to = 0; | |
752 atom.total_time = 0; | |
753 atom.start_time = old_time; | |
754 cmd.clear(); | |
755 } | |
756 } else if (cmd.cmd3 == 0x72 || cmd.cmd3 == 0x7c) { // get time | |
757 if (cmd.cmd4 == 1) { // get time | |
758 eprintf("get time\n"); | |
759 cmd.SetSysvar(old_time - base_time); | |
760 } else if (cmd.cmd4 == 0) { // n-th get time | |
761 int index = cmd.args[0].value; | |
762 eprintf("get time %dth\n",index); | |
763 if (timer_var.find(index) == timer_var.end()) cmd.SetSysvar(0); | |
764 else cmd.SetSysvar(old_time - timer_var[index].start_time); | |
765 } | |
766 } else if (cmd.cmd3 == 0x26c || cmd.cmd3 == 0x270) { // set basetime(multi) | |
767 int j = 0; | |
768 eprintf("set basetime\n"); | |
769 int i; for (i=0; i<cmd.argc; i++) { | |
770 int cnt = cmd.args[j++].value; // 3なので無視 | |
771 int num = cmd.args[j++].value; | |
772 TimerAtom& atom = timer_var[num]; | |
773 atom.from = cmd.args[j++].value; | |
774 atom.to = cmd.args[j++].value; | |
775 atom.total_time = cmd.args[j++].value; | |
776 atom.start_time = old_time; | |
777 } | |
778 cmd.clear(); | |
779 } else if (cmd.cmd3 == 0x276) { // get time (multi) | |
780 eprintf("get timer value\n"); | |
781 vector<VarInfo> args = cmd.args; | |
782 vector<VarInfo>::iterator it = args.begin(); | |
783 int argc = cmd.argc; | |
784 int active_timers = 0; | |
785 int i; for (i=0; i<argc; i++) { | |
786 int cnt = (it++)->value; | |
787 int num = (it++)->value; | |
788 | |
789 if (timer_var.find(num) == timer_var.end()) { | |
790 cmd.SetFlagvar(*it++, 0); | |
791 } else { | |
792 TimerAtom& atom = timer_var[num]; | |
793 if (atom.total_time <= 0) atom.total_time = 1; | |
794 int cur_tm = old_time - atom.start_time; | |
795 if (cur_tm < 0) cur_tm = atom.total_time; // エラーなら最終時間に合わせる | |
796 if (cur_tm > atom.total_time) cur_tm = atom.total_time; | |
797 // use 'long long'(64bit) or 'double'(80bit) type, since total_time, to and from is 32 bit. | |
798 int v = atom.from + (long long)(atom.to-atom.from)*cur_tm/int(atom.total_time); | |
799 cmd.SetFlagvar(*it++, v); | |
800 if (atom.total_time != -1 && cur_tm < atom.total_time) active_timers++; | |
801 } | |
802 } | |
803 if (active_timers) active_timers = 1; | |
804 cmd.SetSysvar(active_timers); | |
805 } else if (cmd.cmd3 == 0x1f4) { | |
806 TimerAtom& atom = timer_var[cmd.args[0].value]; | |
807 atom.from = cmd.args[1].value; | |
808 atom.to = cmd.args[2].value; | |
809 atom.total_time = cmd.args[3].value; | |
810 atom.start_time = old_time; | |
811 cmd.clear(); | |
812 } else if (cmd.cmd3 == 0x3e8) { | |
813 /* rand() */ | |
814 int min = 0, max; | |
815 if (cmd.args.size() == 2) { | |
816 min = cmd.args[0].value; | |
817 max = cmd.args[1].value; | |
818 } else { | |
819 max = cmd.args[1].value; | |
820 } | |
821 if (min > max) { | |
822 int tmp = max; | |
823 max = min; | |
824 min = tmp; | |
825 } | |
826 int r = random(); | |
827 if (min == max) r = min; | |
828 else r = (r % (max-min)) + min; | |
829 cmd.SetSysvar(r); | |
830 } else if (cmd.cmd3 == 0x3ea) { | |
831 int val = cmd.args[0].value; | |
832 if (val < 0) val = -val; | |
833 cmd.SetSysvar(val); | |
834 } else if (cmd.cmd3 == 0x3ec) { | |
835 /* min だよなあ・・・*/ | |
836 int min = cmd.args[0].value; | |
837 int max = cmd.args[1].value; | |
838 if (max < min) min = max; | |
839 cmd.SetSysvar(min); | |
840 } else if (cmd.cmd3 == 0x3ef) { | |
841 /* min */ | |
842 int min = cmd.args[0].value; | |
843 int max = cmd.args[1].value; | |
844 if (max < min) min = max; | |
845 cmd.SetSysvar(min); | |
846 } else if (cmd.cmd3 == 0x320) { | |
847 /* range conversion : 比率に丸める */ | |
848 // アルゴリズムは間違えてるような気がする | |
849 // | |
850 if (cmd.args.size() >= 7) { | |
851 int val = cmd.args[0].value; | |
852 int offset = cmd.args[1].value; | |
853 int r_min = cmd.args[2].value; | |
854 int v_min = cmd.args[3].value; | |
855 int v_max = cmd.args[4].value; | |
856 int r_max = cmd.args[5].value; | |
857 int mode = cmd.args[6].value; | |
858 // rldev : mode == 1,3 : 'acceralating curve', 2,3: 'decelerating curve' | |
859 // 複数の引数リスト(r_minからmodeまでのリスト)もつこともあり、その場合は | |
860 // "cancel out in some way" らしい | |
861 if (mode == 1 || mode == 3) val += offset; | |
862 else if (mode == 2 || mode == 4) val -= offset; | |
863 if (cmd.args.size() != 7) | |
864 fprintf(stderr,"\n%d/%d: cmd 01-04:0320 : XXXX NOT SUPPORTED LIST : DOUBLE RANGE CONVERSION! XXXXXXXXXXX\n",cmd.scn,cmd.pos); | |
865 if (val < v_min) val = v_min; | |
866 if (val > v_max) val = v_max; | |
867 val = (r_max-r_min)*(val-v_min)/(v_max-v_min) + r_min; | |
868 cmd.SetSysvar(val); | |
869 } | |
870 } else if (cmd.cmd3 == 0x3f1) { | |
871 /* range 内に丸める */ | |
872 int min = cmd.args[0].value; | |
873 int val = cmd.args[1].value; | |
874 int max = cmd.args[2].value; | |
875 if (min > max) { | |
876 int tmp = max; | |
877 max = min; | |
878 min = tmp; | |
879 } | |
880 if (val < min) val = min; | |
881 if (val > max) val = max; | |
882 cmd.SetSysvar(val); | |
883 } else if (cmd.cmd3 == 0x16c && cmd.cmd4 == 0) { | |
884 /* なんかよくわからないけどカーソル形状変更にしとく */ | |
885 SetCursor(cmd.args[0].value); | |
886 cmd.clear(); | |
887 } else if (cmd.cmd3 == 0x0bc1) { // メニューからのロード | |
888 cmd.cmd_type = CMD_LOADREQ; | |
889 } else if ( (cmd.cmd3 >= 0x8d4 && cmd.cmd3 <= 0x8d8) || cmd.cmd3 == 0x8db || cmd.cmd3 == 0x93f || cmd.cmd3 == 0xa39) { | |
890 // テキストウィンドウの色設定 | |
891 int r, g, b, a, flag; | |
892 if (cmd.cmd3 == 0xa39) { // 元設定を取り出す | |
893 config->GetOriginalParam("#WINDOW_ATTR", 5, &r, &g, &b, &a, &flag); | |
894 } else { | |
895 config->GetParam("#WINDOW_ATTR", 5, &r, &g, &b, &a, &flag); | |
896 } | |
897 if (cmd.cmd3 == 0xa39 || cmd.cmd3 == 0x93f) { // 設定を変数に取り出す | |
898 if (cmd.args.size() != 5) { | |
899 fprintf(stderr,"cmd 01-04:%4d : invalid arg size\n", cmd.cmd3); | |
900 } else { | |
901 vector<VarInfo> args(cmd.args); | |
902 cmd.SetFlagvar(args[0], r); | |
903 cmd.SetFlagvar(args[1], g); | |
904 cmd.SetFlagvar(args[2], b); | |
905 cmd.SetFlagvar(args[3], a); | |
906 cmd.SetFlagvar(args[4], flag); | |
907 } | |
908 } else { | |
909 switch(cmd.cmd3) { | |
910 case 0x8d4: r = cmd.args[0].value; break; | |
911 case 0x8d5: g = cmd.args[0].value; break; | |
912 case 0x8d6: b = cmd.args[0].value; break; | |
913 case 0x8d7: a = cmd.args[0].value; break; | |
914 case 0x8d8: flag = cmd.args[0].value; break; | |
915 case 0x8db: | |
916 r = cmd.args[0].value; | |
917 g = cmd.args[1].value; | |
918 b = cmd.args[2].value; | |
919 a = cmd.args[3].value; | |
920 flag = cmd.args[4].value; | |
921 break; | |
922 } | |
923 config->SetParam("#WINDOW_ATTR", 5, r, g, b, a, flag); | |
924 SetWindowColor(r, g, b, a, flag); | |
925 cmd.clear(); | |
926 } | |
927 } else if (cmd.cmd3 == 0xa28 || cmd.cmd3 == 0xa29 || cmd.cmd3 == 0xa2c || cmd.cmd3 == 0xa2d || cmd.cmd3 == 0xa2e) { | |
928 int v = 0; | |
929 switch(cmd.cmd3) { | |
930 case 0xa28: case 0xa2d: config->GetOriginalParam("#INIT_MESSAGE_SPEED", 1, &v); break; | |
931 case 0xa29: config->GetOriginalParam("#INIT_MESSAGE_SPEED_MOD", 1, &v); break; | |
932 case 0xa2c: config->GetOriginalParam("#MESSAGE_KEY_WAIT_USE", 1, &v); break; | |
933 case 0xa2e: config->GetOriginalParam("#MESSAGE_KEY_WAIT_TIME", 1, &v); break; | |
934 } | |
935 cmd.SetSysvar(v); | |
936 } else if (cmd.cmd3 == 0x913 || cmd.cmd3 == 0x914 || cmd.cmd3 == 0x92f || cmd.cmd3 == 0x8af || cmd.cmd3 == 0x8b0 || cmd.cmd3 == 0x8cb) { | |
937 // テキスト表示速度関連 | |
938 int m, speed; | |
939 config->GetParam("#INIT_MESSAGE_SPEED", 1, &speed); | |
940 config->GetParam("#INIT_MESSAGE_SPEED_MOD", 1, &m); | |
941 if (cmd.cmd3 == 0x913 || cmd.cmd3 == 0x92f) fprintf(stderr,"TEXT speed %d\n",speed); | |
942 else if (cmd.cmd3 == 0x914) fprintf(stderr,"TEXT mode %d\n",m); | |
943 else if (cmd.cmd3 == 0x8af || cmd.cmd3 == 0x8cb) fprintf(stderr,"TEXT %d, %d <- speed %d\n",m,speed,cmd.args[0].value); | |
944 else fprintf(stderr,"TEXT %d, %d <- mode %d\n",m,speed,cmd.args[0].value); | |
945 if (cmd.cmd3 == 0x913 || cmd.cmd3 == 0x92f) cmd.SetSysvar(speed); | |
946 else if (cmd.cmd3 == 0x914) cmd.SetSysvar(m); | |
947 else { | |
948 if (cmd.cmd3 == 0x8af || cmd.cmd3 == 0x8cb) speed = cmd.args[0].value; | |
949 else m = cmd.args[0].value; | |
950 if (speed < 10) speed = 10; | |
951 else if (speed > 1000) speed = 1000; | |
952 config->SetParam("#INIT_MESSAGE_SPEED", 1, speed); | |
953 config->SetParam("#INIT_MESSAGE_SPEED_MOD", 1, m); | |
954 if (m) speed = -1; | |
955 SetTextSpeed(speed); | |
956 cmd.clear(); | |
957 } | |
958 } else if (cmd.cmd3 == 0x92e || cmd.cmd3 == 0x930 || cmd.cmd3 == 0x8ca || cmd.cmd3 == 0x8cc) { | |
959 // テキストオートモード関連 | |
960 int m, wait; | |
961 config->GetParam("#MESSAGE_KEY_WAIT_USE", 1, &m); | |
962 config->GetParam("#MESSAGE_KEY_WAIT_TIME", 1, &wait); | |
963 if (cmd.cmd3 == 0x92e) fprintf(stderr,"AUTO mode %d\n",m); | |
964 else if (cmd.cmd3 == 0x930) fprintf(stderr,"AUTO wait %d\n",wait); | |
965 else if (cmd.cmd3 == 0x8ca) fprintf(stderr,"AUTO %d,%d <- mode %d\n",m,wait,cmd.args[0].value); | |
966 else fprintf(stderr,"AUTO %d,%d <- wait %d\n",m,wait,cmd.args[0].value); | |
967 | |
968 if (cmd.cmd3 == 0x92e) cmd.SetSysvar(m); | |
969 else if (cmd.cmd3 == 0x930) cmd.SetSysvar(wait); | |
970 else { | |
971 if (cmd.cmd3 == 0x8ca) m = cmd.args[0].value; | |
972 else wait = cmd.args[1].value; | |
973 if (wait < 0) wait = 0; | |
974 else if (wait > 60000) wait = 60000; | |
975 config->SetParam("#MESSAGE_KEY_WAIT_USE", 1, m); | |
976 config->SetParam("#MESSAGE_KEY_WAIT_TIME", 1, wait); | |
977 if (m) SetTextWait(wait); | |
978 else SetTextWait(-1); | |
979 cmd.clear(); | |
980 } | |
981 } else if (cmd.cmd3 == 0x51f && cmd.cmd4 == 0) { // replace_name2 の設定 | |
982 int n = cmd.args[0].value; | |
983 if (n>=0 && n<26) { | |
984 replace_name2[n] = cmd.Str(cmd.args[1]); | |
985 } | |
986 cmd.clear(); | |
987 } else if (cmd.cmd3 == 0x51e && cmd.cmd4 == 0) { // replace_name2 を得る | |
988 int n = cmd.args[0].value; | |
989 if (n >= 0 && n < 26) { | |
990 cmd.SetStrvar(cmd.args[1], replace_name2[n]); | |
991 } else { | |
992 cmd.SetStrvar(cmd.args[1], ""); | |
993 } | |
994 } else if (cmd.cmd3 == 0x514 && cmd.cmd4 == 0) { // replace_name を得る | |
995 int n = cmd.args[0].value; | |
996 if (n >= 0 && n < 26) { | |
997 cmd.SetStrvar(cmd.args[1], replace_name[n]); | |
998 } else { | |
999 cmd.SetStrvar(cmd.args[1], ""); | |
1000 } | |
1001 } | |
1002 } | |
1003 } | 790 } |
1004 | 791 |
1005 extern int print_blit; | 792 extern int print_blit; |
1006 bool Text::Wait(unsigned int current_time, Cmd& cmd) { | 793 bool Text::Wait(unsigned int current_time, Cmd& cmd) { |
1007 if (current_time != Event::Time::NEVER_WAKE) old_time = current_time; | 794 if (current_time != Event::Time::NEVER_WAKE) old_time = current_time; |