Mercurial > otakunoraifu
annotate scn2k/scn2k_grp.cc @ 47:5f548e5957a8
* get rid of the "deprecated conversion from string constant to ‘char*’" warnings
author | thib |
---|---|
date | Wed, 15 Apr 2009 20:26:32 +0000 |
parents | 01aa5ddf7dc8 |
children | ed6c21dde840 |
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); | |
513 return ts; | |
514 } | |
515 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
|
516 if (print_moji.length() == 0 || print_size <= 2) return; |
0 | 517 if (pic_parent == 0) return; |
518 /* ¥Æ¥¥¹¥È¤ÎÂ礤µ¤òÆÀ¤ë */ | |
519 int r, g, b; | |
520 if (print_r == -1 || print_g == -1 || print_b == -1) {// ¿§ÀßÄê¤Ê¤· | |
521 r = g = b = 0; // ¤È¤ê¤¢¤¨¤º¹õ(clannad ¤ÎSave/Load¥á¥Ë¥å¡¼ÍÑ) | |
522 } else { | |
523 r = print_r; | |
524 g = print_g; | |
525 b = print_b; | |
526 } | |
527 TextStream ts = ParseMoji(print_moji.c_str(), r, g, b, print_size); | |
528 TextGlyphStream gs; | |
529 vector<int> lh; | |
530 // ¤È¤ê¤¢¤¨¤º drawable width ¤Ï½¼Ê¬¤ËÂ礤¯(2048)¼è¤ë | |
531 DefaultLayout(print_size-2)->Layout(ts, gs, lh, 2048); // print_size ¤½¤Î¤Þ¤Þ¤À¤È¼å´³Â礤¹¤®¤ë¤Î¤Ç -2 | |
532 int width = gs.width(); | |
533 int height = gs.height(); | |
534 Surface* surface = pic_parent->Root().NewSurface(width, height, ALPHA_MASK); | |
535 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0); | |
536 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0, 0, width, height), surface, Rect(0,0)); | |
537 picture->SetSurface(surface, 0, 0); | |
538 picture->SetSurfaceRect(Rect(0,0,width,height)); | |
539 picture->SetSurfaceFreeFlag(); | |
540 } | |
541 void GrpObj::UpdateDigit(void) { | |
542 // ²èÁüɽ¼¨¤Î¿ôÃÍʸ»úÎó¤òɽ¼¨¤¹¤ë | |
543 if (name.length() == 0) return; | |
544 // ¥Õ¥¡¥¤¥ë̾¤¬Â¸ºß¤¹¤ë¾ì¹ç¡¢¥Õ¥¡¥¤¥ë¤òÆɤ߹þ¤ß | |
545 string path(name); | |
546 path += ".g00"; | |
547 Surface* surface_orig = pic_parent->Root().NewSurface(path.c_str()); | |
548 if (surface_orig == 0) return; | |
549 | |
550 int width, height; | |
551 int i; | |
552 GetSrcGeom(width, height); | |
553 if (width <= 0 || height <= 0) return; | |
554 if (src_pos.size() < 14) { | |
555 // ɬÍפʿô¤Î object ¤¬¤Ê¤¤ | |
556 // ɽ¼¨¤Ç¤¤Ê¤¤Ê¬¤Î¶õ¤Î rect ¤òÄɲ䷤Ƥª¤¯ | |
557 for (i=src_pos.size(); i<14; i++) | |
558 src_pos.push_back(Rect(0,0,0,0)); | |
559 pic_parent->Root().DeleteSurface(surface_orig); | |
560 return; | |
561 } | |
562 // ·å¿ô¤Î·×»» | |
563 char num_str[20]; | |
564 if (dig_number < 0) sprintf(num_str, "%d", -dig_number); | |
565 else sprintf(num_str, "%d", dig_number); | |
566 int sign_count = 0; | |
567 int space_count = 0; | |
568 int total_count; | |
569 int dig_count = strlen(num_str); | |
570 if (dig_number < 0 && (attr&DIG_SIGN) == 0) dig_count++; | |
571 if (dig_count < dig_digit) space_count = dig_digit - dig_count; | |
572 if (attr & DIG_SIGN) sign_count = 1; | |
573 total_count = dig_count + space_count + sign_count; | |
574 | |
575 Surface* surface = pic_parent->Root().NewSurface(width*total_count, height, ALPHA_MASK); | |
576 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0); | |
577 | |
578 /* surface ¤Ë¥³¥Ô¡¼¤¹¤ë */ | |
579 int cur_x = 0; | |
580 if ( (attr & DIG_PACK) && !(attr & DIG_ZERO)) { // »Ï¤á¤Ë¶õÇò¤òÁÞÆþ | |
581 cur_x += space_count * width; | |
582 } | |
583 int plus = 10, minus = 11, plusminus = 12; | |
584 if (dig_number < 0) { | |
585 DSurfaceMove(surface, src_pos[minus], surface, Rect(cur_x,0)); | |
586 cur_x += width; | |
587 } else if (attr & DIG_SIGN) { | |
588 if (dig_number == 0) | |
589 DSurfaceMove(surface, src_pos[plusminus], surface, Rect(cur_x,0)); | |
590 else | |
591 DSurfaceMove(surface, src_pos[plus], surface, Rect(cur_x,0)); | |
592 cur_x += width; | |
593 } | |
594 if (attr & DIG_ZERO) { // ¥¼¥í¡¦¥Ñ¥Ç¥£¥ó¥° | |
595 for (i=0; i<space_count; i++) { | |
596 DSurfaceMove(surface, src_pos[0], surface, Rect(cur_x, 0)); | |
597 cur_x += width;; | |
598 } | |
599 } else if (!(attr & DIG_PACK)) { // PACK ¥ª¥×¥·¥ç¥ó¤Ê¤· | |
600 cur_x += space_count * width; | |
601 } | |
602 for (i=0; num_str[i] != 0; i++) { | |
603 DSurfaceMove(surface_orig, src_pos[num_str[i]-'0'], surface, Rect(cur_x, 0)); | |
604 cur_x += width; | |
605 } | |
606 | |
607 /* picture ¤ËÀßÄê */ | |
608 picture->SetSurface(surface, 0, 0); | |
609 picture->SetSurfaceRect(Rect(0,0,width*total_count,height)); | |
610 picture->SetSurfaceFreeFlag(); | |
611 | |
612 pic_parent->Root().DeleteSurface(surface_orig); | |
613 } | |
614 void GrpObj::CreateGan(Event::Container& event, int event_number) { | |
615 if (picture == 0) { | |
616 fprintf(stderr,"GrpObj::CreateGan() is called before Create()\n"); | |
617 return; | |
618 } | |
619 if (anm) { | |
620 anm->Abort(); | |
621 delete anm; | |
622 } | |
623 if (gan_name.empty()) return; | |
624 /* ¥¢¥Ë¡¼¥á¥·¥ç¥ó¾ðÊó (.GAN ¥Õ¥¡¥¤¥ë)¤òµá¤á¤ë */ | |
625 string path(gan_name); | |
626 path += ".gan"; | |
627 ARCINFO* info = file_searcher.Find(FILESEARCH::GAN, path.c_str(), "gan"); | |
628 if (info == 0) { | |
629 fprintf(stderr,"GrpObj::CreateGan: Cannot Find 'GAN' file %s\n", path.c_str()); | |
630 return; | |
631 } | |
632 const char* data = info->Read(); | |
633 if (read_little_endian_int(data) != 10000 || read_little_endian_int(data+4) != 10000) { | |
634 fprintf(stderr,"GrpObj::CreateGan: Invalid'GAN' file %s\n", path.c_str()); | |
635 delete info; | |
636 return; | |
637 } | |
638 | |
639 picture->SetSurfaceAttribute(PicBase::BLIT_SATURATE); | |
640 attr = Attribute(attr | UPDATE_POS | SATURATE); | |
641 | |
642 const char* buf = data + 16; | |
643 buf += strlen(buf) + 1; // ²èÁü¥Õ¥¡¥¤¥ë̾¤¬Æþ¤Ã¤Æ¤¤¤ë | |
644 buf += 4; // Äê¿ô 20000 | |
645 int pics = read_little_endian_int(buf); buf += 4; // Ê£¿ô¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó¾ðÊó¤¬Æþ¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢¾ðÊó¿ô | |
646 // °Ê²¼¡¢pics ²ó·«¤êÊÖ¤· | |
647 // ¥¢¥Ë¥á¡¼¥·¥ç¥ó¤ò¹Ô¤¦¼ÂÂΤòºîÀ® | |
648 AnmAlphaMove* wid = new AnmAlphaMove(event, picture); | |
649 | |
650 if (event_number && event_number < pics) { // Ê£¿ô¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó¾ðÊ󤬤¢¤ë¾ì¹ç¡¢Àè¤Î¾ðÊó¤òÆɤßÈô¤Ð¤¹ */ | |
651 int i; for (i=0; i<event_number; i++) { | |
652 buf += 4; // Äê¿ô 30000 | |
653 int ptns = read_little_endian_int(buf); buf += 4; | |
654 buf += ptns*52; | |
655 } | |
656 } | |
657 buf += 4; // Äê¿ô 30000 | |
658 int ptns = read_little_endian_int(buf); buf += 4; | |
659 int total_time = 0; | |
660 int i; | |
661 for (i=0; i<ptns; i++) { | |
662 int p = read_little_endian_int(buf+i*52+0*8+4); | |
663 int x = read_little_endian_int(buf+i*52+1*8+4); | |
664 int y = read_little_endian_int(buf+i*52+2*8+4); | |
665 int t = read_little_endian_int(buf+i*52+3*8+4); | |
666 int a = read_little_endian_int(buf+i*52+4*8+4); | |
667 x += PosX(); | |
668 y += PosY(); | |
669 if (p == -1) { a = 0; p = 0; } // p == -1 ¤Ê¤é¤Ê¤Ë¤âɽ¼¨¤·¤Ê¤¤ | |
670 if (p >= src_pos.size()) { | |
671 fprintf(stderr,"Reading GAN file %s (G00 %s) : not enough pictures in .G00 file\n", path.c_str(), name.c_str()); | |
672 a = 0; p = 0; | |
673 } | |
674 total_time += t; | |
675 wid->ptns.push_back(AnmAlphaMove::Ptn(Rect(x,y), src_pos[p], a, total_time)); | |
676 } | |
677 wid->SetPtn(); // ¥Ñ¥¿¡¼¥óÅÐÏ¿½ªÎ» | |
678 attr = Attribute(attr | ANM_PLAYSTART); | |
679 anm = wid; | |
680 }; | |
681 void GrpObj::CreateGanSpecial(Event::Container& event, int event_number, int time) { | |
682 if (picture == 0) { | |
683 fprintf(stderr,"GrpObj::CreateGan() is called before Create()\n"); | |
684 return; | |
685 } | |
686 if (anm) { | |
687 anm->Abort(); | |
688 delete anm; | |
689 } | |
690 | |
691 // ¥¢¥Ë¥á¡¼¥·¥ç¥ó¤ò¹Ô¤¦¼ÂÂΤòºîÀ® | |
692 AnmAlphaMove* wid = new AnmAlphaMove(event, picture); | |
693 | |
694 int i; | |
695 switch(event_number) { | |
696 case 0: // pattern ¤ò 0 ¤«¤éºÇ¸å¤Þ¤ÇÊѲ½¤µ¤»¤ë | |
697 for (i=0; i<src_pos.size(); i++) { | |
698 wid->ptns.push_back(AnmAlphaMove::Ptn(Rect(PosX(), PosY()), src_pos[i], 255, time*i)); | |
699 } | |
700 wid->SetPtn(); // ¥Ñ¥¿¡¼¥óÅÐÏ¿½ªÎ» | |
701 anm = wid; | |
702 attr = Attribute(attr | ANM_PLAYSTART); | |
703 break; | |
704 default: | |
705 break; | |
706 } | |
707 return; | |
708 }; | |
709 | |
710 void GrpObj::SetZoomRotate(int new_zoom, int new_rotate) { | |
711 if (zoom == new_zoom && rotate == new_rotate) return; | |
18 | 712 if ( zoom == -1 || new_zoom == -1) { |
713 attr = Attribute(attr | UPDATE_POS); // centering ¤¹¤ë | |
714 } | |
715 zoom = new_zoom; | |
0 | 716 if (new_rotate != -1) rotate = new_rotate; |
717 if (zoom < 0) zoom = 256; | |
718 if (rotate < 0) rotate = 0; | |
719 else if (rotate > 360) rotate %= 360; | |
720 | |
721 attr = Attribute(attr | UPDATE_PICTURE); | |
722 return; | |
723 } | |
724 /****************************************************************** | |
725 ** | |
726 ** class ScnGrp* | |
727 */ | |
728 /* Princess Bride: Çطʲè¤Î°ìÉô¤Î¤ß°ÜÆ°¡¢¤Î¼ÂÁõ */ | |
729 struct ScnGrpMove : public WidAnmTime { | |
730 Surface* dest; | |
731 Surface* src; | |
732 PicRoot& root; | |
733 Rect dest_r, from, to; | |
734 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); | |
735 void Exec(int count); | |
736 }; | |
737 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) : | |
738 WidAnmTime(container, _pic, total_time), | |
739 dest(_dest), src(_src), root(_root),dest_r(_dest_r), from(_from), to(_to) { | |
740 int dx = to.lx - from.lx; | |
741 int dy = to.ty - from.ty; | |
742 if (dx < 0) dx = -dx; | |
743 if (dy < 0) dy = -dy; | |
744 if (dx < dy) dx = dy; | |
745 if (dx == 0) dx = 1; | |
746 SetAllCount(dx); | |
747 } | |
748 void ScnGrpMove::Exec(int count) { | |
749 Rect r(0,0,dest_r.width(),dest_r.height()); | |
750 int dx = to.lx - from.lx; | |
751 int dy = to.ty - from.ty; | |
752 int x = dx*count/all_count + from.lx; | |
753 int y = dy*count/all_count + from.ty; | |
754 r.rmove(x, y); | |
755 root.BlitSurface(src, r, dest, dest_r); | |
756 iterator it; | |
757 for (it=pic.begin(); it!=pic.end(); it++) | |
758 (*it)->SetSurface(dest, 0, 0); | |
759 } | |
760 | |
761 /* Princess Bride: ¥«¡¼¥É¤¬¤ª¤Á¤ë¥¢¥Ë¥á¡¼¥·¥ç¥ó */ | |
762 | |
763 struct ScnGrpAnmAtom { | |
764 string name; | |
765 int time; | |
766 ScnGrpAnmAtom(const char* _n, int _t) : name(_n), time(_t) {} | |
767 }; | |
768 struct ScnGrpAnm : public WidAnmTime, vector<ScnGrpAnmAtom> { | |
769 GrpImpl& owner; | |
770 ScnGrpAnm(Event::Container& container, PicBase* _pic, GrpImpl& _owner) : | |
771 WidAnmTime(container, _pic, 0), owner(_owner) { | |
772 } | |
773 void CalcTotal(void); | |
774 void Exec(int count); | |
775 }; | |
776 void ScnGrpAnm::CalcTotal(void) { | |
777 /* total time ¤ò·×»» */ | |
778 if (empty()) return; | |
779 int tm = 0; | |
780 vector<ScnGrpAnmAtom>::iterator it; | |
781 for (it=begin(); it != end(); it++) tm += it->time; | |
782 total_time = tm; | |
783 SetAllCount(tm); | |
784 } | |
785 void ScnGrpAnm::Exec(int count) { | |
786 int tm = 0; vector<ScnGrpAnmAtom>::iterator it; | |
787 for (it=begin(); it != end(); it++) { | |
788 tm += it->time; | |
789 if (count < tm) break; | |
790 } | |
791 if (it == end()) it--; | |
792 owner.LoadSurface(it->name.c_str(), 0); | |
793 } | |
794 | |
795 | |
796 /***************************************************** | |
797 * | |
798 * GrpImpl(implementation) : ÄêµÁ | |
799 * | |
800 */ | |
801 | |
802 #include"music2/music.h" | |
803 | |
804 GrpImpl::GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm_data, class MuSys& _mu, AyuSysConfig& _config) : | |
805 event(_event), | |
806 flags(f), | |
807 parent(_parent), | |
808 status(NORMAL), | |
809 skip_mode(SKIP_NO), | |
810 music(_mu), | |
811 cgm_data(_cgm_data), | |
812 grpobj(this), | |
813 bs_obj(this), | |
814 config(_config) | |
815 { | |
816 int i; | |
817 for (i=0; i<MAXPDT; i++) { | |
818 ssurface[i] = 0; | |
819 dsurface[i] = 0; | |
820 } | |
821 screen = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | |
822 screen_front = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | |
823 surface = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); | |
824 surface_update = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); | |
825 DSurfaceFill(surface, Rect(*surface), 0, 0, 0); | |
826 DSurfaceFill(surface_update, Rect(*surface), 0, 0, 0); | |
827 screen->SetSurface(surface, 0, 0); | |
828 screen->show(); | |
829 screen_front->hide(); | |
830 screen_front->ZMove(screen); | |
831 | |
832 LoadCgm(config); | |
833 | |
834 anm1 = 0; anm2 = 0; | |
835 } | |
836 | |
837 GrpImpl::~GrpImpl() { | |
838 | |
839 map<int,GrpObj>::iterator it; | |
840 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | |
841 PicBase* p = it->second.DeletePic(); | |
842 delete p; | |
843 } | |
844 | |
845 delete screen; | |
846 delete screen_front; | |
847 parent.Root().DeleteSurface(surface); | |
848 int i; | |
849 for (i=0; i<MAXPDT; i++) { | |
850 if (ssurface[i]) parent.Root().DeleteSurface(ssurface[i]); | |
851 if (dsurface[i]) parent.Root().DeleteSurface(dsurface[i]); | |
852 } | |
853 } | |
854 | |
855 Surface* GrpImpl::Dsurface(int pdt) { | |
856 if (pdt == 0) return surface; | |
857 if (dsurface[pdt] == 0) { // ¤È¤ê¤¢¤¨¤º²èÌ̤ÎÂ礤µ¤È¤¤¤¦¤³¤È¤Ë¤¹¤ë | |
858 if (pdt == WORKPDT) | |
859 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), ALPHA_MASK); | |
860 else | |
861 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); | |
862 } | |
863 if (ssurface[pdt]) { // ssurface ¤¬Â¸ºß¤¹¤ì¤Ð¡¢dsurface ¤Ë¥³¥Ô¡¼¤·¤ÆÊÖ¤¹ | |
864 DSurfaceMove(ssurface[pdt], Rect(*ssurface[pdt]), dsurface[pdt], Rect(0,0)); | |
865 parent.Root().DeleteSurface(ssurface[pdt]); | |
866 ssurface[pdt] = 0; | |
867 } | |
868 return dsurface[pdt]; | |
869 } | |
870 #include<SDL.h> | |
871 Surface* GrpImpl::Ssurface(int pdt) { | |
872 if (pdt == 0) return surface; | |
873 if (ssurface[pdt]) { | |
874 return ssurface[pdt]; | |
875 } | |
876 return Dsurface(pdt); | |
877 } | |
878 | |
879 void GrpImpl::LoadSurface(const char* str, int pdt) { | |
880 string s = str; | |
881 if (cgm_info.find(s) != cgm_info.end()) { | |
882 cgm_data.insert(cgm_info[s]); | |
883 } | |
884 Surface* bg = parent.Root().NewSurface(s.c_str()); | |
885 if (bg == 0) { | |
886 s += ".g00"; | |
887 bg = parent.Root().NewSurface(s.c_str()); | |
888 } | |
889 if (bg) { | |
890 if (ssurface[pdt]) parent.Root().DeleteSurface(ssurface[pdt]); | |
891 ssurface[pdt] = bg; | |
892 if (pdt == 0) { | |
893 /* ¤È¤ê¤¢¤¨¤º Princess Bride ¤Î¥¢¥Ë¥á¡¼¥·¥ç¥ó¸ú²ÌÀìÍÑ */ | |
894 Rect r(*ssurface[0]); | |
895 Rect dr(*surface); | |
896 int x = (dr.width()-r.width())/2; | |
897 int y = (dr.height()-r.height())/2; | |
898 DSurfaceMove(ssurface[0], r, surface, Rect(x,y)); | |
899 parent.Root().DeleteSurface(ssurface[0]); | |
900 ssurface[0] = 0; | |
901 screen->SetSurface(surface, 0, 0); | |
902 } | |
903 } else { | |
904 if (str[0] != 0) | |
905 fprintf(stderr,"Cannot find surface %d <- '%s'\n",pdt,str); | |
906 } | |
907 return; | |
908 } | |
909 void GrpImpl::InitSel(AyuSysConfig& config) { | |
910 int i; int args[16]; char key[1024]; | |
911 for (i=0; i<999; i++) { | |
912 sprintf(key, "#SEL.%03d",i); | |
913 if (config.GetParam(key, 15, &args[0], &args[1], | |
914 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], | |
915 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13], | |
916 &args[14])) { | |
917 | |
918 sprintf(key, "#SELR.%03d", i); | |
919 if (config.GetParam(key, 16, &args[0], &args[1], | |
920 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], | |
921 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13], | |
922 &args[14], &args[15])) continue; | |
923 } | |
924 SEL& s = anmtype[i]; | |
925 s.from = Rect(args[0], args[1], args[2]+1, args[3]+1); | |
926 s.to = Rect(args[4], args[5]); | |
927 s.time = args[6]; | |
928 s.sel_no = args[7]; | |
929 int j; for (j=0; j<8; j++) s.args[j] = args[8+j]; | |
930 } | |
931 return; | |
932 } | |
933 void GrpImpl::SetSkipMode(SkipMode _mode) { | |
934 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) { | |
935 RefreshObj(); | |
936 } else if ( (skip_mode & SKIP_IN_MENU) == 0 && (_mode & SKIP_IN_MENU) ) { | |
937 } | |
938 skip_mode = _mode; | |
939 } | |
940 void GrpImpl::SetObjChanged(int num) { | |
941 changed_obj.insert(num); | |
942 } | |
943 void GrpImpl::SetObjChangedGroup(int num) { | |
944 if (num % 1000 != 0) { | |
945 SetObjChanged(num); | |
946 return; | |
947 } | |
948 std::map<int, GrpObj>::iterator begin,end,it; | |
949 begin = grpobj.lower_bound(num); | |
950 end = grpobj.lower_bound(num+1000); | |
951 for (it=begin;it!=end;it++) { | |
952 changed_obj.insert(it->first); | |
953 } | |
954 } | |
955 void GrpImpl::RefreshObj(void) { | |
956 if (!deleted_pic.empty()) { | |
957 vector<PicBase*>::iterator it; | |
958 for (it=deleted_pic.begin(); it!=deleted_pic.end(); it++) { | |
959 if (*it) delete *it; | |
960 } | |
961 deleted_pic.clear(); | |
962 } | |
963 if (!changed_obj.empty()) { | |
964 set<int>::iterator it; | |
965 for (it=changed_obj.begin(); it != changed_obj.end(); it++) { | |
966 if (grpobj.find(*it) == grpobj.end()) continue; | |
967 GrpObj& obj = grpobj[*it]; | |
968 GrpObj& parent_obj = grpobj[ ((*it)/1000) * 1000]; | |
969 if (obj.picture == 0) continue; | |
970 if (obj.alpha == 0 || (obj.attr & GrpObj::HIDDEN) || (parent_obj.attr & GrpObj::HIDDEN_GROUP) ) { | |
971 if (obj.attr & GrpObj::ANM_PLAYING) { | |
972 obj.attr = GrpObj::Attribute(obj.attr & ~(GrpObj::ANM_PLAYING)); | |
973 if (obj.anm) obj.anm->Abort(); | |
974 } | |
975 obj.picture->hide(); | |
976 } else { | |
977 obj.Update(); | |
978 obj.picture->show(); | |
979 } | |
980 } | |
981 changed_obj.clear(); | |
982 } | |
983 if (reserved_load_surface0.length() != 0) { | |
984 LoadSurface(reserved_load_surface0.c_str(), 0); | |
985 reserved_load_surface0 = ""; | |
986 } | |
987 screen->ReBlit(); | |
988 } | |
989 | |
990 | |
991 #include<SDL.h> | |
992 void GrpImpl::StartAnm(int type) { | |
993 SEL sel; | |
994 | |
995 if (anmtype.find(type) == anmtype.end()) { | |
996 if (anmtype.find(0) == anmtype.end()) { | |
997 sel.sel_no = 1; | |
998 sel.from = Rect(*surface); | |
999 sel.to = Rect(0,0); | |
1000 sel.time = 0; | |
1001 } else { | |
1002 sel = anmtype[0]; | |
1003 } | |
1004 } else { | |
1005 sel = anmtype[type]; | |
1006 } | |
1007 if (anm1) { | |
1008 fprintf(stderr,"Warning: StartAnm() called before anm1 finished\n"); | |
1009 anm1->Abort(); | |
1010 delete anm1; | |
1011 anm1 = 0; | |
1012 } | |
1013 map<int,GrpObj>::iterator it; | |
1014 // ¸½ºßɽ¼¨Ãæ¤Îobject¤ò¾Ãµî | |
1015 deleted_pic.push_back(screen); | |
1016 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | |
1017 if (! (it->second.attr & GrpObj::WIPEON)) { // ²èÁüÀÚ¤êÂؤ¨»þ¤Ë object ºï½ü | |
1018 deleted_pic.push_back(it->second.DeletePic()); | |
1019 } else { | |
1020 GrpObj& new_obj = bs_obj[it->first]; | |
1021 if (new_obj.name.empty()) { // ¿·¤·¤¤ object ¤¬Â¸ºß¤·¤Ê¤±¤ì¤ÐÆâÍƤò°ú¤·Ñ¤° | |
1022 new_obj = it->second; | |
1023 it->second.DeletePic(); | |
1024 } else { | |
1025 new_obj.attr = GrpObj::Attribute(new_obj.attr | GrpObj::WIPEON); | |
1026 deleted_pic.push_back(it->second.DeletePic()); | |
1027 } | |
1028 } | |
1029 } | |
1030 grpobj.clear(); // Á´¥ª¥Ö¥¸¥§¥¯¥Èºï½ü | |
1031 | |
1032 // Á´²èÁü¥ª¥Ö¥¸¥§¥¯¥È¤ÎÁ°¤Ëscreen °ÜÆ° | |
1033 // ¿·¤·¤¤ screen_front ¤òºîÀ®¤·¤Æ¤ª¤¯ | |
1034 screen = screen_front; | |
1035 screen->hide(); | |
1036 screen->SetSurface(surface_update, 0, 0); | |
1037 parent.Root().BlitSurface(Dsurface(1), Rect(*surface_update), surface_update, Rect(0,0)); | |
1038 | |
1039 screen_front = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | |
1040 screen_front->hide(); | |
1041 screen_front->ZMove(screen); | |
1042 | |
1043 // ¿·¤·¤¤ object ¤Ø¹¹¿·¡¢surface_update ¤Ø¿·¤·¤¤ object ¤òɽ¼¨ | |
1044 // (object ºîÀ®»þ¤Ï picture ¤Ï hide ¤µ¤ì¤Æ¤¤¤ë) | |
1045 for (it=bs_obj.begin(); it!=bs_obj.end(); it++) { | |
1046 grpobj[it->first] = it->second; | |
1047 it->second.DeletePic(); | |
1048 CreateObj(it->first); | |
1049 GrpObj& g = grpobj[it->first]; | |
1050 GrpObj& parent_obj = grpobj[ (it->first/1000) * 1000]; | |
1051 if (g.picture) { | |
1052 g.Update(); | |
1053 if (g.alpha == 0 || (g.attr & GrpObj::HIDDEN) || (parent_obj.attr & GrpObj::HIDDEN_GROUP) ) ; | |
1054 else g.picture->SimpleBlit(surface_update); | |
1055 g.picture->hide(); | |
1056 } | |
1057 } | |
1058 bs_obj.clear(); | |
1059 // ²èÁü¸ú²Ì³«»Ï | |
1060 switch(sel.sel_no) { | |
1061 default: | |
1062 case 0: case 50: // 0 ¤È 50 ¤Î°ã¤¤¤¬Îɤ¯¤ï¤«¤é¤Ê¤¤ | |
1063 if (skip_mode & SKIP_GRP_NOEFFEC) | |
1064 anm1 = new WidAnmAlpha(event, screen, ALPHA_MAX, ALPHA_MAX, 0); | |
1065 else if (skip_mode & SKIP_GRP_FAST) | |
1066 anm1 = new WidAnmAlpha(event, screen, 0, ALPHA_MAX, sel.time/4); | |
1067 else | |
1068 anm1 = new WidAnmAlpha(event, screen, 0, ALPHA_MAX, sel.time); | |
1069 break; | |
1070 } | |
1071 if (anm1) anm1->Play(); | |
1072 if (skip_mode & SKIP_GRP_NOEFFEC) AbortAnm(); | |
1073 } | |
1074 void GrpImpl::StartShake(int total, const int* pattern) { | |
1075 if (anm2) { | |
1076 fprintf(stderr,"Warning: StartShake() called before another animation finished\n"); | |
1077 anm2->Abort(); | |
1078 delete anm2; | |
1079 anm2 = 0; | |
1080 } | |
1081 if (skip_mode & SKIP_GRP_NOEFFEC) return; | |
1082 AnmAlphaMove* new_anm = new AnmAlphaMove(event, &parent); // shake screen ¤Ç¤Ï¸µ²èÌ̤κÂɸ¤òÍɤ餹 | |
1083 int i; int tm = 0; | |
1084 for (i=0; i<total; i+=3) { | |
1085 int x = pattern[i]; | |
1086 int y = pattern[i+1]; | |
1087 new_anm->ptns.push_back(AnmAlphaMove::Ptn(Rect(x,y), Rect(0,0), 255, tm)); | |
1088 tm += pattern[i+2]; | |
1089 } | |
1090 new_anm->ptns.push_back(AnmAlphaMove::Ptn(Rect(0,0), Rect(0,0), 255, tm)); | |
1091 new_anm->SetPtn(); // ¥Ñ¥¿¡¼¥óÅÐÏ¿½ªÎ» | |
1092 new_anm->Play(); | |
1093 anm2 = new_anm; | |
1094 } | |
1095 void GrpImpl::AbortAnm(void) { | |
1096 if (anm1 == 0) return; | |
1097 anm1->Abort(); | |
1098 delete anm1; | |
1099 anm1 = 0; | |
1100 /* ²èÁü¸ú²Ì½ªÎ» */ | |
1101 /* ¸Å¤¤²èÌ̤ؤβèÁü¸ú²Ì¤¬¤¢¤ì¤Ð¾Ãµî */ | |
1102 if (anm2 && anm2->pic[0] != screen) { | |
1103 anm2->Abort(); | |
1104 delete anm2; | |
1105 anm2 = 0; | |
1106 } | |
1107 /* pdt1 -> pdt0 ¤Ø¥³¥Ô¡¼ */ | |
1108 DSurfaceMove(dsurface[1], Rect(*dsurface[1]), surface, Rect(0,0)); | |
1109 screen->SetSurface(surface, 0, 0); | |
1110 // ²èÁü¸ú²Ì³«»Ï»þ¤Ë¸ºß¤·¤¿object¤ò¾Ãµî | |
1111 // ¿·¤·¤¤ object ɽ¼¨ | |
1112 RefreshObj(); | |
1113 return; | |
1114 } | |
1115 void GrpImpl::LoadSurface(const char* str) { | |
1116 if (anm1) AbortAnm(); // Á°¤ÎÉÁ²è¤¬½ª¤ï¤Ã¤Æ¤Ê¤±¤ì¤Ð¶¯À©½ªÎ» | |
1117 LoadSurface(str, 1); | |
1118 bg_name = str; | |
1119 } | |
1120 void GrpImpl::LoadSurface(void) { | |
1121 if (anm1) AbortAnm(); // Á°¤ÎÉÁ²è¤¬½ª¤ï¤Ã¤Æ¤Ê¤±¤ì¤Ð¶¯À©½ªÎ» | |
1122 LoadSurface(bg_name.c_str(), 1); | |
1123 } | |
1124 void GrpImpl::AddSurface(const char* str) { | |
1125 if (anm1) AbortAnm(); // Á°¤ÎÉÁ²è¤¬½ª¤ï¤Ã¤Æ¤Ê¤±¤ì¤Ð¶¯À©½ªÎ» | |
1126 LoadSurface(bg_name.c_str()); | |
1127 | |
1128 string s = str; | |
1129 Surface* front = parent.Root().NewSurface(s.c_str()); | |
1130 if (front == 0) { | |
1131 s += ".g00"; | |
1132 front = parent.Root().NewSurface(s.c_str()); | |
1133 } | |
1134 if (front) { | |
1135 parent.Root().BlitSurface(front, Rect(*front), Dsurface(1), Rect(0,0)); | |
1136 parent.Root().DeleteSurface(front); | |
1137 } else { | |
1138 fprintf(stderr,"Cannot find surface %s\n",str); | |
1139 } | |
1140 } | |
1141 | |
1142 void GrpImpl::CreateObj(int index) { | |
1143 std::map<int, GrpObj>::iterator cur = grpobj.find(index); | |
1144 if (cur == grpobj.end()) return; | |
1145 GrpObj& g = grpobj[index]; | |
1146 g.CreateSurface(&parent); | |
1147 g.order = index; | |
1148 if (g.picture == 0) return; // ¥¨¥é¡¼¡§surface ¤¬Â¸ºß¤·¤Ê¤¤ | |
1149 g.picture->hide(); | |
1150 SetObjChanged(index); | |
1151 ZMoveObj(index); | |
1152 return; | |
1153 } | |
1154 void GrpImpl::ZMoveObj(int index) { | |
1155 std::map<int, GrpObj>::iterator cur = grpobj.find(index); | |
1156 if (cur == grpobj.end()) return; | |
1157 GrpObj& g = grpobj[index]; | |
1158 if (g.picture == 0) return; | |
1159 // ¼«Ê¬¤è¤êÁ°¤Ë object ¤¬¤¢¤ì¤Ð¡¢¤½¤ÎÁ°¤Ëɽ¼¨ | |
1160 // ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð screen ¤ÎÁ°¤Ëɽ¼¨ | |
1161 std::map<int, GrpObj>::iterator cur_backobj = grpobj.end(); | |
1162 std::map<int, GrpObj>::iterator it; | |
1163 for (it = grpobj.begin(); it != grpobj.end(); it++) { | |
1164 if (it == cur) continue; | |
1165 if (it->second.picture == 0) continue; | |
1166 if (it->second.order < g.order) { | |
1167 if (cur_backobj == grpobj.end()) { | |
1168 cur_backobj = it; | |
1169 } else if (cur_backobj->second.order < it->second.order) { | |
1170 cur_backobj = it; | |
1171 } | |
1172 } | |
1173 } | |
1174 if (cur_backobj == grpobj.end()) { | |
1175 g.picture->ZMove(screen); | |
1176 } else { | |
1177 g.picture->ZMove(cur_backobj->second.picture); | |
1178 } | |
1179 return; | |
1180 } | |
1181 void GrpImpl::SwapObj(int index1, int index2) { | |
1182 // ¥Ç¥Õ¥©¥ë¥ÈÃͤ«¤é order ¤¬Êѹ¹¤µ¤ì¤Æ¤¤¤¿¾ì¹ç¤Î¤ß¡¢order ¤ÏÊݸ¤µ¤ì¤ë | |
1183 // ¤Þ¤º¤ÏξÊý¤Îobject¤òswap | |
1184 if (grpobj.find(index1) == grpobj.end()) { | |
1185 if (grpobj.find(index2) == grpobj.end()) return; // ¤É¤Á¤é¤Î object ¤â¸ºß¤·¤Ê¤¤ | |
1186 grpobj[index1] = grpobj[index2]; | |
1187 if (grpobj[index1].order == index2) | |
1188 grpobj[index1].order = index1; | |
1189 grpobj[index2].DeletePic(); | |
1190 grpobj.erase(index2); | |
1191 ZMoveObj(index1); | |
1192 return; | |
1193 } else if (grpobj.find(index2) == grpobj.end()) { // index2 ¤¬Â¸ºß¤·¤Ê¤¤¾ì¹ç | |
1194 grpobj[index2] = grpobj[index1]; | |
1195 if (grpobj[index2].order == index1) | |
1196 grpobj[index2].order = index2; | |
1197 grpobj[index1].DeletePic(); | |
1198 grpobj.erase(index1); | |
1199 ZMoveObj(index2); | |
1200 return; | |
1201 } else { | |
1202 GrpObj obj = grpobj[index1]; | |
1203 grpobj[index1] = grpobj[index2]; | |
1204 grpobj[index2].DeletePic(); | |
1205 if (grpobj[index1].order == index2) | |
1206 grpobj[index1].order = index1; | |
1207 ZMoveObj(index1); | |
1208 grpobj[index2] = obj; | |
1209 if (grpobj[index2].order == index1) | |
1210 grpobj[index2].order = index2; | |
1211 ZMoveObj(index2); | |
1212 obj.DeletePic(); | |
1213 } | |
1214 } | |
1215 | |
1216 bool GrpImpl::Pressed(int x, int y, void* pointer) { // ¥Þ¥¦¥¹¥¯¥ê¥Ã¥¯¤Ç¥¥ã¥ó¥»¥ë | |
1217 GrpImpl* g = (GrpImpl*)pointer; | |
1218 if (g->status == WAIT_MOVIE) | |
1219 g->music.StopMovie(); | |
1220 if (g->status == WAIT_ANM) | |
1221 g->AbortAnm(); | |
1222 if (g->status == WAIT_SHAKE && g->anm2 != 0) { | |
18 | 1223 g->anm2->Abort(); |
0 | 1224 delete g->anm2; |
1225 g->anm2 = 0; | |
1226 } | |
1227 return false; // event deleted | |
1228 } | |
1229 | |
1230 /* mode.cgm ¤Î decode ÍÑ */ | |
1231 static unsigned char decode_char[256] = { | |
1232 0x8b, 0xe5, 0x5d, 0xc3, 0xa1, 0xe0, 0x30, 0x44, | |
1233 0x00, 0x85, 0xc0, 0x74, 0x09, 0x5f, 0x5e, 0x33, | |
1234 0xc0, 0x5b, 0x8b, 0xe5, 0x5d, 0xc3, 0x8b, 0x45, | |
1235 0x0c, 0x85, 0xc0, 0x75, 0x14, 0x8b, 0x55, 0xec, | |
1236 0x83, 0xc2, 0x20, 0x52, 0x6a, 0x00, 0xe8, 0xf5, | |
1237 0x28, 0x01, 0x00, 0x83, 0xc4, 0x08, 0x89, 0x45, | |
1238 0x0c, 0x8b, 0x45, 0xe4, 0x6a, 0x00, 0x6a, 0x00, | |
1239 0x50, 0x53, 0xff, 0x15, 0x34, 0xb1, 0x43, 0x00, | |
1240 0x8b, 0x45, 0x10, 0x85, 0xc0, 0x74, 0x05, 0x8b, | |
1241 0x4d, 0xec, 0x89, 0x08, 0x8a, 0x45, 0xf0, 0x84, | |
1242 0xc0, 0x75, 0x78, 0xa1, 0xe0, 0x30, 0x44, 0x00, | |
1243 0x8b, 0x7d, 0xe8, 0x8b, 0x75, 0x0c, 0x85, 0xc0, | |
1244 0x75, 0x44, 0x8b, 0x1d, 0xd0, 0xb0, 0x43, 0x00, | |
1245 0x85, 0xff, 0x76, 0x37, 0x81, 0xff, 0x00, 0x00, | |
1246 0x04, 0x00, 0x6a, 0x00, 0x76, 0x43, 0x8b, 0x45, | |
1247 0xf8, 0x8d, 0x55, 0xfc, 0x52, 0x68, 0x00, 0x00, | |
1248 0x04, 0x00, 0x56, 0x50, 0xff, 0x15, 0x2c, 0xb1, | |
1249 0x43, 0x00, 0x6a, 0x05, 0xff, 0xd3, 0xa1, 0xe0, | |
1250 0x30, 0x44, 0x00, 0x81, 0xef, 0x00, 0x00, 0x04, | |
1251 0x00, 0x81, 0xc6, 0x00, 0x00, 0x04, 0x00, 0x85, | |
1252 0xc0, 0x74, 0xc5, 0x8b, 0x5d, 0xf8, 0x53, 0xe8, | |
1253 0xf4, 0xfb, 0xff, 0xff, 0x8b, 0x45, 0x0c, 0x83, | |
1254 0xc4, 0x04, 0x5f, 0x5e, 0x5b, 0x8b, 0xe5, 0x5d, | |
1255 0xc3, 0x8b, 0x55, 0xf8, 0x8d, 0x4d, 0xfc, 0x51, | |
1256 0x57, 0x56, 0x52, 0xff, 0x15, 0x2c, 0xb1, 0x43, | |
1257 0x00, 0xeb, 0xd8, 0x8b, 0x45, 0xe8, 0x83, 0xc0, | |
1258 0x20, 0x50, 0x6a, 0x00, 0xe8, 0x47, 0x28, 0x01, | |
1259 0x00, 0x8b, 0x7d, 0xe8, 0x89, 0x45, 0xf4, 0x8b, | |
1260 0xf0, 0xa1, 0xe0, 0x30, 0x44, 0x00, 0x83, 0xc4, | |
1261 0x08, 0x85, 0xc0, 0x75, 0x56, 0x8b, 0x1d, 0xd0, | |
1262 0xb0, 0x43, 0x00, 0x85, 0xff, 0x76, 0x49, 0x81, | |
1263 0xff, 0x00, 0x00, 0x04, 0x00, 0x6a, 0x00, 0x76 | |
1264 }; | |
1265 | |
1266 void GrpImpl::LoadCgm(AyuSysConfig& config) { | |
1267 /* cgm ¥Õ¥¡¥¤¥ëÆɤ߹þ¤ß */ | |
1268 const char* fname = config.GetParaStr("#CGTABLE_FILE"); | |
1269 if (fname == 0) return; | |
1270 ARCINFO* info = file_searcher.Find(FILESEARCH::ALL, fname, ""); | |
1271 if (info == 0) return; | |
1272 char* data = info->CopyRead(); | |
1273 int sz = info->Size(); | |
1274 delete info; | |
1275 | |
1276 | |
8 | 1277 if ( strncmp(data, "CGTABLE", 7) != 0) { |
1278 delete[] data; | |
1279 return; | |
1280 } | |
20
824b89018ea8
* CG completion percentage (maybe not working properly?)
thib
parents:
18
diff
changeset
|
1281 cgm_size = read_little_endian_int(data+0x10); |
0 | 1282 |
1283 int i,j; | |
1284 // xor ²ò½ü | |
1285 for (i=0;i<sz-0x20; i++) { | |
1286 data[i+0x20]^=decode_char[i&0xff]; | |
1287 } | |
1288 // Ÿ³« | |
1289 int dest_size = cgm_size * 36; | |
1290 char* dest = new char[dest_size+1024]; | |
1291 char* src = data + 0x28; | |
1292 char* dest_orig = dest; | |
1293 ARCINFO::Extract2k(dest,src,dest+dest_size,data+sz); | |
1294 dest = dest_orig; | |
1295 for (i=0; i<cgm_size; i++) { | |
1296 char* s = dest + i * 36; | |
1297 int n = read_little_endian_int(dest + i * 36 + 32); | |
1298 cgm_info[s] = n; | |
1299 } | |
8 | 1300 delete[] data; |
0 | 1301 delete[] dest_orig; |
1302 } | |
1303 | |
1304 /***************************************************** | |
1305 * | |
1306 * GrpImpl :: Save, Load : ¥»¡¼¥Ö¥Õ¥¡¥¤¥ë½èÍý | |
1307 * | |
1308 */ | |
1309 void GrpImpl::Save(std::string& str) { | |
1310 } | |
1311 void GrpImpl::Load(const char* str) { | |
1312 status = NORMAL; | |
1313 if (anm1) { | |
1314 AbortAnm(); | |
1315 } | |
1316 if (anm2) { | |
1317 anm2->Abort(); | |
1318 delete anm2; | |
1319 anm2 = 0; | |
1320 } | |
1321 map<int,GrpObj>::iterator it; | |
1322 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | |
1323 PicBase* p = it->second.DeletePic(); | |
1324 delete p; | |
1325 } | |
1326 grpobj.clear(); | |
1327 | |
1328 bg_name = ""; | |
1329 music.StopCDROM(100); | |
1330 } | |
1331 void GrpImpl::SaveSys(string& save) { | |
1332 char buf[1024]; | |
1333 save = "\n[Graphics]\n"; | |
1334 save += "CGM_CG="; | |
1335 | |
1336 set<int>::iterator it; | |
1337 for (it=cgm_data.begin(); it != cgm_data.end(); it++) { | |
1338 sprintf(buf,"%d,",*it); | |
1339 save += buf; | |
1340 } | |
1341 save += "\n"; | |
1342 } | |
1343 void GrpImpl::LoadSys(const char* save) { | |
1344 cgm_data.clear(); | |
1345 save = strstr(save, "\n[Graphics]\n"); | |
1346 | |
1347 if (save) { | |
1348 save += strlen("\n[Graphics]\n"); | |
1349 do { | |
1350 if (save[0] == '[') break; // next section | |
1351 if (strncmp(save, "CGM_CG=",7) == 0) { | |
1352 save += 7; | |
1353 while(isdigit(*save)) { | |
1354 int n = atoi(save); | |
1355 cgm_data.insert(n); | |
1356 save = strchr(save, ','); | |
1357 if (save) save++; | |
1358 } | |
1359 } | |
1360 save = strchr(save, '\n'); | |
1361 if (save) save++; | |
1362 } while (save); | |
1363 } | |
1364 return; | |
1365 } | |
1366 | |
1367 | |
1368 /***************************************************** | |
1369 * | |
1370 * GrpImpl :: Wait , Exec : ¥³¥Þ¥ó¥É¼Â¹ÔÉô | |
1371 * | |
1372 */ | |
1373 static vector<int> drawn_images; | |
1374 static int draw_n = 0; | |
1375 extern bool grpdump_req; | |
1376 bool GrpImpl::Wait(unsigned int current_time, Cmd& cmd) { | |
1377 if (grpdump_req) { | |
1378 grpdump_req = 0; | |
1379 std::map<int,GrpObj>::iterator it; | |
1380 fprintf(stderr,"front %08x(%d) / %08x(%d)\n",screen,screen->IsHidden(),screen_front,screen_front->IsHidden()); | |
1381 for (it=grpobj.begin(); it != grpobj.end(); it++) { | |
1382 GrpObj& obj = it->second; | |
1383 GrpObj& parent_obj = grpobj[ ((it->first)/1000) * 1000]; | |
1384 if (obj.picture) { | |
1385 if (!obj.name.empty()) { | |
1386 fprintf(stderr,"obj %06d(%08x): name %10s pos %d,%d alpha %d (%d/%d/%d)\n", | |
1387 it->first,obj.picture,obj.name.c_str(), | |
1388 obj.PosX(),obj.PosY(),obj.alpha,obj.attr&GrpObj::HIDDEN ? 1 : 0,parent_obj.attr&GrpObj::HIDDEN_GROUP ? 1 : 0,obj.picture->IsHidden()); | |
1389 } else if (!obj.print_moji.empty()) { | |
1390 fprintf(stderr,"obj %06d(%08x): name %10s pos %d,%d alpha %d (%d/%d/%d)\n", | |
1391 it->first,obj.picture,obj.print_moji.c_str(), | |
1392 obj.PosX(),obj.PosY(),obj.alpha,obj.attr&GrpObj::HIDDEN ? 1 : 0,parent_obj.attr&GrpObj::HIDDEN_GROUP ? 1 : 0,obj.picture->IsHidden()); | |
1393 } else { | |
1394 fprintf(stderr,"obj %06d(%08x): name %10s pos %d,%d alpha %d (%d/%d/%d)\n", | |
1395 it->first,obj.picture,"<EMPTY>", | |
1396 obj.PosX(),obj.PosY(),obj.alpha,obj.attr&GrpObj::HIDDEN ? 1 : 0,parent_obj.attr&GrpObj::HIDDEN_GROUP ? 1 : 0,obj.picture->IsHidden()); | |
1397 } | |
1398 } | |
1399 } | |
1400 std::list<PicBase*>::iterator it2; | |
1401 for (it2=parent.children.begin(); it2!=parent.children.end();it2++) { | |
1402 fprintf(stderr,"%08x(%d)\n",*it2,(*it2)->IsHidden()); | |
1403 } | |
1404 RefreshObj(); | |
1405 | |
1406 } | |
1407 #if 0 | |
1408 if (event.presscount(MOUSE_UP)) { | |
1409 std::list<PicBase*>::iterator lit; | |
1410 draw_n++; int i=0; | |
1411 for (lit=parent.children.end(); lit!=parent.children.begin(); ) { | |
1412 lit--; | |
1413 (*lit)->hide(); | |
1414 i++; | |
1415 if (i >= draw_n) break; | |
1416 } | |
1417 if (drawn_images.empty()) { | |
1418 map<int, GrpObj>::iterator it; | |
1419 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | |
1420 if (it->second.picture) { | |
1421 drawn_images.push_back(it->first); | |
1422 PicBase* p = it->second.DeletePic(); | |
1423 delete p; | |
1424 } | |
1425 } | |
1426 } else { | |
1427 vector<int>::iterator it; | |
1428 for (it=drawn_images.begin(); it!=drawn_images.end(); it++) { | |
1429 CreateObj(*it); | |
1430 } | |
1431 drawn_images.clear(); | |
1432 } | |
1433 } | |
1434 #endif | |
1435 if (status == WAIT_ANM) { | |
1436 if (anm1) { | |
1437 if (!anm1->IsEnd()) return true; | |
1438 AbortAnm(); | |
1439 } | |
1440 } else if (status == WAIT_SHAKE) { | |
1441 if (anm2) { | |
1442 if (!anm2->IsEnd()) return true; | |
1443 delete anm2; | |
1444 anm2 = 0; | |
1445 } | |
1446 status = NORMAL; | |
1447 } else if (status == WAIT_SE) { | |
1448 if (music.IsStopSE()) status = NORMAL; | |
1449 return true; | |
1450 } else if (status == WAIT_MOVIE) { | |
1451 if (music.IsStopMovie()) { | |
1452 music.StopMovie(); | |
1453 status = NORMAL; | |
1454 screen->ReBlit(); | |
1455 } | |
1456 return true; | |
1457 } | |
1458 if (anm2) { | |
1459 if (anm2->IsEnd()) { | |
1460 delete anm2; | |
1461 anm2 = 0; | |
1462 } | |
1463 } | |
1464 return false; | |
1465 } | |
1466 | |
1467 void GrpImpl::DeleteObjPic(int num) { // object ¤Î surface ¤Î¤ßºï½ü | |
1468 if (grpobj.find(num) == grpobj.end()) return; | |
1469 deleted_pic.push_back(grpobj[num].DeletePic()); | |
1470 } | |
1471 void GrpImpl::DeleteObj(int num) { | |
1472 if (grpobj.find(num) == grpobj.end()) return; | |
1473 deleted_pic.push_back(grpobj[num].DeletePic()); | |
1474 grpobj.erase(num); | |
1475 } | |
1476 void GrpImpl::DeleteObjRange(int num_first, int num_end) { | |
1477 std::map<int, GrpObj>::iterator begin,end,it; | |
1478 begin = grpobj.lower_bound(num_first); | |
1479 end = grpobj.lower_bound(num_end); | |
1480 for (it=begin;it!=end;it++) { | |
1481 deleted_pic.push_back(it->second.DeletePic()); | |
1482 } | |
1483 grpobj.erase(begin, end); | |
1484 } | |
1485 void GrpImpl::Exec(Cmd& cmd) { | |
1486 if (cmd.cmd_type == CMD_TEXTEND) { | |
1487 music.StopKoe(500); // ¥Æ¥¥¹¥È½ªÎ»¤ÇÀ¼¤ò»ß¤á¤ë | |
1488 cmd.clear(); | |
1489 return; | |
1490 } | |
1491 if (cmd.cmd_type == CMD_WAITFRAMEUPDATE) { | |
1492 // wait ¤¹¤ë¾ì¹ç¤Ï RefreshObj() ¤·¤Æ¤ª¤¯ | |
1493 RefreshObj(); | |
1494 } | |
1495 if (cmd.cmd_type != CMD_OTHER) return; | |
1496 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x1e && cmd.cmd3 == 0) { | |
1497 cmd.cmd_type = CMD_SAVECMDGRP_START; // grp stack clear | |
1498 } | |
1499 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x21) { | |
1500 if (cmd.cmd3 == 0x46) { | |
1501 const char* name = cmd.Str(cmd.args[0]); | |
1502 int pdt = cmd.args[1].value; | |
1503 eprintf("load surface %s pdt %d\n",name, pdt); | |
1504 if (pdt == 0) | |
1505 reserved_load_surface0 = name; // ²èÁüÆɤ߹þ¤ß¤Ï 01-1f:0000 ¤Þ¤ÇÂÔ¤Ä | |
1506 else if (pdt == 1) | |
1507 LoadSurface(name); // Çطʳ¨Æɤ߹þ¤ß¡© | |
1508 else | |
1509 LoadSurface(name, pdt); | |
1510 cmd.cmd_type = CMD_SAVECMDGRP; | |
1511 } else if (cmd.cmd3 == 0x49) { | |
1512 const char* name = cmd.Str(cmd.args[0]); | |
1513 int sel = cmd.args[1].value; | |
1514 eprintf("set background %s sel %d\n",name, sel); | |
1515 if (name[0] == '?') { | |
1516 LoadSurface(); | |
1517 } else { | |
1518 LoadSurface(name); | |
1519 } | |
1520 StartAnm(sel); | |
1521 status = WAIT_ANM; | |
1522 event.RegisterGlobalPressFunc(&Pressed, (void*)this); | |
1523 if (name[0] == '?') | |
1524 cmd.cmd_type = CMD_SAVECMDGRP_ONCE; | |
1525 else | |
1526 cmd.cmd_type = CMD_SAVECMDGRP_START; | |
1527 } else if (cmd.cmd3 == 0x4b) { | |
1528 int pos = cmd.args[0].value; | |
1529 const char* name = cmd.Str(cmd.args[1]); | |
1530 int sel = cmd.args[2].value; | |
1531 eprintf("set foreground %s sel %d pos %d\n",name, sel, pos); | |
1532 AddSurface(name); | |
1533 StartAnm(sel); | |
1534 event.RegisterGlobalPressFunc(&Pressed, (void*)this); | |
1535 status = WAIT_ANM; | |
1536 cmd.cmd_type = CMD_SAVECMDGRP_ONCE; | |
1537 } else if (cmd.cmd3 == 0x4c) { | |
1538 /* 0x46 ¤È¤Î°ã¤¤¤¬¤ï¤«¤é¤Ê¤¤ */ | |
1539 /* ¤È¤ê¤¢¤¨¤º bg ¤È¤·¤ÆÅÐÏ¿¤·¤Ê¤¤¤Ç¤ß¤ë */ | |
1540 /* 735 / 19438 : unsupported command; 0x23 - cmd 01-21:004c:00[ 2] | |
1541 ** "?",0 | |
1542 */ | |
1543 /* arg1 = "?" arg2 = 0 */ | |
1544 const char* name = cmd.Str(cmd.args[0]); | |
1545 int sel = cmd.args[1].value; | |
1546 if (name[0] == '?') { | |
1547 LoadSurface(); | |
1548 } else { | |
1549 LoadSurface(name, 1); | |
1550 } | |
1551 StartAnm(sel); | |
1552 status = WAIT_ANM; | |
1553 event.RegisterGlobalPressFunc(&Pressed, (void*)this); | |
1554 if (name[0] == '?') | |
1555 cmd.cmd_type = CMD_SAVECMDGRP_ONCE; | |
1556 else | |
1557 cmd.cmd_type = CMD_SAVECMDGRP_START; | |
1558 } else if (cmd.cmd3 == 0x20) { | |
1559 // shake screen | |
1560 char key[1024]; | |
1561 sprintf(key, "#SHAKE.%03d", cmd.args[0].value); | |
1562 if (config.SearchParam(key) != 2) { | |
1563 fprintf(stderr,"Cannot find shake pattern %d; use default pattern\n",cmd.args[0].value); | |
1564 strcpy(key, "#SHAKE.000"); // default key | |
1565 } | |
1566 int num; const int* pattern; | |
1567 pattern = config.GetParamArray(key, num); | |
1568 if (pattern) { | |
1569 StartShake(num, pattern); | |
1570 status = WAIT_SHAKE; | |
1571 } | |
1572 cmd.clear(); | |
1573 } else if (cmd.cmd3 == 0x64 && cmd.cmd4 == 2) { // copy (KANOGI) | |
1574 int sx = cmd.args[0].value; | |
1575 int sy = cmd.args[1].value; | |
1576 int w = cmd.args[2].value - sx; | |
1577 int h = cmd.args[3].value - sy; | |
1578 Rect rect(sx, sy, sx+w, sy+h); | |
1579 int src = cmd.args[4].value; | |
1580 int dx = cmd.args[5].value; | |
1581 int dy = cmd.args[6].value; | |
1582 int dest = cmd.args[7].value; | |
1583 unsigned char alpha; | |
1584 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); | |
1585 printf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); | |
1586 if (src == dest) { | |
1587 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect); | |
1588 src = WORKPDT; | |
1589 } | |
1590 parent.Root().BlitSurface(Ssurface(src), rect, Dsurface(dest), Rect(dx,dy)); | |
1591 if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h)); | |
1592 cmd.clear(); | |
1593 } else if (cmd.cmd3 == 0x4b1 && cmd.cmd4 == 2) { | |
1594 int x = cmd.args[0].value; | |
1595 int y = cmd.args[1].value; | |
1596 int w = cmd.args[2].value; | |
1597 int h = cmd.args[3].value; | |
1598 Rect rect(x,y,x+w,y+w); | |
1599 int pdt = cmd.args[4].value; | |
1600 int r = cmd.args[5].value; | |
1601 int g = cmd.args[6].value; | |
1602 int b = cmd.args[7].value; | |
1603 eprintf("clear %d:(%d,%d) size (%d,%d) r %d g %d b %d\n",pdt,x,y,w,h,r,g,b); | |
1604 DSurfaceFill(Dsurface(pdt), rect, r, g, b, 0xff); | |
1605 // if (pdt == 0) screen->ReBlit(rect); | |
1606 cmd.cmd_type = CMD_SAVECMDGRP; | |
1607 } else if (cmd.cmd3 == 0x4b1 && cmd.cmd4 == 3) { // alpha ¤Ä¤fill | |
1608 int x = cmd.args[0].value; | |
1609 int y = cmd.args[1].value; | |
1610 int w = cmd.args[2].value; | |
1611 int h = cmd.args[3].value; | |
1612 Rect rect(x,y,x+w,y+h); | |
1613 int pdt = cmd.args[4].value; | |
1614 int r = cmd.args[5].value; | |
1615 int g = cmd.args[6].value; | |
1616 int b = cmd.args[7].value; | |
1617 int a = cmd.args[8].value; | |
1618 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); | |
1619 if (a <= 0) ; | |
1620 else if (a >= 255) DSurfaceFill(Dsurface(pdt), rect, r, g, b); | |
1621 else { | |
1622 DSurfaceFill(Dsurface(WORKPDT), rect, r, g, b, a); | |
1623 parent.Root().BlitSurface(Dsurface(WORKPDT), rect, Dsurface(pdt), rect); | |
1624 } | |
1625 // if (pdt == 0) screen->ReBlit(rect); | |
1626 cmd.clear(); | |
1627 } else if (cmd.cmd3 == 0x44c && cmd.cmd4 == 2) { | |
1628 int sx = cmd.args[0].value; | |
1629 int sy = cmd.args[1].value; | |
1630 int w = cmd.args[2].value; | |
1631 int h = cmd.args[3].value; | |
1632 int src = cmd.args[4].value; | |
1633 int dx = cmd.args[5].value; | |
1634 int dy = cmd.args[6].value; | |
1635 int dest = cmd.args[7].value; | |
1636 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); | |
1637 parent.Root().BlitSurface(Ssurface(src), Rect(sx,sy,sx+w,sy+h), Dsurface(dest), Rect(dx,dy)); | |
1638 //DSurfaceMove(Ssurface(src), Rect(sx,sy,sx+w,sy+h), Dsurface(dest), Rect(dx,dy)); | |
1639 // if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h)); | |
1640 cmd.cmd_type = CMD_SAVECMDGRP; | |
1641 } else if (cmd.cmd3 == 0x44c && cmd.cmd4 == 3) { // alpha ¤Ä¤copy | |
1642 int sx = cmd.args[0].value; | |
1643 int sy = cmd.args[1].value; | |
1644 int w = cmd.args[2].value; | |
1645 int h = cmd.args[3].value; | |
1646 Rect rect(sx, sy, sx+w, sy+h); | |
1647 int src = cmd.args[4].value; | |
1648 int dx = cmd.args[5].value; | |
1649 int dy = cmd.args[6].value; | |
1650 int dest = cmd.args[7].value; | |
1651 unsigned char alpha; | |
1652 if (cmd.args[8].value < 0) alpha = 0; | |
1653 else if (cmd.args[8].value > 255) alpha = 255; | |
1654 else alpha = cmd.args[8].value; | |
1655 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); | |
1656 if (src == dest) { | |
1657 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect); | |
1658 src = WORKPDT; | |
1659 } | |
1660 if (alpha != 0) | |
1661 parent.Root().BlitSurface(Ssurface(src), rect, &alpha, Rect(0,0,1,1), Dsurface(dest), Rect(dx,dy), 0); | |
1662 // if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h)); | |
1663 cmd.clear(); | |
1664 } else if (cmd.cmd3 == 0x640 && cmd.cmd4 == 3) { // saturate mode ¤Ç alpha ÉÕ¤ copy | |
1665 int sx = cmd.args[0].value; | |
1666 int sy = cmd.args[1].value; | |
1667 int w = cmd.args[2].value; | |
1668 int h = cmd.args[3].value; | |
1669 Rect rect(sx, sy, sx+w, sy+h); | |
1670 int src = cmd.args[4].value; | |
1671 int dx = cmd.args[5].value; | |
1672 int dy = cmd.args[6].value; | |
1673 int dest = cmd.args[7].value; | |
1674 unsigned char alpha; | |
1675 if (cmd.args[8].value < 0) alpha = 0; | |
1676 else if (cmd.args[8].value > 255) alpha = 255; | |
1677 else alpha = cmd.args[8].value; | |
1678 eprintf("copy surface w/ saturate %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); | |
1679 if (src == dest) { | |
1680 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect); | |
1681 src = WORKPDT; | |
1682 } | |
1683 if (alpha != 0) { | |
1684 // saturate mode : screen (picture) ¤ò°ì»þŪ¤ËºîÀ® | |
1685 PicBase* screen_tmp = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | |
1686 screen_tmp->SetSurface(Ssurface(src), 0, 0, PicBase::BLIT_SATURATE); | |
1687 screen_tmp->SetSurfaceRect(rect); | |
1688 screen_tmp->Move(dx, dy); | |
1689 screen_tmp->SetSurfaceAlpha(&alpha, Rect(0,0,1,1)); | |
1690 screen_tmp->SimpleBlit(Dsurface(dest)); | |
1691 delete screen_tmp; | |
1692 } | |
1693 cmd.clear(); | |
1694 } else if (cmd.cmd3 == 0x196 && cmd.cmd4 == 0) { | |
1695 Rect r_from(cmd.args[0].value, cmd.args[1].value); | |
1696 Rect r_to(cmd.args[2].value, cmd.args[3].value); | |
1697 int src_pdt = cmd.args[4].value; | |
1698 Rect r(cmd.args[5].value,cmd.args[6].value,cmd.args[7].value+1,cmd.args[8].value+1); | |
1699 int tm = cmd.args[9].value; | |
1700 fprintf(stderr,"??? cmd time %d\n",tm); | |
1701 // anm1 = new ScnGrpMove(event, screen, parent.Root(), surface, r, Ssurface(2), r_from, r_to, tm); | |
1702 // status = WAIT_ANM; | |
1703 } | |
1704 } | |
1705 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x22) { | |
1706 if (cmd.cmd3 == 0x0c30 && cmd.cmd4 == 0) { // ¥¹¥¯¥í¡¼¥ë¤¹¤ë²èÁü¸ú²Ì(Princess Bride) | |
1707 if (anm2) { | |
1708 anm2->Abort(); | |
1709 delete anm2; | |
1710 } | |
1711 PicBase* pic; Surface* s; | |
1712 Rect r(cmd.args[1].value, cmd.args[2].value, cmd.args[3].value+1, cmd.args[4].value+1); | |
1713 const char* name = cmd.Str(cmd.args[5]); | |
1714 Rect sr_start(cmd.args[6].value,cmd.args[7].value); | |
1715 Rect sr_end(cmd.args[8].value,cmd.args[9].value); | |
1716 int tm = cmd.args[10].value; | |
1717 LoadSurface(name, 2); /* PDT2 ¤ËÆɤ߹þ¤ß¡¢¤È·è¤áÂǤÁ */ | |
1718 | |
1719 anm2 = new ScnGrpMove(event, screen, parent.Root(), Dsurface(1), r, Ssurface(2), sr_start, sr_end, tm); | |
1720 cmd.cmd_type = CMD_SAVECMDGRP; | |
1721 } | |
1722 if ( (cmd.cmd3 == 0xc1c && cmd.cmd4 == 0) || (cmd.cmd3 == 0x835 && cmd.cmd4 == 0) ) { | |
1723 // ¥«¡¼¥É¤¬Íî¤Á¤ë¥¢¥Ë¥á¡¼¥·¥ç¥ó | |
1724 int i; | |
1725 ScnGrpAnm* new_anm = new ScnGrpAnm(event, screen, *this); | |
1726 if (cmd.cmd3 == 0x835) { | |
1727 AbortAnm(); | |
1728 anm1 = new_anm; | |
1729 status = WAIT_ANM; | |
1730 event.RegisterGlobalPressFunc(&Pressed, (void*)this); | |
1731 } else { | |
1732 anm2 = new_anm; | |
1733 } | |
1734 for (i=0; i<cmd.argc; i++) { | |
1735 const char* name = cmd.Str(cmd.args[i*3+1]); | |
1736 int tm = cmd.args[i*3+2].value; | |
1737 new_anm->push_back(ScnGrpAnmAtom(name,tm)); | |
1738 } | |
1739 new_anm->CalcTotal(); | |
1740 cmd.clear(); | |
1741 } | |
1742 } | |
26 | 1743 if (cmd.cmd1 == 1 && cmd.cmd2 == 4) { |
1744 if (cmd.cmd3 == 0x5dc) // Total number of CG | |
1745 cmd.SetSysvar(cgm_size); | |
1746 if (cmd.cmd3 == 0x5dd) // Number of CG viewed | |
1747 cmd.SetSysvar(cgm_data.size()); | |
1748 if (cmd.cmd3 == 0x5de) // Percentage of CG viewed | |
20
824b89018ea8
* CG completion percentage (maybe not working properly?)
thib
parents:
18
diff
changeset
|
1749 cmd.SetSysvar(cgm_data.size() * 100 / cgm_size); |
26 | 1750 |
0 | 1751 if (cmd.cmd3 == 0xd8 || cmd.cmd3 == 0xd3 || cmd.cmd3 == 0xd2 || cmd.cmd3 == 0xd7) { |
1752 cmd.clear(); // ¤¤¤Ä¤â 0xd8 / 0xd7 ¤ÈÁȤǽФƤ¯¤ë | |
1753 } | |
26 | 1754 |
1755 // CG Status | |
0 | 1756 if (cmd.cmd3 == 0x5e0) { // ²èÁü´û»ë¥Õ¥é¥°¤òÆÀ¤ë |
1757 string s = cmd.Str(cmd.args[0]); | |
1758 if (cgm_info.find(s) == cgm_info.end()) { | |
1759 fprintf(stderr,"cmd 01-04:05e0 : cannot find cgm-info of '%s'\n",s.c_str()); | |
1760 return; | |
1761 } | |
1762 int n = cgm_info[s]; | |
1763 if (cgm_data.find(n) == cgm_data.end()) cmd.SetSysvar(0); | |
1764 else cmd.SetSysvar(1); | |
1765 } | |
26 | 1766 |
1767 if (cmd.cmd3 == 0x6a4) { // CreateInput (index, x, y, width, height, fontsize, br, bg, bb, fr, fg, fb) | |
1768 int index = cmd.args[0].value; | |
1769 int x = cmd.args[1].value; | |
1770 int y = cmd.args[2].value; | |
1771 //TODO | |
1772 } | |
1773 if (cmd.cmd3 == 0x6ae) { // SetInput (index, text) | |
1774 //TODO | |
1775 } | |
0 | 1776 } |
1777 #if 1 | |
1778 /* object Áàºî */ | |
1779 if ( (cmd.cmd1 == 1 || cmd.cmd1 == 2) && (cmd.cmd2 == 0x3d || cmd.cmd2 == 0x3e) && (cmd.cmd3 == 0x0a || cmd.cmd3 == 0x0b || cmd.cmd3 == 0x0e)) { // clear object | |
1780 if (cmd.cmd3 == 0x0a || cmd.cmd3 == 0x0b) { | |
1781 if (cmd.cmd1 == 2 && cmd.args.size() == 2) { | |
1782 int num = cmd.args[0].value*1000 + cmd.args[1].value + 500; | |
1783 DeleteObj(num); | |
1784 } else if (cmd.args.size() == 1) { // group ¤´¤È¾Ãµî | |
1785 int num_first = cmd.args[0].value * 1000; | |
1786 int num_end = num_first+1000; | |
1787 DeleteObjRange(num_first, num_end); | |
1788 } | |
1789 } else { // 0x0e | |
1790 if (cmd.cmd1 == 1 && cmd.args.size() == 2) { | |
1791 SwapObj(cmd.args[0].value * 1000, cmd.args[1].value * 1000); | |
1792 } else if (cmd.cmd1 == 2 && cmd.args.size() == 3) { | |
1793 int v1 = cmd.args[0].value*1000 + cmd.args[1].value + 500; | |
1794 int v2 = cmd.args[0].value*1000 + cmd.args[2].value + 500; | |
1795 SwapObj(v1, v2); | |
1796 } | |
1797 } | |
1798 cmd.clear(); | |
1799 } | |
1800 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x3c && cmd.cmd3 == 0x01) { // ??? : CLANNAD | |
1801 cmd.clear(); | |
1802 } | |
1803 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x3c && cmd.cmd3 == 0) { // ??? : KANOGI : ²èÁü¥ª¥Ö¥¸¥§¥¯¥È¤Îºï½ü¡© | |
1804 DeleteObjPic(cmd.args[0].value * 1000); // µì¥Õ¥¡¥¤¥ë̾¤Îsurface¤òºï½ü | |
1805 GrpObj& g = grpobj[cmd.args[0].value * 1000]; | |
1806 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); | |
1807 cmd.clear(); | |
1808 } | |
1809 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)) { | |
1810 if (cmd.cmd1 == 1) { | |
1811 if (cmd.args.size() >= 1) cmd.args[0].value *= 1000; // ¤È¤ê¤¢¤¨¤º 1000Çܤ·¤Æ¤ª¤¯ | |
1812 } else { // cmd.cmd2 == 2 | |
1813 // ¥ª¥Ö¥¸¥§¥¯¥ÈÈÖ¹æ¤ò»ØÄꤹ¤ë¥³¥Þ¥ó¥É°ú¿ô¤¬°ì¤ÄÁý¤¨¤Æ¤¤¤ë¤Î¤ò¾Ãµî | |
1814 vector<VarInfo> args = cmd.args; | |
1815 cmd.args.clear(); | |
1816 if (args.size() >= 2) { | |
1817 cmd.args.push_back(args[0].value*1000 + args[1].value + 500); | |
1818 cmd.args.insert(cmd.args.end(), args.begin()+2, args.end()); | |
1819 } | |
1820 } | |
1821 if (cmd.cmd2 == 0x47) { | |
1822 /**************: | |
1823 0x47 : ¥ª¥Ö¥¸¥§¥¯¥ÈÆâÍƤÎÀßÄê | |
1824 0x3e8: G00 ¥Õ¥¡¥¤¥ë | |
1825 0x3eb: GAN ¥Õ¥¡¥¤¥ë | |
1826 0x44c: ¶ë·ÁÎΰè | |
1827 0x4b0: ʸ»úÎó | |
1828 0x514: Å·¸õ¸ú²Ì | |
1829 0x578: ¿ô»ú¤Î²èÁüɽ¼¨ | |
1830 */ | |
1831 int base_argc = 0; | |
1832 DeleteObjPic(cmd.args[0].value); // µì¥Õ¥¡¥¤¥ë̾¤Îsurface¤òºï½ü | |
1833 GrpObj& g = grpobj[cmd.args[0].value]; | |
1834 if (cmd.cmd3 == 0x3e8) { /* ¥Õ¥¡¥¤¥ë̾ÀßÄê */ | |
1835 g.gtype = GrpObj::FILE; | |
1836 string name = cmd.Str(cmd.args[1]); | |
1837 if (name.find('?') != -1) { | |
1838 name.erase(name.find('?')); // '?' °Ê¹ß¤Î°ÕÌ£¤¬¤ï¤«¤é¤Ê¤¤ | |
1839 } | |
1840 g.name = name; | |
1841 } else if (cmd.cmd3 == 0x3eb) { /* ¥Õ¥¡¥¤¥ë̾ÀßÄê(GAN´Þ¤à) */ | |
1842 g.gtype = GrpObj::GAN; | |
1843 if (cmd.Str(cmd.args[1]) == string("???")) | |
1844 g.name = cmd.Str(cmd.args[2]); | |
1845 else | |
1846 g.name = cmd.Str(cmd.args[1]); | |
1847 g.gan_name = cmd.Str(cmd.args[2]); | |
5 | 1848 |
1849 if (cmd.cmd4 >= 1 && cmd.args[3].value == 0) | |
1850 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); | |
1851 else | |
1852 g.attr = GrpObj::Attribute(g.attr & ~(GrpObj::HIDDEN)); | |
1853 | |
1854 if (cmd.argc >= 5) | |
1855 g.SetPos(1, cmd.args[4].value, -cmd.args[5].value); | |
1856 | |
1857 if (g.name.find('?') != -1) { | |
4 | 1858 g.name.erase(g.name.find('?')); |
1859 g.gan_name = cmd.Str(cmd.args[2]); | |
1860 } | |
0 | 1861 } else if (cmd.cmd3 == 0x4b0) { // ²èÁü¤òʸ»úÎó¤È¤·¤Æ»ØÄê |
1862 g.gtype = GrpObj::MOJI; | |
1863 g.print_moji = cmd.Str(cmd.args[1]); | |
1864 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); // ¾ï¤Ëɽ¼¨¤¬¥Ç¥Õ¥©¥ë¥È¡© | |
1865 cmd.clear(); | |
1866 } else if (cmd.cmd3 == 0x578) { // ¿ôÃͤò²èÁü¤È¤·¤Æɽ¼¨ | |
1867 g.gtype = GrpObj::DIGIT; | |
1868 g.name = cmd.Str(cmd.args[1]); | |
1869 } | |
1870 CreateObj(cmd.args[0].value); | |
1871 if (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb || cmd.cmd3 == 0x4b0 || cmd.cmd3 == 0x578) { | |
1872 // FILE, GAN, MOJI, DIGIT ¤Ê¤é¤ÐºÂɸÅù¤ÎÀßÄê¤ò¹Ô¤¦ | |
18 | 1873 if (cmd.cmd4 >= 1) { |
0 | 1874 if (cmd.args[2+base_argc].value == 0) { |
1875 if (cmd.cmd1 == 1) | |
1876 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP); | |
1877 else | |
1878 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); | |
1879 } else { | |
1880 if (cmd.cmd1 == 1) | |
1881 g.attr = GrpObj::Attribute(g.attr & (~(GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP))); | |
1882 else | |
1883 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); | |
1884 } | |
1885 if (cmd.cmd1 == 1) | |
1886 SetObjChangedGroup(cmd.args[0].value); | |
1887 } | |
18 | 1888 if (cmd.cmd4 >= 2) { // ºÂɸÅù¤âÀßÄê |
0 | 1889 g.SetPos(0,cmd.args[3+base_argc].value, cmd.args[4+base_argc].value); |
1890 } | |
18 | 1891 if ( (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb) && cmd.cmd4 >= 3) { // pattern ÈÖ¹æ¤âÀßÄê |
0 | 1892 g.SetSurfaceNum(cmd.args[5+base_argc].value); |
1893 base_argc++; // 0x3e8 (FILE) / 0x3eb (GAN) ¤Î¾ì¹ç¤Î¤ß¤³¤Î¥ª¥×¥·¥ç¥ó¤Ï¸ºß¤¹¤ë | |
1894 } | |
1895 cmd.clear(); | |
1896 } else { | |
1897 fprintf(stderr,"CreateObj : cmd.cmd3 = %04x ; not supported!\n",cmd.cmd3); | |
1898 } | |
1899 } else if (cmd.cmd2 == 0x48) { | |
1900 // ²èÌÌÀÚ¤êÂؤ¨¸å¤Î object (back screen object) ÀßÄê | |
1901 if (cmd.cmd3 == 0x3e8) { | |
1902 // cmd.cmd4 == 0 : args = 2, CLANNAD : cg mode | |
1903 // cmd.cmd4 == 1 : args = 3, CLANNAD : ½Õ¸¶²óÁÛ¡©¤Î¤È¤³¤í¤Ç²èÌ̤¬¹õ¤¯¤Ê¤Ã¤Æ¤·¤Þ¤¦¤Î¤Ç¡¢¤È¤ê¤¢¤¨¤º¡£ | |
1904 // cmd.cmd4 == 2 : args = 5, KANOGI : Fore Graphics | |
1905 // cmd.cmd4 == 3 : args = 6, KANOGI : CG mode | |
1906 GrpObj& g = bs_obj[cmd.args[0].value]; | |
1907 string name = cmd.Str(cmd.args[1]); | |
1908 if (name.find('?') != -1) { | |
1909 name.erase(name.find('?')); // '?' °Ê¹ß¤Î°ÕÌ£¤¬¤ï¤«¤é¤Ê¤¤ | |
1910 } | |
1911 g.gtype = GrpObj::FILE; | |
1912 g.name = name; | |
1913 if (cmd.cmd4 >= 1 && cmd.args[2].value == 0) | |
1914 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); | |
1915 else | |
1916 g.attr = GrpObj::Attribute(g.attr & ~(GrpObj::HIDDEN)); | |
1917 if (cmd.cmd4 >= 2) | |
1918 g.SetPos(0,cmd.args[3].value, cmd.args[4].value); | |
1919 if (cmd.cmd4 >= 3) | |
1920 g.SetSurfaceNum(cmd.args[5].value); | |
1921 if (cmd.cmd4 <= 3) | |
1922 cmd.cmd_type = CMD_SAVECMDGRP; | |
1923 } | |
1924 } else if (cmd.cmd2 == 0x49) { | |
1925 if (cmd.cmd3 == 0) { // ¥¢¥Ë¥á¡¼¥·¥ç¥ó¤ò¶¯À©½ªÎ» | |
1926 GrpObj& g = grpobj[cmd.args[0].value]; | |
1927 if (g.anm == 0 || g.anm->IsEnd()) ; | |
1928 else g.anm->Abort(); | |
1929 } else if (cmd.cmd3 == 3) { // ¥¢¥Ë¥á¡¼¥·¥ç¥óÃ椫¡© | |
1930 GrpObj& g = grpobj[cmd.args[0].value]; | |
1931 if (g.anm == 0 || g.anm->IsEnd()) { | |
1932 cmd.SetSysvar(0); | |
1933 } else { | |
1934 cmd.SetSysvar(1); | |
1935 } | |
1936 } else if (cmd.cmd3 == 1000) { | |
1937 // ¥¢¥Ë¥á¡¼¥·¥ç¥ó¤òÅÓÃæ¤ÇÄä»ß¤·¤¿¾õÂ֤ˤ¹¤ë | |
1938 GrpObj& g = grpobj[cmd.args[0].value]; | |
1939 if (g.anm == 0 || g.anm->IsEnd()) { | |
1940 // fprintf(stderr,"AnimPause : no animation in %d (%d)\n",cmd.args[0].value, cmd.args[1].value); | |
1941 g.SetSurfaceNum(cmd.args[1].value); | |
1942 } else { | |
1943 g.anm->Abort(); | |
1944 g.SetSurfaceNum(cmd.args[1].value); | |
1945 } | |
1946 SetObjChanged(cmd.args[0].value); | |
1947 cmd.clear(); | |
1948 } else if (cmd.cmd3 == 0x7d3) { // surface ¤òÁý²Ã¤µ¤»¤ë²èÁü¸ú²Ì | |
1949 GrpObj& g = grpobj[cmd.args[0].value]; | |
1950 g.CreateGanSpecial(event, 0, cmd.args[1].value); | |
1951 // g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); | |
1952 SetObjChanged(cmd.args[0].value); | |
1953 cmd.clear(); | |
1954 } else if (cmd.cmd3 == 0xbbd || cmd.cmd3 == 0xbbb || cmd.cmd3 == 0xbb9) { // ¥¢¥Ë¥á¡¼¥·¥ç¥ó³«»Ï | |
1955 GrpObj& g = grpobj[cmd.args[0].value]; | |
1956 g.CreateGan(event, cmd.args[1].value); | |
1957 // g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); | |
1958 SetObjChanged(cmd.args[0].value); | |
1959 cmd.clear(); | |
1960 } | |
1961 } else if (cmd.cmd2 == 0x51 || cmd.cmd2 == 0x52) { | |
1962 GrpObj& g = (cmd.cmd2 == 0x51) ? | |
1963 grpobj[cmd.args[0].value] : | |
1964 bs_obj[cmd.args[0].value]; | |
1965 if (cmd.cmd3 == 0x3e8) { /* ºÂɸÀßÄê */ | |
1966 g.SetPos(0,cmd.args[1].value, cmd.args[2].value); | |
1967 cmd.clear(); | |
1968 } else if (cmd.cmd3 == 0x3e9 || cmd.cmd3 == 0x3ea) { /* x / y ºÂɸ¤Î¤ßÀßÄê */ | |
1969 int x0, y0; | |
1970 g.GetPos(0, x0, y0); | |
1971 if (cmd.cmd3 == 0x3e9) | |
1972 g.SetPos(0,cmd.args[1].value, y0); | |
1973 else | |
1974 g.SetPos(0,x0, cmd.args[1].value); | |
1975 cmd.clear(); | |
1976 } else if (cmd.cmd3 == 0x3eb) { /* alpha */ | |
1977 g.SetAlpha(cmd.args[1].value); | |
1978 cmd.clear(); | |
1979 } else if (cmd.cmd3 == 0x3ec) { /* visible flag */ | |
1980 if (cmd.cmd1 == 1) { | |
1981 if (cmd.args[1].value) g.attr = GrpObj::Attribute(g.attr & (~(GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP))); | |
1982 else g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP); | |
1983 } else { | |
1984 if (cmd.args[1].value) g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); | |
1985 else g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); | |
1986 } | |
1987 g.attr = GrpObj::Attribute(g.attr | GrpObj::UPDATE_VISIBLE); | |
1988 // ¥°¥ë¡¼¥×ñ°Ì¤Ç¼¡¤Î RefreshObj ¤Çɽ¼¨¡¦¾Ãµî | |
1989 if (cmd.cmd2 == 0x51 && cmd.cmd1 == 1) | |
1990 SetObjChangedGroup(cmd.args[0].value); | |
1991 cmd.clear(); | |
1992 } else if (cmd.cmd3 == 0x3ee || cmd.cmd3 == 0x7d6) { /* ºÂɸÀßÄꤽ¤Î£²¡© */ | |
1993 /* 0x7d6 : ²èÁü¦¤Î´ð½àºÂɸ¤ò args[4,5] ¤ËÆþ¤ì¤Æ¤¤¤ë¤Î¤«¤â¤·¤ì¤Ê¤¤ */ | |
1994 int index = cmd.args[1].value; | |
1995 int x = cmd.args[2].value; | |
1996 int y = cmd.args[3].value; | |
1997 g.SetPos(index+1, x, y); | |
1998 cmd.clear(); | |
1999 } else if (cmd.cmd3 == 0x3f8) { // ²èÁü¤òʸ»úÎó¤È¤·¤ÆÀßÄꡧ¿§¤ÎÀßÄê | |
2000 g.print_r = cmd.args[1].value; | |
2001 g.print_g = cmd.args[2].value; | |
2002 g.print_b = cmd.args[3].value; | |
2003 g.SetUpdate(); | |
2004 // grpobj[cmd.args[0].value].print_a = cmd.args[4].value; | |
2005 /* args:229,18,minus-1,0,99,255,-1 */ | |
2006 /* args:102,26,minus-1,0,99,0,255 */ | |
2007 cmd.clear(); | |
2008 } else if (cmd.cmd3 == 0x3fd) { // centering mode ¤Ê¤É¤òÀßÄê¡© | |
2009 if (cmd.args[1].value == 1) { | |
2010 g.attr = GrpObj::Attribute(g.attr | GrpObj::SATURATE); | |
2011 cmd.clear(); | |
2012 } else if (cmd.args[1].value == 0) { | |
2013 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::SATURATE)); | |
2014 cmd.clear(); | |
2015 } | |
2016 g.SetUpdate(); | |
2017 /* cmd3 == 0x41c : ¥²¡¼¥à¤Î¿Ê¹Ô¤È¤È¤â¤Ë | |
2018 args:10,105 | |
2019 args:10,133 | |
2020 args:10,144 | |
2021 args:10,144 | |
2022 ¤ÈÊѲ½ | |
2023 | |
2024 cmd3 == 0x418 : | |
2025 args: 10, 400 -> 100 | |
2026 ¤È¡¢alpha ¤ÎÁý²Ã¤È¤È¤â¤ËÊѲ½ | |
2027 */ | |
2028 /* | |
2029 487 / 8047 : unsupported command; 0x23 - cmd 01-51:0419:00[ 2] | |
2030 81,-40, | |
2031 ÂèÆó°ú¿ô¤Î 1/10 ¤¬¥ª¥Ö¥¸¥§¥¯¥È¤Î²óž³Ñ | |
2032 */ | |
2033 } else if (cmd.cmd3 == 0x400) { // ²èÁü¤òʸ»úÎó¤È¤·¤Æ»ØÄê | |
2034 g.print_moji = cmd.Str(cmd.args[1]); | |
2035 g.SetUpdate(); | |
2036 cmd.clear(); | |
2037 } else if (cmd.cmd3 == 0x401) { // ²èÁü¤òʸ»úÎó¤È¤·¤ÆÀßÄꡧʸ»ú¤ÎÂ礤µ¤Ê¤É | |
2038 /* args: size, xspace, yspace, vertical, color, shadow */ | |
2039 /* | |
2040 args:17, 0,0,-1, 0,-1 DT in Tomoyo | |
2041 args:17, 0,0,-1,200,-1 Save/Load in Tomoyo | |
2042 args:20, 0,0, 0,255,-1 "¨¡¨¡¤¢¤ê¤¬¤È¤¦¡Ä¡£" (¾¡Ê¿EdÉÕ¶á) | |
2043 args:16,-1,0,99,255,-1 "¤ä¤¢¡¢µ×¤·¤Ö¤ê¨¡¨¡¡Ä¡£" (Ʊ¾å,Save/Load Menu) | |
2044 args:26,-1,0,99, 0,255 Kuma in CLANNAD | |
2045 */ | |
2046 g.print_size = cmd.args[1].value; | |
2047 /* Á°·Ê¿§¤òÆÀ¤ë */ | |
2048 int cr,cg,cb; char key[1024]; | |
2049 sprintf(key, "#COLOR_TABLE.%03d", cmd.args[5].value); | |
2050 if (config.GetParam(key, 3, &cr, &cg, &cb)) { // color not found | |
2051 cr = cg = cb = 0; | |
2052 } | |
2053 g.print_r = cr; | |
2054 g.print_g = cg; | |
2055 g.print_b = cb; | |
2056 g.SetUpdate(); | |
2057 cmd.clear(); | |
2058 } else if (cmd.cmd3 == 0x408) { // set order | |
2059 int order = cmd.args[1].value; | |
2060 if (cmd.cmd1 == 1) order *= 1000; // order ¤â 1000 Çܤ¹¤ëɬÍפ¬¤¢¤ë¡© | |
2061 g.order = order; | |
2062 ZMoveObj(cmd.args[0].value); | |
2063 cmd.clear(); | |
2064 } else if (cmd.cmd3 == 0x40a && cmd.cmd4 == 1) { // set surface geometry? | |
2065 // ¥ª¥Ö¥¸¥§¥¯¥È¤Î¤É¤ÎÉôʬ¤ò²èÌ̤Ëɽ¼¨¤¹¤ë¤«¡Ê¥¯¥ê¥Ã¥×Îΰè¡Ë¤ÎÀßÄê | |
2066 int rx = cmd.args[1].value; | |
2067 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
|
2068 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
|
2069 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
|
2070 g.SetClipArea(rx, ry, x2, y2); //TODO: case when cmd.args.size() == 1 |
0 | 2071 cmd.clear(); |
2072 } else if (cmd.cmd3 == 0x40d) { // set digit number | |
2073 g.dig_number = cmd.args[1].value; | |
2074 g.SetUpdate(); | |
2075 cmd.clear(); | |
2076 } else if (cmd.cmd3 == 0x40e) { // set digit option | |
2077 g.dig_digit = cmd.args[1].value; | |
2078 int attr = g.attr; | |
2079 attr &= ~(GrpObj::DIG_ZERO | GrpObj::DIG_SIGN | GrpObj::DIG_PACK); | |
2080 if (cmd.args[2].value) attr |= GrpObj::DIG_ZERO; | |
2081 if (cmd.args[3].value) attr |= GrpObj::DIG_SIGN; | |
2082 if (cmd.args[4].value) attr |= GrpObj::DIG_PACK; | |
2083 g.attr = GrpObj::Attribute(attr); | |
2084 g.SetUpdate(); | |
2085 cmd.clear(); | |
2086 } else if (cmd.cmd3 == 0x40f) { /* set surface number */ | |
2087 g.SetSurfaceNum(cmd.args[1].value); | |
2088 cmd.clear(); | |
2089 } else if (cmd.cmd3 == 0x416) { // ¥ª¥Ö¥¸¥§¥¯¥È¤Î³ÈÂçΨÀßÄê | |
2090 int zoom = (cmd.args[1].value + cmd.args[2].value)/2; // x,y Ê̤ËÀßÄê¤Ç¤¤ë¤é¤·¤¤ | |
2091 zoom = zoom*256/100; | |
2092 g.SetZoomRotate(zoom, -1); | |
2093 cmd.clear(); | |
2094 } else if (cmd.cmd3 == 0x419) { // ¥ª¥Ö¥¸¥§¥¯¥È¤Î²óžÀßÄê | |
2095 int angle = cmd.args[1].value; | |
2096 angle /= 10; | |
2097 if (angle < 0) { | |
2098 angle %= 360; | |
2099 angle += 360; | |
2100 } | |
2101 angle %= 360; | |
2102 g.SetZoomRotate(-1, angle); | |
2103 cmd.clear(); | |
2104 } | |
2105 if (cmd.cmd2 == 0x51 && (g.attr & GrpObj::UPDATE_ALL)) { | |
2106 SetObjChanged(cmd.args[0].value); | |
2107 } | |
2108 } else if (cmd.cmd2 == 0x54) { | |
2109 /* ºÂɸ¼èÆÀ */ | |
2110 if (cmd.cmd3 == 0x3e8) { | |
2111 GrpObj& obj = grpobj[cmd.args[0].value]; | |
2112 VarInfo arg1 = cmd.args[1]; | |
2113 VarInfo arg2 = cmd.args[2]; | |
2114 int x0, y0; | |
2115 obj.GetPos(0,x0, y0); | |
2116 cmd.SetFlagvar(arg1, x0); | |
2117 cmd.SetFlagvar(arg2, y0); | |
2118 } else if (cmd.cmd3 == 0x44c) { | |
2119 int w, h; | |
2120 GrpObj& obj = grpobj[cmd.args[0].value]; | |
2121 obj.GetSrcGeom(w, h); | |
2122 VarInfo arg1 = cmd.args[1]; | |
2123 VarInfo arg2 = cmd.args[2]; | |
2124 cmd.SetFlagvar(arg1, w); | |
2125 cmd.SetFlagvar(arg2, h); | |
2126 } | |
2127 } | |
2128 // ¥»¡¼¥ÖÍѤ˥³¥Þ¥ó¥É¤ò¸µ¤ËÌ᤹ | |
2129 if (cmd.args.size() != 0 && (cmd.cmd_type == CMD_SAVECMDGRP || cmd.cmd_type == CMD_SAVECMDGRP_ONCE)) { | |
2130 if (cmd.cmd1 == 1) cmd.args[0].value /= 1000; | |
2131 else if (cmd.cmd1 == 2) { | |
2132 vector<VarInfo> args = cmd.args; | |
2133 int value = args[0].value; | |
2134 cmd.args.clear(); | |
2135 args[0].value = value / 1000; | |
2136 cmd.args.push_back(args[0]); | |
2137 args[0].value = value % 1000 - 500; | |
2138 cmd.args.push_back(args[0]); | |
2139 cmd.args.insert(cmd.args.end(), args.begin()+1, args.end()); | |
2140 } | |
2141 } | |
2142 } | |
2143 #endif | |
2144 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x1f) { // ËÜÍè¤Ï grpstack clear ¤é¤·¤¤ | |
2145 RefreshObj(); | |
2146 // Princess Bride ¤ÎÃæÅÓ Staff roll | |
2147 // ¤³¤Î¥¿¥¤¥ß¥ó¥°¤ÇÉÁ²è¤¹¤ë¤Î¤¬ÅԹ礬¤¤¤¤¤Î¤Ç¡¢ | |
2148 //¥·¥Ê¥ê¥ª¥ë¡¼¥×¤òÈ´¤±¤ÆÉÁ²è¤òµ¯Æ° | |
2149 cmd.cmd_type = CMD_WAITFRAMEUPDATE; | |
2150 } | |
2151 | |
2152 /* XXX : GiGiGi */ | |
2153 /* 122 : 0x23 - cmd 01-04:0924:00[ 0] : V<sys> ¤ËBGMºÆÀ¸¥â¡¼¥É¤òÊÖ¤¹ (0/1) | |
2154 ** 256 : 0x23 - cmd 01-04:091a:00[ 0] : V<sys> ¤ËBGM²»Î̤òÊÖ¤¹ (0-255?) | |
2155 ** 278 : 0x23 - cmd 01-04:0926:00[ 0] : V<sys> ¤ËEffºÆÀ¸¥â¡¼¥É¤òÊÖ¤¹ (0/1) | |
2156 ** 412 : 0x23 - cmd 01-04:091c:00[ 0] : V<sys> ¤ËEff²»Î̤òÊÖ¤¹ (0-255?) | |
2157 ** 434 : 0x23 - cmd 01-04:0927:00[ 0] : V<sys> ¤ËSE ºÆÀ¸¥â¡¼¥É¤òÊÖ¤¹ (0/1) | |
2158 ** 568 : 0x23 - cmd 01-04:091d:00[ 0] : V<sys> ¤ËSE ²»Î̤òÊÖ¤¹ (0-255?) | |
2159 | |
2160 ** 122 : 0x23 - cmd 01-04:08c0:00[ 0] : V<sys> ¤ËBGMºÆÀ¸¥â¡¼¥É¤òÀßÄê (0/1) | |
2161 ** 256 : 0x23 - cmd 01-04:08b6:00[ 0] : V<sys> ¤ËBGM²»Î̤òÀßÄê (0-255?) | |
2162 ** 278 : 0x23 - cmd 01-04:08c2:00[ 0] : V<sys> ¤ËEffºÆÀ¸¥â¡¼¥É¤òÀßÄê (0/1) | |
2163 ** 412 : 0x23 - cmd 01-04:08b8:00[ 0] : V<sys> ¤ËEff²»Î̤òÀßÄê (0-255?) | |
2164 ** 434 : 0x23 - cmd 01-04:08c3:00[ 0] : V<sys> ¤ËSE ºÆÀ¸¥â¡¼¥É¤òÀßÄê (0/1) | |
2165 ** 568 : 0x23 - cmd 01-04:08b9:00[ 0] : V<sys> ¤ËSE ²»Î̤òÀßÄê (0-255?) | |
2166 */ | |
2167 // ËÜÍè¤Ï²»³Ú´ØÏ¢¤Î¥³¥Þ¥ó¥É | |
2168 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x14) { | |
2169 if (cmd.cmd3 == 0 && cmd.cmd4 == 0) { | |
2170 eprintf("play bgm %s\n",cmd.Str(cmd.args[0])); | |
2171 music.PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000); | |
2172 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2173 } | |
2174 if (cmd.cmd3 == 2 && (cmd.cmd4 == 2 || cmd.cmd4 == 0) ) { /* ??? : ¤³¤È¤ß¥·¥Ê¥ê¥ª¥é¥¹¥È¤Î²»³ÚºÆÀ¸ */ | |
2175 eprintf("play bgm %s\n",cmd.Str(cmd.args[0])); | |
2176 music.PlayCDROM( (char*)cmd.Str(cmd.args[0]), 1); | |
2177 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2178 } | |
2179 if (cmd.cmd3 == 0 && cmd.cmd4 == 2) { | |
2180 eprintf("fade bgm %d? and play bgm %s; %d\n",cmd.args[1].value, cmd.Str(cmd.args[0]), cmd.args[2].value); | |
2181 // music.PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000, cmd.args[2].value); | |
2182 music.PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000); | |
2183 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2184 } | |
2185 if ( (cmd.cmd3 == 5 || cmd.cmd3 == 0x69) && cmd.cmd4 == 0) { | |
2186 if (cmd.cmd3 == 5) { | |
2187 music.StopCDROM(0); | |
2188 eprintf("stop bgm\n"); | |
2189 } else { | |
2190 music.StopCDROM(cmd.args[0].value); | |
2191 eprintf("fade bgm %d\n",cmd.args[0].value); | |
2192 } | |
2193 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2194 } | |
2195 } | |
2196 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x15) { | |
10 | 2197 if ((cmd.cmd3 == 2) || (cmd.cmd3 == 0 && (cmd.cmd4 == 1 || cmd.cmd4 == 2)) || (cmd.cmd3 == 0 && cmd.cmd4 == 0)) { |
11 | 2198 eprintf("play SE %s\n",cmd.Str(cmd.args[0])); |
0 | 2199 if (cmd.cmd3 == 2) { |
2200 music.PlaySE(cmd.Str(cmd.args[0]),1); | |
2201 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2202 } else { | |
2203 music.PlaySE(cmd.Str(cmd.args[0])); | |
2204 cmd.clear(); | |
2205 } | |
2206 } else if (cmd.cmd3 == 5) { | |
2207 eprintf("Stop SE\n"); | |
2208 music.StopSE(); | |
2209 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2210 } else if (cmd.cmd3 == 0x69) { | |
2211 eprintf("Stop SE with fade %d\n",cmd.args[0].value); | |
2212 music.StopSE(cmd.args[0].value); | |
2213 cmd.cmd_type = CMD_SAVECMD_ONCE; | |
2214 } | |
2215 } | |
2216 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && (cmd.cmd3 == 0x4bb || cmd.cmd3 == 0x4bc) ) { | |
2217 // ²»³Ú¤òÂԤäƤߤë(ÀäÂФ˰㤦¤¬)¡£ËÜÍè¡¢04-803 ¤ËÂбþ¤·¤Æ¤Ê¤Ë¤«¤Î½ª¤ï¤ê¤òwait¤¹¤ë¤Ã¤Ý¤¤(É÷»Ò/ÃÒÂåEdÉÕ¶á) | |
2218 // EnableSyscom ¤é¤·¤¤¤¬¡¢¤è¤¯¤ï¤«¤é¤Ê¤¤ (rldev) | |
2219 // if (!music.IsStopSE()) status = WAIT_SE; | |
2220 cmd.clear(); | |
2221 } | |
26 | 2222 |
0 | 2223 // ²»³Ú¥â¡¼¥É¤Ç²»Î̤ò¾å¤²¤ë¤¿¤á¤Î¥³¥Þ¥ó¥É (SetBgmVolume) |
2224 // ¤È¤ê¤¢¤¨¤ºÌ¤¼ÂÁõ | |
26 | 2225 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && cmd.cmd3 >= 0x8b6 && cmd.cmd3 <= 0x8b9) { // Set{Bgm,Koe,PCM,Se}VolMod |
2226 music.volmod[cmd.cmd3-0x8b6] = cmd.args[0].value; | |
2227 config.SetParam("#VOLMOD", 4, music.volmod[0], music.volmod[1], music.volmod[2], music.volmod[3]); | |
0 | 2228 cmd.clear(); |
2229 } | |
26 | 2230 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && cmd.cmd3 >= 0x91a && cmd.cmd3 <= 0x91d) { // Get{Bgm,Koe,PCM,Se}VolMod |
2231 cmd.SetSysvar(music.volmod[cmd.cmd3-0x91a]); | |
2232 } | |
0 | 2233 |
2234 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x16) { | |
2235 if (cmd.cmd3 == 0 && cmd.cmd4 == 0) { | |
2236 eprintf("play SE %d\n",cmd.args[0].value); | |
2237 music.PlaySE(cmd.args[0].value); | |
2238 cmd.clear(); | |
2239 } | |
2240 } | |
2241 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x17) { | |
2242 if (cmd.cmd3 == 0) { | |
2243 eprintf("play koe %d",cmd.args[0].value); | |
2244 if (cmd.cmd4 == 1) { | |
2245 eprintf(", para? %d",cmd.args[1].value); | |
2246 } | |
2247 eprintf("\n"); | |
2248 char buf[1024]; sprintf(buf, "%d",cmd.args[0].value); | |
2249 if ( !(skip_mode & SKIP_TEXT)) music.PlayKoe(buf); | |
2250 cmd.clear(); | |
2251 } | |
2252 } | |
2253 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x1a) { | |
2254 if ( (cmd.cmd3 == 0x14 || cmd.cmd3 == 1) && cmd.cmd4 == 0) { | |
2255 const char* str = cmd.Str(cmd.args[0]); | |
2256 int x = cmd.args[1].value; | |
2257 int y = cmd.args[2].value; | |
2258 int x2 = cmd.args[3].value; | |
2259 int y2 = cmd.args[4].value; | |
2260 eprintf("play movie ; name %s pos %d,%d - %d,%d\n",str,x,y,x2,y2); | |
2261 music.PlayMovie(str, x, y, x2, y2,1); | |
2262 status = WAIT_MOVIE; | |
2263 event.RegisterGlobalPressFunc(&Pressed, (void*)this); | |
2264 cmd.clear(); | |
2265 } | |
2266 } | |
2267 return; | |
2268 } | |
2269 | |
2270 | |
2271 /******************************************************** | |
2272 ** | |
2273 ** class Grp | |
2274 */ | |
2275 | |
2276 Grp::Grp(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm,class MuSys& mu, AyuSysConfig& config) { | |
2277 pimpl = new GrpImpl(_event, _parent, f, _cgm, mu, config); | |
2278 }; | |
2279 Grp::~Grp() { | |
2280 delete pimpl; | |
2281 } | |
2282 | |
2283 bool Grp::Wait(unsigned int current_time, Cmd& cmd) { | |
2284 return pimpl->Wait(current_time, cmd); | |
2285 } | |
2286 void Grp::Exec(Cmd& cmd) { | |
2287 pimpl->Exec(cmd); | |
2288 } | |
2289 void Grp::SetSkipMode(SkipMode mode) { | |
2290 pimpl->SetSkipMode(mode); | |
2291 } | |
2292 void Grp::InitSel(AyuSysConfig& config) { | |
2293 pimpl->InitSel(config); | |
2294 } | |
2295 void Grp::Save(std::string& str) { | |
2296 pimpl->Save(str); | |
2297 } | |
2298 | |
2299 void Grp::Load(const char* str) { | |
2300 pimpl->Load(str); | |
2301 } | |
2302 void Grp::SaveSys(std::string& str) { | |
2303 pimpl->SaveSys(str); | |
2304 } | |
2305 | |
2306 void Grp::LoadSys(const char* str) { | |
2307 pimpl->LoadSys(str); | |
2308 } |