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