comparison scn2k/scn2k_textimpl.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
182 cmd.clear(); 182 cmd.clear();
183 } 183 }
184 184
185 void Text::impl_Wait(Cmd& cmd) { 185 void Text::impl_Wait(Cmd& cmd) {
186 eprintf("wait %dmsec\n",cmd.args[0].value); 186 eprintf("wait %dmsec\n",cmd.args[0].value);
187
187 if (cmd.cmd3 == 100 && text != NULL) { 188 if (cmd.cmd3 == 100 && text != NULL) {
188 /* 0x64 だと文字描画中の待ちに使うことがある */ 189 /* 0x64 だと文字描画中の待ちに使うことがある */
189 text->StartText(text_stream); 190 text->StartText(text_stream);
190 text->wid->Flush(); 191 text->wid->Flush();
191 } 192 }
192 if (cmd.cmd3 == 111 || cmd.cmd3 == 121) 193
193 wait_time = base_time + cmd.args[0].value; //FIXME: second argument, counter 194 if (cmd.cmd3 == 111 || cmd.cmd3 == 112 || cmd.cmd3 == 121)
195 wait_time = base_time + cmd.args[0].value; //FIXME: second argument, counter. See ReadFrame for this
194 else 196 else
195 wait_time = old_time + cmd.args[0].value; 197 wait_time = old_time + cmd.args[0].value;
196 status = WAIT; 198
199 if (cmd.cmd3 == 101 || cmd.cmd3 == 112)
200 status = WAIT_CLICK;
201 else
202 status = WAIT;
203
197 cmd.cmd_type = CMD_WAITFRAMEUPDATE; // 画像描画に戻る(skip時にテキストが描画されやすくするため) 204 cmd.cmd_type = CMD_WAITFRAMEUPDATE; // 画像描画に戻る(skip時にテキストが描画されやすくするため)
198 } 205 }
206
207 void Text::impl_GetClick(Cmd& cmd) {
208 eprintf("wait and get mouse pos at click\n");
209 wait_time = old_time + 1000 * 1000;
210 status = WAIT_CLICK_MOUSEPOS;
211 wait_savedvar[0] = cmd.args[0];
212 wait_savedvar[1] = cmd.args[1];
213 cmd.clear();
214 }
215
216 void Text::impl_ReadFrame(Cmd& cmd) {
217 eprintf("get timer value[%d]\n",cmd.args[0].value);
218 if (timer_var.find(cmd.args[0].value) == timer_var.end())
219 cmd.SetSysvar(0);
220 else {
221 TimerAtom& atom = timer_var[cmd.args[0].value];
222 if (atom.total_time <= 0) atom.total_time = 1;
223 int cur_tm = old_time - atom.start_time;
224 if (cur_tm < 0) cur_tm = atom.total_time; // エラーなら最終時間に合わせる
225 if (cur_tm > atom.total_time) cur_tm = atom.total_time;
226 // use 'long long'(64bit) or 'double'(80bit) type, since total_time, to and from is 32 bit.
227 int v = atom.from + (long long)(atom.to-atom.from)*cur_tm/int(atom.total_time);
228 cmd.SetSysvar(v);
229 }
230 }
231