comparison 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
comparison
equal deleted inserted replaced
53:ddbcbd000206 54:d7cde171a1de
132 GrpObjMap(class GrpImpl* p) { 132 GrpObjMap(class GrpImpl* p) {
133 parent = p; 133 parent = p;
134 } 134 }
135 }; 135 };
136 136
137 class GrpImpl { 137 class GrpImpl : public CommandHandler {
138 #define MAXPDT 256 138 #define MAXPDT 256
139 #define WORKPDT 255 139 #define WORKPDT 255
140 private: 140 private:
141 Event::Container& event;
142 const Flags& flags;
143 PicBase* screen;
144 PicBase* screen_front;
145 Surface* surface, *surface_update;
146
147 Surface* dsurface[MAXPDT]; // 書き込み可能な Surface
148 Surface* ssurface[MAXPDT]; // ファイルの内容等、読み込みのみ可能な状態の Surface
149 PicContainer& parent;
150
151 // 画像効果の保存用
152 WidAnmTime* anm1, *anm2;
153 typedef enum { NORMAL, WAIT_ANM, WAIT_SHAKE, WAIT_SE, WAIT_MOVIE} Status;
154 Status status;
155 SkipMode skip_mode;
156
157 std::string bg_name;
158 std::map<int, SEL> anmtype;
159 GrpObjMap grpobj;
160 GrpObjMap bs_obj;
161 void CreateObj(int number); 141 void CreateObj(int number);
162 void ZMoveObj(int number); 142 void ZMoveObj(int number);
163 void SetObjChanged(int number); 143 void SetObjChanged(int number);
164 void SetObjChangedGroup(int number);
165 void SwapObj(int a1, int a2); 144 void SwapObj(int a1, int a2);
166 void DeleteObjPic(int num);// object の surface のみ削除 145 void DeleteObjPic(int num);// object の surface のみ削除
167 void DeleteObj(int num); 146 void DeleteObj(int num);
168 void DeleteObjRange(int num_b, int num_e);
169
170 std::set<int> changed_obj;
171 string reserved_load_surface0;
172 vector<PicBase*> deleted_pic;
173 void RefreshObj(void); 147 void RefreshObj(void);
174 148
175 Surface* Dsurface(int pdt); 149 Surface* Dsurface(int pdt);
176 Surface* Ssurface(int pdt); 150 Surface* Ssurface(int pdt);
177 151
178 // cgmode 用画像処理関連 152 // cgmode 用画像処理関連
179 void LoadCgm(void); 153 void LoadCgm(void);
180 std::map<std::string, int> cgm_info;
181 set<int>& cgm_data;
182 int cgm_size;
183
184 class MuSys *music;
185
186 public:
187 AyuSysConfig *config;
188 void LoadSurface(const char* str, int pdt);
189
190 private:
191 void LoadSurface(const char* str);
192 void LoadSurface(void);
193 void AddSurface(const char* str);
194
195 void StartAnm(int type);
196 void StartShake(int total, const int* pattern);
197 void AbortAnm(void);
198 static bool Pressed(int x, int y, void* pointer);
199 154
200 public: 155 public:
201 GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& _flag, set<int>& _cgm_data); 156 GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& _flag, set<int>& _cgm_data);
202 ~GrpImpl(); 157 ~GrpImpl();
203 bool Wait(unsigned int current_time, Cmd& cmd); 158 bool Wait(unsigned int current_time, Cmd& cmd);
206 void Save(std::string& str); 161 void Save(std::string& str);
207 void Load(const char* str); 162 void Load(const char* str);
208 void SaveSys(std::string& str); 163 void SaveSys(std::string& str);
209 void LoadSys(const char* str); 164 void LoadSys(const char* str);
210 void SetSkipMode(SkipMode _mode); 165 void SetSkipMode(SkipMode _mode);
166 void LoadSurface(const char* str, int pdt);
167
168 private:
169 void LoadSurface(const char* str);
170 void LoadSurface(void);
171 void AddSurface(const char* str);
172
173 void StartAnm(int type);
174 void StartShake(int total, const int* pattern);
175 void AbortAnm(void);
176 static bool Pressed(int x, int y, void* pointer);
177
178 // Opcode handling
179 void impl_stackClear(Cmd& cmd);
180 void impl_grpBuffer(Cmd& cmd);
181 void impl_grpMulti(Cmd &cmd);
182 void impl_grpOpen(Cmd &cmd);
183 void impl_shake(Cmd &cmd);
184 void impl_grpCopy(Cmd &cmd);
185 void impl_recFill(Cmd &cmd);
186 void impl_recCopy(Cmd &cmd);
187 void impl_recAdd(Cmd &cmd);
188 void impl_grpPan(Cmd &cmd);
189 void impl_snmPlay(Cmd &cmd);
190 void impl_snmBgScroll(Cmd &cmd);
191 void impl_cgGet(Cmd &cmd);
192 void impl_cgStatus(Cmd &cmd);
193 void impl_objClear(Cmd &cmd);
194 void impl_createObj(Cmd &cmd);
195 void impl_gan(Cmd &cmd);
196 void impl_objSetPos(Cmd &cmd);
197 void impl_objAlpha(Cmd &cmd);
198 void impl_objShow(Cmd &cmd);
199 void impl_objColour(Cmd &cmd);
200 void impl_objComposite(Cmd &cmd);
201 void impl_objSetText(Cmd &cmd);
202 void impl_objTextOpts(Cmd &cmd);
203 void impl_objOrder(Cmd &cmd);
204 void impl_objDispArea(Cmd &cmd);
205 void impl_objSetDigits(Cmd &cmd);
206 void impl_objNumOpts(Cmd &cmd);
207 void impl_objPattNo(Cmd &cmd);
208 void impl_objScale(Cmd &cmd);
209 void impl_objRotate(Cmd &cmd);
210 void impl_objPosDims(Cmd &cmd);
211 void impl_refresh(Cmd &cmd);
212 void impl_bgmLoop(Cmd &cmd);
213 void impl_bgmStop(Cmd &cmd);
214 void impl_playWav(Cmd &cmd);
215 void impl_playSE(Cmd &cmd);
216 void impl_stopWav(Cmd &cmd);
217 void impl_SetVolMod(Cmd &cmd);
218 void impl_GetVolMod(Cmd &cmd);
219 void impl_koePlay(Cmd &cmd);
220 void impl_movPlay(Cmd &cmd);
221
222 public:
223 AyuSysConfig *config;
224
225 private:
226 Event::Container& event;
227 const Flags& flags;
228 PicBase* screen;
229 PicBase* screen_front;
230 Surface* surface, *surface_update;
231
232 Surface* dsurface[MAXPDT]; // 書き込み可能な Surface
233 Surface* ssurface[MAXPDT]; // ファイルの内容等、読み込みのみ可能な状態の Surface
234 PicContainer& parent;
235
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;
241
242 std::string bg_name;
243 std::map<int, SEL> anmtype;
244 GrpObjMap grpobj;
245 GrpObjMap bs_obj;
246
247 std::map<std::string, int> cgm_info;
248 set<int>& cgm_data;
249 int cgm_size;
250
251 class MuSys *music;
252
253 std::set<int> changed_obj;
254 string reserved_load_surface0;
255 vector<PicBase*> deleted_pic;
211 }; 256 };
212 /******************************************************************* 257 /*******************************************************************
213 ** GrpObj(implementation) 258 ** GrpObj(implementation)
214 */ 259 */
215 260
216 GrpObj::GrpObj(void) : 261 GrpObj::GrpObj(void) :
217 name(""), gan_name(""), pic_parent(0), picture(0), anm(0), 262 name(""), gan_name(""), pic_parent(0), picture(0), anm(0),
218 _posx(0), _posy(0), clip_area(0,0,0,0), 263 _posx(0), _posy(0), clip_area(0,0,0,0),
219 alpha(255), order(0), surface_num(0), print_moji(""), print_size(0), print_r(-1),print_g(-1),print_b(-1), 264 alpha(255), order(0), surface_num(0), print_moji(""), print_size(0), print_r(-1),print_g(-1),print_b(-1),
220 dig_number(0), dig_digit(0), 265 dig_number(0), dig_digit(0),
221 zoom(-1), rotate(-1), attr(GrpObj::HIDDEN), parent_pimpl(0) { 266 zoom(-1), rotate(-1), attr(GrpObj::HIDDEN), parent_pimpl(NULL) {
222 int i; 267 int i;
223 for (i=0; i<9; i++) { 268 for (i=0; i<9; i++) {
224 posx[i] = posy[i] = 0; 269 posx[i] = posy[i] = 0;
225 } 270 }
226 } 271 }
227 272
228 GrpObj::~GrpObj() { 273 GrpObj::~GrpObj() {
229 if (picture) delete picture; 274 if (picture) delete picture;
230 if (parent_pimpl == 0) { 275 if (parent_pimpl == NULL) {
231 fprintf(stderr,"\n**************\nFATAL : UNINITIALIZED GrpObj IS FOUND!!! \n**************\n"); 276 fprintf(stderr,"\n**************\nFATAL : UNINITIALIZED GrpObj IS FOUND!!! \n**************\n");
232 } 277 }
233 } 278 }
234 279
235 int GrpObj::PosX() { 280 int GrpObj::PosX() {
243 void GrpObj::SetUpdate(void) { 288 void GrpObj::SetUpdate(void) {
244 attr = Attribute (attr | UPDATE_PICTURE); 289 attr = Attribute (attr | UPDATE_PICTURE);
245 //Update(); //FIXME 290 //Update(); //FIXME
246 } 291 }
247 292
248 void GrpObj::SetPos(int index, int x,int y) { 293 void GrpObj::SetPos(int index, int x, int y) {
249 if (index < 0 || index > 8) { 294 if (index < 0 || index > 8) {
250 fprintf(stderr,"GrpObj::SetPos: Invalid index %d <- %d,%d\n",index,x,y); 295 fprintf(stderr,"GrpObj::SetPos: Invalid index %d <- %d,%d\n",index,x,y);
251 return; 296 return;
252 } 297 }
253 if (x == posx[index] && y == posy[index]) return; 298 if (x == posx[index] && y == posy[index]) return;
380 if (attr & UPDATE_CLIP) { 425 if (attr & UPDATE_CLIP) {
381 picture->SetClipArea(clip_area); 426 picture->SetClipArea(clip_area);
382 } 427 }
383 attr = Attribute(attr & (~UPDATE_ALL)); 428 attr = Attribute(attr & (~UPDATE_ALL));
384 if (attr & ANM_PLAYSTART) { 429 if (attr & ANM_PLAYSTART) {
385 if (anm) { 430 if (anm != NULL) {
386 anm->Play(); 431 anm->Play();
387 attr = Attribute(attr | ANM_PLAYING); 432 attr = Attribute(attr | ANM_PLAYING);
388 } 433 }
389 attr = Attribute(attr & (~ANM_PLAYSTART)); 434 attr = Attribute(attr & (~ANM_PLAYSTART));
390 } 435 }
556 void GrpObj::CreateGan(Event::Container& event, int event_number) { 601 void GrpObj::CreateGan(Event::Container& event, int event_number) {
557 if (picture == NULL) { 602 if (picture == NULL) {
558 fprintf(stderr,"GrpObj::CreateGan() is called before Create()\n"); 603 fprintf(stderr,"GrpObj::CreateGan() is called before Create()\n");
559 return; 604 return;
560 } 605 }
561 if (anm) { 606 if (anm != NULL) {
562 anm->Abort(); 607 anm->Abort();
563 delete anm; 608 delete anm;
609 anm = NULL;
564 } 610 }
565 if (gan_name.empty()) return; 611 if (gan_name.empty()) return;
566 /* アニーメション情報 (.GAN ファイル)を求める */ 612 /* アニーメション情報 (.GAN ファイル)を求める */
567 string path(gan_name); 613 string path(gan_name);
568 path += ".gan"; 614 path += ".gan";
624 void GrpObj::CreateGanSpecial(Event::Container& event, int event_number, int time) { 670 void GrpObj::CreateGanSpecial(Event::Container& event, int event_number, int time) {
625 if (picture == NULL) { 671 if (picture == NULL) {
626 fprintf(stderr,"GrpObj::CreateGan() is called before Create()\n"); 672 fprintf(stderr,"GrpObj::CreateGan() is called before Create()\n");
627 return; 673 return;
628 } 674 }
629 if (anm) { 675 if (anm != NULL) {
630 anm->Abort(); 676 anm->Abort();
631 delete anm; 677 delete anm;
678 anm = NULL;
632 } 679 }
633 680
634 // アニメーションを行う実体を作成 681 // アニメーションを行う実体を作成
635 AnmAlphaMove* wid = new AnmAlphaMove(event, picture); 682 AnmAlphaMove* wid = new AnmAlphaMove(event, picture);
636 683
776 screen_front->hide(); 823 screen_front->hide();
777 screen_front->ZMove(screen); 824 screen_front->ZMove(screen);
778 825
779 LoadCgm(); 826 LoadCgm();
780 827
828 RegisterCommand(1, 30, 0, "stackClear", (CmdImpl) &GrpImpl::impl_stackClear);
829 RegisterCommand(1, 33, 70, "grpBuffer", (CmdImpl) &GrpImpl::impl_grpBuffer);
830 RegisterCommand(1, 33, 73, "grpOpenBG", (CmdImpl) &GrpImpl::impl_grpOpen);
831 RegisterCommand(1, 33, 75, "grpMulti", (CmdImpl) &GrpImpl::impl_grpMulti); //FIXME: or not...
832 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &GrpImpl::impl_grpOpen);
833 RegisterCommand(1, 33, 32, "shake", (CmdImpl) &GrpImpl::impl_shake);
834 RegisterCommand(1, 33, 100, "grpCopy", (CmdImpl) &GrpImpl::impl_grpCopy);
835 RegisterCommand(1, 33, 1201, "recFill", (CmdImpl) &GrpImpl::impl_recFill);
836 RegisterCommand(1, 33, 1100, "recCopy", (CmdImpl) &GrpImpl::impl_recCopy);
837 RegisterCommand(1, 33, 1600, "recAdd", (CmdImpl) &GrpImpl::impl_recAdd);
838 RegisterCommand(1, 33, 406, "grpPan", (CmdImpl) &GrpImpl::impl_grpPan);
839
840 RegisterCommand(1, 34, 3120, "snmBgScroll", (CmdImpl) &GrpImpl::impl_snmBgScroll);
841 RegisterCommand(1, 34, 3100, "snmBgPlay", (CmdImpl) &GrpImpl::impl_snmPlay);
842 RegisterCommand(1, 34, 2100, "snmPlay", (CmdImpl) &GrpImpl::impl_snmPlay);
843 RegisterCommand(1, 34, 2101, "snmPlayEx", (CmdImpl) &GrpImpl::impl_snmPlay);
844
845 RegisterCommand(1, 4, 1500, "cgGetTotal", (CmdImpl) &GrpImpl::impl_cgGet);
846 RegisterCommand(1, 4, 1501, "cgGetViewed", (CmdImpl) &GrpImpl::impl_cgGet);
847 RegisterCommand(1, 4, 1502, "cgGetViewedPcnt", (CmdImpl) &GrpImpl::impl_cgGet);
848 RegisterCommand(1, 4, 1503, "cgGetFlag", (CmdImpl) &GrpImpl::impl_cgStatus);
849 RegisterCommand(1, 4, 1504, "cgStatus", (CmdImpl) &GrpImpl::impl_cgStatus);
850
851 RegisterCommand(1, 4, 0x6a4, "CreateInput", NULL);
852 RegisterCommand(1, 4, 0x6ae, "SetInput", NULL);
853
854 RegisterCommand(1, 61, 10, "objClear", (CmdImpl) &GrpImpl::impl_objClear);
855 RegisterCommand(1, 61, 11, "objDelete", (CmdImpl) &GrpImpl::impl_objClear);
856
857 RegisterCommand(1, 71, 1000, "createObjG00", (CmdImpl) &GrpImpl::impl_createObj);
858 RegisterCommand(1, 71, 1003, "createObjGAN", (CmdImpl) &GrpImpl::impl_createObj);
859 RegisterCommand(1, 71, 1100, "createObjRect", (CmdImpl) &GrpImpl::impl_createObj);
860 RegisterCommand(1, 71, 1200, "createObjText", (CmdImpl) &GrpImpl::impl_createObj);
861 RegisterCommand(1, 71, 1300, "createObjWeaver", (CmdImpl) &GrpImpl::impl_createObj);
862 RegisterCommand(1, 71, 1400, "createObjDigit", (CmdImpl) &GrpImpl::impl_createObj);
863
864 //I suppose it's the same thing as createObj*, but I didn't see it in action. For now, mark it unhandled.
865 RegisterCommand(1, 72, 1000, "createBgObjG00", (CmdImpl) &GrpImpl::impl_createObj);
866 RegisterCommand(1, 72, 1003, "createBgObjGAN", (CmdImpl) &GrpImpl::impl_createObj);
867 RegisterCommand(1, 72, 1100, "createBgObjRect", (CmdImpl) &GrpImpl::impl_createObj);
868 RegisterCommand(1, 72, 1200, "createBgObjText", (CmdImpl) &GrpImpl::impl_createObj);
869 RegisterCommand(1, 72, 1300, "createBgObjWeaver", (CmdImpl) &GrpImpl::impl_createObj);
870 RegisterCommand(1, 72, 1400, "createBgObjDigit", (CmdImpl) &GrpImpl::impl_createObj);
871
872 RegisterCommand(1, 73, 0, "ganStop?", NULL); //That's what xclannad says, but I'm not sure...
873 RegisterCommand(1, 73, 1000, "ganStop", (CmdImpl) &GrpImpl::impl_gan); //That's what rldev says
874 RegisterCommand(1, 73, 3, "ganIsPlaying", (CmdImpl) &GrpImpl::impl_gan);
875 RegisterCommand(1, 73, 2003, "objPlay", (CmdImpl) &GrpImpl::impl_gan);
876 RegisterCommand(1, 73, 1001, "ganLoop", (CmdImpl) &GrpImpl::impl_gan);
877 RegisterCommand(1, 73, 1003, "ganPlay", (CmdImpl) &GrpImpl::impl_gan);
878 RegisterCommand(1, 73, 1005, "ganPlayOnce", (CmdImpl) &GrpImpl::impl_gan);
879 RegisterCommand(1, 73, 3001, "ganLoop2", (CmdImpl) &GrpImpl::impl_gan);
880 RegisterCommand(1, 73, 3003, "ganPlay2", (CmdImpl) &GrpImpl::impl_gan);
881 RegisterCommand(1, 73, 3005, "ganPlayOnce2", (CmdImpl) &GrpImpl::impl_gan);
882
883 RegisterCommand(1, 81, 1000, "objMove", (CmdImpl) &GrpImpl::impl_objSetPos);
884 RegisterCommand(1, 82, 1000, "objBgMove", (CmdImpl) &GrpImpl::impl_objSetPos);
885 RegisterCommand(1, 81, 1001, "objLeft", (CmdImpl) &GrpImpl::impl_objSetPos);
886 RegisterCommand(1, 82, 1001, "objBgLeft", (CmdImpl) &GrpImpl::impl_objSetPos);
887 RegisterCommand(1, 81, 1002, "objTop", (CmdImpl) &GrpImpl::impl_objSetPos);
888 RegisterCommand(1, 82, 1002, "objBgTop", (CmdImpl) &GrpImpl::impl_objSetPos);
889
890 RegisterCommand(1, 81, 1003, "objAlpha", (CmdImpl) &GrpImpl::impl_objAlpha);
891 RegisterCommand(1, 82, 1003, "objBgAlpha", (CmdImpl) &GrpImpl::impl_objAlpha);
892 RegisterCommand(1, 81, 1004, "objShow", (CmdImpl) &GrpImpl::impl_objShow);
893 RegisterCommand(1, 82, 1004, "objBgShow", (CmdImpl) &GrpImpl::impl_objShow);
894
895 RegisterCommand(1, 81, 1005, "objDispArea", NULL);
896 RegisterCommand(1, 82, 1005, "objBgDispArea", NULL);
897 RegisterCommand(1, 81, 1006, "objAdjust", (CmdImpl) &GrpImpl::impl_objSetPos);
898 RegisterCommand(1, 82, 1006, "objBgAdjust", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objSetPos);
899 RegisterCommand(1, 81, 1007, "objAdjustX", NULL);
900 RegisterCommand(1, 82, 1007, "objBgAdjustX", NULL);
901 RegisterCommand(1, 81, 1008, "objAdjustY", NULL);
902 RegisterCommand(1, 82, 1008, "objBgAdjustY", NULL);
903 RegisterCommand(1, 81, 2006, "objAdjust2?", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objSetPos); I don't know if it is usefull or properly implemented
904 RegisterCommand(1, 82, 2006, "objBgAdjust2?", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objSetPos); See above
905 RegisterCommand(1, 81, 1016, "objColour", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objColour);
906 RegisterCommand(1, 82, 1016, "objBgColour", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objColour);
907 RegisterCommand(1, 81, 1017, "objColR", NULL);
908 RegisterCommand(1, 82, 1017, "objBgColR", NULL);
909 RegisterCommand(1, 81, 1018, "objColG", NULL);
910 RegisterCommand(1, 82, 1018, "objBgColG", NULL);
911 RegisterCommand(1, 81, 1019, "objColB", NULL);
912 RegisterCommand(1, 82, 1019, "objBgColB", NULL);
913 RegisterCommand(1, 81, 1020, "objColLevel", NULL);
914 RegisterCommand(1, 82, 1020, "objBgColLevel", NULL);
915 RegisterCommand(1, 81, 1021, "objComposite", (CmdImpl) &GrpImpl::impl_objComposite); //FIXME: May be broken
916 RegisterCommand(1, 82, 1021, "objBgComposite", (CmdImpl) &GrpImpl::impl_objComposite);
917 RegisterCommand(1, 81, 1024, "objSetText", (CmdImpl) &GrpImpl::impl_objSetText);
918 RegisterCommand(1, 82, 1024, "objBgSetText", (CmdImpl) &GrpImpl::impl_objSetText);
919 RegisterCommand(1, 81, 1025, "objTextOpts", (CmdImpl) &GrpImpl::impl_objTextOpts); //FIXME: Incomplete
920 RegisterCommand(1, 82, 1025, "objBgTextOpts", (CmdImpl) &GrpImpl::impl_objTextOpts);
921 RegisterCommand(1, 81, 1032, "objOrder", (CmdImpl) &GrpImpl::impl_objOrder);
922 RegisterCommand(1, 82, 1032, "objBgOrder", (CmdImpl) &GrpImpl::impl_objOrder);
923 RegisterCommand(1, 81, 1034, "objDispRect", (CmdImpl) &GrpImpl::impl_objDispArea);
924 RegisterCommand(1, 82, 1034, "objBgDispRect", (CmdImpl) &GrpImpl::impl_objDispArea);
925 RegisterCommand(1, 81, 1037, "objSetDigits", (CmdImpl) &GrpImpl::impl_objSetDigits);
926 RegisterCommand(1, 82, 1037, "objBgSetDigits", (CmdImpl) &GrpImpl::impl_objSetDigits);
927 RegisterCommand(1, 81, 1038, "objNumOpts", (CmdImpl) &GrpImpl::impl_objNumOpts);
928 RegisterCommand(1, 82, 1038, "objBgNumOpts", (CmdImpl) &GrpImpl::impl_objNumOpts);
929 RegisterCommand(1, 81, 1039, "objPattNo", (CmdImpl) &GrpImpl::impl_objPattNo);
930 RegisterCommand(1, 82, 1039, "objBgPattNo", (CmdImpl) &GrpImpl::impl_objPattNo);
931 RegisterCommand(1, 81, 1046, "objScale", (CmdImpl) &GrpImpl::impl_objScale); //FIXME: Broken behaviour
932 RegisterCommand(1, 82, 1046, "objBgScale", (CmdImpl) &GrpImpl::impl_objScale);
933 RegisterCommand(1, 81, 1047, "objWidth", NULL);
934 RegisterCommand(1, 82, 1047, "objBgWidth", NULL);
935 RegisterCommand(1, 81, 1049, "objRotate", (CmdImpl) &GrpImpl::impl_objRotate);
936 RegisterCommand(1, 82, 1049, "objBgRotate", (CmdImpl) &GrpImpl::impl_objRotate);
937
938 RegisterCommand(1, 84, 1000, "objGetPos", (CmdImpl) &GrpImpl::impl_objPosDims);
939 RegisterCommand(1, 84, 1100, "objGetDims", (CmdImpl) &GrpImpl::impl_objPosDims);
940
941 RegisterCommand(1, 31, 0, "refresh", (CmdImpl) &GrpImpl::impl_refresh);
942
943 RegisterCommand(1, 20, 0, "bgmLoop", (CmdImpl) &GrpImpl::impl_bgmLoop);
944 RegisterCommand(1, 20, 1, "bgmPlayEx", (CmdImpl) &GrpImpl::impl_bgmLoop); //FIXME: wait
945 RegisterCommand(1, 20, 2, "bgmPlay", (CmdImpl) &GrpImpl::impl_bgmLoop);
946 RegisterCommand(1, 20, 5, "bgmStop", (CmdImpl) &GrpImpl::impl_bgmStop);
947 RegisterCommand(1, 20, 105, "bgmFadeOut", (CmdImpl) &GrpImpl::impl_bgmStop);
948
949 RegisterCommand(1, 21, 0, "wavPlay", (CmdImpl) &GrpImpl::impl_playWav);
950 RegisterCommand(1, 21, 1, "wavPlayEx", (CmdImpl) &GrpImpl::impl_playWav);
951 RegisterCommand(1, 21, 2, "wavLoop", (CmdImpl) &GrpImpl::impl_playWav);
952 RegisterCommand(1, 21, 3, "wavWait", NULL);
953 RegisterCommand(1, 21, 4, "wavPlaying", NULL);
954 RegisterCommand(1, 21, 5, "wavStop", (CmdImpl) &GrpImpl::impl_stopWav);
955 RegisterCommand(1, 21, 105, "wavFadeout", (CmdImpl) &GrpImpl::impl_stopWav);
956
957 RegisterCommand(1, 22, 0, "sePlay", (CmdImpl) &GrpImpl::impl_playSE);
958
959 RegisterCommand(1, 4, 2230, "SetBgmVolMod", (CmdImpl) &GrpImpl::impl_SetVolMod);
960 RegisterCommand(1, 4, 2231, "SetKoeVolMod", (CmdImpl) &GrpImpl::impl_SetVolMod);
961 RegisterCommand(1, 4, 2232, "SetPCMVolMod", (CmdImpl) &GrpImpl::impl_SetVolMod);
962 RegisterCommand(1, 4, 2233, "SetSeVolMod", (CmdImpl) &GrpImpl::impl_SetVolMod);
963 RegisterCommand(1, 4, 2330, "BgmVolMod", (CmdImpl) &GrpImpl::impl_GetVolMod);
964 RegisterCommand(1, 4, 2331, "KoeVolMod", (CmdImpl) &GrpImpl::impl_GetVolMod);
965 RegisterCommand(1, 4, 2332, "PCMVolMod", (CmdImpl) &GrpImpl::impl_GetVolMod);
966 RegisterCommand(1, 4, 2333, "SeVolMod", (CmdImpl) &GrpImpl::impl_GetVolMod);
967
968 RegisterCommand(1, 23, 0, "koePlay", (CmdImpl) &GrpImpl::impl_koePlay);
969 RegisterCommand(1, 23, 1, "koePlayEx", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME
970 RegisterCommand(1, 23, 7, "koePlayExC", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME
971 RegisterCommand(1, 23, 8, "koeDoPlay", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME
972 RegisterCommand(1, 23, 9, "koeDoPlayEx", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME
973 RegisterCommand(1, 23, 10, "koeDoPlayExC", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME
974
975 RegisterCommand(1, 26, 1, "movPlayEx", (CmdImpl) &GrpImpl::impl_movPlay);
976 RegisterCommand(1, 26, 20, "movPlayExC", (CmdImpl) &GrpImpl::impl_movPlay);
977
978 RegisterCommand(1, 61, 14, "objSwap?", NULL);
979 RegisterCommand(1, 62, 14, "objSwap?", NULL);
980
781 anm1 = NULL; 981 anm1 = NULL;
782 anm2 = NULL; 982 anm2 = NULL;
783 } 983 }
784 984
785 GrpImpl::~GrpImpl() { 985 GrpImpl::~GrpImpl() {
834 Surface* bg = parent.Root().NewSurface(s.c_str()); 1034 Surface* bg = parent.Root().NewSurface(s.c_str());
835 if (bg == NULL) { 1035 if (bg == NULL) {
836 s += ".g00"; 1036 s += ".g00";
837 bg = parent.Root().NewSurface(s.c_str()); 1037 bg = parent.Root().NewSurface(s.c_str());
838 } 1038 }
839 if (bg) { 1039 if (bg != NULL) {
840 if (ssurface[pdt]) parent.Root().DeleteSurface(ssurface[pdt]); 1040 if (ssurface[pdt]) parent.Root().DeleteSurface(ssurface[pdt]);
841 ssurface[pdt] = bg; 1041 ssurface[pdt] = bg;
842 if (pdt == 0) { 1042 if (pdt == 0) {
843 /* とりあえず Princess Bride のアニメーション効果専用 */ 1043 /* とりあえず Princess Bride のアニメーション効果専用 */
844 Rect r(*ssurface[0]); 1044 Rect r(*ssurface[0]);
857 } 1057 }
858 1058
859 void GrpImpl::InitSel(void) { 1059 void GrpImpl::InitSel(void) {
860 int i; 1060 int i;
861 int args[16]; 1061 int args[16];
862 char key[1024]; 1062 char key[10];
863 for (i=0; i<999; i++) { 1063 for (i=0; i<999; i++) {
864 sprintf(key, "#SEL.%03d",i); 1064 sprintf(key, "#SEL.%03d",i);
865 if (config->GetParam(key, 15, &args[0], &args[1], 1065 if (config->GetParam(key, 15, &args[0], &args[1],
866 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7], 1066 &args[2], &args[3], &args[4], &args[5], &args[6], &args[7],
867 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13], 1067 &args[8], &args[9], &args[10], &args[11], &args[12], &args[13],
876 SEL& s = anmtype[i]; 1076 SEL& s = anmtype[i];
877 s.from = Rect(args[0], args[1], args[2]+1, args[3]+1); 1077 s.from = Rect(args[0], args[1], args[2]+1, args[3]+1);
878 s.to = Rect(args[4], args[5]); 1078 s.to = Rect(args[4], args[5]);
879 s.time = args[6]; 1079 s.time = args[6];
880 s.sel_no = args[7]; 1080 s.sel_no = args[7];
881 int j; for (j=0; j<8; j++) s.args[j] = args[8+j]; 1081 int j;
1082 for (j=0; j<8; j++) s.args[j] = args[8+j];
882 } 1083 }
883 } 1084 }
884 1085
885 void GrpImpl::SetSkipMode(SkipMode _mode) { 1086 void GrpImpl::SetSkipMode(SkipMode _mode) {
886 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) { 1087 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) {
890 skip_mode = _mode; 1091 skip_mode = _mode;
891 } 1092 }
892 1093
893 void GrpImpl::SetObjChanged(int num) { 1094 void GrpImpl::SetObjChanged(int num) {
894 changed_obj.insert(num); 1095 changed_obj.insert(num);
895 }
896
897 void GrpImpl::SetObjChangedGroup(int num) {
898 if (num % 1000 != 0) {
899 SetObjChanged(num);
900 return;
901 }
902 std::map<int, GrpObj>::iterator begin,end,it;
903 begin = grpobj.lower_bound(num);
904 end = grpobj.lower_bound(num+1000);
905 for (it=begin;it!=end;it++) {
906 changed_obj.insert(it->first);
907 }
908 } 1096 }
909 1097
910 void GrpImpl::RefreshObj(void) { 1098 void GrpImpl::RefreshObj(void) {
911 if (!deleted_pic.empty()) { 1099 if (!deleted_pic.empty()) {
912 vector<PicBase*>::iterator it; 1100 vector<PicBase*>::iterator it;
918 if (!changed_obj.empty()) { 1106 if (!changed_obj.empty()) {
919 set<int>::iterator it; 1107 set<int>::iterator it;
920 for (it=changed_obj.begin(); it != changed_obj.end(); it++) { 1108 for (it=changed_obj.begin(); it != changed_obj.end(); it++) {
921 if (grpobj.find(*it) == grpobj.end()) continue; 1109 if (grpobj.find(*it) == grpobj.end()) continue;
922 GrpObj& obj = grpobj[*it]; 1110 GrpObj& obj = grpobj[*it];
923 GrpObj& parent_obj = grpobj[ ((*it)/1000) * 1000]; 1111 if (obj.picture == NULL) continue;
924 if (obj.picture == 0) continue; 1112 if (obj.alpha == 0 || (obj.attr & GrpObj::HIDDEN)) {
925 if (obj.alpha == 0 || (obj.attr & GrpObj::HIDDEN) || (parent_obj.attr & GrpObj::HIDDEN_GROUP) ) {
926 if (obj.attr & GrpObj::ANM_PLAYING) { 1113 if (obj.attr & GrpObj::ANM_PLAYING) {
927 obj.attr = GrpObj::Attribute(obj.attr & ~(GrpObj::ANM_PLAYING)); 1114 obj.attr = GrpObj::Attribute(obj.attr & ~(GrpObj::ANM_PLAYING));
928 if (obj.anm) obj.anm->Abort(); 1115 if (obj.anm) obj.anm->Abort();
929 } 1116 }
930 obj.picture->hide(); 1117 obj.picture->hide();
1000 for (it=bs_obj.begin(); it!=bs_obj.end(); it++) { 1187 for (it=bs_obj.begin(); it!=bs_obj.end(); it++) {
1001 grpobj[it->first] = it->second; 1188 grpobj[it->first] = it->second;
1002 it->second.DeletePic(); 1189 it->second.DeletePic();
1003 CreateObj(it->first); 1190 CreateObj(it->first);
1004 GrpObj& g = grpobj[it->first]; 1191 GrpObj& g = grpobj[it->first];
1005 GrpObj& parent_obj = grpobj[ (it->first/1000) * 1000];
1006 if (g.picture) { 1192 if (g.picture) {
1007 g.Update(); 1193 g.Update();
1008 if (g.alpha == 0 || (g.attr & GrpObj::HIDDEN) || (parent_obj.attr & GrpObj::HIDDEN_GROUP) ) ; 1194 if (g.alpha == 0 || (g.attr & GrpObj::HIDDEN)) ;
1009 else g.picture->SimpleBlit(surface_update); 1195 else g.picture->SimpleBlit(surface_update);
1010 g.picture->hide(); 1196 g.picture->hide();
1011 } 1197 }
1012 } 1198 }
1013 bs_obj.clear(); 1199 bs_obj.clear();
1070 RefreshObj(); 1256 RefreshObj();
1071 return; 1257 return;
1072 } 1258 }
1073 1259
1074 void GrpImpl::LoadSurface(const char* str) { 1260 void GrpImpl::LoadSurface(const char* str) {
1075 if (anm1) AbortAnm(); // 前の描画が終わってなければ強制終了 1261 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了
1076 LoadSurface(str, 1); 1262 LoadSurface(str, 1);
1077 bg_name = str; 1263 bg_name = str;
1078 } 1264 }
1079 1265
1080 void GrpImpl::LoadSurface(void) { 1266 void GrpImpl::LoadSurface(void) {
1081 if (anm1) AbortAnm(); // 前の描画が終わってなければ強制終了 1267 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了
1082 LoadSurface(bg_name.c_str(), 1); 1268 LoadSurface(bg_name.c_str(), 1);
1083 } 1269 }
1084 1270
1085 void GrpImpl::AddSurface(const char* str) { 1271 void GrpImpl::AddSurface(const char* str) {
1086 if (anm1) AbortAnm(); // 前の描画が終わってなければ強制終了 1272 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了
1087 LoadSurface(bg_name.c_str()); 1273 LoadSurface(bg_name.c_str());
1088 1274
1089 string s = str; 1275 string s = str;
1090 Surface* front = parent.Root().NewSurface(s.c_str()); 1276 Surface* front = parent.Root().NewSurface(s.c_str());
1091 if (front == NULL) { 1277 if (front == NULL) {
1342 grpdump_req = 0; 1528 grpdump_req = 0;
1343 std::map<int,GrpObj>::iterator it; 1529 std::map<int,GrpObj>::iterator it;
1344 fprintf(stderr,"front %p(%d) / %p(%d)\n",screen,screen->IsHidden(),screen_front,screen_front->IsHidden()); 1530 fprintf(stderr,"front %p(%d) / %p(%d)\n",screen,screen->IsHidden(),screen_front,screen_front->IsHidden());
1345 for (it=grpobj.begin(); it != grpobj.end(); it++) { 1531 for (it=grpobj.begin(); it != grpobj.end(); it++) {
1346 GrpObj& obj = it->second; 1532 GrpObj& obj = it->second;
1347 GrpObj& parent_obj = grpobj[ ((it->first)/1000) * 1000];
1348 if (obj.picture) { 1533 if (obj.picture) {
1349 if (!obj.name.empty()) { 1534 if (!obj.name.empty()) {
1350 fprintf(stderr,"obj %06d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n", 1535 fprintf(stderr,"obj %06d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n",
1351 it->first,obj.picture,obj.name.c_str(), 1536 it->first,obj.picture,obj.name.c_str(),
1352 obj.PosX(),obj.PosY(),obj.alpha,obj.attr&GrpObj::HIDDEN ? 1 : 0,parent_obj.attr&GrpObj::HIDDEN_GROUP ? 1 : 0,obj.picture->IsHidden()); 1537 obj.PosX(),obj.PosY(),obj.alpha,obj.attr&GrpObj::HIDDEN ? 1 : 0, 0, obj.picture->IsHidden());
1353 } else if (!obj.print_moji.empty()) { 1538 } else if (!obj.print_moji.empty()) {
1354 fprintf(stderr,"obj %06d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n", 1539 fprintf(stderr,"obj %06d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n",
1355 it->first,obj.picture,obj.print_moji.c_str(), 1540 it->first,obj.picture,obj.print_moji.c_str(),
1356 obj.PosX(),obj.PosY(),obj.alpha,obj.attr&GrpObj::HIDDEN ? 1 : 0,parent_obj.attr&GrpObj::HIDDEN_GROUP ? 1 : 0,obj.picture->IsHidden()); 1541 obj.PosX(),obj.PosY(),obj.alpha,obj.attr&GrpObj::HIDDEN ? 1 : 0, 0, obj.picture->IsHidden());
1357 } else { 1542 } else {
1358 fprintf(stderr,"obj %06d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n", 1543 fprintf(stderr,"obj %06d(%p): name %10s pos %d,%d alpha %d (%d/%d/%d)\n",
1359 it->first,obj.picture,"<EMPTY>", 1544 it->first,obj.picture,"<EMPTY>",
1360 obj.PosX(),obj.PosY(),obj.alpha,obj.attr&GrpObj::HIDDEN ? 1 : 0,parent_obj.attr&GrpObj::HIDDEN_GROUP ? 1 : 0,obj.picture->IsHidden()); 1545 obj.PosX(),obj.PosY(),obj.alpha,obj.attr&GrpObj::HIDDEN ? 1 : 0, 0, obj.picture->IsHidden());
1361 } 1546 }
1362 } 1547 }
1363 } 1548 }
1364 std::list<PicBase*>::iterator it2; 1549 std::list<PicBase*>::iterator it2;
1365 for (it2=parent.children.begin(); it2!=parent.children.end();it2++) { 1550 for (it2=parent.children.begin(); it2!=parent.children.end();it2++) {
1397 } 1582 }
1398 #endif 1583 #endif
1399 if (status == WAIT_ANM) { 1584 if (status == WAIT_ANM) {
1400 if (anm1 != NULL) { 1585 if (anm1 != NULL) {
1401 if (!anm1->IsEnd()) return true; 1586 if (!anm1->IsEnd()) return true;
1587 //FIXME: Handle animation loops
1402 AbortAnm(); 1588 AbortAnm();
1403 } 1589 }
1404 } else if (status == WAIT_SHAKE) { 1590 } else if (status == WAIT_SHAKE) {
1405 if (anm2 != NULL) { 1591 if (anm2 != NULL) {
1406 if (!anm2->IsEnd()) return true; 1592 if (!anm2->IsEnd()) return true;
1437 if (grpobj.find(num) == grpobj.end()) return; 1623 if (grpobj.find(num) == grpobj.end()) return;
1438 deleted_pic.push_back(grpobj[num].DeletePic()); 1624 deleted_pic.push_back(grpobj[num].DeletePic());
1439 grpobj.erase(num); 1625 grpobj.erase(num);
1440 } 1626 }
1441 1627
1442 void GrpImpl::DeleteObjRange(int num_first, int num_end) { 1628 void GrpImpl::impl_stackClear (Cmd& cmd) {
1443 std::map<int, GrpObj>::iterator begin,end,it; 1629 cmd.cmd_type = CMD_SAVECMDGRP_START;
1444 begin = grpobj.lower_bound(num_first); 1630 }
1445 end = grpobj.lower_bound(num_end); 1631
1446 for (it=begin;it!=end;it++) { 1632 void GrpImpl::impl_grpBuffer (Cmd& cmd) {
1447 deleted_pic.push_back(it->second.DeletePic()); 1633 const char* name = cmd.Str(cmd.args[0]);
1448 } 1634 int pdt = cmd.args[1].value;
1449 grpobj.erase(begin, end); 1635 eprintf("load surface %s pdt %d\n",name, pdt);
1636 if (pdt == 0)
1637 reserved_load_surface0 = name; // 画像読み込みは 01-1f:0000 まで待つ
1638 else if (pdt == 1)
1639 LoadSurface(name); // 背景絵読み込み?
1640 else
1641 LoadSurface(name, pdt);
1642 cmd.cmd_type = CMD_SAVECMDGRP;
1643 }
1644
1645 void GrpImpl::impl_grpMulti(Cmd& cmd) {
1646 int pos = cmd.args[0].value;
1647 const char* name = cmd.Str(cmd.args[1]);
1648 int sel = cmd.args[2].value;
1649 eprintf("set foreground %s sel %d pos %d\n",name, sel, pos);
1650 AddSurface(name);
1651 StartAnm(sel);
1652 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
1653 status = WAIT_ANM;
1654 cmd.cmd_type = CMD_SAVECMDGRP_ONCE;
1655 }
1656
1657 void GrpImpl::impl_grpOpen(Cmd& cmd) {
1658 const char* name = cmd.Str(cmd.args[0]);
1659 int sel = cmd.args[1].value;
1660
1661 if (name[0] == '?')
1662 LoadSurface();
1663 else if(cmd.cmd3 == 73)
1664 LoadSurface(name, 1);
1665 else
1666 LoadSurface(name);
1667
1668 StartAnm(sel);
1669 status = WAIT_ANM;
1670 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
1671
1672 if (name[0] == '?')
1673 cmd.cmd_type = CMD_SAVECMDGRP_ONCE;
1674 else
1675 cmd.cmd_type = CMD_SAVECMDGRP_START;
1676 }
1677
1678 void GrpImpl::impl_shake(Cmd& cmd) {
1679 // shake screen
1680 char key[11];
1681 sprintf(key, "#SHAKE.%03d", cmd.args[0].value);
1682 if (config->SearchParam(key) != 2) {
1683 fprintf(stderr,"Cannot find shake pattern %d; use default pattern\n",cmd.args[0].value);
1684 strcpy(key, "#SHAKE.000"); // default key
1685 }
1686 int num;
1687 const int* pattern;
1688 pattern = config->GetParamArray(key, num);
1689 if (pattern) {
1690 StartShake(num, pattern);
1691 status = WAIT_SHAKE;
1692 }
1693 cmd.clear();
1694 }
1695
1696 void GrpImpl::impl_grpCopy(Cmd& cmd) {
1697 if (cmd.cmd4 == 2) { // copy (KANOGI)
1698 int sx = cmd.args[0].value;
1699 int sy = cmd.args[1].value;
1700 int w = cmd.args[2].value - sx;
1701 int h = cmd.args[3].value - sy;
1702 Rect rect(sx, sy, sx+w, sy+h);
1703 int src = cmd.args[4].value;
1704 int dx = cmd.args[5].value;
1705 int dy = cmd.args[6].value;
1706 int dest = cmd.args[7].value;
1707 unsigned char alpha;
1708 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1709 printf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1710 if (src == dest) {
1711 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect);
1712 src = WORKPDT;
1713 }
1714 parent.Root().BlitSurface(Ssurface(src), rect, Dsurface(dest), Rect(dx,dy));
1715 if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h));
1716 cmd.clear();
1717 }
1718 }
1719
1720 void GrpImpl::impl_recFill(Cmd& cmd) {
1721 int x = cmd.args[0].value;
1722 int y = cmd.args[1].value;
1723 int w = cmd.args[2].value;
1724 int h = cmd.args[3].value;
1725 Rect rect(x, y, x+w, y+w);
1726 int pdt = cmd.args[4].value;
1727 int r = cmd.args[5].value;
1728 int g = cmd.args[6].value;
1729 int b = cmd.args[7].value;
1730
1731 if (cmd.cmd4 == 2) {
1732 eprintf("clear %d:(%d,%d) size (%d,%d) r %d g %d b %d\n",pdt,x,y,w,h,r,g,b);
1733 DSurfaceFill(Dsurface(pdt), rect, r, g, b);
1734 // if (pdt == 0) screen->ReBlit(rect);
1735 cmd.cmd_type = CMD_SAVECMDGRP;
1736 }
1737 else if (cmd.cmd4 == 3) { // alpha つきfill
1738 int a = cmd.args[8].value;
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);
1740 if (a <= 0) ;
1741 else if (a >= 255) DSurfaceFill(Dsurface(pdt), rect, r, g, b);
1742 else {
1743 DSurfaceFill(Dsurface(WORKPDT), rect, r, g, b, a);
1744 parent.Root().BlitSurface(Dsurface(WORKPDT), rect, Dsurface(pdt), rect);
1745 }
1746 // if (pdt == 0) screen->ReBlit(rect);
1747 cmd.clear();
1748 }
1749 }
1750
1751 void GrpImpl::impl_recCopy(Cmd& cmd) {
1752 int sx = cmd.args[0].value;
1753 int sy = cmd.args[1].value;
1754 int w = cmd.args[2].value;
1755 int h = cmd.args[3].value;
1756 Rect rect(sx, sy, sx + w, sy + h);
1757 int src = cmd.args[4].value;
1758 int dx = cmd.args[5].value;
1759 int dy = cmd.args[6].value;
1760 int dest = cmd.args[7].value;
1761
1762 if (cmd.cmd4 == 2) {
1763 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1764 parent.Root().BlitSurface(Ssurface(src), rect, Dsurface(dest), Rect(dx,dy));
1765 //DSurfaceMove(Ssurface(src), Rect(sx,sy,sx+w,sy+h), Dsurface(dest), Rect(dx,dy));
1766 // if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h));
1767 cmd.cmd_type = CMD_SAVECMDGRP;
1768 }
1769
1770 else if (cmd.cmd4 == 3) { // alpha つきcopy
1771 unsigned char alpha;
1772 if (cmd.args[8].value < 0) alpha = 0;
1773 else if (cmd.args[8].value > 255) alpha = 255;
1774 else alpha = cmd.args[8].value;
1775 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1776 if (src == dest) {
1777 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect);
1778 src = WORKPDT;
1779 }
1780 if (alpha != 0)
1781 parent.Root().BlitSurface(Ssurface(src), rect, &alpha, Rect(0,0,1,1), Dsurface(dest), Rect(dx,dy), 0);
1782 // if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h));
1783 cmd.clear();
1784 }
1785 }
1786
1787 void GrpImpl::impl_recAdd(Cmd& cmd) {
1788 if (cmd.cmd4 == 3) { // saturate mode で alpha 付き copy
1789 int sx = cmd.args[0].value;
1790 int sy = cmd.args[1].value;
1791 int w = cmd.args[2].value;
1792 int h = cmd.args[3].value;
1793 Rect rect(sx, sy, sx+w, sy+h);
1794 int src = cmd.args[4].value;
1795 int dx = cmd.args[5].value;
1796 int dy = cmd.args[6].value;
1797 int dest = cmd.args[7].value;
1798 unsigned char alpha;
1799 if (cmd.args[8].value < 0) alpha = 0;
1800 else if (cmd.args[8].value > 255) alpha = 255;
1801 else alpha = cmd.args[8].value;
1802 eprintf("copy surface w/ saturate %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1803 if (src == dest) {
1804 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect);
1805 src = WORKPDT;
1806 }
1807 if (alpha != 0) {
1808 // saturate mode : screen (picture) を一時的に作成
1809 PicBase* screen_tmp = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0);
1810 screen_tmp->SetSurface(Ssurface(src), 0, 0, PicBase::BLIT_SATURATE);
1811 screen_tmp->SetSurfaceRect(rect);
1812 screen_tmp->Move(dx, dy);
1813 screen_tmp->SetSurfaceAlpha(&alpha, Rect(0,0,1,1));
1814 screen_tmp->SimpleBlit(Dsurface(dest));
1815 delete screen_tmp;
1816 }
1817 cmd.clear();
1818 }
1819 }
1820
1821 void GrpImpl::impl_grpPan(Cmd& cmd) {
1822 if (cmd.cmd4 == 0) {
1823 Rect r_from(cmd.args[0].value, cmd.args[1].value);
1824 Rect r_to(cmd.args[2].value, cmd.args[3].value);
1825 int src_pdt = cmd.args[4].value;
1826 Rect r(cmd.args[5].value,cmd.args[6].value,cmd.args[7].value+1,cmd.args[8].value+1);
1827 int tm = cmd.args[9].value;
1828 fprintf(stderr,"??? cmd time %d\n",tm);
1829 // anm1 = new ScnGrpMove(event, screen, parent.Root(), surface, r, Ssurface(2), r_from, r_to, tm);
1830 // status = WAIT_ANM;
1831 }
1832 }
1833
1834 void GrpImpl::impl_snmBgScroll(Cmd& cmd) {
1835 if (cmd.cmd4 == 0) { // スクロールする画像効果(Princess Bride)
1836 if (anm2 != NULL) {
1837 anm2->Abort();
1838 delete anm2;
1839 anm2 = NULL;
1840 }
1841 PicBase* pic; Surface* s;
1842 Rect r(cmd.args[1].value, cmd.args[2].value, cmd.args[3].value+1, cmd.args[4].value+1);
1843 const char* name = cmd.Str(cmd.args[5]);
1844 Rect sr_start(cmd.args[6].value,cmd.args[7].value);
1845 Rect sr_end(cmd.args[8].value,cmd.args[9].value);
1846 int tm = cmd.args[10].value;
1847 LoadSurface(name, 2); /* PDT2 に読み込み、と決め打ち */
1848
1849 anm2 = new ScnGrpMove(event, screen, parent.Root(), Dsurface(1), r, Ssurface(2), sr_start, sr_end, tm);
1850 cmd.cmd_type = CMD_SAVECMDGRP;
1851 }
1852 }
1853
1854 void GrpImpl::impl_snmPlay(Cmd& cmd) {
1855 if (cmd.cmd4 == 0) {
1856 // カードが落ちるアニメーション
1857 int i;
1858 ScnGrpAnm* new_anm = new ScnGrpAnm(event, screen, *this);
1859 if (cmd.cmd3 == 0x834 || cmd.cmd3 == 0x835) {
1860 AbortAnm();
1861 anm1 = new_anm;
1862 if (cmd.cmd3 == 0x835) {
1863 status = WAIT_ANM;
1864 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
1865 }
1866 } else {
1867 anm2 = new_anm;
1868 }
1869 for (i=0; i<cmd.argc; i++) {
1870 const char* name = cmd.Str(cmd.args[i*3+1]);
1871 int tm = cmd.args[i*3+2].value;
1872 new_anm->push_back(ScnGrpAnmAtom(name,tm));
1873 }
1874 new_anm->CalcTotal();
1875 cmd.clear();
1876 }
1877 }
1878
1879 void GrpImpl::impl_cgGet(Cmd& cmd) {
1880 if (cmd.cmd3 == 0x5dc) // Total number of CG
1881 cmd.SetSysvar(cgm_size);
1882
1883 if (cmd.cmd3 == 0x5dd) // Number of CG viewed
1884 cmd.SetSysvar(cgm_data.size());
1885
1886 if (cmd.cmd3 == 0x5de) // Percentage of CG viewed
1887 cmd.SetSysvar(cgm_data.size() * 100 / cgm_size);
1888 }
1889
1890 void GrpImpl::impl_cgStatus(Cmd& cmd) {
1891 string s = cmd.Str(cmd.args[0]);
1892 if (cgm_info.find(s) == cgm_info.end()) {
1893 fprintf(stderr,"cmd 01-04:05e0 : cannot find cgm-info of '%s'\n",s.c_str());
1894 cmd.SetSysvar(-1);
1895 }
1896 else {
1897 int n = cgm_info[s];
1898 if (cmd.cmd3 == 1503) cmd.SetSysvar(n);
1899 else {
1900 if (cgm_data.find(n) == cgm_data.end()) cmd.SetSysvar(0);
1901 else cmd.SetSysvar(1);
1902 }
1903 }
1904 }
1905
1906 void GrpImpl::impl_objClear(Cmd& cmd) { //FIXME: may be broken (doesn't reflect what Haeleth says)
1907 DeleteObj(cmd.args[0].value);
1908 cmd.clear();
1909 }
1910
1911 void GrpImpl::impl_createObj(Cmd& cmd) {
1912 /**************:
1913 0x47 : オブジェクト内容の設定
1914 1100: G00 file
1915 1003: GAN file
1916 1100: rect
1917 1200: string
1918 1300: weather effects
1919 1400: number
1920 */
1921 int base_argc = 0;
1922 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除
1923 if (cmd.cmd2 == 71)
1924 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除
1925
1926 GrpObj& g = (cmd.cmd2 == 71) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
1927
1928 if (cmd.cmd3 == 1000) { /* ファイル名設定 */
1929 g.gtype = GrpObj::FILE; //FIXME: Strange thing in the main menu
1930 string name = cmd.Str(cmd.args[1]);
1931 if (name.find('?') != -1) {
1932 name.erase(name.find('?')); // '?' 以降の意味がわからない
1933 }
1934 g.name = name;
1935 } else if (cmd.cmd3 == 1003) { /* ファイル名設定(GAN含む) */
1936 g.gtype = GrpObj::GAN;
1937 if (cmd.Str(cmd.args[1]) == string("???"))
1938 g.name = cmd.Str(cmd.args[2]);
1939 else
1940 g.name = cmd.Str(cmd.args[1]);
1941 g.gan_name = cmd.Str(cmd.args[2]);
1942 if (cmd.cmd4 >= 1 && cmd.args[3].value == 0)
1943 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN);
1944 else
1945 g.attr = GrpObj::Attribute(g.attr & ~(GrpObj::HIDDEN));
1946
1947 if (cmd.argc >= 5)
1948 g.SetPos(1, cmd.args[4].value, -cmd.args[5].value);
1949
1950 if (g.name.find('?') != -1) {
1951 g.name.erase(g.name.find('?'));
1952 g.gan_name = cmd.Str(cmd.args[2]);
1953 }
1954 } else if (cmd.cmd3 == 1200) { // 画像を文字列として指定
1955 g.gtype = GrpObj::MOJI;
1956 g.print_moji = cmd.Str(cmd.args[1]);
1957 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); // 常に表示がデフォルト?
1958 cmd.clear();
1959 } else if (cmd.cmd3 == 1400) { // 数値を画像として表示
1960 g.gtype = GrpObj::DIGIT;
1961 g.name = cmd.Str(cmd.args[1]);
1962 }
1963 CreateObj(cmd.args[0].value);
1964 if (cmd.cmd3 == 1000 || cmd.cmd3 == 1003 || cmd.cmd3 == 1200 || cmd.cmd3 == 1400) {
1965 // FILE, GAN, MOJI, DIGIT ならば座標等の設定を行う
1966 if (cmd.cmd4 >= 1) {
1967 if (cmd.args[2+base_argc].value == 0) {
1968 if (cmd.cmd1 == 1)
1969 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP);
1970 else
1971 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN);
1972 } else {
1973 if (cmd.cmd1 == 1)
1974 g.attr = GrpObj::Attribute(g.attr & (~(GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP)));
1975 else
1976 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN));
1977 }
1978 if (cmd.cmd1 == 1)
1979 SetObjChanged(cmd.args[0].value);
1980 }
1981 if (cmd.cmd4 >= 2) { // 座標等も設定
1982 g.SetPos(0, cmd.args[3+base_argc].value, cmd.args[4+base_argc].value);
1983 }
1984 if ( (cmd.cmd3 == 1000 || cmd.cmd3 == 1003) && cmd.cmd4 >= 3) { // pattern 番号も設定
1985 g.SetSurfaceNum(cmd.args[5+base_argc].value);
1986 base_argc++; // 1000 (FILE) / 1003 (GAN) の場合のみこのオプションは存在する
1987 }
1988 cmd.clear();
1989 } else {
1990 fprintf(stderr,"CreateObj : cmd.cmd3 = %04x ; not supported!\n",cmd.cmd3);
1991 }
1992 }
1993
1994 void GrpImpl::impl_gan(Cmd& cmd) {
1995 GrpObj& g = grpobj[cmd.args[0].value];
1996
1997 if (cmd.cmd3 == 3) { // ganIsPlaying
1998 if (g.anm == NULL || g.anm->IsEnd())
1999 cmd.SetSysvar(0);
2000 else
2001 cmd.SetSysvar(1);
2002 }
2003 else if (cmd.cmd3 == 1000) { // ganStop
2004 if (g.anm == NULL || g.anm->IsEnd())
2005 g.SetSurfaceNum(cmd.args[1].value);
2006 else {
2007 g.anm->Abort();
2008 g.SetSurfaceNum(cmd.args[1].value);
2009 }
2010 SetObjChanged(cmd.args[0].value);
2011 cmd.clear();
2012 }
2013 else if (cmd.cmd3 == 2003) { // objPlay
2014 g.CreateGanSpecial(event, 0, cmd.args[1].value);
2015 // g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN));
2016 SetObjChanged(cmd.args[0].value);
2017 cmd.clear();
2018 }
2019 else if (cmd.cmd3 == 3001 || cmd.cmd3 == 3003 || cmd.cmd3 == 3005 ||
2020 cmd.cmd3 == 1001 || cmd.cmd3 == 1003 || cmd.cmd3 == 1005) { // ganPlay*
2021 g.CreateGan(event, cmd.args[1].value);
2022 // g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN));
2023 SetObjChanged(cmd.args[0].value);
2024 cmd.clear();
2025 }
2026 }
2027
2028 void GrpImpl::impl_objSetPos(Cmd& cmd) {
2029 //obj or objBg
2030 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2031
2032 int index, x, y;
2033 if (cmd.cmd3 == 1006 || cmd.cmd3 == 2006) { //objAdjust
2034 index = cmd.args[1].value + 1;
2035 x = cmd.args[2].value;
2036 y = cmd.args[3].value;
2037 }
2038 else {
2039 index = 0;
2040 if (cmd.cmd3 == 1000) {
2041 x = cmd.args[1].value;
2042 y = cmd.args[2].value;
2043 }
2044 else {
2045 g.GetPos(index, x, y);
2046 if (cmd.cmd3 == 1001)
2047 x = cmd.args[1].value;
2048 else
2049 y = cmd.args[1].value;
2050 }
2051 }
2052
2053 g.SetPos(index, x, y);
2054 cmd.clear();
2055 }
2056
2057 void GrpImpl::impl_objAlpha(Cmd& cmd) {
2058 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2059 g.SetAlpha(cmd.args[1].value);
2060 cmd.clear();
2061 }
2062
2063 void GrpImpl::impl_objShow(Cmd& cmd) {
2064 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2065 if (cmd.cmd1 == 1) {
2066 if (cmd.args[1].value)
2067 g.attr = GrpObj::Attribute(g.attr & (~(GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP)));
2068 else
2069 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP);
2070 } else {
2071 if (cmd.args[1].value)
2072 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN));
2073 else
2074 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN);
2075 }
2076 g.attr = GrpObj::Attribute(g.attr | GrpObj::UPDATE_VISIBLE);
2077 // グループ単位で次の RefreshObj で表示・消去
2078 if (cmd.cmd2 == 0x51) //not Bg
2079 SetObjChanged(cmd.args[0].value);
2080 cmd.clear();
2081 }
2082
2083 void GrpImpl::impl_objColour(Cmd& cmd) {
2084 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2085 g.print_r = cmd.args[1].value;
2086 g.print_g = cmd.args[2].value;
2087 g.print_b = cmd.args[3].value;
2088 g.SetUpdate();
2089 // grpobj[cmd.args[0].value].print_a = cmd.args[4].value;
2090 /* args:229,18,minus-1,0,99,255,-1 */
2091 /* args:102,26,minus-1,0,99,0,255 */
2092 cmd.clear();
2093 }
2094
2095 void GrpImpl::impl_objComposite(Cmd& cmd) {
2096 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2097 // centering mode などを設定?
2098 if (cmd.args[1].value == 1) {
2099 g.attr = GrpObj::Attribute(g.attr | GrpObj::SATURATE);
2100 cmd.clear();
2101 } else if (cmd.args[1].value == 0) {
2102 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::SATURATE));
2103 cmd.clear();
2104 }
2105 g.SetUpdate();
2106 }
2107
2108 void GrpImpl::impl_objSetText(Cmd& cmd) {
2109 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2110
2111 g.print_moji = cmd.Str(cmd.args[1]);
2112 g.SetUpdate();
2113 cmd.clear();
2114 }
2115
2116 void GrpImpl::impl_objTextOpts(Cmd& cmd) {
2117 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2118 // 画像を文字列として設定:文字の大きさなど
2119 g.print_size = cmd.args[1].value;
2120 /* 前景色を得る */
2121 int cr, cg, cb;
2122 char key[17];
2123 sprintf(key, "#COLOR_TABLE.%03d", cmd.args[5].value);
2124 if (config->GetParam(key, 3, &cr, &cg, &cb)) { // color not found
2125 cr = cg = cb = 0;
2126 }
2127 g.print_r = cr;
2128 g.print_g = cg;
2129 g.print_b = cb;
2130 g.SetUpdate();
2131 cmd.clear();
2132 }
2133
2134 void GrpImpl::impl_objOrder(Cmd& cmd) {
2135 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2136 int order = cmd.args[1].value;
2137 g.order = order;
2138 ZMoveObj(cmd.args[0].value);
2139 cmd.clear();
2140 }
2141
2142 void GrpImpl::impl_objDispArea(Cmd& cmd) {
2143 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2144 // オブジェクトのどの部分を画面に表示するか(クリップ領域)の設定
2145 int rx, ry, w, h;
2146 if (cmd.args.size() == 5) {
2147 int rx = cmd.args[1].value;
2148 int ry = cmd.args[2].value;
2149 int w = cmd.args[3].value;
2150 int h = cmd.args[4].value;
2151 if (cmd.cmd3 == 1005) {
2152 w -= rx;
2153 h -= ry;
2154 }
2155 }
2156 else {
2157 rx = ry = 0;
2158 w = screen->Width();
2159 h = screen->Height();
2160 }
2161 g.SetClipArea(rx, ry, w, h); //TODO: case when cmd.args.size() == 1
2162 cmd.clear();
2163 }
2164
2165 void GrpImpl::impl_objSetDigits(Cmd& cmd) {
2166 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2167 g.dig_number = cmd.args[1].value;
2168 g.SetUpdate();
2169 cmd.clear();
2170 }
2171
2172 void GrpImpl::impl_objNumOpts(Cmd& cmd) {
2173 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2174 g.dig_digit = cmd.args[1].value;
2175 int attr = g.attr;
2176 attr &= ~(GrpObj::DIG_ZERO | GrpObj::DIG_SIGN | GrpObj::DIG_PACK);
2177 if (cmd.args[2].value) attr |= GrpObj::DIG_ZERO;
2178 if (cmd.args[3].value) attr |= GrpObj::DIG_SIGN;
2179 if (cmd.args[4].value) attr |= GrpObj::DIG_PACK;
2180 g.attr = GrpObj::Attribute(attr);
2181 g.SetUpdate();
2182 cmd.clear();
2183 }
2184
2185 void GrpImpl::impl_objPattNo(Cmd& cmd) {
2186 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2187 g.SetSurfaceNum(cmd.args[1].value);
2188 cmd.clear();
2189 }
2190
2191 void GrpImpl::impl_objScale(Cmd& cmd) {
2192 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2193 int zoom = (cmd.args[1].value + cmd.args[2].value)/2; //FIXME: eurk
2194 zoom = zoom*256/100;
2195 g.SetZoomRotate(zoom, -1);
2196 cmd.clear();
2197 }
2198
2199 void GrpImpl::impl_objRotate(Cmd& cmd) {
2200 GrpObj& g = (cmd.cmd2 == 0x51) ? grpobj[cmd.args[0].value] : bs_obj[cmd.args[0].value];
2201 int angle = cmd.args[1].value;
2202 angle /= 10;
2203 if (angle < 0) {
2204 angle %= 360;
2205 angle += 360;
2206 }
2207 angle %= 360;
2208 g.SetZoomRotate(-1, angle);
2209 cmd.clear();
2210 }
2211
2212 void GrpImpl::impl_objPosDims(Cmd& cmd) {
2213 GrpObj& obj = grpobj[cmd.args[0].value];
2214
2215 VarInfo arg1 = cmd.args[1];
2216 VarInfo arg2 = cmd.args[2];
2217
2218 int val1, val2;
2219
2220 if (cmd.cmd3 == 1000)
2221 obj.GetPos(0, val1, val2);
2222 else if (cmd.cmd3 == 1100)
2223 obj.GetSrcGeom(val1, val2);
2224
2225 cmd.SetFlagvar(arg1, val1);
2226 cmd.SetFlagvar(arg2, val2);
2227 }
2228
2229 void GrpImpl::impl_refresh(Cmd& cmd) {
2230 // 本来は grpstack clear らしい
2231 RefreshObj();
2232 // Princess Bride の中途 Staff roll
2233 // このタイミングで描画するのが都合がいいので、
2234 //シナリオループを抜けて描画を起動
2235 cmd.cmd_type = CMD_WAITFRAMEUPDATE;
2236 }
2237
2238 void GrpImpl::impl_bgmLoop(Cmd& cmd) {
2239 if (cmd.cmd4 == 0 || cmd.cmd4 == 2) {
2240 int count = 8000;
2241 if (cmd.cmd3 == 2)
2242 count = 0; //bgmPlay, play once
2243 music->PlayCDROM((char*)cmd.Str(cmd.args[0]), count);
2244 cmd.cmd_type = CMD_SAVECMD_ONCE;
2245 }
2246 }
2247
2248 void GrpImpl::impl_bgmStop(Cmd& cmd) {
2249 if (cmd.cmd4 == 0) {
2250 if (cmd.cmd3 == 5)
2251 music->StopCDROM(0);
2252 else if (cmd.cmd3 == 105)
2253 music->StopCDROM(cmd.args[0].value);
2254 cmd.cmd_type = CMD_SAVECMD_ONCE;
2255 }
2256 }
2257
2258 void GrpImpl::impl_playWav(Cmd& cmd) {
2259 if (cmd.cmd3 == 2) {
2260 music->PlaySE(cmd.Str(cmd.args[0]), 1); //loop
2261 cmd.cmd_type = CMD_SAVECMD_ONCE;
2262 }
2263 else {
2264 music->PlaySE(cmd.Str(cmd.args[0]));
2265 cmd.clear();
2266 }
2267 if (cmd.cmd3 == 1)
2268 status = WAIT_SE;
2269 }
2270
2271 void GrpImpl::impl_playSE(Cmd& cmd) {
2272 music->PlaySE(cmd.args[0].value);
2273 cmd.clear();
2274 }
2275
2276 void GrpImpl::impl_stopWav(Cmd& cmd) {
2277 if (cmd.cmd3 == 5)
2278 music->StopSE();
2279 else if (cmd.cmd3 == 105)
2280 music->StopSE(cmd.args[0].value);
2281
2282 cmd.cmd_type = CMD_SAVECMD_ONCE;
2283 }
2284
2285 void GrpImpl::impl_SetVolMod(Cmd& cmd) {
2286 music->volmod[cmd.cmd3-0x8b6] = cmd.args[0].value;
2287 config->SetParam("#VOLMOD", 4, music->volmod[0], music->volmod[1], music->volmod[2], music->volmod[3]);
2288 cmd.clear();
2289 }
2290
2291 void GrpImpl::impl_GetVolMod(Cmd& cmd) {
2292 cmd.SetSysvar(music->volmod[cmd.cmd3-0x91a]);
2293 }
2294
2295 void GrpImpl::impl_koePlay(Cmd& cmd) {
2296 eprintf("play koe %d",cmd.args[0].value);
2297 if (cmd.cmd4 == 1) {
2298 eprintf(", para? %d",cmd.args[1].value);
2299 }
2300 eprintf("\n");
2301 char buf[1024]; sprintf(buf, "%d",cmd.args[0].value);
2302 if ( !(skip_mode & SKIP_TEXT)) music->PlayKoe(buf);
2303 cmd.clear();
2304 }
2305
2306 /*It may be useful... or not.
2307 void GrpImpl::impl_objSwap(Cmd& cmd) {
2308 if (cmd.cmd1 == 1 && cmd.args.size() == 2) {
2309 SwapObj(cmd.args[0].value, cmd.args[1].value);
2310 }
2311 cmd.clear();
2312 }*/
2313
2314 void GrpImpl::impl_movPlay(Cmd& cmd) {
2315 if ( cmd.cmd4 == 0) {
2316 const char* str = cmd.Str(cmd.args[0]);
2317 int x = cmd.args[1].value;
2318 int y = cmd.args[2].value;
2319 int x2 = cmd.args[3].value;
2320 int y2 = cmd.args[4].value;
2321 eprintf("play movie ; name %s pos %d,%d - %d,%d\n",str,x,y,x2,y2);
2322 music->PlayMovie(str, x, y, x2, y2,1);
2323 status = WAIT_MOVIE;
2324 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
2325 cmd.clear();
2326 }
1450 } 2327 }
1451 2328
1452 void GrpImpl::Exec(Cmd& cmd) { 2329 void GrpImpl::Exec(Cmd& cmd) {
1453 if (cmd.cmd_type == CMD_TEXTEND) { 2330 if (cmd.cmd_type == CMD_TEXTEND) {
1454 music->StopKoe(500); // テキスト終了で声を止める 2331 music->StopKoe(500); // テキスト終了で声を止める
1458 if (cmd.cmd_type == CMD_WAITFRAMEUPDATE) { 2335 if (cmd.cmd_type == CMD_WAITFRAMEUPDATE) {
1459 // wait する場合は RefreshObj() しておく 2336 // wait する場合は RefreshObj() しておく
1460 RefreshObj(); 2337 RefreshObj();
1461 } 2338 }
1462 if (cmd.cmd_type != CMD_OTHER) return; 2339 if (cmd.cmd_type != CMD_OTHER) return;
1463 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x1e && cmd.cmd3 == 0) { 2340
1464 cmd.cmd_type = CMD_SAVECMDGRP_START; // grp stack clear 2341 CommandHandler::Exec(cmd);
1465 } 2342
1466 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x21) { 2343 //TODO: ???
1467 if (cmd.cmd3 == 0x46) {
1468 const char* name = cmd.Str(cmd.args[0]);
1469 int pdt = cmd.args[1].value;
1470 eprintf("load surface %s pdt %d\n",name, pdt);
1471 if (pdt == 0)
1472 reserved_load_surface0 = name; // 画像読み込みは 01-1f:0000 まで待つ
1473 else if (pdt == 1)
1474 LoadSurface(name); // 背景絵読み込み?
1475 else
1476 LoadSurface(name, pdt);
1477 cmd.cmd_type = CMD_SAVECMDGRP;
1478 } else if (cmd.cmd3 == 0x49) {
1479 const char* name = cmd.Str(cmd.args[0]);
1480 int sel = cmd.args[1].value;
1481 eprintf("set background %s sel %d\n",name, sel);
1482 if (name[0] == '?') {
1483 LoadSurface();
1484 } else {
1485 LoadSurface(name);
1486 }
1487 StartAnm(sel);
1488 status = WAIT_ANM;
1489 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
1490 if (name[0] == '?')
1491 cmd.cmd_type = CMD_SAVECMDGRP_ONCE;
1492 else
1493 cmd.cmd_type = CMD_SAVECMDGRP_START;
1494 } else if (cmd.cmd3 == 0x4b) {
1495 int pos = cmd.args[0].value;
1496 const char* name = cmd.Str(cmd.args[1]);
1497 int sel = cmd.args[2].value;
1498 eprintf("set foreground %s sel %d pos %d\n",name, sel, pos);
1499 AddSurface(name);
1500 StartAnm(sel);
1501 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
1502 status = WAIT_ANM;
1503 cmd.cmd_type = CMD_SAVECMDGRP_ONCE;
1504 } else if (cmd.cmd3 == 0x4c) {
1505 /* 0x46 との違いがわからない */
1506 /* とりあえず bg として登録しないでみる */
1507 /* 735 / 19438 : unsupported command; 0x23 - cmd 01-21:004c:00[ 2]
1508 ** "?",0
1509 */
1510 /* arg1 = "?" arg2 = 0 */
1511 const char* name = cmd.Str(cmd.args[0]);
1512 int sel = cmd.args[1].value;
1513 if (name[0] == '?') {
1514 LoadSurface();
1515 } else {
1516 LoadSurface(name, 1);
1517 }
1518 StartAnm(sel);
1519 status = WAIT_ANM;
1520 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
1521 if (name[0] == '?')
1522 cmd.cmd_type = CMD_SAVECMDGRP_ONCE;
1523 else
1524 cmd.cmd_type = CMD_SAVECMDGRP_START;
1525 } else if (cmd.cmd3 == 0x20) {
1526 // shake screen
1527 char key[1024];
1528 sprintf(key, "#SHAKE.%03d", cmd.args[0].value);
1529 if (config->SearchParam(key) != 2) {
1530 fprintf(stderr,"Cannot find shake pattern %d; use default pattern\n",cmd.args[0].value);
1531 strcpy(key, "#SHAKE.000"); // default key
1532 }
1533 int num; const int* pattern;
1534 pattern = config->GetParamArray(key, num);
1535 if (pattern) {
1536 StartShake(num, pattern);
1537 status = WAIT_SHAKE;
1538 }
1539 cmd.clear();
1540 } else if (cmd.cmd3 == 0x64 && cmd.cmd4 == 2) { // copy (KANOGI)
1541 int sx = cmd.args[0].value;
1542 int sy = cmd.args[1].value;
1543 int w = cmd.args[2].value - sx;
1544 int h = cmd.args[3].value - sy;
1545 Rect rect(sx, sy, sx+w, sy+h);
1546 int src = cmd.args[4].value;
1547 int dx = cmd.args[5].value;
1548 int dy = cmd.args[6].value;
1549 int dest = cmd.args[7].value;
1550 unsigned char alpha;
1551 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1552 printf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1553 if (src == dest) {
1554 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect);
1555 src = WORKPDT;
1556 }
1557 parent.Root().BlitSurface(Ssurface(src), rect, Dsurface(dest), Rect(dx,dy));
1558 if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h));
1559 cmd.clear();
1560 } else if (cmd.cmd3 == 0x4b1 && cmd.cmd4 == 2) {
1561 int x = cmd.args[0].value;
1562 int y = cmd.args[1].value;
1563 int w = cmd.args[2].value;
1564 int h = cmd.args[3].value;
1565 Rect rect(x,y,x+w,y+w);
1566 int pdt = cmd.args[4].value;
1567 int r = cmd.args[5].value;
1568 int g = cmd.args[6].value;
1569 int b = cmd.args[7].value;
1570 eprintf("clear %d:(%d,%d) size (%d,%d) r %d g %d b %d\n",pdt,x,y,w,h,r,g,b);
1571 DSurfaceFill(Dsurface(pdt), rect, r, g, b, 0xff);
1572 // if (pdt == 0) screen->ReBlit(rect);
1573 cmd.cmd_type = CMD_SAVECMDGRP;
1574 } else if (cmd.cmd3 == 0x4b1 && cmd.cmd4 == 3) { // alpha つきfill
1575 int x = cmd.args[0].value;
1576 int y = cmd.args[1].value;
1577 int w = cmd.args[2].value;
1578 int h = cmd.args[3].value;
1579 Rect rect(x,y,x+w,y+h);
1580 int pdt = cmd.args[4].value;
1581 int r = cmd.args[5].value;
1582 int g = cmd.args[6].value;
1583 int b = cmd.args[7].value;
1584 int a = cmd.args[8].value;
1585 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);
1586 if (a <= 0) ;
1587 else if (a >= 255) DSurfaceFill(Dsurface(pdt), rect, r, g, b);
1588 else {
1589 DSurfaceFill(Dsurface(WORKPDT), rect, r, g, b, a);
1590 parent.Root().BlitSurface(Dsurface(WORKPDT), rect, Dsurface(pdt), rect);
1591 }
1592 // if (pdt == 0) screen->ReBlit(rect);
1593 cmd.clear();
1594 } else if (cmd.cmd3 == 0x44c && cmd.cmd4 == 2) {
1595 int sx = cmd.args[0].value;
1596 int sy = cmd.args[1].value;
1597 int w = cmd.args[2].value;
1598 int h = cmd.args[3].value;
1599 int src = cmd.args[4].value;
1600 int dx = cmd.args[5].value;
1601 int dy = cmd.args[6].value;
1602 int dest = cmd.args[7].value;
1603 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1604 parent.Root().BlitSurface(Ssurface(src), Rect(sx,sy,sx+w,sy+h), Dsurface(dest), Rect(dx,dy));
1605 //DSurfaceMove(Ssurface(src), Rect(sx,sy,sx+w,sy+h), Dsurface(dest), Rect(dx,dy));
1606 // if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h));
1607 cmd.cmd_type = CMD_SAVECMDGRP;
1608 } else if (cmd.cmd3 == 0x44c && cmd.cmd4 == 3) { // alpha つきcopy
1609 int sx = cmd.args[0].value;
1610 int sy = cmd.args[1].value;
1611 int w = cmd.args[2].value;
1612 int h = cmd.args[3].value;
1613 Rect rect(sx, sy, sx+w, sy+h);
1614 int src = cmd.args[4].value;
1615 int dx = cmd.args[5].value;
1616 int dy = cmd.args[6].value;
1617 int dest = cmd.args[7].value;
1618 unsigned char alpha;
1619 if (cmd.args[8].value < 0) alpha = 0;
1620 else if (cmd.args[8].value > 255) alpha = 255;
1621 else alpha = cmd.args[8].value;
1622 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1623 if (src == dest) {
1624 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect);
1625 src = WORKPDT;
1626 }
1627 if (alpha != 0)
1628 parent.Root().BlitSurface(Ssurface(src), rect, &alpha, Rect(0,0,1,1), Dsurface(dest), Rect(dx,dy), 0);
1629 // if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h));
1630 cmd.clear();
1631 } else if (cmd.cmd3 == 0x640 && cmd.cmd4 == 3) { // saturate mode で alpha 付き copy
1632 int sx = cmd.args[0].value;
1633 int sy = cmd.args[1].value;
1634 int w = cmd.args[2].value;
1635 int h = cmd.args[3].value;
1636 Rect rect(sx, sy, sx+w, sy+h);
1637 int src = cmd.args[4].value;
1638 int dx = cmd.args[5].value;
1639 int dy = cmd.args[6].value;
1640 int dest = cmd.args[7].value;
1641 unsigned char alpha;
1642 if (cmd.args[8].value < 0) alpha = 0;
1643 else if (cmd.args[8].value > 255) alpha = 255;
1644 else alpha = cmd.args[8].value;
1645 eprintf("copy surface w/ saturate %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1646 if (src == dest) {
1647 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect);
1648 src = WORKPDT;
1649 }
1650 if (alpha != 0) {
1651 // saturate mode : screen (picture) を一時的に作成
1652 PicBase* screen_tmp = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0);
1653 screen_tmp->SetSurface(Ssurface(src), 0, 0, PicBase::BLIT_SATURATE);
1654 screen_tmp->SetSurfaceRect(rect);
1655 screen_tmp->Move(dx, dy);
1656 screen_tmp->SetSurfaceAlpha(&alpha, Rect(0,0,1,1));
1657 screen_tmp->SimpleBlit(Dsurface(dest));
1658 delete screen_tmp;
1659 }
1660 cmd.clear();
1661 } else if (cmd.cmd3 == 0x196 && cmd.cmd4 == 0) {
1662 Rect r_from(cmd.args[0].value, cmd.args[1].value);
1663 Rect r_to(cmd.args[2].value, cmd.args[3].value);
1664 int src_pdt = cmd.args[4].value;
1665 Rect r(cmd.args[5].value,cmd.args[6].value,cmd.args[7].value+1,cmd.args[8].value+1);
1666 int tm = cmd.args[9].value;
1667 fprintf(stderr,"??? cmd time %d\n",tm);
1668 // anm1 = new ScnGrpMove(event, screen, parent.Root(), surface, r, Ssurface(2), r_from, r_to, tm);
1669 // status = WAIT_ANM;
1670 }
1671 }
1672 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x22) {
1673 if (cmd.cmd3 == 0x0c30 && cmd.cmd4 == 0) { // スクロールする画像効果(Princess Bride)
1674 if (anm2) {
1675 anm2->Abort();
1676 delete anm2;
1677 }
1678 PicBase* pic; Surface* s;
1679 Rect r(cmd.args[1].value, cmd.args[2].value, cmd.args[3].value+1, cmd.args[4].value+1);
1680 const char* name = cmd.Str(cmd.args[5]);
1681 Rect sr_start(cmd.args[6].value,cmd.args[7].value);
1682 Rect sr_end(cmd.args[8].value,cmd.args[9].value);
1683 int tm = cmd.args[10].value;
1684 LoadSurface(name, 2); /* PDT2 に読み込み、と決め打ち */
1685
1686 anm2 = new ScnGrpMove(event, screen, parent.Root(), Dsurface(1), r, Ssurface(2), sr_start, sr_end, tm);
1687 cmd.cmd_type = CMD_SAVECMDGRP;
1688 }
1689 if ( (cmd.cmd3 == 0xc1c && cmd.cmd4 == 0) || (cmd.cmd3 == 0x835 && cmd.cmd4 == 0) ) {
1690 // カードが落ちるアニメーション
1691 int i;
1692 ScnGrpAnm* new_anm = new ScnGrpAnm(event, screen, *this);
1693 if (cmd.cmd3 == 0x835) {
1694 AbortAnm();
1695 anm1 = new_anm;
1696 status = WAIT_ANM;
1697 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
1698 } else {
1699 anm2 = new_anm;
1700 }
1701 for (i=0; i<cmd.argc; i++) {
1702 const char* name = cmd.Str(cmd.args[i*3+1]);
1703 int tm = cmd.args[i*3+2].value;
1704 new_anm->push_back(ScnGrpAnmAtom(name,tm));
1705 }
1706 new_anm->CalcTotal();
1707 cmd.clear();
1708 }
1709 }
1710 if (cmd.cmd1 == 1 && cmd.cmd2 == 4) {
1711 if (cmd.cmd3 == 0x5dc) // Total number of CG
1712 cmd.SetSysvar(cgm_size);
1713 if (cmd.cmd3 == 0x5dd) // Number of CG viewed
1714 cmd.SetSysvar(cgm_data.size());
1715 if (cmd.cmd3 == 0x5de) // Percentage of CG viewed
1716 cmd.SetSysvar(cgm_data.size() * 100 / cgm_size);
1717
1718 if (cmd.cmd3 == 0xd8 || cmd.cmd3 == 0xd3 || cmd.cmd3 == 0xd2 || cmd.cmd3 == 0xd7) {
1719 cmd.clear(); // いつも 0xd8 / 0xd7 と組で出てくる
1720 }
1721
1722 // CG Status
1723 if (cmd.cmd3 == 0x5e0) { // 画像既視フラグを得る
1724 string s = cmd.Str(cmd.args[0]);
1725 if (cgm_info.find(s) == cgm_info.end()) {
1726 fprintf(stderr,"cmd 01-04:05e0 : cannot find cgm-info of '%s'\n",s.c_str());
1727 return;
1728 }
1729 int n = cgm_info[s];
1730 if (cgm_data.find(n) == cgm_data.end()) cmd.SetSysvar(0);
1731 else cmd.SetSysvar(1);
1732 }
1733
1734 if (cmd.cmd3 == 0x6a4) { // CreateInput (index, x, y, width, height, fontsize, br, bg, bb, fr, fg, fb)
1735 int index = cmd.args[0].value;
1736 int x = cmd.args[1].value;
1737 int y = cmd.args[2].value;
1738 //TODO
1739 }
1740 if (cmd.cmd3 == 0x6ae) { // SetInput (index, text)
1741 //TODO
1742 }
1743 }
1744 #if 1
1745 /* object 操作 */
1746 if ( (cmd.cmd1 == 1 || cmd.cmd1 == 2) && (cmd.cmd2 == 0x3d || cmd.cmd2 == 0x3e) && (cmd.cmd3 == 0x0a || cmd.cmd3 == 0x0b || cmd.cmd3 == 0x0e)) { // clear object
1747 if (cmd.cmd3 == 0x0a || cmd.cmd3 == 0x0b) {
1748 if (cmd.cmd1 == 2 && cmd.args.size() == 2) {
1749 int num = cmd.args[0].value*1000 + cmd.args[1].value + 500;
1750 DeleteObj(num);
1751 } else if (cmd.args.size() == 1) { // group ごと消去
1752 int num_first = cmd.args[0].value * 1000;
1753 int num_end = num_first+1000;
1754 DeleteObjRange(num_first, num_end);
1755 }
1756 } else { // 0x0e
1757 if (cmd.cmd1 == 1 && cmd.args.size() == 2) {
1758 SwapObj(cmd.args[0].value * 1000, cmd.args[1].value * 1000);
1759 } else if (cmd.cmd1 == 2 && cmd.args.size() == 3) {
1760 int v1 = cmd.args[0].value*1000 + cmd.args[1].value + 500;
1761 int v2 = cmd.args[0].value*1000 + cmd.args[2].value + 500;
1762 SwapObj(v1, v2);
1763 }
1764 }
1765 cmd.clear();
1766 }
1767 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x3c && cmd.cmd3 == 0x01) { // ??? : CLANNAD
1768 cmd.clear();
1769 }
1770 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x3c && cmd.cmd3 == 0) { // ??? : KANOGI : 画像オブジェクトの削除? 2344 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x3c && cmd.cmd3 == 0) { // ??? : KANOGI : 画像オブジェクトの削除?
1771 DeleteObjPic(cmd.args[0].value * 1000); // 旧ファイル名のsurfaceを削除 2345 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除
1772 GrpObj& g = grpobj[cmd.args[0].value * 1000]; 2346 GrpObj& g = grpobj[cmd.args[0].value];
1773 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN); 2347 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN);
1774 cmd.clear(); 2348 cmd.clear();
1775 } 2349 }
1776 if ( (cmd.cmd1 == 1 || cmd.cmd1 == 2) && (cmd.cmd2 == 0x47 || cmd.cmd2 == 0x48|| cmd.cmd2 == 0x49 || cmd.cmd2 == 0x51 || cmd.cmd2 == 0x52 || cmd.cmd2 == 0x54)) { 2350
1777 if (cmd.cmd1 == 1) { 2351 //TODO: ???
1778 if (cmd.args.size() >= 1) cmd.args[0].value *= 1000; // とりあえず 1000倍しておく 2352 if ( (cmd.cmd1 == 1 || cmd.cmd1 == 2) && cmd.cmd2 == 0x51) {
1779 } else { // cmd.cmd2 == 2 2353 GrpObj& g = grpobj[cmd.args[0].value];
1780 // オブジェクト番号を指定するコマンド引数が一つ増えているのを消去 2354 if (g.attr & GrpObj::UPDATE_ALL) {
1781 vector<VarInfo> args = cmd.args; 2355 SetObjChanged(cmd.args[0].value);
1782 cmd.args.clear(); 2356 }
1783 if (args.size() >= 2) { 2357 }
1784 cmd.args.push_back(args[0].value*1000 + args[1].value + 500);
1785 cmd.args.insert(cmd.args.end(), args.begin()+2, args.end());
1786 }
1787 }
1788 if (cmd.cmd2 == 0x47) {
1789 /**************:
1790 0x47 : オブジェクト内容の設定
1791 0x3e8: G00 ファイル
1792 0x3eb: GAN ファイル
1793 0x44c: 矩形領域
1794 0x4b0: 文字列
1795 0x514: 天候効果
1796 0x578: 数字の画像表示
1797 */
1798 int base_argc = 0;
1799 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除
1800 GrpObj& g = grpobj[cmd.args[0].value];
1801 if (cmd.cmd3 == 0x3e8) { /* ファイル名設定 */
1802 g.gtype = GrpObj::FILE;
1803 string name = cmd.Str(cmd.args[1]);
1804 if (name.find('?') != -1) {
1805 name.erase(name.find('?')); // '?' 以降の意味がわからない
1806 }
1807 g.name = name;
1808 } else if (cmd.cmd3 == 0x3eb) { /* ファイル名設定(GAN含む) */
1809 g.gtype = GrpObj::GAN;
1810 if (cmd.Str(cmd.args[1]) == string("???"))
1811 g.name = cmd.Str(cmd.args[2]);
1812 else
1813 g.name = cmd.Str(cmd.args[1]);
1814 g.gan_name = cmd.Str(cmd.args[2]);
1815
1816 if (cmd.cmd4 >= 1 && cmd.args[3].value == 0)
1817 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN);
1818 else
1819 g.attr = GrpObj::Attribute(g.attr & ~(GrpObj::HIDDEN));
1820
1821 if (cmd.argc >= 5)
1822 g.SetPos(1, cmd.args[4].value, -cmd.args[5].value);
1823
1824 if (g.name.find('?') != -1) {
1825 g.name.erase(g.name.find('?'));
1826 g.gan_name = cmd.Str(cmd.args[2]);
1827 }
1828 } else if (cmd.cmd3 == 0x4b0) { // 画像を文字列として指定
1829 g.gtype = GrpObj::MOJI;
1830 g.print_moji = cmd.Str(cmd.args[1]);
1831 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN)); // 常に表示がデフォルト?
1832 cmd.clear();
1833 } else if (cmd.cmd3 == 0x578) { // 数値を画像として表示
1834 g.gtype = GrpObj::DIGIT;
1835 g.name = cmd.Str(cmd.args[1]);
1836 }
1837 CreateObj(cmd.args[0].value);
1838 if (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb || cmd.cmd3 == 0x4b0 || cmd.cmd3 == 0x578) {
1839 // FILE, GAN, MOJI, DIGIT ならば座標等の設定を行う
1840 if (cmd.cmd4 >= 1) {
1841 if (cmd.args[2+base_argc].value == 0) {
1842 if (cmd.cmd1 == 1)
1843 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP);
1844 else
1845 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN);
1846 } else {
1847 if (cmd.cmd1 == 1)
1848 g.attr = GrpObj::Attribute(g.attr & (~(GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP)));
1849 else
1850 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN));
1851 }
1852 if (cmd.cmd1 == 1)
1853 SetObjChangedGroup(cmd.args[0].value);
1854 }
1855 if (cmd.cmd4 >= 2) { // 座標等も設定
1856 g.SetPos(0,cmd.args[3+base_argc].value, cmd.args[4+base_argc].value);
1857 }
1858 if ( (cmd.cmd3 == 0x3e8 || cmd.cmd3 == 0x3eb) && cmd.cmd4 >= 3) { // pattern 番号も設定
1859 g.SetSurfaceNum(cmd.args[5+base_argc].value);
1860 base_argc++; // 0x3e8 (FILE) / 0x3eb (GAN) の場合のみこのオプションは存在する
1861 }
1862 cmd.clear();
1863 } else {
1864 fprintf(stderr,"CreateObj : cmd.cmd3 = %04x ; not supported!\n",cmd.cmd3);
1865 }
1866 } else if (cmd.cmd2 == 0x48) {
1867 // 画面切り替え後の object (back screen object) 設定
1868 if (cmd.cmd3 == 0x3e8) {
1869 // cmd.cmd4 == 0 : args = 2, CLANNAD : cg mode
1870 // cmd.cmd4 == 1 : args = 3, CLANNAD : 春原回想?のところで画面が黒くなってしまうので、とりあえず。
1871 // cmd.cmd4 == 2 : args = 5, KANOGI : Fore Graphics
1872 // cmd.cmd4 == 3 : args = 6, KANOGI : CG mode
1873 GrpObj& g = bs_obj[cmd.args[0].value];
1874 string name = cmd.Str(cmd.args[1]);
1875 if (name.find('?') != -1) {
1876 name.erase(name.find('?')); // '?' 以降の意味がわからない
1877 }
1878 g.gtype = GrpObj::FILE;
1879 g.name = name;
1880 if (cmd.cmd4 >= 1 && cmd.args[2].value == 0)
1881 g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN);
1882 else
1883 g.attr = GrpObj::Attribute(g.attr & ~(GrpObj::HIDDEN));
1884 if (cmd.cmd4 >= 2)
1885 g.SetPos(0,cmd.args[3].value, cmd.args[4].value);
1886 if (cmd.cmd4 >= 3)
1887 g.SetSurfaceNum(cmd.args[5].value);
1888 if (cmd.cmd4 <= 3)
1889 cmd.cmd_type = CMD_SAVECMDGRP;
1890 }
1891 } else if (cmd.cmd2 == 0x49) {
1892 if (cmd.cmd3 == 0) { // アニメーションを強制終了
1893 GrpObj& g = grpobj[cmd.args[0].value];
1894 if (g.anm == NULL || g.anm->IsEnd()) ;
1895 else g.anm->Abort();
1896 } else if (cmd.cmd3 == 3) { // アニメーション中か?
1897 GrpObj& g = grpobj[cmd.args[0].value];
1898 if (g.anm == NULL || g.anm->IsEnd()) {
1899 cmd.SetSysvar(0);
1900 } else {
1901 cmd.SetSysvar(1);
1902 }
1903 } else if (cmd.cmd3 == 1000) {
1904 // アニメーションを途中で停止した状態にする
1905 GrpObj& g = grpobj[cmd.args[0].value];
1906 if (g.anm == NULL || g.anm->IsEnd()) {
1907 // fprintf(stderr,"AnimPause : no animation in %d (%d)\n",cmd.args[0].value, cmd.args[1].value);
1908 g.SetSurfaceNum(cmd.args[1].value);
1909 } else {
1910 g.anm->Abort();
1911 g.SetSurfaceNum(cmd.args[1].value);
1912 }
1913 SetObjChanged(cmd.args[0].value);
1914 cmd.clear();
1915 } else if (cmd.cmd3 == 0x7d3) { // surface を増加させる画像効果
1916 GrpObj& g = grpobj[cmd.args[0].value];
1917 g.CreateGanSpecial(event, 0, cmd.args[1].value);
1918 // g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN));
1919 SetObjChanged(cmd.args[0].value);
1920 cmd.clear();
1921 } else if (cmd.cmd3 == 0xbbd || cmd.cmd3 == 0xbbb || cmd.cmd3 == 0xbb9) { // アニメーション開始
1922 GrpObj& g = grpobj[cmd.args[0].value];
1923 g.CreateGan(event, cmd.args[1].value);
1924 // g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN));
1925 SetObjChanged(cmd.args[0].value);
1926 cmd.clear();
1927 }
1928 } else if (cmd.cmd2 == 0x51 || cmd.cmd2 == 0x52) {
1929 GrpObj& g = (cmd.cmd2 == 0x51) ?
1930 grpobj[cmd.args[0].value] :
1931 bs_obj[cmd.args[0].value];
1932 if (cmd.cmd3 == 0x3e8) { /* 座標設定 */
1933 g.SetPos(0,cmd.args[1].value, cmd.args[2].value);
1934 cmd.clear();
1935 } else if (cmd.cmd3 == 0x3e9 || cmd.cmd3 == 0x3ea) { /* x / y 座標のみ設定 */
1936 int x0, y0;
1937 g.GetPos(0, x0, y0);
1938 if (cmd.cmd3 == 0x3e9)
1939 g.SetPos(0,cmd.args[1].value, y0);
1940 else
1941 g.SetPos(0,x0, cmd.args[1].value);
1942 cmd.clear();
1943 } else if (cmd.cmd3 == 0x3eb) { /* alpha */
1944 g.SetAlpha(cmd.args[1].value);
1945 cmd.clear();
1946 } else if (cmd.cmd3 == 0x3ec) { /* visible flag */
1947 if (cmd.cmd1 == 1) {
1948 if (cmd.args[1].value) g.attr = GrpObj::Attribute(g.attr & (~(GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP)));
1949 else g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN | GrpObj::HIDDEN_GROUP);
1950 } else {
1951 if (cmd.args[1].value) g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN));
1952 else g.attr = GrpObj::Attribute(g.attr | GrpObj::HIDDEN);
1953 }
1954 g.attr = GrpObj::Attribute(g.attr | GrpObj::UPDATE_VISIBLE);
1955 // グループ単位で次の RefreshObj で表示・消去
1956 if (cmd.cmd2 == 0x51 && cmd.cmd1 == 1)
1957 SetObjChangedGroup(cmd.args[0].value);
1958 cmd.clear();
1959 } else if (cmd.cmd3 == 0x3ee || cmd.cmd3 == 0x7d6) { /* 座標設定その2? */
1960 /* 0x7d6 : 画像側の基準座標を args[4,5] に入れているのかもしれない */
1961 int index = cmd.args[1].value;
1962 int x = cmd.args[2].value;
1963 int y = cmd.args[3].value;
1964 g.SetPos(index+1, x, y);
1965 cmd.clear();
1966 } else if (cmd.cmd3 == 0x3f8) { // 画像を文字列として設定:色の設定
1967 g.print_r = cmd.args[1].value;
1968 g.print_g = cmd.args[2].value;
1969 g.print_b = cmd.args[3].value;
1970 g.SetUpdate();
1971 // grpobj[cmd.args[0].value].print_a = cmd.args[4].value;
1972 /* args:229,18,minus-1,0,99,255,-1 */
1973 /* args:102,26,minus-1,0,99,0,255 */
1974 cmd.clear();
1975 } else if (cmd.cmd3 == 0x3fd) { // centering mode などを設定?
1976 if (cmd.args[1].value == 1) {
1977 g.attr = GrpObj::Attribute(g.attr | GrpObj::SATURATE);
1978 cmd.clear();
1979 } else if (cmd.args[1].value == 0) {
1980 g.attr = GrpObj::Attribute(g.attr & (~GrpObj::SATURATE));
1981 cmd.clear();
1982 }
1983 g.SetUpdate();
1984 /* cmd3 == 0x41c : ゲームの進行とともに
1985 args:10,105
1986 args:10,133
1987 args:10,144
1988 args:10,144
1989 と変化
1990
1991 cmd3 == 0x418 :
1992 args: 10, 400 -> 100
1993 と、alpha の増加とともに変化
1994 */
1995 /*
1996 487 / 8047 : unsupported command; 0x23 - cmd 01-51:0419:00[ 2]
1997 81,-40,
1998 第二引数の 1/10 がオブジェクトの回転角
1999 */
2000 } else if (cmd.cmd3 == 0x400) { // 画像を文字列として指定
2001 g.print_moji = cmd.Str(cmd.args[1]);
2002 g.SetUpdate();
2003 cmd.clear();
2004 } else if (cmd.cmd3 == 0x401) { // 画像を文字列として設定:文字の大きさなど
2005 /* args: size, xspace, yspace, vertical, color, shadow */
2006 /*
2007 args:17, 0,0,-1, 0,-1 DT in Tomoyo
2008 args:17, 0,0,-1,200,-1 Save/Load in Tomoyo
2009 args:20, 0,0, 0,255,-1 "──ありがとう…。" (勝平Ed付近)
2010 args:16,-1,0,99,255,-1 "やあ、久しぶり──…。" (同上,Save/Load Menu)
2011 args:26,-1,0,99, 0,255 Kuma in CLANNAD
2012 */
2013 g.print_size = cmd.args[1].value;
2014 /* 前景色を得る */
2015 int cr,cg,cb; char key[1024];
2016 sprintf(key, "#COLOR_TABLE.%03d", cmd.args[5].value);
2017 if (config->GetParam(key, 3, &cr, &cg, &cb)) { // color not found
2018 cr = cg = cb = 0;
2019 }
2020 g.print_r = cr;
2021 g.print_g = cg;
2022 g.print_b = cb;
2023 g.SetUpdate();
2024 cmd.clear();
2025 } else if (cmd.cmd3 == 0x408) { // set order
2026 int order = cmd.args[1].value;
2027 if (cmd.cmd1 == 1) order *= 1000; // order も 1000 倍する必要がある?
2028 g.order = order;
2029 ZMoveObj(cmd.args[0].value);
2030 cmd.clear();
2031 } else if (cmd.cmd3 == 0x40a && cmd.cmd4 == 1) { // set surface geometry?
2032 // オブジェクトのどの部分を画面に表示するか(クリップ領域)の設定
2033 int rx = cmd.args[1].value;
2034 int ry = cmd.args[2].value;
2035 int x2 = cmd.args[3].value;
2036 int y2 = cmd.args[4].value;
2037 g.SetClipArea(rx, ry, x2, y2); //TODO: case when cmd.args.size() == 1
2038 cmd.clear();
2039 } else if (cmd.cmd3 == 0x40d) { // set digit number
2040 g.dig_number = cmd.args[1].value;
2041 g.SetUpdate();
2042 cmd.clear();
2043 } else if (cmd.cmd3 == 0x40e) { // set digit option
2044 g.dig_digit = cmd.args[1].value;
2045 int attr = g.attr;
2046 attr &= ~(GrpObj::DIG_ZERO | GrpObj::DIG_SIGN | GrpObj::DIG_PACK);
2047 if (cmd.args[2].value) attr |= GrpObj::DIG_ZERO;
2048 if (cmd.args[3].value) attr |= GrpObj::DIG_SIGN;
2049 if (cmd.args[4].value) attr |= GrpObj::DIG_PACK;
2050 g.attr = GrpObj::Attribute(attr);
2051 g.SetUpdate();
2052 cmd.clear();
2053 } else if (cmd.cmd3 == 0x40f) { /* set surface number */
2054 g.SetSurfaceNum(cmd.args[1].value);
2055 cmd.clear();
2056 } else if (cmd.cmd3 == 0x416) { // オブジェクトの拡大率設定
2057 int zoom = (cmd.args[1].value + cmd.args[2].value)/2; // x,y 別に設定できるらしい
2058 zoom = zoom*256/100;
2059 g.SetZoomRotate(zoom, -1);
2060 cmd.clear();
2061 } else if (cmd.cmd3 == 0x419) { // オブジェクトの回転設定
2062 int angle = cmd.args[1].value;
2063 angle /= 10;
2064 if (angle < 0) {
2065 angle %= 360;
2066 angle += 360;
2067 }
2068 angle %= 360;
2069 g.SetZoomRotate(-1, angle);
2070 cmd.clear();
2071 }
2072 if (cmd.cmd2 == 0x51 && (g.attr & GrpObj::UPDATE_ALL)) {
2073 SetObjChanged(cmd.args[0].value);
2074 }
2075 } else if (cmd.cmd2 == 0x54) {
2076 /* 座標取得 */
2077 if (cmd.cmd3 == 0x3e8) {
2078 GrpObj& obj = grpobj[cmd.args[0].value];
2079 VarInfo arg1 = cmd.args[1];
2080 VarInfo arg2 = cmd.args[2];
2081 int x0, y0;
2082 obj.GetPos(0,x0, y0);
2083 cmd.SetFlagvar(arg1, x0);
2084 cmd.SetFlagvar(arg2, y0);
2085 } else if (cmd.cmd3 == 0x44c) {
2086 int w, h;
2087 GrpObj& obj = grpobj[cmd.args[0].value];
2088 obj.GetSrcGeom(w, h);
2089 VarInfo arg1 = cmd.args[1];
2090 VarInfo arg2 = cmd.args[2];
2091 cmd.SetFlagvar(arg1, w);
2092 cmd.SetFlagvar(arg2, h);
2093 }
2094 }
2095 // セーブ用にコマンドを元に戻す
2096 if (cmd.args.size() != 0 && (cmd.cmd_type == CMD_SAVECMDGRP || cmd.cmd_type == CMD_SAVECMDGRP_ONCE)) {
2097 if (cmd.cmd1 == 1) cmd.args[0].value /= 1000;
2098 else if (cmd.cmd1 == 2) {
2099 vector<VarInfo> args = cmd.args;
2100 int value = args[0].value;
2101 cmd.args.clear();
2102 args[0].value = value / 1000;
2103 cmd.args.push_back(args[0]);
2104 args[0].value = value % 1000 - 500;
2105 cmd.args.push_back(args[0]);
2106 cmd.args.insert(cmd.args.end(), args.begin()+1, args.end());
2107 }
2108 }
2109 }
2110 #endif
2111 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x1f) { // 本来は grpstack clear らしい
2112 RefreshObj();
2113 // Princess Bride の中途 Staff roll
2114 // このタイミングで描画するのが都合がいいので、
2115 //シナリオループを抜けて描画を起動
2116 cmd.cmd_type = CMD_WAITFRAMEUPDATE;
2117 }
2118
2119 /* XXX : GiGiGi */
2120 /* 122 : 0x23 - cmd 01-04:0924:00[ 0] : V<sys> にBGM再生モードを返す (0/1)
2121 ** 256 : 0x23 - cmd 01-04:091a:00[ 0] : V<sys> にBGM音量を返す (0-255?)
2122 ** 278 : 0x23 - cmd 01-04:0926:00[ 0] : V<sys> にEff再生モードを返す (0/1)
2123 ** 412 : 0x23 - cmd 01-04:091c:00[ 0] : V<sys> にEff音量を返す (0-255?)
2124 ** 434 : 0x23 - cmd 01-04:0927:00[ 0] : V<sys> にSE 再生モードを返す (0/1)
2125 ** 568 : 0x23 - cmd 01-04:091d:00[ 0] : V<sys> にSE 音量を返す (0-255?)
2126
2127 ** 122 : 0x23 - cmd 01-04:08c0:00[ 0] : V<sys> にBGM再生モードを設定 (0/1)
2128 ** 256 : 0x23 - cmd 01-04:08b6:00[ 0] : V<sys> にBGM音量を設定 (0-255?)
2129 ** 278 : 0x23 - cmd 01-04:08c2:00[ 0] : V<sys> にEff再生モードを設定 (0/1)
2130 ** 412 : 0x23 - cmd 01-04:08b8:00[ 0] : V<sys> にEff音量を設定 (0-255?)
2131 ** 434 : 0x23 - cmd 01-04:08c3:00[ 0] : V<sys> にSE 再生モードを設定 (0/1)
2132 ** 568 : 0x23 - cmd 01-04:08b9:00[ 0] : V<sys> にSE 音量を設定 (0-255?)
2133 */
2134 // 本来は音楽関連のコマンド
2135 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x14) {
2136 if (cmd.cmd3 == 0 && cmd.cmd4 == 0) {
2137 eprintf("play bgm %s\n",cmd.Str(cmd.args[0]));
2138 music->PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000);
2139 cmd.cmd_type = CMD_SAVECMD_ONCE;
2140 }
2141 if (cmd.cmd3 == 2 && (cmd.cmd4 == 2 || cmd.cmd4 == 0) ) { /* ??? : ことみシナリオラストの音楽再生 */
2142 eprintf("play bgm %s\n",cmd.Str(cmd.args[0]));
2143 music->PlayCDROM( (char*)cmd.Str(cmd.args[0]), 1);
2144 cmd.cmd_type = CMD_SAVECMD_ONCE;
2145 }
2146 if (cmd.cmd3 == 0 && cmd.cmd4 == 2) {
2147 eprintf("fade bgm %d? and play bgm %s; %d\n",cmd.args[1].value, cmd.Str(cmd.args[0]), cmd.args[2].value);
2148 // music->PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000, cmd.args[2].value);
2149 music->PlayCDROM( (char*)cmd.Str(cmd.args[0]), 10000);
2150 cmd.cmd_type = CMD_SAVECMD_ONCE;
2151 }
2152 if ( (cmd.cmd3 == 5 || cmd.cmd3 == 0x69) && cmd.cmd4 == 0) {
2153 if (cmd.cmd3 == 5) {
2154 music->StopCDROM(0);
2155 eprintf("stop bgm\n");
2156 } else {
2157 music->StopCDROM(cmd.args[0].value);
2158 eprintf("fade bgm %d\n",cmd.args[0].value);
2159 }
2160 cmd.cmd_type = CMD_SAVECMD_ONCE;
2161 }
2162 }
2163 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x15) {
2164 if ((cmd.cmd3 == 2) || (cmd.cmd3 == 0 && (cmd.cmd4 == 1 || cmd.cmd4 == 2)) || (cmd.cmd3 == 0 && cmd.cmd4 == 0)) {
2165 eprintf("play SE %s\n",cmd.Str(cmd.args[0]));
2166 if (cmd.cmd3 == 2) {
2167 music->PlaySE(cmd.Str(cmd.args[0]),1);
2168 cmd.cmd_type = CMD_SAVECMD_ONCE;
2169 } else {
2170 music->PlaySE(cmd.Str(cmd.args[0]));
2171 cmd.clear();
2172 }
2173 } else if (cmd.cmd3 == 5) {
2174 eprintf("Stop SE\n");
2175 music->StopSE();
2176 cmd.cmd_type = CMD_SAVECMD_ONCE;
2177 } else if (cmd.cmd3 == 0x69) {
2178 eprintf("Stop SE with fade %d\n",cmd.args[0].value);
2179 music->StopSE(cmd.args[0].value);
2180 cmd.cmd_type = CMD_SAVECMD_ONCE;
2181 }
2182 }
2183 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && (cmd.cmd3 == 0x4bb || cmd.cmd3 == 0x4bc) ) {
2184 // 音楽を待ってみる(絶対に違うが)。本来、04-803 に対応してなにかの終わりをwaitするっぽい(風子/智代Ed付近)
2185 // EnableSyscom らしいが、よくわからない (rldev)
2186 // if (!music->IsStopSE()) status = WAIT_SE;
2187 cmd.clear();
2188 }
2189
2190 // 音楽モードで音量を上げるためのコマンド (SetBgmVolume)
2191 // とりあえず未実装
2192 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && cmd.cmd3 >= 0x8b6 && cmd.cmd3 <= 0x8b9) { // Set{Bgm,Koe,PCM,Se}VolMod
2193 music->volmod[cmd.cmd3-0x8b6] = cmd.args[0].value;
2194 config->SetParam("#VOLMOD", 4, music->volmod[0], music->volmod[1], music->volmod[2], music->volmod[3]);
2195 cmd.clear();
2196 }
2197 if (cmd.cmd1 == 1 && cmd.cmd2 == 4 && cmd.cmd3 >= 0x91a && cmd.cmd3 <= 0x91d) { // Get{Bgm,Koe,PCM,Se}VolMod
2198 cmd.SetSysvar(music->volmod[cmd.cmd3-0x91a]);
2199 }
2200
2201 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x16) {
2202 if (cmd.cmd3 == 0 && cmd.cmd4 == 0) {
2203 eprintf("play SE %d\n",cmd.args[0].value);
2204 music->PlaySE(cmd.args[0].value);
2205 cmd.clear();
2206 }
2207 }
2208 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x17) {
2209 if (cmd.cmd3 == 0) {
2210 eprintf("play koe %d",cmd.args[0].value);
2211 if (cmd.cmd4 == 1) {
2212 eprintf(", para? %d",cmd.args[1].value);
2213 }
2214 eprintf("\n");
2215 char buf[1024]; sprintf(buf, "%d",cmd.args[0].value);
2216 if ( !(skip_mode & SKIP_TEXT)) music->PlayKoe(buf);
2217 cmd.clear();
2218 }
2219 }
2220 if (cmd.cmd1 == 1 && cmd.cmd2 == 0x1a) {
2221 if ( (cmd.cmd3 == 0x14 || cmd.cmd3 == 1) && cmd.cmd4 == 0) {
2222 const char* str = cmd.Str(cmd.args[0]);
2223 int x = cmd.args[1].value;
2224 int y = cmd.args[2].value;
2225 int x2 = cmd.args[3].value;
2226 int y2 = cmd.args[4].value;
2227 eprintf("play movie ; name %s pos %d,%d - %d,%d\n",str,x,y,x2,y2);
2228 music->PlayMovie(str, x, y, x2, y2,1);
2229 status = WAIT_MOVIE;
2230 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
2231 cmd.clear();
2232 }
2233 }
2234 return;
2235 } 2358 }
2236 2359
2237 2360
2238 /******************************************************** 2361 /********************************************************
2239 ** 2362 **