comparison scn2k/scn2k_text.cc @ 57:6d9146f56ccf

* Move some opcodes * Merge last changes from xclannad
author Thibaut GIRKA <thib@sitedethib.com>
date Sat, 14 Nov 2009 23:31:51 +0100
parents c7bcc0ec2267
children 0aaa5bb3dde5
comparison
equal deleted inserted replaced
56:c7bcc0ec2267 57:6d9146f56ccf
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(0, 2, 1, "select", (CmdImpl) &Text::impl_createSelect); 104 RegisterCommand(0, 2, 1, "select", (CmdImpl) &Text::impl_createSelect);
105 RegisterCommand(0, 2, 3, "select2?", (CmdImpl) &Text::impl_createSelect); //What difference with select? 105 RegisterCommand(0, 2, 3, "select2?", (CmdImpl) &Text::impl_createSelect); //FIXME: What difference with select?
106 106
107 RegisterCommand(0, 4, 1000, "ShowBackground", (CmdImpl) &Text::impl_ShowBackground); 107 RegisterCommand(0, 4, 1000, "ShowBackground", (CmdImpl) &Text::impl_ShowBackground);
108 RegisterCommand(0, 4, 1100, "SetSkipMode", (CmdImpl) &Text::impl_SetSkipMode); 108 RegisterCommand(0, 4, 1100, "SetSkipMode", (CmdImpl) &Text::impl_SetSkipMode);
109 RegisterCommand(1, 4, 100, "wait", (CmdImpl) &Text::impl_Wait); 109 RegisterCommand(1, 4, 100, "wait", (CmdImpl) &Text::impl_Wait);
110 RegisterCommand(1, 4, 111, "time", (CmdImpl) &Text::impl_Wait); 110 RegisterCommand(1, 4, 111, "time", (CmdImpl) &Text::impl_Wait);
111 RegisterCommand(1, 4, 121, "timeEx", (CmdImpl) &Text::impl_Wait); 111 RegisterCommand(1, 4, 121, "timeEx", (CmdImpl) &Text::impl_Wait);
112
113 RegisterCommand(1, 4, 101, "waitC", (CmdImpl) &Text::impl_Wait);
114 RegisterCommand(1, 4, 112, "timeC", (CmdImpl) &Text::impl_Wait);
115 RegisterCommand(1, 4, 131, "GetClick", (CmdImpl) &Text::impl_GetClick);
116
117 RegisterCommand(1, 4, 510, "ReadFrame", (CmdImpl) &Text::impl_ReadFrame);
112 } 118 }
113 119
114 Text::~Text() { 120 Text::~Text() {
115 if (sel_widget != NULL) 121 if (sel_widget != NULL)
116 delete sel_widget; 122 delete sel_widget;
726 732
727 if (cmd.cmd_type != CMD_OTHER) return; 733 if (cmd.cmd_type != CMD_OTHER) return;
728 734
729 CommandHandler::Exec(cmd); 735 CommandHandler::Exec(cmd);
730 736
737 //RegisterCommand(1, 4, 110, "ResetTimer", NULL);
738 //RegisterCommand(1, 4, 120, "ResetExTimer", NULL);
731 if (cmd.cmd1 == 1 && cmd.cmd2 == 4) { 739 if (cmd.cmd1 == 1 && cmd.cmd2 == 4) {
732 /* ウェイト関連命令 */ 740 /* ウェイト関連命令 */
733 if (cmd.cmd3 == 0x65 || cmd.cmd3 == 0x70) { 741 if (cmd.cmd3 == 0x6e || cmd.cmd3 == 0x78) { // set basetime
734 eprintf("wait %dmsec(click stop)\n",cmd.args[0].value);
735 if (cmd.cmd3 == 0x70) wait_time = base_time + cmd.args[0].value;
736 else wait_time = old_time + cmd.args[0].value;
737 status = WAIT_CLICK;
738 cmd.cmd_type = CMD_WAITFRAMEUPDATE; // 画像描画に戻る(skip時にテキストが描画されやすくするため)
739 } else if (cmd.cmd3 == 0x83) {
740 /* マウスがクリックされるまで待つ */
741 eprintf("wait and get mouse pos at click\n");
742 wait_time = old_time + 1000 * 1000;
743 status = WAIT_CLICK_MOUSEPOS;
744 wait_savedvar[0] = cmd.args[0];
745 wait_savedvar[1] = cmd.args[1];
746 cmd.clear();
747 } else if (cmd.cmd3 == 0x1fe) {
748 eprintf("get timer value[%d]\n",cmd.args[0].value);
749 if (timer_var.find(cmd.args[0].value) == timer_var.end()) {
750 cmd.SetSysvar(0);
751 } else {
752 TimerAtom& atom = timer_var[cmd.args[0].value];
753 if (atom.total_time <= 0) atom.total_time = 1;
754 int cur_tm = old_time - atom.start_time;
755 if (cur_tm < 0) cur_tm = atom.total_time; // エラーなら最終時間に合わせる
756 if (cur_tm > atom.total_time) cur_tm = atom.total_time;
757 // use 'long long'(64bit) or 'double'(80bit) type, since total_time, to and from is 32 bit.
758 int v = atom.from + (long long)(atom.to-atom.from)*cur_tm/int(atom.total_time);
759 cmd.SetSysvar(v);
760 }
761 /* From rldev-1.40, reallive.kfn
762 0x72 fun Timer (store) <1:Sys:00114, 1> ('counter') ()
763 0x73 fun CmpTimer (store) <1:Sys:00115, 1> ('time') ('time', 'counter')
764 0x74 fun SetTimer <1:Sys:00116, 1> ('time') ('time', 'counter')
765
766 0x78 fun ResetExTimer <1:Sys:00120, 1> ('counter') ()
767 0x79 fun timeEx <1:Sys:00121, 1> ('time') ('time', 'counter')
768 0x7a fun timeExC (store) <1:Sys:00122, 1> ('time') ('time', 'counter')
769 0x7b fun timeExC2 (store) <1:Sys:00123, 1> ('time') ('time', 'counter') // UNDOCUMENTED
770 0x7c fun ExTimer (store) <1:Sys:00124, 1> ('counter') ()
771 0x7d fun CmpExTimer (store) <1:Sys:00125, 1> ('time') ('time', 'counter')
772 0x7e fun SetExTimer <1:Sys:00126, 1> ('time') ('time', 'counter')
773 */
774
775 } else if (cmd.cmd3 == 0x6e || cmd.cmd3 == 0x78) { // set basetime
776 if (cmd.cmd4 == 1) { 742 if (cmd.cmd4 == 1) {
777 eprintf("set basetime\n"); 743 eprintf("set basetime\n");
778 base_time = old_time; 744 base_time = old_time;
779 cmd.clear(); 745 cmd.clear();
780 } else if (cmd.cmd4 == 0) { // n-th base time 746 } else if (cmd.cmd4 == 0) { // n-th base time