annotate scn2k/scn2k_textimpl.cc @ 68:043d5db57474

Fix index_series implementation (still incomplete)
author Thibaut Girka <thib@sitedethib.com>
date Wed, 23 Feb 2011 16:19:11 +0100
parents 36d92d21300f
children c3d4f9ee2cf1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
1 /*
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
2 * Copyright (c) 2009 Thibaut GIRKA
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
3 * Copyright (c) 2004-2006 Kazunori "jagarl" Ueno
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
4 * All rights reserved.
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
5 *
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
6 * Redistribution and use in source and binary forms, with or without
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
7 * modification, are permitted provided that the following conditions
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
8 * are met:
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
9 * 1. Redistributions of source code must retain the above copyright
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
10 * notice, this list of conditions and the following disclaimer.
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
11 * 2. Redistributions in binary form must reproduce the above copyright
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
12 * notice, this list of conditions and the following disclaimer in the
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
13 * documentation and/or other materials provided with the distribution.
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
14 * 3. The name of the author may not be used to endorse or promote products
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
15 * derived from this software without specific prior written permission.
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
16 *
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
27 */
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
28
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
29 #include "scn2k_text.h"
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
30
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
31 void Text::impl_txtClear(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
32 if (text != NULL) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
33 text->ResetFace();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
34 if (cmd.cmd2 == 3 && cmd.cmd3 == 151)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
35 text->wid->Clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
36 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
37 cur_backlog_item.face = "";
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
38 if (cmd.cmd2 == 3 && cmd.cmd3 == 151)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
39 text_stream.Clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
40 hide();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
41 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
42
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
43 void Text::impl_logKoe(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
44 // PlayKoe ; 声出力コマンドをチェックする */
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
45 cur_backlog_item.koe = cmd.args[0].value;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
46 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
47
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
48 void Text::impl_pause(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
49 if (text != NULL) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
50 eprintf("start\n");
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
51 text->StartText(text_stream);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
52 if (skip_mode & SKIP_TEXT) text->wid->Flush();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
53 else if (kcursor) kcursor->show();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
54 status = WAIT_TEXT;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
55 text_parsing = false;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
56 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
57 backlog_item = cur_backlog_item;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
58 if (cur_backlog_item.scn == 0 && cur_backlog_item.pos == -1) backlog_item.text = text_stream;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
59 cur_backlog_item.Clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
60
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
61 cmd.clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
62 cmd.cmd_type = CMD_WAITFRAMEUPDATE; // 画像描画に戻る(skip時にテキストが描画されやすくするため)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
63 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
64
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
65 void Text::impl_PauseCursor(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
66 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
67 /* なんかよくわからないけどカーソル形状変更にしとく */
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
68 SetCursor(cmd.args[0].value);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
69 cmd.clear();
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
70 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
71
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
72 void Text::impl_br(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
73 text_stream.AddReturn();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
74 cur_backlog_item.DeleteTextPos();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
75 cmd.clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
76 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
77
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
78 void Text::impl_FaceOpen(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
79 if (text == NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
80 show();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
81 string s = cmd.Str(cmd.args[0]);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
82 s += ".g00";
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
83 if (text != NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
84 text->ShowFace(s.c_str());
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
85 cur_backlog_item.face = s;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
86 cmd.cmd_type = CMD_SAVECMD_ONCE;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
87 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
88
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
89 void Text::impl_FaceClear(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
90 if (text == NULL)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
91 show();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
92 if (text)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
93 text->ResetFace();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
94 cur_backlog_item.face = "";
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
95 cmd.cmd_type = CMD_SAVECMD_ONCE;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
96 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
97
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
98 void Text::impl_doRuby(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
99 if (text == NULL) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
100 show();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
101 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
102 if (cmd.cmd4 == 1) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
103 ruby_text_flag = true;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
104 eprintf("SetRubyText.");
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
105 cmd.clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
106 } else if (cmd.cmd4 == 0) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
107 if (ruby_text.length() == 0) { // ルビを振るテキストがない
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
108 eprintf("Cannot find ruby text.\n");
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
109 return;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
110 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
111 if (cmd.args.size() != 1) return;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
112 char debug1[1024], debug2[1024];
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
113 kconv( (unsigned char*)ruby_text.c_str(), (unsigned char*)debug1);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
114 kconv( (unsigned char*)cmd.Str(cmd.args[0]), (unsigned char*)debug2);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
115 eprintf("SetRuby. %s, %s",debug1, debug2);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
116 text_stream.AddRuby(ruby_text.c_str(), cmd.Str(cmd.args[0]));
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
117 cur_backlog_item.DeleteTextPos();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
118 cmd.clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
119 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
120 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
121
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
122 void Text::impl_TextWindow(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
123 if (cmd.cmd4 == 0) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
124 eprintf("set text window <- %d\n",cmd.args[0].value);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
125 if (text != NULL) show(cmd.args[0].value);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
126 else text_window_number = cmd.args[0].value;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
127 } else if (cmd.cmd4 == 1) { // default value
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
128 eprintf("set text window <- default\n");
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
129 if (text != NULL) show(0);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
130 else text_window_number = 0;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
131 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
132 cmd.clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
133 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
134
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
135 void Text::impl_FastText(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
136 //I think it's broken. For now, it's disabled.
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
137 if (cmd.cmd3 == 103) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
138 // テキストウィンドウ表示?
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
139 show();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
140 // 表示の際はテキストをクリアしない?
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
141 // if (text) text->wid->Clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
142 // text_stream.Clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
143 cmd.clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
144 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
145 else if (cmd.cmd3 == 104) { // テキスト表示?
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
146 // 全テキスト表示
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
147 if (text != NULL) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
148 text->StartText(text_stream);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
149 text->wid->Flush();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
150 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
151 cmd.clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
152 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
153 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
154
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
155 void Text::impl_msgClear(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
156 show();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
157 if (text != NULL) text->wid->Clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
158 text_stream.Clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
159 cmd.clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
160 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
161
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
162 void Text::impl_createSelect(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
163 if (cmd.cmd4 == 0) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
164 // 選択肢
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
165 CreateSelect(cmd);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
166 //FIXME: Check if it's really clean
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
167 if (text_parsing) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
168 show();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
169 text->StartText(text_stream);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
170 if (skip_mode & SKIP_TEXT) text->wid->Flush();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
171 else if (kcursor) kcursor->hide();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
172 text_parsing = false;
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
173 text_stream.Clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
174 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
175 cmd.cmd_type = CMD_ROLLBACKPOINT; /* 選択肢はセーブ位置 / シナリオ巻き戻し位置 */
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
176 // cmd.clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
177 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
178 else
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
179 PrintCmd(cmd); //FIXME
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
180 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
181
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
182 void Text::impl_ShowBackground(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
183 status_mask = Status(CLEARSCR_MASK | status_mask);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
184 cmd.clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
185 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
186
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
187 void Text::impl_SetSkipMode(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
188 status_mask = Status(SKIPMASK | status_mask);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
189 cmd.clear();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
190 }
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
191
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
192 void Text::impl_Wait(Cmd& cmd) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
193 eprintf("wait %dmsec\n",cmd.args[0].value);
57
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
194
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
195 if (cmd.cmd3 == 100 && text != NULL) {
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
196 /* 0x64 だと文字描画中の待ちに使うことがある */
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
197 text->StartText(text_stream);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
198 text->wid->Flush();
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
199 }
57
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
200
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
201 if (cmd.cmd3 == 111 || cmd.cmd3 == 112 || cmd.cmd3 == 121)
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
202 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
203 int index;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
204 if (cmd.cmd4 == 1)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
205 index = 0;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
206 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
207 index = cmd.args[1].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
208 wait_time = timer_var[index].start_time + cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
209 }
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
210 else
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
211 wait_time = old_time + cmd.args[0].value;
57
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
212
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
213 if (cmd.cmd3 == 101 || cmd.cmd3 == 112)
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
214 status = WAIT_CLICK;
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
215 else
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
216 status = WAIT;
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
217
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
218 cmd.cmd_type = CMD_WAITFRAMEUPDATE; // 画像描画に戻る(skip時にテキストが描画されやすくするため)
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents:
diff changeset
219 }
57
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
220
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
221 void Text::impl_GetClick(Cmd& cmd) {
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
222 eprintf("wait and get mouse pos at click\n");
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
223 wait_time = old_time + 1000 * 1000;
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
224 status = WAIT_CLICK_MOUSEPOS;
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
225 wait_savedvar[0] = cmd.args[0];
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
226 wait_savedvar[1] = cmd.args[1];
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
227 cmd.clear();
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
228 }
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
229
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
230 void Text::impl_ResetTimer(Cmd& cmd) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
231 int index;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
232
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
233 if (cmd.cmd4 == 1)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
234 index = 0;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
235 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
236 index = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
237
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
238 eprintf("set basetime (%d)\n",index);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
239 //TODO: Handle EX timer set
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
240 TimerAtom& atom = timer_var[index];
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
241 atom.start_time = old_time;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
242
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
243 cmd.clear();
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
244 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
245
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
246 void Text::impl_Timer(Cmd& cmd) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
247 int index;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
248
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
249 if (cmd.cmd4 == 1)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
250 index = 0;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
251 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
252 index = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
253
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
254 eprintf("get time %dth\n",index);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
255 if (timer_var.find(index) == timer_var.end())
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
256 cmd.SetSysvar(0);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
257 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
258 cmd.SetSysvar(old_time - timer_var[index].start_time);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
259 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
260
57
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
261 void Text::impl_ReadFrame(Cmd& cmd) {
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
262 eprintf("get timer value[%d]\n", cmd.args[0].value);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
263 if (frame_var.find(cmd.args[0].value) == frame_var.end())
57
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
264 cmd.SetSysvar(0);
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
265 else {
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
266 FrameTimerAtom& atom = frame_var[cmd.args[0].value];
57
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
267 if (atom.total_time <= 0) atom.total_time = 1;
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
268 int cur_tm = old_time - atom.start_time;
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
269 if (cur_tm < 0) cur_tm = atom.total_time; // エラーなら最終時間に合わせる
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
270 if (cur_tm > atom.total_time) cur_tm = atom.total_time;
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
271 // use 'long long'(64bit) or 'double'(80bit) type, since total_time, to and from is 32 bit.
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
272 int v = atom.from + (long long)(atom.to - atom.from)*cur_tm/int(atom.total_time);
57
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
273 cmd.SetSysvar(v);
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
274 }
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
275 }
6d9146f56ccf * Move some opcodes
Thibaut GIRKA <thib@sitedethib.com>
parents: 56
diff changeset
276
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
277 void Text::impl_InitFrame(Cmd& cmd) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
278 FrameTimerAtom& atom = frame_var[cmd.args[0].value];
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
279 atom.from = cmd.args[1].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
280 atom.to = cmd.args[2].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
281 atom.total_time = cmd.args[3].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
282 atom.start_time = old_time;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
283 cmd.clear();
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
284 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
285
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
286 void Text::impl_InitFrames(Cmd& cmd) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
287 int i, j = 0;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
288 for (i = 0; i < cmd.argc; i++)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
289 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
290 int cnt = cmd.args[j++].value; // £³€Ê€Î€Ç̵»ë
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
291 int num = cmd.args[j++].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
292 FrameTimerAtom& atom = frame_var[num];
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
293 atom.from = cmd.args[j++].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
294 atom.to = cmd.args[j++].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
295 atom.total_time = cmd.args[j++].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
296 atom.start_time = old_time;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
297 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
298 cmd.clear();
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
299 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
300
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
301 void Text::impl_ReadFrames(Cmd& cmd) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
302 vector<VarInfo> args = cmd.args;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
303 vector<VarInfo>::iterator it = args.begin();
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
304 int argc = cmd.argc;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
305 int timers_active = 0;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
306 int i;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
307 for (i=0; i < argc; i++)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
308 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
309 int cnt = (it++)->value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
310 int num = (it++)->value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
311
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
312 if (frame_var.find(num) == frame_var.end()) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
313 cmd.SetFlagvar(*it++, 0);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
314 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
315 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
316 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
317 FrameTimerAtom& atom = frame_var[num];
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
318 if (atom.total_time <= 0)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
319 atom.total_time = 1;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
320 int cur_tm = old_time - atom.start_time;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
321 if (cur_tm < 0)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
322 cur_tm = atom.total_time; // ¥š¥é¡Œ€Ê€éºÇœª»þŽÖ€Ë¹ç€ï€»€ë
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
323 if (cur_tm > atom.total_time)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
324 cur_tm = atom.total_time;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
325 // use 'long long'(64bit) or 'double'(80bit) type, since total_time, to and from is 32 bit.
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
326 int v = atom.from + (long long)(atom.to-atom.from)*cur_tm/int(atom.total_time);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
327 cmd.SetFlagvar(*it++, v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
328 if (atom.total_time != -1 && cur_tm < atom.total_time)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
329 timers_active = 1;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
330 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
331 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
332 cmd.SetSysvar(timers_active);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
333 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
334
59
36d92d21300f Implemented sin opcode
Thibaut GIRKA <thib@sitedethib.com>
parents: 58
diff changeset
335 #include "math.h"
36d92d21300f Implemented sin opcode
Thibaut GIRKA <thib@sitedethib.com>
parents: 58
diff changeset
336
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
337 void Text::impl_rnd(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
338 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
339 /* rand() */
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
340 int min, max;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
341 if (cmd.args.size() == 2)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
342 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
343 min = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
344 max = cmd.args[1].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
345 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
346 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
347 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
348 min = 0;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
349 max = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
350 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
351 if (min > max)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
352 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
353 int tmp = max;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
354 max = min;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
355 min = tmp;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
356 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
357 int r = random();
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
358 if (min == max)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
359 r = min;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
360 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
361 r = (r % (max-min)) + min;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
362 cmd.SetSysvar(r);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
363 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
364
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
365 void Text::impl_pcnt(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
366 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
367 cmd.SetSysvar(100 * cmd.args[0].value / cmd.args[1].value);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
368 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
369
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
370 void Text::impl_abs(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
371 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
372 cmd.SetSysvar(abs(cmd.args[0].value));
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
373 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
374
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
375 void Text::impl_power(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
376 {
59
36d92d21300f Implemented sin opcode
Thibaut GIRKA <thib@sitedethib.com>
parents: 58
diff changeset
377 cmd.SetSysvar(pow(cmd.args[0].value, cmd.args[1].value));
36d92d21300f Implemented sin opcode
Thibaut GIRKA <thib@sitedethib.com>
parents: 58
diff changeset
378 }
36d92d21300f Implemented sin opcode
Thibaut GIRKA <thib@sitedethib.com>
parents: 58
diff changeset
379
36d92d21300f Implemented sin opcode
Thibaut GIRKA <thib@sitedethib.com>
parents: 58
diff changeset
380 void Text::impl_sin(Cmd& cmd)
36d92d21300f Implemented sin opcode
Thibaut GIRKA <thib@sitedethib.com>
parents: 58
diff changeset
381 {
36d92d21300f Implemented sin opcode
Thibaut GIRKA <thib@sitedethib.com>
parents: 58
diff changeset
382 cmd.SetSysvar(sin(cmd.args[0].value * M_PI / 180) * 32640 / cmd.args[1].value);
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
383 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
384
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
385 void Text::impl_min(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
386 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
387 int a = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
388 int b = cmd.args[1].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
389 cmd.SetSysvar((a < b) ? a : b);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
390 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
391
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
392 void Text::impl_max(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
393 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
394 int a = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
395 int b = cmd.args[1].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
396 cmd.SetSysvar((a > b) ? a : b);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
397 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
398
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
399 void Text::impl_index_series(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
400 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
401 //TODO: This one is not fully documented in
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
402 // http://dev.haeleth.net/rldev/manual.html
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
403 // Try to figure out what's it...
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
404
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
405 /* range conversion : 比率に丸める */
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
406 // アルゴリズムは間違えてるような気がする
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
407 //
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
408 if (cmd.args.size() >= 7)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
409 {
68
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
410 int i, val;
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
411 int x, startval;
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
412 int start, end, endval, mode;
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
413
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
414 //TODO: why index and offset, and not x?
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
415 x = cmd.args[0].value + cmd.args[1].value;
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
416 startval = cmd.args[2].value;
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
417 start = end = 0;
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
418 val = endval = startval;
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
419 for (i=3; i < cmd.args.size(); i += 4)
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
420 {
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
421 startval = endval;
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
422 start = cmd.args[i].value;
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
423 end = cmd.args[i + 1].value;
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
424 endval = cmd.args[i + 2].value;
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
425 int mode = cmd.args[i + 3].value;
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
426 if (start <= x && x <= end)
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
427 {
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
428 // rldev : mode == 1,3 : 'acceralating curve', 2,3: 'decelerating curve'
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
429 // 複数の引数リスト(r_minからmodeまでのリスト)もつこともあり、その場合は
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
430 // "cancel out in some way" らしい
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
431 // Assume mode 0, as we only know of it
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
432 // TODO: find out how other mode works (exp/log?)
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
433 // TODO: "When two ranges overlap, they appear to cancel out in some way"
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
434 val = startval + (endval - startval) * (x - start) / (end - start);
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
435 }
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
436 }
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
437 if (i != cmd.args.size())
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
438 fprintf(stderr, "\n%d/%d: cmd 01-04:0320 : WARNING: %d unconsumed arguments\n", cmd.scn, cmd.pos, cmd.args.size() - i);
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
439 if (x > end)
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
440 x = endval;
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
441 cmd.SetSysvar(val);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
442 }
68
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
443 else
043d5db57474 Fix index_series implementation (still incomplete)
Thibaut Girka <thib@sitedethib.com>
parents: 59
diff changeset
444 fprintf(stderr, "\n%d/%d: cmd 01-04:0320 : Not enough arguments?!\n", cmd.scn, cmd.pos);
58
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
445 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
446
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
447 void Text::impl_constrain(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
448 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
449 /* range 内に丸める */
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
450 int min = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
451 int val = cmd.args[1].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
452 int max = cmd.args[2].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
453 if (min > max) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
454 max = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
455 min = cmd.args[2].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
456 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
457 if (val < min)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
458 val = min;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
459 if (val > max)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
460 val = max;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
461 cmd.SetSysvar(val);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
462 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
463
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
464
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
465 void Text::impl_load(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
466 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
467 // メニューからのロード
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
468 cmd.cmd_type = CMD_LOADREQ;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
469 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
470
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
471 void Text::impl_GetWindowAttr(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
472 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
473 // テキストウィンドウの色設定
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
474 int r, g, b, a, flag;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
475
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
476 if (cmd.cmd3 == 2617) // 元設定を取り出す
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
477 config->GetOriginalParam("#WINDOW_ATTR", 5, &r, &g, &b, &a, &flag);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
478 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
479 config->GetParam("#WINDOW_ATTR", 5, &r, &g, &b, &a, &flag);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
480
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
481 if (cmd.args.size() != 5) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
482 fprintf(stderr,"cmd 01-04:%4d : invalid arg size\n", cmd.cmd3);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
483 } else {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
484 vector<VarInfo> args(cmd.args);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
485 cmd.SetFlagvar(args[0], r);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
486 cmd.SetFlagvar(args[1], g);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
487 cmd.SetFlagvar(args[2], b);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
488 cmd.SetFlagvar(args[3], a);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
489 cmd.SetFlagvar(args[4], flag);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
490 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
491 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
492
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
493 void Text::impl_SetWindowAttr(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
494 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
495 int r, g, b, a, flag;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
496 config->GetParam("#WINDOW_ATTR", 5, &r, &g, &b, &a, &flag);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
497
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
498 switch(cmd.cmd3) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
499 case 2260:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
500 r = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
501 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
502 case 2261:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
503 g = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
504 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
505 case 2262:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
506 b = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
507 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
508 case 2263:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
509 a = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
510 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
511 case 2264:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
512 flag = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
513 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
514 case 2267:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
515 r = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
516 g = cmd.args[1].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
517 b = cmd.args[2].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
518 a = cmd.args[3].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
519 flag = cmd.args[4].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
520 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
521 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
522 config->SetParam("#WINDOW_ATTR", 5, r, g, b, a, flag);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
523 SetWindowColor(r, g, b, a, flag);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
524 cmd.clear();
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
525 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
526
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
527 void Text::impl_GetDefConfig(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
528 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
529 int v = 0;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
530 switch(cmd.cmd3) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
531 case 2600:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
532 case 2605:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
533 config->GetOriginalParam("#INIT_MESSAGE_SPEED", 1, &v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
534 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
535 case 2601:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
536 config->GetOriginalParam("#INIT_MESSAGE_SPEED_MOD", 1, &v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
537 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
538 case 2604:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
539 config->GetOriginalParam("#MESSAGE_KEY_WAIT_USE", 1, &v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
540 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
541 case 2606:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
542 config->GetOriginalParam("#MESSAGE_KEY_WAIT_TIME", 1, &v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
543 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
544 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
545 cmd.SetSysvar(v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
546 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
547
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
548 void Text::impl_GetConfig(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
549 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
550 int v;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
551 switch (cmd.cmd3)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
552 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
553 case 2323:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
554 case 2351:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
555 config->GetParam("#INIT_MESSAGE_SPEED", 1, &v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
556 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
557 case 2324:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
558 config->GetParam("#INIT_MESSAGE_SPEED_MOD", 1, &v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
559 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
560 case 2350:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
561 config->GetParam("#MESSAGE_KEY_WAIT_USE", 1, &v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
562 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
563 case 2352:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
564 config->GetParam("#MESSAGE_KEY_WAIT_TIME", 1, &v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
565 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
566 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
567
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
568 cmd.SetSysvar(v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
569 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
570
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
571 void Text::impl_SetConfig(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
572 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
573 int speed, use_speed_mod, wait, use_wait_mod;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
574 config->GetParam("#INIT_MESSAGE_SPEED", 1, &speed);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
575 config->GetParam("#INIT_MESSAGE_SPEED_MOD", 1, &use_speed_mod);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
576 config->GetParam("#MESSAGE_KEY_WAIT_USE", 1, &use_wait_mod);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
577 config->GetParam("#MESSAGE_KEY_WAIT_TIME", 1, &wait);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
578 switch (cmd.cmd3)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
579 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
580 case 2223:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
581 case 2251:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
582 speed = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
583 if (speed < 10) //FIXME: ??? 0 ???
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
584 speed = 10;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
585 if (speed > 10000) //FIXME: ??? 255 ???
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
586 speed = 10000;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
587 config->SetParam("#INIT_MESSAGE_SPEED", 1, speed);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
588 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
589 case 2224:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
590 use_speed_mod = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
591 config->SetParam("#INIT_MESSAGE_SPEED_MOD", 1, use_speed_mod);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
592 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
593 case 2250:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
594 use_wait_mod = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
595 config->SetParam("#MESSAGE_KEY_WAIT_USE", 1, use_wait_mod);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
596 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
597 case 2252:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
598 int wait = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
599 if (wait < 0)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
600 wait = 0;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
601 else if (wait > 60000)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
602 wait = 60000;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
603 config->SetParam("#MESSAGE_KEY_WAIT_TIME", 1, wait);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
604 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
605 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
606
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
607 if (use_speed_mod) // FIXME: Not the other way around?
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
608 SetTextSpeed(-1);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
609 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
610 SetTextSpeed(speed);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
611
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
612 if (use_wait_mod)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
613 SetTextWait(wait);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
614 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
615 SetTextWait(-1);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
616
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
617 cmd.clear();
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
618 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
619
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
620 void Text::impl_GetName(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
621 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
622 // replace_name を得る
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
623 int n = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
624 if (n >= 0 && n < 26) // FIXME: Should go up to 702, but otakunoraifu is not ready for that yet
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
625 cmd.SetStrvar(cmd.args[1], replace_name[n]);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
626 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
627 cmd.SetStrvar(cmd.args[1], "");
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
628 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
629
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
630 void Text::impl_SetName(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
631 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
632 // replace_name を得る
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
633 int n = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
634 if (n >= 0 && n < 26) // FIXME: Should go up to 702, but otakunoraifu is not ready for that yet
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
635 replace_name[n] = cmd.Str(cmd.args[1]);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
636 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
637
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
638 void Text::impl_GetLocalName(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
639 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
640 // replace_name2 を得る
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
641 int n = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
642 if (n >= 0 && n < 26) // FIXME: Should go up to 702, but otakunoraifu is not ready for that yet
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
643 cmd.SetStrvar(cmd.args[1], replace_name2[n]);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
644 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
645 cmd.SetStrvar(cmd.args[1], "");
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
646 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
647
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
648 void Text::impl_SetLocalName(Cmd& cmd)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
649 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
650 // replace_name2 の設定
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
651 int n = cmd.args[0].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
652 if (n >= 0 && n < 26) // FIXME: Should go up to 702, but otakunoraifu is not ready for that yet
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
653 replace_name2[n] = cmd.Str(cmd.args[1]);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
654
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
655 cmd.clear();
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
656 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
657