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