Mercurial > otakunoraifu
annotate scn2k/scn2k_grp.cc @ 55:f1a27ee7e03c
* started the same changes on scn2k_text.cc
* handle opcodes childObj*. In fact, it was handled (in a strange way, but it worked) before the previous changeset
author | thib |
---|---|
date | Wed, 22 Apr 2009 15:01:42 +0000 |
parents | d7cde171a1de |
children | c7bcc0ec2267 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (c) 2004-2006 Kazunori "jagarl" Ueno | |
3 * All rights reserved. | |
4 * | |
5 * Redistribution and use in source and binary forms, with or without | |
6 * modification, are permitted provided that the following conditions | |
7 * are met: | |
8 * 1. Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * 2. Redistributions in binary form must reproduce the above copyright | |
11 * notice, this list of conditions and the following disclaimer in the | |
12 * documentation and/or other materials provided with the distribution. | |
13 * 3. The name of the author may not be used to endorse or promote products | |
14 * derived from this software without specific prior written permission. | |
15 * | |
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
26 */ | |
27 | |
52 | 28 #include "scn2k.h" |
29 #include "window/widget.h" | |
30 #include "system/file.h" | |
31 #include "system/system_config.h" | |
32 #include "font/text.h" | |
33 #include <set> | |
0 | 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 | |
55 | 56 struct GrpObj; |
57 typedef std::map<int, GrpObj> GrpObjMap; | |
58 | |
0 | 59 struct GrpObj { |
60 string name; | |
61 string gan_name; | |
62 PicContainer* pic_parent; | |
63 PicBase* picture; | |
64 WidAnmTime* anm; | |
65 int _posx, _posy; | |
52 | 66 int posx[9], posy[9]; |
0 | 67 Rect clip_area; |
68 unsigned char alpha; | |
69 int order; | |
70 int surface_num; | |
71 | |
55 | 72 GrpObjMap children_obj; |
73 | |
0 | 74 string print_moji; |
75 int print_size, print_r, print_b, print_g; | |
76 | |
77 int dig_number, dig_digit; | |
78 | |
79 // zoom / rotate 関係 | |
80 int zoom; // 256 で 1 倍 | |
81 int rotate; // 0-360度 | |
82 | |
83 vector<Rect> src_pos; | |
84 enum GrpType { FILLRECT = 1, FILE = 2, GAN = 3, MOJI = 4, DIGIT = 5} gtype; | |
55 | 85 enum Attribute { NONE=0, WIPEON=1, SATURATE=2, HIDDEN=4, |
18 | 86 UPDATE_PICTURE = 16, UPDATE_POS = 32, UPDATE_ALPHA = 64, UPDATE_SNUM = 128, UPDATE_CLIP = 256, UPDATE_VISIBLE = 512, |
55 | 87 UPDATE_ALL = (UPDATE_PICTURE | UPDATE_POS | UPDATE_ALPHA | UPDATE_SNUM | UPDATE_CLIP | UPDATE_VISIBLE), |
0 | 88 ANM_PLAYSTART = 0x8000, ANM_PLAYING = 0x10000, |
89 DIG_ZERO = 0x10000*2, DIG_SIGN = 0x10000*4, DIG_PACK=0x10000*8,DIG_SPACE=0x10000*16 | |
90 }; | |
91 Attribute attr; | |
92 | |
93 GrpObj(void); | |
94 ~GrpObj(void); | |
95 | |
96 void SetPos(int index, int x, int y); | |
97 void GetPos(int index, int& x, int& y); | |
98 int PosX(void); | |
99 int PosY(void); | |
100 void SetAlpha(void); | |
101 void SetAlpha(int alpha); | |
102 void SetSurfaceNum(int num = -1); | |
103 void SetZoomRotate(int zoom=-1, int rotate=-1); | |
104 void SetClipArea(int x, int y, int width, int height); | |
105 void GetSrcGeom(int& width, int& height); | |
106 void SetUpdate(void); | |
107 void UpdateMoji(void); | |
108 void UpdateDigit(void); | |
109 void UpdateSurface(void); | |
110 void ZoomRotate(void); | |
55 | 111 void Refresh(GrpObj& parent_obj); |
112 void _debug_Dump(int, int); | |
0 | 113 void Update(void); |
114 void CreateSurface(PicContainer* parent); | |
115 void CreateGan(Event::Container& event, int event_number); | |
116 void CreateGanSpecial(Event::Container& event, int event_number, int time); | |
117 PicBase* DeletePic(void); | |
118 }; | |
119 | |
120 /******************************************************************* | |
121 ** GrpObj(interface) | |
122 */ | |
123 | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
124 class GrpImpl : public CommandHandler { |
0 | 125 #define MAXPDT 256 |
126 #define WORKPDT 255 | |
52 | 127 private: |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
128 void CreateObj(int number); |
55 | 129 void CreateSubObj(int grp_num, int number); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
130 void ZMoveObj(int number); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
131 void SetObjChanged(int number); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
132 void SwapObj(int a1, int a2); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
133 void DeleteObjPic(int num);// object の surface のみ削除 |
55 | 134 void DeleteSubObjPic(int grp_num, int num); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
135 void DeleteObj(int num); |
55 | 136 void DeleteSubObj(int grp_num, int num); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
137 void RefreshObj(void); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
138 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
139 Surface* Dsurface(int pdt); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
140 Surface* Ssurface(int pdt); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
141 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
142 // cgmode 用画像処理関連 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
143 void LoadCgm(void); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
144 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
145 public: |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
146 GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& _flag, set<int>& _cgm_data); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
147 ~GrpImpl(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
148 bool Wait(unsigned int current_time, Cmd& cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
149 void Exec(Cmd& cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
150 void InitSel(void); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
151 void Save(std::string& str); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
152 void Load(const char* str); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
153 void SaveSys(std::string& str); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
154 void LoadSys(const char* str); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
155 void SetSkipMode(SkipMode _mode); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
156 void LoadSurface(const char* str, int pdt); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
157 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
158 private: |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
159 void LoadSurface(const char* str); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
160 void LoadSurface(void); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
161 void AddSurface(const char* str); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
162 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
163 void StartAnm(int type); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
164 void StartShake(int total, const int* pattern); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
165 void AbortAnm(void); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
166 static bool Pressed(int x, int y, void* pointer); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
167 |
55 | 168 GrpObj* GetGraphicObj(int grp, bool fg=true); |
169 GrpObj* GetGraphicObj(int grp, int index, bool fg=true); | |
170 GrpObj* GetGraphicObjVarMode(Cmd& cmd, int &base_arg, bool fg=true); | |
171 | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
172 // Opcode handling |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
173 void impl_stackClear(Cmd& cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
174 void impl_grpBuffer(Cmd& cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
175 void impl_grpMulti(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
176 void impl_grpOpen(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
177 void impl_shake(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
178 void impl_grpCopy(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
179 void impl_recFill(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
180 void impl_recCopy(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
181 void impl_recAdd(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
182 void impl_grpPan(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
183 void impl_snmPlay(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
184 void impl_snmBgScroll(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
185 void impl_cgGet(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
186 void impl_cgStatus(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
187 void impl_objClear(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
188 void impl_createObj(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
189 void impl_gan(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
190 void impl_objSetPos(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
191 void impl_objAlpha(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
192 void impl_objShow(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
193 void impl_objColour(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
194 void impl_objComposite(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
195 void impl_objSetText(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
196 void impl_objTextOpts(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
197 void impl_objOrder(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
198 void impl_objDispArea(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
199 void impl_objSetDigits(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
200 void impl_objNumOpts(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
201 void impl_objPattNo(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
202 void impl_objScale(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
203 void impl_objRotate(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
204 void impl_objPosDims(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
205 void impl_refresh(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
206 void impl_bgmLoop(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
207 void impl_bgmStop(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
208 void impl_playWav(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
209 void impl_playSE(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
210 void impl_stopWav(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
211 void impl_SetVolMod(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
212 void impl_GetVolMod(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
213 void impl_koePlay(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
214 void impl_movPlay(Cmd &cmd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
215 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
216 public: |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
217 AyuSysConfig *config; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
218 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
219 private: |
52 | 220 Event::Container& event; |
221 const Flags& flags; | |
222 PicBase* screen; | |
223 PicBase* screen_front; | |
224 Surface* surface, *surface_update; | |
0 | 225 |
52 | 226 Surface* dsurface[MAXPDT]; // 書き込み可能な Surface |
227 Surface* ssurface[MAXPDT]; // ファイルの内容等、読み込みのみ可能な状態の Surface | |
228 PicContainer& parent; | |
0 | 229 |
52 | 230 // 画像効果の保存用 |
231 WidAnmTime* anm1, *anm2; | |
232 typedef enum { NORMAL, WAIT_ANM, WAIT_SHAKE, WAIT_SE, WAIT_MOVIE} Status; | |
233 Status status; | |
234 SkipMode skip_mode; | |
0 | 235 |
52 | 236 std::string bg_name; |
237 std::map<int, SEL> anmtype; | |
238 GrpObjMap grpobj; | |
239 GrpObjMap bs_obj; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
240 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
241 std::map<std::string, int> cgm_info; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
242 set<int>& cgm_data; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
243 int cgm_size; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
244 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
245 class MuSys *music; |
0 | 246 |
52 | 247 std::set<int> changed_obj; |
248 string reserved_load_surface0; | |
249 vector<PicBase*> deleted_pic; | |
0 | 250 }; |
251 /******************************************************************* | |
252 ** GrpObj(implementation) | |
253 */ | |
254 | |
255 GrpObj::GrpObj(void) : | |
256 name(""), gan_name(""), pic_parent(0), picture(0), anm(0), | |
257 _posx(0), _posy(0), clip_area(0,0,0,0), | |
258 alpha(255), order(0), surface_num(0), print_moji(""), print_size(0), print_r(-1),print_g(-1),print_b(-1), | |
259 dig_number(0), dig_digit(0), | |
55 | 260 zoom(-1), rotate(-1), attr(GrpObj::HIDDEN) { |
0 | 261 int i; |
262 for (i=0; i<9; i++) { | |
263 posx[i] = posy[i] = 0; | |
264 } | |
265 } | |
52 | 266 |
0 | 267 GrpObj::~GrpObj() { |
55 | 268 if (picture != NULL) delete picture; |
0 | 269 } |
52 | 270 |
0 | 271 int GrpObj::PosX() { |
272 return _posx; | |
273 } | |
52 | 274 |
0 | 275 int GrpObj::PosY() { |
276 return _posy; | |
277 } | |
52 | 278 |
0 | 279 void GrpObj::SetUpdate(void) { |
280 attr = Attribute (attr | UPDATE_PICTURE); | |
18 | 281 //Update(); //FIXME |
0 | 282 } |
52 | 283 |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
284 void GrpObj::SetPos(int index, int x, int y) { |
0 | 285 if (index < 0 || index > 8) { |
286 fprintf(stderr,"GrpObj::SetPos: Invalid index %d <- %d,%d\n",index,x,y); | |
287 return; | |
288 } | |
289 if (x == posx[index] && y == posy[index]) return; | |
290 attr = Attribute(attr | UPDATE_POS); | |
291 _posx += x-posx[index]; | |
292 _posy += y-posy[index]; | |
293 posx[index] = x; | |
294 posy[index] = y; | |
295 } | |
52 | 296 |
0 | 297 void GrpObj::GetPos(int index, int& x, int& y) { |
298 if (index < 0 || index > 8) { | |
299 fprintf(stderr,"GrpObj::GetPos: Invalid index %d\n",index); | |
300 x = 0; y = 0; | |
301 return; | |
302 } | |
303 x = posx[index]; | |
304 y = posy[index]; | |
305 } | |
52 | 306 |
0 | 307 void GrpObj::SetAlpha(int new_alpha) { |
308 if (alpha == new_alpha) return; | |
309 alpha = new_alpha; | |
310 attr = Attribute(attr | UPDATE_ALPHA); | |
311 return; | |
312 } | |
52 | 313 |
0 | 314 void GrpObj::SetSurfaceNum(int num) { |
315 if (num != -1) { | |
316 if (surface_num == num) return; | |
317 surface_num = num; | |
318 } | |
319 attr = Attribute(attr | UPDATE_SNUM); | |
320 } | |
321 | |
322 void GrpObj::SetClipArea(int x, int y, int w, int h) { | |
323 Rect new_clip(x,y,x+w,y+h); | |
324 if (clip_area == new_clip) return; | |
325 clip_area = new_clip; | |
326 attr = Attribute(attr | UPDATE_CLIP); | |
327 } | |
52 | 328 |
0 | 329 PicBase* GrpObj::DeletePic(void) { |
330 PicBase* p = picture; | |
55 | 331 anm = NULL; |
332 picture = NULL; | |
0 | 333 src_pos.clear(); |
55 | 334 attr = Attribute(attr & HIDDEN); |
0 | 335 return p; |
336 } | |
52 | 337 |
0 | 338 void GrpObj::GetSrcGeom(int& width, int& height) { |
339 if (src_pos.empty()) { | |
340 width = 0; height = 0; | |
341 if (name.length() == 0) { | |
342 return; | |
343 } | |
344 /* ボタンの位置情報を求める */ | |
345 /* g00 ファイルのヘッダ部分に位置情報は入っている */ | |
346 string path(name); | |
347 path += ".g00"; | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
348 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::PDT, path.c_str(), "g00"); |
52 | 349 if (info == NULL) { // ファイルが見つからない |
350 fprintf(stderr, "GrpObj::GetSrcGeom : Cannot find file %s\n", path.c_str()); | |
0 | 351 return; |
352 } | |
353 const char* data = info->Read(); | |
52 | 354 if (data != NULL && *data == 2) { // 画像ファイル内にボタン情報が存在する |
0 | 355 int srclen = read_little_endian_int(data+5); |
356 int i; | |
357 for (i=0; i<srclen; i++) { | |
358 int x1 = read_little_endian_int(data+9+i*24+0); | |
359 int y1 = read_little_endian_int(data+9+i*24+4); | |
360 int x2 = read_little_endian_int(data+9+i*24+8); | |
361 int y2 = read_little_endian_int(data+9+i*24+12); | |
362 src_pos.push_back(Rect(x1, y1, x2+1, y2+1)); | |
363 if (width < src_pos.back().width()) width = src_pos.back().width(); | |
364 if (height < src_pos.back().height()) height = src_pos.back().height(); | |
365 } | |
366 } else { // 画像ファイルから大きさ取得 | |
367 width = read_little_endian_short(data+1); | |
368 height = read_little_endian_short(data+3); | |
369 src_pos.push_back(Rect(0,0,width,height)); | |
370 } | |
371 delete info; | |
372 } | |
373 int sn = surface_num; | |
374 if (sn < 0 || sn > src_pos.size()) sn = 0; | |
375 width = src_pos[sn].width(); | |
376 height = src_pos[sn].height(); | |
377 } | |
52 | 378 |
0 | 379 void GrpObj::Update(void) { |
380 if (attr & UPDATE_PICTURE) { | |
381 UpdateSurface(); | |
382 attr = Attribute( (attr | UPDATE_ALL) & (~UPDATE_PICTURE)); | |
383 } | |
55 | 384 if (picture == NULL) return; |
0 | 385 if (attr & UPDATE_POS) { |
18 | 386 if ( (attr & SATURATE) || zoom != -1) { |
0 | 387 int w=0, h=0; |
388 GetSrcGeom(w,h); | |
389 picture->Move(_posx-w/2, _posy-h/2); | |
390 } else { | |
391 picture->Move(_posx, _posy); | |
392 } | |
393 } | |
394 if (attr & UPDATE_ALPHA) { | |
395 if (alpha <= 0) { | |
396 picture->SetSurfaceAlpha(0, Rect(0,0)); | |
397 picture->hide(); | |
398 } else if (alpha >= ALPHA_MAX) { | |
399 picture->SetSurfaceAlpha(0, Rect(0,0)); | |
400 if (attr & HIDDEN) picture->hide(); | |
401 else picture->show(); | |
402 } else { | |
403 picture->SetSurfaceAlpha(&alpha, Rect(0,0,1,1)); | |
404 if (attr & HIDDEN) picture->hide(); | |
405 else picture->show(); | |
406 } | |
407 } | |
408 if ( (attr & UPDATE_SNUM) && (!src_pos.empty())) { | |
409 if (surface_num < 0 || surface_num >= src_pos.size()) surface_num = 0; | |
410 picture->SetSurfacePos(src_pos[surface_num].lx, src_pos[surface_num].ty); | |
411 } | |
412 if (attr & UPDATE_CLIP) { | |
413 picture->SetClipArea(clip_area); | |
414 } | |
415 attr = Attribute(attr & (~UPDATE_ALL)); | |
416 if (attr & ANM_PLAYSTART) { | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
417 if (anm != NULL) { |
0 | 418 anm->Play(); |
419 attr = Attribute(attr | ANM_PLAYING); | |
420 } | |
421 attr = Attribute(attr & (~ANM_PLAYSTART)); | |
422 } | |
423 } | |
52 | 424 |
0 | 425 void GrpObj::CreateSurface(PicContainer* parent) { |
52 | 426 if (picture != NULL) { |
0 | 427 PicBase* p = DeletePic(); |
428 delete p; | |
429 } | |
430 src_pos.clear(); | |
431 // picture を作成 | |
432 pic_parent = parent; | |
433 picture = parent->create_leaf(Rect(_posx,_posy,_posx+1,_posy+1), 0); | |
434 picture->hide(); | |
435 UpdateSurface(); | |
436 } | |
437 | |
438 void GrpObj::UpdateSurface(void) { | |
52 | 439 if (pic_parent == NULL || picture == NULL) return; |
0 | 440 int width = 0, height = 0; |
441 if (gtype == FILE || gtype == GAN) { | |
442 if (name.length() == 0) return; | |
443 // ファイル名が存在する場合、ファイルを読み込み | |
444 GetSrcGeom(width, height); | |
445 if (width <= 0 || height <= 0) return; | |
446 // surface の設定 | |
447 if (surface_num == 0 && ( (zoom > 0 && zoom != 256) || rotate > 0)) { | |
448 ZoomRotate(); | |
449 } else { | |
450 // 普通に surface を設定 | |
451 string path(name); | |
452 path += ".g00"; | |
453 picture->SetSurface(path.c_str(), 0, 0); | |
454 picture->SetSurfaceRect(Rect(0,0,width,height)); | |
455 } | |
456 if (attr & SATURATE) | |
457 picture->SetSurfaceAttribute(PicBase::BLIT_SATURATE); | |
458 } else if (gtype == MOJI) { // テキスト描画 | |
459 if (print_moji.length() == 0) return; | |
460 UpdateMoji(); | |
461 } else if (gtype == DIGIT) { // 数値を画像表示 | |
462 UpdateDigit(); | |
463 } | |
464 } | |
52 | 465 |
0 | 466 void GrpObj::ZoomRotate(void) { |
52 | 467 picture->SetSurface( (Surface*)0, 0, 0); |
0 | 468 |
469 // 回転、縮小拡大は座標原点が画像の中心になる | |
470 string path(name); | |
471 path += ".g00"; | |
472 Surface* surface_orig = pic_parent->Root().NewSurface(path.c_str()); | |
52 | 473 if (surface_orig == NULL) return; |
0 | 474 |
475 Surface* zoom_surface = pic_parent->Root().RotZoomSurface(surface_orig, double(zoom)/256.0, rotate); | |
476 Rect zoom_r (*zoom_surface); | |
477 picture->SetSurface(zoom_surface, 0, 0); | |
478 picture->SetSurfaceFreeFlag(); | |
479 //picture->Move(PosX() + - zoom_r.width()/2, PosY() + - zoom_r.height()/2); | |
480 // 中心座標がわからん・・・ | |
481 picture->Move(320 - zoom_r.width()/2, 240 - zoom_r.height()/2); | |
482 picture->SetSurfaceRect(Rect(0, 0, zoom_r.width(), zoom_r.height())); | |
483 | |
484 pic_parent->Root().DeleteSurface(surface_orig); | |
485 } | |
486 | |
487 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
|
488 if (print_moji.length() == 0 || print_size <= 2) return; |
0 | 489 if (pic_parent == 0) return; |
490 /* テキストの大きさを得る */ | |
491 int r, g, b; | |
492 if (print_r == -1 || print_g == -1 || print_b == -1) {// 色設定なし | |
493 r = g = b = 0; // とりあえず黒(clannad のSave/Loadメニュー用) | |
494 } else { | |
495 r = print_r; | |
496 g = print_g; | |
497 b = print_b; | |
498 } | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
499 TextStream ts = TextStream::ParseMoji(print_moji.c_str(), r, g, b, print_size); |
0 | 500 TextGlyphStream gs; |
501 vector<int> lh; | |
502 // とりあえず drawable width は充分に大きく(2048)取る | |
503 DefaultLayout(print_size-2)->Layout(ts, gs, lh, 2048); // print_size そのままだと弱干大きすぎるので -2 | |
504 int width = gs.width(); | |
505 int height = gs.height(); | |
506 Surface* surface = pic_parent->Root().NewSurface(width, height, ALPHA_MASK); | |
507 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0); | |
508 DSurfaceRenderText(gs.begin(), gs.end(), Rect(0, 0, width, height), surface, Rect(0,0)); | |
509 picture->SetSurface(surface, 0, 0); | |
510 picture->SetSurfaceRect(Rect(0,0,width,height)); | |
511 picture->SetSurfaceFreeFlag(); | |
512 } | |
52 | 513 |
0 | 514 void GrpObj::UpdateDigit(void) { |
515 // 画像表示の数値文字列を表示する | |
516 if (name.length() == 0) return; | |
517 // ファイル名が存在する場合、ファイルを読み込み | |
518 string path(name); | |
519 path += ".g00"; | |
520 Surface* surface_orig = pic_parent->Root().NewSurface(path.c_str()); | |
52 | 521 if (surface_orig == NULL) return; |
0 | 522 |
523 int width, height; | |
524 int i; | |
525 GetSrcGeom(width, height); | |
526 if (width <= 0 || height <= 0) return; | |
527 if (src_pos.size() < 14) { | |
528 // 必要な数の object がない | |
529 // 表示できない分の空の rect を追加しておく | |
530 for (i=src_pos.size(); i<14; i++) | |
531 src_pos.push_back(Rect(0,0,0,0)); | |
532 pic_parent->Root().DeleteSurface(surface_orig); | |
533 return; | |
534 } | |
535 // 桁数の計算 | |
536 char num_str[20]; | |
537 if (dig_number < 0) sprintf(num_str, "%d", -dig_number); | |
538 else sprintf(num_str, "%d", dig_number); | |
539 int sign_count = 0; | |
540 int space_count = 0; | |
541 int total_count; | |
542 int dig_count = strlen(num_str); | |
543 if (dig_number < 0 && (attr&DIG_SIGN) == 0) dig_count++; | |
544 if (dig_count < dig_digit) space_count = dig_digit - dig_count; | |
545 if (attr & DIG_SIGN) sign_count = 1; | |
546 total_count = dig_count + space_count + sign_count; | |
547 | |
548 Surface* surface = pic_parent->Root().NewSurface(width*total_count, height, ALPHA_MASK); | |
549 DSurfaceFill(surface, Rect(*surface), 0, 0, 0, 0); | |
550 | |
551 /* surface にコピーする */ | |
552 int cur_x = 0; | |
553 if ( (attr & DIG_PACK) && !(attr & DIG_ZERO)) { // 始めに空白を挿入 | |
554 cur_x += space_count * width; | |
555 } | |
556 int plus = 10, minus = 11, plusminus = 12; | |
557 if (dig_number < 0) { | |
558 DSurfaceMove(surface, src_pos[minus], surface, Rect(cur_x,0)); | |
559 cur_x += width; | |
560 } else if (attr & DIG_SIGN) { | |
561 if (dig_number == 0) | |
562 DSurfaceMove(surface, src_pos[plusminus], surface, Rect(cur_x,0)); | |
563 else | |
564 DSurfaceMove(surface, src_pos[plus], surface, Rect(cur_x,0)); | |
565 cur_x += width; | |
566 } | |
567 if (attr & DIG_ZERO) { // ゼロ・パディング | |
568 for (i=0; i<space_count; i++) { | |
569 DSurfaceMove(surface, src_pos[0], surface, Rect(cur_x, 0)); | |
570 cur_x += width;; | |
571 } | |
572 } else if (!(attr & DIG_PACK)) { // PACK オプションなし | |
573 cur_x += space_count * width; | |
574 } | |
575 for (i=0; num_str[i] != 0; i++) { | |
576 DSurfaceMove(surface_orig, src_pos[num_str[i]-'0'], surface, Rect(cur_x, 0)); | |
577 cur_x += width; | |
578 } | |
579 | |
580 /* picture に設定 */ | |
581 picture->SetSurface(surface, 0, 0); | |
582 picture->SetSurfaceRect(Rect(0,0,width*total_count,height)); | |
583 picture->SetSurfaceFreeFlag(); | |
584 | |
585 pic_parent->Root().DeleteSurface(surface_orig); | |
586 } | |
52 | 587 |
0 | 588 void GrpObj::CreateGan(Event::Container& event, int event_number) { |
52 | 589 if (picture == NULL) { |
0 | 590 fprintf(stderr,"GrpObj::CreateGan() is called before Create()\n"); |
591 return; | |
592 } | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
593 if (anm != NULL) { |
0 | 594 anm->Abort(); |
595 delete anm; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
596 anm = NULL; |
0 | 597 } |
598 if (gan_name.empty()) return; | |
599 /* アニーメション情報 (.GAN ファイル)を求める */ | |
600 string path(gan_name); | |
601 path += ".gan"; | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
602 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::GAN, path.c_str(), "gan"); |
52 | 603 if (info == NULL) { |
0 | 604 fprintf(stderr,"GrpObj::CreateGan: Cannot Find 'GAN' file %s\n", path.c_str()); |
605 return; | |
606 } | |
607 const char* data = info->Read(); | |
608 if (read_little_endian_int(data) != 10000 || read_little_endian_int(data+4) != 10000) { | |
609 fprintf(stderr,"GrpObj::CreateGan: Invalid'GAN' file %s\n", path.c_str()); | |
610 delete info; | |
611 return; | |
612 } | |
613 | |
614 picture->SetSurfaceAttribute(PicBase::BLIT_SATURATE); | |
615 attr = Attribute(attr | UPDATE_POS | SATURATE); | |
616 | |
617 const char* buf = data + 16; | |
618 buf += strlen(buf) + 1; // 画像ファイル名が入っている | |
619 buf += 4; // 定数 20000 | |
620 int pics = read_little_endian_int(buf); buf += 4; // 複数のアニメーション情報が入っている場合、情報数 | |
621 // 以下、pics 回繰り返し | |
622 // アニメーションを行う実体を作成 | |
623 AnmAlphaMove* wid = new AnmAlphaMove(event, picture); | |
624 | |
625 if (event_number && event_number < pics) { // 複数のアニメーション情報がある場合、先の情報を読み飛ばす */ | |
626 int i; for (i=0; i<event_number; i++) { | |
627 buf += 4; // 定数 30000 | |
628 int ptns = read_little_endian_int(buf); buf += 4; | |
629 buf += ptns*52; | |
630 } | |
631 } | |
632 buf += 4; // 定数 30000 | |
633 int ptns = read_little_endian_int(buf); buf += 4; | |
634 int total_time = 0; | |
635 int i; | |
636 for (i=0; i<ptns; i++) { | |
637 int p = read_little_endian_int(buf+i*52+0*8+4); | |
638 int x = read_little_endian_int(buf+i*52+1*8+4); | |
639 int y = read_little_endian_int(buf+i*52+2*8+4); | |
640 int t = read_little_endian_int(buf+i*52+3*8+4); | |
641 int a = read_little_endian_int(buf+i*52+4*8+4); | |
642 x += PosX(); | |
643 y += PosY(); | |
644 if (p == -1) { a = 0; p = 0; } // p == -1 ならなにも表示しない | |
645 if (p >= src_pos.size()) { | |
646 fprintf(stderr,"Reading GAN file %s (G00 %s) : not enough pictures in .G00 file\n", path.c_str(), name.c_str()); | |
647 a = 0; p = 0; | |
648 } | |
649 total_time += t; | |
650 wid->ptns.push_back(AnmAlphaMove::Ptn(Rect(x,y), src_pos[p], a, total_time)); | |
651 } | |
652 wid->SetPtn(); // パターン登録終了 | |
653 attr = Attribute(attr | ANM_PLAYSTART); | |
654 anm = wid; | |
52 | 655 } |
656 | |
0 | 657 void GrpObj::CreateGanSpecial(Event::Container& event, int event_number, int time) { |
52 | 658 if (picture == NULL) { |
0 | 659 fprintf(stderr,"GrpObj::CreateGan() is called before Create()\n"); |
660 return; | |
661 } | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
662 if (anm != NULL) { |
0 | 663 anm->Abort(); |
664 delete anm; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
665 anm = NULL; |
0 | 666 } |
667 | |
668 // アニメーションを行う実体を作成 | |
669 AnmAlphaMove* wid = new AnmAlphaMove(event, picture); | |
670 | |
671 int i; | |
672 switch(event_number) { | |
52 | 673 case 0: // pattern を 0 から最後まで変化させる |
674 for (i=0; i<src_pos.size(); i++) { | |
675 wid->ptns.push_back(AnmAlphaMove::Ptn(Rect(PosX(), PosY()), src_pos[i], 255, time*i)); | |
676 } | |
677 wid->SetPtn(); // パターン登録終了 | |
678 anm = wid; | |
679 attr = Attribute(attr | ANM_PLAYSTART); | |
680 break; | |
681 default: | |
682 break; | |
0 | 683 } |
52 | 684 } |
0 | 685 |
686 void GrpObj::SetZoomRotate(int new_zoom, int new_rotate) { | |
687 if (zoom == new_zoom && rotate == new_rotate) return; | |
18 | 688 if ( zoom == -1 || new_zoom == -1) { |
689 attr = Attribute(attr | UPDATE_POS); // centering する | |
690 } | |
691 zoom = new_zoom; | |
0 | 692 if (new_rotate != -1) rotate = new_rotate; |
693 if (zoom < 0) zoom = 256; | |
694 if (rotate < 0) rotate = 0; | |
695 else if (rotate > 360) rotate %= 360; | |
696 | |
697 attr = Attribute(attr | UPDATE_PICTURE); | |
698 } | |
55 | 699 |
700 void GrpObj::Refresh(GrpObj& parent_obj) { | |
701 //if (&parent_obj != this) printf("Toto\n"); //FIXME | |
702 | |
703 GrpObjMap::iterator it; | |
704 | |
705 for (it = children_obj.begin(); it != children_obj.end(); it++) | |
706 it->second.Refresh(parent_obj); | |
707 | |
708 if (picture == NULL) return; | |
709 if (alpha == 0 || (attr & GrpObj::HIDDEN) || (parent_obj.attr & GrpObj::HIDDEN)) { | |
710 if (attr & GrpObj::ANM_PLAYING) { | |
711 attr = GrpObj::Attribute(attr & ~(GrpObj::ANM_PLAYING)); | |
712 if (anm != NULL) anm->Abort(); | |
713 } | |
714 picture->hide(); | |
715 } else { | |
716 Update(); | |
717 picture->show(); | |
718 } | |
719 } | |
720 | |
721 void GrpObj::_debug_Dump(int id, int indent) | |
722 { | |
723 const char* repr; | |
724 | |
725 if (indent == 0) | |
726 repr = "obj %04d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n"; | |
727 else | |
728 repr = " * obj %04d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n"; | |
729 | |
730 if (picture != NULL) { | |
731 if (!name.empty()) | |
732 fprintf(stderr, repr, | |
733 id, this, name.c_str(), PosX(), PosY(), alpha, attr&GrpObj::HIDDEN ? 1 : 0, 0, | |
734 picture->IsHidden()); | |
735 else if (!print_moji.empty()) | |
736 fprintf(stderr, repr, | |
737 id, this, print_moji.c_str(), PosX(), PosY(), alpha, attr&GrpObj::HIDDEN ? 1 : 0, | |
738 0, picture->IsHidden()); | |
739 else | |
740 fprintf(stderr, repr, | |
741 id, this, "<EMPTY>", PosX(), PosY(), alpha, attr&GrpObj::HIDDEN ? 1 : 0, 0, | |
742 picture->IsHidden()); | |
743 } | |
744 | |
745 GrpObjMap::iterator it; | |
746 for (it = children_obj.begin(); it != children_obj.end(); it++) | |
747 it->second._debug_Dump(it->first, indent+1); | |
748 } | |
749 | |
0 | 750 /****************************************************************** |
751 ** | |
752 ** class ScnGrp* | |
753 */ | |
754 /* Princess Bride: 背景画の一部のみ移動、の実装 */ | |
755 struct ScnGrpMove : public WidAnmTime { | |
756 Surface* dest; | |
757 Surface* src; | |
758 PicRoot& root; | |
759 Rect dest_r, from, to; | |
760 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); | |
761 void Exec(int count); | |
762 }; | |
763 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) : | |
764 WidAnmTime(container, _pic, total_time), | |
765 dest(_dest), src(_src), root(_root),dest_r(_dest_r), from(_from), to(_to) { | |
766 int dx = to.lx - from.lx; | |
767 int dy = to.ty - from.ty; | |
768 if (dx < 0) dx = -dx; | |
769 if (dy < 0) dy = -dy; | |
770 if (dx < dy) dx = dy; | |
771 if (dx == 0) dx = 1; | |
772 SetAllCount(dx); | |
773 } | |
52 | 774 |
0 | 775 void ScnGrpMove::Exec(int count) { |
776 Rect r(0,0,dest_r.width(),dest_r.height()); | |
777 int dx = to.lx - from.lx; | |
778 int dy = to.ty - from.ty; | |
779 int x = dx*count/all_count + from.lx; | |
780 int y = dy*count/all_count + from.ty; | |
781 r.rmove(x, y); | |
782 root.BlitSurface(src, r, dest, dest_r); | |
783 iterator it; | |
784 for (it=pic.begin(); it!=pic.end(); it++) | |
785 (*it)->SetSurface(dest, 0, 0); | |
786 } | |
787 | |
788 /* Princess Bride: カードがおちるアニメーション */ | |
789 | |
790 struct ScnGrpAnmAtom { | |
791 string name; | |
792 int time; | |
793 ScnGrpAnmAtom(const char* _n, int _t) : name(_n), time(_t) {} | |
794 }; | |
52 | 795 |
0 | 796 struct ScnGrpAnm : public WidAnmTime, vector<ScnGrpAnmAtom> { |
797 GrpImpl& owner; | |
798 ScnGrpAnm(Event::Container& container, PicBase* _pic, GrpImpl& _owner) : | |
799 WidAnmTime(container, _pic, 0), owner(_owner) { | |
800 } | |
801 void CalcTotal(void); | |
802 void Exec(int count); | |
803 }; | |
52 | 804 |
0 | 805 void ScnGrpAnm::CalcTotal(void) { |
806 /* total time を計算 */ | |
807 if (empty()) return; | |
808 int tm = 0; | |
809 vector<ScnGrpAnmAtom>::iterator it; | |
810 for (it=begin(); it != end(); it++) tm += it->time; | |
811 total_time = tm; | |
812 SetAllCount(tm); | |
813 } | |
52 | 814 |
0 | 815 void ScnGrpAnm::Exec(int count) { |
816 int tm = 0; vector<ScnGrpAnmAtom>::iterator it; | |
817 for (it=begin(); it != end(); it++) { | |
818 tm += it->time; | |
819 if (count < tm) break; | |
820 } | |
821 if (it == end()) it--; | |
822 owner.LoadSurface(it->name.c_str(), 0); | |
823 } | |
824 | |
825 | |
826 /***************************************************** | |
827 * | |
828 * GrpImpl(implementation) : 定義 | |
829 * | |
830 */ | |
831 | |
52 | 832 #include "music2/music.h" |
0 | 833 |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
834 GrpImpl::GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm_data): |
0 | 835 event(_event), |
836 flags(f), | |
837 parent(_parent), | |
838 status(NORMAL), | |
839 skip_mode(SKIP_NO), | |
55 | 840 cgm_data(_cgm_data) |
0 | 841 { |
842 int i; | |
843 for (i=0; i<MAXPDT; i++) { | |
844 ssurface[i] = 0; | |
845 dsurface[i] = 0; | |
846 } | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
847 |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
848 music = MuSys::GetInstance(); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
849 config = AyuSysConfig::GetInstance(); |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
850 |
0 | 851 screen = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); |
852 screen_front = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | |
853 surface = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); | |
854 surface_update = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); | |
855 DSurfaceFill(surface, Rect(*surface), 0, 0, 0); | |
856 DSurfaceFill(surface_update, Rect(*surface), 0, 0, 0); | |
857 screen->SetSurface(surface, 0, 0); | |
858 screen->show(); | |
859 screen_front->hide(); | |
860 screen_front->ZMove(screen); | |
861 | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
862 LoadCgm(); |
0 | 863 |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
864 RegisterCommand(1, 30, 0, "stackClear", (CmdImpl) &GrpImpl::impl_stackClear); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
865 RegisterCommand(1, 33, 70, "grpBuffer", (CmdImpl) &GrpImpl::impl_grpBuffer); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
866 RegisterCommand(1, 33, 73, "grpOpenBG", (CmdImpl) &GrpImpl::impl_grpOpen); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
867 RegisterCommand(1, 33, 75, "grpMulti", (CmdImpl) &GrpImpl::impl_grpMulti); //FIXME: or not... |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
868 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &GrpImpl::impl_grpOpen); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
869 RegisterCommand(1, 33, 32, "shake", (CmdImpl) &GrpImpl::impl_shake); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
870 RegisterCommand(1, 33, 100, "grpCopy", (CmdImpl) &GrpImpl::impl_grpCopy); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
871 RegisterCommand(1, 33, 1201, "recFill", (CmdImpl) &GrpImpl::impl_recFill); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
872 RegisterCommand(1, 33, 1100, "recCopy", (CmdImpl) &GrpImpl::impl_recCopy); |
55 | 873 RegisterCommand(1, 33, 1101, "recMaskCopy", NULL); //FIXME |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
874 RegisterCommand(1, 33, 1600, "recAdd", (CmdImpl) &GrpImpl::impl_recAdd); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
875 RegisterCommand(1, 33, 406, "grpPan", (CmdImpl) &GrpImpl::impl_grpPan); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
876 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
877 RegisterCommand(1, 34, 3120, "snmBgScroll", (CmdImpl) &GrpImpl::impl_snmBgScroll); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
878 RegisterCommand(1, 34, 3100, "snmBgPlay", (CmdImpl) &GrpImpl::impl_snmPlay); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
879 RegisterCommand(1, 34, 2100, "snmPlay", (CmdImpl) &GrpImpl::impl_snmPlay); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
880 RegisterCommand(1, 34, 2101, "snmPlayEx", (CmdImpl) &GrpImpl::impl_snmPlay); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
881 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
882 RegisterCommand(1, 4, 1500, "cgGetTotal", (CmdImpl) &GrpImpl::impl_cgGet); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
883 RegisterCommand(1, 4, 1501, "cgGetViewed", (CmdImpl) &GrpImpl::impl_cgGet); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
884 RegisterCommand(1, 4, 1502, "cgGetViewedPcnt", (CmdImpl) &GrpImpl::impl_cgGet); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
885 RegisterCommand(1, 4, 1503, "cgGetFlag", (CmdImpl) &GrpImpl::impl_cgStatus); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
886 RegisterCommand(1, 4, 1504, "cgStatus", (CmdImpl) &GrpImpl::impl_cgStatus); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
887 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
888 RegisterCommand(1, 4, 0x6a4, "CreateInput", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
889 RegisterCommand(1, 4, 0x6ae, "SetInput", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
890 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
891 RegisterCommand(1, 61, 10, "objClear", (CmdImpl) &GrpImpl::impl_objClear); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
892 RegisterCommand(1, 61, 11, "objDelete", (CmdImpl) &GrpImpl::impl_objClear); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
893 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
894 RegisterCommand(1, 71, 1000, "createObjG00", (CmdImpl) &GrpImpl::impl_createObj); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
895 RegisterCommand(1, 71, 1003, "createObjGAN", (CmdImpl) &GrpImpl::impl_createObj); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
896 RegisterCommand(1, 71, 1100, "createObjRect", (CmdImpl) &GrpImpl::impl_createObj); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
897 RegisterCommand(1, 71, 1200, "createObjText", (CmdImpl) &GrpImpl::impl_createObj); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
898 RegisterCommand(1, 71, 1300, "createObjWeaver", (CmdImpl) &GrpImpl::impl_createObj); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
899 RegisterCommand(1, 71, 1400, "createObjDigit", (CmdImpl) &GrpImpl::impl_createObj); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
900 |
55 | 901 RegisterCommand(2, 71, 1000, "createSubObjG00", (CmdImpl) &GrpImpl::impl_createObj); |
902 RegisterCommand(2, 71, 1003, "createSubObjGAN", (CmdImpl) &GrpImpl::impl_createObj); | |
903 RegisterCommand(2, 71, 1100, "createSubObjRect", (CmdImpl) &GrpImpl::impl_createObj); | |
904 RegisterCommand(2, 71, 1200, "createSubObjText", (CmdImpl) &GrpImpl::impl_createObj); | |
905 RegisterCommand(2, 71, 1300, "createSubObjWeaver", (CmdImpl) &GrpImpl::impl_createObj); | |
906 RegisterCommand(2, 71, 1400, "createSubObjDigit", (CmdImpl) &GrpImpl::impl_createObj); | |
907 | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
908 //I suppose it's the same thing as createObj*, but I didn't see it in action. For now, mark it unhandled. |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
909 RegisterCommand(1, 72, 1000, "createBgObjG00", (CmdImpl) &GrpImpl::impl_createObj); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
910 RegisterCommand(1, 72, 1003, "createBgObjGAN", (CmdImpl) &GrpImpl::impl_createObj); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
911 RegisterCommand(1, 72, 1100, "createBgObjRect", (CmdImpl) &GrpImpl::impl_createObj); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
912 RegisterCommand(1, 72, 1200, "createBgObjText", (CmdImpl) &GrpImpl::impl_createObj); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
913 RegisterCommand(1, 72, 1300, "createBgObjWeaver", (CmdImpl) &GrpImpl::impl_createObj); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
914 RegisterCommand(1, 72, 1400, "createBgObjDigit", (CmdImpl) &GrpImpl::impl_createObj); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
915 |
55 | 916 RegisterCommand(2, 72, 1000, "createBgSubObjG00", NULL);//FIXME |
917 RegisterCommand(2, 72, 1003, "createBgSubObjGAN", NULL);//FIXME | |
918 RegisterCommand(2, 72, 1100, "createBgSubObjRect", NULL);//FIXME | |
919 RegisterCommand(2, 72, 1200, "createBgSubObjText", NULL);//FIXME | |
920 RegisterCommand(2, 72, 1300, "createBgSubObjWeaver", NULL);//FIXME | |
921 RegisterCommand(2, 72, 1400, "createBgSubObjDigit", NULL);//FIXME | |
922 | |
923 | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
924 RegisterCommand(1, 73, 0, "ganStop?", NULL); //That's what xclannad says, but I'm not sure... |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
925 RegisterCommand(1, 73, 1000, "ganStop", (CmdImpl) &GrpImpl::impl_gan); //That's what rldev says |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
926 RegisterCommand(1, 73, 3, "ganIsPlaying", (CmdImpl) &GrpImpl::impl_gan); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
927 RegisterCommand(1, 73, 2003, "objPlay", (CmdImpl) &GrpImpl::impl_gan); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
928 RegisterCommand(1, 73, 1001, "ganLoop", (CmdImpl) &GrpImpl::impl_gan); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
929 RegisterCommand(1, 73, 1003, "ganPlay", (CmdImpl) &GrpImpl::impl_gan); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
930 RegisterCommand(1, 73, 1005, "ganPlayOnce", (CmdImpl) &GrpImpl::impl_gan); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
931 RegisterCommand(1, 73, 3001, "ganLoop2", (CmdImpl) &GrpImpl::impl_gan); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
932 RegisterCommand(1, 73, 3003, "ganPlay2", (CmdImpl) &GrpImpl::impl_gan); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
933 RegisterCommand(1, 73, 3005, "ganPlayOnce2", (CmdImpl) &GrpImpl::impl_gan); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
934 |
55 | 935 RegisterCommand(2, 73, 0, "ganSubStop?", NULL); //FIXME |
936 RegisterCommand(2, 73, 1000, "ganSubStop", NULL); //FIXME | |
937 RegisterCommand(2, 73, 3, "ganSubIsPlaying", NULL); //FIXME | |
938 RegisterCommand(2, 73, 2003, "objSubPlay", NULL); //FIXME | |
939 RegisterCommand(2, 73, 1001, "ganSubLoop", NULL); //FIXME | |
940 RegisterCommand(2, 73, 1003, "ganSubPlay", NULL); //FIXME | |
941 RegisterCommand(2, 73, 1005, "ganSubPlayOnce", NULL); //FIXME | |
942 RegisterCommand(2, 73, 3001, "ganSubLoop2", (CmdImpl) &GrpImpl::impl_gan); //FIXME | |
943 RegisterCommand(2, 73, 3003, "ganSubPlay2", NULL); //FIXME | |
944 RegisterCommand(2, 73, 3005, "ganSubPlayOnce2", NULL); //FIXME | |
945 | |
946 | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
947 RegisterCommand(1, 81, 1000, "objMove", (CmdImpl) &GrpImpl::impl_objSetPos); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
948 RegisterCommand(1, 82, 1000, "objBgMove", (CmdImpl) &GrpImpl::impl_objSetPos); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
949 RegisterCommand(1, 81, 1001, "objLeft", (CmdImpl) &GrpImpl::impl_objSetPos); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
950 RegisterCommand(1, 82, 1001, "objBgLeft", (CmdImpl) &GrpImpl::impl_objSetPos); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
951 RegisterCommand(1, 81, 1002, "objTop", (CmdImpl) &GrpImpl::impl_objSetPos); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
952 RegisterCommand(1, 82, 1002, "objBgTop", (CmdImpl) &GrpImpl::impl_objSetPos); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
953 RegisterCommand(1, 81, 1003, "objAlpha", (CmdImpl) &GrpImpl::impl_objAlpha); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
954 RegisterCommand(1, 82, 1003, "objBgAlpha", (CmdImpl) &GrpImpl::impl_objAlpha); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
955 RegisterCommand(1, 81, 1004, "objShow", (CmdImpl) &GrpImpl::impl_objShow); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
956 RegisterCommand(1, 82, 1004, "objBgShow", (CmdImpl) &GrpImpl::impl_objShow); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
957 RegisterCommand(1, 81, 1005, "objDispArea", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
958 RegisterCommand(1, 82, 1005, "objBgDispArea", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
959 RegisterCommand(1, 81, 1006, "objAdjust", (CmdImpl) &GrpImpl::impl_objSetPos); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
960 RegisterCommand(1, 82, 1006, "objBgAdjust", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objSetPos); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
961 RegisterCommand(1, 81, 1007, "objAdjustX", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
962 RegisterCommand(1, 82, 1007, "objBgAdjustX", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
963 RegisterCommand(1, 81, 1008, "objAdjustY", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
964 RegisterCommand(1, 82, 1008, "objBgAdjustY", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
965 RegisterCommand(1, 81, 2006, "objAdjust2?", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objSetPos); I don't know if it is usefull or properly implemented |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
966 RegisterCommand(1, 82, 2006, "objBgAdjust2?", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objSetPos); See above |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
967 RegisterCommand(1, 81, 1016, "objColour", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objColour); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
968 RegisterCommand(1, 82, 1016, "objBgColour", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objColour); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
969 RegisterCommand(1, 81, 1017, "objColR", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
970 RegisterCommand(1, 82, 1017, "objBgColR", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
971 RegisterCommand(1, 81, 1018, "objColG", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
972 RegisterCommand(1, 82, 1018, "objBgColG", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
973 RegisterCommand(1, 81, 1019, "objColB", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
974 RegisterCommand(1, 82, 1019, "objBgColB", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
975 RegisterCommand(1, 81, 1020, "objColLevel", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
976 RegisterCommand(1, 82, 1020, "objBgColLevel", NULL); |
55 | 977 RegisterCommand(1, 81, 1021, "objComposite", NULL);//(CmdImpl) &GrpImpl::impl_objComposite); //FIXME: May be broken |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
978 RegisterCommand(1, 82, 1021, "objBgComposite", (CmdImpl) &GrpImpl::impl_objComposite); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
979 RegisterCommand(1, 81, 1024, "objSetText", (CmdImpl) &GrpImpl::impl_objSetText); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
980 RegisterCommand(1, 82, 1024, "objBgSetText", (CmdImpl) &GrpImpl::impl_objSetText); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
981 RegisterCommand(1, 81, 1025, "objTextOpts", (CmdImpl) &GrpImpl::impl_objTextOpts); //FIXME: Incomplete |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
982 RegisterCommand(1, 82, 1025, "objBgTextOpts", (CmdImpl) &GrpImpl::impl_objTextOpts); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
983 RegisterCommand(1, 81, 1032, "objOrder", (CmdImpl) &GrpImpl::impl_objOrder); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
984 RegisterCommand(1, 82, 1032, "objBgOrder", (CmdImpl) &GrpImpl::impl_objOrder); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
985 RegisterCommand(1, 81, 1034, "objDispRect", (CmdImpl) &GrpImpl::impl_objDispArea); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
986 RegisterCommand(1, 82, 1034, "objBgDispRect", (CmdImpl) &GrpImpl::impl_objDispArea); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
987 RegisterCommand(1, 81, 1037, "objSetDigits", (CmdImpl) &GrpImpl::impl_objSetDigits); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
988 RegisterCommand(1, 82, 1037, "objBgSetDigits", (CmdImpl) &GrpImpl::impl_objSetDigits); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
989 RegisterCommand(1, 81, 1038, "objNumOpts", (CmdImpl) &GrpImpl::impl_objNumOpts); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
990 RegisterCommand(1, 82, 1038, "objBgNumOpts", (CmdImpl) &GrpImpl::impl_objNumOpts); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
991 RegisterCommand(1, 81, 1039, "objPattNo", (CmdImpl) &GrpImpl::impl_objPattNo); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
992 RegisterCommand(1, 82, 1039, "objBgPattNo", (CmdImpl) &GrpImpl::impl_objPattNo); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
993 RegisterCommand(1, 81, 1046, "objScale", (CmdImpl) &GrpImpl::impl_objScale); //FIXME: Broken behaviour |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
994 RegisterCommand(1, 82, 1046, "objBgScale", (CmdImpl) &GrpImpl::impl_objScale); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
995 RegisterCommand(1, 81, 1047, "objWidth", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
996 RegisterCommand(1, 82, 1047, "objBgWidth", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
997 RegisterCommand(1, 81, 1049, "objRotate", (CmdImpl) &GrpImpl::impl_objRotate); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
998 RegisterCommand(1, 82, 1049, "objBgRotate", (CmdImpl) &GrpImpl::impl_objRotate); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
999 |
55 | 1000 RegisterCommand(2, 81, 1000, "childObjMove", (CmdImpl) &GrpImpl::impl_objSetPos); |
1001 RegisterCommand(2, 82, 1000, "childObjBgMove", (CmdImpl) &GrpImpl::impl_objSetPos); | |
1002 RegisterCommand(2, 81, 1001, "childObjLeft", NULL); | |
1003 RegisterCommand(2, 82, 1001, "childObjBgLeft", NULL); | |
1004 RegisterCommand(2, 81, 1002, "childObjTop", NULL); | |
1005 RegisterCommand(2, 82, 1002, "childObjBgTop", NULL); | |
1006 RegisterCommand(2, 81, 1003, "childObjAlpha", (CmdImpl) &GrpImpl::impl_objAlpha); | |
1007 RegisterCommand(2, 82, 1003, "childObjBgAlpha", (CmdImpl) &GrpImpl::impl_objAlpha); | |
1008 RegisterCommand(2, 81, 1004, "childObjShow", (CmdImpl) &GrpImpl::impl_objShow); | |
1009 RegisterCommand(2, 82, 1004, "childObjBgShow", (CmdImpl) &GrpImpl::impl_objShow); | |
1010 RegisterCommand(2, 81, 1005, "childObjDispArea", NULL); | |
1011 RegisterCommand(2, 82, 1005, "childObjBgDispArea", NULL); | |
1012 RegisterCommand(2, 81, 1006, "childObjAdjust", (CmdImpl) &GrpImpl::impl_objSetPos); | |
1013 RegisterCommand(2, 82, 1006, "childObjBgAdjust", (CmdImpl) &GrpImpl::impl_objSetPos); | |
1014 RegisterCommand(2, 81, 1007, "childObjAdjustX", NULL); | |
1015 RegisterCommand(2, 82, 1007, "childObjBgAdjustX", NULL); | |
1016 RegisterCommand(2, 81, 1008, "childObjAdjustY", NULL); | |
1017 RegisterCommand(2, 82, 1008, "childObjBgAdjustY", NULL); | |
1018 RegisterCommand(2, 81, 2006, "childObjAdjust2?", NULL); | |
1019 RegisterCommand(2, 82, 2006, "childObjBgAdjust2?", NULL); | |
1020 RegisterCommand(2, 81, 1016, "childObjColour", NULL); | |
1021 RegisterCommand(2, 82, 1016, "childObjBgColour", NULL); | |
1022 RegisterCommand(2, 81, 1017, "childObjColR", NULL); | |
1023 RegisterCommand(2, 82, 1017, "childObjBgColR", NULL); | |
1024 RegisterCommand(2, 81, 1018, "childObjColG", NULL); | |
1025 RegisterCommand(2, 82, 1018, "childObjBgColG", NULL); | |
1026 RegisterCommand(2, 81, 1019, "childObjColB", NULL); | |
1027 RegisterCommand(2, 82, 1019, "childObjBgColB", NULL); | |
1028 RegisterCommand(2, 81, 1020, "childObjColLevel", NULL); | |
1029 RegisterCommand(2, 82, 1020, "childObjBgColLevel", NULL); | |
1030 RegisterCommand(2, 81, 1021, "childObjComposite", NULL); | |
1031 RegisterCommand(2, 82, 1021, "childObjBgComposite", NULL); | |
1032 RegisterCommand(2, 81, 1024, "childObjSetText", (CmdImpl) &GrpImpl::impl_objSetText); | |
1033 RegisterCommand(2, 82, 1024, "childObjBgSetText", (CmdImpl) &GrpImpl::impl_objSetText); | |
1034 RegisterCommand(2, 81, 1025, "childObjTextOpts", (CmdImpl) &GrpImpl::impl_objTextOpts); | |
1035 RegisterCommand(2, 82, 1025, "childObjBgTextOpts", (CmdImpl) &GrpImpl::impl_objTextOpts); | |
1036 RegisterCommand(2, 81, 1032, "childObjOrder", NULL); | |
1037 RegisterCommand(2, 82, 1032, "childObjBgOrder", NULL); | |
1038 RegisterCommand(2, 81, 1034, "childObjDispRect", NULL); | |
1039 RegisterCommand(2, 82, 1034, "childObjBgDispRect", NULL); | |
1040 RegisterCommand(2, 81, 1037, "childObjSetDigits", (CmdImpl) &GrpImpl::impl_objSetDigits); | |
1041 RegisterCommand(2, 82, 1037, "childObjBgSetDigits", (CmdImpl) &GrpImpl::impl_objSetDigits); | |
1042 RegisterCommand(2, 81, 1038, "childObjNumOpts", (CmdImpl) &GrpImpl::impl_objNumOpts); | |
1043 RegisterCommand(2, 82, 1038, "childObjBgNumOpts", (CmdImpl) &GrpImpl::impl_objNumOpts); | |
1044 RegisterCommand(2, 81, 1039, "childObjPattNo", (CmdImpl) &GrpImpl::impl_objPattNo); | |
1045 RegisterCommand(2, 82, 1039, "childObjBgPattNo", (CmdImpl) &GrpImpl::impl_objPattNo); | |
1046 RegisterCommand(2, 81, 1046, "childObjScale", (CmdImpl) &GrpImpl::impl_objScale); | |
1047 RegisterCommand(2, 82, 1046, "childObjBgScale", (CmdImpl) &GrpImpl::impl_objScale); | |
1048 RegisterCommand(2, 81, 1047, "childObjWidth", NULL); | |
1049 RegisterCommand(2, 82, 1047, "childObjBgWidth", NULL); | |
1050 RegisterCommand(2, 81, 1049, "childObjRotate", NULL); | |
1051 RegisterCommand(2, 82, 1049, "childObjBgRotate", NULL); | |
1052 | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1053 RegisterCommand(1, 84, 1000, "objGetPos", (CmdImpl) &GrpImpl::impl_objPosDims); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1054 RegisterCommand(1, 84, 1100, "objGetDims", (CmdImpl) &GrpImpl::impl_objPosDims); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1055 |
55 | 1056 RegisterCommand(2, 84, 1000, "childObjGetPos", (CmdImpl) &GrpImpl::impl_objPosDims); |
1057 RegisterCommand(2, 84, 1100, "childObjGetDims", (CmdImpl) &GrpImpl::impl_objPosDims); | |
1058 | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1059 RegisterCommand(1, 31, 0, "refresh", (CmdImpl) &GrpImpl::impl_refresh); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1060 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1061 RegisterCommand(1, 20, 0, "bgmLoop", (CmdImpl) &GrpImpl::impl_bgmLoop); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1062 RegisterCommand(1, 20, 1, "bgmPlayEx", (CmdImpl) &GrpImpl::impl_bgmLoop); //FIXME: wait |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1063 RegisterCommand(1, 20, 2, "bgmPlay", (CmdImpl) &GrpImpl::impl_bgmLoop); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1064 RegisterCommand(1, 20, 5, "bgmStop", (CmdImpl) &GrpImpl::impl_bgmStop); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1065 RegisterCommand(1, 20, 105, "bgmFadeOut", (CmdImpl) &GrpImpl::impl_bgmStop); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1066 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1067 RegisterCommand(1, 21, 0, "wavPlay", (CmdImpl) &GrpImpl::impl_playWav); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1068 RegisterCommand(1, 21, 1, "wavPlayEx", (CmdImpl) &GrpImpl::impl_playWav); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1069 RegisterCommand(1, 21, 2, "wavLoop", (CmdImpl) &GrpImpl::impl_playWav); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1070 RegisterCommand(1, 21, 3, "wavWait", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1071 RegisterCommand(1, 21, 4, "wavPlaying", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1072 RegisterCommand(1, 21, 5, "wavStop", (CmdImpl) &GrpImpl::impl_stopWav); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1073 RegisterCommand(1, 21, 105, "wavFadeout", (CmdImpl) &GrpImpl::impl_stopWav); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1074 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1075 RegisterCommand(1, 22, 0, "sePlay", (CmdImpl) &GrpImpl::impl_playSE); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1076 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1077 RegisterCommand(1, 4, 2230, "SetBgmVolMod", (CmdImpl) &GrpImpl::impl_SetVolMod); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1078 RegisterCommand(1, 4, 2231, "SetKoeVolMod", (CmdImpl) &GrpImpl::impl_SetVolMod); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1079 RegisterCommand(1, 4, 2232, "SetPCMVolMod", (CmdImpl) &GrpImpl::impl_SetVolMod); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1080 RegisterCommand(1, 4, 2233, "SetSeVolMod", (CmdImpl) &GrpImpl::impl_SetVolMod); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1081 RegisterCommand(1, 4, 2330, "BgmVolMod", (CmdImpl) &GrpImpl::impl_GetVolMod); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1082 RegisterCommand(1, 4, 2331, "KoeVolMod", (CmdImpl) &GrpImpl::impl_GetVolMod); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1083 RegisterCommand(1, 4, 2332, "PCMVolMod", (CmdImpl) &GrpImpl::impl_GetVolMod); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1084 RegisterCommand(1, 4, 2333, "SeVolMod", (CmdImpl) &GrpImpl::impl_GetVolMod); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1085 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1086 RegisterCommand(1, 23, 0, "koePlay", (CmdImpl) &GrpImpl::impl_koePlay); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1087 RegisterCommand(1, 23, 1, "koePlayEx", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1088 RegisterCommand(1, 23, 7, "koePlayExC", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1089 RegisterCommand(1, 23, 8, "koeDoPlay", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1090 RegisterCommand(1, 23, 9, "koeDoPlayEx", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1091 RegisterCommand(1, 23, 10, "koeDoPlayExC", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1092 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1093 RegisterCommand(1, 26, 1, "movPlayEx", (CmdImpl) &GrpImpl::impl_movPlay); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1094 RegisterCommand(1, 26, 20, "movPlayExC", (CmdImpl) &GrpImpl::impl_movPlay); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1095 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1096 RegisterCommand(1, 61, 14, "objSwap?", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1097 RegisterCommand(1, 62, 14, "objSwap?", NULL); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1098 |
55 | 1099 RegisterCommand(1, 4, 1211, "EnableSyscom", NULL); |
1100 RegisterCommand(1, 4, 1212, "HideSyscom", NULL); | |
1101 RegisterCommand(1, 4, 1213, "DisableSyscom", NULL); | |
1102 | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1103 anm1 = NULL; |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1104 anm2 = NULL; |
0 | 1105 } |
1106 | |
1107 GrpImpl::~GrpImpl() { | |
1108 | |
1109 map<int,GrpObj>::iterator it; | |
1110 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | |
1111 PicBase* p = it->second.DeletePic(); | |
1112 delete p; | |
1113 } | |
1114 | |
1115 delete screen; | |
1116 delete screen_front; | |
1117 parent.Root().DeleteSurface(surface); | |
50 | 1118 parent.Root().DeleteSurface(surface_update); |
0 | 1119 int i; |
1120 for (i=0; i<MAXPDT; i++) { | |
1121 if (ssurface[i]) parent.Root().DeleteSurface(ssurface[i]); | |
1122 if (dsurface[i]) parent.Root().DeleteSurface(dsurface[i]); | |
1123 } | |
1124 } | |
1125 | |
1126 Surface* GrpImpl::Dsurface(int pdt) { | |
1127 if (pdt == 0) return surface; | |
1128 if (dsurface[pdt] == 0) { // とりあえず画面の大きさということにする | |
1129 if (pdt == WORKPDT) | |
1130 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), ALPHA_MASK); | |
1131 else | |
1132 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), NO_MASK); | |
1133 } | |
1134 if (ssurface[pdt]) { // ssurface が存在すれば、dsurface にコピーして返す | |
1135 DSurfaceMove(ssurface[pdt], Rect(*ssurface[pdt]), dsurface[pdt], Rect(0,0)); | |
1136 parent.Root().DeleteSurface(ssurface[pdt]); | |
1137 ssurface[pdt] = 0; | |
1138 } | |
1139 return dsurface[pdt]; | |
1140 } | |
52 | 1141 |
55 | 1142 GrpObj* GrpImpl::GetGraphicObj(int grp, bool fg) { |
1143 if (fg) | |
1144 return &grpobj[grp]; | |
1145 else | |
1146 return &bs_obj[grp]; | |
1147 } | |
1148 | |
1149 GrpObj* GrpImpl::GetGraphicObj(int grp, int index, bool fg) { | |
1150 GrpObj* g = GetGraphicObj(grp, fg); | |
1151 return &g->children_obj[index]; | |
1152 } | |
1153 | |
1154 GrpObj* GrpImpl::GetGraphicObjVarMode(Cmd& cmd, int &base_arg, bool fg) { | |
1155 GrpObj* g; | |
1156 if (cmd.cmd1 == 2) { | |
1157 g = GetGraphicObj(cmd.args[base_arg].value, cmd.args[base_arg+1].value, fg); | |
1158 base_arg += 1; | |
1159 } | |
1160 else | |
1161 g = GetGraphicObj(cmd.args[base_arg].value, fg); | |
1162 return g; | |
1163 } | |
1164 | |
52 | 1165 #include <SDL.h> |
0 | 1166 Surface* GrpImpl::Ssurface(int pdt) { |
1167 if (pdt == 0) return surface; | |
1168 if (ssurface[pdt]) { | |
1169 return ssurface[pdt]; | |
1170 } | |
1171 return Dsurface(pdt); | |
1172 } | |
1173 | |
1174 void GrpImpl::LoadSurface(const char* str, int pdt) { | |
1175 string s = str; | |
1176 if (cgm_info.find(s) != cgm_info.end()) { | |
1177 cgm_data.insert(cgm_info[s]); | |
1178 } | |
1179 Surface* bg = parent.Root().NewSurface(s.c_str()); | |
52 | 1180 if (bg == NULL) { |
0 | 1181 s += ".g00"; |
1182 bg = parent.Root().NewSurface(s.c_str()); | |
1183 } | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1184 if (bg != NULL) { |
0 | 1185 if (ssurface[pdt]) parent.Root().DeleteSurface(ssurface[pdt]); |
1186 ssurface[pdt] = bg; | |
1187 if (pdt == 0) { | |
1188 /* とりあえず Princess Bride のアニメーション効果専用 */ | |
1189 Rect r(*ssurface[0]); | |
1190 Rect dr(*surface); | |
1191 int x = (dr.width()-r.width())/2; | |
1192 int y = (dr.height()-r.height())/2; | |
1193 DSurfaceMove(ssurface[0], r, surface, Rect(x,y)); | |
1194 parent.Root().DeleteSurface(ssurface[0]); | |
52 | 1195 ssurface[0] = NULL; |
0 | 1196 screen->SetSurface(surface, 0, 0); |
1197 } | |
1198 } else { | |
1199 if (str[0] != 0) | |
1200 fprintf(stderr,"Cannot find surface %d <- '%s'\n",pdt,str); | |
1201 } | |
1202 } | |
52 | 1203 |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1204 void GrpImpl::InitSel(void) { |
52 | 1205 int i; |
1206 int args[16]; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1207 char key[10]; |
0 | 1208 for (i=0; i<999; i++) { |
1209 sprintf(key, "#SEL.%03d",i); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1210 if (config->GetParam(key, 15, &args[0], &args[1], |
0 | 1211 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], |
1212 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13], | |
1213 &args[14])) { | |
1214 | |
1215 sprintf(key, "#SELR.%03d", i); | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1216 if (config->GetParam(key, 16, &args[0], &args[1], |
0 | 1217 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], |
1218 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13], | |
1219 &args[14], &args[15])) continue; | |
1220 } | |
1221 SEL& s = anmtype[i]; | |
1222 s.from = Rect(args[0], args[1], args[2]+1, args[3]+1); | |
1223 s.to = Rect(args[4], args[5]); | |
1224 s.time = args[6]; | |
1225 s.sel_no = args[7]; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1226 int j; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1227 for (j=0; j<8; j++) s.args[j] = args[8+j]; |
0 | 1228 } |
1229 } | |
52 | 1230 |
0 | 1231 void GrpImpl::SetSkipMode(SkipMode _mode) { |
1232 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) { | |
1233 RefreshObj(); | |
1234 } else if ( (skip_mode & SKIP_IN_MENU) == 0 && (_mode & SKIP_IN_MENU) ) { | |
1235 } | |
1236 skip_mode = _mode; | |
1237 } | |
52 | 1238 |
0 | 1239 void GrpImpl::SetObjChanged(int num) { |
1240 changed_obj.insert(num); | |
1241 } | |
52 | 1242 |
0 | 1243 void GrpImpl::RefreshObj(void) { |
1244 if (!deleted_pic.empty()) { | |
1245 vector<PicBase*>::iterator it; | |
1246 for (it=deleted_pic.begin(); it!=deleted_pic.end(); it++) { | |
1247 if (*it) delete *it; | |
1248 } | |
1249 deleted_pic.clear(); | |
1250 } | |
1251 if (!changed_obj.empty()) { | |
1252 set<int>::iterator it; | |
1253 for (it=changed_obj.begin(); it != changed_obj.end(); it++) { | |
1254 if (grpobj.find(*it) == grpobj.end()) continue; | |
1255 GrpObj& obj = grpobj[*it]; | |
55 | 1256 obj.Refresh(obj); |
0 | 1257 } |
1258 changed_obj.clear(); | |
1259 } | |
1260 if (reserved_load_surface0.length() != 0) { | |
1261 LoadSurface(reserved_load_surface0.c_str(), 0); | |
1262 reserved_load_surface0 = ""; | |
1263 } | |
1264 screen->ReBlit(); | |
1265 } | |
1266 | |
1267 | |
52 | 1268 #include <SDL.h> |
0 | 1269 void GrpImpl::StartAnm(int type) { |
1270 SEL sel; | |
1271 | |
1272 if (anmtype.find(type) == anmtype.end()) { | |
1273 if (anmtype.find(0) == anmtype.end()) { | |
1274 sel.sel_no = 1; | |
1275 sel.from = Rect(*surface); | |
1276 sel.to = Rect(0,0); | |
1277 sel.time = 0; | |
1278 } else { | |
1279 sel = anmtype[0]; | |
1280 } | |
1281 } else { | |
1282 sel = anmtype[type]; | |
1283 } | |
52 | 1284 if (anm1 != NULL) { |
0 | 1285 fprintf(stderr,"Warning: StartAnm() called before anm1 finished\n"); |
1286 anm1->Abort(); | |
1287 delete anm1; | |
52 | 1288 anm1 = NULL; |
0 | 1289 } |
1290 map<int,GrpObj>::iterator it; | |
1291 // 現在表示中のobjectを消去 | |
1292 deleted_pic.push_back(screen); | |
1293 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | |
1294 if (! (it->second.attr & GrpObj::WIPEON)) { // 画像切り替え時に object 削除 | |
1295 deleted_pic.push_back(it->second.DeletePic()); | |
1296 } else { | |
1297 GrpObj& new_obj = bs_obj[it->first]; | |
1298 if (new_obj.name.empty()) { // 新しい object が存在しなければ内容を引き継ぐ | |
1299 new_obj = it->second; | |
1300 it->second.DeletePic(); | |
1301 } else { | |
1302 new_obj.attr = GrpObj::Attribute(new_obj.attr | GrpObj::WIPEON); | |
1303 deleted_pic.push_back(it->second.DeletePic()); | |
1304 } | |
1305 } | |
1306 } | |
1307 grpobj.clear(); // 全オブジェクト削除 | |
1308 | |
1309 // 全画像オブジェクトの前にscreen 移動 | |
1310 // 新しい screen_front を作成しておく | |
1311 screen = screen_front; | |
1312 screen->hide(); | |
1313 screen->SetSurface(surface_update, 0, 0); | |
1314 parent.Root().BlitSurface(Dsurface(1), Rect(*surface_update), surface_update, Rect(0,0)); | |
1315 | |
1316 screen_front = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); | |
1317 screen_front->hide(); | |
1318 screen_front->ZMove(screen); | |
1319 | |
1320 // 新しい object へ更新、surface_update へ新しい object を表示 | |
1321 // (object 作成時は picture は hide されている) | |
1322 for (it=bs_obj.begin(); it!=bs_obj.end(); it++) { | |
1323 grpobj[it->first] = it->second; | |
1324 it->second.DeletePic(); | |
55 | 1325 CreateObj(it->first);//FIXME: Adapt to groups |
0 | 1326 GrpObj& g = grpobj[it->first]; |
1327 if (g.picture) { | |
1328 g.Update(); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1329 if (g.alpha == 0 || (g.attr & GrpObj::HIDDEN)) ; |
0 | 1330 else g.picture->SimpleBlit(surface_update); |
1331 g.picture->hide(); | |
1332 } | |
1333 } | |
1334 bs_obj.clear(); | |
1335 // 画像効果開始 | |
1336 switch(sel.sel_no) { | |
1337 default: | |
1338 case 0: case 50: // 0 と 50 の違いが良くわからない | |
1339 if (skip_mode & SKIP_GRP_NOEFFEC) | |
1340 anm1 = new WidAnmAlpha(event, screen, ALPHA_MAX, ALPHA_MAX, 0); | |
1341 else if (skip_mode & SKIP_GRP_FAST) | |
1342 anm1 = new WidAnmAlpha(event, screen, 0, ALPHA_MAX, sel.time/4); | |
1343 else | |
1344 anm1 = new WidAnmAlpha(event, screen, 0, ALPHA_MAX, sel.time); | |
1345 break; | |
1346 } | |
1347 if (anm1) anm1->Play(); | |
1348 if (skip_mode & SKIP_GRP_NOEFFEC) AbortAnm(); | |
1349 } | |
52 | 1350 |
0 | 1351 void GrpImpl::StartShake(int total, const int* pattern) { |
1352 if (anm2) { | |
1353 fprintf(stderr,"Warning: StartShake() called before another animation finished\n"); | |
1354 anm2->Abort(); | |
1355 delete anm2; | |
52 | 1356 anm2 = NULL; |
0 | 1357 } |
1358 if (skip_mode & SKIP_GRP_NOEFFEC) return; | |
1359 AnmAlphaMove* new_anm = new AnmAlphaMove(event, &parent); // shake screen では元画面の座標を揺らす | |
52 | 1360 int i; |
1361 int tm = 0; | |
0 | 1362 for (i=0; i<total; i+=3) { |
1363 int x = pattern[i]; | |
1364 int y = pattern[i+1]; | |
1365 new_anm->ptns.push_back(AnmAlphaMove::Ptn(Rect(x,y), Rect(0,0), 255, tm)); | |
1366 tm += pattern[i+2]; | |
1367 } | |
1368 new_anm->ptns.push_back(AnmAlphaMove::Ptn(Rect(0,0), Rect(0,0), 255, tm)); | |
1369 new_anm->SetPtn(); // パターン登録終了 | |
1370 new_anm->Play(); | |
1371 anm2 = new_anm; | |
1372 } | |
52 | 1373 |
0 | 1374 void GrpImpl::AbortAnm(void) { |
52 | 1375 if (anm1 == NULL) return; |
0 | 1376 anm1->Abort(); |
1377 delete anm1; | |
52 | 1378 anm1 = NULL; |
0 | 1379 /* 画像効果終了 */ |
1380 /* 古い画面への画像効果があれば消去 */ | |
1381 if (anm2 && anm2->pic[0] != screen) { | |
1382 anm2->Abort(); | |
1383 delete anm2; | |
52 | 1384 anm2 = NULL; |
0 | 1385 } |
1386 /* pdt1 -> pdt0 へコピー */ | |
1387 DSurfaceMove(dsurface[1], Rect(*dsurface[1]), surface, Rect(0,0)); | |
1388 screen->SetSurface(surface, 0, 0); | |
1389 // 画像効果開始時に存在したobjectを消去 | |
1390 // 新しい object 表示 | |
1391 RefreshObj(); | |
1392 return; | |
1393 } | |
52 | 1394 |
0 | 1395 void GrpImpl::LoadSurface(const char* str) { |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1396 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了 |
0 | 1397 LoadSurface(str, 1); |
1398 bg_name = str; | |
1399 } | |
52 | 1400 |
0 | 1401 void GrpImpl::LoadSurface(void) { |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1402 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了 |
0 | 1403 LoadSurface(bg_name.c_str(), 1); |
1404 } | |
52 | 1405 |
0 | 1406 void GrpImpl::AddSurface(const char* str) { |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1407 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了 |
0 | 1408 LoadSurface(bg_name.c_str()); |
1409 | |
1410 string s = str; | |
1411 Surface* front = parent.Root().NewSurface(s.c_str()); | |
52 | 1412 if (front == NULL) { |
0 | 1413 s += ".g00"; |
1414 front = parent.Root().NewSurface(s.c_str()); | |
1415 } | |
52 | 1416 if (front != NULL) { |
0 | 1417 parent.Root().BlitSurface(front, Rect(*front), Dsurface(1), Rect(0,0)); |
1418 parent.Root().DeleteSurface(front); | |
1419 } else { | |
1420 fprintf(stderr,"Cannot find surface %s\n",str); | |
1421 } | |
1422 } | |
1423 | |
1424 void GrpImpl::CreateObj(int index) { | |
55 | 1425 GrpObjMap::iterator cur = grpobj.find(index); |
0 | 1426 if (cur == grpobj.end()) return; |
1427 GrpObj& g = grpobj[index]; | |
1428 g.CreateSurface(&parent); | |
1429 g.order = index; | |
52 | 1430 if (g.picture == NULL) return; // エラー:surface が存在しない |
0 | 1431 g.picture->hide(); |
1432 SetObjChanged(index); | |
1433 ZMoveObj(index); | |
1434 } | |
52 | 1435 |
55 | 1436 void GrpImpl::CreateSubObj(int grp_index, int index) { |
1437 GrpObjMap::iterator cur = grpobj.find(grp_index); | |
1438 if (cur == grpobj.end()) return; | |
1439 GrpObj* g = &grpobj[grp_index]; | |
1440 cur = g->children_obj.find(index); | |
1441 if (cur == g->children_obj.end()) return; | |
1442 g = &g->children_obj[index]; | |
1443 g->CreateSurface(&parent); | |
1444 g->order = index; | |
1445 if (g->picture == NULL) return; // エラー:surface が存在しない | |
1446 g->picture->hide(); | |
1447 //TODO | |
1448 SetObjChanged(grp_index); | |
1449 /*ZMoveObj(index);*/ | |
1450 } | |
1451 | |
0 | 1452 void GrpImpl::ZMoveObj(int index) { |
55 | 1453 GrpObjMap::iterator cur = grpobj.find(index); |
0 | 1454 if (cur == grpobj.end()) return; |
1455 GrpObj& g = grpobj[index]; | |
52 | 1456 if (g.picture == NULL) return; |
0 | 1457 // 自分より前に object があれば、その前に表示 |
1458 // そうでなければ screen の前に表示 | |
55 | 1459 GrpObjMap::iterator cur_backobj = grpobj.end(); |
1460 GrpObjMap::iterator it; | |
0 | 1461 for (it = grpobj.begin(); it != grpobj.end(); it++) { |
1462 if (it == cur) continue; | |
52 | 1463 if (it->second.picture == NULL) continue; |
0 | 1464 if (it->second.order < g.order) { |
1465 if (cur_backobj == grpobj.end()) { | |
1466 cur_backobj = it; | |
1467 } else if (cur_backobj->second.order < it->second.order) { | |
1468 cur_backobj = it; | |
1469 } | |
1470 } | |
1471 } | |
1472 if (cur_backobj == grpobj.end()) { | |
1473 g.picture->ZMove(screen); | |
1474 } else { | |
1475 g.picture->ZMove(cur_backobj->second.picture); | |
1476 } | |
1477 } | |
52 | 1478 |
0 | 1479 void GrpImpl::SwapObj(int index1, int index2) { |
1480 // デフォルト値から order が変更されていた場合のみ、order は保存される | |
1481 // まずは両方のobjectをswap | |
1482 if (grpobj.find(index1) == grpobj.end()) { | |
1483 if (grpobj.find(index2) == grpobj.end()) return; // どちらの object も存在しない | |
1484 grpobj[index1] = grpobj[index2]; | |
1485 if (grpobj[index1].order == index2) | |
1486 grpobj[index1].order = index1; | |
1487 grpobj[index2].DeletePic(); | |
1488 grpobj.erase(index2); | |
1489 ZMoveObj(index1); | |
1490 return; | |
1491 } else if (grpobj.find(index2) == grpobj.end()) { // index2 が存在しない場合 | |
1492 grpobj[index2] = grpobj[index1]; | |
1493 if (grpobj[index2].order == index1) | |
1494 grpobj[index2].order = index2; | |
1495 grpobj[index1].DeletePic(); | |
1496 grpobj.erase(index1); | |
1497 ZMoveObj(index2); | |
1498 return; | |
1499 } else { | |
1500 GrpObj obj = grpobj[index1]; | |
1501 grpobj[index1] = grpobj[index2]; | |
1502 grpobj[index2].DeletePic(); | |
1503 if (grpobj[index1].order == index2) | |
1504 grpobj[index1].order = index1; | |
1505 ZMoveObj(index1); | |
1506 grpobj[index2] = obj; | |
1507 if (grpobj[index2].order == index1) | |
1508 grpobj[index2].order = index2; | |
1509 ZMoveObj(index2); | |
1510 obj.DeletePic(); | |
1511 } | |
1512 } | |
1513 | |
1514 bool GrpImpl::Pressed(int x, int y, void* pointer) { // マウスクリックでキャンセル | |
1515 GrpImpl* g = (GrpImpl*)pointer; | |
1516 if (g->status == WAIT_MOVIE) | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1517 g->music->StopMovie(); |
0 | 1518 if (g->status == WAIT_ANM) |
1519 g->AbortAnm(); | |
52 | 1520 if (g->status == WAIT_SHAKE && g->anm2 != NULL) { |
18 | 1521 g->anm2->Abort(); |
0 | 1522 delete g->anm2; |
52 | 1523 g->anm2 = NULL; |
0 | 1524 } |
1525 return false; // event deleted | |
1526 } | |
1527 | |
1528 /* mode.cgm の decode 用 */ | |
1529 static unsigned char decode_char[256] = { | |
1530 0x8b, 0xe5, 0x5d, 0xc3, 0xa1, 0xe0, 0x30, 0x44, | |
1531 0x00, 0x85, 0xc0, 0x74, 0x09, 0x5f, 0x5e, 0x33, | |
1532 0xc0, 0x5b, 0x8b, 0xe5, 0x5d, 0xc3, 0x8b, 0x45, | |
1533 0x0c, 0x85, 0xc0, 0x75, 0x14, 0x8b, 0x55, 0xec, | |
1534 0x83, 0xc2, 0x20, 0x52, 0x6a, 0x00, 0xe8, 0xf5, | |
1535 0x28, 0x01, 0x00, 0x83, 0xc4, 0x08, 0x89, 0x45, | |
1536 0x0c, 0x8b, 0x45, 0xe4, 0x6a, 0x00, 0x6a, 0x00, | |
1537 0x50, 0x53, 0xff, 0x15, 0x34, 0xb1, 0x43, 0x00, | |
1538 0x8b, 0x45, 0x10, 0x85, 0xc0, 0x74, 0x05, 0x8b, | |
1539 0x4d, 0xec, 0x89, 0x08, 0x8a, 0x45, 0xf0, 0x84, | |
1540 0xc0, 0x75, 0x78, 0xa1, 0xe0, 0x30, 0x44, 0x00, | |
1541 0x8b, 0x7d, 0xe8, 0x8b, 0x75, 0x0c, 0x85, 0xc0, | |
1542 0x75, 0x44, 0x8b, 0x1d, 0xd0, 0xb0, 0x43, 0x00, | |
1543 0x85, 0xff, 0x76, 0x37, 0x81, 0xff, 0x00, 0x00, | |
1544 0x04, 0x00, 0x6a, 0x00, 0x76, 0x43, 0x8b, 0x45, | |
1545 0xf8, 0x8d, 0x55, 0xfc, 0x52, 0x68, 0x00, 0x00, | |
1546 0x04, 0x00, 0x56, 0x50, 0xff, 0x15, 0x2c, 0xb1, | |
1547 0x43, 0x00, 0x6a, 0x05, 0xff, 0xd3, 0xa1, 0xe0, | |
1548 0x30, 0x44, 0x00, 0x81, 0xef, 0x00, 0x00, 0x04, | |
1549 0x00, 0x81, 0xc6, 0x00, 0x00, 0x04, 0x00, 0x85, | |
1550 0xc0, 0x74, 0xc5, 0x8b, 0x5d, 0xf8, 0x53, 0xe8, | |
1551 0xf4, 0xfb, 0xff, 0xff, 0x8b, 0x45, 0x0c, 0x83, | |
1552 0xc4, 0x04, 0x5f, 0x5e, 0x5b, 0x8b, 0xe5, 0x5d, | |
1553 0xc3, 0x8b, 0x55, 0xf8, 0x8d, 0x4d, 0xfc, 0x51, | |
1554 0x57, 0x56, 0x52, 0xff, 0x15, 0x2c, 0xb1, 0x43, | |
1555 0x00, 0xeb, 0xd8, 0x8b, 0x45, 0xe8, 0x83, 0xc0, | |
1556 0x20, 0x50, 0x6a, 0x00, 0xe8, 0x47, 0x28, 0x01, | |
1557 0x00, 0x8b, 0x7d, 0xe8, 0x89, 0x45, 0xf4, 0x8b, | |
1558 0xf0, 0xa1, 0xe0, 0x30, 0x44, 0x00, 0x83, 0xc4, | |
1559 0x08, 0x85, 0xc0, 0x75, 0x56, 0x8b, 0x1d, 0xd0, | |
1560 0xb0, 0x43, 0x00, 0x85, 0xff, 0x76, 0x49, 0x81, | |
1561 0xff, 0x00, 0x00, 0x04, 0x00, 0x6a, 0x00, 0x76 | |
1562 }; | |
1563 | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1564 void GrpImpl::LoadCgm() { |
0 | 1565 /* cgm ファイル読み込み */ |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1566 const char* fname = config->GetParaStr("#CGTABLE_FILE"); |
52 | 1567 if (fname == NULL) return; |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1568 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::ALL, fname, ""); |
52 | 1569 if (info == NULL) return; |
0 | 1570 char* data = info->CopyRead(); |
1571 int sz = info->Size(); | |
1572 delete info; | |
1573 | |
1574 | |
8 | 1575 if ( strncmp(data, "CGTABLE", 7) != 0) { |
1576 delete[] data; | |
1577 return; | |
1578 } | |
20
824b89018ea8
* CG completion percentage (maybe not working properly?)
thib
parents:
18
diff
changeset
|
1579 cgm_size = read_little_endian_int(data+0x10); |
0 | 1580 |
52 | 1581 int i, j; |
0 | 1582 // xor 解除 |
52 | 1583 for (i=0; i < sz-0x20; i++) { |
0 | 1584 data[i+0x20]^=decode_char[i&0xff]; |
1585 } | |
1586 // 展開 | |
1587 int dest_size = cgm_size * 36; | |
1588 char* dest = new char[dest_size+1024]; | |
1589 char* src = data + 0x28; | |
1590 char* dest_orig = dest; | |
1591 ARCINFO::Extract2k(dest,src,dest+dest_size,data+sz); | |
1592 dest = dest_orig; | |
1593 for (i=0; i<cgm_size; i++) { | |
1594 char* s = dest + i * 36; | |
1595 int n = read_little_endian_int(dest + i * 36 + 32); | |
1596 cgm_info[s] = n; | |
1597 } | |
8 | 1598 delete[] data; |
0 | 1599 delete[] dest_orig; |
1600 } | |
1601 | |
1602 /***************************************************** | |
1603 * | |
1604 * GrpImpl :: Save, Load : セーブファイル処理 | |
1605 * | |
1606 */ | |
1607 void GrpImpl::Save(std::string& str) { | |
1608 } | |
52 | 1609 |
0 | 1610 void GrpImpl::Load(const char* str) { |
1611 status = NORMAL; | |
52 | 1612 if (anm1 != NULL) { |
0 | 1613 AbortAnm(); |
1614 } | |
52 | 1615 if (anm2 != NULL) { |
0 | 1616 anm2->Abort(); |
1617 delete anm2; | |
52 | 1618 anm2 = NULL; |
0 | 1619 } |
1620 map<int,GrpObj>::iterator it; | |
1621 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | |
1622 PicBase* p = it->second.DeletePic(); | |
1623 delete p; | |
1624 } | |
1625 grpobj.clear(); | |
1626 | |
1627 bg_name = ""; | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1628 music->StopCDROM(100); |
0 | 1629 } |
52 | 1630 |
0 | 1631 void GrpImpl::SaveSys(string& save) { |
1632 char buf[1024]; | |
1633 save = "\n[Graphics]\n"; | |
1634 save += "CGM_CG="; | |
1635 | |
1636 set<int>::iterator it; | |
1637 for (it=cgm_data.begin(); it != cgm_data.end(); it++) { | |
1638 sprintf(buf,"%d,",*it); | |
1639 save += buf; | |
1640 } | |
1641 save += "\n"; | |
1642 } | |
52 | 1643 |
0 | 1644 void GrpImpl::LoadSys(const char* save) { |
1645 cgm_data.clear(); | |
1646 save = strstr(save, "\n[Graphics]\n"); | |
1647 | |
1648 if (save) { | |
1649 save += strlen("\n[Graphics]\n"); | |
1650 do { | |
1651 if (save[0] == '[') break; // next section | |
1652 if (strncmp(save, "CGM_CG=",7) == 0) { | |
1653 save += 7; | |
1654 while(isdigit(*save)) { | |
1655 int n = atoi(save); | |
1656 cgm_data.insert(n); | |
1657 save = strchr(save, ','); | |
1658 if (save) save++; | |
1659 } | |
1660 } | |
1661 save = strchr(save, '\n'); | |
1662 if (save) save++; | |
1663 } while (save); | |
1664 } | |
1665 return; | |
1666 } | |
1667 | |
1668 | |
1669 /***************************************************** | |
1670 * | |
1671 * GrpImpl :: Wait , Exec : コマンド実行部 | |
1672 * | |
1673 */ | |
1674 static vector<int> drawn_images; | |
1675 static int draw_n = 0; | |
1676 extern bool grpdump_req; | |
1677 bool GrpImpl::Wait(unsigned int current_time, Cmd& cmd) { | |
1678 if (grpdump_req) { | |
1679 grpdump_req = 0; | |
55 | 1680 GrpObjMap::iterator it; |
48 | 1681 fprintf(stderr,"front %p(%d) / %p(%d)\n",screen,screen->IsHidden(),screen_front,screen_front->IsHidden()); |
0 | 1682 for (it=grpobj.begin(); it != grpobj.end(); it++) { |
1683 GrpObj& obj = it->second; | |
55 | 1684 obj._debug_Dump(it->first, 0); |
0 | 1685 } |
1686 std::list<PicBase*>::iterator it2; | |
1687 for (it2=parent.children.begin(); it2!=parent.children.end();it2++) { | |
48 | 1688 fprintf(stderr,"%p(%d)\n",*it2,(*it2)->IsHidden()); |
0 | 1689 } |
1690 RefreshObj(); | |
1691 | |
1692 } | |
1693 #if 0 | |
1694 if (event.presscount(MOUSE_UP)) { | |
1695 std::list<PicBase*>::iterator lit; | |
1696 draw_n++; int i=0; | |
1697 for (lit=parent.children.end(); lit!=parent.children.begin(); ) { | |
1698 lit--; | |
1699 (*lit)->hide(); | |
1700 i++; | |
1701 if (i >= draw_n) break; | |
1702 } | |
1703 if (drawn_images.empty()) { | |
1704 map<int, GrpObj>::iterator it; | |
1705 for (it=grpobj.begin(); it!=grpobj.end(); it++) { | |
1706 if (it->second.picture) { | |
1707 drawn_images.push_back(it->first); | |
1708 PicBase* p = it->second.DeletePic(); | |
1709 delete p; | |
1710 } | |
1711 } | |
1712 } else { | |
1713 vector<int>::iterator it; | |
1714 for (it=drawn_images.begin(); it!=drawn_images.end(); it++) { | |
1715 CreateObj(*it); | |
1716 } | |
1717 drawn_images.clear(); | |
1718 } | |
1719 } | |
1720 #endif | |
1721 if (status == WAIT_ANM) { | |
52 | 1722 if (anm1 != NULL) { |
0 | 1723 if (!anm1->IsEnd()) return true; |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1724 //FIXME: Handle animation loops |
0 | 1725 AbortAnm(); |
1726 } | |
1727 } else if (status == WAIT_SHAKE) { | |
52 | 1728 if (anm2 != NULL) { |
0 | 1729 if (!anm2->IsEnd()) return true; |
1730 delete anm2; | |
52 | 1731 anm2 = NULL; |
0 | 1732 } |
1733 status = NORMAL; | |
1734 } else if (status == WAIT_SE) { | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1735 if (music->IsStopSE()) status = NORMAL; |
0 | 1736 return true; |
1737 } else if (status == WAIT_MOVIE) { | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1738 if (music->IsStopMovie()) { |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
1739 music->StopMovie(); |
0 | 1740 status = NORMAL; |
1741 screen->ReBlit(); | |
1742 } | |
1743 return true; | |
1744 } | |
52 | 1745 if (anm2 != NULL) { |
0 | 1746 if (anm2->IsEnd()) { |
1747 delete anm2; | |
52 | 1748 anm2 = NULL; |
0 | 1749 } |
1750 } | |
1751 return false; | |
1752 } | |
1753 | |
1754 void GrpImpl::DeleteObjPic(int num) { // object の surface のみ削除 | |
1755 if (grpobj.find(num) == grpobj.end()) return; | |
1756 deleted_pic.push_back(grpobj[num].DeletePic()); | |
1757 } | |
52 | 1758 |
55 | 1759 void GrpImpl::DeleteSubObjPic(int num_grp, int num) { |
1760 if (grpobj.find(num_grp) == grpobj.end()) return; | |
1761 if (grpobj[num_grp].children_obj.find(num) == grpobj[num_grp].children_obj.end()) return; | |
1762 deleted_pic.push_back(grpobj[num_grp].children_obj[num].DeletePic()); | |
1763 } | |
1764 | |
0 | 1765 void GrpImpl::DeleteObj(int num) { |
1766 if (grpobj.find(num) == grpobj.end()) return; | |
1767 deleted_pic.push_back(grpobj[num].DeletePic()); | |
55 | 1768 GrpObjMap::iterator it; |
1769 for (it = grpobj[num].children_obj.begin(); it != grpobj[num].children_obj.end(); it++) { | |
1770 deleted_pic.push_back(it->second.DeletePic()); | |
1771 } | |
0 | 1772 grpobj.erase(num); |
1773 } | |
52 | 1774 |
55 | 1775 void GrpImpl::DeleteSubObj(int num_grp, int num) { |
1776 if (grpobj.find(num_grp) == grpobj.end()) return; | |
1777 if (grpobj[num_grp].children_obj.find(num) == grpobj[num_grp].children_obj.end()) return; | |
1778 deleted_pic.push_back(grpobj[num_grp].children_obj[num].DeletePic()); | |
1779 grpobj[num_grp].children_obj.erase(num); | |
1780 } | |
1781 | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1782 void GrpImpl::impl_stackClear (Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1783 cmd.cmd_type = CMD_SAVECMDGRP_START; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1784 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1785 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1786 void GrpImpl::impl_grpBuffer (Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1787 const char* name = cmd.Str(cmd.args[0]); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1788 int pdt = cmd.args[1].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1789 eprintf("load surface %s pdt %d\n",name, pdt); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1790 if (pdt == 0) |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1791 reserved_load_surface0 = name; // 画像読み込みは 01-1f:0000 まで待つ |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1792 else if (pdt == 1) |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1793 LoadSurface(name); // 背景絵読み込み? |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1794 else |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1795 LoadSurface(name, pdt); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1796 cmd.cmd_type = CMD_SAVECMDGRP; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1797 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1798 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1799 void GrpImpl::impl_grpMulti(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1800 int pos = cmd.args[0].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1801 const char* name = cmd.Str(cmd.args[1]); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1802 int sel = cmd.args[2].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1803 eprintf("set foreground %s sel %d pos %d\n",name, sel, pos); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1804 AddSurface(name); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1805 StartAnm(sel); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1806 event.RegisterGlobalPressFunc(&Pressed, (void*)this); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1807 status = WAIT_ANM; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1808 cmd.cmd_type = CMD_SAVECMDGRP_ONCE; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1809 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1810 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1811 void GrpImpl::impl_grpOpen(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1812 const char* name = cmd.Str(cmd.args[0]); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1813 int sel = cmd.args[1].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1814 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1815 if (name[0] == '?') |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1816 LoadSurface(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1817 else if(cmd.cmd3 == 73) |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1818 LoadSurface(name, 1); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1819 else |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1820 LoadSurface(name); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1821 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1822 StartAnm(sel); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1823 status = WAIT_ANM; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1824 event.RegisterGlobalPressFunc(&Pressed, (void*)this); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1825 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1826 if (name[0] == '?') |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1827 cmd.cmd_type = CMD_SAVECMDGRP_ONCE; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1828 else |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1829 cmd.cmd_type = CMD_SAVECMDGRP_START; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1830 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1831 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1832 void GrpImpl::impl_shake(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1833 // shake screen |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1834 char key[11]; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1835 sprintf(key, "#SHAKE.%03d", cmd.args[0].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1836 if (config->SearchParam(key) != 2) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1837 fprintf(stderr,"Cannot find shake pattern %d; use default pattern\n",cmd.args[0].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1838 strcpy(key, "#SHAKE.000"); // default key |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1839 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1840 int num; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1841 const int* pattern; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1842 pattern = config->GetParamArray(key, num); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1843 if (pattern) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1844 StartShake(num, pattern); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1845 status = WAIT_SHAKE; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1846 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1847 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1848 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1849 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1850 void GrpImpl::impl_grpCopy(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1851 if (cmd.cmd4 == 2) { // copy (KANOGI) |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1852 int sx = cmd.args[0].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1853 int sy = cmd.args[1].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1854 int w = cmd.args[2].value - sx; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1855 int h = cmd.args[3].value - sy; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1856 Rect rect(sx, sy, sx+w, sy+h); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1857 int src = cmd.args[4].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1858 int dx = cmd.args[5].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1859 int dy = cmd.args[6].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1860 int dest = cmd.args[7].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1861 unsigned char alpha; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1862 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1863 printf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1864 if (src == dest) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1865 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1866 src = WORKPDT; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1867 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1868 parent.Root().BlitSurface(Ssurface(src), rect, Dsurface(dest), Rect(dx,dy)); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1869 if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h)); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1870 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1871 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1872 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1873 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1874 void GrpImpl::impl_recFill(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1875 int x = cmd.args[0].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1876 int y = cmd.args[1].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1877 int w = cmd.args[2].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1878 int h = cmd.args[3].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1879 Rect rect(x, y, x+w, y+w); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1880 int pdt = cmd.args[4].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1881 int r = cmd.args[5].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1882 int g = cmd.args[6].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1883 int b = cmd.args[7].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1884 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1885 if (cmd.cmd4 == 2) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1886 eprintf("clear %d:(%d,%d) size (%d,%d) r %d g %d b %d\n",pdt,x,y,w,h,r,g,b); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1887 DSurfaceFill(Dsurface(pdt), rect, r, g, b); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1888 // if (pdt == 0) screen->ReBlit(rect); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1889 cmd.cmd_type = CMD_SAVECMDGRP; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1890 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1891 else if (cmd.cmd4 == 3) { // alpha つきfill |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1892 int a = cmd.args[8].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1893 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); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1894 if (a <= 0) ; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1895 else if (a >= 255) DSurfaceFill(Dsurface(pdt), rect, r, g, b); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1896 else { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1897 DSurfaceFill(Dsurface(WORKPDT), rect, r, g, b, a); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1898 parent.Root().BlitSurface(Dsurface(WORKPDT), rect, Dsurface(pdt), rect); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1899 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1900 // if (pdt == 0) screen->ReBlit(rect); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1901 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1902 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1903 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1904 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1905 void GrpImpl::impl_recCopy(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1906 int sx = cmd.args[0].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1907 int sy = cmd.args[1].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1908 int w = cmd.args[2].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1909 int h = cmd.args[3].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1910 Rect rect(sx, sy, sx + w, sy + h); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1911 int src = cmd.args[4].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1912 int dx = cmd.args[5].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1913 int dy = cmd.args[6].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1914 int dest = cmd.args[7].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1915 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1916 if (cmd.cmd4 == 2) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1917 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1918 parent.Root().BlitSurface(Ssurface(src), rect, Dsurface(dest), Rect(dx,dy)); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1919 //DSurfaceMove(Ssurface(src), Rect(sx,sy,sx+w,sy+h), Dsurface(dest), Rect(dx,dy)); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1920 // if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h)); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1921 cmd.cmd_type = CMD_SAVECMDGRP; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1922 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1923 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1924 else if (cmd.cmd4 == 3) { // alpha つきcopy |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1925 unsigned char alpha; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1926 if (cmd.args[8].value < 0) alpha = 0; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1927 else if (cmd.args[8].value > 255) alpha = 255; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1928 else alpha = cmd.args[8].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1929 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1930 if (src == dest) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1931 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1932 src = WORKPDT; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1933 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1934 if (alpha != 0) |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1935 parent.Root().BlitSurface(Ssurface(src), rect, &alpha, Rect(0,0,1,1), Dsurface(dest), Rect(dx,dy), 0); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1936 // if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h)); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1937 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1938 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1939 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1940 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1941 void GrpImpl::impl_recAdd(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1942 if (cmd.cmd4 == 3) { // saturate mode で alpha 付き copy |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1943 int sx = cmd.args[0].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1944 int sy = cmd.args[1].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1945 int w = cmd.args[2].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1946 int h = cmd.args[3].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1947 Rect rect(sx, sy, sx+w, sy+h); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1948 int src = cmd.args[4].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1949 int dx = cmd.args[5].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1950 int dy = cmd.args[6].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1951 int dest = cmd.args[7].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1952 unsigned char alpha; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1953 if (cmd.args[8].value < 0) alpha = 0; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1954 else if (cmd.args[8].value > 255) alpha = 255; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1955 else alpha = cmd.args[8].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1956 eprintf("copy surface w/ saturate %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1957 if (src == dest) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1958 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1959 src = WORKPDT; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1960 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1961 if (alpha != 0) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1962 // saturate mode : screen (picture) を一時的に作成 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1963 PicBase* screen_tmp = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1964 screen_tmp->SetSurface(Ssurface(src), 0, 0, PicBase::BLIT_SATURATE); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1965 screen_tmp->SetSurfaceRect(rect); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1966 screen_tmp->Move(dx, dy); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1967 screen_tmp->SetSurfaceAlpha(&alpha, Rect(0,0,1,1)); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1968 screen_tmp->SimpleBlit(Dsurface(dest)); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1969 delete screen_tmp; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1970 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1971 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1972 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1973 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1974 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1975 void GrpImpl::impl_grpPan(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1976 if (cmd.cmd4 == 0) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1977 Rect r_from(cmd.args[0].value, cmd.args[1].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1978 Rect r_to(cmd.args[2].value, cmd.args[3].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1979 int src_pdt = cmd.args[4].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1980 Rect r(cmd.args[5].value,cmd.args[6].value,cmd.args[7].value+1,cmd.args[8].value+1); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1981 int tm = cmd.args[9].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1982 fprintf(stderr,"??? cmd time %d\n",tm); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1983 // anm1 = new ScnGrpMove(event, screen, parent.Root(), surface, r, Ssurface(2), r_from, r_to, tm); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1984 // status = WAIT_ANM; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1985 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1986 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1987 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1988 void GrpImpl::impl_snmBgScroll(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1989 if (cmd.cmd4 == 0) { // スクロールする画像効果(Princess Bride) |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1990 if (anm2 != NULL) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1991 anm2->Abort(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1992 delete anm2; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1993 anm2 = NULL; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1994 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1995 PicBase* pic; Surface* s; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1996 Rect r(cmd.args[1].value, cmd.args[2].value, cmd.args[3].value+1, cmd.args[4].value+1); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1997 const char* name = cmd.Str(cmd.args[5]); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1998 Rect sr_start(cmd.args[6].value,cmd.args[7].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
1999 Rect sr_end(cmd.args[8].value,cmd.args[9].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2000 int tm = cmd.args[10].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2001 LoadSurface(name, 2); /* PDT2 に読み込み、と決め打ち */ |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2002 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2003 anm2 = new ScnGrpMove(event, screen, parent.Root(), Dsurface(1), r, Ssurface(2), sr_start, sr_end, tm); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2004 cmd.cmd_type = CMD_SAVECMDGRP; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2005 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2006 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2007 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2008 void GrpImpl::impl_snmPlay(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2009 if (cmd.cmd4 == 0) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2010 // カードが落ちるアニメーション |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2011 int i; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2012 ScnGrpAnm* new_anm = new ScnGrpAnm(event, screen, *this); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2013 if (cmd.cmd3 == 0x834 || cmd.cmd3 == 0x835) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2014 AbortAnm(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2015 anm1 = new_anm; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2016 if (cmd.cmd3 == 0x835) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2017 status = WAIT_ANM; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2018 event.RegisterGlobalPressFunc(&Pressed, (void*)this); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2019 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2020 } else { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2021 anm2 = new_anm; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2022 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2023 for (i=0; i<cmd.argc; i++) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2024 const char* name = cmd.Str(cmd.args[i*3+1]); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2025 int tm = cmd.args[i*3+2].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2026 new_anm->push_back(ScnGrpAnmAtom(name,tm)); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2027 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2028 new_anm->CalcTotal(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2029 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2030 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2031 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2032 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2033 void GrpImpl::impl_cgGet(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2034 if (cmd.cmd3 == 0x5dc) // Total number of CG |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2035 cmd.SetSysvar(cgm_size); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2036 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2037 if (cmd.cmd3 == 0x5dd) // Number of CG viewed |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2038 cmd.SetSysvar(cgm_data.size()); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2039 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2040 if (cmd.cmd3 == 0x5de) // Percentage of CG viewed |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2041 cmd.SetSysvar(cgm_data.size() * 100 / cgm_size); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2042 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2043 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2044 void GrpImpl::impl_cgStatus(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2045 string s = cmd.Str(cmd.args[0]); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2046 if (cgm_info.find(s) == cgm_info.end()) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2047 fprintf(stderr,"cmd 01-04:05e0 : cannot find cgm-info of '%s'\n",s.c_str()); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2048 cmd.SetSysvar(-1); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2049 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2050 else { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2051 int n = cgm_info[s]; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2052 if (cmd.cmd3 == 1503) cmd.SetSysvar(n); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2053 else { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2054 if (cgm_data.find(n) == cgm_data.end()) cmd.SetSysvar(0); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2055 else cmd.SetSysvar(1); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2056 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2057 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2058 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2059 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2060 void GrpImpl::impl_objClear(Cmd& cmd) { //FIXME: may be broken (doesn't reflect what Haeleth says) |
55 | 2061 if (cmd.cmd1 == 1) |
2062 DeleteObj(cmd.args[0].value); | |
2063 if (cmd.cmd1 == 2) | |
2064 DeleteSubObj(cmd.args[0].value, cmd.args[1].value); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2065 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2066 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2067 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2068 void GrpImpl::impl_createObj(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2069 /**************: |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2070 0x47 : オブジェクト内容の設定 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2071 1100: G00 file |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2072 1003: GAN file |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2073 1100: rect |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2074 1200: string |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2075 1300: weather effects |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2076 1400: number |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2077 */ |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2078 int base_argc = 0; |
55 | 2079 |
2080 if (cmd.cmd1 == 1) { // 1: group object | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2081 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除 |
55 | 2082 if (cmd.cmd2 == 71) |
2083 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除 | |
2084 } | |
2085 else { // 2: single object in group | |
2086 DeleteSubObjPic(cmd.args[0].value, cmd.args[1].value); // 旧ファイル名のsurfaceを削除 | |
2087 if (cmd.cmd2 == 71) | |
2088 DeleteSubObjPic(cmd.args[0].value, cmd.args[1].value); // 旧ファイル名のsurfaceを削除 | |
2089 } | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2090 |
55 | 2091 GrpObj* g = (cmd.cmd2 == 71) ? &grpobj[cmd.args[0].value] : &bs_obj[cmd.args[0].value]; |
2092 if (cmd.cmd1 == 2) // 2: single object in a group | |
2093 g = &g->children_obj[cmd.args[1].value]; | |
2094 | |
2095 if (cmd.cmd1 == 2) | |
2096 base_argc = 1; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2097 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2098 if (cmd.cmd3 == 1000) { /* ファイル名設定 */ |
55 | 2099 g->gtype = GrpObj::FILE; //FIXME: Strange thing in the main menu; that happens with objComposite |
2100 string name = cmd.Str(cmd.args[base_argc + 1]); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2101 if (name.find('?') != -1) { |
55 | 2102 //Maybe it's for shading or something like that? |
2103 printf("Warning: the part after the '?' was removed: '%s'\n", name.c_str()); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2104 name.erase(name.find('?')); // '?' 以降の意味がわからない |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2105 } |
55 | 2106 g->name = name; |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2107 } else if (cmd.cmd3 == 1003) { /* ファイル名設定(GAN含む) */ |
55 | 2108 g->gtype = GrpObj::GAN; |
2109 if (cmd.Str(cmd.args[base_argc + 1]) == string("???")) | |
2110 g->name = cmd.Str(cmd.args[base_argc + 2]); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2111 else |
55 | 2112 g->name = cmd.Str(cmd.args[base_argc + 1]); |
2113 g->gan_name = cmd.Str(cmd.args[base_argc + 2]); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2114 |
55 | 2115 if (cmd.cmd4 >= 1 && cmd.args[base_argc + 3].value == 0) |
2116 g->attr = GrpObj::Attribute(g->attr | GrpObj::HIDDEN); | |
2117 else | |
2118 g->attr = GrpObj::Attribute(g->attr & ~(GrpObj::HIDDEN)); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2119 |
55 | 2120 if (cmd.argc >= base_argc + 5) |
2121 g->SetPos(1, cmd.args[base_argc + 4].value, -cmd.args[base_argc + 5].value); | |
2122 | |
2123 if (g->name.find('?') != -1) { | |
2124 g->name.erase(g->name.find('?')); | |
2125 g->gan_name = cmd.Str(cmd.args[base_argc + 2]); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2126 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2127 } else if (cmd.cmd3 == 1200) { // 画像を文字列として指定 |
55 | 2128 g->gtype = GrpObj::MOJI; |
2129 g->print_moji = cmd.Str(cmd.args[base_argc + 1]); | |
2130 g->attr = GrpObj::Attribute(g->attr & (~GrpObj::HIDDEN)); // 常に表示がデフォルト? | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2131 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2132 } else if (cmd.cmd3 == 1400) { // 数値を画像として表示 |
55 | 2133 g->gtype = GrpObj::DIGIT; |
2134 g->name = cmd.Str(cmd.args[base_argc + 1]); | |
0 | 2135 } |
55 | 2136 |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2137 CreateObj(cmd.args[0].value); |
55 | 2138 if (cmd.cmd1 == 2) |
2139 CreateSubObj(cmd.args[0].value, cmd.args[1].value); | |
2140 | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2141 if (cmd.cmd3 == 1000 || cmd.cmd3 == 1003 || cmd.cmd3 == 1200 || cmd.cmd3 == 1400) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2142 // FILE, GAN, MOJI, DIGIT ならば座標等の設定を行う |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2143 if (cmd.cmd4 >= 1) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2144 if (cmd.args[2+base_argc].value == 0) { |
55 | 2145 g->attr = GrpObj::Attribute(g->attr | GrpObj::HIDDEN); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2146 } else { |
55 | 2147 g->attr = GrpObj::Attribute(g->attr & (~GrpObj::HIDDEN)); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2148 } |
55 | 2149 SetObjChanged(cmd.args[0].value); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2150 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2151 if (cmd.cmd4 >= 2) { // 座標等も設定 |
55 | 2152 g->SetPos(0, cmd.args[3+base_argc].value, cmd.args[4+base_argc].value); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2153 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2154 if ( (cmd.cmd3 == 1000 || cmd.cmd3 == 1003) && cmd.cmd4 >= 3) { // pattern 番号も設定 |
55 | 2155 g->SetSurfaceNum(cmd.args[5+base_argc].value); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2156 base_argc++; // 1000 (FILE) / 1003 (GAN) の場合のみこのオプションは存在する |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2157 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2158 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2159 } else { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2160 fprintf(stderr,"CreateObj : cmd.cmd3 = %04x ; not supported!\n",cmd.cmd3); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2161 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2162 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2163 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2164 void GrpImpl::impl_gan(Cmd& cmd) { |
55 | 2165 int base_arg = 0; |
2166 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2167 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2168 if (cmd.cmd3 == 3) { // ganIsPlaying |
55 | 2169 if (g->anm == NULL || g->anm->IsEnd()) |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2170 cmd.SetSysvar(0); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2171 else |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2172 cmd.SetSysvar(1); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2173 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2174 else if (cmd.cmd3 == 1000) { // ganStop |
55 | 2175 if (g->anm == NULL || g->anm->IsEnd()) |
2176 g->SetSurfaceNum(cmd.args[1].value); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2177 else { |
55 | 2178 g->anm->Abort(); |
2179 g->SetSurfaceNum(cmd.args[1].value); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2180 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2181 SetObjChanged(cmd.args[0].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2182 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2183 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2184 else if (cmd.cmd3 == 2003) { // objPlay |
55 | 2185 g->CreateGanSpecial(event, 0, cmd.args[1].value); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2186 // g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2187 SetObjChanged(cmd.args[0].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2188 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2189 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2190 else if (cmd.cmd3 == 3001 || cmd.cmd3 == 3003 || cmd.cmd3 == 3005 || |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2191 cmd.cmd3 == 1001 || cmd.cmd3 == 1003 || cmd.cmd3 == 1005) { // ganPlay* |
55 | 2192 g->CreateGan(event, cmd.args[1].value); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2193 // g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2194 SetObjChanged(cmd.args[0].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2195 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2196 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2197 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2198 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2199 void GrpImpl::impl_objSetPos(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2200 //obj or objBg |
55 | 2201 int base_arg = 0; |
2202 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2203 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2204 int index, x, y; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2205 if (cmd.cmd3 == 1006 || cmd.cmd3 == 2006) { //objAdjust |
55 | 2206 index = cmd.args[1+base_arg].value + 1; |
2207 x = cmd.args[2+base_arg].value; | |
2208 y = cmd.args[3+base_arg].value; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2209 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2210 else { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2211 index = 0; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2212 if (cmd.cmd3 == 1000) { |
55 | 2213 x = cmd.args[1+base_arg].value; |
2214 y = cmd.args[2+base_arg].value; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2215 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2216 else { |
55 | 2217 g->GetPos(index, x, y); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2218 if (cmd.cmd3 == 1001) |
55 | 2219 x = cmd.args[1+base_arg].value; |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2220 else |
55 | 2221 y = cmd.args[1+base_arg].value; |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2222 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2223 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2224 |
55 | 2225 g->SetPos(index, x, y); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2226 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2227 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2228 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2229 void GrpImpl::impl_objAlpha(Cmd& cmd) { |
55 | 2230 int base_arg = 0; |
2231 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
2232 | |
2233 g->SetAlpha(cmd.args[base_arg + 1].value); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2234 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2235 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2236 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2237 void GrpImpl::impl_objShow(Cmd& cmd) { |
55 | 2238 int base_arg = 0; |
2239 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
2240 | |
2241 if (cmd.args[base_arg + 1].value) | |
2242 g->attr = GrpObj::Attribute(g->attr & (~GrpObj::HIDDEN)); | |
2243 else | |
2244 g->attr = GrpObj::Attribute(g->attr | GrpObj::HIDDEN); | |
2245 | |
2246 g->attr = GrpObj::Attribute(g->attr | GrpObj::UPDATE_VISIBLE); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2247 // グループ単位で次の RefreshObj で表示・消去 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2248 if (cmd.cmd2 == 0x51) //not Bg |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2249 SetObjChanged(cmd.args[0].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2250 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2251 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2252 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2253 void GrpImpl::impl_objColour(Cmd& cmd) { |
55 | 2254 int base_arg = 0; |
2255 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
2256 | |
2257 g->print_r = cmd.args[base_arg+1].value; | |
2258 g->print_g = cmd.args[base_arg+2].value; | |
2259 g->print_b = cmd.args[base_arg+3].value; | |
2260 g->SetUpdate(); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2261 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2262 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2263 |
55 | 2264 void GrpImpl::impl_objComposite(Cmd& cmd) {//FIXME |
2265 int base_arg = 0; | |
2266 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
2267 | |
2268 if (cmd.args[base_arg + 1].value == 1) { | |
2269 g->attr = GrpObj::Attribute(g->attr | GrpObj::SATURATE); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2270 cmd.clear(); |
55 | 2271 } else if (cmd.args[base_arg + 1].value == 0) { |
2272 g->attr = GrpObj::Attribute(g->attr & (~GrpObj::SATURATE)); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2273 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2274 } |
55 | 2275 g->SetUpdate(); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2276 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2277 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2278 void GrpImpl::impl_objSetText(Cmd& cmd) { |
55 | 2279 int base_arg = 0; |
2280 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2281 |
55 | 2282 g->print_moji = cmd.Str(cmd.args[base_arg + 1]); |
2283 g->SetUpdate(); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2284 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2285 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2286 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2287 void GrpImpl::impl_objTextOpts(Cmd& cmd) { |
55 | 2288 int base_arg = 0; |
2289 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
2290 | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2291 // 画像を文字列として設定:文字の大きさなど |
55 | 2292 g->print_size = cmd.args[base_arg + 1].value; |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2293 /* 前景色を得る */ |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2294 int cr, cg, cb; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2295 char key[17]; |
55 | 2296 sprintf(key, "#COLOR_TABLE.%03d", cmd.args[base_arg + 5].value); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2297 if (config->GetParam(key, 3, &cr, &cg, &cb)) { // color not found |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2298 cr = cg = cb = 0; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2299 } |
55 | 2300 g->print_r = cr; |
2301 g->print_g = cg; | |
2302 g->print_b = cb; | |
2303 g->SetUpdate(); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2304 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2305 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2306 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2307 void GrpImpl::impl_objOrder(Cmd& cmd) { |
55 | 2308 int base_arg = 0; |
2309 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
2310 | |
2311 int order = cmd.args[base_arg + 1].value; | |
2312 g->order = order; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2313 ZMoveObj(cmd.args[0].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2314 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2315 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2316 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2317 void GrpImpl::impl_objDispArea(Cmd& cmd) { |
55 | 2318 int base_arg = 0; |
2319 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
2320 | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2321 // オブジェクトのどの部分を画面に表示するか(クリップ領域)の設定 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2322 int rx, ry, w, h; |
55 | 2323 if (cmd.args.size() == base_arg + 5) { |
2324 int rx = cmd.args[base_arg + 1].value; | |
2325 int ry = cmd.args[base_arg + 2].value; | |
2326 int w = cmd.args[base_arg + 3].value; | |
2327 int h = cmd.args[base_arg + 4].value; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2328 if (cmd.cmd3 == 1005) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2329 w -= rx; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2330 h -= ry; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2331 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2332 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2333 else { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2334 rx = ry = 0; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2335 w = screen->Width(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2336 h = screen->Height(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2337 } |
55 | 2338 g->SetClipArea(rx, ry, w, h); //TODO: case when cmd.args.size() == 1 |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2339 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2340 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2341 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2342 void GrpImpl::impl_objSetDigits(Cmd& cmd) { |
55 | 2343 int base_arg = 0; |
2344 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
2345 | |
2346 g->dig_number = cmd.args[base_arg + 1].value; | |
2347 g->SetUpdate(); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2348 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2349 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2350 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2351 void GrpImpl::impl_objNumOpts(Cmd& cmd) { |
55 | 2352 int base_arg = 0; |
2353 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
2354 | |
2355 g->dig_digit = cmd.args[base_arg + 1].value; | |
2356 int attr = g->attr; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2357 attr &= ~(GrpObj::DIG_ZERO | GrpObj::DIG_SIGN | GrpObj::DIG_PACK); |
55 | 2358 if (cmd.args[base_arg + 2].value) attr |= GrpObj::DIG_ZERO; |
2359 if (cmd.args[base_arg + 3].value) attr |= GrpObj::DIG_SIGN; | |
2360 if (cmd.args[base_arg + 4].value) attr |= GrpObj::DIG_PACK; | |
2361 g->attr = GrpObj::Attribute(attr); | |
2362 g->SetUpdate(); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2363 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2364 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2365 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2366 void GrpImpl::impl_objPattNo(Cmd& cmd) { |
55 | 2367 int base_arg = 0; |
2368 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
2369 | |
2370 g->SetSurfaceNum(cmd.args[base_arg + 1].value); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2371 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2372 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2373 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2374 void GrpImpl::impl_objScale(Cmd& cmd) { |
55 | 2375 int base_arg = 0; |
2376 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
2377 | |
2378 int zoom = (cmd.args[base_arg + 1].value + cmd.args[base_arg + 2].value)/2; //FIXME: eurk | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2379 zoom = zoom*256/100; |
55 | 2380 g->SetZoomRotate(zoom, -1); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2381 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2382 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2383 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2384 void GrpImpl::impl_objRotate(Cmd& cmd) { |
55 | 2385 int base_arg = 0; |
2386 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51)); | |
2387 | |
2388 int angle = cmd.args[base_arg + 1].value; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2389 angle /= 10; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2390 if (angle < 0) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2391 angle %= 360; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2392 angle += 360; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2393 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2394 angle %= 360; |
55 | 2395 g->SetZoomRotate(-1, angle); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2396 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2397 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2398 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2399 void GrpImpl::impl_objPosDims(Cmd& cmd) { |
55 | 2400 int base_arg = 0; |
2401 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, true); | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2402 |
55 | 2403 VarInfo arg1 = cmd.args[base_arg + 1]; |
2404 VarInfo arg2 = cmd.args[base_arg + 2]; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2405 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2406 int val1, val2; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2407 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2408 if (cmd.cmd3 == 1000) |
55 | 2409 g->GetPos(0, val1, val2); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2410 else if (cmd.cmd3 == 1100) |
55 | 2411 g->GetSrcGeom(val1, val2); |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2412 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2413 cmd.SetFlagvar(arg1, val1); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2414 cmd.SetFlagvar(arg2, val2); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2415 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2416 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2417 void GrpImpl::impl_refresh(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2418 // 本来は grpstack clear らしい |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2419 RefreshObj(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2420 // Princess Bride の中途 Staff roll |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2421 // このタイミングで描画するのが都合がいいので、 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2422 //シナリオループを抜けて描画を起動 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2423 cmd.cmd_type = CMD_WAITFRAMEUPDATE; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2424 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2425 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2426 void GrpImpl::impl_bgmLoop(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2427 if (cmd.cmd4 == 0 || cmd.cmd4 == 2) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2428 int count = 8000; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2429 if (cmd.cmd3 == 2) |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2430 count = 0; //bgmPlay, play once |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2431 music->PlayCDROM((char*)cmd.Str(cmd.args[0]), count); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2432 cmd.cmd_type = CMD_SAVECMD_ONCE; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2433 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2434 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2435 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2436 void GrpImpl::impl_bgmStop(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2437 if (cmd.cmd4 == 0) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2438 if (cmd.cmd3 == 5) |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2439 music->StopCDROM(0); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2440 else if (cmd.cmd3 == 105) |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2441 music->StopCDROM(cmd.args[0].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2442 cmd.cmd_type = CMD_SAVECMD_ONCE; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2443 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2444 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2445 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2446 void GrpImpl::impl_playWav(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2447 if (cmd.cmd3 == 2) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2448 music->PlaySE(cmd.Str(cmd.args[0]), 1); //loop |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2449 cmd.cmd_type = CMD_SAVECMD_ONCE; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2450 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2451 else { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2452 music->PlaySE(cmd.Str(cmd.args[0])); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2453 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2454 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2455 if (cmd.cmd3 == 1) |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2456 status = WAIT_SE; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2457 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2458 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2459 void GrpImpl::impl_playSE(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2460 music->PlaySE(cmd.args[0].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2461 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2462 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2463 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2464 void GrpImpl::impl_stopWav(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2465 if (cmd.cmd3 == 5) |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2466 music->StopSE(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2467 else if (cmd.cmd3 == 105) |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2468 music->StopSE(cmd.args[0].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2469 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2470 cmd.cmd_type = CMD_SAVECMD_ONCE; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2471 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2472 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2473 void GrpImpl::impl_SetVolMod(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2474 music->volmod[cmd.cmd3-0x8b6] = cmd.args[0].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2475 config->SetParam("#VOLMOD", 4, music->volmod[0], music->volmod[1], music->volmod[2], music->volmod[3]); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2476 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2477 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2478 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2479 void GrpImpl::impl_GetVolMod(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2480 cmd.SetSysvar(music->volmod[cmd.cmd3-0x91a]); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2481 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2482 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2483 void GrpImpl::impl_koePlay(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2484 eprintf("play koe %d",cmd.args[0].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2485 if (cmd.cmd4 == 1) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2486 eprintf(", para? %d",cmd.args[1].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2487 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2488 eprintf("\n"); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2489 char buf[1024]; sprintf(buf, "%d",cmd.args[0].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2490 if ( !(skip_mode & SKIP_TEXT)) music->PlayKoe(buf); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2491 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2492 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2493 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2494 /*It may be useful... or not. |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2495 void GrpImpl::impl_objSwap(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2496 if (cmd.cmd1 == 1 && cmd.args.size() == 2) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2497 SwapObj(cmd.args[0].value, cmd.args[1].value); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2498 } |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2499 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2500 }*/ |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2501 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2502 void GrpImpl::impl_movPlay(Cmd& cmd) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2503 if ( cmd.cmd4 == 0) { |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2504 const char* str = cmd.Str(cmd.args[0]); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2505 int x = cmd.args[1].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2506 int y = cmd.args[2].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2507 int x2 = cmd.args[3].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2508 int y2 = cmd.args[4].value; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2509 eprintf("play movie ; name %s pos %d,%d - %d,%d\n",str,x,y,x2,y2); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2510 music->PlayMovie(str, x, y, x2, y2,1); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2511 status = WAIT_MOVIE; |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2512 event.RegisterGlobalPressFunc(&Pressed, (void*)this); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2513 cmd.clear(); |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2514 } |
0 | 2515 } |
52 | 2516 |
0 | 2517 void GrpImpl::Exec(Cmd& cmd) { |
2518 if (cmd.cmd_type == CMD_TEXTEND) { | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
2519 music->StopKoe(500); // テキスト終了で声を止める |
0 | 2520 cmd.clear(); |
2521 return; | |
2522 } | |
2523 if (cmd.cmd_type == CMD_WAITFRAMEUPDATE) { | |
2524 // wait する場合は RefreshObj() しておく | |
2525 RefreshObj(); | |
2526 } | |
2527 if (cmd.cmd_type != CMD_OTHER) return; | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2528 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2529 CommandHandler::Exec(cmd); |
26 | 2530 |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2531 //TODO: ??? |
0 | 2532 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x3c && cmd.cmd3 == 0) { // ??? : KANOGI : 画像オブジェクトの削除? |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2533 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除 |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2534 GrpObj& g = grpobj[cmd.args[0].value]; |
0 | 2535 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); |
2536 cmd.clear(); | |
2537 } | |
5 | 2538 |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2539 //TODO: ??? |
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2540 if ( (cmd.cmd1 == 1 || cmd.cmd1 == 2) && cmd.cmd2 == 0x51) { |
55 | 2541 /*GrpObj& g = grpobj[cmd.args[0].value]; |
2542 int attr; | |
2543 GrpObjMap::iterator it; | |
2544 for (it = g.children_obj.begin(); it != g.children_obj.end(); it++) | |
2545 attr |= it->second.attr; | |
2546 if (attr & GrpObj::UPDATE_ALL) | |
2547 SetObjChanged(cmd.args[0].value);*/ | |
2548 GrpObj* g; | |
2549 if (cmd.cmd1 == 2) | |
2550 g = GetGraphicObj(cmd.args[0].value, cmd.args[1].value); | |
2551 else | |
2552 g = GetGraphicObj(cmd.args[0].value); | |
2553 if (g->attr & GrpObj::UPDATE_ALL) | |
54
d7cde171a1de
* scn2k_grp.cc now handles commands in a cleanier way \o/
thib
parents:
53
diff
changeset
|
2554 SetObjChanged(cmd.args[0].value); |
0 | 2555 } |
2556 } | |
2557 | |
2558 | |
2559 /******************************************************** | |
2560 ** | |
2561 ** class Grp | |
2562 */ | |
2563 | |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
2564 Grp::Grp(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm) { |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
2565 pimpl = new GrpImpl(_event, _parent, f, _cgm); |
52 | 2566 } |
2567 | |
0 | 2568 Grp::~Grp() { |
2569 delete pimpl; | |
2570 } | |
2571 | |
2572 bool Grp::Wait(unsigned int current_time, Cmd& cmd) { | |
2573 return pimpl->Wait(current_time, cmd); | |
2574 } | |
52 | 2575 |
0 | 2576 void Grp::Exec(Cmd& cmd) { |
2577 pimpl->Exec(cmd); | |
2578 } | |
52 | 2579 |
0 | 2580 void Grp::SetSkipMode(SkipMode mode) { |
2581 pimpl->SetSkipMode(mode); | |
2582 } | |
52 | 2583 |
53
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
2584 void Grp::InitSel(void) { |
ddbcbd000206
* MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents:
52
diff
changeset
|
2585 pimpl->InitSel(); |
0 | 2586 } |
52 | 2587 |
0 | 2588 void Grp::Save(std::string& str) { |
2589 pimpl->Save(str); | |
2590 } | |
2591 | |
2592 void Grp::Load(const char* str) { | |
2593 pimpl->Load(str); | |
2594 } | |
2595 void Grp::SaveSys(std::string& str) { | |
2596 pimpl->SaveSys(str); | |
2597 } | |
2598 | |
2599 void Grp::LoadSys(const char* str) { | |
2600 pimpl->LoadSys(str); | |
2601 } |