Mercurial > otakunoraifu
diff 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 |
line wrap: on
line diff
--- a/scn2k/scn2k_textimpl.cc +++ b/scn2k/scn2k_textimpl.cc @@ -184,15 +184,48 @@ void Text::impl_SetSkipMode(Cmd& cmd) { void Text::impl_Wait(Cmd& cmd) { eprintf("wait %dmsec\n",cmd.args[0].value); + if (cmd.cmd3 == 100 && text != NULL) { /* 0x64 だと文字描画中の待ちに使うことがある */ text->StartText(text_stream); text->wid->Flush(); } - if (cmd.cmd3 == 111 || cmd.cmd3 == 121) - wait_time = base_time + cmd.args[0].value; //FIXME: second argument, counter + + if (cmd.cmd3 == 111 || cmd.cmd3 == 112 || cmd.cmd3 == 121) + wait_time = base_time + cmd.args[0].value; //FIXME: second argument, counter. See ReadFrame for this else wait_time = old_time + cmd.args[0].value; - status = WAIT; + + if (cmd.cmd3 == 101 || cmd.cmd3 == 112) + status = WAIT_CLICK; + else + status = WAIT; + cmd.cmd_type = CMD_WAITFRAMEUPDATE; // 画像描画に戻る(skip時にテキストが描画されやすくするため) } + +void Text::impl_GetClick(Cmd& cmd) { + eprintf("wait and get mouse pos at click\n"); + wait_time = old_time + 1000 * 1000; + status = WAIT_CLICK_MOUSEPOS; + wait_savedvar[0] = cmd.args[0]; + wait_savedvar[1] = cmd.args[1]; + cmd.clear(); +} + +void Text::impl_ReadFrame(Cmd& cmd) { + eprintf("get timer value[%d]\n",cmd.args[0].value); + if (timer_var.find(cmd.args[0].value) == timer_var.end()) + cmd.SetSysvar(0); + else { + TimerAtom& atom = timer_var[cmd.args[0].value]; + if (atom.total_time <= 0) atom.total_time = 1; + int cur_tm = old_time - atom.start_time; + if (cur_tm < 0) cur_tm = atom.total_time; // エラーなら最終時間に合わせる + if (cur_tm > atom.total_time) cur_tm = atom.total_time; + // use 'long long'(64bit) or 'double'(80bit) type, since total_time, to and from is 32 bit. + int v = atom.from + (long long)(atom.to-atom.from)*cur_tm/int(atom.total_time); + cmd.SetSysvar(v); + } +} +