Mercurial > otakunoraifu
annotate scn2k/scn2k_grp.cc @ 51:cbb301016a4e
* oops... finishing what was started and not said with the other patch: fixing memory leaks
author | thib |
---|---|
date | Fri, 17 Apr 2009 18:40:39 +0000 |
parents | 35ce1a30f3f9 |
children | 15a18fbe6f21 |
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 | |
28 #include"scn2k.h" | |
29 #include"window/widget.h" | |
30 #include"system/file.h" | |
31 #include"system/system_config.h" | |
32 #include"font/text.h" | |
33 #include<set> | |
34 | |
35 using namespace std; | |
36 | |
37 extern void DSurfaceFill(Surface* dest, const Rect& rect, int r, int g, int b, int a=0xff); | |
38 extern void DSurfaceMove(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstpos); | |
39 extern Rect DSurfaceRenderText(TextGlyphStream::iterator start, TextGlyphStream::iterator end, const Rect& srcrect, | |
40 Surface* dst, const Rect& dstrect); | |
41 extern XKFont::HorizLayout* DefaultLayout(int text_size); | |
42 | |
43 /******************************************************************* | |
44 ** GrpObj(interface) | |
45 */ | |
46 | |
47 struct SEL { | |
48 Rect from; | |
49 Rect to; | |
50 int time; | |
51 int sel_no; | |
52 int args[8]; | |
53 SEL() : from(0,0), to(0,0) {} | |
54 }; | |
55 | |
56 struct GrpObj { | |
57 string name; | |
58 string gan_name; | |
59 PicContainer* pic_parent; | |
60 PicBase* picture; | |
61 WidAnmTime* anm; | |
62 int _posx, _posy; | |
63 int posx[9],posy[9]; | |
64 Rect clip_area; | |
65 unsigned char alpha; | |
66 int order; | |
67 int surface_num; | |
68 | |
69 string print_moji; | |
70 int print_size, print_r, print_b, print_g; | |
71 | |
72 int dig_number, dig_digit; | |
73 | |
74 // zoom / rotate 関係 | |
75 int zoom; // 256 で 1 倍 | |
76 int rotate; // 0-360度 | |
77 | |
78 vector<Rect> src_pos; | |
79 enum GrpType { FILLRECT = 1, FILE = 2, GAN = 3, MOJI = 4, DIGIT = 5} gtype; | |
80 enum Attribute { NONE=0, WIPEON=1, SATURATE=2, HIDDEN=4, HIDDEN_GROUP=8, | |
18 | 81 UPDATE_PICTURE = 16, UPDATE_POS = 32, UPDATE_ALPHA = 64, UPDATE_SNUM = 128, UPDATE_CLIP = 256, UPDATE_VISIBLE = 512, |
82 UPDATE_ALL = (16|32|64|128|256|512), | |
0 | 83 ANM_PLAYSTART = 0x8000, ANM_PLAYING = 0x10000, |
84 DIG_ZERO = 0x10000*2, DIG_SIGN = 0x10000*4, DIG_PACK=0x10000*8,DIG_SPACE=0x10000*16 | |
85 }; | |
86 Attribute attr; | |
87 | |
88 GrpImpl* parent_pimpl; | |
89 | |
90 GrpObj(void); | |
91 ~GrpObj(void); | |
92 | |
93 void SetPos(int index, int x, int y); | |
94 void GetPos(int index, int& x, int& y); | |
95 int PosX(void); | |
96 int PosY(void); | |
97 void SetAlpha(void); | |
98 void SetAlpha(int alpha); | |
99 void SetSurfaceNum(int num = -1); | |
100 void SetZoomRotate(int zoom=-1, int rotate=-1); | |
101 void SetClipArea(int x, int y, int width, int height); | |
102 void GetSrcGeom(int& width, int& height); | |
103 void SetUpdate(void); | |
104 TextStream ParseMoji(const char* str, int def_r ,int def_g, int def_b, int def_size); | |
105 void UpdateMoji(void); | |
106 void UpdateDigit(void); | |
107 void UpdateSurface(void); | |
108 void ZoomRotate(void); | |
109 void Update(void); | |
110 void CreateSurface(PicContainer* parent); | |
111 void CreateGan(Event::Container& event, int event_number); | |
112 void CreateGanSpecial(Event::Container& event, int event_number, int time); | |
113 PicBase* DeletePic(void); | |
114 }; | |
115 | |
116 /******************************************************************* | |
117 ** GrpObj(interface) | |
118 */ | |
119 | |
120 | |
121 struct GrpObjMap : std::map<int, GrpObj> { | |
122 typedef pair<const int, GrpObj> value_type; | |
123 class GrpImpl* parent; | |
124 GrpObj& operator[](const int& k) { | |
125 iterator it = lower_bound(k); | |
126 if (it == end() || it->first != k) { | |
127 GrpObj obj; | |
128 obj.parent_pimpl = parent; | |
129 it = insert(it, value_type(k, obj)); | |
130 } | |
131 return it->second; | |
132 } | |
133 GrpObjMap(class GrpImpl* p) { | |
134 parent = p; | |
135 } | |
136 }; | |
137 | |
138 class GrpImpl { | |
139 #define MAXPDT 256 | |
140 #define WORKPDT 255 | |
141 Event::Container& event; | |
142 const Flags& flags; | |
143 PicBase* screen; | |
144 PicBase* screen_front; | |
145 Surface* surface, *surface_update; | |
146 | |
147 Surface* dsurface[MAXPDT]; // 書き込み可能な Surface | |
148 Surface* ssurface[MAXPDT]; // ファイルの内容等、読み込みのみ可能な状態の Surface | |
149 PicContainer& parent; | |
150 | |
151 // 画像効果の保存用 | |
152 WidAnmTime* anm1, *anm2; | |
153 typedef enum { NORMAL, WAIT_ANM, WAIT_SHAKE, WAIT_SE, WAIT_MOVIE} Status; | |
154 Status status; | |
155 SkipMode skip_mode; | |
156 | |
157 std::string bg_name; | |
158 std::map<int, SEL> anmtype; | |
159 GrpObjMap grpobj; | |
160 GrpObjMap bs_obj; | |
161 void CreateObj(int number); | |
162 void ZMoveObj(int number); | |
163 void SetObjChanged(int number); | |
164 void SetObjChangedGroup(int number); | |
165 void SwapObj(int a1, int a2); | |
166 void DeleteObjPic(int num);// object の surface のみ削除 | |
167 void DeleteObj(int num); | |
168 void DeleteObjRange(int num_b, int num_e); | |
169 | |
170 std::set<int> changed_obj; | |
171 string reserved_load_surface0; | |
172 vector<PicBase*> deleted_pic; | |
173 void RefreshObj(void); | |
174 | |
175 Surface* Dsurface(int pdt); | |
176 Surface* Ssurface(int pdt); | |
177 | |
178 // cgmode 用画像処理関連 | |
179 void LoadCgm(AyuSysConfig& config); | |
180 std::map<std::string, int> cgm_info; | |
181 set<int>& cgm_data; | |
20
824b89018ea8
* CG completion percentage (maybe not working properly?)
thib
parents:
18
diff
changeset
|
182 int cgm_size; |
0 | 183 |
184 class MuSys& music; | |
185 | |
186 public: | |
187 AyuSysConfig& config; | |
188 void LoadSurface(const char* str, int pdt); | |
189 private: | |
190 void LoadSurface(const char* str); | |
191 void LoadSurface(void); | |
192 void AddSurface(const char* str); | |
193 | |
194 void StartAnm(int type); | |
195 void StartShake(int total, const int* pattern); | |
196 void AbortAnm(void); | |
197 static bool Pressed(int x, int y, void* pointer); | |
198 public: | |
199 GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& _flag, set<int>& _cgm_data, class MuSys& mu, AyuSysConfig& config); | |
200 ~GrpImpl(); | |
201 bool Wait(unsigned int current_time, Cmd& cmd); | |
202 void Exec(Cmd& cmd); | |
203 void InitSel(AyuSysConfig& config); | |
204 void Save(std::string& str); | |
205 void Load(const char* str); | |
206 void SaveSys(std::string& str); | |
207 void LoadSys(const char* str); | |
208 void SetSkipMode(SkipMode _mode); | |
209 }; | |
210 /******************************************************************* | |
211 ** GrpObj(implementation) | |
212 */ | |
213 | |
214 GrpObj::GrpObj(void) : | |
215 name(""), gan_name(""), pic_parent(0), picture(0), anm(0), | |
216 _posx(0), _posy(0), clip_area(0,0,0,0), | |
217 alpha(255), order(0), surface_num(0), print_moji(""), print_size(0), print_r(-1),print_g(-1),print_b(-1), | |
218 dig_number(0), dig_digit(0), | |
219 zoom(-1), rotate(-1), attr(GrpObj::HIDDEN), parent_pimpl(0) { | |
220 int i; | |
221 for (i=0; i<9; i++) { | |
222 posx[i] = posy[i] = 0; | |
223 } | |
224 } | |
225 GrpObj::~GrpObj() { | |
226 if (picture) delete picture; | |
227 if (parent_pimpl == 0) { | |
228 fprintf(stderr,"\n**************\nFATAL : UNINITIALIZED GrpObj IS FOUND!!! \n**************\n"); | |
229 } | |
230 } | |
231 int GrpObj::PosX() { | |
232 return _posx; | |
233 } | |
234 int GrpObj::PosY() { | |
235 return _posy; | |
236 } | |
237 void GrpObj::SetUpdate(void) { | |
238 attr = Attribute (attr | UPDATE_PICTURE); | |
18 | 239 //Update(); //FIXME |
0 | 240 } |
241 void GrpObj::SetPos(int index, int x,int y) { | |
242 if (index < 0 || index > 8) { | |
243 fprintf(stderr,"GrpObj::SetPos: Invalid index %d <- %d,%d\n",index,x,y); | |
244 return; | |
245 } | |
246 if (x == posx[index] && y == posy[index]) return; | |
247 attr = Attribute(attr | UPDATE_POS); | |
248 _posx += x-posx[index]; | |
249 _posy += y-posy[index]; | |
250 posx[index] = x; | |
251 posy[index] = y; | |
252 } | |
253 void GrpObj::GetPos(int index, int& x, int& y) { | |
254 if (index < 0 || index > 8) { | |
255 fprintf(stderr,"GrpObj::GetPos: Invalid index %d\n",index); | |
256 x = 0; y = 0; | |
257 return; | |
258 } | |
259 x = posx[index]; | |
260 y = posy[index]; | |
261 return; | |
262 } | |
263 void GrpObj::SetAlpha(int new_alpha) { | |
264 if (alpha == new_alpha) return; | |
265 alpha = new_alpha; | |
266 attr = Attribute(attr | UPDATE_ALPHA); | |
267 return; | |
268 } | |
269 void GrpObj::SetSurfaceNum(int num) { | |
270 if (num != -1) { | |
271 if (surface_num == num) return; | |
272 surface_num = num; | |
273 } | |
274 attr = Attribute(attr | UPDATE_SNUM); | |
275 return; | |
276 } | |
277 | |
278 void GrpObj::SetClipArea(int x, int y, int w, int h) { | |
279 Rect new_clip(x,y,x+w,y+h); | |
280 if (clip_area == new_clip) return; | |
281 clip_area = new_clip; | |
282 attr = Attribute(attr | UPDATE_CLIP); | |
283 return; | |
284 } | |
285 PicBase* GrpObj::DeletePic(void) { | |
286 PicBase* p = picture; | |
287 anm = 0; | |
288 picture = 0; | |
289 src_pos.clear(); | |
290 attr = Attribute(attr & (HIDDEN | HIDDEN_GROUP)); | |
291 return p; | |
292 } | |
293 void GrpObj::GetSrcGeom(int& width, int& height) { | |
294 if (src_pos.empty()) { | |
295 width = 0; height = 0; | |
296 if (name.length() == 0) { | |
297 return; | |
298 } | |
299 /* ボタンの位置情報を求める */ | |
300 /* g00 ファイルのヘッダ部分に位置情報は入っている */ | |
301 string path(name); | |
302 path += ".g00"; | |
303 ARCINFO* info = file_searcher.Find(FILESEARCH::PDT, path.c_str(), "g00"); | |
304 if (info == 0) { // ファイルが見つからない | |
305 fprintf(stderr,"GrpObj::GetSrcGeom : Cannot find file %s\n", path.c_str()); | |
306 return; | |
307 } | |
308 const char* data = info->Read(); | |
309 if (data && *data == 2) { // 画像ファイル内にボタン情報が存在する | |
310 int srclen = read_little_endian_int(data+5); | |
311 int i; | |
312 for (i=0; i<srclen; i++) { | |
313 int x1 = read_little_endian_int(data+9+i*24+0); | |
314 int y1 = read_little_endian_int(data+9+i*24+4); | |
315 int x2 = read_little_endian_int(data+9+i*24+8); | |
316 int y2 = read_little_endian_int(data+9+i*24+12); | |
317 src_pos.push_back(Rect(x1, y1, x2+1, y2+1)); | |
318 if (width < src_pos.back().width()) width = src_pos.back().width(); | |
319 if (height < src_pos.back().height()) height = src_pos.back().height(); | |
320 } | |
321 } else { // 画像ファイルから大きさ取得 | |
322 width = read_little_endian_short(data+1); | |
323 height = read_little_endian_short(data+3); | |
324 src_pos.push_back(Rect(0,0,width,height)); | |
325 } | |
326 delete info; | |
327 } | |
328 int sn = surface_num; | |
329 if (sn < 0 || sn > src_pos.size()) sn = 0; | |
330 width = src_pos[sn].width(); | |
331 height = src_pos[sn].height(); | |
332 return; | |
333 } | |
334 void GrpObj::Update(void) { | |
335 if (attr & UPDATE_PICTURE) { | |
336 UpdateSurface(); | |
337 attr = Attribute( (attr | UPDATE_ALL) & (~UPDATE_PICTURE)); | |
338 } | |
339 if (picture == 0) return; | |
340 if (attr & UPDATE_POS) { | |
18 | 341 if ( (attr & SATURATE) || zoom != -1) { |
0 | 342 int w=0, h=0; |
343 GetSrcGeom(w,h); | |
344 picture->Move(_posx-w/2, _posy-h/2); | |
345 } else { | |
346 picture->Move(_posx, _posy); | |
347 } | |
348 } | |
349 if (attr & UPDATE_ALPHA) { | |
350 if (alpha <= 0) { | |
351 picture->SetSurfaceAlpha(0, Rect(0,0)); | |
352 picture->hide(); | |
353 } else if (alpha >= ALPHA_MAX) { | |
354 picture->SetSurfaceAlpha(0, Rect(0,0)); | |
355 if (attr & HIDDEN) picture->hide(); | |
356 else picture->show(); | |
357 } else { | |
358 picture->SetSurfaceAlpha(&alpha, Rect(0,0,1,1)); | |
359 if (attr & HIDDEN) picture->hide(); | |
360 else picture->show(); | |
361 } | |
362 } | |
363 if ( (attr & UPDATE_SNUM) && (!src_pos.empty())) { | |
364 if (surface_num < 0 || surface_num >= src_pos.size()) surface_num = 0; | |
365 picture->SetSurfacePos(src_pos[surface_num].lx, src_pos[surface_num].ty); | |
366 } | |
367 if (attr & UPDATE_CLIP) { | |
368 picture->SetClipArea(clip_area); | |
369 } | |
370 attr = Attribute(attr & (~UPDATE_ALL)); | |
371 if (attr & ANM_PLAYSTART) { | |
372 if (anm) { | |
373 anm->Play(); | |
374 attr = Attribute(attr | ANM_PLAYING); | |
375 } | |
376 attr = Attribute(attr & (~ANM_PLAYSTART)); | |
377 } | |
378 } | |
379 void GrpObj::CreateSurface(PicContainer* parent) { | |
380 if (picture) { | |
381 PicBase* p = DeletePic(); | |
382 delete p; | |
383 } | |
384 src_pos.clear(); | |
385 // picture を作成 | |
386 pic_parent = parent; | |
387 picture = parent->create_leaf(Rect(_posx,_posy,_posx+1,_posy+1), 0); | |
388 picture->hide(); | |
389 UpdateSurface(); | |
390 } | |
391 | |
392 void GrpObj::UpdateSurface(void) { | |
393 if (pic_parent == 0 || picture == 0) return; | |
394 int width = 0, height = 0; | |
395 if (gtype == FILE || gtype == GAN) { | |
396 if (name.length() == 0) return; | |
397 // ファイル名が存在する場合、ファイルを読み込み | |
398 GetSrcGeom(width, height); | |
399 if (width <= 0 || height <= 0) return; | |
400 // surface の設定 | |
401 if (surface_num == 0 && ( (zoom > 0 && zoom != 256) || rotate > 0)) { | |
402 ZoomRotate(); | |
403 } else { | |
404 // 普通に surface を設定 | |
405 string path(name); | |
406 path += ".g00"; | |
407 picture->SetSurface(path.c_str(), 0, 0); | |
408 picture->SetSurfaceRect(Rect(0,0,width,height)); | |
409 } | |
410 if (attr & SATURATE) | |
411 picture->SetSurfaceAttribute(PicBase::BLIT_SATURATE); | |
412 } else if (gtype == MOJI) { // テキスト描画 | |
413 if (print_moji.length() == 0) return; | |
414 UpdateMoji(); | |
415 } else if (gtype == DIGIT) { // 数値を画像表示 | |
416 UpdateDigit(); | |
417 } | |
418 } | |
419 void GrpObj::ZoomRotate(void) { | |
420 picture->SetSurface( (Surface*)0,0,0); | |
421 | |
422 // 回転、縮小拡大は座標原点が画像の中心になる | |
423 string path(name); | |
424 path += ".g00"; | |
425 Surface* surface_orig = pic_parent->Root().NewSurface(path.c_str()); | |
426 if (surface_orig == 0) return; | |
427 | |
428 Surface* zoom_surface = pic_parent->Root().RotZoomSurface(surface_orig, double(zoom)/256.0, rotate); | |
429 Rect zoom_r (*zoom_surface); | |
430 picture->SetSurface(zoom_surface, 0, 0); | |
431 picture->SetSurfaceFreeFlag(); | |
432 //picture->Move(PosX() + - zoom_r.width()/2, PosY() + - zoom_r.height()/2); | |
433 // 中心座標がわからん・・・ | |
434 picture->Move(320 - zoom_r.width()/2, 240 - zoom_r.height()/2); | |
435 picture->SetSurfaceRect(Rect(0, 0, zoom_r.width(), zoom_r.height())); | |
436 | |
437 pic_parent->Root().DeleteSurface(surface_orig); | |
438 } | |
439 | |
440 static char* wstrchr(const char* s, unsigned int chr) { | |
441 int ws, wc; | |
442 while(*s != 0) { | |
443 if (*s < 0 && s[1] != 0) { | |
444 wc = int((unsigned char)(s[0]))*0x100 + int((unsigned char)(s[1])); | |
445 ws = 2; | |
446 } else { | |
447 wc = (unsigned char)(s[0]); | |
448 ws = 1; | |
449 } | |
450 if (wc == chr) return (char*)s; | |
451 s += ws; | |
452 } | |
453 return 0; | |
454 } | |
455 TextStream GrpObj::ParseMoji(const char* str, int def_r ,int def_g, int def_b, int def_size) { // 制御シーケンス付き文字列をparse | |
456 TextStream ts; | |
457 ts.kanji_type = TextStream::sjis; | |
458 ts.SetColor(def_r, def_g, def_b); | |
459 char* copy_str = new char[strlen(str)+1]; | |
460 char* next_str; | |
461 char* retptr; | |
462 int var; | |
463 | |
464 while( (next_str = wstrchr(str, '#')) != 0) { | |
465 int len = next_str - str; | |
466 strncpy(copy_str, str, len); | |
467 copy_str[len] = 0; | |
468 ts.Add(copy_str); | |
469 str = next_str + 1; | |
470 | |
471 switch(str[0]) { | |
472 case '#': // separator | |
473 str += 1; | |
474 break; | |
475 case 'D': case 'd': // return | |
476 ts.AddReturn(); | |
477 str += 1; | |
478 break; | |
479 case 'C': case 'c': // color | |
480 str += 1; | |
481 var = strtol(str, &next_str,10); | |
482 if (var == 0 && str == next_str) { // no parameter | |
483 ts.SetColor(def_r, def_g, def_b); | |
484 } else { | |
485 int r,g,b; char key[1024]; | |
486 sprintf(key, "#COLOR_TABLE.%03d", var); | |
487 if (parent_pimpl->config.GetParam(key, 3, &r, &g, &b)) { // color not found | |
488 r = g = b = 0; | |
489 } | |
490 ts.SetColor(r,g,b); | |
491 str = next_str; | |
492 } | |
493 break; | |
494 case 'S': case 's': // size | |
495 str += 1; | |
496 var = strtol(str, &next_str, 10); | |
497 if (var == 0 && str == next_str) { // no parameter | |
498 ts.SetSize(1); | |
499 } else { | |
500 if (def_size == 0) def_size = 20; | |
501 if (var <= 0) var = 1; | |
502 ts.SetSize(double(var)/def_size); | |
503 } | |
504 break; | |
505 case 'X': case 'x': // xpos : not supported | |
506 case 'Y': case 'y': // ypos : not supported | |
507 default: | |
508 ts.Add("#"); | |
509 break; | |
510 } | |
511 } | |
512 ts.Add(str); | |
50 | 513 delete[] copy_str; |
0 | 514 return ts; |
515 } | |
516 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
|
517 if (print_moji.length() == 0 || print_size <= 2) return; |
0 | 518 if (pic_parent == 0) return; |
519 /* テキストの大きさを得る */ | |
520 int r, g, b; | |
521 if (print_r == -1 || print_g == -1 || print_b == -1) {// 色設定なし | |
522 r = g = b = 0; // とりあえず黒(clannad のSave/Loadメニュー用) | |
523 } else { | |
524 r = print_r; | |
525 g = print_g; | |
526 b = print_b; | |
527 } | |
528 TextStream ts = ParseMoji(print_moji.c_str(), r, g, b, print_size); | |
529 TextGlyphStream gs; | |
530 vector<int> lh; | |
531 // とりあえず drawable width は充分に大きく(2048)取る | |
532 DefaultLayout(print_size-2)->Layout(ts, gs, lh, 2048); // print_size そのままだと弱干大きすぎるので -2 | |
533 int width = gs.width(); | |
534 int height = gs.height(); | |
535 Surface* surface = pic_parent->Root().NewSurface(width, height, ALPHA_MASK); | |
536 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0); | |
537 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0, 0, width, height), surface, Rect(0,0)); | |
538 picture->SetSurface(surface, 0, 0); | |
539 picture->SetSurfaceRect(Rect(0,0,width,height)); | |
540 picture->SetSurfaceFreeFlag(); | |
541 } | |
542 void GrpObj::UpdateDigit(void) { | |
543 // 画像表示の数値文字列を表示する | |
544 if (name.length() == 0) return; | |
545 // ファイル名が存在する場合、ファイルを読み込み | |
546 string path(name); | |
547 path += ".g00"; | |
548 Surface* surface_orig = pic_parent->Root().NewSurface(path.c_str()); | |
549 if (surface_orig == 0) return; | |
550 | |
551 int width, height; | |
552 int i; | |
553 GetSrcGeom(width, height); | |
554 if (width <= 0 || height <= 0) return; | |
555 if (src_pos.size() < 14) { | |
556 // 必要な数の object がない | |
557 // 表示できない分の空の rect を追加しておく | |
558 for (i=src_pos.size(); i<14; i++) | |
559 src_pos.push_back(Rect(0,0,0,0)); | |
560 pic_parent->Root().DeleteSurface(surface_orig); | |
561 return; | |
562 } | |
563 // 桁数の計算 | |
564 char num_str[20]; | |
565 if (dig_number < 0) sprintf(num_str, "%d", -dig_number); | |
566 else sprintf(num_str, "%d", dig_number); | |
567 int sign_count = 0; | |
568 int space_count = 0; | |
569 int total_count; | |
570 int dig_count = strlen(num_str); | |
571 if (dig_number < 0 && (attr&DIG_SIGN) == 0) dig_count++; | |
572 if (dig_count < dig_digit) space_count = dig_digit - dig_count; | |
573 if (attr & DIG_SIGN) sign_count = 1; | |
574 total_count = dig_count + space_count + sign_count; | |
575 | |
576 Surface* surface = pic_parent->Root().NewSurface(width*total_count, height, ALPHA_MASK); | |
577 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0); | |
578 | |
579 /* surface にコピーする */ | |
580 int cur_x = 0; | |
581 if ( (attr & DIG_PACK) && !(attr & DIG_ZERO)) { // 始めに空白を挿入 | |
582 cur_x += space_count * width; | |
583 } | |
584 int plus = 10, minus = 11, plusminus = 12; | |
585 if (dig_number < 0) { | |
586 DSurfaceMove(surface, src_pos[minus], surface, Rect(cur_x,0)); | |
587 cur_x += width; | |
588 } else if (attr & DIG_SIGN) { | |
589 if (dig_number == 0) | |
590 DSurfaceMove(surface, src_pos[plusminus], surface, Rect(cur_x,0)); | |
591 else | |
592 DSurfaceMove(surface, src_pos[plus], surface, Rect(cur_x,0)); | |
593 cur_x += width; | |
594 } | |
595 if (attr & DIG_ZERO) { // ゼロ・パディング | |
596 for (i=0; i<space_count; i++) { | |
597 DSurfaceMove(surface, src_pos[0], surface, Rect(cur_x, 0)); | |
598 cur_x += width;; | |
599 } | |
600 } else if (!(attr & DIG_PACK)) { // PACK オプションなし | |
601 cur_x += space_count * width; | |
602 } | |
603 for (i=0; num_str[i] != 0; i++) { | |
604 DSurfaceMove(surface_orig, src_pos[num_str[i]-'0'], surface, Rect(cur_x, 0)); | |
605 cur_x += width; | |
606 } | |
607 | |
608 /* picture に設定 */ | |
609 picture->SetSurface(surface, 0, 0); | |
610 picture->SetSurfaceRect(Rect(0,0,width*total_count,height)); | |
611 picture->SetSurfaceFreeFlag(); | |
612 | |
613 pic_parent->Root().DeleteSurface(surface_orig); | |
614 } | |
615 void GrpObj::CreateGan(Event::Container& event, int event_number) { | |
616 if (picture == 0) { | |
617 fprintf(stderr,"GrpObj::CreateGan() is called before Create()\n"); | |
618 return; | |
619 } | |
620 if (anm) { | |
621 anm->Abort(); | |
622 delete anm; | |
623 } | |
624 if (gan_name.empty()) return; | |
625 /* アニーメション情報 (.GAN ファイル)を求める */ | |
626 string path(gan_name); | |
627 path += ".gan"; | |
628 ARCINFO* info = file_searcher.Find(FILESEARCH::GAN, path.c_str(), "gan"); | |
629 if (info == 0) { | |
630 fprintf(stderr,"GrpObj::CreateGan: Cannot Find 'GAN' file %s\n", path.c_str()); | |
631 return; | |
632 } | |
633 const char* data = info->Read(); | |
634 if (read_little_endian_int(data) != 10000 || read_little_endian_int(data+4) != 10000) { | |
635 fprintf(stderr,"GrpObj::CreateGan: Invalid'GAN' file %s\n", path.c_str()); | |
636 delete info; | |
637 return; | |
638 } | |
639 | |
640 picture->SetSurfaceAttribute(PicBase::BLIT_SATURATE); | |
641 attr = Attribute(attr | UPDATE_POS | SATURATE); | |
642 | |
643 const char* buf = data + 16; | |
644 buf += strlen(buf) + 1; // 画像ファイル名が入っている | |
645 buf += 4; // 定数 20000 | |
646 int pics = read_little_endian_int(buf); buf += 4; // 複数のアニメーション情報が入っている場合、情報数 | |
647 // 以下、pics 回繰り返し | |
648 // アニメーションを行う実体を作成 | |
649 AnmAlphaMove* wid = new AnmAlphaMove(event, picture); | |
650 | |
651 if (event_number && event_number < pics) { // 複数のアニメーション情報がある場合、先の情報を読み飛ばす */ | |
652 int i; for (i=0; i<event_number; i++) { | |
653 buf += 4; // 定数 30000 | |
654 int ptns = read_little_endian_int(buf); buf += 4; | |
655 buf += ptns*52; | |
656 } | |
657 } | |
658 buf += 4; // 定数 30000 | |
659 int ptns = read_little_endian_int(buf); buf += 4; | |
660 int total_time = 0; | |
661 int i; | |
662 for (i=0; i<ptns; i++) { | |
663 int p = read_little_endian_int(buf+i*52+0*8+4); | |
664 int x = read_little_endian_int(buf+i*52+1*8+4); | |
665 int y = read_little_endian_int(buf+i*52+2*8+4); | |
666 int t = read_little_endian_int(buf+i*52+3*8+4); | |
667 int a = read_little_endian_int(buf+i*52+4*8+4); | |
668 x += PosX(); | |
669 y += PosY(); | |
670 if (p == -1) { a = 0; p = 0; } // p == -1 ならなにも表示しない | |
671 if (p >= src_pos.size()) { | |
672 fprintf(stderr,"Reading GAN file %s (G00 %s) : not enough pictures in .G00 file\n", path.c_str(), name.c_str()); | |
673 a = 0; p = 0; | |
674 } | |
675 total_time += t; | |
676 wid->ptns.push_back(AnmAlphaMove::Ptn(Rect(x,y), src_pos[p], a, total_time)); | |
677 } | |
678 wid->SetPtn(); // パターン登録終了 | |
679 attr = Attribute(attr | ANM_PLAYSTART); | |
680 anm = wid; | |
681 }; | |
682 void GrpObj::CreateGanSpecial(Event::Container& event, int event_number, int time) { | |
683 if (picture == 0) { | |
684 fprintf(stderr,"GrpObj::CreateGan() is called before Create()\n"); | |
685 return; | |
686 } | |
687 if (anm) { | |
688 anm->Abort(); | |
689 delete anm; | |
690 } | |
691 | |
692 // アニメーションを行う実体を作成 | |
693 AnmAlphaMove* wid = new AnmAlphaMove(event, picture); | |
694 | |
695 int i; | |
696 switch(event_number) { | |
697 case 0: // pattern を 0 から最後まで変化させる | |
698 for (i=0; i<src_pos.size(); i++) { | |
699 wid->ptns.push_back(AnmAlphaMove::Ptn(Rect(PosX(), PosY()), src_pos[i], 255, time*i)); | |
700 } | |
701 wid->SetPtn(); // パターン登録終了 | |
702 anm = wid; | |
703 attr = Attribute(attr | ANM_PLAYSTART); | |
704 break; | |
705 default: | |
706 break; | |
707 } | |
708 return; | |
709 }; | |
710 | |
711 void GrpObj::SetZoomRotate(int new_zoom, int new_rotate) { | |
712 if (zoom == new_zoom && rotate == new_rotate) return; | |
18 | 713 if ( zoom == -1 || new_zoom == -1) { |
714 attr = Attribute(attr | UPDATE_POS); // centering する | |
715 } | |
716 zoom = new_zoom; | |
0 | 717 if (new_rotate != -1) rotate = new_rotate; |
718 if (zoom < 0) zoom = 256; | |
719 if (rotate < 0) rotate = 0; | |
720 else if (rotate > 360) rotate %= 360; | |
721 | |
722 attr = Attribute(attr | UPDATE_PICTURE); | |
723 return; | |
724 } | |
725 /****************************************************************** | |
726 ** | |
727 ** class ScnGrp* | |
728 */ | |
729 /* Princess Bride: 背景画の一部のみ移動、の実装 */ | |
730 struct ScnGrpMove : public WidAnmTime { | |
731 Surface* dest; | |
732 Surface* src; | |
733 PicRoot& root; | |
734 Rect dest_r, from, to; | |
735 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); | |
736 void Exec(int count); | |
737 }; | |
738 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) : | |
739 WidAnmTime(container, _pic, total_time), | |
740 dest(_dest), src(_src), root(_root),dest_r(_dest_r), from(_from), to(_to) { | |
741 int dx = to.lx - from.lx; | |
742 int dy = to.ty - from.ty; | |
743 if (dx < 0) dx = -dx; | |
744 if (dy < 0) dy = -dy; | |
745 if (dx < dy) dx = dy; | |
746 if (dx == 0) dx = 1; | |
747 SetAllCount(dx); | |
748 } | |
749 void ScnGrpMove::Exec(int count) { | |
750 Rect r(0,0,dest_r.width(),dest_r.height()); | |
751 int dx = to.lx - from.lx; | |
752 int dy = to.ty - from.ty; | |
753 int x = dx*count/all_count + from.lx; | |
754 int y = dy*count/all_count + from.ty; | |
755 r.rmove(x, y); | |
756 root.BlitSurface(src, r, dest, dest_r); | |
757 iterator it; | |
758 for (it=pic.begin(); it!=pic.end(); it++) | |
759 (*it)->SetSurface(dest, 0, 0); | |
760 } | |
761 | |
762 /* Princess Bride: カードがおちるアニメーション */ | |
763 | |
764 struct ScnGrpAnmAtom { | |
765 string name; | |
766 int time; | |
767 ScnGrpAnmAtom(const char* _n, int _t) : name(_n), time(_t) {} | |
768 }; | |
769 struct ScnGrpAnm : public WidAnmTime, vector<ScnGrpAnmAtom> { | |
770 GrpImpl& owner; | |
771 ScnGrpAnm(Event::Container& container, PicBase* _pic, GrpImpl& _owner) : | |
772 WidAnmTime(container, _pic, 0), owner(_owner) { | |
773 } | |
774 void CalcTotal(void); | |
775 void Exec(int count); | |
776 }; | |
777 void ScnGrpAnm::CalcTotal(void) { | |
778 /* total time を計算 */ | |
779 if (empty()) return; | |
780 int tm = 0; | |
781 vector<ScnGrpAnmAtom>::iterator it; | |
782 for (it=begin(); it != end(); it++) tm += it->time; | |
783 total_time = tm; | |
784 SetAllCount(tm); | |
785 } | |
786 void ScnGrpAnm::Exec(int count) { | |
787 int tm = 0; vector<ScnGrpAnmAtom>::iterator it; | |
788 for (it=begin(); it != end(); it++) { | |
789 tm += it->time; | |
790 if (count < tm) break; | |
791 } | |
792 if (it == end()) it--; | |
793 owner.LoadSurface(it->name.c_str(), 0); | |
794 } | |
795 | |
796 | |
797 /***************************************************** | |
798 * | |
799 * GrpImpl(implementation) : 定義 | |
800 * | |
801 */ | |
802 | |
803 #include"music2/music.h" | |
804 | |
805 GrpImpl::GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm_data, class MuSys& _mu, AyuSysConfig& _config) : | |
806 event(_event), | |
807 flags(f), | |
808 parent(_parent), | |
809 status(NORMAL), | |
810 skip_mode(SKIP_NO), | |
811 music(_mu), | |
812 cgm_data(_cgm_data), | |
813 grpobj(this), | |
814 bs_obj(this), | |
815 config(_config) | |
816 { | |
817 int i; | |
818 for (i=0; i<MAXPDT; i++) { | |
819 ssurface[i] = 0; | |
820 dsurface[i] = 0; | |
821 } | |
822 screen = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | |
823 screen_front = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | |
824 surface = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); | |
825 surface_update = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); | |
826 DSurfaceFill(surface, Rect(*surface), 0, 0, 0); | |
827 DSurfaceFill(surface_update, Rect(*surface), 0, 0, 0); | |
828 screen->SetSurface(surface, 0, 0); | |
829 screen->show(); | |
830 screen_front->hide(); | |
831 screen_front->ZMove(screen); | |
832 | |
833 LoadCgm(config); | |
834 | |
835 anm1 = 0; anm2 = 0; | |
836 } | |
837 | |
838 GrpImpl::~GrpImpl() { | |
839 | |
840 map<int,GrpObj>::iterator it; | |
841 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | |
842 PicBase* p = it->second.DeletePic(); | |
843 delete p; | |
844 } | |
845 | |
846 delete screen; | |
847 delete screen_front; | |
848 parent.Root().DeleteSurface(surface); | |
50 | 849 parent.Root().DeleteSurface(surface_update); |
0 | 850 int i; |
851 for (i=0; i<MAXPDT; i++) { | |
852 if (ssurface[i]) parent.Root().DeleteSurface(ssurface[i]); | |
853 if (dsurface[i]) parent.Root().DeleteSurface(dsurface[i]); | |
854 } | |
855 } | |
856 | |
857 Surface* GrpImpl::Dsurface(int pdt) { | |
858 if (pdt == 0) return surface; | |
859 if (dsurface[pdt] == 0) { // とりあえず画面の大きさということにする | |
860 if (pdt == WORKPDT) | |
861 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), ALPHA_MASK); | |
862 else | |
863 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); | |
864 } | |
865 if (ssurface[pdt]) { // ssurface が存在すれば、dsurface にコピーして返す | |
866 DSurfaceMove(ssurface[pdt], Rect(*ssurface[pdt]), dsurface[pdt], Rect(0,0)); | |
867 parent.Root().DeleteSurface(ssurface[pdt]); | |
868 ssurface[pdt] = 0; | |
869 } | |
870 return dsurface[pdt]; | |
871 } | |
872 #include<SDL.h> | |
873 Surface* GrpImpl::Ssurface(int pdt) { | |
874 if (pdt == 0) return surface; | |
875 if (ssurface[pdt]) { | |
876 return ssurface[pdt]; | |
877 } | |
878 return Dsurface(pdt); | |
879 } | |
880 | |
881 void GrpImpl::LoadSurface(const char* str, int pdt) { | |
882 string s = str; | |
883 if (cgm_info.find(s) != cgm_info.end()) { | |
884 cgm_data.insert(cgm_info[s]); | |
885 } | |
886 Surface* bg = parent.Root().NewSurface(s.c_str()); | |
887 if (bg == 0) { | |
888 s += ".g00"; | |
889 bg = parent.Root().NewSurface(s.c_str()); | |
890 } | |
891 if (bg) { | |
892 if (ssurface[pdt]) parent.Root().DeleteSurface(ssurface[pdt]); | |
893 ssurface[pdt] = bg; | |
894 if (pdt == 0) { | |
895 /* とりあえず Princess Bride のアニメーション効果専用 */ | |
896 Rect r(*ssurface[0]); | |
897 Rect dr(*surface); | |
898 int x = (dr.width()-r.width())/2; | |
899 int y = (dr.height()-r.height())/2; | |
900 DSurfaceMove(ssurface[0], r, surface, Rect(x,y)); | |
901 parent.Root().DeleteSurface(ssurface[0]); | |
902 ssurface[0] = 0; | |
903 screen->SetSurface(surface, 0, 0); | |
904 } | |
905 } else { | |
906 if (str[0] != 0) | |
907 fprintf(stderr,"Cannot find surface %d <- '%s'\n",pdt,str); | |
908 } | |
909 return; | |
910 } | |
911 void GrpImpl::InitSel(AyuSysConfig& config) { | |
912 int i; int args[16]; char key[1024]; | |
913 for (i=0; i<999; i++) { | |
914 sprintf(key, "#SEL.%03d",i); | |
915 if (config.GetParam(key, 15, &args[0], &args[1], | |
916 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], | |
917 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13], | |
918 &args[14])) { | |
919 | |
920 sprintf(key, "#SELR.%03d", i); | |
921 if (config.GetParam(key, 16, &args[0], &args[1], | |
922 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], | |
923 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13], | |
924 &args[14], &args[15])) continue; | |
925 } | |
926 SEL& s = anmtype[i]; | |
927 s.from = Rect(args[0], args[1], args[2]+1, args[3]+1); | |
928 s.to = Rect(args[4], args[5]); | |
929 s.time = args[6]; | |
930 s.sel_no = args[7]; | |
931 int j; for (j=0; j<8; j++) s.args[j] = args[8+j]; | |
932 } | |
933 return; | |
934 } | |
935 void GrpImpl::SetSkipMode(SkipMode _mode) { | |
936 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) { | |
937 RefreshObj(); | |
938 } else if ( (skip_mode & SKIP_IN_MENU) == 0 && (_mode & SKIP_IN_MENU) ) { | |
939 } | |
940 skip_mode = _mode; | |
941 } | |
942 void GrpImpl::SetObjChanged(int num) { | |
943 changed_obj.insert(num); | |
944 } | |
945 void GrpImpl::SetObjChangedGroup(int num) { | |
946 if (num % 1000 != 0) { | |
947 SetObjChanged(num); | |
948 return; | |
949 } | |
950 std::map<int, GrpObj>::iterator begin,end,it; | |
951 begin = grpobj.lower_bound(num); | |
952 end = grpobj.lower_bound(num+1000); | |
953 for (it=begin;it!=end;it++) { | |
954 changed_obj.insert(it->first); | |
955 } | |
956 } | |
957 void GrpImpl::RefreshObj(void) { | |
958 if (!deleted_pic.empty()) { | |
959 vector<PicBase*>::iterator it; | |
960 for (it=deleted_pic.begin(); it!=deleted_pic.end(); it++) { | |
961 if (*it) delete *it; | |
962 } | |
963 deleted_pic.clear(); | |
964 } | |
965 if (!changed_obj.empty()) { | |
966 set<int>::iterator it; | |
967 for (it=changed_obj.begin(); it != changed_obj.end(); it++) { | |
968 if (grpobj.find(*it) == grpobj.end()) continue; | |
969 GrpObj& obj = grpobj[*it]; | |
970 GrpObj& parent_obj = grpobj[ ((*it)/1000) * 1000]; | |
971 if (obj.picture == 0) continue; | |
972 if (obj.alpha == 0 || (obj.attr & GrpObj::HIDDEN) || (parent_obj.attr & GrpObj::HIDDEN_GROUP) ) { | |
973 if (obj.attr & GrpObj::ANM_PLAYING) { | |
974 obj.attr = GrpObj::Attribute(obj.attr & ~(GrpObj::ANM_PLAYING)); | |
975 if (obj.anm) obj.anm->Abort(); | |
976 } | |
977 obj.picture->hide(); | |
978 } else { | |
979 obj.Update(); | |
980 obj.picture->show(); | |
981 } | |
982 } | |
983 changed_obj.clear(); | |
984 } | |
985 if (reserved_load_surface0.length() != 0) { | |
986 LoadSurface(reserved_load_surface0.c_str(), 0); | |
987 reserved_load_surface0 = ""; | |
988 } | |
989 screen->ReBlit(); | |
990 } | |
991 | |
992 | |
993 #include<SDL.h> | |
994 void GrpImpl::StartAnm(int type) { | |
995 SEL sel; | |
996 | |
997 if (anmtype.find(type) == anmtype.end()) { | |
998 if (anmtype.find(0) == anmtype.end()) { | |
999 sel.sel_no = 1; | |
1000 sel.from = Rect(*surface); | |
1001 sel.to = Rect(0,0); | |
1002 sel.time = 0; | |
1003 } else { | |
1004 sel = anmtype[0]; | |
1005 } | |
1006 } else { | |
1007 sel = anmtype[type]; | |
1008 } | |
1009 if (anm1) { | |
1010 fprintf(stderr,"Warning: StartAnm() called before anm1 finished\n"); | |
1011 anm1->Abort(); | |
1012 delete anm1; | |
1013 anm1 = 0; | |
1014 } | |
1015 map<int,GrpObj>::iterator it; | |
1016 // 現在表示中のobjectを消去 | |
1017 deleted_pic.push_back(screen); | |
1018 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | |
1019 if (! (it->second.attr & GrpObj::WIPEON)) { // 画像切り替え時に object 削除 | |
1020 deleted_pic.push_back(it->second.DeletePic()); | |
1021 } else { | |
1022 GrpObj& new_obj = bs_obj[it->first]; | |
1023 if (new_obj.name.empty()) { // 新しい object が存在しなければ内容を引き継ぐ | |
1024 new_obj = it->second; | |
1025 it->second.DeletePic(); | |
1026 } else { | |
1027 new_obj.attr = GrpObj::Attribute(new_obj.attr | GrpObj::WIPEON); | |
1028 deleted_pic.push_back(it->second.DeletePic()); | |
1029 } | |
1030 } | |
1031 } | |
1032 grpobj.clear(); // 全オブジェクト削除 | |
1033 | |
1034 // 全画像オブジェクトの前にscreen 移動 | |
1035 // 新しい screen_front を作成しておく | |
1036 screen = screen_front; | |
1037 screen->hide(); | |
1038 screen->SetSurface(surface_update, 0, 0); | |
1039 parent.Root().BlitSurface(Dsurface(1), Rect(*surface_update), surface_update, Rect(0,0)); | |
1040 | |
1041 screen_front = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | |
1042 screen_front->hide(); | |
1043 screen_front->ZMove(screen); | |
1044 | |
1045 // 新しい object へ更新、surface_update へ新しい object を表示 | |
1046 // (object 作成時は picture は hide されている) | |
1047 for (it=bs_obj.begin(); it!=bs_obj.end(); it++) { | |
1048 grpobj[it->first] = it->second; | |
1049 it->second.DeletePic(); | |
1050 CreateObj(it->first); | |
1051 GrpObj& g = grpobj[it->first]; | |
1052 GrpObj& parent_obj = grpobj[ (it->first/1000) * 1000]; | |
1053 if (g.picture) { | |
1054 g.Update(); | |
1055 if (g.alpha == 0 || (g.attr & GrpObj::HIDDEN) || (parent_obj.attr & GrpObj::HIDDEN_GROUP) ) ; | |
1056 else g.picture->SimpleBlit(surface_update); | |
1057 g.picture->hide(); | |
1058 } | |
1059 } | |
1060 bs_obj.clear(); | |
1061 // 画像効果開始 | |
1062 switch(sel.sel_no) { | |
1063 default: | |
1064 case 0: case 50: // 0 と 50 の違いが良くわからない | |
1065 if (skip_mode & SKIP_GRP_NOEFFEC) | |
1066 anm1 = new WidAnmAlpha(event, screen, ALPHA_MAX, ALPHA_MAX, 0); | |
1067 else if (skip_mode & SKIP_GRP_FAST) | |
1068 anm1 = new WidAnmAlpha(event, screen, 0, ALPHA_MAX, sel.time/4); | |
1069 else | |
1070 anm1 = new WidAnmAlpha(event, screen, 0, ALPHA_MAX, sel.time); | |
1071 break; | |
1072 } | |
1073 if (anm1) anm1->Play(); | |
1074 if (skip_mode & SKIP_GRP_NOEFFEC) AbortAnm(); | |
1075 } | |
1076 void GrpImpl::StartShake(int total, const int* pattern) { | |
1077 if (anm2) { | |
1078 fprintf(stderr,"Warning: StartShake() called before another animation finished\n"); | |
1079 anm2->Abort(); | |
1080 delete anm2; | |
1081 anm2 = 0; | |
1082 } | |
1083 if (skip_mode & SKIP_GRP_NOEFFEC) return; | |
1084 AnmAlphaMove* new_anm = new AnmAlphaMove(event, &parent); // shake screen では元画面の座標を揺らす | |
1085 int i; int tm = 0; | |
1086 for (i=0; i<total; i+=3) { | |
1087 int x = pattern[i]; | |
1088 int y = pattern[i+1]; | |
1089 new_anm->ptns.push_back(AnmAlphaMove::Ptn(Rect(x,y), Rect(0,0), 255, tm)); | |
1090 tm += pattern[i+2]; | |
1091 } | |
1092 new_anm->ptns.push_back(AnmAlphaMove::Ptn(Rect(0,0), Rect(0,0), 255, tm)); | |
1093 new_anm->SetPtn(); // パターン登録終了 | |
1094 new_anm->Play(); | |
1095 anm2 = new_anm; | |
1096 } | |
1097 void GrpImpl::AbortAnm(void) { | |
1098 if (anm1 == 0) return; | |
1099 anm1->Abort(); | |
1100 delete anm1; | |
1101 anm1 = 0; | |
1102 /* 画像効果終了 */ | |
1103 /* 古い画面への画像効果があれば消去 */ | |
1104 if (anm2 && anm2->pic[0] != screen) { | |
1105 anm2->Abort(); | |
1106 delete anm2; | |
1107 anm2 = 0; | |
1108 } | |
1109 /* pdt1 -> pdt0 へコピー */ | |
1110 DSurfaceMove(dsurface[1], Rect(*dsurface[1]), surface, Rect(0,0)); | |
1111 screen->SetSurface(surface, 0, 0); | |
1112 // 画像効果開始時に存在したobjectを消去 | |
1113 // 新しい object 表示 | |
1114 RefreshObj(); | |
1115 return; | |
1116 } | |
1117 void GrpImpl::LoadSurface(const char* str) { | |
1118 if (anm1) AbortAnm(); // 前の描画が終わってなければ強制終了 | |
1119 LoadSurface(str, 1); | |
1120 bg_name = str; | |
1121 } | |
1122 void GrpImpl::LoadSurface(void) { | |
1123 if (anm1) AbortAnm(); // 前の描画が終わってなければ強制終了 | |
1124 LoadSurface(bg_name.c_str(), 1); | |
1125 } | |
1126 void GrpImpl::AddSurface(const char* str) { | |
1127 if (anm1) AbortAnm(); // 前の描画が終わってなければ強制終了 | |
1128 LoadSurface(bg_name.c_str()); | |
1129 | |
1130 string s = str; | |
1131 Surface* front = parent.Root().NewSurface(s.c_str()); | |
1132 if (front == 0) { | |
1133 s += ".g00"; | |
1134 front = parent.Root().NewSurface(s.c_str()); | |
1135 } | |
1136 if (front) { | |
1137 parent.Root().BlitSurface(front, Rect(*front), Dsurface(1), Rect(0,0)); | |
1138 parent.Root().DeleteSurface(front); | |
1139 } else { | |
1140 fprintf(stderr,"Cannot find surface %s\n",str); | |
1141 } | |
1142 } | |
1143 | |
1144 void GrpImpl::CreateObj(int index) { | |
1145 std::map<int, GrpObj>::iterator cur = grpobj.find(index); | |
1146 if (cur == grpobj.end()) return; | |
1147 GrpObj& g = grpobj[index]; | |
1148 g.CreateSurface(&parent); | |
1149 g.order = index; | |
1150 if (g.picture == 0) return; // エラー:surface が存在しない | |
1151 g.picture->hide(); | |
1152 SetObjChanged(index); | |
1153 ZMoveObj(index); | |
1154 return; | |
1155 } | |
1156 void GrpImpl::ZMoveObj(int index) { | |
1157 std::map<int, GrpObj>::iterator cur = grpobj.find(index); | |
1158 if (cur == grpobj.end()) return; | |
1159 GrpObj& g = grpobj[index]; | |
1160 if (g.picture == 0) return; | |
1161 // 自分より前に object があれば、その前に表示 | |
1162 // そうでなければ screen の前に表示 | |
1163 std::map<int, GrpObj>::iterator cur_backobj = grpobj.end(); | |
1164 std::map<int, GrpObj>::iterator it; | |
1165 for (it = grpobj.begin(); it != grpobj.end(); it++) { | |
1166 if (it == cur) continue; | |
1167 if (it->second.picture == 0) continue; | |
1168 if (it->second.order < g.order) { | |
1169 if (cur_backobj == grpobj.end()) { | |
1170 cur_backobj = it; | |
1171 } else if (cur_backobj->second.order < it->second.order) { | |
1172 cur_backobj = it; | |
1173 } | |
1174 } | |
1175 } | |
1176 if (cur_backobj == grpobj.end()) { | |
1177 g.picture->ZMove(screen); | |
1178 } else { | |
1179 g.picture->ZMove(cur_backobj->second.picture); | |
1180 } | |
1181 return; | |
1182 } | |
1183 void GrpImpl::SwapObj(int index1, int index2) { | |
1184 // デフォルト値から order が変更されていた場合のみ、order は保存される | |
1185 // まずは両方のobjectをswap | |
1186 if (grpobj.find(index1) == grpobj.end()) { | |
1187 if (grpobj.find(index2) == grpobj.end()) return; // どちらの object も存在しない | |
1188 grpobj[index1] = grpobj[index2]; | |
1189 if (grpobj[index1].order == index2) | |
1190 grpobj[index1].order = index1; | |
1191 grpobj[index2].DeletePic(); | |
1192 grpobj.erase(index2); | |
1193 ZMoveObj(index1); | |
1194 return; | |
1195 } else if (grpobj.find(index2) == grpobj.end()) { // index2 が存在しない場合 | |
1196 grpobj[index2] = grpobj[index1]; | |
1197 if (grpobj[index2].order == index1) | |
1198 grpobj[index2].order = index2; | |
1199 grpobj[index1].DeletePic(); | |
1200 grpobj.erase(index1); | |
1201 ZMoveObj(index2); | |
1202 return; | |
1203 } else { | |
1204 GrpObj obj = grpobj[index1]; | |
1205 grpobj[index1] = grpobj[index2]; | |
1206 grpobj[index2].DeletePic(); | |
1207 if (grpobj[index1].order == index2) | |
1208 grpobj[index1].order = index1; | |
1209 ZMoveObj(index1); | |
1210 grpobj[index2] = obj; | |
1211 if (grpobj[index2].order == index1) | |
1212 grpobj[index2].order = index2; | |
1213 ZMoveObj(index2); | |
1214 obj.DeletePic(); | |
1215 } | |
1216 } | |
1217 | |
1218 bool GrpImpl::Pressed(int x, int y, void* pointer) { // マウスクリックでキャンセル | |
1219 GrpImpl* g = (GrpImpl*)pointer; | |
1220 if (g->status == WAIT_MOVIE) | |
1221 g->music.StopMovie(); | |
1222 if (g->status == WAIT_ANM) | |
1223 g->AbortAnm(); | |
1224 if (g->status == WAIT_SHAKE && g->anm2 != 0) { | |
18 | 1225 g->anm2->Abort(); |
0 | 1226 delete g->anm2; |
1227 g->anm2 = 0; | |
1228 } | |
1229 return false; // event deleted | |
1230 } | |
1231 | |
1232 /* mode.cgm の decode 用 */ | |
1233 static unsigned char decode_char[256] = { | |
1234 0x8b, 0xe5, 0x5d, 0xc3, 0xa1, 0xe0, 0x30, 0x44, | |
1235 0x00, 0x85, 0xc0, 0x74, 0x09, 0x5f, 0x5e, 0x33, | |
1236 0xc0, 0x5b, 0x8b, 0xe5, 0x5d, 0xc3, 0x8b, 0x45, | |
1237 0x0c, 0x85, 0xc0, 0x75, 0x14, 0x8b, 0x55, 0xec, | |
1238 0x83, 0xc2, 0x20, 0x52, 0x6a, 0x00, 0xe8, 0xf5, | |
1239 0x28, 0x01, 0x00, 0x83, 0xc4, 0x08, 0x89, 0x45, | |
1240 0x0c, 0x8b, 0x45, 0xe4, 0x6a, 0x00, 0x6a, 0x00, | |
1241 0x50, 0x53, 0xff, 0x15, 0x34, 0xb1, 0x43, 0x00, | |
1242 0x8b, 0x45, 0x10, 0x85, 0xc0, 0x74, 0x05, 0x8b, | |
1243 0x4d, 0xec, 0x89, 0x08, 0x8a, 0x45, 0xf0, 0x84, | |
1244 0xc0, 0x75, 0x78, 0xa1, 0xe0, 0x30, 0x44, 0x00, | |
1245 0x8b, 0x7d, 0xe8, 0x8b, 0x75, 0x0c, 0x85, 0xc0, | |
1246 0x75, 0x44, 0x8b, 0x1d, 0xd0, 0xb0, 0x43, 0x00, | |
1247 0x85, 0xff, 0x76, 0x37, 0x81, 0xff, 0x00, 0x00, | |
1248 0x04, 0x00, 0x6a, 0x00, 0x76, 0x43, 0x8b, 0x45, | |
1249 0xf8, 0x8d, 0x55, 0xfc, 0x52, 0x68, 0x00, 0x00, | |
1250 0x04, 0x00, 0x56, 0x50, 0xff, 0x15, 0x2c, 0xb1, | |
1251 0x43, 0x00, 0x6a, 0x05, 0xff, 0xd3, 0xa1, 0xe0, | |
1252 0x30, 0x44, 0x00, 0x81, 0xef, 0x00, 0x00, 0x04, | |
1253 0x00, 0x81, 0xc6, 0x00, 0x00, 0x04, 0x00, 0x85, | |
1254 0xc0, 0x74, 0xc5, 0x8b, 0x5d, 0xf8, 0x53, 0xe8, | |
1255 0xf4, 0xfb, 0xff, 0xff, 0x8b, 0x45, 0x0c, 0x83, | |
1256 0xc4, 0x04, 0x5f, 0x5e, 0x5b, 0x8b, 0xe5, 0x5d, | |
1257 0xc3, 0x8b, 0x55, 0xf8, 0x8d, 0x4d, 0xfc, 0x51, | |
1258 0x57, 0x56, 0x52, 0xff, 0x15, 0x2c, 0xb1, 0x43, | |
1259 0x00, 0xeb, 0xd8, 0x8b, 0x45, 0xe8, 0x83, 0xc0, | |
1260 0x20, 0x50, 0x6a, 0x00, 0xe8, 0x47, 0x28, 0x01, | |
1261 0x00, 0x8b, 0x7d, 0xe8, 0x89, 0x45, 0xf4, 0x8b, | |
1262 0xf0, 0xa1, 0xe0, 0x30, 0x44, 0x00, 0x83, 0xc4, | |
1263 0x08, 0x85, 0xc0, 0x75, 0x56, 0x8b, 0x1d, 0xd0, | |
1264 0xb0, 0x43, 0x00, 0x85, 0xff, 0x76, 0x49, 0x81, | |
1265 0xff, 0x00, 0x00, 0x04, 0x00, 0x6a, 0x00, 0x76 | |
1266 }; | |
1267 | |
1268 void GrpImpl::LoadCgm(AyuSysConfig& config) { | |
1269 /* cgm ファイル読み込み */ | |
1270 const char* fname = config.GetParaStr("#CGTABLE_FILE"); | |
1271 if (fname == 0) return; | |
1272 ARCINFO* info = file_searcher.Find(FILESEARCH::ALL, fname, ""); | |
1273 if (info == 0) return; | |
1274 char* data = info->CopyRead(); | |
1275 int sz = info->Size(); | |
1276 delete info; | |
1277 | |
1278 | |
8 | 1279 if ( strncmp(data, "CGTABLE", 7) != 0) { |
1280 delete[] data; | |
1281 return; | |
1282 } | |
20
824b89018ea8
* CG completion percentage (maybe not working properly?)
thib
parents:
18
diff
changeset
|
1283 cgm_size = read_little_endian_int(data+0x10); |
0 | 1284 |
1285 int i,j; | |
1286 // xor 解除 | |
1287 for (i=0;i<sz-0x20; i++) { | |
1288 data[i+0x20]^=decode_char[i&0xff]; | |
1289 } | |
1290 // 展開 | |
1291 int dest_size = cgm_size * 36; | |
1292 char* dest = new char[dest_size+1024]; | |
1293 char* src = data + 0x28; | |
1294 char* dest_orig = dest; | |
1295 ARCINFO::Extract2k(dest,src,dest+dest_size,data+sz); | |
1296 dest = dest_orig; | |
1297 for (i=0; i<cgm_size; i++) { | |
1298 char* s = dest + i * 36; | |
1299 int n = read_little_endian_int(dest + i * 36 + 32); | |
1300 cgm_info[s] = n; | |
1301 } | |
8 | 1302 delete[] data; |
0 | 1303 delete[] dest_orig; |
1304 } | |
1305 | |
1306 /***************************************************** | |
1307 * | |
1308 * GrpImpl :: Save, Load : セーブファイル処理 | |
1309 * | |
1310 */ | |
1311 void GrpImpl::Save(std::string& str) { | |
1312 } | |
1313 void GrpImpl::Load(const char* str) { | |
1314 status = NORMAL; | |
1315 if (anm1) { | |
1316 AbortAnm(); | |
1317 } | |
1318 if (anm2) { | |
1319 anm2->Abort(); | |
1320 delete anm2; | |
1321 anm2 = 0; | |
1322 } | |
1323 map<int,GrpObj>::iterator it; | |
1324 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | |
1325 PicBase* p = it->second.DeletePic(); | |
1326 delete p; | |
1327 } | |
1328 grpobj.clear(); | |
1329 | |
1330 bg_name = ""; | |
1331 music.StopCDROM(100); | |
1332 } | |
1333 void GrpImpl::SaveSys(string& save) { | |
1334 char buf[1024]; | |
1335 save = "\n[Graphics]\n"; | |
1336 save += "CGM_CG="; | |
1337 | |
1338 set<int>::iterator it; | |
1339 for (it=cgm_data.begin(); it != cgm_data.end(); it++) { | |
1340 sprintf(buf,"%d,",*it); | |
1341 save += buf; | |
1342 } | |
1343 save += "\n"; | |
1344 } | |
1345 void GrpImpl::LoadSys(const char* save) { | |
1346 cgm_data.clear(); | |
1347 save = strstr(save, "\n[Graphics]\n"); | |
1348 | |
1349 if (save) { | |
1350 save += strlen("\n[Graphics]\n"); | |
1351 do { | |
1352 if (save[0] == '[') break; // next section | |
1353 if (strncmp(save, "CGM_CG=",7) == 0) { | |
1354 save += 7; | |
1355 while(isdigit(*save)) { | |
1356 int n = atoi(save); | |
1357 cgm_data.insert(n); | |
1358 save = strchr(save, ','); | |
1359 if (save) save++; | |
1360 } | |
1361 } | |
1362 save = strchr(save, '\n'); | |
1363 if (save) save++; | |
1364 } while (save); | |
1365 } | |
1366 return; | |
1367 } | |
1368 | |
1369 | |
1370 /***************************************************** | |
1371 * | |
1372 * GrpImpl :: Wait , Exec : コマンド実行部 | |
1373 * | |
1374 */ | |
1375 static vector<int> drawn_images; | |
1376 static int draw_n = 0; | |
1377 extern bool grpdump_req; | |
1378 bool GrpImpl::Wait(unsigned int current_time, Cmd& cmd) { | |
1379 if (grpdump_req) { | |
1380 grpdump_req = 0; | |
1381 std::map<int,GrpObj>::iterator it; | |
48 | 1382 fprintf(stderr,"front %p(%d) / %p(%d)\n",screen,screen->IsHidden(),screen_front,screen_front->IsHidden()); |
0 | 1383 for (it=grpobj.begin(); it != grpobj.end(); it++) { |
1384 GrpObj& obj = it->second; | |
1385 GrpObj& parent_obj = grpobj[ ((it->first)/1000) * 1000]; | |
1386 if (obj.picture) { | |
1387 if (!obj.name.empty()) { | |
48 | 1388 fprintf(stderr,"obj %06d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n", |
0 | 1389 it->first,obj.picture,obj.name.c_str(), |
1390 obj.PosX(),obj.PosY(),obj.alpha,obj.attr&GrpObj::HIDDEN ? 1 : 0,parent_obj.attr&GrpObj::HIDDEN_GROUP ? 1 : 0,obj.picture->IsHidden()); | |
1391 } else if (!obj.print_moji.empty()) { | |
48 | 1392 fprintf(stderr,"obj %06d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n", |
0 | 1393 it->first,obj.picture,obj.print_moji.c_str(), |
1394 obj.PosX(),obj.PosY(),obj.alpha,obj.attr&GrpObj::HIDDEN ? 1 : 0,parent_obj.attr&GrpObj::HIDDEN_GROUP ? 1 : 0,obj.picture->IsHidden()); | |
1395 } else { | |
48 | 1396 fprintf(stderr,"obj %06d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n", |
0 | 1397 it->first,obj.picture,"<EMPTY>", |
1398 obj.PosX(),obj.PosY(),obj.alpha,obj.attr&GrpObj::HIDDEN ? 1 : 0,parent_obj.attr&GrpObj::HIDDEN_GROUP ? 1 : 0,obj.picture->IsHidden()); | |
1399 } | |
1400 } | |
1401 } | |
1402 std::list<PicBase*>::iterator it2; | |
1403 for (it2=parent.children.begin(); it2!=parent.children.end();it2++) { | |
48 | 1404 fprintf(stderr,"%p(%d)\n",*it2,(*it2)->IsHidden()); |
0 | 1405 } |
1406 RefreshObj(); | |
1407 | |
1408 } | |
1409 #if 0 | |
1410 if (event.presscount(MOUSE_UP)) { | |
1411 std::list<PicBase*>::iterator lit; | |
1412 draw_n++; int i=0; | |
1413 for (lit=parent.children.end(); lit!=parent.children.begin(); ) { | |
1414 lit--; | |
1415 (*lit)->hide(); | |
1416 i++; | |
1417 if (i >= draw_n) break; | |
1418 } | |
1419 if (drawn_images.empty()) { | |
1420 map<int, GrpObj>::iterator it; | |
1421 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | |
1422 if (it->second.picture) { | |
1423 drawn_images.push_back(it->first); | |
1424 PicBase* p = it->second.DeletePic(); | |
1425 delete p; | |
1426 } | |
1427 } | |
1428 } else { | |
1429 vector<int>::iterator it; | |
1430 for (it=drawn_images.begin(); it!=drawn_images.end(); it++) { | |
1431 CreateObj(*it); | |
1432 } | |
1433 drawn_images.clear(); | |
1434 } | |
1435 } | |
1436 #endif | |
1437 if (status == WAIT_ANM) { | |
1438 if (anm1) { | |
1439 if (!anm1->IsEnd()) return true; | |
1440 AbortAnm(); | |
1441 } | |
1442 } else if (status == WAIT_SHAKE) { | |
1443 if (anm2) { | |
1444 if (!anm2->IsEnd()) return true; | |
1445 delete anm2; | |
1446 anm2 = 0; | |
1447 } | |
1448 status = NORMAL; | |
1449 } else if (status == WAIT_SE) { | |
1450 if (music.IsStopSE()) status = NORMAL; | |
1451 return true; | |
1452 } else if (status == WAIT_MOVIE) { | |
1453 if (music.IsStopMovie()) { | |
1454 music.StopMovie(); | |
1455 status = NORMAL; | |
1456 screen->ReBlit(); | |
1457 } | |
1458 return true; | |
1459 } | |
1460 if (anm2) { | |
1461 if (anm2->IsEnd()) { | |
1462 delete anm2; | |
1463 anm2 = 0; | |
1464 } | |
1465 } | |
1466 return false; | |
1467 } | |
1468 | |
1469 void GrpImpl::DeleteObjPic(int num) { // object の surface のみ削除 | |
1470 if (grpobj.find(num) == grpobj.end()) return; | |
1471 deleted_pic.push_back(grpobj[num].DeletePic()); | |
1472 } | |
1473 void GrpImpl::DeleteObj(int num) { | |
1474 if (grpobj.find(num) == grpobj.end()) return; | |
1475 deleted_pic.push_back(grpobj[num].DeletePic()); | |
1476 grpobj.erase(num); | |
1477 } | |
1478 void GrpImpl::DeleteObjRange(int num_first, int num_end) { | |
1479 std::map<int, GrpObj>::iterator begin,end,it; | |
1480 begin = grpobj.lower_bound(num_first); | |
1481 end = grpobj.lower_bound(num_end); | |
1482 for (it=begin;it!=end;it++) { | |
1483 deleted_pic.push_back(it->second.DeletePic()); | |
1484 } | |
1485 grpobj.erase(begin, end); | |
1486 } | |
1487 void GrpImpl::Exec(Cmd& cmd) { | |
1488 if (cmd.cmd_type == CMD_TEXTEND) { | |
1489 music.StopKoe(500); // テキスト終了で声を止める | |
1490 cmd.clear(); | |
1491 return; | |
1492 } | |
1493 if (cmd.cmd_type == CMD_WAITFRAMEUPDATE) { | |
1494 // wait する場合は RefreshObj() しておく | |
1495 RefreshObj(); | |
1496 } | |
1497 if (cmd.cmd_type != CMD_OTHER) return; | |
1498 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x1e && cmd.cmd3 == 0) { | |
1499 cmd.cmd_type = CMD_SAVECMDGRP_START; // grp stack clear | |
1500 } | |
1501 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x21) { | |
1502 if (cmd.cmd3 == 0x46) { | |
1503 const char* name = cmd.Str(cmd.args[0]); | |
1504 int pdt = cmd.args[1].value; | |
1505 eprintf("load surface %s pdt %d\n",name, pdt); | |
1506 if (pdt == 0) | |
1507 reserved_load_surface0 = name; // 画像読み込みは 01-1f:0000 まで待つ | |
1508 else if (pdt == 1) | |
1509 LoadSurface(name); // 背景絵読み込み? | |
1510 else | |
1511 LoadSurface(name, pdt); | |
1512 cmd.cmd_type = CMD_SAVECMDGRP; | |
1513 } else if (cmd.cmd3 == 0x49) { | |
1514 const char* name = cmd.Str(cmd.args[0]); | |
1515 int sel = cmd.args[1].value; | |
1516 eprintf("set background %s sel %d\n",name, sel); | |
1517 if (name[0] == '?') { | |
1518 LoadSurface(); | |
1519 } else { | |
1520 LoadSurface(name); | |
1521 } | |
1522 StartAnm(sel); | |
1523 status = WAIT_ANM; | |
1524 event.RegisterGlobalPressFunc(&Pressed, (void*)this); | |
1525 if (name[0] == '?') | |
1526 cmd.cmd_type = CMD_SAVECMDGRP_ONCE; | |
1527 else | |
1528 cmd.cmd_type = CMD_SAVECMDGRP_START; | |
1529 } else if (cmd.cmd3 == 0x4b) { | |
1530 int pos = cmd.args[0].value; | |
1531 const char* name = cmd.Str(cmd.args[1]); | |
1532 int sel = cmd.args[2].value; | |
1533 eprintf("set foreground %s sel %d pos %d\n",name, sel, pos); | |
1534 AddSurface(name); | |
1535 StartAnm(sel); | |
1536 event.RegisterGlobalPressFunc(&Pressed, (void*)this); | |
1537 status = WAIT_ANM; | |
1538 cmd.cmd_type = CMD_SAVECMDGRP_ONCE; | |
1539 } else if (cmd.cmd3 == 0x4c) { | |
1540 /* 0x46 との違いがわからない */ | |
1541 /* とりあえず bg として登録しないでみる */ | |
1542 /* 735 / 19438 : unsupported command; 0x23 - cmd 01-21:004c:00[ 2] | |
1543 ** "?",0 | |
1544 */ | |
1545 /* arg1 = "?" arg2 = 0 */ | |
1546 const char* name = cmd.Str(cmd.args[0]); | |
1547 int sel = cmd.args[1].value; | |
1548 if (name[0] == '?') { | |
1549 LoadSurface(); | |
1550 } else { | |
1551 LoadSurface(name, 1); | |
1552 } | |
1553 StartAnm(sel); | |
1554 status = WAIT_ANM; | |
1555 event.RegisterGlobalPressFunc(&Pressed, (void*)this); | |
1556 if (name[0] == '?') | |
1557 cmd.cmd_type = CMD_SAVECMDGRP_ONCE; | |
1558 else | |
1559 cmd.cmd_type = CMD_SAVECMDGRP_START; | |
1560 } else if (cmd.cmd3 == 0x20) { | |
1561 // shake screen | |
1562 char key[1024]; | |
1563 sprintf(key, "#SHAKE.%03d", cmd.args[0].value); | |
1564 if (config.SearchParam(key) != 2) { | |
1565 fprintf(stderr,"Cannot find shake pattern %d; use default pattern\n",cmd.args[0].value); | |
1566 strcpy(key, "#SHAKE.000"); // default key | |
1567 } | |
1568 int num; const int* pattern; | |
1569 pattern = config.GetParamArray(key, num); | |
1570 if (pattern) { | |
1571 StartShake(num, pattern); | |
1572 status = WAIT_SHAKE; | |
1573 } | |
1574 cmd.clear(); | |
1575 } else if (cmd.cmd3 == 0x64 && cmd.cmd4 == 2) { // copy (KANOGI) | |
1576 int sx = cmd.args[0].value; | |
1577 int sy = cmd.args[1].value; | |
1578 int w = cmd.args[2].value - sx; | |
1579 int h = cmd.args[3].value - sy; | |
1580 Rect rect(sx, sy, sx+w, sy+h); | |
1581 int src = cmd.args[4].value; | |
1582 int dx = cmd.args[5].value; | |
1583 int dy = cmd.args[6].value; | |
1584 int dest = cmd.args[7].value; | |
1585 unsigned char alpha; | |
1586 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); | |
1587 printf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); | |
1588 if (src == dest) { | |
1589 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect); | |
1590 src = WORKPDT; | |
1591 } | |
1592 parent.Root().BlitSurface(Ssurface(src), rect, Dsurface(dest), Rect(dx,dy)); | |
1593 if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h)); | |
1594 cmd.clear(); | |
1595 } else if (cmd.cmd3 == 0x4b1 && cmd.cmd4 == 2) { | |
1596 int x = cmd.args[0].value; | |
1597 int y = cmd.args[1].value; | |
1598 int w = cmd.args[2].value; | |
1599 int h = cmd.args[3].value; | |
1600 Rect rect(x,y,x+w,y+w); | |
1601 int pdt = cmd.args[4].value; | |
1602 int r = cmd.args[5].value; | |
1603 int g = cmd.args[6].value; | |
1604 int b = cmd.args[7].value; | |
1605 eprintf("clear %d:(%d,%d) size (%d,%d) r %d g %d b %d\n",pdt,x,y,w,h,r,g,b); | |
1606 DSurfaceFill(Dsurface(pdt), rect, r, g, b, 0xff); | |
1607 // if (pdt == 0) screen->ReBlit(rect); | |
1608 cmd.cmd_type = CMD_SAVECMDGRP; | |
1609 } else if (cmd.cmd3 == 0x4b1 && cmd.cmd4 == 3) { // alpha つきfill | |
1610 int x = cmd.args[0].value; | |
1611 int y = cmd.args[1].value; | |
1612 int w = cmd.args[2].value; | |
1613 int h = cmd.args[3].value; | |
1614 Rect rect(x,y,x+w,y+h); | |
1615 int pdt = cmd.args[4].value; | |
1616 int r = cmd.args[5].value; | |
1617 int g = cmd.args[6].value; | |
1618 int b = cmd.args[7].value; | |
1619 int a = cmd.args[8].value; | |
1620 eprintf("alpha-clear %d:(%d,%d) size (%d,%d) r %d g %d b %d a %d\n",pdt,x,y,w,h,r,g,b,a); | |
1621 if (a <= 0) ; | |
1622 else if (a >= 255) DSurfaceFill(Dsurface(pdt), rect, r, g, b); | |
1623 else { | |
1624 DSurfaceFill(Dsurface(WORKPDT), rect, r, g, b, a); | |
1625 parent.Root().BlitSurface(Dsurface(WORKPDT), rect, Dsurface(pdt), rect); | |
1626 } | |
1627 // if (pdt == 0) screen->ReBlit(rect); | |
1628 cmd.clear(); | |
1629 } else if (cmd.cmd3 == 0x44c && cmd.cmd4 == 2) { | |
1630 int sx = cmd.args[0].value; | |
1631 int sy = cmd.args[1].value; | |
1632 int w = cmd.args[2].value; | |
1633 int h = cmd.args[3].value; | |
1634 int src = cmd.args[4].value; | |
1635 int dx = cmd.args[5].value; | |
1636 int dy = cmd.args[6].value; | |
1637 int dest = cmd.args[7].value; | |
1638 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); | |
1639 parent.Root().BlitSurface(Ssurface(src), Rect(sx,sy,sx+w,sy+h), Dsurface(dest), Rect(dx,dy)); | |
1640 //DSurfaceMove(Ssurface(src), Rect(sx,sy,sx+w,sy+h), Dsurface(dest), Rect(dx,dy)); | |
1641 // if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h)); | |
1642 cmd.cmd_type = CMD_SAVECMDGRP; | |
1643 } else if (cmd.cmd3 == 0x44c && cmd.cmd4 == 3) { // alpha つきcopy | |
1644 int sx = cmd.args[0].value; | |
1645 int sy = cmd.args[1].value; | |
1646 int w = cmd.args[2].value; | |
1647 int h = cmd.args[3].value; | |
1648 Rect rect(sx, sy, sx+w, sy+h); | |
1649 int src = cmd.args[4].value; | |
1650 int dx = cmd.args[5].value; | |
1651 int dy = cmd.args[6].value; | |
1652 int dest = cmd.args[7].value; | |
1653 unsigned char alpha; | |
1654 if (cmd.args[8].value < 0) alpha = 0; | |
1655 else if (cmd.args[8].value > 255) alpha = 255; | |
1656 else alpha = cmd.args[8].value; | |
1657 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); | |
1658 if (src == dest) { | |
1659 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect); | |
1660 src = WORKPDT; | |
1661 } | |
1662 if (alpha != 0) | |
1663 parent.Root().BlitSurface(Ssurface(src), rect, &alpha, Rect(0,0,1,1), Dsurface(dest), Rect(dx,dy), 0); | |
1664 // if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h)); | |
1665 cmd.clear(); | |
1666 } else if (cmd.cmd3 == 0x640 && cmd.cmd4 == 3) { // saturate mode で alpha 付き copy | |
1667 int sx = cmd.args[0].value; | |
1668 int sy = cmd.args[1].value; | |
1669 int w = cmd.args[2].value; | |
1670 int h = cmd.args[3].value; | |
1671 Rect rect(sx, sy, sx+w, sy+h); | |
1672 int src = cmd.args[4].value; | |
1673 int dx = cmd.args[5].value; | |
1674 int dy = cmd.args[6].value; | |
1675 int dest = cmd.args[7].value; | |
1676 unsigned char alpha; | |
1677 if (cmd.args[8].value < 0) alpha = 0; | |
1678 else if (cmd.args[8].value > 255) alpha = 255; | |
1679 else alpha = cmd.args[8].value; | |
1680 eprintf("copy surface w/ saturate %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); | |
1681 if (src == dest) { | |
1682 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect); | |
1683 src = WORKPDT; | |
1684 } | |
1685 if (alpha != 0) { | |
1686 // saturate mode : screen (picture) を一時的に作成 | |
1687 PicBase* screen_tmp = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | |
1688 screen_tmp->SetSurface(Ssurface(src), 0, 0, PicBase::BLIT_SATURATE); | |
1689 screen_tmp->SetSurfaceRect(rect); | |
1690 screen_tmp->Move(dx, dy); | |
1691 screen_tmp->SetSurfaceAlpha(&alpha, Rect(0,0,1,1)); | |
1692 screen_tmp->SimpleBlit(Dsurface(dest)); | |
1693 delete screen_tmp; | |
1694 } | |
1695 cmd.clear(); | |
1696 } else if (cmd.cmd3 == 0x196 && cmd.cmd4 == 0) { | |
1697 Rect r_from(cmd.args[0].value, cmd.args[1].value); | |
1698 Rect r_to(cmd.args[2].value, cmd.args[3].value); | |
1699 int src_pdt = cmd.args[4].value; | |
1700 Rect r(cmd.args[5].value,cmd.args[6].value,cmd.args[7].value+1,cmd.args[8].value+1); | |
1701 int tm = cmd.args[9].value; | |
1702 fprintf(stderr,"??? cmd time %d\n",tm); | |
1703 // anm1 = new ScnGrpMove(event, screen, parent.Root(), surface, r, Ssurface(2), r_from, r_to, tm); | |
1704 // status = WAIT_ANM; | |
1705 } | |
1706 } | |
1707 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x22) { | |
1708 if (cmd.cmd3 == 0x0c30 && cmd.cmd4 == 0) { // スクロールする画像効果(Princess Bride) | |
1709 if (anm2) { | |
1710 anm2->Abort(); | |
1711 delete anm2; | |
1712 } | |
1713 PicBase* pic; Surface* s; | |
1714 Rect r(cmd.args[1].value, cmd.args[2].value, cmd.args[3].value+1, cmd.args[4].value+1); | |
1715 const char* name = cmd.Str(cmd.args[5]); | |
1716 Rect sr_start(cmd.args[6].value,cmd.args[7].value); | |
1717 Rect sr_end(cmd.args[8].value,cmd.args[9].value); | |
1718 int tm = cmd.args[10].value; | |
1719 LoadSurface(name, 2); /* PDT2 に読み込み、と決め打ち */ | |
1720 | |
1721 anm2 = new ScnGrpMove(event, screen, parent.Root(), Dsurface(1), r, Ssurface(2), sr_start, sr_end, tm); | |
1722 cmd.cmd_type = CMD_SAVECMDGRP; | |
1723 } | |
1724 if ( (cmd.cmd3 == 0xc1c && cmd.cmd4 == 0) || (cmd.cmd3 == 0x835 && cmd.cmd4 == 0) ) { | |
1725 // カードが落ちるアニメーション | |
1726 int i; | |
1727 ScnGrpAnm* new_anm = new ScnGrpAnm(event, screen, *this); | |
1728 if (cmd.cmd3 == 0x835) { | |
1729 AbortAnm(); | |
1730 anm1 = new_anm; | |
1731 status = WAIT_ANM; | |
1732 event.RegisterGlobalPressFunc(&Pressed, (void*)this); | |
1733 } else { | |
1734 anm2 = new_anm; | |
1735 } | |
1736 for (i=0; i<cmd.argc; i++) { | |
1737 const char* name = cmd.Str(cmd.args[i*3+1]); | |
1738 int tm = cmd.args[i*3+2].value; | |
1739 new_anm->push_back(ScnGrpAnmAtom(name,tm)); | |
1740 } | |
1741 new_anm->CalcTotal(); | |
1742 cmd.clear(); | |
1743 } | |
1744 } | |
26 | 1745 if (cmd.cmd1 == 1 && cmd.cmd2 == 4) { |
1746 if (cmd.cmd3 == 0x5dc) // Total number of CG | |
1747 cmd.SetSysvar(cgm_size); | |
1748 if (cmd.cmd3 == 0x5dd) // Number of CG viewed | |
1749 cmd.SetSysvar(cgm_data.size()); | |
1750 if (cmd.cmd3 == 0x5de) // Percentage of CG viewed | |
20
824b89018ea8
* CG completion percentage (maybe not working properly?)
thib
parents:
18
diff
changeset
|
1751 cmd.SetSysvar(cgm_data.size() * 100 / cgm_size); |
26 | 1752 |
0 | 1753 if (cmd.cmd3 == 0xd8 || cmd.cmd3 == 0xd3 || cmd.cmd3 == 0xd2 || cmd.cmd3 == 0xd7) { |
1754 cmd.clear(); // いつも 0xd8 / 0xd7 と組で出てくる | |
1755 } | |
26 | 1756 |
1757 // CG Status | |
0 | 1758 if (cmd.cmd3 == 0x5e0) { // 画像既視フラグを得る |
1759 string s = cmd.Str(cmd.args[0]); | |
1760 if (cgm_info.find(s) == cgm_info.end()) { | |
1761 fprintf(stderr,"cmd 01-04:05e0 : cannot find cgm-info of '%s'\n",s.c_str()); | |
1762 return; | |
1763 } | |
1764 int n = cgm_info[s]; | |
1765 if (cgm_data.find(n) == cgm_data.end()) cmd.SetSysvar(0); | |
1766 else cmd.SetSysvar(1); | |
1767 } | |
26 | 1768 |
1769 if (cmd.cmd3 == 0x6a4) { // CreateInput (index, x, y, width, height, fontsize, br, bg, bb, fr, fg, fb) | |
1770 int index = cmd.args[0].value; | |
1771 int x = cmd.args[1].value; | |
1772 int y = cmd.args[2].value; | |
1773 //TODO | |
1774 } | |
1775 if (cmd.cmd3 == 0x6ae) { // SetInput (index, text) | |
1776 //TODO | |
1777 } | |
0 | 1778 } |
1779 #if 1 | |
1780 /* object 操作 */ | |
1781 if ( (cmd.cmd1 == 1 || cmd.cmd1 == 2) && (cmd.cmd2 == 0x3d || cmd.cmd2 == 0x3e) && (cmd.cmd3 == 0x0a || cmd.cmd3 == 0x0b || cmd.cmd3 == 0x0e)) { // clear object | |
1782 if (cmd.cmd3 == 0x0a || cmd.cmd3 == 0x0b) { | |
1783 if (cmd.cmd1 == 2 && cmd.args.size() == 2) { | |
1784 int num = cmd.args[0].value*1000 + cmd.args[1].value + 500; | |
1785 DeleteObj(num); | |
1786 } else if (cmd.args.size() == 1) { // group ごと消去 | |
1787 int num_first = cmd.args[0].value * 1000; | |
1788 int num_end = num_first+1000; | |
1789 DeleteObjRange(num_first, num_end); | |
1790 } | |
1791 } else { // 0x0e | |
1792 if (cmd.cmd1 == 1 && cmd.args.size() == 2) { | |
1793 SwapObj(cmd.args[0].value * 1000, cmd.args[1].value * 1000); | |
1794 } else if (cmd.cmd1 == 2 && cmd.args.size() == 3) { | |
1795 int v1 = cmd.args[0].value*1000 + cmd.args[1].value + 500; | |
1796 int v2 = cmd.args[0].value*1000 + cmd.args[2].value + 500; | |
1797 SwapObj(v1, v2); | |
1798 } | |
1799 } | |
1800 cmd.clear(); | |
1801 } | |
1802 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x3c && cmd.cmd3 == 0x01) { // ??? : CLANNAD | |
1803 cmd.clear(); | |
1804 } | |
1805 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x3c && cmd.cmd3 == 0) { // ??? : KANOGI : 画像オブジェクトの削除? | |
1806 DeleteObjPic(cmd.args[0].value * 1000); // 旧ファイル名のsurfaceを削除 | |
1807 GrpObj& g = grpobj[cmd.args[0].value * 1000]; | |
1808 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); | |
1809 cmd.clear(); | |
1810 } | |
1811 if ( (cmd.cmd1 == 1 || cmd.cmd1 == 2) && (cmd.cmd2 == 0x47 || cmd.cmd2 == 0x48|| cmd.cmd2 == 0x49 || cmd.cmd2 == 0x51 || cmd.cmd2 == 0x52 || cmd.cmd2 == 0x54)) { | |
1812 if (cmd.cmd1 == 1) { | |
1813 if (cmd.args.size() >= 1) cmd.args[0].value *= 1000; // とりあえず 1000倍しておく | |
1814 } else { // cmd.cmd2 == 2 | |
1815 // オブジェクト番号を指定するコマンド引数が一つ増えているのを消去 | |
1816 vector<VarInfo> args = cmd.args; | |
1817 cmd.args.clear(); | |
1818 if (args.size() >= 2) { | |
1819 cmd.args.push_back(args[0].value*1000 + args[1].value + 500); | |
1820 cmd.args.insert(cmd.args.end(), args.begin()+2, args.end()); | |
1821 } | |
1822 } | |
1823 if (cmd.cmd2 == 0x47) { | |
1824 /**************: | |
1825 0x47 : オブジェクト内容の設定 | |
1826 0x3e8: G00 ファイル | |
1827 0x3eb: GAN ファイル | |
1828 0x44c: 矩形領域 | |
1829 0x4b0: 文字列 | |
1830 0x514: 天候効果 | |
1831 0x578: 数字の画像表示 | |
1832 */ | |
1833 int base_argc = 0; | |
1834 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除 | |
1835 GrpObj& g = grpobj[cmd.args[0].value]; | |
1836 if (cmd.cmd3 == 0x3e8) { /* ファイル名設定 */ | |
1837 g.gtype = GrpObj::FILE; | |
1838 string name = cmd.Str(cmd.args[1]); | |
1839 if (name.find('?') != -1) { | |
1840 name.erase(name.find('?')); // '?' 以降の意味がわからない | |
1841 } | |
1842 g.name = name; | |
1843 } else if (cmd.cmd3 == 0x3eb) { /* ファイル名設定(GAN含む) */ | |
1844 g.gtype = GrpObj::GAN; | |
1845 if (cmd.Str(cmd.args[1]) == string("???")) | |
1846 g.name = cmd.Str(cmd.args[2]); | |
1847 else | |
1848 g.name = cmd.Str(cmd.args[1]); | |
1849 g.gan_name = cmd.Str(cmd.args[2]); | |
5 | 1850 |
1851 if (cmd.cmd4 >= 1 && cmd.args[3].value == 0) | |
1852 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); | |
1853 else | |
1854 g.attr = GrpObj::Attribute(g.attr & ~(GrpObj::HIDDEN)); | |
1855 | |
1856 if (cmd.argc >= 5) | |
1857 g.SetPos(1, cmd.args[4].value, -cmd.args[5].value); | |
1858 | |
1859 if (g.name.find('?') != -1) { | |
4 | 1860 g.name.erase(g.name.find('?')); |
1861 g.gan_name = cmd.Str(cmd.args[2]); | |
1862 } | |
0 | 1863 } else if (cmd.cmd3 == 0x4b0) { // 画像を文字列として指定 |
1864 g.gtype = GrpObj::MOJI; | |
1865 g.print_moji = cmd.Str(cmd.args[1]); | |
1866 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); // 常に表示がデフォルト? | |
1867 cmd.clear(); | |
1868 } else if (cmd.cmd3 == 0x578) { // 数値を画像として表示 | |
1869 g.gtype = GrpObj::DIGIT; | |
1870 g.name = cmd.Str(cmd.args[1]); | |
1871 } | |
1872 CreateObj(cmd.args[0].value); | |
1873 if (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb || cmd.cmd3 == 0x4b0 || cmd.cmd3 == 0x578) { | |
1874 // FILE, GAN, MOJI, DIGIT ならば座標等の設定を行う | |
18 | 1875 if (cmd.cmd4 >= 1) { |
0 | 1876 if (cmd.args[2+base_argc].value == 0) { |
1877 if (cmd.cmd1 == 1) | |
1878 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP); | |
1879 else | |
1880 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); | |
1881 } else { | |
1882 if (cmd.cmd1 == 1) | |
1883 g.attr = GrpObj::Attribute(g.attr & (~(GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP))); | |
1884 else | |
1885 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); | |
1886 } | |
1887 if (cmd.cmd1 == 1) | |
1888 SetObjChangedGroup(cmd.args[0].value); | |
1889 } | |
18 | 1890 if (cmd.cmd4 >= 2) { // 座標等も設定 |
0 | 1891 g.SetPos(0,cmd.args[3+base_argc].value, cmd.args[4+base_argc].value); |
1892 } | |
18 | 1893 if ( (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb) && cmd.cmd4 >= 3) { // pattern 番号も設定 |
0 | 1894 g.SetSurfaceNum(cmd.args[5+base_argc].value); |
1895 base_argc++; // 0x3e8 (FILE) / 0x3eb (GAN) の場合のみこのオプションは存在する | |
1896 } | |
1897 cmd.clear(); | |
1898 } else { | |
1899 fprintf(stderr,"CreateObj : cmd.cmd3 = %04x ; not supported!\n",cmd.cmd3); | |
1900 } | |
1901 } else if (cmd.cmd2 == 0x48) { | |
1902 // 画面切り替え後の object (back screen object) 設定 | |
1903 if (cmd.cmd3 == 0x3e8) { | |
1904 // cmd.cmd4 == 0 : args = 2, CLANNAD : cg mode | |
1905 // cmd.cmd4 == 1 : args = 3, CLANNAD : 春原回想?のところで画面が黒くなってしまうので、とりあえず。 | |
1906 // cmd.cmd4 == 2 : args = 5, KANOGI : Fore Graphics | |
1907 // cmd.cmd4 == 3 : args = 6, KANOGI : CG mode | |
1908 GrpObj& g = bs_obj[cmd.args[0].value]; | |
1909 string name = cmd.Str(cmd.args[1]); | |
1910 if (name.find('?') != -1) { | |
1911 name.erase(name.find('?')); // '?' 以降の意味がわからない | |
1912 } | |
1913 g.gtype = GrpObj::FILE; | |
1914 g.name = name; | |
1915 if (cmd.cmd4 >= 1 && cmd.args[2].value == 0) | |
1916 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); | |
1917 else | |
1918 g.attr = GrpObj::Attribute(g.attr & ~(GrpObj::HIDDEN)); | |
1919 if (cmd.cmd4 >= 2) | |
1920 g.SetPos(0,cmd.args[3].value, cmd.args[4].value); | |
1921 if (cmd.cmd4 >= 3) | |
1922 g.SetSurfaceNum(cmd.args[5].value); | |
1923 if (cmd.cmd4 <= 3) | |
1924 cmd.cmd_type = CMD_SAVECMDGRP; | |
1925 } | |
1926 } else if (cmd.cmd2 == 0x49) { | |
1927 if (cmd.cmd3 == 0) { // アニメーションを強制終了 | |
1928 GrpObj& g = grpobj[cmd.args[0].value]; | |
1929 if (g.anm == 0 || g.anm->IsEnd()) ; | |
1930 else g.anm->Abort(); | |
1931 } else if (cmd.cmd3 == 3) { // アニメーション中か? | |
1932 GrpObj& g = grpobj[cmd.args[0].value]; | |
1933 if (g.anm == 0 || g.anm->IsEnd()) { | |
1934 cmd.SetSysvar(0); | |
1935 } else { | |
1936 cmd.SetSysvar(1); | |
1937 } | |
1938 } else if (cmd.cmd3 == 1000) { | |
1939 // アニメーションを途中で停止した状態にする | |
1940 GrpObj& g = grpobj[cmd.args[0].value]; | |
1941 if (g.anm == 0 || g.anm->IsEnd()) { | |
1942 // fprintf(stderr,"AnimPause : no animation in %d (%d)\n",cmd.args[0].value, cmd.args[1].value); | |
1943 g.SetSurfaceNum(cmd.args[1].value); | |
1944 } else { | |
1945 g.anm->Abort(); | |
1946 g.SetSurfaceNum(cmd.args[1].value); | |
1947 } | |
1948 SetObjChanged(cmd.args[0].value); | |
1949 cmd.clear(); | |
1950 } else if (cmd.cmd3 == 0x7d3) { // surface を増加させる画像効果 | |
1951 GrpObj& g = grpobj[cmd.args[0].value]; | |
1952 g.CreateGanSpecial(event, 0, cmd.args[1].value); | |
1953 // g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); | |
1954 SetObjChanged(cmd.args[0].value); | |
1955 cmd.clear(); | |
1956 } else if (cmd.cmd3 == 0xbbd || cmd.cmd3 == 0xbbb || cmd.cmd3 == 0xbb9) { // アニメーション開始 | |
1957 GrpObj& g = grpobj[cmd.args[0].value]; | |
1958 g.CreateGan(event, cmd.args[1].value); | |
1959 // g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); | |
1960 SetObjChanged(cmd.args[0].value); | |
1961 cmd.clear(); | |
1962 } | |
1963 } else if (cmd.cmd2 == 0x51 || cmd.cmd2 == 0x52) { | |
1964 GrpObj& g = (cmd.cmd2 == 0x51) ? | |
1965 grpobj[cmd.args[0].value] : | |
1966 bs_obj[cmd.args[0].value]; | |
1967 if (cmd.cmd3 == 0x3e8) { /* 座標設定 */ | |
1968 g.SetPos(0,cmd.args[1].value, cmd.args[2].value); | |
1969 cmd.clear(); | |
1970 } else if (cmd.cmd3 == 0x3e9 || cmd.cmd3 == 0x3ea) { /* x / y 座標のみ設定 */ | |
1971 int x0, y0; | |
1972 g.GetPos(0, x0, y0); | |
1973 if (cmd.cmd3 == 0x3e9) | |
1974 g.SetPos(0,cmd.args[1].value, y0); | |
1975 else | |
1976 g.SetPos(0,x0, cmd.args[1].value); | |
1977 cmd.clear(); | |
1978 } else if (cmd.cmd3 == 0x3eb) { /* alpha */ | |
1979 g.SetAlpha(cmd.args[1].value); | |
1980 cmd.clear(); | |
1981 } else if (cmd.cmd3 == 0x3ec) { /* visible flag */ | |
1982 if (cmd.cmd1 == 1) { | |
1983 if (cmd.args[1].value) g.attr = GrpObj::Attribute(g.attr & (~(GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP))); | |
1984 else g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP); | |
1985 } else { | |
1986 if (cmd.args[1].value) g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); | |
1987 else g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); | |
1988 } | |
1989 g.attr = GrpObj::Attribute(g.attr | GrpObj::UPDATE_VISIBLE); | |
1990 // グループ単位で次の RefreshObj で表示・消去 | |
1991 if (cmd.cmd2 == 0x51 && cmd.cmd1 == 1) | |
1992 SetObjChangedGroup(cmd.args[0].value); | |
1993 cmd.clear(); | |
1994 } else if (cmd.cmd3 == 0x3ee || cmd.cmd3 == 0x7d6) { /* 座標設定その2? */ | |
1995 /* 0x7d6 : 画像側の基準座標を args[4,5] に入れているのかもしれない */ | |
1996 int index = cmd.args[1].value; | |
1997 int x = cmd.args[2].value; | |
1998 int y = cmd.args[3].value; | |
1999 g.SetPos(index+1, x, y); | |
2000 cmd.clear(); | |
2001 } else if (cmd.cmd3 == 0x3f8) { // 画像を文字列として設定:色の設定 | |
2002 g.print_r = cmd.args[1].value; | |
2003 g.print_g = cmd.args[2].value; | |
2004 g.print_b = cmd.args[3].value; | |
2005 g.SetUpdate(); | |
2006 // grpobj[cmd.args[0].value].print_a = cmd.args[4].value; | |
2007 /* args:229,18,minus-1,0,99,255,-1 */ | |
2008 /* args:102,26,minus-1,0,99,0,255 */ | |
2009 cmd.clear(); | |
2010 } else if (cmd.cmd3 == 0x3fd) { // centering mode などを設定? | |
2011 if (cmd.args[1].value == 1) { | |
2012 g.attr = GrpObj::Attribute(g.attr | GrpObj::SATURATE); | |
2013 cmd.clear(); | |
2014 } else if (cmd.args[1].value == 0) { | |
2015 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::SATURATE)); | |
2016 cmd.clear(); | |
2017 } | |
2018 g.SetUpdate(); | |
2019 /* cmd3 == 0x41c : ゲームの進行とともに | |
2020 args:10,105 | |
2021 args:10,133 | |
2022 args:10,144 | |
2023 args:10,144 | |
2024 と変化 | |
2025 | |
2026 cmd3 == 0x418 : | |
2027 args: 10, 400 -> 100 | |
2028 と、alpha の増加とともに変化 | |
2029 */ | |
2030 /* | |
2031 487 / 8047 : unsupported command; 0x23 - cmd 01-51:0419:00[ 2] | |
2032 81,-40, | |
2033 第二引数の 1/10 がオブジェクトの回転角 | |
2034 */ | |
2035 } else if (cmd.cmd3 == 0x400) { // 画像を文字列として指定 | |
2036 g.print_moji = cmd.Str(cmd.args[1]); | |
2037 g.SetUpdate(); | |
2038 cmd.clear(); | |
2039 } else if (cmd.cmd3 == 0x401) { // 画像を文字列として設定:文字の大きさなど | |
2040 /* args: size, xspace, yspace, vertical, color, shadow */ | |
2041 /* | |
2042 args:17, 0,0,-1, 0,-1 DT in Tomoyo | |
2043 args:17, 0,0,-1,200,-1 Save/Load in Tomoyo | |
2044 args:20, 0,0, 0,255,-1 "──ありがとう…。" (勝平Ed付近) | |
2045 args:16,-1,0,99,255,-1 "やあ、久しぶり──…。" (同上,Save/Load Menu) | |
2046 args:26,-1,0,99, 0,255 Kuma in CLANNAD | |
2047 */ | |
2048 g.print_size = cmd.args[1].value; | |
2049 /* 前景色を得る */ | |
2050 int cr,cg,cb; char key[1024]; | |
2051 sprintf(key, "#COLOR_TABLE.%03d", cmd.args[5].value); | |
2052 if (config.GetParam(key, 3, &cr, &cg, &cb)) { // color not found | |
2053 cr = cg = cb = 0; | |
2054 } | |
2055 g.print_r = cr; | |
2056 g.print_g = cg; | |
2057 g.print_b = cb; | |
2058 g.SetUpdate(); | |
2059 cmd.clear(); | |
2060 } else if (cmd.cmd3 == 0x408) { // set order | |
2061 int order = cmd.args[1].value; | |
2062 if (cmd.cmd1 == 1) order *= 1000; // order も 1000 倍する必要がある? | |
2063 g.order = order; | |
2064 ZMoveObj(cmd.args[0].value); | |
2065 cmd.clear(); | |
2066 } else if (cmd.cmd3 == 0x40a && cmd.cmd4 == 1) { // set surface geometry? | |
2067 // オブジェクトのどの部分を画面に表示するか(クリップ領域)の設定 | |
2068 int rx = cmd.args[1].value; | |
2069 int ry = cmd.args[2].value; | |
43
01aa5ddf7dc8
A lot of very minor improvements (deleted some unused variables, and other things like that...)
thib
parents:
26
diff
changeset
|
2070 int x2 = cmd.args[3].value; |
01aa5ddf7dc8
A lot of very minor improvements (deleted some unused variables, and other things like that...)
thib
parents:
26
diff
changeset
|
2071 int y2 = cmd.args[4].value; |
01aa5ddf7dc8
A lot of very minor improvements (deleted some unused variables, and other things like that...)
thib
parents:
26
diff
changeset
|
2072 g.SetClipArea(rx, ry, x2, y2); //TODO: case when cmd.args.size() == 1 |
0 | 2073 cmd.clear(); |
2074 } else if (cmd.cmd3 == 0x40d) { // set digit number | |
2075 g.dig_number = cmd.args[1].value; | |
2076 g.SetUpdate(); | |
2077 cmd.clear(); | |
2078 } else if (cmd.cmd3 == 0x40e) { // set digit option | |
2079 g.dig_digit = cmd.args[1].value; | |
2080 int attr = g.attr; | |
2081 attr &= ~(GrpObj::DIG_ZERO | GrpObj::DIG_SIGN | GrpObj::DIG_PACK); | |
2082 if (cmd.args[2].value) attr |= GrpObj::DIG_ZERO; | |
2083 if (cmd.args[3].value) attr |= GrpObj::DIG_SIGN; | |
2084 if (cmd.args[4].value) attr |= GrpObj::DIG_PACK; | |
2085 g.attr = GrpObj::Attribute(attr); | |
2086 g.SetUpdate(); | |
2087 cmd.clear(); | |
2088 } else if (cmd.cmd3 == 0x40f) { /* set surface number */ | |
2089 g.SetSurfaceNum(cmd.args[1].value); | |
2090 cmd.clear(); | |
2091 } else if (cmd.cmd3 == 0x416) { // オブジェクトの拡大率設定 | |
2092 int zoom = (cmd.args[1].value + cmd.args[2].value)/2; // x,y 別に設定できるらしい | |
2093 zoom = zoom*256/100; | |
2094 g.SetZoomRotate(zoom, -1); | |
2095 cmd.clear(); | |
2096 } else if (cmd.cmd3 == 0x419) { // オブジェクトの回転設定 | |
2097 int angle = cmd.args[1].value; | |
2098 angle /= 10; | |
2099 if (angle < 0) { | |
2100 angle %= 360; | |
2101 angle += 360; | |
2102 } | |
2103 angle %= 360; | |
2104 g.SetZoomRotate(-1, angle); | |
2105 cmd.clear(); | |
2106 } | |
2107 if (cmd.cmd2 == 0x51 && (g.attr & GrpObj::UPDATE_ALL)) { | |
2108 SetObjChanged(cmd.args[0].value); | |
2109 } | |
2110 } else if (cmd.cmd2 == 0x54) { | |
2111 /* 座標取得 */ | |
2112 if (cmd.cmd3 == 0x3e8) { | |
2113 GrpObj& obj = grpobj[cmd.args[0].value]; | |
2114 VarInfo arg1 = cmd.args[1]; | |
2115 VarInfo arg2 = cmd.args[2]; | |
2116 int x0, y0; | |
2117 obj.GetPos(0,x0, y0); | |
2118 cmd.SetFlagvar(arg1, x0); | |
2119 cmd.SetFlagvar(arg2, y0); | |
2120 } else if (cmd.cmd3 == 0x44c) { | |
2121 int w, h; | |
2122 GrpObj& obj = grpobj[cmd.args[0].value]; | |
2123 obj.GetSrcGeom(w, h); | |
2124 VarInfo arg1 = cmd.args[1]; | |
2125 VarInfo arg2 = cmd.args[2]; | |
2126 cmd.SetFlagvar(arg1, w); | |
2127 cmd.SetFlagvar(arg2, h); | |
2128 } | |
2129 } | |
2130 // セーブ用にコマンドを元に戻す | |
2131 if (cmd.args.size() != 0 && (cmd.cmd_type == CMD_SAVECMDGRP || cmd.cmd_type == CMD_SAVECMDGRP_ONCE)) { | |
2132 if (cmd.cmd1 == 1) cmd.args[0].value /= 1000; | |
2133 else if (cmd.cmd1 == 2) { | |
2134 vector<VarInfo> args = cmd.args; | |
2135 int value = args[0].value; | |
2136 cmd.args.clear(); | |
2137 args[0].value = value / 1000; | |
2138 cmd.args.push_back(args[0]); | |
2139 args[0].value = value % 1000 - 500; | |
2140 cmd.args.push_back(args[0]); | |
2141 cmd.args.insert(cmd.args.end(), args.begin()+1, args.end()); | |
2142 } | |
2143 } | |
2144 } | |
2145 #endif | |
2146 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x1f) { // 本来は grpstack clear らしい | |
2147 RefreshObj(); | |
2148 // Princess Bride の中途 Staff roll | |
2149 // このタイミングで描画するのが都合がいいので、 | |
2150 //シナリオループを抜けて描画を起動 | |
2151 cmd.cmd_type = CMD_WAITFRAMEUPDATE; | |
2152 } | |
2153 | |
2154 /* XXX : GiGiGi */ | |
2155 /* 122 : 0x23 - cmd 01-04:0924:00[ 0] : V<sys> にBGM再生モードを返す (0/1) | |
2156 ** 256 : 0x23 - cmd 01-04:091a:00[ 0] : V<sys> にBGM音量を返す (0-255?) | |
2157 ** 278 : 0x23 - cmd 01-04:0926:00[ 0] : V<sys> にEff再生モードを返す (0/1) | |
2158 ** 412 : 0x23 - cmd 01-04:091c:00[ 0] : V<sys> にEff音量を返す (0-255?) | |
2159 ** 434 : 0x23 - cmd 01-04:0927:00[ 0] : V<sys> にSE 再生モードを返す (0/1) | |
2160 ** 568 : 0x23 - cmd 01-04:091d:00[ 0] : V<sys> にSE 音量を返す (0-255?) | |
2161 | |
2162 ** 122 : 0x23 - cmd 01-04:08c0:00[ 0] : V<sys> にBGM再生モードを設定 (0/1) | |
2163 ** 256 : 0x23 - cmd 01-04:08b6:00[ 0] : V<sys> にBGM音量を設定 (0-255?) | |
2164 ** 278 : 0x23 - cmd 01-04:08c2:00[ 0] : V<sys> にEff再生モードを設定 (0/1) | |
2165 ** 412 : 0x23 - cmd 01-04:08b8:00[ 0] : V<sys> にEff音量を設定 (0-255?) | |
2166 ** 434 : 0x23 - cmd 01-04:08c3:00[ 0] : V<sys> にSE 再生モードを設定 (0/1) | |
2167 ** 568 : 0x23 - cmd 01-04:08b9:00[ 0] : V<sys> にSE 音量を設定 (0-255?) | |
2168 */ | |
2169 // 本来は音楽関連のコマンド | |
2170 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x14) { | |
2171 if (cmd.cmd3 == 0 && cmd.cmd4 == 0) { | |
2172 eprintf("play bgm %s\n",cmd.Str(cmd.args[0])); | |
2173 music.PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000); | |
2174 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2175 } | |
2176 if (cmd.cmd3 == 2 && (cmd.cmd4 == 2 || cmd.cmd4 == 0) ) { /* ??? : ことみシナリオラストの音楽再生 */ | |
2177 eprintf("play bgm %s\n",cmd.Str(cmd.args[0])); | |
2178 music.PlayCDROM( (char*)cmd.Str(cmd.args[0]), 1); | |
2179 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2180 } | |
2181 if (cmd.cmd3 == 0 && cmd.cmd4 == 2) { | |
2182 eprintf("fade bgm %d? and play bgm %s; %d\n",cmd.args[1].value, cmd.Str(cmd.args[0]), cmd.args[2].value); | |
2183 // music.PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000, cmd.args[2].value); | |
2184 music.PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000); | |
2185 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2186 } | |
2187 if ( (cmd.cmd3 == 5 || cmd.cmd3 == 0x69) && cmd.cmd4 == 0) { | |
2188 if (cmd.cmd3 == 5) { | |
2189 music.StopCDROM(0); | |
2190 eprintf("stop bgm\n"); | |
2191 } else { | |
2192 music.StopCDROM(cmd.args[0].value); | |
2193 eprintf("fade bgm %d\n",cmd.args[0].value); | |
2194 } | |
2195 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2196 } | |
2197 } | |
2198 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x15) { | |
10 | 2199 if ((cmd.cmd3 == 2) || (cmd.cmd3 == 0 && (cmd.cmd4 == 1 || cmd.cmd4 == 2)) || (cmd.cmd3 == 0 && cmd.cmd4 == 0)) { |
11 | 2200 eprintf("play SE %s\n",cmd.Str(cmd.args[0])); |
0 | 2201 if (cmd.cmd3 == 2) { |
2202 music.PlaySE(cmd.Str(cmd.args[0]),1); | |
2203 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2204 } else { | |
2205 music.PlaySE(cmd.Str(cmd.args[0])); | |
2206 cmd.clear(); | |
2207 } | |
2208 } else if (cmd.cmd3 == 5) { | |
2209 eprintf("Stop SE\n"); | |
2210 music.StopSE(); | |
2211 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2212 } else if (cmd.cmd3 == 0x69) { | |
2213 eprintf("Stop SE with fade %d\n",cmd.args[0].value); | |
2214 music.StopSE(cmd.args[0].value); | |
2215 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2216 } | |
2217 } | |
2218 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && (cmd.cmd3 == 0x4bb || cmd.cmd3 == 0x4bc) ) { | |
2219 // 音楽を待ってみる(絶対に違うが)。本来、04-803 に対応してなにかの終わりをwaitするっぽい(風子/智代Ed付近) | |
2220 // EnableSyscom らしいが、よくわからない (rldev) | |
2221 // if (!music.IsStopSE()) status = WAIT_SE; | |
2222 cmd.clear(); | |
2223 } | |
26 | 2224 |
0 | 2225 // 音楽モードで音量を上げるためのコマンド (SetBgmVolume) |
2226 // とりあえず未実装 | |
26 | 2227 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && cmd.cmd3 >= 0x8b6 && cmd.cmd3 <= 0x8b9) { // Set{Bgm,Koe,PCM,Se}VolMod |
2228 music.volmod[cmd.cmd3-0x8b6] = cmd.args[0].value; | |
2229 config.SetParam("#VOLMOD", 4, music.volmod[0], music.volmod[1], music.volmod[2], music.volmod[3]); | |
0 | 2230 cmd.clear(); |
2231 } | |
26 | 2232 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && cmd.cmd3 >= 0x91a && cmd.cmd3 <= 0x91d) { // Get{Bgm,Koe,PCM,Se}VolMod |
2233 cmd.SetSysvar(music.volmod[cmd.cmd3-0x91a]); | |
2234 } | |
0 | 2235 |
2236 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x16) { | |
2237 if (cmd.cmd3 == 0 && cmd.cmd4 == 0) { | |
2238 eprintf("play SE %d\n",cmd.args[0].value); | |
2239 music.PlaySE(cmd.args[0].value); | |
2240 cmd.clear(); | |
2241 } | |
2242 } | |
2243 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x17) { | |
2244 if (cmd.cmd3 == 0) { | |
2245 eprintf("play koe %d",cmd.args[0].value); | |
2246 if (cmd.cmd4 == 1) { | |
2247 eprintf(", para? %d",cmd.args[1].value); | |
2248 } | |
2249 eprintf("\n"); | |
2250 char buf[1024]; sprintf(buf, "%d",cmd.args[0].value); | |
2251 if ( !(skip_mode & SKIP_TEXT)) music.PlayKoe(buf); | |
2252 cmd.clear(); | |
2253 } | |
2254 } | |
2255 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x1a) { | |
2256 if ( (cmd.cmd3 == 0x14 || cmd.cmd3 == 1) && cmd.cmd4 == 0) { | |
2257 const char* str = cmd.Str(cmd.args[0]); | |
2258 int x = cmd.args[1].value; | |
2259 int y = cmd.args[2].value; | |
2260 int x2 = cmd.args[3].value; | |
2261 int y2 = cmd.args[4].value; | |
2262 eprintf("play movie ; name %s pos %d,%d - %d,%d\n",str,x,y,x2,y2); | |
2263 music.PlayMovie(str, x, y, x2, y2,1); | |
2264 status = WAIT_MOVIE; | |
2265 event.RegisterGlobalPressFunc(&Pressed, (void*)this); | |
2266 cmd.clear(); | |
2267 } | |
2268 } | |
2269 return; | |
2270 } | |
2271 | |
2272 | |
2273 /******************************************************** | |
2274 ** | |
2275 ** class Grp | |
2276 */ | |
2277 | |
2278 Grp::Grp(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm,class MuSys& mu, AyuSysConfig& config) { | |
2279 pimpl = new GrpImpl(_event, _parent, f, _cgm, mu, config); | |
2280 }; | |
2281 Grp::~Grp() { | |
2282 delete pimpl; | |
2283 } | |
2284 | |
2285 bool Grp::Wait(unsigned int current_time, Cmd& cmd) { | |
2286 return pimpl->Wait(current_time, cmd); | |
2287 } | |
2288 void Grp::Exec(Cmd& cmd) { | |
2289 pimpl->Exec(cmd); | |
2290 } | |
2291 void Grp::SetSkipMode(SkipMode mode) { | |
2292 pimpl->SetSkipMode(mode); | |
2293 } | |
2294 void Grp::InitSel(AyuSysConfig& config) { | |
2295 pimpl->InitSel(config); | |
2296 } | |
2297 void Grp::Save(std::string& str) { | |
2298 pimpl->Save(str); | |
2299 } | |
2300 | |
2301 void Grp::Load(const char* str) { | |
2302 pimpl->Load(str); | |
2303 } | |
2304 void Grp::SaveSys(std::string& str) { | |
2305 pimpl->SaveSys(str); | |
2306 } | |
2307 | |
2308 void Grp::LoadSys(const char* str) { | |
2309 pimpl->LoadSys(str); | |
2310 } |