annotate scn2k/scn2k_textimpl.cc @ 65:4416cfac86ae

Convert EUC-JP files to UTF8
author Thibaut Girka <thib@sitedethib.com>
date Fri, 26 Nov 2010 10:53:15 +0100
parents 36d92d21300f
children 043d5db57474
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 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
410 int val = 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
411 int offset = 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
412 int r_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
413 int v_min = 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
414 int v_max = 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
415 int r_max = cmd.args[5].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
416 int mode = cmd.args[6].value;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
417 // rldev : mode == 1,3 : 'acceralating curve', 2,3: 'decelerating curve'
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
418 // 複数の引数リスト(r_minからmodeまでのリスト)もつこともあり、その場合は
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
419 // "cancel out in some way" らしい
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
420 if (mode == 1 || mode == 3)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
421 val += offset;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
422 else if (mode == 2 || mode == 4)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
423 val -= offset;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
424 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
425 fprintf(stderr,"\n%d/%d: cmd 01-04:0320 : XXXX NOT SUPPORTED LIST : DOUBLE RANGE CONVERSION! XXXXXXXXXXX\n",cmd.scn,cmd.pos);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
426 if (val < v_min)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
427 val = v_min;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
428 if (val > v_max)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
429 val = v_max;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
430 val = (r_max-r_min)*(val-v_min)/(v_max-v_min) + r_min;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
431 cmd.SetSysvar(val);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
432 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
433 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
434
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
435 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
436 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
437 /* range 内に丸める */
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
438 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
439 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
440 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
441 if (min > max) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
442 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
443 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
444 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
445 if (val < min)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
446 val = min;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
447 if (val > max)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
448 val = max;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
449 cmd.SetSysvar(val);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
450 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
451
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
452
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
453 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
454 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
455 // メニューからのロード
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
456 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
457 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
458
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
459 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
460 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
461 // テキストウィンドウの色設定
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
462 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
463
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
464 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
465 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
466 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
467 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
468
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
469 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
470 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
471 } else {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
472 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
473 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
474 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
475 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
476 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
477 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
478 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
479 }
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 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
482 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
483 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
484 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
485
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
486 switch(cmd.cmd3) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
487 case 2260:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
488 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
489 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
490 case 2261:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
491 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
492 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
493 case 2262:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
494 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
495 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
496 case 2263:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
497 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
498 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
499 case 2264:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
500 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
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 2267:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
503 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
504 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
505 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
506 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
507 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
508 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
509 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
510 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
511 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
512 cmd.clear();
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
513 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
514
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
515 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
516 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
517 int v = 0;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
518 switch(cmd.cmd3) {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
519 case 2600:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
520 case 2605:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
521 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
522 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
523 case 2601:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
524 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
525 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
526 case 2604:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
527 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
528 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
529 case 2606:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
530 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
531 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
532 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
533 cmd.SetSysvar(v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
534 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
535
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
536 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
537 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
538 int v;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
539 switch (cmd.cmd3)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
540 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
541 case 2323:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
542 case 2351:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
543 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
544 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
545 case 2324:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
546 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
547 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
548 case 2350:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
549 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
550 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
551 case 2352:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
552 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
553 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
554 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
555
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
556 cmd.SetSysvar(v);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
557 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
558
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
559 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
560 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
561 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
562 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
563 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
564 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
565 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
566 switch (cmd.cmd3)
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 case 2223:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
569 case 2251:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
570 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
571 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
572 speed = 10;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
573 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
574 speed = 10000;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
575 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
576 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
577 case 2224:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
578 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
579 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
580 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
581 case 2250:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
582 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
583 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
584 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
585 case 2252:
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
586 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
587 if (wait < 0)
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
588 wait = 0;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
589 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
590 wait = 60000;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
591 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
592 break;
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
593 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
594
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
595 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
596 SetTextSpeed(-1);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
597 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
598 SetTextSpeed(speed);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
599
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
600 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
601 SetTextWait(wait);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
602 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
603 SetTextWait(-1);
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
604
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
605 cmd.clear();
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
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
608 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
609 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
610 // replace_name を得る
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
611 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
612 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
613 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
614 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
615 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
616 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
617
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
618 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
619 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
620 // replace_name を得る
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
621 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
622 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
623 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
624 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
625
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
626 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
627 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
628 // replace_name2 を得る
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
629 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
630 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
631 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
632 else
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
633 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
634 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
635
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
636 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
637 {
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
638 // replace_name2 の設定
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
639 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
640 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
641 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
642
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
643 cmd.clear();
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
644 }
0aaa5bb3dde5 Moved all opcodes from scn2k_text.cc to scn2k_textimpl.cc
Thibaut GIRKA <thib@sitedethib.com>
parents: 57
diff changeset
645