annotate scn2k/scn2k_grp.cc @ 56:c7bcc0ec2267

* replaced Grp and Text classes by the TextImpl and GrpImpl ones * splitted scn2k.h into smaller header files * moved some definitions from scn2k_*.cc to the header files * moved opcode implementation to scn2k_*impl.cc
author thib
date Thu, 30 Apr 2009 19:05:09 +0000
parents f1a27ee7e03c
children e16e13d8cd68
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
223b71206888 Initial import
thib
parents:
diff changeset
1 /*
223b71206888 Initial import
thib
parents:
diff changeset
2 * Copyright (c) 2004-2006 Kazunori "jagarl" Ueno
223b71206888 Initial import
thib
parents:
diff changeset
3 * All rights reserved.
223b71206888 Initial import
thib
parents:
diff changeset
4 *
223b71206888 Initial import
thib
parents:
diff changeset
5 * Redistribution and use in source and binary forms, with or without
223b71206888 Initial import
thib
parents:
diff changeset
6 * modification, are permitted provided that the following conditions
223b71206888 Initial import
thib
parents:
diff changeset
7 * are met:
223b71206888 Initial import
thib
parents:
diff changeset
8 * 1. Redistributions of source code must retain the above copyright
223b71206888 Initial import
thib
parents:
diff changeset
9 * notice, this list of conditions and the following disclaimer.
223b71206888 Initial import
thib
parents:
diff changeset
10 * 2. Redistributions in binary form must reproduce the above copyright
223b71206888 Initial import
thib
parents:
diff changeset
11 * notice, this list of conditions and the following disclaimer in the
223b71206888 Initial import
thib
parents:
diff changeset
12 * documentation and/or other materials provided with the distribution.
223b71206888 Initial import
thib
parents:
diff changeset
13 * 3. The name of the author may not be used to endorse or promote products
223b71206888 Initial import
thib
parents:
diff changeset
14 * derived from this software without specific prior written permission.
223b71206888 Initial import
thib
parents:
diff changeset
15 *
223b71206888 Initial import
thib
parents:
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
223b71206888 Initial import
thib
parents:
diff changeset
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
223b71206888 Initial import
thib
parents:
diff changeset
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
223b71206888 Initial import
thib
parents:
diff changeset
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
223b71206888 Initial import
thib
parents:
diff changeset
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
223b71206888 Initial import
thib
parents:
diff changeset
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
223b71206888 Initial import
thib
parents:
diff changeset
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
223b71206888 Initial import
thib
parents:
diff changeset
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
223b71206888 Initial import
thib
parents:
diff changeset
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
223b71206888 Initial import
thib
parents:
diff changeset
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
223b71206888 Initial import
thib
parents:
diff changeset
26 */
223b71206888 Initial import
thib
parents:
diff changeset
27
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
28 #include "scn2k.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
29 #include "system/file.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
30 #include "system/system_config.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
31 #include "font/text.h"
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
32 #include "window/render.h"
0
223b71206888 Initial import
thib
parents:
diff changeset
33
223b71206888 Initial import
thib
parents:
diff changeset
34 extern XKFont::HorizLayout* DefaultLayout(int text_size);
223b71206888 Initial import
thib
parents:
diff changeset
35
223b71206888 Initial import
thib
parents:
diff changeset
36 /*******************************************************************
223b71206888 Initial import
thib
parents:
diff changeset
37 ** GrpObj(implementation)
223b71206888 Initial import
thib
parents:
diff changeset
38 */
223b71206888 Initial import
thib
parents:
diff changeset
39
223b71206888 Initial import
thib
parents:
diff changeset
40 GrpObj::GrpObj(void) :
223b71206888 Initial import
thib
parents:
diff changeset
41 name(""), gan_name(""), pic_parent(0), picture(0), anm(0),
223b71206888 Initial import
thib
parents:
diff changeset
42 _posx(0), _posy(0), clip_area(0,0,0,0),
223b71206888 Initial import
thib
parents:
diff changeset
43 alpha(255), order(0), surface_num(0), print_moji(""), print_size(0), print_r(-1),print_g(-1),print_b(-1),
223b71206888 Initial import
thib
parents:
diff changeset
44 dig_number(0), dig_digit(0),
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
45 zoom(-1), rotate(-1), attr(GrpObj::HIDDEN) {
0
223b71206888 Initial import
thib
parents:
diff changeset
46 int i;
223b71206888 Initial import
thib
parents:
diff changeset
47 for (i=0; i<9; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
48 posx[i] = posy[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
49 }
223b71206888 Initial import
thib
parents:
diff changeset
50 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
51
0
223b71206888 Initial import
thib
parents:
diff changeset
52 GrpObj::~GrpObj() {
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
53 if (picture != NULL) delete picture;
0
223b71206888 Initial import
thib
parents:
diff changeset
54 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
55
0
223b71206888 Initial import
thib
parents:
diff changeset
56 int GrpObj::PosX() {
223b71206888 Initial import
thib
parents:
diff changeset
57 return _posx;
223b71206888 Initial import
thib
parents:
diff changeset
58 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
59
0
223b71206888 Initial import
thib
parents:
diff changeset
60 int GrpObj::PosY() {
223b71206888 Initial import
thib
parents:
diff changeset
61 return _posy;
223b71206888 Initial import
thib
parents:
diff changeset
62 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
63
0
223b71206888 Initial import
thib
parents:
diff changeset
64 void GrpObj::SetUpdate(void) {
223b71206888 Initial import
thib
parents:
diff changeset
65 attr = Attribute (attr | UPDATE_PICTURE);
18
4d7486cb20a9 Sync with upstream
thib
parents: 14
diff changeset
66 //Update(); //FIXME
0
223b71206888 Initial import
thib
parents:
diff changeset
67 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
68
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
69 void GrpObj::SetPos(int index, int x, int y) {
0
223b71206888 Initial import
thib
parents:
diff changeset
70 if (index < 0 || index > 8) {
223b71206888 Initial import
thib
parents:
diff changeset
71 fprintf(stderr,"GrpObj::SetPos: Invalid index %d <- %d,%d\n",index,x,y);
223b71206888 Initial import
thib
parents:
diff changeset
72 return;
223b71206888 Initial import
thib
parents:
diff changeset
73 }
223b71206888 Initial import
thib
parents:
diff changeset
74 if (x == posx[index] && y == posy[index]) return;
223b71206888 Initial import
thib
parents:
diff changeset
75 attr = Attribute(attr | UPDATE_POS);
223b71206888 Initial import
thib
parents:
diff changeset
76 _posx += x-posx[index];
223b71206888 Initial import
thib
parents:
diff changeset
77 _posy += y-posy[index];
223b71206888 Initial import
thib
parents:
diff changeset
78 posx[index] = x;
223b71206888 Initial import
thib
parents:
diff changeset
79 posy[index] = y;
223b71206888 Initial import
thib
parents:
diff changeset
80 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
81
0
223b71206888 Initial import
thib
parents:
diff changeset
82 void GrpObj::GetPos(int index, int& x, int& y) {
223b71206888 Initial import
thib
parents:
diff changeset
83 if (index < 0 || index > 8) {
223b71206888 Initial import
thib
parents:
diff changeset
84 fprintf(stderr,"GrpObj::GetPos: Invalid index %d\n",index);
223b71206888 Initial import
thib
parents:
diff changeset
85 x = 0; y = 0;
223b71206888 Initial import
thib
parents:
diff changeset
86 return;
223b71206888 Initial import
thib
parents:
diff changeset
87 }
223b71206888 Initial import
thib
parents:
diff changeset
88 x = posx[index];
223b71206888 Initial import
thib
parents:
diff changeset
89 y = posy[index];
223b71206888 Initial import
thib
parents:
diff changeset
90 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
91
0
223b71206888 Initial import
thib
parents:
diff changeset
92 void GrpObj::SetAlpha(int new_alpha) {
223b71206888 Initial import
thib
parents:
diff changeset
93 if (alpha == new_alpha) return;
223b71206888 Initial import
thib
parents:
diff changeset
94 alpha = new_alpha;
223b71206888 Initial import
thib
parents:
diff changeset
95 attr = Attribute(attr | UPDATE_ALPHA);
223b71206888 Initial import
thib
parents:
diff changeset
96 return;
223b71206888 Initial import
thib
parents:
diff changeset
97 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
98
0
223b71206888 Initial import
thib
parents:
diff changeset
99 void GrpObj::SetSurfaceNum(int num) {
223b71206888 Initial import
thib
parents:
diff changeset
100 if (num != -1) {
223b71206888 Initial import
thib
parents:
diff changeset
101 if (surface_num == num) return;
223b71206888 Initial import
thib
parents:
diff changeset
102 surface_num = num;
223b71206888 Initial import
thib
parents:
diff changeset
103 }
223b71206888 Initial import
thib
parents:
diff changeset
104 attr = Attribute(attr | UPDATE_SNUM);
223b71206888 Initial import
thib
parents:
diff changeset
105 }
223b71206888 Initial import
thib
parents:
diff changeset
106
223b71206888 Initial import
thib
parents:
diff changeset
107 void GrpObj::SetClipArea(int x, int y, int w, int h) {
223b71206888 Initial import
thib
parents:
diff changeset
108 Rect new_clip(x,y,x+w,y+h);
223b71206888 Initial import
thib
parents:
diff changeset
109 if (clip_area == new_clip) return;
223b71206888 Initial import
thib
parents:
diff changeset
110 clip_area = new_clip;
223b71206888 Initial import
thib
parents:
diff changeset
111 attr = Attribute(attr | UPDATE_CLIP);
223b71206888 Initial import
thib
parents:
diff changeset
112 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
113
0
223b71206888 Initial import
thib
parents:
diff changeset
114 PicBase* GrpObj::DeletePic(void) {
223b71206888 Initial import
thib
parents:
diff changeset
115 PicBase* p = picture;
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
116 anm = NULL;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
117 picture = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
118 src_pos.clear();
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
119 attr = Attribute(attr & HIDDEN);
0
223b71206888 Initial import
thib
parents:
diff changeset
120 return p;
223b71206888 Initial import
thib
parents:
diff changeset
121 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
122
0
223b71206888 Initial import
thib
parents:
diff changeset
123 void GrpObj::GetSrcGeom(int& width, int& height) {
223b71206888 Initial import
thib
parents:
diff changeset
124 if (src_pos.empty()) {
223b71206888 Initial import
thib
parents:
diff changeset
125 width = 0; height = 0;
223b71206888 Initial import
thib
parents:
diff changeset
126 if (name.length() == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
127 return;
223b71206888 Initial import
thib
parents:
diff changeset
128 }
223b71206888 Initial import
thib
parents:
diff changeset
129 /* ボタンの位置情報を求める */
223b71206888 Initial import
thib
parents:
diff changeset
130 /* g00 ファイルのヘッダ部分に位置情報は入っている */
223b71206888 Initial import
thib
parents:
diff changeset
131 string path(name);
223b71206888 Initial import
thib
parents:
diff changeset
132 path += ".g00";
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
133 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::PDT, path.c_str(), "g00");
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
134 if (info == NULL) { // ファイルが見つからない
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
135 fprintf(stderr, "GrpObj::GetSrcGeom : Cannot find file %s\n", path.c_str());
0
223b71206888 Initial import
thib
parents:
diff changeset
136 return;
223b71206888 Initial import
thib
parents:
diff changeset
137 }
223b71206888 Initial import
thib
parents:
diff changeset
138 const char* data = info->Read();
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
139 if (data != NULL && *data == 2) { // 画像ファイル内にボタン情報が存在する
0
223b71206888 Initial import
thib
parents:
diff changeset
140 int srclen = read_little_endian_int(data+5);
223b71206888 Initial import
thib
parents:
diff changeset
141 int i;
223b71206888 Initial import
thib
parents:
diff changeset
142 for (i=0; i<srclen; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
143 int x1 = read_little_endian_int(data+9+i*24+0);
223b71206888 Initial import
thib
parents:
diff changeset
144 int y1 = read_little_endian_int(data+9+i*24+4);
223b71206888 Initial import
thib
parents:
diff changeset
145 int x2 = read_little_endian_int(data+9+i*24+8);
223b71206888 Initial import
thib
parents:
diff changeset
146 int y2 = read_little_endian_int(data+9+i*24+12);
223b71206888 Initial import
thib
parents:
diff changeset
147 src_pos.push_back(Rect(x1, y1, x2+1, y2+1));
223b71206888 Initial import
thib
parents:
diff changeset
148 if (width < src_pos.back().width()) width = src_pos.back().width();
223b71206888 Initial import
thib
parents:
diff changeset
149 if (height < src_pos.back().height()) height = src_pos.back().height();
223b71206888 Initial import
thib
parents:
diff changeset
150 }
223b71206888 Initial import
thib
parents:
diff changeset
151 } else { // 画像ファイルから大きさ取得
223b71206888 Initial import
thib
parents:
diff changeset
152 width = read_little_endian_short(data+1);
223b71206888 Initial import
thib
parents:
diff changeset
153 height = read_little_endian_short(data+3);
223b71206888 Initial import
thib
parents:
diff changeset
154 src_pos.push_back(Rect(0,0,width,height));
223b71206888 Initial import
thib
parents:
diff changeset
155 }
223b71206888 Initial import
thib
parents:
diff changeset
156 delete info;
223b71206888 Initial import
thib
parents:
diff changeset
157 }
223b71206888 Initial import
thib
parents:
diff changeset
158 int sn = surface_num;
223b71206888 Initial import
thib
parents:
diff changeset
159 if (sn < 0 || sn > src_pos.size()) sn = 0;
223b71206888 Initial import
thib
parents:
diff changeset
160 width = src_pos[sn].width();
223b71206888 Initial import
thib
parents:
diff changeset
161 height = src_pos[sn].height();
223b71206888 Initial import
thib
parents:
diff changeset
162 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
163
0
223b71206888 Initial import
thib
parents:
diff changeset
164 void GrpObj::Update(void) {
223b71206888 Initial import
thib
parents:
diff changeset
165 if (attr & UPDATE_PICTURE) {
223b71206888 Initial import
thib
parents:
diff changeset
166 UpdateSurface();
223b71206888 Initial import
thib
parents:
diff changeset
167 attr = Attribute( (attr | UPDATE_ALL) & (~UPDATE_PICTURE));
223b71206888 Initial import
thib
parents:
diff changeset
168 }
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
169 if (picture == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
170 if (attr & UPDATE_POS) {
18
4d7486cb20a9 Sync with upstream
thib
parents: 14
diff changeset
171 if ( (attr & SATURATE) || zoom != -1) {
0
223b71206888 Initial import
thib
parents:
diff changeset
172 int w=0, h=0;
223b71206888 Initial import
thib
parents:
diff changeset
173 GetSrcGeom(w,h);
223b71206888 Initial import
thib
parents:
diff changeset
174 picture->Move(_posx-w/2, _posy-h/2);
223b71206888 Initial import
thib
parents:
diff changeset
175 } else {
223b71206888 Initial import
thib
parents:
diff changeset
176 picture->Move(_posx, _posy);
223b71206888 Initial import
thib
parents:
diff changeset
177 }
223b71206888 Initial import
thib
parents:
diff changeset
178 }
223b71206888 Initial import
thib
parents:
diff changeset
179 if (attr & UPDATE_ALPHA) {
223b71206888 Initial import
thib
parents:
diff changeset
180 if (alpha <= 0) {
223b71206888 Initial import
thib
parents:
diff changeset
181 picture->SetSurfaceAlpha(0, Rect(0,0));
223b71206888 Initial import
thib
parents:
diff changeset
182 picture->hide();
223b71206888 Initial import
thib
parents:
diff changeset
183 } else if (alpha >= ALPHA_MAX) {
223b71206888 Initial import
thib
parents:
diff changeset
184 picture->SetSurfaceAlpha(0, Rect(0,0));
223b71206888 Initial import
thib
parents:
diff changeset
185 if (attr & HIDDEN) picture->hide();
223b71206888 Initial import
thib
parents:
diff changeset
186 else picture->show();
223b71206888 Initial import
thib
parents:
diff changeset
187 } else {
223b71206888 Initial import
thib
parents:
diff changeset
188 picture->SetSurfaceAlpha(&alpha, Rect(0,0,1,1));
223b71206888 Initial import
thib
parents:
diff changeset
189 if (attr & HIDDEN) picture->hide();
223b71206888 Initial import
thib
parents:
diff changeset
190 else picture->show();
223b71206888 Initial import
thib
parents:
diff changeset
191 }
223b71206888 Initial import
thib
parents:
diff changeset
192 }
223b71206888 Initial import
thib
parents:
diff changeset
193 if ( (attr & UPDATE_SNUM) && (!src_pos.empty())) {
223b71206888 Initial import
thib
parents:
diff changeset
194 if (surface_num < 0 || surface_num >= src_pos.size()) surface_num = 0;
223b71206888 Initial import
thib
parents:
diff changeset
195 picture->SetSurfacePos(src_pos[surface_num].lx, src_pos[surface_num].ty);
223b71206888 Initial import
thib
parents:
diff changeset
196 }
223b71206888 Initial import
thib
parents:
diff changeset
197 if (attr & UPDATE_CLIP) {
223b71206888 Initial import
thib
parents:
diff changeset
198 picture->SetClipArea(clip_area);
223b71206888 Initial import
thib
parents:
diff changeset
199 }
223b71206888 Initial import
thib
parents:
diff changeset
200 attr = Attribute(attr & (~UPDATE_ALL));
223b71206888 Initial import
thib
parents:
diff changeset
201 if (attr & ANM_PLAYSTART) {
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
202 if (anm != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
203 anm->Play();
223b71206888 Initial import
thib
parents:
diff changeset
204 attr = Attribute(attr | ANM_PLAYING);
223b71206888 Initial import
thib
parents:
diff changeset
205 }
223b71206888 Initial import
thib
parents:
diff changeset
206 attr = Attribute(attr & (~ANM_PLAYSTART));
223b71206888 Initial import
thib
parents:
diff changeset
207 }
223b71206888 Initial import
thib
parents:
diff changeset
208 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
209
0
223b71206888 Initial import
thib
parents:
diff changeset
210 void GrpObj::CreateSurface(PicContainer* parent) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
211 if (picture != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
212 PicBase* p = DeletePic();
223b71206888 Initial import
thib
parents:
diff changeset
213 delete p;
223b71206888 Initial import
thib
parents:
diff changeset
214 }
223b71206888 Initial import
thib
parents:
diff changeset
215 src_pos.clear();
223b71206888 Initial import
thib
parents:
diff changeset
216 // picture を作成
223b71206888 Initial import
thib
parents:
diff changeset
217 pic_parent = parent;
223b71206888 Initial import
thib
parents:
diff changeset
218 picture = parent->create_leaf(Rect(_posx,_posy,_posx+1,_posy+1), 0);
223b71206888 Initial import
thib
parents:
diff changeset
219 picture->hide();
223b71206888 Initial import
thib
parents:
diff changeset
220 UpdateSurface();
223b71206888 Initial import
thib
parents:
diff changeset
221 }
223b71206888 Initial import
thib
parents:
diff changeset
222
223b71206888 Initial import
thib
parents:
diff changeset
223 void GrpObj::UpdateSurface(void) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
224 if (pic_parent == NULL || picture == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
225 int width = 0, height = 0;
223b71206888 Initial import
thib
parents:
diff changeset
226 if (gtype == FILE || gtype == GAN) {
223b71206888 Initial import
thib
parents:
diff changeset
227 if (name.length() == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
228 // ファイル名が存在する場合、ファイルを読み込み
223b71206888 Initial import
thib
parents:
diff changeset
229 GetSrcGeom(width, height);
223b71206888 Initial import
thib
parents:
diff changeset
230 if (width <= 0 || height <= 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
231 // surface の設定
223b71206888 Initial import
thib
parents:
diff changeset
232 if (surface_num == 0 && ( (zoom > 0 && zoom != 256) || rotate > 0)) {
223b71206888 Initial import
thib
parents:
diff changeset
233 ZoomRotate();
223b71206888 Initial import
thib
parents:
diff changeset
234 } else {
223b71206888 Initial import
thib
parents:
diff changeset
235 // 普通に surface を設定
223b71206888 Initial import
thib
parents:
diff changeset
236 string path(name);
223b71206888 Initial import
thib
parents:
diff changeset
237 path += ".g00";
223b71206888 Initial import
thib
parents:
diff changeset
238 picture->SetSurface(path.c_str(), 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
239 picture->SetSurfaceRect(Rect(0,0,width,height));
223b71206888 Initial import
thib
parents:
diff changeset
240 }
223b71206888 Initial import
thib
parents:
diff changeset
241 if (attr & SATURATE)
223b71206888 Initial import
thib
parents:
diff changeset
242 picture->SetSurfaceAttribute(PicBase::BLIT_SATURATE);
223b71206888 Initial import
thib
parents:
diff changeset
243 } else if (gtype == MOJI) { // テキスト描画
223b71206888 Initial import
thib
parents:
diff changeset
244 if (print_moji.length() == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
245 UpdateMoji();
223b71206888 Initial import
thib
parents:
diff changeset
246 } else if (gtype == DIGIT) { // 数値を画像表示
223b71206888 Initial import
thib
parents:
diff changeset
247 UpdateDigit();
223b71206888 Initial import
thib
parents:
diff changeset
248 }
223b71206888 Initial import
thib
parents:
diff changeset
249 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
250
0
223b71206888 Initial import
thib
parents:
diff changeset
251 void GrpObj::ZoomRotate(void) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
252 picture->SetSurface( (Surface*)0, 0, 0);
0
223b71206888 Initial import
thib
parents:
diff changeset
253
223b71206888 Initial import
thib
parents:
diff changeset
254 // 回転、縮小拡大は座標原点が画像の中心になる
223b71206888 Initial import
thib
parents:
diff changeset
255 string path(name);
223b71206888 Initial import
thib
parents:
diff changeset
256 path += ".g00";
223b71206888 Initial import
thib
parents:
diff changeset
257 Surface* surface_orig = pic_parent->Root().NewSurface(path.c_str());
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
258 if (surface_orig == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
259
223b71206888 Initial import
thib
parents:
diff changeset
260 Surface* zoom_surface = pic_parent->Root().RotZoomSurface(surface_orig, double(zoom)/256.0, rotate);
223b71206888 Initial import
thib
parents:
diff changeset
261 Rect zoom_r (*zoom_surface);
223b71206888 Initial import
thib
parents:
diff changeset
262 picture->SetSurface(zoom_surface, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
263 picture->SetSurfaceFreeFlag();
223b71206888 Initial import
thib
parents:
diff changeset
264 //picture->Move(PosX() + - zoom_r.width()/2, PosY() + - zoom_r.height()/2);
223b71206888 Initial import
thib
parents:
diff changeset
265 // 中心座標がわからん・・・
223b71206888 Initial import
thib
parents:
diff changeset
266 picture->Move(320 - zoom_r.width()/2, 240 - zoom_r.height()/2);
223b71206888 Initial import
thib
parents:
diff changeset
267 picture->SetSurfaceRect(Rect(0, 0, zoom_r.width(), zoom_r.height()));
223b71206888 Initial import
thib
parents:
diff changeset
268
223b71206888 Initial import
thib
parents:
diff changeset
269 pic_parent->Root().DeleteSurface(surface_orig);
223b71206888 Initial import
thib
parents:
diff changeset
270 }
223b71206888 Initial import
thib
parents:
diff changeset
271
223b71206888 Initial import
thib
parents:
diff changeset
272 void GrpObj::UpdateMoji(void) { // 文字の大きさ、色などを変更
14
8da1d92ac8f8 Don't create fonts faces for size <= 0, and update objects when their font size is set
thib
parents: 11
diff changeset
273 if (print_moji.length() == 0 || print_size <= 2) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
274 if (pic_parent == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
275 /* テキストの大きさを得る */
223b71206888 Initial import
thib
parents:
diff changeset
276 int r, g, b;
223b71206888 Initial import
thib
parents:
diff changeset
277 if (print_r == -1 || print_g == -1 || print_b == -1) {// 色設定なし
223b71206888 Initial import
thib
parents:
diff changeset
278 r = g = b = 0; // とりあえず黒(clannad のSave/Loadメニュー用)
223b71206888 Initial import
thib
parents:
diff changeset
279 } else {
223b71206888 Initial import
thib
parents:
diff changeset
280 r = print_r;
223b71206888 Initial import
thib
parents:
diff changeset
281 g = print_g;
223b71206888 Initial import
thib
parents:
diff changeset
282 b = print_b;
223b71206888 Initial import
thib
parents:
diff changeset
283 }
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
284 TextStream ts = TextStream::ParseMoji(print_moji.c_str(), r, g, b, print_size);
0
223b71206888 Initial import
thib
parents:
diff changeset
285 TextGlyphStream gs;
223b71206888 Initial import
thib
parents:
diff changeset
286 vector<int> lh;
223b71206888 Initial import
thib
parents:
diff changeset
287 // とりあえず drawable width は充分に大きく(2048)取る
223b71206888 Initial import
thib
parents:
diff changeset
288 DefaultLayout(print_size-2)->Layout(ts, gs, lh, 2048); // print_size そのままだと弱干大きすぎるので -2
223b71206888 Initial import
thib
parents:
diff changeset
289 int width = gs.width();
223b71206888 Initial import
thib
parents:
diff changeset
290 int height = gs.height();
223b71206888 Initial import
thib
parents:
diff changeset
291 Surface* surface = pic_parent->Root().NewSurface(width, height, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
292 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
293 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0, 0, width, height), surface, Rect(0,0));
223b71206888 Initial import
thib
parents:
diff changeset
294 picture->SetSurface(surface, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
295 picture->SetSurfaceRect(Rect(0,0,width,height));
223b71206888 Initial import
thib
parents:
diff changeset
296 picture->SetSurfaceFreeFlag();
223b71206888 Initial import
thib
parents:
diff changeset
297 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
298
0
223b71206888 Initial import
thib
parents:
diff changeset
299 void GrpObj::UpdateDigit(void) {
223b71206888 Initial import
thib
parents:
diff changeset
300 // 画像表示の数値文字列を表示する
223b71206888 Initial import
thib
parents:
diff changeset
301 if (name.length() == 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
302 // ファイル名が存在する場合、ファイルを読み込み
223b71206888 Initial import
thib
parents:
diff changeset
303 string path(name);
223b71206888 Initial import
thib
parents:
diff changeset
304 path += ".g00";
223b71206888 Initial import
thib
parents:
diff changeset
305 Surface* surface_orig = pic_parent->Root().NewSurface(path.c_str());
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
306 if (surface_orig == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
307
223b71206888 Initial import
thib
parents:
diff changeset
308 int width, height;
223b71206888 Initial import
thib
parents:
diff changeset
309 int i;
223b71206888 Initial import
thib
parents:
diff changeset
310 GetSrcGeom(width, height);
223b71206888 Initial import
thib
parents:
diff changeset
311 if (width <= 0 || height <= 0) return;
223b71206888 Initial import
thib
parents:
diff changeset
312 if (src_pos.size() < 14) {
223b71206888 Initial import
thib
parents:
diff changeset
313 // 必要な数の object がない
223b71206888 Initial import
thib
parents:
diff changeset
314 // 表示できない分の空の rect を追加しておく
223b71206888 Initial import
thib
parents:
diff changeset
315 for (i=src_pos.size(); i<14; i++)
223b71206888 Initial import
thib
parents:
diff changeset
316 src_pos.push_back(Rect(0,0,0,0));
223b71206888 Initial import
thib
parents:
diff changeset
317 pic_parent->Root().DeleteSurface(surface_orig);
223b71206888 Initial import
thib
parents:
diff changeset
318 return;
223b71206888 Initial import
thib
parents:
diff changeset
319 }
223b71206888 Initial import
thib
parents:
diff changeset
320 // 桁数の計算
223b71206888 Initial import
thib
parents:
diff changeset
321 char num_str[20];
223b71206888 Initial import
thib
parents:
diff changeset
322 if (dig_number < 0) sprintf(num_str, "%d", -dig_number);
223b71206888 Initial import
thib
parents:
diff changeset
323 else sprintf(num_str, "%d", dig_number);
223b71206888 Initial import
thib
parents:
diff changeset
324 int sign_count = 0;
223b71206888 Initial import
thib
parents:
diff changeset
325 int space_count = 0;
223b71206888 Initial import
thib
parents:
diff changeset
326 int total_count;
223b71206888 Initial import
thib
parents:
diff changeset
327 int dig_count = strlen(num_str);
223b71206888 Initial import
thib
parents:
diff changeset
328 if (dig_number < 0 && (attr&DIG_SIGN) == 0) dig_count++;
223b71206888 Initial import
thib
parents:
diff changeset
329 if (dig_count < dig_digit) space_count = dig_digit - dig_count;
223b71206888 Initial import
thib
parents:
diff changeset
330 if (attr & DIG_SIGN) sign_count = 1;
223b71206888 Initial import
thib
parents:
diff changeset
331 total_count = dig_count + space_count + sign_count;
223b71206888 Initial import
thib
parents:
diff changeset
332
223b71206888 Initial import
thib
parents:
diff changeset
333 Surface* surface = pic_parent->Root().NewSurface(width*total_count, height, ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
334 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
335
223b71206888 Initial import
thib
parents:
diff changeset
336 /* surface にコピーする */
223b71206888 Initial import
thib
parents:
diff changeset
337 int cur_x = 0;
223b71206888 Initial import
thib
parents:
diff changeset
338 if ( (attr & DIG_PACK) && !(attr & DIG_ZERO)) { // 始めに空白を挿入
223b71206888 Initial import
thib
parents:
diff changeset
339 cur_x += space_count * width;
223b71206888 Initial import
thib
parents:
diff changeset
340 }
223b71206888 Initial import
thib
parents:
diff changeset
341 int plus = 10, minus = 11, plusminus = 12;
223b71206888 Initial import
thib
parents:
diff changeset
342 if (dig_number < 0) {
223b71206888 Initial import
thib
parents:
diff changeset
343 DSurfaceMove(surface, src_pos[minus], surface, Rect(cur_x,0));
223b71206888 Initial import
thib
parents:
diff changeset
344 cur_x += width;
223b71206888 Initial import
thib
parents:
diff changeset
345 } else if (attr & DIG_SIGN) {
223b71206888 Initial import
thib
parents:
diff changeset
346 if (dig_number == 0)
223b71206888 Initial import
thib
parents:
diff changeset
347 DSurfaceMove(surface, src_pos[plusminus], surface, Rect(cur_x,0));
223b71206888 Initial import
thib
parents:
diff changeset
348 else
223b71206888 Initial import
thib
parents:
diff changeset
349 DSurfaceMove(surface, src_pos[plus], surface, Rect(cur_x,0));
223b71206888 Initial import
thib
parents:
diff changeset
350 cur_x += width;
223b71206888 Initial import
thib
parents:
diff changeset
351 }
223b71206888 Initial import
thib
parents:
diff changeset
352 if (attr & DIG_ZERO) { // ゼロ・パディング
223b71206888 Initial import
thib
parents:
diff changeset
353 for (i=0; i<space_count; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
354 DSurfaceMove(surface, src_pos[0], surface, Rect(cur_x, 0));
223b71206888 Initial import
thib
parents:
diff changeset
355 cur_x += width;;
223b71206888 Initial import
thib
parents:
diff changeset
356 }
223b71206888 Initial import
thib
parents:
diff changeset
357 } else if (!(attr & DIG_PACK)) { // PACK オプションなし
223b71206888 Initial import
thib
parents:
diff changeset
358 cur_x += space_count * width;
223b71206888 Initial import
thib
parents:
diff changeset
359 }
223b71206888 Initial import
thib
parents:
diff changeset
360 for (i=0; num_str[i] != 0; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
361 DSurfaceMove(surface_orig, src_pos[num_str[i]-'0'], surface, Rect(cur_x, 0));
223b71206888 Initial import
thib
parents:
diff changeset
362 cur_x += width;
223b71206888 Initial import
thib
parents:
diff changeset
363 }
223b71206888 Initial import
thib
parents:
diff changeset
364
223b71206888 Initial import
thib
parents:
diff changeset
365 /* picture に設定 */
223b71206888 Initial import
thib
parents:
diff changeset
366 picture->SetSurface(surface, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
367 picture->SetSurfaceRect(Rect(0,0,width*total_count,height));
223b71206888 Initial import
thib
parents:
diff changeset
368 picture->SetSurfaceFreeFlag();
223b71206888 Initial import
thib
parents:
diff changeset
369
223b71206888 Initial import
thib
parents:
diff changeset
370 pic_parent->Root().DeleteSurface(surface_orig);
223b71206888 Initial import
thib
parents:
diff changeset
371 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
372
0
223b71206888 Initial import
thib
parents:
diff changeset
373 void GrpObj::CreateGan(Event::Container& event, int event_number) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
374 if (picture == NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
375 fprintf(stderr,"GrpObj::CreateGan() is called before Create()\n");
223b71206888 Initial import
thib
parents:
diff changeset
376 return;
223b71206888 Initial import
thib
parents:
diff changeset
377 }
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
378 if (anm != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
379 anm->Abort();
223b71206888 Initial import
thib
parents:
diff changeset
380 delete anm;
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
381 anm = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
382 }
223b71206888 Initial import
thib
parents:
diff changeset
383 if (gan_name.empty()) return;
223b71206888 Initial import
thib
parents:
diff changeset
384 /* アニーメション情報 (.GAN ファイル)を求める */
223b71206888 Initial import
thib
parents:
diff changeset
385 string path(gan_name);
223b71206888 Initial import
thib
parents:
diff changeset
386 path += ".gan";
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
387 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::GAN, path.c_str(), "gan");
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
388 if (info == NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
389 fprintf(stderr,"GrpObj::CreateGan: Cannot Find 'GAN' file %s\n", path.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
390 return;
223b71206888 Initial import
thib
parents:
diff changeset
391 }
223b71206888 Initial import
thib
parents:
diff changeset
392 const char* data = info->Read();
223b71206888 Initial import
thib
parents:
diff changeset
393 if (read_little_endian_int(data) != 10000 || read_little_endian_int(data+4) != 10000) {
223b71206888 Initial import
thib
parents:
diff changeset
394 fprintf(stderr,"GrpObj::CreateGan: Invalid'GAN' file %s\n", path.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
395 delete info;
223b71206888 Initial import
thib
parents:
diff changeset
396 return;
223b71206888 Initial import
thib
parents:
diff changeset
397 }
223b71206888 Initial import
thib
parents:
diff changeset
398
223b71206888 Initial import
thib
parents:
diff changeset
399 picture->SetSurfaceAttribute(PicBase::BLIT_SATURATE);
223b71206888 Initial import
thib
parents:
diff changeset
400 attr = Attribute(attr | UPDATE_POS | SATURATE);
223b71206888 Initial import
thib
parents:
diff changeset
401
223b71206888 Initial import
thib
parents:
diff changeset
402 const char* buf = data + 16;
223b71206888 Initial import
thib
parents:
diff changeset
403 buf += strlen(buf) + 1; // 画像ファイル名が入っている
223b71206888 Initial import
thib
parents:
diff changeset
404 buf += 4; // 定数 20000
223b71206888 Initial import
thib
parents:
diff changeset
405 int pics = read_little_endian_int(buf); buf += 4; // 複数のアニメーション情報が入っている場合、情報数
223b71206888 Initial import
thib
parents:
diff changeset
406 // 以下、pics 回繰り返し
223b71206888 Initial import
thib
parents:
diff changeset
407 // アニメーションを行う実体を作成
223b71206888 Initial import
thib
parents:
diff changeset
408 AnmAlphaMove* wid = new AnmAlphaMove(event, picture);
223b71206888 Initial import
thib
parents:
diff changeset
409
223b71206888 Initial import
thib
parents:
diff changeset
410 if (event_number && event_number < pics) { // 複数のアニメーション情報がある場合、先の情報を読み飛ばす */
223b71206888 Initial import
thib
parents:
diff changeset
411 int i; for (i=0; i<event_number; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
412 buf += 4; // 定数 30000
223b71206888 Initial import
thib
parents:
diff changeset
413 int ptns = read_little_endian_int(buf); buf += 4;
223b71206888 Initial import
thib
parents:
diff changeset
414 buf += ptns*52;
223b71206888 Initial import
thib
parents:
diff changeset
415 }
223b71206888 Initial import
thib
parents:
diff changeset
416 }
223b71206888 Initial import
thib
parents:
diff changeset
417 buf += 4; // 定数 30000
223b71206888 Initial import
thib
parents:
diff changeset
418 int ptns = read_little_endian_int(buf); buf += 4;
223b71206888 Initial import
thib
parents:
diff changeset
419 int total_time = 0;
223b71206888 Initial import
thib
parents:
diff changeset
420 int i;
223b71206888 Initial import
thib
parents:
diff changeset
421 for (i=0; i<ptns; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
422 int p = read_little_endian_int(buf+i*52+0*8+4);
223b71206888 Initial import
thib
parents:
diff changeset
423 int x = read_little_endian_int(buf+i*52+1*8+4);
223b71206888 Initial import
thib
parents:
diff changeset
424 int y = read_little_endian_int(buf+i*52+2*8+4);
223b71206888 Initial import
thib
parents:
diff changeset
425 int t = read_little_endian_int(buf+i*52+3*8+4);
223b71206888 Initial import
thib
parents:
diff changeset
426 int a = read_little_endian_int(buf+i*52+4*8+4);
223b71206888 Initial import
thib
parents:
diff changeset
427 x += PosX();
223b71206888 Initial import
thib
parents:
diff changeset
428 y += PosY();
223b71206888 Initial import
thib
parents:
diff changeset
429 if (p == -1) { a = 0; p = 0; } // p == -1 ならなにも表示しない
223b71206888 Initial import
thib
parents:
diff changeset
430 if (p >= src_pos.size()) {
223b71206888 Initial import
thib
parents:
diff changeset
431 fprintf(stderr,"Reading GAN file %s (G00 %s) : not enough pictures in .G00 file\n", path.c_str(), name.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
432 a = 0; p = 0;
223b71206888 Initial import
thib
parents:
diff changeset
433 }
223b71206888 Initial import
thib
parents:
diff changeset
434 total_time += t;
223b71206888 Initial import
thib
parents:
diff changeset
435 wid->ptns.push_back(AnmAlphaMove::Ptn(Rect(x,y), src_pos[p], a, total_time));
223b71206888 Initial import
thib
parents:
diff changeset
436 }
223b71206888 Initial import
thib
parents:
diff changeset
437 wid->SetPtn(); // パターン登録終了
223b71206888 Initial import
thib
parents:
diff changeset
438 attr = Attribute(attr | ANM_PLAYSTART);
223b71206888 Initial import
thib
parents:
diff changeset
439 anm = wid;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
440 }
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
441
0
223b71206888 Initial import
thib
parents:
diff changeset
442 void GrpObj::CreateGanSpecial(Event::Container& event, int event_number, int time) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
443 if (picture == NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
444 fprintf(stderr,"GrpObj::CreateGan() is called before Create()\n");
223b71206888 Initial import
thib
parents:
diff changeset
445 return;
223b71206888 Initial import
thib
parents:
diff changeset
446 }
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
447 if (anm != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
448 anm->Abort();
223b71206888 Initial import
thib
parents:
diff changeset
449 delete anm;
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
450 anm = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
451 }
223b71206888 Initial import
thib
parents:
diff changeset
452
223b71206888 Initial import
thib
parents:
diff changeset
453 // アニメーションを行う実体を作成
223b71206888 Initial import
thib
parents:
diff changeset
454 AnmAlphaMove* wid = new AnmAlphaMove(event, picture);
223b71206888 Initial import
thib
parents:
diff changeset
455
223b71206888 Initial import
thib
parents:
diff changeset
456 int i;
223b71206888 Initial import
thib
parents:
diff changeset
457 switch(event_number) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
458 case 0: // pattern を 0 から最後まで変化させる
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
459 for (i=0; i<src_pos.size(); i++) {
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
460 wid->ptns.push_back(AnmAlphaMove::Ptn(Rect(PosX(), PosY()), src_pos[i], 255, time*i));
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
461 }
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
462 wid->SetPtn(); // パターン登録終了
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
463 anm = wid;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
464 attr = Attribute(attr | ANM_PLAYSTART);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
465 break;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
466 default:
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
467 break;
0
223b71206888 Initial import
thib
parents:
diff changeset
468 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
469 }
0
223b71206888 Initial import
thib
parents:
diff changeset
470
223b71206888 Initial import
thib
parents:
diff changeset
471 void GrpObj::SetZoomRotate(int new_zoom, int new_rotate) {
223b71206888 Initial import
thib
parents:
diff changeset
472 if (zoom == new_zoom && rotate == new_rotate) return;
18
4d7486cb20a9 Sync with upstream
thib
parents: 14
diff changeset
473 if ( zoom == -1 || new_zoom == -1) {
4d7486cb20a9 Sync with upstream
thib
parents: 14
diff changeset
474 attr = Attribute(attr | UPDATE_POS); // centering する
4d7486cb20a9 Sync with upstream
thib
parents: 14
diff changeset
475 }
4d7486cb20a9 Sync with upstream
thib
parents: 14
diff changeset
476 zoom = new_zoom;
0
223b71206888 Initial import
thib
parents:
diff changeset
477 if (new_rotate != -1) rotate = new_rotate;
223b71206888 Initial import
thib
parents:
diff changeset
478 if (zoom < 0) zoom = 256;
223b71206888 Initial import
thib
parents:
diff changeset
479 if (rotate < 0) rotate = 0;
223b71206888 Initial import
thib
parents:
diff changeset
480 else if (rotate > 360) rotate %= 360;
223b71206888 Initial import
thib
parents:
diff changeset
481
223b71206888 Initial import
thib
parents:
diff changeset
482 attr = Attribute(attr | UPDATE_PICTURE);
223b71206888 Initial import
thib
parents:
diff changeset
483 }
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
484
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
485 void GrpObj::Refresh(GrpObj& parent_obj) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
486 //if (&parent_obj != this) printf("Toto\n"); //FIXME
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
487
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
488 GrpObjMap::iterator it;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
489
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
490 for (it = children_obj.begin(); it != children_obj.end(); it++)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
491 it->second.Refresh(parent_obj);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
492
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
493 if (picture == NULL) return;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
494 if (alpha == 0 || (attr & GrpObj::HIDDEN) || (parent_obj.attr & GrpObj::HIDDEN)) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
495 if (attr & GrpObj::ANM_PLAYING) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
496 attr = GrpObj::Attribute(attr & ~(GrpObj::ANM_PLAYING));
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
497 if (anm != NULL) anm->Abort();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
498 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
499 picture->hide();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
500 } else {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
501 Update();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
502 picture->show();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
503 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
504 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
505
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
506 void GrpObj::_debug_Dump(int id, int indent)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
507 {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
508 const char* repr;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
509
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
510 if (indent == 0)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
511 repr = "obj %04d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n";
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
512 else
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
513 repr = " * obj %04d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n";
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
514
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
515 if (picture != NULL) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
516 if (!name.empty())
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
517 fprintf(stderr, repr,
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
518 id, this, name.c_str(), PosX(), PosY(), alpha, attr&GrpObj::HIDDEN ? 1 : 0, 0,
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
519 picture->IsHidden());
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
520 else if (!print_moji.empty())
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
521 fprintf(stderr, repr,
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
522 id, this, print_moji.c_str(), PosX(), PosY(), alpha, attr&GrpObj::HIDDEN ? 1 : 0,
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
523 0, picture->IsHidden());
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
524 else
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
525 fprintf(stderr, repr,
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
526 id, this, "<EMPTY>", PosX(), PosY(), alpha, attr&GrpObj::HIDDEN ? 1 : 0, 0,
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
527 picture->IsHidden());
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
528 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
529
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
530 GrpObjMap::iterator it;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
531 for (it = children_obj.begin(); it != children_obj.end(); it++)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
532 it->second._debug_Dump(it->first, indent+1);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
533 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
534
0
223b71206888 Initial import
thib
parents:
diff changeset
535 /******************************************************************
223b71206888 Initial import
thib
parents:
diff changeset
536 **
223b71206888 Initial import
thib
parents:
diff changeset
537 ** class ScnGrp*
223b71206888 Initial import
thib
parents:
diff changeset
538 */
223b71206888 Initial import
thib
parents:
diff changeset
539 /* Princess Bride: 背景画の一部のみ移動、の実装 */
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
540
0
223b71206888 Initial import
thib
parents:
diff changeset
541 ScnGrpMove::ScnGrpMove(Event::Container& container, PicBase* _pic, PicRoot& _root, Surface* _dest, const Rect& _dest_r, Surface* _src, const Rect& _from, const Rect& _to, int total_time) :
223b71206888 Initial import
thib
parents:
diff changeset
542 WidAnmTime(container, _pic, total_time),
223b71206888 Initial import
thib
parents:
diff changeset
543 dest(_dest), src(_src), root(_root),dest_r(_dest_r), from(_from), to(_to) {
223b71206888 Initial import
thib
parents:
diff changeset
544 int dx = to.lx - from.lx;
223b71206888 Initial import
thib
parents:
diff changeset
545 int dy = to.ty - from.ty;
223b71206888 Initial import
thib
parents:
diff changeset
546 if (dx < 0) dx = -dx;
223b71206888 Initial import
thib
parents:
diff changeset
547 if (dy < 0) dy = -dy;
223b71206888 Initial import
thib
parents:
diff changeset
548 if (dx < dy) dx = dy;
223b71206888 Initial import
thib
parents:
diff changeset
549 if (dx == 0) dx = 1;
223b71206888 Initial import
thib
parents:
diff changeset
550 SetAllCount(dx);
223b71206888 Initial import
thib
parents:
diff changeset
551 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
552
0
223b71206888 Initial import
thib
parents:
diff changeset
553 void ScnGrpMove::Exec(int count) {
223b71206888 Initial import
thib
parents:
diff changeset
554 Rect r(0,0,dest_r.width(),dest_r.height());
223b71206888 Initial import
thib
parents:
diff changeset
555 int dx = to.lx - from.lx;
223b71206888 Initial import
thib
parents:
diff changeset
556 int dy = to.ty - from.ty;
223b71206888 Initial import
thib
parents:
diff changeset
557 int x = dx*count/all_count + from.lx;
223b71206888 Initial import
thib
parents:
diff changeset
558 int y = dy*count/all_count + from.ty;
223b71206888 Initial import
thib
parents:
diff changeset
559 r.rmove(x, y);
223b71206888 Initial import
thib
parents:
diff changeset
560 root.BlitSurface(src, r, dest, dest_r);
223b71206888 Initial import
thib
parents:
diff changeset
561 iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
562 for (it=pic.begin(); it!=pic.end(); it++)
223b71206888 Initial import
thib
parents:
diff changeset
563 (*it)->SetSurface(dest, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
564 }
223b71206888 Initial import
thib
parents:
diff changeset
565
223b71206888 Initial import
thib
parents:
diff changeset
566 void ScnGrpAnm::CalcTotal(void) {
223b71206888 Initial import
thib
parents:
diff changeset
567 /* total time を計算 */
223b71206888 Initial import
thib
parents:
diff changeset
568 if (empty()) return;
223b71206888 Initial import
thib
parents:
diff changeset
569 int tm = 0;
223b71206888 Initial import
thib
parents:
diff changeset
570 vector<ScnGrpAnmAtom>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
571 for (it=begin(); it != end(); it++) tm += it->time;
223b71206888 Initial import
thib
parents:
diff changeset
572 total_time = tm;
223b71206888 Initial import
thib
parents:
diff changeset
573 SetAllCount(tm);
223b71206888 Initial import
thib
parents:
diff changeset
574 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
575
0
223b71206888 Initial import
thib
parents:
diff changeset
576 void ScnGrpAnm::Exec(int count) {
223b71206888 Initial import
thib
parents:
diff changeset
577 int tm = 0; vector<ScnGrpAnmAtom>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
578 for (it=begin(); it != end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
579 tm += it->time;
223b71206888 Initial import
thib
parents:
diff changeset
580 if (count < tm) break;
223b71206888 Initial import
thib
parents:
diff changeset
581 }
223b71206888 Initial import
thib
parents:
diff changeset
582 if (it == end()) it--;
223b71206888 Initial import
thib
parents:
diff changeset
583 owner.LoadSurface(it->name.c_str(), 0);
223b71206888 Initial import
thib
parents:
diff changeset
584 }
223b71206888 Initial import
thib
parents:
diff changeset
585
223b71206888 Initial import
thib
parents:
diff changeset
586
223b71206888 Initial import
thib
parents:
diff changeset
587 /*****************************************************
223b71206888 Initial import
thib
parents:
diff changeset
588 *
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
589 * Grp
0
223b71206888 Initial import
thib
parents:
diff changeset
590 *
223b71206888 Initial import
thib
parents:
diff changeset
591 */
223b71206888 Initial import
thib
parents:
diff changeset
592
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
593 #include "music2/music.h"
0
223b71206888 Initial import
thib
parents:
diff changeset
594
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
595 Grp::Grp(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm_data):
0
223b71206888 Initial import
thib
parents:
diff changeset
596 event(_event),
223b71206888 Initial import
thib
parents:
diff changeset
597 flags(f),
223b71206888 Initial import
thib
parents:
diff changeset
598 parent(_parent),
223b71206888 Initial import
thib
parents:
diff changeset
599 status(NORMAL),
223b71206888 Initial import
thib
parents:
diff changeset
600 skip_mode(SKIP_NO),
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
601 cgm_data(_cgm_data)
0
223b71206888 Initial import
thib
parents:
diff changeset
602 {
223b71206888 Initial import
thib
parents:
diff changeset
603 int i;
223b71206888 Initial import
thib
parents:
diff changeset
604 for (i=0; i<MAXPDT; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
605 ssurface[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
606 dsurface[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
607 }
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
608
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
609 music = MuSys::GetInstance();
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
610 config = AyuSysConfig::GetInstance();
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
611
0
223b71206888 Initial import
thib
parents:
diff changeset
612 screen = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0);
223b71206888 Initial import
thib
parents:
diff changeset
613 screen_front = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0);
223b71206888 Initial import
thib
parents:
diff changeset
614 surface = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
615 surface_update = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
616 DSurfaceFill(surface, Rect(*surface), 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
617 DSurfaceFill(surface_update, Rect(*surface), 0, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
618 screen->SetSurface(surface, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
619 screen->show();
223b71206888 Initial import
thib
parents:
diff changeset
620 screen_front->hide();
223b71206888 Initial import
thib
parents:
diff changeset
621 screen_front->ZMove(screen);
223b71206888 Initial import
thib
parents:
diff changeset
622
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
623 LoadCgm();
0
223b71206888 Initial import
thib
parents:
diff changeset
624
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
625 RegisterCommand(1, 30, 0, "stackClear", (CmdImpl) &Grp::impl_stackClear);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
626 RegisterCommand(1, 33, 70, "grpBuffer", (CmdImpl) &Grp::impl_grpBuffer);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
627 RegisterCommand(1, 33, 73, "grpOpenBG", (CmdImpl) &Grp::impl_grpOpen);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
628 RegisterCommand(1, 33, 75, "grpMulti", (CmdImpl) &Grp::impl_grpMulti); //FIXME: or not...
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
629 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &Grp::impl_grpOpen);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
630 RegisterCommand(1, 33, 32, "shake", (CmdImpl) &Grp::impl_shake);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
631 RegisterCommand(1, 33, 100, "grpCopy", (CmdImpl) &Grp::impl_grpCopy);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
632 RegisterCommand(1, 33, 1201, "recFill", (CmdImpl) &Grp::impl_recFill);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
633 RegisterCommand(1, 33, 1100, "recCopy", (CmdImpl) &Grp::impl_recCopy);
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
634 RegisterCommand(1, 33, 1101, "recMaskCopy", NULL); //FIXME
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
635 RegisterCommand(1, 33, 1600, "recAdd", (CmdImpl) &Grp::impl_recAdd);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
636 RegisterCommand(1, 33, 406, "grpPan", (CmdImpl) &Grp::impl_grpPan);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
637
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
638 RegisterCommand(1, 34, 3120, "snmBgScroll", (CmdImpl) &Grp::impl_snmBgScroll);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
639 RegisterCommand(1, 34, 3100, "snmBgPlay", (CmdImpl) &Grp::impl_snmPlay);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
640 RegisterCommand(1, 34, 2100, "snmPlay", (CmdImpl) &Grp::impl_snmPlay);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
641 RegisterCommand(1, 34, 2101, "snmPlayEx", (CmdImpl) &Grp::impl_snmPlay);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
642
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
643 RegisterCommand(1, 4, 1500, "cgGetTotal", (CmdImpl) &Grp::impl_cgGet);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
644 RegisterCommand(1, 4, 1501, "cgGetViewed", (CmdImpl) &Grp::impl_cgGet);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
645 RegisterCommand(1, 4, 1502, "cgGetViewedPcnt", (CmdImpl) &Grp::impl_cgGet);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
646 RegisterCommand(1, 4, 1503, "cgGetFlag", (CmdImpl) &Grp::impl_cgStatus);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
647 RegisterCommand(1, 4, 1504, "cgStatus", (CmdImpl) &Grp::impl_cgStatus);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
648
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
649 RegisterCommand(1, 4, 0x6a4, "CreateInput", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
650 RegisterCommand(1, 4, 0x6ae, "SetInput", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
651
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
652 RegisterCommand(1, 61, 10, "objClear", (CmdImpl) &Grp::impl_objClear);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
653 RegisterCommand(1, 61, 11, "objDelete", (CmdImpl) &Grp::impl_objClear);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
654
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
655 RegisterCommand(1, 71, 1000, "objOfFile", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
656 RegisterCommand(1, 71, 1003, "objOfFileGan", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
657 RegisterCommand(1, 71, 1100, "objOfArea", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
658 RegisterCommand(1, 71, 1200, "objOfText", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
659 RegisterCommand(1, 71, 1300, "objDriftOfFile", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
660 RegisterCommand(1, 71, 1400, "objOfDigits", (CmdImpl) &Grp::impl_createObj);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
661
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
662 RegisterCommand(2, 71, 1000, "subObjOfFile", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
663 RegisterCommand(2, 71, 1003, "subObjOfGan", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
664 RegisterCommand(2, 71, 1100, "subObjOfArea", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
665 RegisterCommand(2, 71, 1200, "subObjOfText", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
666 RegisterCommand(2, 71, 1300, "subObjDriftOfFile", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
667 RegisterCommand(2, 71, 1400, "subObjOfDigits", (CmdImpl) &Grp::impl_createObj);
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
668
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
669 //I suppose it's the same thing as createObj*, but I didn't see it in action. For now, mark it unhandled.
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
670 RegisterCommand(1, 72, 1000, "objBgOfFile", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
671 RegisterCommand(1, 72, 1003, "objBgOfFileGan", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
672 RegisterCommand(1, 72, 1100, "objBgOfArea", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
673 RegisterCommand(1, 72, 1200, "objBgOfText", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
674 RegisterCommand(1, 72, 1300, "objBgDriftOfFile", (CmdImpl) &Grp::impl_createObj);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
675 RegisterCommand(1, 72, 1400, "objBgOfDigits", (CmdImpl) &Grp::impl_createObj);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
676
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
677 RegisterCommand(2, 72, 1000, "subObjBgOfFile", NULL);//FIXME
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
678 RegisterCommand(2, 72, 1003, "subObjBgOfGan", NULL);//FIXME
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
679 RegisterCommand(2, 72, 1100, "subObjBgOfArea", NULL);//FIXME
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
680 RegisterCommand(2, 72, 1200, "subObjBgOfText", NULL);//FIXME
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
681 RegisterCommand(2, 72, 1300, "subObjBgDriftOfFile", NULL);//FIXME
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
682 RegisterCommand(2, 72, 1400, "subObjBgOfDigits", NULL);//FIXME;
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
683
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
684 RegisterCommand(1, 73, 0, "ganStop?", NULL); //That's what xclannad says, but I'm not sure...
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
685 RegisterCommand(1, 73, 1000, "ganStop", (CmdImpl) &Grp::impl_gan); //That's what rldev says
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
686 RegisterCommand(1, 73, 3, "ganIsPlaying", (CmdImpl) &Grp::impl_gan);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
687 RegisterCommand(1, 73, 2003, "objPlay", (CmdImpl) &Grp::impl_gan);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
688 RegisterCommand(1, 73, 1001, "ganLoop", (CmdImpl) &Grp::impl_gan);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
689 RegisterCommand(1, 73, 1003, "ganPlay", (CmdImpl) &Grp::impl_gan);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
690 RegisterCommand(1, 73, 1005, "ganPlayOnce", (CmdImpl) &Grp::impl_gan);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
691 RegisterCommand(1, 73, 3001, "ganLoop2", (CmdImpl) &Grp::impl_gan);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
692 RegisterCommand(1, 73, 3003, "ganPlay2", (CmdImpl) &Grp::impl_gan);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
693 RegisterCommand(1, 73, 3005, "ganPlayOnce2", (CmdImpl) &Grp::impl_gan);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
694
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
695 RegisterCommand(2, 73, 0, "ganSubStop?", NULL); //FIXME
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
696 RegisterCommand(2, 73, 1000, "ganSubStop", NULL); //FIXME
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
697 RegisterCommand(2, 73, 3, "ganSubIsPlaying", NULL); //FIXME
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
698 RegisterCommand(2, 73, 2003, "objSubPlay", NULL); //FIXME
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
699 RegisterCommand(2, 73, 1001, "ganSubLoop", NULL); //FIXME
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
700 RegisterCommand(2, 73, 1003, "ganSubPlay", NULL); //FIXME
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
701 RegisterCommand(2, 73, 1005, "ganSubPlayOnce", NULL); //FIXME
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
702 RegisterCommand(2, 73, 3001, "ganSubLoop2", (CmdImpl) &Grp::impl_gan); //FIXME
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
703 RegisterCommand(2, 73, 3003, "ganSubPlay2", NULL); //FIXME
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
704 RegisterCommand(2, 73, 3005, "ganSubPlayOnce2", NULL); //FIXME
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
705
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
706
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
707 RegisterCommand(1, 81, 1000, "objMove", (CmdImpl) &Grp::impl_objSetPos);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
708 RegisterCommand(1, 82, 1000, "objBgMove", (CmdImpl) &Grp::impl_objSetPos);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
709 RegisterCommand(1, 81, 1001, "objLeft", (CmdImpl) &Grp::impl_objSetPos);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
710 RegisterCommand(1, 82, 1001, "objBgLeft", (CmdImpl) &Grp::impl_objSetPos);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
711 RegisterCommand(1, 81, 1002, "objTop", (CmdImpl) &Grp::impl_objSetPos);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
712 RegisterCommand(1, 82, 1002, "objBgTop", (CmdImpl) &Grp::impl_objSetPos);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
713 RegisterCommand(1, 81, 1003, "objAlpha", (CmdImpl) &Grp::impl_objAlpha);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
714 RegisterCommand(1, 82, 1003, "objBgAlpha", (CmdImpl) &Grp::impl_objAlpha);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
715 RegisterCommand(1, 81, 1004, "objShow", (CmdImpl) &Grp::impl_objShow);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
716 RegisterCommand(1, 82, 1004, "objBgShow", (CmdImpl) &Grp::impl_objShow);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
717 RegisterCommand(1, 81, 1005, "objDispArea", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
718 RegisterCommand(1, 82, 1005, "objBgDispArea", NULL);
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
719 RegisterCommand(1, 81, 1006, "objAdjust", (CmdImpl) &Grp::impl_objSetPos);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
720 RegisterCommand(1, 82, 1006, "objBgAdjust", NULL); //FIXME: (CmdImpl) &Grp::impl_objSetPos);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
721 RegisterCommand(1, 81, 1007, "objAdjustX", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
722 RegisterCommand(1, 82, 1007, "objBgAdjustX", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
723 RegisterCommand(1, 81, 1008, "objAdjustY", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
724 RegisterCommand(1, 82, 1008, "objBgAdjustY", NULL);
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
725 RegisterCommand(1, 81, 2006, "objAdjust2?", NULL); //FIXME: (CmdImpl) &Grp::impl_objSetPos); I don't know if it is usefull or properly implemented
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
726 RegisterCommand(1, 82, 2006, "objBgAdjust2?", NULL); //FIXME: (CmdImpl) &Grp::impl_objSetPos); See above
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
727 RegisterCommand(1, 81, 1016, "objColour", NULL); //FIXME: (CmdImpl) &Grp::impl_objColour);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
728 RegisterCommand(1, 82, 1016, "objBgColour", NULL); //FIXME: (CmdImpl) &Grp::impl_objColour);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
729 RegisterCommand(1, 81, 1017, "objColR", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
730 RegisterCommand(1, 82, 1017, "objBgColR", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
731 RegisterCommand(1, 81, 1018, "objColG", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
732 RegisterCommand(1, 82, 1018, "objBgColG", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
733 RegisterCommand(1, 81, 1019, "objColB", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
734 RegisterCommand(1, 82, 1019, "objBgColB", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
735 RegisterCommand(1, 81, 1020, "objColLevel", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
736 RegisterCommand(1, 82, 1020, "objBgColLevel", NULL);
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
737 RegisterCommand(1, 81, 1021, "objComposite", NULL);//(CmdImpl) &Grp::impl_objComposite); //FIXME: May be broken
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
738 RegisterCommand(1, 82, 1021, "objBgComposite", (CmdImpl) &Grp::impl_objComposite);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
739 RegisterCommand(1, 81, 1024, "objSetText", (CmdImpl) &Grp::impl_objSetText);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
740 RegisterCommand(1, 82, 1024, "objBgSetText", (CmdImpl) &Grp::impl_objSetText);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
741 RegisterCommand(1, 81, 1025, "objTextOpts", (CmdImpl) &Grp::impl_objTextOpts); //FIXME: Incomplete
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
742 RegisterCommand(1, 82, 1025, "objBgTextOpts", (CmdImpl) &Grp::impl_objTextOpts);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
743 RegisterCommand(1, 81, 1032, "objOrder", (CmdImpl) &Grp::impl_objOrder);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
744 RegisterCommand(1, 82, 1032, "objBgOrder", (CmdImpl) &Grp::impl_objOrder);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
745 RegisterCommand(1, 81, 1034, "objDispRect", (CmdImpl) &Grp::impl_objDispArea);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
746 RegisterCommand(1, 82, 1034, "objBgDispRect", (CmdImpl) &Grp::impl_objDispArea);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
747 RegisterCommand(1, 81, 1037, "objSetDigits", (CmdImpl) &Grp::impl_objSetDigits);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
748 RegisterCommand(1, 82, 1037, "objBgSetDigits", (CmdImpl) &Grp::impl_objSetDigits);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
749 RegisterCommand(1, 81, 1038, "objNumOpts", (CmdImpl) &Grp::impl_objNumOpts);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
750 RegisterCommand(1, 82, 1038, "objBgNumOpts", (CmdImpl) &Grp::impl_objNumOpts);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
751 RegisterCommand(1, 81, 1039, "objPattNo", (CmdImpl) &Grp::impl_objPattNo);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
752 RegisterCommand(1, 82, 1039, "objBgPattNo", (CmdImpl) &Grp::impl_objPattNo);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
753 RegisterCommand(1, 81, 1046, "objScale", (CmdImpl) &Grp::impl_objScale); //FIXME: Broken behaviour
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
754 RegisterCommand(1, 82, 1046, "objBgScale", (CmdImpl) &Grp::impl_objScale);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
755 RegisterCommand(1, 81, 1047, "objWidth", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
756 RegisterCommand(1, 82, 1047, "objBgWidth", NULL);
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
757 RegisterCommand(1, 81, 1049, "objRotate", (CmdImpl) &Grp::impl_objRotate);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
758 RegisterCommand(1, 82, 1049, "objBgRotate", (CmdImpl) &Grp::impl_objRotate);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
759
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
760 RegisterCommand(2, 81, 1000, "childObjMove", (CmdImpl) &Grp::impl_objSetPos);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
761 RegisterCommand(2, 82, 1000, "childObjBgMove", (CmdImpl) &Grp::impl_objSetPos);
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
762 RegisterCommand(2, 81, 1001, "childObjLeft", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
763 RegisterCommand(2, 82, 1001, "childObjBgLeft", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
764 RegisterCommand(2, 81, 1002, "childObjTop", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
765 RegisterCommand(2, 82, 1002, "childObjBgTop", NULL);
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
766 RegisterCommand(2, 81, 1003, "childObjAlpha", (CmdImpl) &Grp::impl_objAlpha);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
767 RegisterCommand(2, 82, 1003, "childObjBgAlpha", (CmdImpl) &Grp::impl_objAlpha);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
768 RegisterCommand(2, 81, 1004, "childObjShow", (CmdImpl) &Grp::impl_objShow);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
769 RegisterCommand(2, 82, 1004, "childObjBgShow", (CmdImpl) &Grp::impl_objShow);
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
770 RegisterCommand(2, 81, 1005, "childObjDispArea", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
771 RegisterCommand(2, 82, 1005, "childObjBgDispArea", NULL);
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
772 RegisterCommand(2, 81, 1006, "childObjAdjust", (CmdImpl) &Grp::impl_objSetPos);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
773 RegisterCommand(2, 82, 1006, "childObjBgAdjust", (CmdImpl) &Grp::impl_objSetPos);
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
774 RegisterCommand(2, 81, 1007, "childObjAdjustX", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
775 RegisterCommand(2, 82, 1007, "childObjBgAdjustX", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
776 RegisterCommand(2, 81, 1008, "childObjAdjustY", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
777 RegisterCommand(2, 82, 1008, "childObjBgAdjustY", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
778 RegisterCommand(2, 81, 2006, "childObjAdjust2?", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
779 RegisterCommand(2, 82, 2006, "childObjBgAdjust2?", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
780 RegisterCommand(2, 81, 1016, "childObjColour", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
781 RegisterCommand(2, 82, 1016, "childObjBgColour", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
782 RegisterCommand(2, 81, 1017, "childObjColR", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
783 RegisterCommand(2, 82, 1017, "childObjBgColR", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
784 RegisterCommand(2, 81, 1018, "childObjColG", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
785 RegisterCommand(2, 82, 1018, "childObjBgColG", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
786 RegisterCommand(2, 81, 1019, "childObjColB", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
787 RegisterCommand(2, 82, 1019, "childObjBgColB", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
788 RegisterCommand(2, 81, 1020, "childObjColLevel", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
789 RegisterCommand(2, 82, 1020, "childObjBgColLevel", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
790 RegisterCommand(2, 81, 1021, "childObjComposite", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
791 RegisterCommand(2, 82, 1021, "childObjBgComposite", NULL);
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
792 RegisterCommand(2, 81, 1024, "childObjSetText", (CmdImpl) &Grp::impl_objSetText);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
793 RegisterCommand(2, 82, 1024, "childObjBgSetText", (CmdImpl) &Grp::impl_objSetText);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
794 RegisterCommand(2, 81, 1025, "childObjTextOpts", (CmdImpl) &Grp::impl_objTextOpts);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
795 RegisterCommand(2, 82, 1025, "childObjBgTextOpts", (CmdImpl) &Grp::impl_objTextOpts);
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
796 RegisterCommand(2, 81, 1032, "childObjOrder", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
797 RegisterCommand(2, 82, 1032, "childObjBgOrder", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
798 RegisterCommand(2, 81, 1034, "childObjDispRect", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
799 RegisterCommand(2, 82, 1034, "childObjBgDispRect", NULL);
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
800 RegisterCommand(2, 81, 1037, "childObjSetDigits", (CmdImpl) &Grp::impl_objSetDigits);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
801 RegisterCommand(2, 82, 1037, "childObjBgSetDigits", (CmdImpl) &Grp::impl_objSetDigits);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
802 RegisterCommand(2, 81, 1038, "childObjNumOpts", (CmdImpl) &Grp::impl_objNumOpts);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
803 RegisterCommand(2, 82, 1038, "childObjBgNumOpts", (CmdImpl) &Grp::impl_objNumOpts);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
804 RegisterCommand(2, 81, 1039, "childObjPattNo", (CmdImpl) &Grp::impl_objPattNo);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
805 RegisterCommand(2, 82, 1039, "childObjBgPattNo", (CmdImpl) &Grp::impl_objPattNo);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
806 RegisterCommand(2, 81, 1046, "childObjScale", (CmdImpl) &Grp::impl_objScale);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
807 RegisterCommand(2, 82, 1046, "childObjBgScale", (CmdImpl) &Grp::impl_objScale);
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
808 RegisterCommand(2, 81, 1047, "childObjWidth", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
809 RegisterCommand(2, 82, 1047, "childObjBgWidth", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
810 RegisterCommand(2, 81, 1049, "childObjRotate", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
811 RegisterCommand(2, 82, 1049, "childObjBgRotate", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
812
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
813 RegisterCommand(1, 84, 1000, "objGetPos", (CmdImpl) &Grp::impl_objPosDims);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
814 RegisterCommand(1, 84, 1100, "objGetDims", (CmdImpl) &Grp::impl_objPosDims);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
815
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
816 RegisterCommand(2, 84, 1000, "childObjGetPos", (CmdImpl) &Grp::impl_objPosDims);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
817 RegisterCommand(2, 84, 1100, "childObjGetDims", (CmdImpl) &Grp::impl_objPosDims);
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
818
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
819 RegisterCommand(1, 31, 0, "refresh", (CmdImpl) &Grp::impl_refresh);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
820
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
821 RegisterCommand(1, 20, 0, "bgmLoop", (CmdImpl) &Grp::impl_bgmLoop);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
822 RegisterCommand(1, 20, 1, "bgmPlayEx", (CmdImpl) &Grp::impl_bgmLoop); //FIXME: wait
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
823 RegisterCommand(1, 20, 2, "bgmPlay", (CmdImpl) &Grp::impl_bgmLoop);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
824 RegisterCommand(1, 20, 5, "bgmStop", (CmdImpl) &Grp::impl_bgmStop);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
825 RegisterCommand(1, 20, 105, "bgmFadeOut", (CmdImpl) &Grp::impl_bgmStop);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
826
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
827 RegisterCommand(1, 21, 0, "wavPlay", (CmdImpl) &Grp::impl_playWav);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
828 RegisterCommand(1, 21, 1, "wavPlayEx", (CmdImpl) &Grp::impl_playWav);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
829 RegisterCommand(1, 21, 2, "wavLoop", (CmdImpl) &Grp::impl_playWav);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
830 RegisterCommand(1, 21, 3, "wavWait", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
831 RegisterCommand(1, 21, 4, "wavPlaying", NULL);
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
832 RegisterCommand(1, 21, 5, "wavStop", (CmdImpl) &Grp::impl_stopWav);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
833 RegisterCommand(1, 21, 105, "wavFadeout", (CmdImpl) &Grp::impl_stopWav);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
834
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
835 RegisterCommand(1, 22, 0, "sePlay", (CmdImpl) &Grp::impl_playSE);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
836
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
837 RegisterCommand(1, 4, 2230, "SetBgmVolMod", (CmdImpl) &Grp::impl_SetVolMod);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
838 RegisterCommand(1, 4, 2231, "SetKoeVolMod", (CmdImpl) &Grp::impl_SetVolMod);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
839 RegisterCommand(1, 4, 2232, "SetPCMVolMod", (CmdImpl) &Grp::impl_SetVolMod);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
840 RegisterCommand(1, 4, 2233, "SetSeVolMod", (CmdImpl) &Grp::impl_SetVolMod);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
841 RegisterCommand(1, 4, 2330, "BgmVolMod", (CmdImpl) &Grp::impl_GetVolMod);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
842 RegisterCommand(1, 4, 2331, "KoeVolMod", (CmdImpl) &Grp::impl_GetVolMod);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
843 RegisterCommand(1, 4, 2332, "PCMVolMod", (CmdImpl) &Grp::impl_GetVolMod);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
844 RegisterCommand(1, 4, 2333, "SeVolMod", (CmdImpl) &Grp::impl_GetVolMod);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
845
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
846 RegisterCommand(1, 23, 0, "koePlay", (CmdImpl) &Grp::impl_koePlay);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
847 RegisterCommand(1, 23, 1, "koePlayEx", (CmdImpl) &Grp::impl_koePlay); //FIXME
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
848 RegisterCommand(1, 23, 7, "koePlayExC", (CmdImpl) &Grp::impl_koePlay); //FIXME
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
849 RegisterCommand(1, 23, 8, "koeDoPlay", (CmdImpl) &Grp::impl_koePlay); //FIXME
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
850 RegisterCommand(1, 23, 9, "koeDoPlayEx", (CmdImpl) &Grp::impl_koePlay); //FIXME
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
851 RegisterCommand(1, 23, 10, "koeDoPlayExC", (CmdImpl) &Grp::impl_koePlay); //FIXME
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
852
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
853 RegisterCommand(1, 26, 1, "movPlayEx", (CmdImpl) &Grp::impl_movPlay);
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
854 RegisterCommand(1, 26, 20, "movPlayExC", (CmdImpl) &Grp::impl_movPlay);
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
855
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
856 RegisterCommand(1, 61, 14, "objSwap?", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
857 RegisterCommand(1, 62, 14, "objSwap?", NULL);
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
858
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
859 RegisterCommand(1, 4, 1211, "EnableSyscom", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
860 RegisterCommand(1, 4, 1212, "HideSyscom", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
861 RegisterCommand(1, 4, 1213, "DisableSyscom", NULL);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
862
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
863 anm1 = NULL;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
864 anm2 = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
865 }
223b71206888 Initial import
thib
parents:
diff changeset
866
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
867 Grp::~Grp() {
0
223b71206888 Initial import
thib
parents:
diff changeset
868 map<int,GrpObj>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
869 for (it=grpobj.begin(); it!=grpobj.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
870 PicBase* p = it->second.DeletePic();
223b71206888 Initial import
thib
parents:
diff changeset
871 delete p;
223b71206888 Initial import
thib
parents:
diff changeset
872 }
223b71206888 Initial import
thib
parents:
diff changeset
873
223b71206888 Initial import
thib
parents:
diff changeset
874 delete screen;
223b71206888 Initial import
thib
parents:
diff changeset
875 delete screen_front;
223b71206888 Initial import
thib
parents:
diff changeset
876 parent.Root().DeleteSurface(surface);
50
35ce1a30f3f9 * Added va_end where there is a va_start
thib
parents: 48
diff changeset
877 parent.Root().DeleteSurface(surface_update);
0
223b71206888 Initial import
thib
parents:
diff changeset
878 int i;
223b71206888 Initial import
thib
parents:
diff changeset
879 for (i=0; i<MAXPDT; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
880 if (ssurface[i]) parent.Root().DeleteSurface(ssurface[i]);
223b71206888 Initial import
thib
parents:
diff changeset
881 if (dsurface[i]) parent.Root().DeleteSurface(dsurface[i]);
223b71206888 Initial import
thib
parents:
diff changeset
882 }
223b71206888 Initial import
thib
parents:
diff changeset
883 }
223b71206888 Initial import
thib
parents:
diff changeset
884
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
885 Surface* Grp::Dsurface(int pdt) {
0
223b71206888 Initial import
thib
parents:
diff changeset
886 if (pdt == 0) return surface;
223b71206888 Initial import
thib
parents:
diff changeset
887 if (dsurface[pdt] == 0) { // とりあえず画面の大きさということにする
223b71206888 Initial import
thib
parents:
diff changeset
888 if (pdt == WORKPDT)
223b71206888 Initial import
thib
parents:
diff changeset
889 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
890 else
223b71206888 Initial import
thib
parents:
diff changeset
891 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
892 }
223b71206888 Initial import
thib
parents:
diff changeset
893 if (ssurface[pdt]) { // ssurface が存在すれば、dsurface にコピーして返す
223b71206888 Initial import
thib
parents:
diff changeset
894 DSurfaceMove(ssurface[pdt], Rect(*ssurface[pdt]), dsurface[pdt], Rect(0,0));
223b71206888 Initial import
thib
parents:
diff changeset
895 parent.Root().DeleteSurface(ssurface[pdt]);
223b71206888 Initial import
thib
parents:
diff changeset
896 ssurface[pdt] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
897 }
223b71206888 Initial import
thib
parents:
diff changeset
898 return dsurface[pdt];
223b71206888 Initial import
thib
parents:
diff changeset
899 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
900
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
901 GrpObj* Grp::GetGraphicObj(int grp, bool fg) {
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
902 if (fg)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
903 return &grpobj[grp];
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
904 else
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
905 return &bs_obj[grp];
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
906 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
907
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
908 GrpObj* Grp::GetGraphicObj(int grp, int index, bool fg) {
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
909 GrpObj* g = GetGraphicObj(grp, fg);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
910 return &g->children_obj[index];
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
911 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
912
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
913 GrpObj* Grp::GetGraphicObjVarMode(Cmd& cmd, int &base_arg, bool fg) {
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
914 GrpObj* g;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
915 if (cmd.cmd1 == 2) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
916 g = GetGraphicObj(cmd.args[base_arg].value, cmd.args[base_arg+1].value, fg);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
917 base_arg += 1;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
918 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
919 else
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
920 g = GetGraphicObj(cmd.args[base_arg].value, fg);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
921 return g;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
922 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
923
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
924 #include <SDL.h>
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
925 Surface* Grp::Ssurface(int pdt) {
0
223b71206888 Initial import
thib
parents:
diff changeset
926 if (pdt == 0) return surface;
223b71206888 Initial import
thib
parents:
diff changeset
927 if (ssurface[pdt]) {
223b71206888 Initial import
thib
parents:
diff changeset
928 return ssurface[pdt];
223b71206888 Initial import
thib
parents:
diff changeset
929 }
223b71206888 Initial import
thib
parents:
diff changeset
930 return Dsurface(pdt);
223b71206888 Initial import
thib
parents:
diff changeset
931 }
223b71206888 Initial import
thib
parents:
diff changeset
932
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
933 void Grp::LoadSurface(const char* str, int pdt) {
0
223b71206888 Initial import
thib
parents:
diff changeset
934 string s = str;
223b71206888 Initial import
thib
parents:
diff changeset
935 if (cgm_info.find(s) != cgm_info.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
936 cgm_data.insert(cgm_info[s]);
223b71206888 Initial import
thib
parents:
diff changeset
937 }
223b71206888 Initial import
thib
parents:
diff changeset
938 Surface* bg = parent.Root().NewSurface(s.c_str());
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
939 if (bg == NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
940 s += ".g00";
223b71206888 Initial import
thib
parents:
diff changeset
941 bg = parent.Root().NewSurface(s.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
942 }
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
943 if (bg != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
944 if (ssurface[pdt]) parent.Root().DeleteSurface(ssurface[pdt]);
223b71206888 Initial import
thib
parents:
diff changeset
945 ssurface[pdt] = bg;
223b71206888 Initial import
thib
parents:
diff changeset
946 if (pdt == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
947 /* とりあえず Princess Bride のアニメーション効果専用 */
223b71206888 Initial import
thib
parents:
diff changeset
948 Rect r(*ssurface[0]);
223b71206888 Initial import
thib
parents:
diff changeset
949 Rect dr(*surface);
223b71206888 Initial import
thib
parents:
diff changeset
950 int x = (dr.width()-r.width())/2;
223b71206888 Initial import
thib
parents:
diff changeset
951 int y = (dr.height()-r.height())/2;
223b71206888 Initial import
thib
parents:
diff changeset
952 DSurfaceMove(ssurface[0], r, surface, Rect(x,y));
223b71206888 Initial import
thib
parents:
diff changeset
953 parent.Root().DeleteSurface(ssurface[0]);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
954 ssurface[0] = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
955 screen->SetSurface(surface, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
956 }
223b71206888 Initial import
thib
parents:
diff changeset
957 } else {
223b71206888 Initial import
thib
parents:
diff changeset
958 if (str[0] != 0)
223b71206888 Initial import
thib
parents:
diff changeset
959 fprintf(stderr,"Cannot find surface %d <- '%s'\n",pdt,str);
223b71206888 Initial import
thib
parents:
diff changeset
960 }
223b71206888 Initial import
thib
parents:
diff changeset
961 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
962
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
963 void Grp::InitSel(void) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
964 int i;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
965 int args[16];
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
966 char key[10];
0
223b71206888 Initial import
thib
parents:
diff changeset
967 for (i=0; i<999; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
968 sprintf(key, "#SEL.%03d",i);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
969 if (config->GetParam(key, 15, &args[0], &args[1],
0
223b71206888 Initial import
thib
parents:
diff changeset
970 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7],
223b71206888 Initial import
thib
parents:
diff changeset
971 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13],
223b71206888 Initial import
thib
parents:
diff changeset
972 &args[14])) {
223b71206888 Initial import
thib
parents:
diff changeset
973
223b71206888 Initial import
thib
parents:
diff changeset
974 sprintf(key, "#SELR.%03d", i);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
975 if (config->GetParam(key, 16, &args[0], &args[1],
0
223b71206888 Initial import
thib
parents:
diff changeset
976 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7],
223b71206888 Initial import
thib
parents:
diff changeset
977 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13],
223b71206888 Initial import
thib
parents:
diff changeset
978 &args[14], &args[15])) continue;
223b71206888 Initial import
thib
parents:
diff changeset
979 }
223b71206888 Initial import
thib
parents:
diff changeset
980 SEL& s = anmtype[i];
223b71206888 Initial import
thib
parents:
diff changeset
981 s.from = Rect(args[0], args[1], args[2]+1, args[3]+1);
223b71206888 Initial import
thib
parents:
diff changeset
982 s.to = Rect(args[4], args[5]);
223b71206888 Initial import
thib
parents:
diff changeset
983 s.time = args[6];
223b71206888 Initial import
thib
parents:
diff changeset
984 s.sel_no = args[7];
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
985 int j;
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
986 for (j=0; j<8; j++) s.args[j] = args[8+j];
0
223b71206888 Initial import
thib
parents:
diff changeset
987 }
223b71206888 Initial import
thib
parents:
diff changeset
988 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
989
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
990 void Grp::SetSkipMode(SkipMode _mode) {
0
223b71206888 Initial import
thib
parents:
diff changeset
991 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
992 RefreshObj();
223b71206888 Initial import
thib
parents:
diff changeset
993 } else if ( (skip_mode & SKIP_IN_MENU) == 0 && (_mode & SKIP_IN_MENU) ) {
223b71206888 Initial import
thib
parents:
diff changeset
994 }
223b71206888 Initial import
thib
parents:
diff changeset
995 skip_mode = _mode;
223b71206888 Initial import
thib
parents:
diff changeset
996 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
997
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
998 void Grp::SetObjChanged(int num) {
0
223b71206888 Initial import
thib
parents:
diff changeset
999 changed_obj.insert(num);
223b71206888 Initial import
thib
parents:
diff changeset
1000 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1001
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1002 void Grp::RefreshObj(void) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1003 if (!deleted_pic.empty()) {
223b71206888 Initial import
thib
parents:
diff changeset
1004 vector<PicBase*>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
1005 for (it=deleted_pic.begin(); it!=deleted_pic.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1006 if (*it) delete *it;
223b71206888 Initial import
thib
parents:
diff changeset
1007 }
223b71206888 Initial import
thib
parents:
diff changeset
1008 deleted_pic.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1009 }
223b71206888 Initial import
thib
parents:
diff changeset
1010 if (!changed_obj.empty()) {
223b71206888 Initial import
thib
parents:
diff changeset
1011 set<int>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
1012 for (it=changed_obj.begin(); it != changed_obj.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1013 if (grpobj.find(*it) == grpobj.end()) continue;
223b71206888 Initial import
thib
parents:
diff changeset
1014 GrpObj& obj = grpobj[*it];
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1015 obj.Refresh(obj);
0
223b71206888 Initial import
thib
parents:
diff changeset
1016 }
223b71206888 Initial import
thib
parents:
diff changeset
1017 changed_obj.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1018 }
223b71206888 Initial import
thib
parents:
diff changeset
1019 if (reserved_load_surface0.length() != 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1020 LoadSurface(reserved_load_surface0.c_str(), 0);
223b71206888 Initial import
thib
parents:
diff changeset
1021 reserved_load_surface0 = "";
223b71206888 Initial import
thib
parents:
diff changeset
1022 }
223b71206888 Initial import
thib
parents:
diff changeset
1023 screen->ReBlit();
223b71206888 Initial import
thib
parents:
diff changeset
1024 }
223b71206888 Initial import
thib
parents:
diff changeset
1025
223b71206888 Initial import
thib
parents:
diff changeset
1026
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1027 #include <SDL.h>
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1028 void Grp::StartAnm(int type) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1029 SEL sel;
223b71206888 Initial import
thib
parents:
diff changeset
1030
223b71206888 Initial import
thib
parents:
diff changeset
1031 if (anmtype.find(type) == anmtype.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
1032 if (anmtype.find(0) == anmtype.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
1033 sel.sel_no = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1034 sel.from = Rect(*surface);
223b71206888 Initial import
thib
parents:
diff changeset
1035 sel.to = Rect(0,0);
223b71206888 Initial import
thib
parents:
diff changeset
1036 sel.time = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1037 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1038 sel = anmtype[0];
223b71206888 Initial import
thib
parents:
diff changeset
1039 }
223b71206888 Initial import
thib
parents:
diff changeset
1040 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1041 sel = anmtype[type];
223b71206888 Initial import
thib
parents:
diff changeset
1042 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1043 if (anm1 != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1044 fprintf(stderr,"Warning: StartAnm() called before anm1 finished\n");
223b71206888 Initial import
thib
parents:
diff changeset
1045 anm1->Abort();
223b71206888 Initial import
thib
parents:
diff changeset
1046 delete anm1;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1047 anm1 = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1048 }
223b71206888 Initial import
thib
parents:
diff changeset
1049 map<int,GrpObj>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
1050 // 現在表示中のobjectを消去
223b71206888 Initial import
thib
parents:
diff changeset
1051 deleted_pic.push_back(screen);
223b71206888 Initial import
thib
parents:
diff changeset
1052 for (it=grpobj.begin(); it!=grpobj.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1053 if (! (it->second.attr & GrpObj::WIPEON)) { // 画像切り替え時に object 削除
223b71206888 Initial import
thib
parents:
diff changeset
1054 deleted_pic.push_back(it->second.DeletePic());
223b71206888 Initial import
thib
parents:
diff changeset
1055 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1056 GrpObj& new_obj = bs_obj[it->first];
223b71206888 Initial import
thib
parents:
diff changeset
1057 if (new_obj.name.empty()) { // 新しい object が存在しなければ内容を引き継ぐ
223b71206888 Initial import
thib
parents:
diff changeset
1058 new_obj = it->second;
223b71206888 Initial import
thib
parents:
diff changeset
1059 it->second.DeletePic();
223b71206888 Initial import
thib
parents:
diff changeset
1060 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1061 new_obj.attr = GrpObj::Attribute(new_obj.attr | GrpObj::WIPEON);
223b71206888 Initial import
thib
parents:
diff changeset
1062 deleted_pic.push_back(it->second.DeletePic());
223b71206888 Initial import
thib
parents:
diff changeset
1063 }
223b71206888 Initial import
thib
parents:
diff changeset
1064 }
223b71206888 Initial import
thib
parents:
diff changeset
1065 }
223b71206888 Initial import
thib
parents:
diff changeset
1066 grpobj.clear(); // 全オブジェクト削除
223b71206888 Initial import
thib
parents:
diff changeset
1067
223b71206888 Initial import
thib
parents:
diff changeset
1068 // 全画像オブジェクトの前にscreen 移動
223b71206888 Initial import
thib
parents:
diff changeset
1069 // 新しい screen_front を作成しておく
223b71206888 Initial import
thib
parents:
diff changeset
1070 screen = screen_front;
223b71206888 Initial import
thib
parents:
diff changeset
1071 screen->hide();
223b71206888 Initial import
thib
parents:
diff changeset
1072 screen->SetSurface(surface_update, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
1073 parent.Root().BlitSurface(Dsurface(1), Rect(*surface_update), surface_update, Rect(0,0));
223b71206888 Initial import
thib
parents:
diff changeset
1074
223b71206888 Initial import
thib
parents:
diff changeset
1075 screen_front = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0);
223b71206888 Initial import
thib
parents:
diff changeset
1076 screen_front->hide();
223b71206888 Initial import
thib
parents:
diff changeset
1077 screen_front->ZMove(screen);
223b71206888 Initial import
thib
parents:
diff changeset
1078
223b71206888 Initial import
thib
parents:
diff changeset
1079 // 新しい object へ更新、surface_update へ新しい object を表示
223b71206888 Initial import
thib
parents:
diff changeset
1080 // (object 作成時は picture は hide されている)
223b71206888 Initial import
thib
parents:
diff changeset
1081 for (it=bs_obj.begin(); it!=bs_obj.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1082 grpobj[it->first] = it->second;
223b71206888 Initial import
thib
parents:
diff changeset
1083 it->second.DeletePic();
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1084 CreateObj(it->first);//FIXME: Adapt to groups
0
223b71206888 Initial import
thib
parents:
diff changeset
1085 GrpObj& g = grpobj[it->first];
223b71206888 Initial import
thib
parents:
diff changeset
1086 if (g.picture) {
223b71206888 Initial import
thib
parents:
diff changeset
1087 g.Update();
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1088 if (g.alpha == 0 || (g.attr & GrpObj::HIDDEN)) ;
0
223b71206888 Initial import
thib
parents:
diff changeset
1089 else g.picture->SimpleBlit(surface_update);
223b71206888 Initial import
thib
parents:
diff changeset
1090 g.picture->hide();
223b71206888 Initial import
thib
parents:
diff changeset
1091 }
223b71206888 Initial import
thib
parents:
diff changeset
1092 }
223b71206888 Initial import
thib
parents:
diff changeset
1093 bs_obj.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1094 // 画像効果開始
223b71206888 Initial import
thib
parents:
diff changeset
1095 switch(sel.sel_no) {
223b71206888 Initial import
thib
parents:
diff changeset
1096 default:
223b71206888 Initial import
thib
parents:
diff changeset
1097 case 0: case 50: // 0 と 50 の違いが良くわからない
223b71206888 Initial import
thib
parents:
diff changeset
1098 if (skip_mode & SKIP_GRP_NOEFFEC)
223b71206888 Initial import
thib
parents:
diff changeset
1099 anm1 = new WidAnmAlpha(event, screen, ALPHA_MAX, ALPHA_MAX, 0);
223b71206888 Initial import
thib
parents:
diff changeset
1100 else if (skip_mode & SKIP_GRP_FAST)
223b71206888 Initial import
thib
parents:
diff changeset
1101 anm1 = new WidAnmAlpha(event, screen, 0, ALPHA_MAX, sel.time/4);
223b71206888 Initial import
thib
parents:
diff changeset
1102 else
223b71206888 Initial import
thib
parents:
diff changeset
1103 anm1 = new WidAnmAlpha(event, screen, 0, ALPHA_MAX, sel.time);
223b71206888 Initial import
thib
parents:
diff changeset
1104 break;
223b71206888 Initial import
thib
parents:
diff changeset
1105 }
223b71206888 Initial import
thib
parents:
diff changeset
1106 if (anm1) anm1->Play();
223b71206888 Initial import
thib
parents:
diff changeset
1107 if (skip_mode & SKIP_GRP_NOEFFEC) AbortAnm();
223b71206888 Initial import
thib
parents:
diff changeset
1108 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1109
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1110 void Grp::StartShake(int total, const int* pattern) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1111 if (anm2) {
223b71206888 Initial import
thib
parents:
diff changeset
1112 fprintf(stderr,"Warning: StartShake() called before another animation finished\n");
223b71206888 Initial import
thib
parents:
diff changeset
1113 anm2->Abort();
223b71206888 Initial import
thib
parents:
diff changeset
1114 delete anm2;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1115 anm2 = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1116 }
223b71206888 Initial import
thib
parents:
diff changeset
1117 if (skip_mode & SKIP_GRP_NOEFFEC) return;
223b71206888 Initial import
thib
parents:
diff changeset
1118 AnmAlphaMove* new_anm = new AnmAlphaMove(event, &parent); // shake screen では元画面の座標を揺らす
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1119 int i;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1120 int tm = 0;
0
223b71206888 Initial import
thib
parents:
diff changeset
1121 for (i=0; i<total; i+=3) {
223b71206888 Initial import
thib
parents:
diff changeset
1122 int x = pattern[i];
223b71206888 Initial import
thib
parents:
diff changeset
1123 int y = pattern[i+1];
223b71206888 Initial import
thib
parents:
diff changeset
1124 new_anm->ptns.push_back(AnmAlphaMove::Ptn(Rect(x,y), Rect(0,0), 255, tm));
223b71206888 Initial import
thib
parents:
diff changeset
1125 tm += pattern[i+2];
223b71206888 Initial import
thib
parents:
diff changeset
1126 }
223b71206888 Initial import
thib
parents:
diff changeset
1127 new_anm->ptns.push_back(AnmAlphaMove::Ptn(Rect(0,0), Rect(0,0), 255, tm));
223b71206888 Initial import
thib
parents:
diff changeset
1128 new_anm->SetPtn(); // パターン登録終了
223b71206888 Initial import
thib
parents:
diff changeset
1129 new_anm->Play();
223b71206888 Initial import
thib
parents:
diff changeset
1130 anm2 = new_anm;
223b71206888 Initial import
thib
parents:
diff changeset
1131 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1132
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1133 void Grp::AbortAnm(void) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1134 if (anm1 == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1135 anm1->Abort();
223b71206888 Initial import
thib
parents:
diff changeset
1136 delete anm1;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1137 anm1 = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1138 /* 画像効果終了 */
223b71206888 Initial import
thib
parents:
diff changeset
1139 /* 古い画面への画像効果があれば消去 */
223b71206888 Initial import
thib
parents:
diff changeset
1140 if (anm2 && anm2->pic[0] != screen) {
223b71206888 Initial import
thib
parents:
diff changeset
1141 anm2->Abort();
223b71206888 Initial import
thib
parents:
diff changeset
1142 delete anm2;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1143 anm2 = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1144 }
223b71206888 Initial import
thib
parents:
diff changeset
1145 /* pdt1 -> pdt0 へコピー */
223b71206888 Initial import
thib
parents:
diff changeset
1146 DSurfaceMove(dsurface[1], Rect(*dsurface[1]), surface, Rect(0,0));
223b71206888 Initial import
thib
parents:
diff changeset
1147 screen->SetSurface(surface, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
1148 // 画像効果開始時に存在したobjectを消去
223b71206888 Initial import
thib
parents:
diff changeset
1149 // 新しい object 表示
223b71206888 Initial import
thib
parents:
diff changeset
1150 RefreshObj();
223b71206888 Initial import
thib
parents:
diff changeset
1151 return;
223b71206888 Initial import
thib
parents:
diff changeset
1152 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1153
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1154 void Grp::LoadSurface(const char* str) {
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1155 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了
0
223b71206888 Initial import
thib
parents:
diff changeset
1156 LoadSurface(str, 1);
223b71206888 Initial import
thib
parents:
diff changeset
1157 bg_name = str;
223b71206888 Initial import
thib
parents:
diff changeset
1158 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1159
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1160 void Grp::LoadSurface(void) {
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1161 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了
0
223b71206888 Initial import
thib
parents:
diff changeset
1162 LoadSurface(bg_name.c_str(), 1);
223b71206888 Initial import
thib
parents:
diff changeset
1163 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1164
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1165 void Grp::AddSurface(const char* str) {
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1166 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了
0
223b71206888 Initial import
thib
parents:
diff changeset
1167 LoadSurface(bg_name.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
1168
223b71206888 Initial import
thib
parents:
diff changeset
1169 string s = str;
223b71206888 Initial import
thib
parents:
diff changeset
1170 Surface* front = parent.Root().NewSurface(s.c_str());
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1171 if (front == NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1172 s += ".g00";
223b71206888 Initial import
thib
parents:
diff changeset
1173 front = parent.Root().NewSurface(s.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
1174 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1175 if (front != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1176 parent.Root().BlitSurface(front, Rect(*front), Dsurface(1), Rect(0,0));
223b71206888 Initial import
thib
parents:
diff changeset
1177 parent.Root().DeleteSurface(front);
223b71206888 Initial import
thib
parents:
diff changeset
1178 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1179 fprintf(stderr,"Cannot find surface %s\n",str);
223b71206888 Initial import
thib
parents:
diff changeset
1180 }
223b71206888 Initial import
thib
parents:
diff changeset
1181 }
223b71206888 Initial import
thib
parents:
diff changeset
1182
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1183 void Grp::CreateObj(int index) {
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1184 GrpObjMap::iterator cur = grpobj.find(index);
0
223b71206888 Initial import
thib
parents:
diff changeset
1185 if (cur == grpobj.end()) return;
223b71206888 Initial import
thib
parents:
diff changeset
1186 GrpObj& g = grpobj[index];
223b71206888 Initial import
thib
parents:
diff changeset
1187 g.CreateSurface(&parent);
223b71206888 Initial import
thib
parents:
diff changeset
1188 g.order = index;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1189 if (g.picture == NULL) return; // エラー:surface が存在しない
0
223b71206888 Initial import
thib
parents:
diff changeset
1190 g.picture->hide();
223b71206888 Initial import
thib
parents:
diff changeset
1191 SetObjChanged(index);
223b71206888 Initial import
thib
parents:
diff changeset
1192 ZMoveObj(index);
223b71206888 Initial import
thib
parents:
diff changeset
1193 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1194
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1195 void Grp::CreateSubObj(int grp_index, int index) {
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1196 GrpObjMap::iterator cur = grpobj.find(grp_index);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1197 if (cur == grpobj.end()) return;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1198 GrpObj* g = &grpobj[grp_index];
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1199 cur = g->children_obj.find(index);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1200 if (cur == g->children_obj.end()) return;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1201 g = &g->children_obj[index];
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1202 g->CreateSurface(&parent);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1203 g->order = index;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1204 if (g->picture == NULL) return; // エラー:surface が存在しない
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1205 g->picture->hide();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1206 //TODO
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1207 SetObjChanged(grp_index);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1208 /*ZMoveObj(index);*/
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1209 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1210
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1211 void Grp::ZMoveObj(int index) {
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1212 GrpObjMap::iterator cur = grpobj.find(index);
0
223b71206888 Initial import
thib
parents:
diff changeset
1213 if (cur == grpobj.end()) return;
223b71206888 Initial import
thib
parents:
diff changeset
1214 GrpObj& g = grpobj[index];
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1215 if (g.picture == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1216 // 自分より前に object があれば、その前に表示
223b71206888 Initial import
thib
parents:
diff changeset
1217 // そうでなければ screen の前に表示
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1218 GrpObjMap::iterator cur_backobj = grpobj.end();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1219 GrpObjMap::iterator it;
0
223b71206888 Initial import
thib
parents:
diff changeset
1220 for (it = grpobj.begin(); it != grpobj.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1221 if (it == cur) continue;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1222 if (it->second.picture == NULL) continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
1223 if (it->second.order < g.order) {
223b71206888 Initial import
thib
parents:
diff changeset
1224 if (cur_backobj == grpobj.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
1225 cur_backobj = it;
223b71206888 Initial import
thib
parents:
diff changeset
1226 } else if (cur_backobj->second.order < it->second.order) {
223b71206888 Initial import
thib
parents:
diff changeset
1227 cur_backobj = it;
223b71206888 Initial import
thib
parents:
diff changeset
1228 }
223b71206888 Initial import
thib
parents:
diff changeset
1229 }
223b71206888 Initial import
thib
parents:
diff changeset
1230 }
223b71206888 Initial import
thib
parents:
diff changeset
1231 if (cur_backobj == grpobj.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
1232 g.picture->ZMove(screen);
223b71206888 Initial import
thib
parents:
diff changeset
1233 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1234 g.picture->ZMove(cur_backobj->second.picture);
223b71206888 Initial import
thib
parents:
diff changeset
1235 }
223b71206888 Initial import
thib
parents:
diff changeset
1236 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1237
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1238 void Grp::SwapObj(int index1, int index2) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1239 // デフォルト値から order が変更されていた場合のみ、order は保存される
223b71206888 Initial import
thib
parents:
diff changeset
1240 // まずは両方のobjectをswap
223b71206888 Initial import
thib
parents:
diff changeset
1241 if (grpobj.find(index1) == grpobj.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
1242 if (grpobj.find(index2) == grpobj.end()) return; // どちらの object も存在しない
223b71206888 Initial import
thib
parents:
diff changeset
1243 grpobj[index1] = grpobj[index2];
223b71206888 Initial import
thib
parents:
diff changeset
1244 if (grpobj[index1].order == index2)
223b71206888 Initial import
thib
parents:
diff changeset
1245 grpobj[index1].order = index1;
223b71206888 Initial import
thib
parents:
diff changeset
1246 grpobj[index2].DeletePic();
223b71206888 Initial import
thib
parents:
diff changeset
1247 grpobj.erase(index2);
223b71206888 Initial import
thib
parents:
diff changeset
1248 ZMoveObj(index1);
223b71206888 Initial import
thib
parents:
diff changeset
1249 return;
223b71206888 Initial import
thib
parents:
diff changeset
1250 } else if (grpobj.find(index2) == grpobj.end()) { // index2 が存在しない場合
223b71206888 Initial import
thib
parents:
diff changeset
1251 grpobj[index2] = grpobj[index1];
223b71206888 Initial import
thib
parents:
diff changeset
1252 if (grpobj[index2].order == index1)
223b71206888 Initial import
thib
parents:
diff changeset
1253 grpobj[index2].order = index2;
223b71206888 Initial import
thib
parents:
diff changeset
1254 grpobj[index1].DeletePic();
223b71206888 Initial import
thib
parents:
diff changeset
1255 grpobj.erase(index1);
223b71206888 Initial import
thib
parents:
diff changeset
1256 ZMoveObj(index2);
223b71206888 Initial import
thib
parents:
diff changeset
1257 return;
223b71206888 Initial import
thib
parents:
diff changeset
1258 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1259 GrpObj obj = grpobj[index1];
223b71206888 Initial import
thib
parents:
diff changeset
1260 grpobj[index1] = grpobj[index2];
223b71206888 Initial import
thib
parents:
diff changeset
1261 grpobj[index2].DeletePic();
223b71206888 Initial import
thib
parents:
diff changeset
1262 if (grpobj[index1].order == index2)
223b71206888 Initial import
thib
parents:
diff changeset
1263 grpobj[index1].order = index1;
223b71206888 Initial import
thib
parents:
diff changeset
1264 ZMoveObj(index1);
223b71206888 Initial import
thib
parents:
diff changeset
1265 grpobj[index2] = obj;
223b71206888 Initial import
thib
parents:
diff changeset
1266 if (grpobj[index2].order == index1)
223b71206888 Initial import
thib
parents:
diff changeset
1267 grpobj[index2].order = index2;
223b71206888 Initial import
thib
parents:
diff changeset
1268 ZMoveObj(index2);
223b71206888 Initial import
thib
parents:
diff changeset
1269 obj.DeletePic();
223b71206888 Initial import
thib
parents:
diff changeset
1270 }
223b71206888 Initial import
thib
parents:
diff changeset
1271 }
223b71206888 Initial import
thib
parents:
diff changeset
1272
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1273 bool Grp::Pressed(int x, int y, void* pointer) { // マウスクリックでキャンセル
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1274 Grp* g = (Grp*)pointer;
0
223b71206888 Initial import
thib
parents:
diff changeset
1275 if (g->status == WAIT_MOVIE)
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1276 g->music->StopMovie();
0
223b71206888 Initial import
thib
parents:
diff changeset
1277 if (g->status == WAIT_ANM)
223b71206888 Initial import
thib
parents:
diff changeset
1278 g->AbortAnm();
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1279 if (g->status == WAIT_SHAKE && g->anm2 != NULL) {
18
4d7486cb20a9 Sync with upstream
thib
parents: 14
diff changeset
1280 g->anm2->Abort();
0
223b71206888 Initial import
thib
parents:
diff changeset
1281 delete g->anm2;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1282 g->anm2 = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1283 }
223b71206888 Initial import
thib
parents:
diff changeset
1284 return false; // event deleted
223b71206888 Initial import
thib
parents:
diff changeset
1285 }
223b71206888 Initial import
thib
parents:
diff changeset
1286
223b71206888 Initial import
thib
parents:
diff changeset
1287 /* mode.cgm の decode 用 */
223b71206888 Initial import
thib
parents:
diff changeset
1288 static unsigned char decode_char[256] = {
223b71206888 Initial import
thib
parents:
diff changeset
1289 0x8b, 0xe5, 0x5d, 0xc3, 0xa1, 0xe0, 0x30, 0x44,
223b71206888 Initial import
thib
parents:
diff changeset
1290 0x00, 0x85, 0xc0, 0x74, 0x09, 0x5f, 0x5e, 0x33,
223b71206888 Initial import
thib
parents:
diff changeset
1291 0xc0, 0x5b, 0x8b, 0xe5, 0x5d, 0xc3, 0x8b, 0x45,
223b71206888 Initial import
thib
parents:
diff changeset
1292 0x0c, 0x85, 0xc0, 0x75, 0x14, 0x8b, 0x55, 0xec,
223b71206888 Initial import
thib
parents:
diff changeset
1293 0x83, 0xc2, 0x20, 0x52, 0x6a, 0x00, 0xe8, 0xf5,
223b71206888 Initial import
thib
parents:
diff changeset
1294 0x28, 0x01, 0x00, 0x83, 0xc4, 0x08, 0x89, 0x45,
223b71206888 Initial import
thib
parents:
diff changeset
1295 0x0c, 0x8b, 0x45, 0xe4, 0x6a, 0x00, 0x6a, 0x00,
223b71206888 Initial import
thib
parents:
diff changeset
1296 0x50, 0x53, 0xff, 0x15, 0x34, 0xb1, 0x43, 0x00,
223b71206888 Initial import
thib
parents:
diff changeset
1297 0x8b, 0x45, 0x10, 0x85, 0xc0, 0x74, 0x05, 0x8b,
223b71206888 Initial import
thib
parents:
diff changeset
1298 0x4d, 0xec, 0x89, 0x08, 0x8a, 0x45, 0xf0, 0x84,
223b71206888 Initial import
thib
parents:
diff changeset
1299 0xc0, 0x75, 0x78, 0xa1, 0xe0, 0x30, 0x44, 0x00,
223b71206888 Initial import
thib
parents:
diff changeset
1300 0x8b, 0x7d, 0xe8, 0x8b, 0x75, 0x0c, 0x85, 0xc0,
223b71206888 Initial import
thib
parents:
diff changeset
1301 0x75, 0x44, 0x8b, 0x1d, 0xd0, 0xb0, 0x43, 0x00,
223b71206888 Initial import
thib
parents:
diff changeset
1302 0x85, 0xff, 0x76, 0x37, 0x81, 0xff, 0x00, 0x00,
223b71206888 Initial import
thib
parents:
diff changeset
1303 0x04, 0x00, 0x6a, 0x00, 0x76, 0x43, 0x8b, 0x45,
223b71206888 Initial import
thib
parents:
diff changeset
1304 0xf8, 0x8d, 0x55, 0xfc, 0x52, 0x68, 0x00, 0x00,
223b71206888 Initial import
thib
parents:
diff changeset
1305 0x04, 0x00, 0x56, 0x50, 0xff, 0x15, 0x2c, 0xb1,
223b71206888 Initial import
thib
parents:
diff changeset
1306 0x43, 0x00, 0x6a, 0x05, 0xff, 0xd3, 0xa1, 0xe0,
223b71206888 Initial import
thib
parents:
diff changeset
1307 0x30, 0x44, 0x00, 0x81, 0xef, 0x00, 0x00, 0x04,
223b71206888 Initial import
thib
parents:
diff changeset
1308 0x00, 0x81, 0xc6, 0x00, 0x00, 0x04, 0x00, 0x85,
223b71206888 Initial import
thib
parents:
diff changeset
1309 0xc0, 0x74, 0xc5, 0x8b, 0x5d, 0xf8, 0x53, 0xe8,
223b71206888 Initial import
thib
parents:
diff changeset
1310 0xf4, 0xfb, 0xff, 0xff, 0x8b, 0x45, 0x0c, 0x83,
223b71206888 Initial import
thib
parents:
diff changeset
1311 0xc4, 0x04, 0x5f, 0x5e, 0x5b, 0x8b, 0xe5, 0x5d,
223b71206888 Initial import
thib
parents:
diff changeset
1312 0xc3, 0x8b, 0x55, 0xf8, 0x8d, 0x4d, 0xfc, 0x51,
223b71206888 Initial import
thib
parents:
diff changeset
1313 0x57, 0x56, 0x52, 0xff, 0x15, 0x2c, 0xb1, 0x43,
223b71206888 Initial import
thib
parents:
diff changeset
1314 0x00, 0xeb, 0xd8, 0x8b, 0x45, 0xe8, 0x83, 0xc0,
223b71206888 Initial import
thib
parents:
diff changeset
1315 0x20, 0x50, 0x6a, 0x00, 0xe8, 0x47, 0x28, 0x01,
223b71206888 Initial import
thib
parents:
diff changeset
1316 0x00, 0x8b, 0x7d, 0xe8, 0x89, 0x45, 0xf4, 0x8b,
223b71206888 Initial import
thib
parents:
diff changeset
1317 0xf0, 0xa1, 0xe0, 0x30, 0x44, 0x00, 0x83, 0xc4,
223b71206888 Initial import
thib
parents:
diff changeset
1318 0x08, 0x85, 0xc0, 0x75, 0x56, 0x8b, 0x1d, 0xd0,
223b71206888 Initial import
thib
parents:
diff changeset
1319 0xb0, 0x43, 0x00, 0x85, 0xff, 0x76, 0x49, 0x81,
223b71206888 Initial import
thib
parents:
diff changeset
1320 0xff, 0x00, 0x00, 0x04, 0x00, 0x6a, 0x00, 0x76
223b71206888 Initial import
thib
parents:
diff changeset
1321 };
223b71206888 Initial import
thib
parents:
diff changeset
1322
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1323 void Grp::LoadCgm() {
0
223b71206888 Initial import
thib
parents:
diff changeset
1324 /* cgm ファイル読み込み */
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1325 const char* fname = config->GetParaStr("#CGTABLE_FILE");
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1326 if (fname == NULL) return;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1327 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::ALL, fname, "");
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1328 if (info == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1329 char* data = info->CopyRead();
223b71206888 Initial import
thib
parents:
diff changeset
1330 int sz = info->Size();
223b71206888 Initial import
thib
parents:
diff changeset
1331 delete info;
223b71206888 Initial import
thib
parents:
diff changeset
1332
223b71206888 Initial import
thib
parents:
diff changeset
1333
8
55b577e5f5b5 Some memory leaks fixed
thib
parents: 5
diff changeset
1334 if ( strncmp(data, "CGTABLE", 7) != 0) {
55b577e5f5b5 Some memory leaks fixed
thib
parents: 5
diff changeset
1335 delete[] data;
55b577e5f5b5 Some memory leaks fixed
thib
parents: 5
diff changeset
1336 return;
55b577e5f5b5 Some memory leaks fixed
thib
parents: 5
diff changeset
1337 }
20
824b89018ea8 * CG completion percentage (maybe not working properly?)
thib
parents: 18
diff changeset
1338 cgm_size = read_little_endian_int(data+0x10);
0
223b71206888 Initial import
thib
parents:
diff changeset
1339
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1340 int i, j;
0
223b71206888 Initial import
thib
parents:
diff changeset
1341 // xor 解除
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1342 for (i=0; i < sz-0x20; i++) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1343 data[i+0x20]^=decode_char[i&0xff];
223b71206888 Initial import
thib
parents:
diff changeset
1344 }
223b71206888 Initial import
thib
parents:
diff changeset
1345 // 展開
223b71206888 Initial import
thib
parents:
diff changeset
1346 int dest_size = cgm_size * 36;
223b71206888 Initial import
thib
parents:
diff changeset
1347 char* dest = new char[dest_size+1024];
223b71206888 Initial import
thib
parents:
diff changeset
1348 char* src = data + 0x28;
223b71206888 Initial import
thib
parents:
diff changeset
1349 char* dest_orig = dest;
223b71206888 Initial import
thib
parents:
diff changeset
1350 ARCINFO::Extract2k(dest,src,dest+dest_size,data+sz);
223b71206888 Initial import
thib
parents:
diff changeset
1351 dest = dest_orig;
223b71206888 Initial import
thib
parents:
diff changeset
1352 for (i=0; i<cgm_size; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1353 char* s = dest + i * 36;
223b71206888 Initial import
thib
parents:
diff changeset
1354 int n = read_little_endian_int(dest + i * 36 + 32);
223b71206888 Initial import
thib
parents:
diff changeset
1355 cgm_info[s] = n;
223b71206888 Initial import
thib
parents:
diff changeset
1356 }
8
55b577e5f5b5 Some memory leaks fixed
thib
parents: 5
diff changeset
1357 delete[] data;
0
223b71206888 Initial import
thib
parents:
diff changeset
1358 delete[] dest_orig;
223b71206888 Initial import
thib
parents:
diff changeset
1359 }
223b71206888 Initial import
thib
parents:
diff changeset
1360
223b71206888 Initial import
thib
parents:
diff changeset
1361 /*****************************************************
223b71206888 Initial import
thib
parents:
diff changeset
1362 *
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1363 * Grp :: Save, Load : セーブファイル処理
0
223b71206888 Initial import
thib
parents:
diff changeset
1364 *
223b71206888 Initial import
thib
parents:
diff changeset
1365 */
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1366 void Grp::Save(std::string& str) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1367 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1368
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1369 void Grp::Load(const char* str) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1370 status = NORMAL;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1371 if (anm1 != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1372 AbortAnm();
223b71206888 Initial import
thib
parents:
diff changeset
1373 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1374 if (anm2 != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1375 anm2->Abort();
223b71206888 Initial import
thib
parents:
diff changeset
1376 delete anm2;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1377 anm2 = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1378 }
223b71206888 Initial import
thib
parents:
diff changeset
1379 map<int,GrpObj>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
1380 for (it=grpobj.begin(); it!=grpobj.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1381 PicBase* p = it->second.DeletePic();
223b71206888 Initial import
thib
parents:
diff changeset
1382 delete p;
223b71206888 Initial import
thib
parents:
diff changeset
1383 }
223b71206888 Initial import
thib
parents:
diff changeset
1384 grpobj.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1385
223b71206888 Initial import
thib
parents:
diff changeset
1386 bg_name = "";
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1387 music->StopCDROM(100);
0
223b71206888 Initial import
thib
parents:
diff changeset
1388 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1389
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1390 void Grp::SaveSys(string& save) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1391 char buf[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1392 save = "\n[Graphics]\n";
223b71206888 Initial import
thib
parents:
diff changeset
1393 save += "CGM_CG=";
223b71206888 Initial import
thib
parents:
diff changeset
1394
223b71206888 Initial import
thib
parents:
diff changeset
1395 set<int>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
1396 for (it=cgm_data.begin(); it != cgm_data.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1397 sprintf(buf,"%d,",*it);
223b71206888 Initial import
thib
parents:
diff changeset
1398 save += buf;
223b71206888 Initial import
thib
parents:
diff changeset
1399 }
223b71206888 Initial import
thib
parents:
diff changeset
1400 save += "\n";
223b71206888 Initial import
thib
parents:
diff changeset
1401 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1402
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1403 void Grp::LoadSys(const char* save) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1404 cgm_data.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1405 save = strstr(save, "\n[Graphics]\n");
223b71206888 Initial import
thib
parents:
diff changeset
1406
223b71206888 Initial import
thib
parents:
diff changeset
1407 if (save) {
223b71206888 Initial import
thib
parents:
diff changeset
1408 save += strlen("\n[Graphics]\n");
223b71206888 Initial import
thib
parents:
diff changeset
1409 do {
223b71206888 Initial import
thib
parents:
diff changeset
1410 if (save[0] == '[') break; // next section
223b71206888 Initial import
thib
parents:
diff changeset
1411 if (strncmp(save, "CGM_CG=",7) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1412 save += 7;
223b71206888 Initial import
thib
parents:
diff changeset
1413 while(isdigit(*save)) {
223b71206888 Initial import
thib
parents:
diff changeset
1414 int n = atoi(save);
223b71206888 Initial import
thib
parents:
diff changeset
1415 cgm_data.insert(n);
223b71206888 Initial import
thib
parents:
diff changeset
1416 save = strchr(save, ',');
223b71206888 Initial import
thib
parents:
diff changeset
1417 if (save) save++;
223b71206888 Initial import
thib
parents:
diff changeset
1418 }
223b71206888 Initial import
thib
parents:
diff changeset
1419 }
223b71206888 Initial import
thib
parents:
diff changeset
1420 save = strchr(save, '\n');
223b71206888 Initial import
thib
parents:
diff changeset
1421 if (save) save++;
223b71206888 Initial import
thib
parents:
diff changeset
1422 } while (save);
223b71206888 Initial import
thib
parents:
diff changeset
1423 }
223b71206888 Initial import
thib
parents:
diff changeset
1424 return;
223b71206888 Initial import
thib
parents:
diff changeset
1425 }
223b71206888 Initial import
thib
parents:
diff changeset
1426
223b71206888 Initial import
thib
parents:
diff changeset
1427
223b71206888 Initial import
thib
parents:
diff changeset
1428 /*****************************************************
223b71206888 Initial import
thib
parents:
diff changeset
1429 *
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1430 * Grp :: Wait , Exec : コマンド実行部
0
223b71206888 Initial import
thib
parents:
diff changeset
1431 *
223b71206888 Initial import
thib
parents:
diff changeset
1432 */
223b71206888 Initial import
thib
parents:
diff changeset
1433 static vector<int> drawn_images;
223b71206888 Initial import
thib
parents:
diff changeset
1434 static int draw_n = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1435 extern bool grpdump_req;
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1436 bool Grp::Wait(unsigned int current_time, Cmd& cmd) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1437 if (grpdump_req) {
223b71206888 Initial import
thib
parents:
diff changeset
1438 grpdump_req = 0;
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1439 GrpObjMap::iterator it;
48
ed6c21dde840 * use correct format (%p) for pointers
thib
parents: 43
diff changeset
1440 fprintf(stderr,"front %p(%d) / %p(%d)\n",screen,screen->IsHidden(),screen_front,screen_front->IsHidden());
0
223b71206888 Initial import
thib
parents:
diff changeset
1441 for (it=grpobj.begin(); it != grpobj.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1442 GrpObj& obj = it->second;
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1443 obj._debug_Dump(it->first, 0);
0
223b71206888 Initial import
thib
parents:
diff changeset
1444 }
223b71206888 Initial import
thib
parents:
diff changeset
1445 std::list<PicBase*>::iterator it2;
223b71206888 Initial import
thib
parents:
diff changeset
1446 for (it2=parent.children.begin(); it2!=parent.children.end();it2++) {
48
ed6c21dde840 * use correct format (%p) for pointers
thib
parents: 43
diff changeset
1447 fprintf(stderr,"%p(%d)\n",*it2,(*it2)->IsHidden());
0
223b71206888 Initial import
thib
parents:
diff changeset
1448 }
223b71206888 Initial import
thib
parents:
diff changeset
1449 RefreshObj();
223b71206888 Initial import
thib
parents:
diff changeset
1450
223b71206888 Initial import
thib
parents:
diff changeset
1451 }
223b71206888 Initial import
thib
parents:
diff changeset
1452 #if 0
223b71206888 Initial import
thib
parents:
diff changeset
1453 if (event.presscount(MOUSE_UP)) {
223b71206888 Initial import
thib
parents:
diff changeset
1454 std::list<PicBase*>::iterator lit;
223b71206888 Initial import
thib
parents:
diff changeset
1455 draw_n++; int i=0;
223b71206888 Initial import
thib
parents:
diff changeset
1456 for (lit=parent.children.end(); lit!=parent.children.begin(); ) {
223b71206888 Initial import
thib
parents:
diff changeset
1457 lit--;
223b71206888 Initial import
thib
parents:
diff changeset
1458 (*lit)->hide();
223b71206888 Initial import
thib
parents:
diff changeset
1459 i++;
223b71206888 Initial import
thib
parents:
diff changeset
1460 if (i >= draw_n) break;
223b71206888 Initial import
thib
parents:
diff changeset
1461 }
223b71206888 Initial import
thib
parents:
diff changeset
1462 if (drawn_images.empty()) {
223b71206888 Initial import
thib
parents:
diff changeset
1463 map<int, GrpObj>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
1464 for (it=grpobj.begin(); it!=grpobj.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1465 if (it->second.picture) {
223b71206888 Initial import
thib
parents:
diff changeset
1466 drawn_images.push_back(it->first);
223b71206888 Initial import
thib
parents:
diff changeset
1467 PicBase* p = it->second.DeletePic();
223b71206888 Initial import
thib
parents:
diff changeset
1468 delete p;
223b71206888 Initial import
thib
parents:
diff changeset
1469 }
223b71206888 Initial import
thib
parents:
diff changeset
1470 }
223b71206888 Initial import
thib
parents:
diff changeset
1471 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1472 vector<int>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
1473 for (it=drawn_images.begin(); it!=drawn_images.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
1474 CreateObj(*it);
223b71206888 Initial import
thib
parents:
diff changeset
1475 }
223b71206888 Initial import
thib
parents:
diff changeset
1476 drawn_images.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1477 }
223b71206888 Initial import
thib
parents:
diff changeset
1478 }
223b71206888 Initial import
thib
parents:
diff changeset
1479 #endif
223b71206888 Initial import
thib
parents:
diff changeset
1480 if (status == WAIT_ANM) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1481 if (anm1 != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1482 if (!anm1->IsEnd()) return true;
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1483 //FIXME: Handle animation loops
0
223b71206888 Initial import
thib
parents:
diff changeset
1484 AbortAnm();
223b71206888 Initial import
thib
parents:
diff changeset
1485 }
223b71206888 Initial import
thib
parents:
diff changeset
1486 } else if (status == WAIT_SHAKE) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1487 if (anm2 != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1488 if (!anm2->IsEnd()) return true;
223b71206888 Initial import
thib
parents:
diff changeset
1489 delete anm2;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1490 anm2 = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1491 }
223b71206888 Initial import
thib
parents:
diff changeset
1492 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
1493 } else if (status == WAIT_SE) {
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1494 if (music->IsStopSE()) status = NORMAL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1495 return true;
223b71206888 Initial import
thib
parents:
diff changeset
1496 } else if (status == WAIT_MOVIE) {
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1497 if (music->IsStopMovie()) {
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1498 music->StopMovie();
0
223b71206888 Initial import
thib
parents:
diff changeset
1499 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
1500 screen->ReBlit();
223b71206888 Initial import
thib
parents:
diff changeset
1501 }
223b71206888 Initial import
thib
parents:
diff changeset
1502 return true;
223b71206888 Initial import
thib
parents:
diff changeset
1503 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1504 if (anm2 != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1505 if (anm2->IsEnd()) {
223b71206888 Initial import
thib
parents:
diff changeset
1506 delete anm2;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1507 anm2 = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1508 }
223b71206888 Initial import
thib
parents:
diff changeset
1509 }
223b71206888 Initial import
thib
parents:
diff changeset
1510 return false;
223b71206888 Initial import
thib
parents:
diff changeset
1511 }
223b71206888 Initial import
thib
parents:
diff changeset
1512
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1513 void Grp::DeleteObjPic(int num) { // object の surface のみ削除
0
223b71206888 Initial import
thib
parents:
diff changeset
1514 if (grpobj.find(num) == grpobj.end()) return;
223b71206888 Initial import
thib
parents:
diff changeset
1515 deleted_pic.push_back(grpobj[num].DeletePic());
223b71206888 Initial import
thib
parents:
diff changeset
1516 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1517
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1518 void Grp::DeleteSubObjPic(int num_grp, int num) {
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1519 if (grpobj.find(num_grp) == grpobj.end()) return;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1520 if (grpobj[num_grp].children_obj.find(num) == grpobj[num_grp].children_obj.end()) return;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1521 deleted_pic.push_back(grpobj[num_grp].children_obj[num].DeletePic());
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1522 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1523
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1524 void Grp::DeleteObj(int num) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1525 if (grpobj.find(num) == grpobj.end()) return;
223b71206888 Initial import
thib
parents:
diff changeset
1526 deleted_pic.push_back(grpobj[num].DeletePic());
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1527 GrpObjMap::iterator it;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1528 for (it = grpobj[num].children_obj.begin(); it != grpobj[num].children_obj.end(); it++) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1529 deleted_pic.push_back(it->second.DeletePic());
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1530 }
0
223b71206888 Initial import
thib
parents:
diff changeset
1531 grpobj.erase(num);
223b71206888 Initial import
thib
parents:
diff changeset
1532 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1533
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1534 void Grp::DeleteSubObj(int num_grp, int num) {
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1535 if (grpobj.find(num_grp) == grpobj.end()) return;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1536 if (grpobj[num_grp].children_obj.find(num) == grpobj[num_grp].children_obj.end()) return;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1537 deleted_pic.push_back(grpobj[num_grp].children_obj[num].DeletePic());
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1538 grpobj[num_grp].children_obj.erase(num);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1539 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1540
56
c7bcc0ec2267 * replaced Grp and Text classes by the TextImpl and GrpImpl ones
thib
parents: 55
diff changeset
1541 void Grp::Exec(Cmd& cmd) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1542 if (cmd.cmd_type == CMD_TEXTEND) {
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1543 music->StopKoe(500); // テキスト終了で声を止める
0
223b71206888 Initial import
thib
parents:
diff changeset
1544 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1545 return;
223b71206888 Initial import
thib
parents:
diff changeset
1546 }
223b71206888 Initial import
thib
parents:
diff changeset
1547 if (cmd.cmd_type == CMD_WAITFRAMEUPDATE) {
223b71206888 Initial import
thib
parents:
diff changeset
1548 // wait する場合は RefreshObj() しておく
223b71206888 Initial import
thib
parents:
diff changeset
1549 RefreshObj();
223b71206888 Initial import
thib
parents:
diff changeset
1550 }
223b71206888 Initial import
thib
parents:
diff changeset
1551 if (cmd.cmd_type != CMD_OTHER) return;
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1552
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1553 CommandHandler::Exec(cmd);
26
f45da03ca631 * Corrected --disable-vorbis in configure.ac
thib
parents: 20
diff changeset
1554
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1555 //TODO: ???
0
223b71206888 Initial import
thib
parents:
diff changeset
1556 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x3c && cmd.cmd3 == 0) { // ??? : KANOGI : 画像オブジェクトの削除?
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1557 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1558 GrpObj& g = grpobj[cmd.args[0].value];
0
223b71206888 Initial import
thib
parents:
diff changeset
1559 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN);
223b71206888 Initial import
thib
parents:
diff changeset
1560 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1561 }
5
aa0577c1a494 Support for animated things like Botan
thib
parents: 4
diff changeset
1562
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1563 //TODO: ???
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1564 if ( (cmd.cmd1 == 1 || cmd.cmd1 == 2) && cmd.cmd2 == 0x51) {
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1565 /*GrpObj& g = grpobj[cmd.args[0].value];
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1566 int attr;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1567 GrpObjMap::iterator it;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1568 for (it = g.children_obj.begin(); it != g.children_obj.end(); it++)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1569 attr |= it->second.attr;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1570 if (attr & GrpObj::UPDATE_ALL)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1571 SetObjChanged(cmd.args[0].value);*/
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1572 GrpObj* g;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1573 if (cmd.cmd1 == 2)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1574 g = GetGraphicObj(cmd.args[0].value, cmd.args[1].value);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1575 else
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1576 g = GetGraphicObj(cmd.args[0].value);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 54
diff changeset
1577 if (g->attr & GrpObj::UPDATE_ALL)
54
d7cde171a1de * scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents: 53
diff changeset
1578 SetObjChanged(cmd.args[0].value);
0
223b71206888 Initial import
thib
parents:
diff changeset
1579 }
223b71206888 Initial import
thib
parents:
diff changeset
1580 }
223b71206888 Initial import
thib
parents:
diff changeset
1581