comparison scn2k/scn2k_grp.cc @ 56:c7bcc0ec2267

* replaced Grp and Text classes by the TextImpl and GrpImpl ones * splitted scn2k.h into smaller header files * moved some definitions from scn2k_*.cc to the header files * moved opcode implementation to scn2k_*impl.cc
author thib
date Thu, 30 Apr 2009 19:05:09 +0000
parents f1a27ee7e03c
children e16e13d8cd68
comparison
equal deleted inserted replaced
55:f1a27ee7e03c 56:c7bcc0ec2267
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 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. 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "scn2k.h" 28 #include "scn2k.h"
29 #include "window/widget.h"
30 #include "system/file.h" 29 #include "system/file.h"
31 #include "system/system_config.h" 30 #include "system/system_config.h"
32 #include "font/text.h" 31 #include "font/text.h"
33 #include <set> 32 #include "window/render.h"
34 33
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); 34 extern XKFont::HorizLayout* DefaultLayout(int text_size);
42 35
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 typedef std::map<int, GrpObj> GrpObjMap;
58
59 struct GrpObj {
60 string name;
61 string gan_name;
62 PicContainer* pic_parent;
63 PicBase* picture;
64 WidAnmTime* anm;
65 int _posx, _posy;
66 int posx[9], posy[9];
67 Rect clip_area;
68 unsigned char alpha;
69 int order;
70 int surface_num;
71
72 GrpObjMap children_obj;
73
74 string print_moji;
75 int print_size, print_r, print_b, print_g;
76
77 int dig_number, dig_digit;
78
79 // zoom / rotate 関係
80 int zoom; // 256 で 1 倍
81 int rotate; // 0-360度
82
83 vector<Rect> src_pos;
84 enum GrpType { FILLRECT = 1, FILE = 2, GAN = 3, MOJI = 4, DIGIT = 5} gtype;
85 enum Attribute { NONE=0, WIPEON=1, SATURATE=2, HIDDEN=4,
86 UPDATE_PICTURE = 16, UPDATE_POS = 32, UPDATE_ALPHA = 64, UPDATE_SNUM = 128, UPDATE_CLIP = 256, UPDATE_VISIBLE = 512,
87 UPDATE_ALL = (UPDATE_PICTURE | UPDATE_POS | UPDATE_ALPHA | UPDATE_SNUM | UPDATE_CLIP | UPDATE_VISIBLE),
88 ANM_PLAYSTART = 0x8000, ANM_PLAYING = 0x10000,
89 DIG_ZERO = 0x10000*2, DIG_SIGN = 0x10000*4, DIG_PACK=0x10000*8,DIG_SPACE=0x10000*16
90 };
91 Attribute attr;
92
93 GrpObj(void);
94 ~GrpObj(void);
95
96 void SetPos(int index, int x, int y);
97 void GetPos(int index, int& x, int& y);
98 int PosX(void);
99 int PosY(void);
100 void SetAlpha(void);
101 void SetAlpha(int alpha);
102 void SetSurfaceNum(int num = -1);
103 void SetZoomRotate(int zoom=-1, int rotate=-1);
104 void SetClipArea(int x, int y, int width, int height);
105 void GetSrcGeom(int& width, int& height);
106 void SetUpdate(void);
107 void UpdateMoji(void);
108 void UpdateDigit(void);
109 void UpdateSurface(void);
110 void ZoomRotate(void);
111 void Refresh(GrpObj& parent_obj);
112 void _debug_Dump(int, int);
113 void Update(void);
114 void CreateSurface(PicContainer* parent);
115 void CreateGan(Event::Container& event, int event_number);
116 void CreateGanSpecial(Event::Container& event, int event_number, int time);
117 PicBase* DeletePic(void);
118 };
119
120 /*******************************************************************
121 ** GrpObj(interface)
122 */
123
124 class GrpImpl : public CommandHandler {
125 #define MAXPDT 256
126 #define WORKPDT 255
127 private:
128 void CreateObj(int number);
129 void CreateSubObj(int grp_num, int number);
130 void ZMoveObj(int number);
131 void SetObjChanged(int number);
132 void SwapObj(int a1, int a2);
133 void DeleteObjPic(int num);// object の surface のみ削除
134 void DeleteSubObjPic(int grp_num, int num);
135 void DeleteObj(int num);
136 void DeleteSubObj(int grp_num, int num);
137 void RefreshObj(void);
138
139 Surface* Dsurface(int pdt);
140 Surface* Ssurface(int pdt);
141
142 // cgmode 用画像処理関連
143 void LoadCgm(void);
144
145 public:
146 GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& _flag, set<int>& _cgm_data);
147 ~GrpImpl();
148 bool Wait(unsigned int current_time, Cmd& cmd);
149 void Exec(Cmd& cmd);
150 void InitSel(void);
151 void Save(std::string& str);
152 void Load(const char* str);
153 void SaveSys(std::string& str);
154 void LoadSys(const char* str);
155 void SetSkipMode(SkipMode _mode);
156 void LoadSurface(const char* str, int pdt);
157
158 private:
159 void LoadSurface(const char* str);
160 void LoadSurface(void);
161 void AddSurface(const char* str);
162
163 void StartAnm(int type);
164 void StartShake(int total, const int* pattern);
165 void AbortAnm(void);
166 static bool Pressed(int x, int y, void* pointer);
167
168 GrpObj* GetGraphicObj(int grp, bool fg=true);
169 GrpObj* GetGraphicObj(int grp, int index, bool fg=true);
170 GrpObj* GetGraphicObjVarMode(Cmd& cmd, int &base_arg, bool fg=true);
171
172 // Opcode handling
173 void impl_stackClear(Cmd& cmd);
174 void impl_grpBuffer(Cmd& cmd);
175 void impl_grpMulti(Cmd &cmd);
176 void impl_grpOpen(Cmd &cmd);
177 void impl_shake(Cmd &cmd);
178 void impl_grpCopy(Cmd &cmd);
179 void impl_recFill(Cmd &cmd);
180 void impl_recCopy(Cmd &cmd);
181 void impl_recAdd(Cmd &cmd);
182 void impl_grpPan(Cmd &cmd);
183 void impl_snmPlay(Cmd &cmd);
184 void impl_snmBgScroll(Cmd &cmd);
185 void impl_cgGet(Cmd &cmd);
186 void impl_cgStatus(Cmd &cmd);
187 void impl_objClear(Cmd &cmd);
188 void impl_createObj(Cmd &cmd);
189 void impl_gan(Cmd &cmd);
190 void impl_objSetPos(Cmd &cmd);
191 void impl_objAlpha(Cmd &cmd);
192 void impl_objShow(Cmd &cmd);
193 void impl_objColour(Cmd &cmd);
194 void impl_objComposite(Cmd &cmd);
195 void impl_objSetText(Cmd &cmd);
196 void impl_objTextOpts(Cmd &cmd);
197 void impl_objOrder(Cmd &cmd);
198 void impl_objDispArea(Cmd &cmd);
199 void impl_objSetDigits(Cmd &cmd);
200 void impl_objNumOpts(Cmd &cmd);
201 void impl_objPattNo(Cmd &cmd);
202 void impl_objScale(Cmd &cmd);
203 void impl_objRotate(Cmd &cmd);
204 void impl_objPosDims(Cmd &cmd);
205 void impl_refresh(Cmd &cmd);
206 void impl_bgmLoop(Cmd &cmd);
207 void impl_bgmStop(Cmd &cmd);
208 void impl_playWav(Cmd &cmd);
209 void impl_playSE(Cmd &cmd);
210 void impl_stopWav(Cmd &cmd);
211 void impl_SetVolMod(Cmd &cmd);
212 void impl_GetVolMod(Cmd &cmd);
213 void impl_koePlay(Cmd &cmd);
214 void impl_movPlay(Cmd &cmd);
215
216 public:
217 AyuSysConfig *config;
218
219 private:
220 Event::Container& event;
221 const Flags& flags;
222 PicBase* screen;
223 PicBase* screen_front;
224 Surface* surface, *surface_update;
225
226 Surface* dsurface[MAXPDT]; // 書き込み可能な Surface
227 Surface* ssurface[MAXPDT]; // ファイルの内容等、読み込みのみ可能な状態の Surface
228 PicContainer& parent;
229
230 // 画像効果の保存用
231 WidAnmTime* anm1, *anm2;
232 typedef enum { NORMAL, WAIT_ANM, WAIT_SHAKE, WAIT_SE, WAIT_MOVIE} Status;
233 Status status;
234 SkipMode skip_mode;
235
236 std::string bg_name;
237 std::map<int, SEL> anmtype;
238 GrpObjMap grpobj;
239 GrpObjMap bs_obj;
240
241 std::map<std::string, int> cgm_info;
242 set<int>& cgm_data;
243 int cgm_size;
244
245 class MuSys *music;
246
247 std::set<int> changed_obj;
248 string reserved_load_surface0;
249 vector<PicBase*> deleted_pic;
250 };
251 /******************************************************************* 36 /*******************************************************************
252 ** GrpObj(implementation) 37 ** GrpObj(implementation)
253 */ 38 */
254 39
255 GrpObj::GrpObj(void) : 40 GrpObj::GrpObj(void) :
750 /****************************************************************** 535 /******************************************************************
751 ** 536 **
752 ** class ScnGrp* 537 ** class ScnGrp*
753 */ 538 */
754 /* Princess Bride: 背景画の一部のみ移動、の実装 */ 539 /* Princess Bride: 背景画の一部のみ移動、の実装 */
755 struct ScnGrpMove : public WidAnmTime { 540
756 Surface* dest;
757 Surface* src;
758 PicRoot& root;
759 Rect dest_r, from, to;
760 ScnGrpMove(Event::Container& container, PicBase* _pic, PicRoot& root, Surface* dest, const Rect& _dest_r, Surface* src, const Rect& from, const Rect& to, int total_time);
761 void Exec(int count);
762 };
763 ScnGrpMove::ScnGrpMove(Event::Container& container, PicBase* _pic, PicRoot& _root, Surface* _dest, const Rect& _dest_r, Surface* _src, const Rect& _from, const Rect& _to, int total_time) : 541 ScnGrpMove::ScnGrpMove(Event::Container& container, PicBase* _pic, PicRoot& _root, Surface* _dest, const Rect& _dest_r, Surface* _src, const Rect& _from, const Rect& _to, int total_time) :
764 WidAnmTime(container, _pic, total_time), 542 WidAnmTime(container, _pic, total_time),
765 dest(_dest), src(_src), root(_root),dest_r(_dest_r), from(_from), to(_to) { 543 dest(_dest), src(_src), root(_root),dest_r(_dest_r), from(_from), to(_to) {
766 int dx = to.lx - from.lx; 544 int dx = to.lx - from.lx;
767 int dy = to.ty - from.ty; 545 int dy = to.ty - from.ty;
783 iterator it; 561 iterator it;
784 for (it=pic.begin(); it!=pic.end(); it++) 562 for (it=pic.begin(); it!=pic.end(); it++)
785 (*it)->SetSurface(dest, 0, 0); 563 (*it)->SetSurface(dest, 0, 0);
786 } 564 }
787 565
788 /* Princess Bride: カードがおちるアニメーション */
789
790 struct ScnGrpAnmAtom {
791 string name;
792 int time;
793 ScnGrpAnmAtom(const char* _n, int _t) : name(_n), time(_t) {}
794 };
795
796 struct ScnGrpAnm : public WidAnmTime, vector<ScnGrpAnmAtom> {
797 GrpImpl& owner;
798 ScnGrpAnm(Event::Container& container, PicBase* _pic, GrpImpl& _owner) :
799 WidAnmTime(container, _pic, 0), owner(_owner) {
800 }
801 void CalcTotal(void);
802 void Exec(int count);
803 };
804
805 void ScnGrpAnm::CalcTotal(void) { 566 void ScnGrpAnm::CalcTotal(void) {
806 /* total time を計算 */ 567 /* total time を計算 */
807 if (empty()) return; 568 if (empty()) return;
808 int tm = 0; 569 int tm = 0;
809 vector<ScnGrpAnmAtom>::iterator it; 570 vector<ScnGrpAnmAtom>::iterator it;
823 } 584 }
824 585
825 586
826 /***************************************************** 587 /*****************************************************
827 * 588 *
828 * GrpImpl(implementation) : 定義 589 * Grp
829 * 590 *
830 */ 591 */
831 592
832 #include "music2/music.h" 593 #include "music2/music.h"
833 594
834 GrpImpl::GrpImpl(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm_data): 595 Grp::Grp(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm_data):
835 event(_event), 596 event(_event),
836 flags(f), 597 flags(f),
837 parent(_parent), 598 parent(_parent),
838 status(NORMAL), 599 status(NORMAL),
839 skip_mode(SKIP_NO), 600 skip_mode(SKIP_NO),
859 screen_front->hide(); 620 screen_front->hide();
860 screen_front->ZMove(screen); 621 screen_front->ZMove(screen);
861 622
862 LoadCgm(); 623 LoadCgm();
863 624
864 RegisterCommand(1, 30, 0, "stackClear", (CmdImpl) &GrpImpl::impl_stackClear); 625 RegisterCommand(1, 30, 0, "stackClear", (CmdImpl) &Grp::impl_stackClear);
865 RegisterCommand(1, 33, 70, "grpBuffer", (CmdImpl) &GrpImpl::impl_grpBuffer); 626 RegisterCommand(1, 33, 70, "grpBuffer", (CmdImpl) &Grp::impl_grpBuffer);
866 RegisterCommand(1, 33, 73, "grpOpenBG", (CmdImpl) &GrpImpl::impl_grpOpen); 627 RegisterCommand(1, 33, 73, "grpOpenBG", (CmdImpl) &Grp::impl_grpOpen);
867 RegisterCommand(1, 33, 75, "grpMulti", (CmdImpl) &GrpImpl::impl_grpMulti); //FIXME: or not... 628 RegisterCommand(1, 33, 75, "grpMulti", (CmdImpl) &Grp::impl_grpMulti); //FIXME: or not...
868 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &GrpImpl::impl_grpOpen); 629 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &Grp::impl_grpOpen);
869 RegisterCommand(1, 33, 32, "shake", (CmdImpl) &GrpImpl::impl_shake); 630 RegisterCommand(1, 33, 32, "shake", (CmdImpl) &Grp::impl_shake);
870 RegisterCommand(1, 33, 100, "grpCopy", (CmdImpl) &GrpImpl::impl_grpCopy); 631 RegisterCommand(1, 33, 100, "grpCopy", (CmdImpl) &Grp::impl_grpCopy);
871 RegisterCommand(1, 33, 1201, "recFill", (CmdImpl) &GrpImpl::impl_recFill); 632 RegisterCommand(1, 33, 1201, "recFill", (CmdImpl) &Grp::impl_recFill);
872 RegisterCommand(1, 33, 1100, "recCopy", (CmdImpl) &GrpImpl::impl_recCopy); 633 RegisterCommand(1, 33, 1100, "recCopy", (CmdImpl) &Grp::impl_recCopy);
873 RegisterCommand(1, 33, 1101, "recMaskCopy", NULL); //FIXME 634 RegisterCommand(1, 33, 1101, "recMaskCopy", NULL); //FIXME
874 RegisterCommand(1, 33, 1600, "recAdd", (CmdImpl) &GrpImpl::impl_recAdd); 635 RegisterCommand(1, 33, 1600, "recAdd", (CmdImpl) &Grp::impl_recAdd);
875 RegisterCommand(1, 33, 406, "grpPan", (CmdImpl) &GrpImpl::impl_grpPan); 636 RegisterCommand(1, 33, 406, "grpPan", (CmdImpl) &Grp::impl_grpPan);
876 637
877 RegisterCommand(1, 34, 3120, "snmBgScroll", (CmdImpl) &GrpImpl::impl_snmBgScroll); 638 RegisterCommand(1, 34, 3120, "snmBgScroll", (CmdImpl) &Grp::impl_snmBgScroll);
878 RegisterCommand(1, 34, 3100, "snmBgPlay", (CmdImpl) &GrpImpl::impl_snmPlay); 639 RegisterCommand(1, 34, 3100, "snmBgPlay", (CmdImpl) &Grp::impl_snmPlay);
879 RegisterCommand(1, 34, 2100, "snmPlay", (CmdImpl) &GrpImpl::impl_snmPlay); 640 RegisterCommand(1, 34, 2100, "snmPlay", (CmdImpl) &Grp::impl_snmPlay);
880 RegisterCommand(1, 34, 2101, "snmPlayEx", (CmdImpl) &GrpImpl::impl_snmPlay); 641 RegisterCommand(1, 34, 2101, "snmPlayEx", (CmdImpl) &Grp::impl_snmPlay);
881 642
882 RegisterCommand(1, 4, 1500, "cgGetTotal", (CmdImpl) &GrpImpl::impl_cgGet); 643 RegisterCommand(1, 4, 1500, "cgGetTotal", (CmdImpl) &Grp::impl_cgGet);
883 RegisterCommand(1, 4, 1501, "cgGetViewed", (CmdImpl) &GrpImpl::impl_cgGet); 644 RegisterCommand(1, 4, 1501, "cgGetViewed", (CmdImpl) &Grp::impl_cgGet);
884 RegisterCommand(1, 4, 1502, "cgGetViewedPcnt", (CmdImpl) &GrpImpl::impl_cgGet); 645 RegisterCommand(1, 4, 1502, "cgGetViewedPcnt", (CmdImpl) &Grp::impl_cgGet);
885 RegisterCommand(1, 4, 1503, "cgGetFlag", (CmdImpl) &GrpImpl::impl_cgStatus); 646 RegisterCommand(1, 4, 1503, "cgGetFlag", (CmdImpl) &Grp::impl_cgStatus);
886 RegisterCommand(1, 4, 1504, "cgStatus", (CmdImpl) &GrpImpl::impl_cgStatus); 647 RegisterCommand(1, 4, 1504, "cgStatus", (CmdImpl) &Grp::impl_cgStatus);
887 648
888 RegisterCommand(1, 4, 0x6a4, "CreateInput", NULL); 649 RegisterCommand(1, 4, 0x6a4, "CreateInput", NULL);
889 RegisterCommand(1, 4, 0x6ae, "SetInput", NULL); 650 RegisterCommand(1, 4, 0x6ae, "SetInput", NULL);
890 651
891 RegisterCommand(1, 61, 10, "objClear", (CmdImpl) &GrpImpl::impl_objClear); 652 RegisterCommand(1, 61, 10, "objClear", (CmdImpl) &Grp::impl_objClear);
892 RegisterCommand(1, 61, 11, "objDelete", (CmdImpl) &GrpImpl::impl_objClear); 653 RegisterCommand(1, 61, 11, "objDelete", (CmdImpl) &Grp::impl_objClear);
893 654
894 RegisterCommand(1, 71, 1000, "createObjG00", (CmdImpl) &GrpImpl::impl_createObj); 655 RegisterCommand(1, 71, 1000, "objOfFile", (CmdImpl) &Grp::impl_createObj);
895 RegisterCommand(1, 71, 1003, "createObjGAN", (CmdImpl) &GrpImpl::impl_createObj); 656 RegisterCommand(1, 71, 1003, "objOfFileGan", (CmdImpl) &Grp::impl_createObj);
896 RegisterCommand(1, 71, 1100, "createObjRect", (CmdImpl) &GrpImpl::impl_createObj); 657 RegisterCommand(1, 71, 1100, "objOfArea", (CmdImpl) &Grp::impl_createObj);
897 RegisterCommand(1, 71, 1200, "createObjText", (CmdImpl) &GrpImpl::impl_createObj); 658 RegisterCommand(1, 71, 1200, "objOfText", (CmdImpl) &Grp::impl_createObj);
898 RegisterCommand(1, 71, 1300, "createObjWeaver", (CmdImpl) &GrpImpl::impl_createObj); 659 RegisterCommand(1, 71, 1300, "objDriftOfFile", (CmdImpl) &Grp::impl_createObj);
899 RegisterCommand(1, 71, 1400, "createObjDigit", (CmdImpl) &GrpImpl::impl_createObj); 660 RegisterCommand(1, 71, 1400, "objOfDigits", (CmdImpl) &Grp::impl_createObj);
900 661
901 RegisterCommand(2, 71, 1000, "createSubObjG00", (CmdImpl) &GrpImpl::impl_createObj); 662 RegisterCommand(2, 71, 1000, "subObjOfFile", (CmdImpl) &Grp::impl_createObj);
902 RegisterCommand(2, 71, 1003, "createSubObjGAN", (CmdImpl) &GrpImpl::impl_createObj); 663 RegisterCommand(2, 71, 1003, "subObjOfGan", (CmdImpl) &Grp::impl_createObj);
903 RegisterCommand(2, 71, 1100, "createSubObjRect", (CmdImpl) &GrpImpl::impl_createObj); 664 RegisterCommand(2, 71, 1100, "subObjOfArea", (CmdImpl) &Grp::impl_createObj);
904 RegisterCommand(2, 71, 1200, "createSubObjText", (CmdImpl) &GrpImpl::impl_createObj); 665 RegisterCommand(2, 71, 1200, "subObjOfText", (CmdImpl) &Grp::impl_createObj);
905 RegisterCommand(2, 71, 1300, "createSubObjWeaver", (CmdImpl) &GrpImpl::impl_createObj); 666 RegisterCommand(2, 71, 1300, "subObjDriftOfFile", (CmdImpl) &Grp::impl_createObj);
906 RegisterCommand(2, 71, 1400, "createSubObjDigit", (CmdImpl) &GrpImpl::impl_createObj); 667 RegisterCommand(2, 71, 1400, "subObjOfDigits", (CmdImpl) &Grp::impl_createObj);
907 668
908 //I suppose it's the same thing as createObj*, but I didn't see it in action. For now, mark it unhandled. 669 //I suppose it's the same thing as createObj*, but I didn't see it in action. For now, mark it unhandled.
909 RegisterCommand(1, 72, 1000, "createBgObjG00", (CmdImpl) &GrpImpl::impl_createObj); 670 RegisterCommand(1, 72, 1000, "objBgOfFile", (CmdImpl) &Grp::impl_createObj);
910 RegisterCommand(1, 72, 1003, "createBgObjGAN", (CmdImpl) &GrpImpl::impl_createObj); 671 RegisterCommand(1, 72, 1003, "objBgOfFileGan", (CmdImpl) &Grp::impl_createObj);
911 RegisterCommand(1, 72, 1100, "createBgObjRect", (CmdImpl) &GrpImpl::impl_createObj); 672 RegisterCommand(1, 72, 1100, "objBgOfArea", (CmdImpl) &Grp::impl_createObj);
912 RegisterCommand(1, 72, 1200, "createBgObjText", (CmdImpl) &GrpImpl::impl_createObj); 673 RegisterCommand(1, 72, 1200, "objBgOfText", (CmdImpl) &Grp::impl_createObj);
913 RegisterCommand(1, 72, 1300, "createBgObjWeaver", (CmdImpl) &GrpImpl::impl_createObj); 674 RegisterCommand(1, 72, 1300, "objBgDriftOfFile", (CmdImpl) &Grp::impl_createObj);
914 RegisterCommand(1, 72, 1400, "createBgObjDigit", (CmdImpl) &GrpImpl::impl_createObj); 675 RegisterCommand(1, 72, 1400, "objBgOfDigits", (CmdImpl) &Grp::impl_createObj);
915 676
916 RegisterCommand(2, 72, 1000, "createBgSubObjG00", NULL);//FIXME 677 RegisterCommand(2, 72, 1000, "subObjBgOfFile", NULL);//FIXME
917 RegisterCommand(2, 72, 1003, "createBgSubObjGAN", NULL);//FIXME 678 RegisterCommand(2, 72, 1003, "subObjBgOfGan", NULL);//FIXME
918 RegisterCommand(2, 72, 1100, "createBgSubObjRect", NULL);//FIXME 679 RegisterCommand(2, 72, 1100, "subObjBgOfArea", NULL);//FIXME
919 RegisterCommand(2, 72, 1200, "createBgSubObjText", NULL);//FIXME 680 RegisterCommand(2, 72, 1200, "subObjBgOfText", NULL);//FIXME
920 RegisterCommand(2, 72, 1300, "createBgSubObjWeaver", NULL);//FIXME 681 RegisterCommand(2, 72, 1300, "subObjBgDriftOfFile", NULL);//FIXME
921 RegisterCommand(2, 72, 1400, "createBgSubObjDigit", NULL);//FIXME 682 RegisterCommand(2, 72, 1400, "subObjBgOfDigits", NULL);//FIXME;
922
923 683
924 RegisterCommand(1, 73, 0, "ganStop?", NULL); //That's what xclannad says, but I'm not sure... 684 RegisterCommand(1, 73, 0, "ganStop?", NULL); //That's what xclannad says, but I'm not sure...
925 RegisterCommand(1, 73, 1000, "ganStop", (CmdImpl) &GrpImpl::impl_gan); //That's what rldev says 685 RegisterCommand(1, 73, 1000, "ganStop", (CmdImpl) &Grp::impl_gan); //That's what rldev says
926 RegisterCommand(1, 73, 3, "ganIsPlaying", (CmdImpl) &GrpImpl::impl_gan); 686 RegisterCommand(1, 73, 3, "ganIsPlaying", (CmdImpl) &Grp::impl_gan);
927 RegisterCommand(1, 73, 2003, "objPlay", (CmdImpl) &GrpImpl::impl_gan); 687 RegisterCommand(1, 73, 2003, "objPlay", (CmdImpl) &Grp::impl_gan);
928 RegisterCommand(1, 73, 1001, "ganLoop", (CmdImpl) &GrpImpl::impl_gan); 688 RegisterCommand(1, 73, 1001, "ganLoop", (CmdImpl) &Grp::impl_gan);
929 RegisterCommand(1, 73, 1003, "ganPlay", (CmdImpl) &GrpImpl::impl_gan); 689 RegisterCommand(1, 73, 1003, "ganPlay", (CmdImpl) &Grp::impl_gan);
930 RegisterCommand(1, 73, 1005, "ganPlayOnce", (CmdImpl) &GrpImpl::impl_gan); 690 RegisterCommand(1, 73, 1005, "ganPlayOnce", (CmdImpl) &Grp::impl_gan);
931 RegisterCommand(1, 73, 3001, "ganLoop2", (CmdImpl) &GrpImpl::impl_gan); 691 RegisterCommand(1, 73, 3001, "ganLoop2", (CmdImpl) &Grp::impl_gan);
932 RegisterCommand(1, 73, 3003, "ganPlay2", (CmdImpl) &GrpImpl::impl_gan); 692 RegisterCommand(1, 73, 3003, "ganPlay2", (CmdImpl) &Grp::impl_gan);
933 RegisterCommand(1, 73, 3005, "ganPlayOnce2", (CmdImpl) &GrpImpl::impl_gan); 693 RegisterCommand(1, 73, 3005, "ganPlayOnce2", (CmdImpl) &Grp::impl_gan);
934 694
935 RegisterCommand(2, 73, 0, "ganSubStop?", NULL); //FIXME 695 RegisterCommand(2, 73, 0, "ganSubStop?", NULL); //FIXME
936 RegisterCommand(2, 73, 1000, "ganSubStop", NULL); //FIXME 696 RegisterCommand(2, 73, 1000, "ganSubStop", NULL); //FIXME
937 RegisterCommand(2, 73, 3, "ganSubIsPlaying", NULL); //FIXME 697 RegisterCommand(2, 73, 3, "ganSubIsPlaying", NULL); //FIXME
938 RegisterCommand(2, 73, 2003, "objSubPlay", NULL); //FIXME 698 RegisterCommand(2, 73, 2003, "objSubPlay", NULL); //FIXME
939 RegisterCommand(2, 73, 1001, "ganSubLoop", NULL); //FIXME 699 RegisterCommand(2, 73, 1001, "ganSubLoop", NULL); //FIXME
940 RegisterCommand(2, 73, 1003, "ganSubPlay", NULL); //FIXME 700 RegisterCommand(2, 73, 1003, "ganSubPlay", NULL); //FIXME
941 RegisterCommand(2, 73, 1005, "ganSubPlayOnce", NULL); //FIXME 701 RegisterCommand(2, 73, 1005, "ganSubPlayOnce", NULL); //FIXME
942 RegisterCommand(2, 73, 3001, "ganSubLoop2", (CmdImpl) &GrpImpl::impl_gan); //FIXME 702 RegisterCommand(2, 73, 3001, "ganSubLoop2", (CmdImpl) &Grp::impl_gan); //FIXME
943 RegisterCommand(2, 73, 3003, "ganSubPlay2", NULL); //FIXME 703 RegisterCommand(2, 73, 3003, "ganSubPlay2", NULL); //FIXME
944 RegisterCommand(2, 73, 3005, "ganSubPlayOnce2", NULL); //FIXME 704 RegisterCommand(2, 73, 3005, "ganSubPlayOnce2", NULL); //FIXME
945 705
946 706
947 RegisterCommand(1, 81, 1000, "objMove", (CmdImpl) &GrpImpl::impl_objSetPos); 707 RegisterCommand(1, 81, 1000, "objMove", (CmdImpl) &Grp::impl_objSetPos);
948 RegisterCommand(1, 82, 1000, "objBgMove", (CmdImpl) &GrpImpl::impl_objSetPos); 708 RegisterCommand(1, 82, 1000, "objBgMove", (CmdImpl) &Grp::impl_objSetPos);
949 RegisterCommand(1, 81, 1001, "objLeft", (CmdImpl) &GrpImpl::impl_objSetPos); 709 RegisterCommand(1, 81, 1001, "objLeft", (CmdImpl) &Grp::impl_objSetPos);
950 RegisterCommand(1, 82, 1001, "objBgLeft", (CmdImpl) &GrpImpl::impl_objSetPos); 710 RegisterCommand(1, 82, 1001, "objBgLeft", (CmdImpl) &Grp::impl_objSetPos);
951 RegisterCommand(1, 81, 1002, "objTop", (CmdImpl) &GrpImpl::impl_objSetPos); 711 RegisterCommand(1, 81, 1002, "objTop", (CmdImpl) &Grp::impl_objSetPos);
952 RegisterCommand(1, 82, 1002, "objBgTop", (CmdImpl) &GrpImpl::impl_objSetPos); 712 RegisterCommand(1, 82, 1002, "objBgTop", (CmdImpl) &Grp::impl_objSetPos);
953 RegisterCommand(1, 81, 1003, "objAlpha", (CmdImpl) &GrpImpl::impl_objAlpha); 713 RegisterCommand(1, 81, 1003, "objAlpha", (CmdImpl) &Grp::impl_objAlpha);
954 RegisterCommand(1, 82, 1003, "objBgAlpha", (CmdImpl) &GrpImpl::impl_objAlpha); 714 RegisterCommand(1, 82, 1003, "objBgAlpha", (CmdImpl) &Grp::impl_objAlpha);
955 RegisterCommand(1, 81, 1004, "objShow", (CmdImpl) &GrpImpl::impl_objShow); 715 RegisterCommand(1, 81, 1004, "objShow", (CmdImpl) &Grp::impl_objShow);
956 RegisterCommand(1, 82, 1004, "objBgShow", (CmdImpl) &GrpImpl::impl_objShow); 716 RegisterCommand(1, 82, 1004, "objBgShow", (CmdImpl) &Grp::impl_objShow);
957 RegisterCommand(1, 81, 1005, "objDispArea", NULL); 717 RegisterCommand(1, 81, 1005, "objDispArea", NULL);
958 RegisterCommand(1, 82, 1005, "objBgDispArea", NULL); 718 RegisterCommand(1, 82, 1005, "objBgDispArea", NULL);
959 RegisterCommand(1, 81, 1006, "objAdjust", (CmdImpl) &GrpImpl::impl_objSetPos); 719 RegisterCommand(1, 81, 1006, "objAdjust", (CmdImpl) &Grp::impl_objSetPos);
960 RegisterCommand(1, 82, 1006, "objBgAdjust", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objSetPos); 720 RegisterCommand(1, 82, 1006, "objBgAdjust", NULL); //FIXME: (CmdImpl) &Grp::impl_objSetPos);
961 RegisterCommand(1, 81, 1007, "objAdjustX", NULL); 721 RegisterCommand(1, 81, 1007, "objAdjustX", NULL);
962 RegisterCommand(1, 82, 1007, "objBgAdjustX", NULL); 722 RegisterCommand(1, 82, 1007, "objBgAdjustX", NULL);
963 RegisterCommand(1, 81, 1008, "objAdjustY", NULL); 723 RegisterCommand(1, 81, 1008, "objAdjustY", NULL);
964 RegisterCommand(1, 82, 1008, "objBgAdjustY", NULL); 724 RegisterCommand(1, 82, 1008, "objBgAdjustY", NULL);
965 RegisterCommand(1, 81, 2006, "objAdjust2?", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objSetPos); I don't know if it is usefull or properly implemented 725 RegisterCommand(1, 81, 2006, "objAdjust2?", NULL); //FIXME: (CmdImpl) &Grp::impl_objSetPos); I don't know if it is usefull or properly implemented
966 RegisterCommand(1, 82, 2006, "objBgAdjust2?", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objSetPos); See above 726 RegisterCommand(1, 82, 2006, "objBgAdjust2?", NULL); //FIXME: (CmdImpl) &Grp::impl_objSetPos); See above
967 RegisterCommand(1, 81, 1016, "objColour", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objColour); 727 RegisterCommand(1, 81, 1016, "objColour", NULL); //FIXME: (CmdImpl) &Grp::impl_objColour);
968 RegisterCommand(1, 82, 1016, "objBgColour", NULL); //FIXME: (CmdImpl) &GrpImpl::impl_objColour); 728 RegisterCommand(1, 82, 1016, "objBgColour", NULL); //FIXME: (CmdImpl) &Grp::impl_objColour);
969 RegisterCommand(1, 81, 1017, "objColR", NULL); 729 RegisterCommand(1, 81, 1017, "objColR", NULL);
970 RegisterCommand(1, 82, 1017, "objBgColR", NULL); 730 RegisterCommand(1, 82, 1017, "objBgColR", NULL);
971 RegisterCommand(1, 81, 1018, "objColG", NULL); 731 RegisterCommand(1, 81, 1018, "objColG", NULL);
972 RegisterCommand(1, 82, 1018, "objBgColG", NULL); 732 RegisterCommand(1, 82, 1018, "objBgColG", NULL);
973 RegisterCommand(1, 81, 1019, "objColB", NULL); 733 RegisterCommand(1, 81, 1019, "objColB", NULL);
974 RegisterCommand(1, 82, 1019, "objBgColB", NULL); 734 RegisterCommand(1, 82, 1019, "objBgColB", NULL);
975 RegisterCommand(1, 81, 1020, "objColLevel", NULL); 735 RegisterCommand(1, 81, 1020, "objColLevel", NULL);
976 RegisterCommand(1, 82, 1020, "objBgColLevel", NULL); 736 RegisterCommand(1, 82, 1020, "objBgColLevel", NULL);
977 RegisterCommand(1, 81, 1021, "objComposite", NULL);//(CmdImpl) &GrpImpl::impl_objComposite); //FIXME: May be broken 737 RegisterCommand(1, 81, 1021, "objComposite", NULL);//(CmdImpl) &Grp::impl_objComposite); //FIXME: May be broken
978 RegisterCommand(1, 82, 1021, "objBgComposite", (CmdImpl) &GrpImpl::impl_objComposite); 738 RegisterCommand(1, 82, 1021, "objBgComposite", (CmdImpl) &Grp::impl_objComposite);
979 RegisterCommand(1, 81, 1024, "objSetText", (CmdImpl) &GrpImpl::impl_objSetText); 739 RegisterCommand(1, 81, 1024, "objSetText", (CmdImpl) &Grp::impl_objSetText);
980 RegisterCommand(1, 82, 1024, "objBgSetText", (CmdImpl) &GrpImpl::impl_objSetText); 740 RegisterCommand(1, 82, 1024, "objBgSetText", (CmdImpl) &Grp::impl_objSetText);
981 RegisterCommand(1, 81, 1025, "objTextOpts", (CmdImpl) &GrpImpl::impl_objTextOpts); //FIXME: Incomplete 741 RegisterCommand(1, 81, 1025, "objTextOpts", (CmdImpl) &Grp::impl_objTextOpts); //FIXME: Incomplete
982 RegisterCommand(1, 82, 1025, "objBgTextOpts", (CmdImpl) &GrpImpl::impl_objTextOpts); 742 RegisterCommand(1, 82, 1025, "objBgTextOpts", (CmdImpl) &Grp::impl_objTextOpts);
983 RegisterCommand(1, 81, 1032, "objOrder", (CmdImpl) &GrpImpl::impl_objOrder); 743 RegisterCommand(1, 81, 1032, "objOrder", (CmdImpl) &Grp::impl_objOrder);
984 RegisterCommand(1, 82, 1032, "objBgOrder", (CmdImpl) &GrpImpl::impl_objOrder); 744 RegisterCommand(1, 82, 1032, "objBgOrder", (CmdImpl) &Grp::impl_objOrder);
985 RegisterCommand(1, 81, 1034, "objDispRect", (CmdImpl) &GrpImpl::impl_objDispArea); 745 RegisterCommand(1, 81, 1034, "objDispRect", (CmdImpl) &Grp::impl_objDispArea);
986 RegisterCommand(1, 82, 1034, "objBgDispRect", (CmdImpl) &GrpImpl::impl_objDispArea); 746 RegisterCommand(1, 82, 1034, "objBgDispRect", (CmdImpl) &Grp::impl_objDispArea);
987 RegisterCommand(1, 81, 1037, "objSetDigits", (CmdImpl) &GrpImpl::impl_objSetDigits); 747 RegisterCommand(1, 81, 1037, "objSetDigits", (CmdImpl) &Grp::impl_objSetDigits);
988 RegisterCommand(1, 82, 1037, "objBgSetDigits", (CmdImpl) &GrpImpl::impl_objSetDigits); 748 RegisterCommand(1, 82, 1037, "objBgSetDigits", (CmdImpl) &Grp::impl_objSetDigits);
989 RegisterCommand(1, 81, 1038, "objNumOpts", (CmdImpl) &GrpImpl::impl_objNumOpts); 749 RegisterCommand(1, 81, 1038, "objNumOpts", (CmdImpl) &Grp::impl_objNumOpts);
990 RegisterCommand(1, 82, 1038, "objBgNumOpts", (CmdImpl) &GrpImpl::impl_objNumOpts); 750 RegisterCommand(1, 82, 1038, "objBgNumOpts", (CmdImpl) &Grp::impl_objNumOpts);
991 RegisterCommand(1, 81, 1039, "objPattNo", (CmdImpl) &GrpImpl::impl_objPattNo); 751 RegisterCommand(1, 81, 1039, "objPattNo", (CmdImpl) &Grp::impl_objPattNo);
992 RegisterCommand(1, 82, 1039, "objBgPattNo", (CmdImpl) &GrpImpl::impl_objPattNo); 752 RegisterCommand(1, 82, 1039, "objBgPattNo", (CmdImpl) &Grp::impl_objPattNo);
993 RegisterCommand(1, 81, 1046, "objScale", (CmdImpl) &GrpImpl::impl_objScale); //FIXME: Broken behaviour 753 RegisterCommand(1, 81, 1046, "objScale", (CmdImpl) &Grp::impl_objScale); //FIXME: Broken behaviour
994 RegisterCommand(1, 82, 1046, "objBgScale", (CmdImpl) &GrpImpl::impl_objScale); 754 RegisterCommand(1, 82, 1046, "objBgScale", (CmdImpl) &Grp::impl_objScale);
995 RegisterCommand(1, 81, 1047, "objWidth", NULL); 755 RegisterCommand(1, 81, 1047, "objWidth", NULL);
996 RegisterCommand(1, 82, 1047, "objBgWidth", NULL); 756 RegisterCommand(1, 82, 1047, "objBgWidth", NULL);
997 RegisterCommand(1, 81, 1049, "objRotate", (CmdImpl) &GrpImpl::impl_objRotate); 757 RegisterCommand(1, 81, 1049, "objRotate", (CmdImpl) &Grp::impl_objRotate);
998 RegisterCommand(1, 82, 1049, "objBgRotate", (CmdImpl) &GrpImpl::impl_objRotate); 758 RegisterCommand(1, 82, 1049, "objBgRotate", (CmdImpl) &Grp::impl_objRotate);
999 759
1000 RegisterCommand(2, 81, 1000, "childObjMove", (CmdImpl) &GrpImpl::impl_objSetPos); 760 RegisterCommand(2, 81, 1000, "childObjMove", (CmdImpl) &Grp::impl_objSetPos);
1001 RegisterCommand(2, 82, 1000, "childObjBgMove", (CmdImpl) &GrpImpl::impl_objSetPos); 761 RegisterCommand(2, 82, 1000, "childObjBgMove", (CmdImpl) &Grp::impl_objSetPos);
1002 RegisterCommand(2, 81, 1001, "childObjLeft", NULL); 762 RegisterCommand(2, 81, 1001, "childObjLeft", NULL);
1003 RegisterCommand(2, 82, 1001, "childObjBgLeft", NULL); 763 RegisterCommand(2, 82, 1001, "childObjBgLeft", NULL);
1004 RegisterCommand(2, 81, 1002, "childObjTop", NULL); 764 RegisterCommand(2, 81, 1002, "childObjTop", NULL);
1005 RegisterCommand(2, 82, 1002, "childObjBgTop", NULL); 765 RegisterCommand(2, 82, 1002, "childObjBgTop", NULL);
1006 RegisterCommand(2, 81, 1003, "childObjAlpha", (CmdImpl) &GrpImpl::impl_objAlpha); 766 RegisterCommand(2, 81, 1003, "childObjAlpha", (CmdImpl) &Grp::impl_objAlpha);
1007 RegisterCommand(2, 82, 1003, "childObjBgAlpha", (CmdImpl) &GrpImpl::impl_objAlpha); 767 RegisterCommand(2, 82, 1003, "childObjBgAlpha", (CmdImpl) &Grp::impl_objAlpha);
1008 RegisterCommand(2, 81, 1004, "childObjShow", (CmdImpl) &GrpImpl::impl_objShow); 768 RegisterCommand(2, 81, 1004, "childObjShow", (CmdImpl) &Grp::impl_objShow);
1009 RegisterCommand(2, 82, 1004, "childObjBgShow", (CmdImpl) &GrpImpl::impl_objShow); 769 RegisterCommand(2, 82, 1004, "childObjBgShow", (CmdImpl) &Grp::impl_objShow);
1010 RegisterCommand(2, 81, 1005, "childObjDispArea", NULL); 770 RegisterCommand(2, 81, 1005, "childObjDispArea", NULL);
1011 RegisterCommand(2, 82, 1005, "childObjBgDispArea", NULL); 771 RegisterCommand(2, 82, 1005, "childObjBgDispArea", NULL);
1012 RegisterCommand(2, 81, 1006, "childObjAdjust", (CmdImpl) &GrpImpl::impl_objSetPos); 772 RegisterCommand(2, 81, 1006, "childObjAdjust", (CmdImpl) &Grp::impl_objSetPos);
1013 RegisterCommand(2, 82, 1006, "childObjBgAdjust", (CmdImpl) &GrpImpl::impl_objSetPos); 773 RegisterCommand(2, 82, 1006, "childObjBgAdjust", (CmdImpl) &Grp::impl_objSetPos);
1014 RegisterCommand(2, 81, 1007, "childObjAdjustX", NULL); 774 RegisterCommand(2, 81, 1007, "childObjAdjustX", NULL);
1015 RegisterCommand(2, 82, 1007, "childObjBgAdjustX", NULL); 775 RegisterCommand(2, 82, 1007, "childObjBgAdjustX", NULL);
1016 RegisterCommand(2, 81, 1008, "childObjAdjustY", NULL); 776 RegisterCommand(2, 81, 1008, "childObjAdjustY", NULL);
1017 RegisterCommand(2, 82, 1008, "childObjBgAdjustY", NULL); 777 RegisterCommand(2, 82, 1008, "childObjBgAdjustY", NULL);
1018 RegisterCommand(2, 81, 2006, "childObjAdjust2?", NULL); 778 RegisterCommand(2, 81, 2006, "childObjAdjust2?", NULL);
1027 RegisterCommand(2, 82, 1019, "childObjBgColB", NULL); 787 RegisterCommand(2, 82, 1019, "childObjBgColB", NULL);
1028 RegisterCommand(2, 81, 1020, "childObjColLevel", NULL); 788 RegisterCommand(2, 81, 1020, "childObjColLevel", NULL);
1029 RegisterCommand(2, 82, 1020, "childObjBgColLevel", NULL); 789 RegisterCommand(2, 82, 1020, "childObjBgColLevel", NULL);
1030 RegisterCommand(2, 81, 1021, "childObjComposite", NULL); 790 RegisterCommand(2, 81, 1021, "childObjComposite", NULL);
1031 RegisterCommand(2, 82, 1021, "childObjBgComposite", NULL); 791 RegisterCommand(2, 82, 1021, "childObjBgComposite", NULL);
1032 RegisterCommand(2, 81, 1024, "childObjSetText", (CmdImpl) &GrpImpl::impl_objSetText); 792 RegisterCommand(2, 81, 1024, "childObjSetText", (CmdImpl) &Grp::impl_objSetText);
1033 RegisterCommand(2, 82, 1024, "childObjBgSetText", (CmdImpl) &GrpImpl::impl_objSetText); 793 RegisterCommand(2, 82, 1024, "childObjBgSetText", (CmdImpl) &Grp::impl_objSetText);
1034 RegisterCommand(2, 81, 1025, "childObjTextOpts", (CmdImpl) &GrpImpl::impl_objTextOpts); 794 RegisterCommand(2, 81, 1025, "childObjTextOpts", (CmdImpl) &Grp::impl_objTextOpts);
1035 RegisterCommand(2, 82, 1025, "childObjBgTextOpts", (CmdImpl) &GrpImpl::impl_objTextOpts); 795 RegisterCommand(2, 82, 1025, "childObjBgTextOpts", (CmdImpl) &Grp::impl_objTextOpts);
1036 RegisterCommand(2, 81, 1032, "childObjOrder", NULL); 796 RegisterCommand(2, 81, 1032, "childObjOrder", NULL);
1037 RegisterCommand(2, 82, 1032, "childObjBgOrder", NULL); 797 RegisterCommand(2, 82, 1032, "childObjBgOrder", NULL);
1038 RegisterCommand(2, 81, 1034, "childObjDispRect", NULL); 798 RegisterCommand(2, 81, 1034, "childObjDispRect", NULL);
1039 RegisterCommand(2, 82, 1034, "childObjBgDispRect", NULL); 799 RegisterCommand(2, 82, 1034, "childObjBgDispRect", NULL);
1040 RegisterCommand(2, 81, 1037, "childObjSetDigits", (CmdImpl) &GrpImpl::impl_objSetDigits); 800 RegisterCommand(2, 81, 1037, "childObjSetDigits", (CmdImpl) &Grp::impl_objSetDigits);
1041 RegisterCommand(2, 82, 1037, "childObjBgSetDigits", (CmdImpl) &GrpImpl::impl_objSetDigits); 801 RegisterCommand(2, 82, 1037, "childObjBgSetDigits", (CmdImpl) &Grp::impl_objSetDigits);
1042 RegisterCommand(2, 81, 1038, "childObjNumOpts", (CmdImpl) &GrpImpl::impl_objNumOpts); 802 RegisterCommand(2, 81, 1038, "childObjNumOpts", (CmdImpl) &Grp::impl_objNumOpts);
1043 RegisterCommand(2, 82, 1038, "childObjBgNumOpts", (CmdImpl) &GrpImpl::impl_objNumOpts); 803 RegisterCommand(2, 82, 1038, "childObjBgNumOpts", (CmdImpl) &Grp::impl_objNumOpts);
1044 RegisterCommand(2, 81, 1039, "childObjPattNo", (CmdImpl) &GrpImpl::impl_objPattNo); 804 RegisterCommand(2, 81, 1039, "childObjPattNo", (CmdImpl) &Grp::impl_objPattNo);
1045 RegisterCommand(2, 82, 1039, "childObjBgPattNo", (CmdImpl) &GrpImpl::impl_objPattNo); 805 RegisterCommand(2, 82, 1039, "childObjBgPattNo", (CmdImpl) &Grp::impl_objPattNo);
1046 RegisterCommand(2, 81, 1046, "childObjScale", (CmdImpl) &GrpImpl::impl_objScale); 806 RegisterCommand(2, 81, 1046, "childObjScale", (CmdImpl) &Grp::impl_objScale);
1047 RegisterCommand(2, 82, 1046, "childObjBgScale", (CmdImpl) &GrpImpl::impl_objScale); 807 RegisterCommand(2, 82, 1046, "childObjBgScale", (CmdImpl) &Grp::impl_objScale);
1048 RegisterCommand(2, 81, 1047, "childObjWidth", NULL); 808 RegisterCommand(2, 81, 1047, "childObjWidth", NULL);
1049 RegisterCommand(2, 82, 1047, "childObjBgWidth", NULL); 809 RegisterCommand(2, 82, 1047, "childObjBgWidth", NULL);
1050 RegisterCommand(2, 81, 1049, "childObjRotate", NULL); 810 RegisterCommand(2, 81, 1049, "childObjRotate", NULL);
1051 RegisterCommand(2, 82, 1049, "childObjBgRotate", NULL); 811 RegisterCommand(2, 82, 1049, "childObjBgRotate", NULL);
1052 812
1053 RegisterCommand(1, 84, 1000, "objGetPos", (CmdImpl) &GrpImpl::impl_objPosDims); 813 RegisterCommand(1, 84, 1000, "objGetPos", (CmdImpl) &Grp::impl_objPosDims);
1054 RegisterCommand(1, 84, 1100, "objGetDims", (CmdImpl) &GrpImpl::impl_objPosDims); 814 RegisterCommand(1, 84, 1100, "objGetDims", (CmdImpl) &Grp::impl_objPosDims);
1055 815
1056 RegisterCommand(2, 84, 1000, "childObjGetPos", (CmdImpl) &GrpImpl::impl_objPosDims); 816 RegisterCommand(2, 84, 1000, "childObjGetPos", (CmdImpl) &Grp::impl_objPosDims);
1057 RegisterCommand(2, 84, 1100, "childObjGetDims", (CmdImpl) &GrpImpl::impl_objPosDims); 817 RegisterCommand(2, 84, 1100, "childObjGetDims", (CmdImpl) &Grp::impl_objPosDims);
1058 818
1059 RegisterCommand(1, 31, 0, "refresh", (CmdImpl) &GrpImpl::impl_refresh); 819 RegisterCommand(1, 31, 0, "refresh", (CmdImpl) &Grp::impl_refresh);
1060 820
1061 RegisterCommand(1, 20, 0, "bgmLoop", (CmdImpl) &GrpImpl::impl_bgmLoop); 821 RegisterCommand(1, 20, 0, "bgmLoop", (CmdImpl) &Grp::impl_bgmLoop);
1062 RegisterCommand(1, 20, 1, "bgmPlayEx", (CmdImpl) &GrpImpl::impl_bgmLoop); //FIXME: wait 822 RegisterCommand(1, 20, 1, "bgmPlayEx", (CmdImpl) &Grp::impl_bgmLoop); //FIXME: wait
1063 RegisterCommand(1, 20, 2, "bgmPlay", (CmdImpl) &GrpImpl::impl_bgmLoop); 823 RegisterCommand(1, 20, 2, "bgmPlay", (CmdImpl) &Grp::impl_bgmLoop);
1064 RegisterCommand(1, 20, 5, "bgmStop", (CmdImpl) &GrpImpl::impl_bgmStop); 824 RegisterCommand(1, 20, 5, "bgmStop", (CmdImpl) &Grp::impl_bgmStop);
1065 RegisterCommand(1, 20, 105, "bgmFadeOut", (CmdImpl) &GrpImpl::impl_bgmStop); 825 RegisterCommand(1, 20, 105, "bgmFadeOut", (CmdImpl) &Grp::impl_bgmStop);
1066 826
1067 RegisterCommand(1, 21, 0, "wavPlay", (CmdImpl) &GrpImpl::impl_playWav); 827 RegisterCommand(1, 21, 0, "wavPlay", (CmdImpl) &Grp::impl_playWav);
1068 RegisterCommand(1, 21, 1, "wavPlayEx", (CmdImpl) &GrpImpl::impl_playWav); 828 RegisterCommand(1, 21, 1, "wavPlayEx", (CmdImpl) &Grp::impl_playWav);
1069 RegisterCommand(1, 21, 2, "wavLoop", (CmdImpl) &GrpImpl::impl_playWav); 829 RegisterCommand(1, 21, 2, "wavLoop", (CmdImpl) &Grp::impl_playWav);
1070 RegisterCommand(1, 21, 3, "wavWait", NULL); 830 RegisterCommand(1, 21, 3, "wavWait", NULL);
1071 RegisterCommand(1, 21, 4, "wavPlaying", NULL); 831 RegisterCommand(1, 21, 4, "wavPlaying", NULL);
1072 RegisterCommand(1, 21, 5, "wavStop", (CmdImpl) &GrpImpl::impl_stopWav); 832 RegisterCommand(1, 21, 5, "wavStop", (CmdImpl) &Grp::impl_stopWav);
1073 RegisterCommand(1, 21, 105, "wavFadeout", (CmdImpl) &GrpImpl::impl_stopWav); 833 RegisterCommand(1, 21, 105, "wavFadeout", (CmdImpl) &Grp::impl_stopWav);
1074 834
1075 RegisterCommand(1, 22, 0, "sePlay", (CmdImpl) &GrpImpl::impl_playSE); 835 RegisterCommand(1, 22, 0, "sePlay", (CmdImpl) &Grp::impl_playSE);
1076 836
1077 RegisterCommand(1, 4, 2230, "SetBgmVolMod", (CmdImpl) &GrpImpl::impl_SetVolMod); 837 RegisterCommand(1, 4, 2230, "SetBgmVolMod", (CmdImpl) &Grp::impl_SetVolMod);
1078 RegisterCommand(1, 4, 2231, "SetKoeVolMod", (CmdImpl) &GrpImpl::impl_SetVolMod); 838 RegisterCommand(1, 4, 2231, "SetKoeVolMod", (CmdImpl) &Grp::impl_SetVolMod);
1079 RegisterCommand(1, 4, 2232, "SetPCMVolMod", (CmdImpl) &GrpImpl::impl_SetVolMod); 839 RegisterCommand(1, 4, 2232, "SetPCMVolMod", (CmdImpl) &Grp::impl_SetVolMod);
1080 RegisterCommand(1, 4, 2233, "SetSeVolMod", (CmdImpl) &GrpImpl::impl_SetVolMod); 840 RegisterCommand(1, 4, 2233, "SetSeVolMod", (CmdImpl) &Grp::impl_SetVolMod);
1081 RegisterCommand(1, 4, 2330, "BgmVolMod", (CmdImpl) &GrpImpl::impl_GetVolMod); 841 RegisterCommand(1, 4, 2330, "BgmVolMod", (CmdImpl) &Grp::impl_GetVolMod);
1082 RegisterCommand(1, 4, 2331, "KoeVolMod", (CmdImpl) &GrpImpl::impl_GetVolMod); 842 RegisterCommand(1, 4, 2331, "KoeVolMod", (CmdImpl) &Grp::impl_GetVolMod);
1083 RegisterCommand(1, 4, 2332, "PCMVolMod", (CmdImpl) &GrpImpl::impl_GetVolMod); 843 RegisterCommand(1, 4, 2332, "PCMVolMod", (CmdImpl) &Grp::impl_GetVolMod);
1084 RegisterCommand(1, 4, 2333, "SeVolMod", (CmdImpl) &GrpImpl::impl_GetVolMod); 844 RegisterCommand(1, 4, 2333, "SeVolMod", (CmdImpl) &Grp::impl_GetVolMod);
1085 845
1086 RegisterCommand(1, 23, 0, "koePlay", (CmdImpl) &GrpImpl::impl_koePlay); 846 RegisterCommand(1, 23, 0, "koePlay", (CmdImpl) &Grp::impl_koePlay);
1087 RegisterCommand(1, 23, 1, "koePlayEx", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME 847 RegisterCommand(1, 23, 1, "koePlayEx", (CmdImpl) &Grp::impl_koePlay); //FIXME
1088 RegisterCommand(1, 23, 7, "koePlayExC", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME 848 RegisterCommand(1, 23, 7, "koePlayExC", (CmdImpl) &Grp::impl_koePlay); //FIXME
1089 RegisterCommand(1, 23, 8, "koeDoPlay", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME 849 RegisterCommand(1, 23, 8, "koeDoPlay", (CmdImpl) &Grp::impl_koePlay); //FIXME
1090 RegisterCommand(1, 23, 9, "koeDoPlayEx", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME 850 RegisterCommand(1, 23, 9, "koeDoPlayEx", (CmdImpl) &Grp::impl_koePlay); //FIXME
1091 RegisterCommand(1, 23, 10, "koeDoPlayExC", (CmdImpl) &GrpImpl::impl_koePlay); //FIXME 851 RegisterCommand(1, 23, 10, "koeDoPlayExC", (CmdImpl) &Grp::impl_koePlay); //FIXME
1092 852
1093 RegisterCommand(1, 26, 1, "movPlayEx", (CmdImpl) &GrpImpl::impl_movPlay); 853 RegisterCommand(1, 26, 1, "movPlayEx", (CmdImpl) &Grp::impl_movPlay);
1094 RegisterCommand(1, 26, 20, "movPlayExC", (CmdImpl) &GrpImpl::impl_movPlay); 854 RegisterCommand(1, 26, 20, "movPlayExC", (CmdImpl) &Grp::impl_movPlay);
1095 855
1096 RegisterCommand(1, 61, 14, "objSwap?", NULL); 856 RegisterCommand(1, 61, 14, "objSwap?", NULL);
1097 RegisterCommand(1, 62, 14, "objSwap?", NULL); 857 RegisterCommand(1, 62, 14, "objSwap?", NULL);
1098 858
1099 RegisterCommand(1, 4, 1211, "EnableSyscom", NULL); 859 RegisterCommand(1, 4, 1211, "EnableSyscom", NULL);
1102 862
1103 anm1 = NULL; 863 anm1 = NULL;
1104 anm2 = NULL; 864 anm2 = NULL;
1105 } 865 }
1106 866
1107 GrpImpl::~GrpImpl() { 867 Grp::~Grp() {
1108
1109 map<int,GrpObj>::iterator it; 868 map<int,GrpObj>::iterator it;
1110 for (it=grpobj.begin(); it!=grpobj.end(); it++) { 869 for (it=grpobj.begin(); it!=grpobj.end(); it++) {
1111 PicBase* p = it->second.DeletePic(); 870 PicBase* p = it->second.DeletePic();
1112 delete p; 871 delete p;
1113 } 872 }
1121 if (ssurface[i]) parent.Root().DeleteSurface(ssurface[i]); 880 if (ssurface[i]) parent.Root().DeleteSurface(ssurface[i]);
1122 if (dsurface[i]) parent.Root().DeleteSurface(dsurface[i]); 881 if (dsurface[i]) parent.Root().DeleteSurface(dsurface[i]);
1123 } 882 }
1124 } 883 }
1125 884
1126 Surface* GrpImpl::Dsurface(int pdt) { 885 Surface* Grp::Dsurface(int pdt) {
1127 if (pdt == 0) return surface; 886 if (pdt == 0) return surface;
1128 if (dsurface[pdt] == 0) { // とりあえず画面の大きさということにする 887 if (dsurface[pdt] == 0) { // とりあえず画面の大きさということにする
1129 if (pdt == WORKPDT) 888 if (pdt == WORKPDT)
1130 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), ALPHA_MASK); 889 dsurface[pdt] = parent.Root().NewSurface(parent.Width(), parent.Height(), ALPHA_MASK);
1131 else 890 else
1137 ssurface[pdt] = 0; 896 ssurface[pdt] = 0;
1138 } 897 }
1139 return dsurface[pdt]; 898 return dsurface[pdt];
1140 } 899 }
1141 900
1142 GrpObj* GrpImpl::GetGraphicObj(int grp, bool fg) { 901 GrpObj* Grp::GetGraphicObj(int grp, bool fg) {
1143 if (fg) 902 if (fg)
1144 return &grpobj[grp]; 903 return &grpobj[grp];
1145 else 904 else
1146 return &bs_obj[grp]; 905 return &bs_obj[grp];
1147 } 906 }
1148 907
1149 GrpObj* GrpImpl::GetGraphicObj(int grp, int index, bool fg) { 908 GrpObj* Grp::GetGraphicObj(int grp, int index, bool fg) {
1150 GrpObj* g = GetGraphicObj(grp, fg); 909 GrpObj* g = GetGraphicObj(grp, fg);
1151 return &g->children_obj[index]; 910 return &g->children_obj[index];
1152 } 911 }
1153 912
1154 GrpObj* GrpImpl::GetGraphicObjVarMode(Cmd& cmd, int &base_arg, bool fg) { 913 GrpObj* Grp::GetGraphicObjVarMode(Cmd& cmd, int &base_arg, bool fg) {
1155 GrpObj* g; 914 GrpObj* g;
1156 if (cmd.cmd1 == 2) { 915 if (cmd.cmd1 == 2) {
1157 g = GetGraphicObj(cmd.args[base_arg].value, cmd.args[base_arg+1].value, fg); 916 g = GetGraphicObj(cmd.args[base_arg].value, cmd.args[base_arg+1].value, fg);
1158 base_arg += 1; 917 base_arg += 1;
1159 } 918 }
1161 g = GetGraphicObj(cmd.args[base_arg].value, fg); 920 g = GetGraphicObj(cmd.args[base_arg].value, fg);
1162 return g; 921 return g;
1163 } 922 }
1164 923
1165 #include <SDL.h> 924 #include <SDL.h>
1166 Surface* GrpImpl::Ssurface(int pdt) { 925 Surface* Grp::Ssurface(int pdt) {
1167 if (pdt == 0) return surface; 926 if (pdt == 0) return surface;
1168 if (ssurface[pdt]) { 927 if (ssurface[pdt]) {
1169 return ssurface[pdt]; 928 return ssurface[pdt];
1170 } 929 }
1171 return Dsurface(pdt); 930 return Dsurface(pdt);
1172 } 931 }
1173 932
1174 void GrpImpl::LoadSurface(const char* str, int pdt) { 933 void Grp::LoadSurface(const char* str, int pdt) {
1175 string s = str; 934 string s = str;
1176 if (cgm_info.find(s) != cgm_info.end()) { 935 if (cgm_info.find(s) != cgm_info.end()) {
1177 cgm_data.insert(cgm_info[s]); 936 cgm_data.insert(cgm_info[s]);
1178 } 937 }
1179 Surface* bg = parent.Root().NewSurface(s.c_str()); 938 Surface* bg = parent.Root().NewSurface(s.c_str());
1199 if (str[0] != 0) 958 if (str[0] != 0)
1200 fprintf(stderr,"Cannot find surface %d <- '%s'\n",pdt,str); 959 fprintf(stderr,"Cannot find surface %d <- '%s'\n",pdt,str);
1201 } 960 }
1202 } 961 }
1203 962
1204 void GrpImpl::InitSel(void) { 963 void Grp::InitSel(void) {
1205 int i; 964 int i;
1206 int args[16]; 965 int args[16];
1207 char key[10]; 966 char key[10];
1208 for (i=0; i<999; i++) { 967 for (i=0; i<999; i++) {
1209 sprintf(key, "#SEL.%03d",i); 968 sprintf(key, "#SEL.%03d",i);
1226 int j; 985 int j;
1227 for (j=0; j<8; j++) s.args[j] = args[8+j]; 986 for (j=0; j<8; j++) s.args[j] = args[8+j];
1228 } 987 }
1229 } 988 }
1230 989
1231 void GrpImpl::SetSkipMode(SkipMode _mode) { 990 void Grp::SetSkipMode(SkipMode _mode) {
1232 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) { 991 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) {
1233 RefreshObj(); 992 RefreshObj();
1234 } else if ( (skip_mode & SKIP_IN_MENU) == 0 && (_mode & SKIP_IN_MENU) ) { 993 } else if ( (skip_mode & SKIP_IN_MENU) == 0 && (_mode & SKIP_IN_MENU) ) {
1235 } 994 }
1236 skip_mode = _mode; 995 skip_mode = _mode;
1237 } 996 }
1238 997
1239 void GrpImpl::SetObjChanged(int num) { 998 void Grp::SetObjChanged(int num) {
1240 changed_obj.insert(num); 999 changed_obj.insert(num);
1241 } 1000 }
1242 1001
1243 void GrpImpl::RefreshObj(void) { 1002 void Grp::RefreshObj(void) {
1244 if (!deleted_pic.empty()) { 1003 if (!deleted_pic.empty()) {
1245 vector<PicBase*>::iterator it; 1004 vector<PicBase*>::iterator it;
1246 for (it=deleted_pic.begin(); it!=deleted_pic.end(); it++) { 1005 for (it=deleted_pic.begin(); it!=deleted_pic.end(); it++) {
1247 if (*it) delete *it; 1006 if (*it) delete *it;
1248 } 1007 }
1264 screen->ReBlit(); 1023 screen->ReBlit();
1265 } 1024 }
1266 1025
1267 1026
1268 #include <SDL.h> 1027 #include <SDL.h>
1269 void GrpImpl::StartAnm(int type) { 1028 void Grp::StartAnm(int type) {
1270 SEL sel; 1029 SEL sel;
1271 1030
1272 if (anmtype.find(type) == anmtype.end()) { 1031 if (anmtype.find(type) == anmtype.end()) {
1273 if (anmtype.find(0) == anmtype.end()) { 1032 if (anmtype.find(0) == anmtype.end()) {
1274 sel.sel_no = 1; 1033 sel.sel_no = 1;
1346 } 1105 }
1347 if (anm1) anm1->Play(); 1106 if (anm1) anm1->Play();
1348 if (skip_mode & SKIP_GRP_NOEFFEC) AbortAnm(); 1107 if (skip_mode & SKIP_GRP_NOEFFEC) AbortAnm();
1349 } 1108 }
1350 1109
1351 void GrpImpl::StartShake(int total, const int* pattern) { 1110 void Grp::StartShake(int total, const int* pattern) {
1352 if (anm2) { 1111 if (anm2) {
1353 fprintf(stderr,"Warning: StartShake() called before another animation finished\n"); 1112 fprintf(stderr,"Warning: StartShake() called before another animation finished\n");
1354 anm2->Abort(); 1113 anm2->Abort();
1355 delete anm2; 1114 delete anm2;
1356 anm2 = NULL; 1115 anm2 = NULL;
1369 new_anm->SetPtn(); // パターン登録終了 1128 new_anm->SetPtn(); // パターン登録終了
1370 new_anm->Play(); 1129 new_anm->Play();
1371 anm2 = new_anm; 1130 anm2 = new_anm;
1372 } 1131 }
1373 1132
1374 void GrpImpl::AbortAnm(void) { 1133 void Grp::AbortAnm(void) {
1375 if (anm1 == NULL) return; 1134 if (anm1 == NULL) return;
1376 anm1->Abort(); 1135 anm1->Abort();
1377 delete anm1; 1136 delete anm1;
1378 anm1 = NULL; 1137 anm1 = NULL;
1379 /* 画像効果終了 */ 1138 /* 画像効果終了 */
1390 // 新しい object 表示 1149 // 新しい object 表示
1391 RefreshObj(); 1150 RefreshObj();
1392 return; 1151 return;
1393 } 1152 }
1394 1153
1395 void GrpImpl::LoadSurface(const char* str) { 1154 void Grp::LoadSurface(const char* str) {
1396 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了 1155 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了
1397 LoadSurface(str, 1); 1156 LoadSurface(str, 1);
1398 bg_name = str; 1157 bg_name = str;
1399 } 1158 }
1400 1159
1401 void GrpImpl::LoadSurface(void) { 1160 void Grp::LoadSurface(void) {
1402 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了 1161 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了
1403 LoadSurface(bg_name.c_str(), 1); 1162 LoadSurface(bg_name.c_str(), 1);
1404 } 1163 }
1405 1164
1406 void GrpImpl::AddSurface(const char* str) { 1165 void Grp::AddSurface(const char* str) {
1407 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了 1166 if (anm1 != NULL) AbortAnm(); // 前の描画が終わってなければ強制終了
1408 LoadSurface(bg_name.c_str()); 1167 LoadSurface(bg_name.c_str());
1409 1168
1410 string s = str; 1169 string s = str;
1411 Surface* front = parent.Root().NewSurface(s.c_str()); 1170 Surface* front = parent.Root().NewSurface(s.c_str());
1419 } else { 1178 } else {
1420 fprintf(stderr,"Cannot find surface %s\n",str); 1179 fprintf(stderr,"Cannot find surface %s\n",str);
1421 } 1180 }
1422 } 1181 }
1423 1182
1424 void GrpImpl::CreateObj(int index) { 1183 void Grp::CreateObj(int index) {
1425 GrpObjMap::iterator cur = grpobj.find(index); 1184 GrpObjMap::iterator cur = grpobj.find(index);
1426 if (cur == grpobj.end()) return; 1185 if (cur == grpobj.end()) return;
1427 GrpObj& g = grpobj[index]; 1186 GrpObj& g = grpobj[index];
1428 g.CreateSurface(&parent); 1187 g.CreateSurface(&parent);
1429 g.order = index; 1188 g.order = index;
1431 g.picture->hide(); 1190 g.picture->hide();
1432 SetObjChanged(index); 1191 SetObjChanged(index);
1433 ZMoveObj(index); 1192 ZMoveObj(index);
1434 } 1193 }
1435 1194
1436 void GrpImpl::CreateSubObj(int grp_index, int index) { 1195 void Grp::CreateSubObj(int grp_index, int index) {
1437 GrpObjMap::iterator cur = grpobj.find(grp_index); 1196 GrpObjMap::iterator cur = grpobj.find(grp_index);
1438 if (cur == grpobj.end()) return; 1197 if (cur == grpobj.end()) return;
1439 GrpObj* g = &grpobj[grp_index]; 1198 GrpObj* g = &grpobj[grp_index];
1440 cur = g->children_obj.find(index); 1199 cur = g->children_obj.find(index);
1441 if (cur == g->children_obj.end()) return; 1200 if (cur == g->children_obj.end()) return;
1447 //TODO 1206 //TODO
1448 SetObjChanged(grp_index); 1207 SetObjChanged(grp_index);
1449 /*ZMoveObj(index);*/ 1208 /*ZMoveObj(index);*/
1450 } 1209 }
1451 1210
1452 void GrpImpl::ZMoveObj(int index) { 1211 void Grp::ZMoveObj(int index) {
1453 GrpObjMap::iterator cur = grpobj.find(index); 1212 GrpObjMap::iterator cur = grpobj.find(index);
1454 if (cur == grpobj.end()) return; 1213 if (cur == grpobj.end()) return;
1455 GrpObj& g = grpobj[index]; 1214 GrpObj& g = grpobj[index];
1456 if (g.picture == NULL) return; 1215 if (g.picture == NULL) return;
1457 // 自分より前に object があれば、その前に表示 1216 // 自分より前に object があれば、その前に表示
1474 } else { 1233 } else {
1475 g.picture->ZMove(cur_backobj->second.picture); 1234 g.picture->ZMove(cur_backobj->second.picture);
1476 } 1235 }
1477 } 1236 }
1478 1237
1479 void GrpImpl::SwapObj(int index1, int index2) { 1238 void Grp::SwapObj(int index1, int index2) {
1480 // デフォルト値から order が変更されていた場合のみ、order は保存される 1239 // デフォルト値から order が変更されていた場合のみ、order は保存される
1481 // まずは両方のobjectをswap 1240 // まずは両方のobjectをswap
1482 if (grpobj.find(index1) == grpobj.end()) { 1241 if (grpobj.find(index1) == grpobj.end()) {
1483 if (grpobj.find(index2) == grpobj.end()) return; // どちらの object も存在しない 1242 if (grpobj.find(index2) == grpobj.end()) return; // どちらの object も存在しない
1484 grpobj[index1] = grpobj[index2]; 1243 grpobj[index1] = grpobj[index2];
1509 ZMoveObj(index2); 1268 ZMoveObj(index2);
1510 obj.DeletePic(); 1269 obj.DeletePic();
1511 } 1270 }
1512 } 1271 }
1513 1272
1514 bool GrpImpl::Pressed(int x, int y, void* pointer) { // マウスクリックでキャンセル 1273 bool Grp::Pressed(int x, int y, void* pointer) { // マウスクリックでキャンセル
1515 GrpImpl* g = (GrpImpl*)pointer; 1274 Grp* g = (Grp*)pointer;
1516 if (g->status == WAIT_MOVIE) 1275 if (g->status == WAIT_MOVIE)
1517 g->music->StopMovie(); 1276 g->music->StopMovie();
1518 if (g->status == WAIT_ANM) 1277 if (g->status == WAIT_ANM)
1519 g->AbortAnm(); 1278 g->AbortAnm();
1520 if (g->status == WAIT_SHAKE && g->anm2 != NULL) { 1279 if (g->status == WAIT_SHAKE && g->anm2 != NULL) {
1559 0x08, 0x85, 0xc0, 0x75, 0x56, 0x8b, 0x1d, 0xd0, 1318 0x08, 0x85, 0xc0, 0x75, 0x56, 0x8b, 0x1d, 0xd0,
1560 0xb0, 0x43, 0x00, 0x85, 0xff, 0x76, 0x49, 0x81, 1319 0xb0, 0x43, 0x00, 0x85, 0xff, 0x76, 0x49, 0x81,
1561 0xff, 0x00, 0x00, 0x04, 0x00, 0x6a, 0x00, 0x76 1320 0xff, 0x00, 0x00, 0x04, 0x00, 0x6a, 0x00, 0x76
1562 }; 1321 };
1563 1322
1564 void GrpImpl::LoadCgm() { 1323 void Grp::LoadCgm() {
1565 /* cgm ファイル読み込み */ 1324 /* cgm ファイル読み込み */
1566 const char* fname = config->GetParaStr("#CGTABLE_FILE"); 1325 const char* fname = config->GetParaStr("#CGTABLE_FILE");
1567 if (fname == NULL) return; 1326 if (fname == NULL) return;
1568 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::ALL, fname, ""); 1327 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::ALL, fname, "");
1569 if (info == NULL) return; 1328 if (info == NULL) return;
1599 delete[] dest_orig; 1358 delete[] dest_orig;
1600 } 1359 }
1601 1360
1602 /***************************************************** 1361 /*****************************************************
1603 * 1362 *
1604 * GrpImpl :: Save, Load : セーブファイル処理 1363 * Grp :: Save, Load : セーブファイル処理
1605 * 1364 *
1606 */ 1365 */
1607 void GrpImpl::Save(std::string& str) { 1366 void Grp::Save(std::string& str) {
1608 } 1367 }
1609 1368
1610 void GrpImpl::Load(const char* str) { 1369 void Grp::Load(const char* str) {
1611 status = NORMAL; 1370 status = NORMAL;
1612 if (anm1 != NULL) { 1371 if (anm1 != NULL) {
1613 AbortAnm(); 1372 AbortAnm();
1614 } 1373 }
1615 if (anm2 != NULL) { 1374 if (anm2 != NULL) {
1626 1385
1627 bg_name = ""; 1386 bg_name = "";
1628 music->StopCDROM(100); 1387 music->StopCDROM(100);
1629 } 1388 }
1630 1389
1631 void GrpImpl::SaveSys(string& save) { 1390 void Grp::SaveSys(string& save) {
1632 char buf[1024]; 1391 char buf[1024];
1633 save = "\n[Graphics]\n"; 1392 save = "\n[Graphics]\n";
1634 save += "CGM_CG="; 1393 save += "CGM_CG=";
1635 1394
1636 set<int>::iterator it; 1395 set<int>::iterator it;
1639 save += buf; 1398 save += buf;
1640 } 1399 }
1641 save += "\n"; 1400 save += "\n";
1642 } 1401 }
1643 1402
1644 void GrpImpl::LoadSys(const char* save) { 1403 void Grp::LoadSys(const char* save) {
1645 cgm_data.clear(); 1404 cgm_data.clear();
1646 save = strstr(save, "\n[Graphics]\n"); 1405 save = strstr(save, "\n[Graphics]\n");
1647 1406
1648 if (save) { 1407 if (save) {
1649 save += strlen("\n[Graphics]\n"); 1408 save += strlen("\n[Graphics]\n");
1666 } 1425 }
1667 1426
1668 1427
1669 /***************************************************** 1428 /*****************************************************
1670 * 1429 *
1671 * GrpImpl :: Wait , Exec : コマンド実行部 1430 * Grp :: Wait , Exec : コマンド実行部
1672 * 1431 *
1673 */ 1432 */
1674 static vector<int> drawn_images; 1433 static vector<int> drawn_images;
1675 static int draw_n = 0; 1434 static int draw_n = 0;
1676 extern bool grpdump_req; 1435 extern bool grpdump_req;
1677 bool GrpImpl::Wait(unsigned int current_time, Cmd& cmd) { 1436 bool Grp::Wait(unsigned int current_time, Cmd& cmd) {
1678 if (grpdump_req) { 1437 if (grpdump_req) {
1679 grpdump_req = 0; 1438 grpdump_req = 0;
1680 GrpObjMap::iterator it; 1439 GrpObjMap::iterator it;
1681 fprintf(stderr,"front %p(%d) / %p(%d)\n",screen,screen->IsHidden(),screen_front,screen_front->IsHidden()); 1440 fprintf(stderr,"front %p(%d) / %p(%d)\n",screen,screen->IsHidden(),screen_front,screen_front->IsHidden());
1682 for (it=grpobj.begin(); it != grpobj.end(); it++) { 1441 for (it=grpobj.begin(); it != grpobj.end(); it++) {
1749 } 1508 }
1750 } 1509 }
1751 return false; 1510 return false;
1752 } 1511 }
1753 1512
1754 void GrpImpl::DeleteObjPic(int num) { // object の surface のみ削除 1513 void Grp::DeleteObjPic(int num) { // object の surface のみ削除
1755 if (grpobj.find(num) == grpobj.end()) return; 1514 if (grpobj.find(num) == grpobj.end()) return;
1756 deleted_pic.push_back(grpobj[num].DeletePic()); 1515 deleted_pic.push_back(grpobj[num].DeletePic());
1757 } 1516 }
1758 1517
1759 void GrpImpl::DeleteSubObjPic(int num_grp, int num) { 1518 void Grp::DeleteSubObjPic(int num_grp, int num) {
1760 if (grpobj.find(num_grp) == grpobj.end()) return; 1519 if (grpobj.find(num_grp) == grpobj.end()) return;
1761 if (grpobj[num_grp].children_obj.find(num) == grpobj[num_grp].children_obj.end()) return; 1520 if (grpobj[num_grp].children_obj.find(num) == grpobj[num_grp].children_obj.end()) return;
1762 deleted_pic.push_back(grpobj[num_grp].children_obj[num].DeletePic()); 1521 deleted_pic.push_back(grpobj[num_grp].children_obj[num].DeletePic());
1763 } 1522 }
1764 1523
1765 void GrpImpl::DeleteObj(int num) { 1524 void Grp::DeleteObj(int num) {
1766 if (grpobj.find(num) == grpobj.end()) return; 1525 if (grpobj.find(num) == grpobj.end()) return;
1767 deleted_pic.push_back(grpobj[num].DeletePic()); 1526 deleted_pic.push_back(grpobj[num].DeletePic());
1768 GrpObjMap::iterator it; 1527 GrpObjMap::iterator it;
1769 for (it = grpobj[num].children_obj.begin(); it != grpobj[num].children_obj.end(); it++) { 1528 for (it = grpobj[num].children_obj.begin(); it != grpobj[num].children_obj.end(); it++) {
1770 deleted_pic.push_back(it->second.DeletePic()); 1529 deleted_pic.push_back(it->second.DeletePic());
1771 } 1530 }
1772 grpobj.erase(num); 1531 grpobj.erase(num);
1773 } 1532 }
1774 1533
1775 void GrpImpl::DeleteSubObj(int num_grp, int num) { 1534 void Grp::DeleteSubObj(int num_grp, int num) {
1776 if (grpobj.find(num_grp) == grpobj.end()) return; 1535 if (grpobj.find(num_grp) == grpobj.end()) return;
1777 if (grpobj[num_grp].children_obj.find(num) == grpobj[num_grp].children_obj.end()) return; 1536 if (grpobj[num_grp].children_obj.find(num) == grpobj[num_grp].children_obj.end()) return;
1778 deleted_pic.push_back(grpobj[num_grp].children_obj[num].DeletePic()); 1537 deleted_pic.push_back(grpobj[num_grp].children_obj[num].DeletePic());
1779 grpobj[num_grp].children_obj.erase(num); 1538 grpobj[num_grp].children_obj.erase(num);
1780 } 1539 }
1781 1540
1782 void GrpImpl::impl_stackClear (Cmd& cmd) { 1541 void Grp::Exec(Cmd& cmd) {
1783 cmd.cmd_type = CMD_SAVECMDGRP_START;
1784 }
1785
1786 void GrpImpl::impl_grpBuffer (Cmd& cmd) {
1787 const char* name = cmd.Str(cmd.args[0]);
1788 int pdt = cmd.args[1].value;
1789 eprintf("load surface %s pdt %d\n",name, pdt);
1790 if (pdt == 0)
1791 reserved_load_surface0 = name; // 画像読み込みは 01-1f:0000 まで待つ
1792 else if (pdt == 1)
1793 LoadSurface(name); // 背景絵読み込み?
1794 else
1795 LoadSurface(name, pdt);
1796 cmd.cmd_type = CMD_SAVECMDGRP;
1797 }
1798
1799 void GrpImpl::impl_grpMulti(Cmd& cmd) {
1800 int pos = cmd.args[0].value;
1801 const char* name = cmd.Str(cmd.args[1]);
1802 int sel = cmd.args[2].value;
1803 eprintf("set foreground %s sel %d pos %d\n",name, sel, pos);
1804 AddSurface(name);
1805 StartAnm(sel);
1806 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
1807 status = WAIT_ANM;
1808 cmd.cmd_type = CMD_SAVECMDGRP_ONCE;
1809 }
1810
1811 void GrpImpl::impl_grpOpen(Cmd& cmd) {
1812 const char* name = cmd.Str(cmd.args[0]);
1813 int sel = cmd.args[1].value;
1814
1815 if (name[0] == '?')
1816 LoadSurface();
1817 else if(cmd.cmd3 == 73)
1818 LoadSurface(name, 1);
1819 else
1820 LoadSurface(name);
1821
1822 StartAnm(sel);
1823 status = WAIT_ANM;
1824 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
1825
1826 if (name[0] == '?')
1827 cmd.cmd_type = CMD_SAVECMDGRP_ONCE;
1828 else
1829 cmd.cmd_type = CMD_SAVECMDGRP_START;
1830 }
1831
1832 void GrpImpl::impl_shake(Cmd& cmd) {
1833 // shake screen
1834 char key[11];
1835 sprintf(key, "#SHAKE.%03d", cmd.args[0].value);
1836 if (config->SearchParam(key) != 2) {
1837 fprintf(stderr,"Cannot find shake pattern %d; use default pattern\n",cmd.args[0].value);
1838 strcpy(key, "#SHAKE.000"); // default key
1839 }
1840 int num;
1841 const int* pattern;
1842 pattern = config->GetParamArray(key, num);
1843 if (pattern) {
1844 StartShake(num, pattern);
1845 status = WAIT_SHAKE;
1846 }
1847 cmd.clear();
1848 }
1849
1850 void GrpImpl::impl_grpCopy(Cmd& cmd) {
1851 if (cmd.cmd4 == 2) { // copy (KANOGI)
1852 int sx = cmd.args[0].value;
1853 int sy = cmd.args[1].value;
1854 int w = cmd.args[2].value - sx;
1855 int h = cmd.args[3].value - sy;
1856 Rect rect(sx, sy, sx+w, sy+h);
1857 int src = cmd.args[4].value;
1858 int dx = cmd.args[5].value;
1859 int dy = cmd.args[6].value;
1860 int dest = cmd.args[7].value;
1861 unsigned char alpha;
1862 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1863 printf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1864 if (src == dest) {
1865 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect);
1866 src = WORKPDT;
1867 }
1868 parent.Root().BlitSurface(Ssurface(src), rect, Dsurface(dest), Rect(dx,dy));
1869 if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h));
1870 cmd.clear();
1871 }
1872 }
1873
1874 void GrpImpl::impl_recFill(Cmd& cmd) {
1875 int x = cmd.args[0].value;
1876 int y = cmd.args[1].value;
1877 int w = cmd.args[2].value;
1878 int h = cmd.args[3].value;
1879 Rect rect(x, y, x+w, y+w);
1880 int pdt = cmd.args[4].value;
1881 int r = cmd.args[5].value;
1882 int g = cmd.args[6].value;
1883 int b = cmd.args[7].value;
1884
1885 if (cmd.cmd4 == 2) {
1886 eprintf("clear %d:(%d,%d) size (%d,%d) r %d g %d b %d\n",pdt,x,y,w,h,r,g,b);
1887 DSurfaceFill(Dsurface(pdt), rect, r, g, b);
1888 // if (pdt == 0) screen->ReBlit(rect);
1889 cmd.cmd_type = CMD_SAVECMDGRP;
1890 }
1891 else if (cmd.cmd4 == 3) { // alpha つきfill
1892 int a = cmd.args[8].value;
1893 eprintf("alpha-clear %d:(%d,%d) size (%d,%d) r %d g %d b %d a %d\n",pdt,x,y,w,h,r,g,b,a);
1894 if (a <= 0) ;
1895 else if (a >= 255) DSurfaceFill(Dsurface(pdt), rect, r, g, b);
1896 else {
1897 DSurfaceFill(Dsurface(WORKPDT), rect, r, g, b, a);
1898 parent.Root().BlitSurface(Dsurface(WORKPDT), rect, Dsurface(pdt), rect);
1899 }
1900 // if (pdt == 0) screen->ReBlit(rect);
1901 cmd.clear();
1902 }
1903 }
1904
1905 void GrpImpl::impl_recCopy(Cmd& cmd) {
1906 int sx = cmd.args[0].value;
1907 int sy = cmd.args[1].value;
1908 int w = cmd.args[2].value;
1909 int h = cmd.args[3].value;
1910 Rect rect(sx, sy, sx + w, sy + h);
1911 int src = cmd.args[4].value;
1912 int dx = cmd.args[5].value;
1913 int dy = cmd.args[6].value;
1914 int dest = cmd.args[7].value;
1915
1916 if (cmd.cmd4 == 2) {
1917 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1918 parent.Root().BlitSurface(Ssurface(src), rect, Dsurface(dest), Rect(dx,dy));
1919 //DSurfaceMove(Ssurface(src), Rect(sx,sy,sx+w,sy+h), Dsurface(dest), Rect(dx,dy));
1920 // if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h));
1921 cmd.cmd_type = CMD_SAVECMDGRP;
1922 }
1923
1924 else if (cmd.cmd4 == 3) { // alpha つきcopy
1925 unsigned char alpha;
1926 if (cmd.args[8].value < 0) alpha = 0;
1927 else if (cmd.args[8].value > 255) alpha = 255;
1928 else alpha = cmd.args[8].value;
1929 eprintf("copy surface %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1930 if (src == dest) {
1931 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect);
1932 src = WORKPDT;
1933 }
1934 if (alpha != 0)
1935 parent.Root().BlitSurface(Ssurface(src), rect, &alpha, Rect(0,0,1,1), Dsurface(dest), Rect(dx,dy), 0);
1936 // if (dest == 0) screen->ReBlit(Rect(dx,dy,dx+w,dy+h));
1937 cmd.clear();
1938 }
1939 }
1940
1941 void GrpImpl::impl_recAdd(Cmd& cmd) {
1942 if (cmd.cmd4 == 3) { // saturate mode で alpha 付き copy
1943 int sx = cmd.args[0].value;
1944 int sy = cmd.args[1].value;
1945 int w = cmd.args[2].value;
1946 int h = cmd.args[3].value;
1947 Rect rect(sx, sy, sx+w, sy+h);
1948 int src = cmd.args[4].value;
1949 int dx = cmd.args[5].value;
1950 int dy = cmd.args[6].value;
1951 int dest = cmd.args[7].value;
1952 unsigned char alpha;
1953 if (cmd.args[8].value < 0) alpha = 0;
1954 else if (cmd.args[8].value > 255) alpha = 255;
1955 else alpha = cmd.args[8].value;
1956 eprintf("copy surface w/ saturate %d:(%d,%d) size(%d,%d) -> %d:(%d,%d)\n",src,sx,sy,w,h,dest,dx,dy);
1957 if (src == dest) {
1958 DSurfaceMove(Ssurface(src), rect, Dsurface(WORKPDT), rect);
1959 src = WORKPDT;
1960 }
1961 if (alpha != 0) {
1962 // saturate mode : screen (picture) を一時的に作成
1963 PicBase* screen_tmp = parent.create_leaf(Rect(0, 0, parent.Width(), parent.Height()), 0);
1964 screen_tmp->SetSurface(Ssurface(src), 0, 0, PicBase::BLIT_SATURATE);
1965 screen_tmp->SetSurfaceRect(rect);
1966 screen_tmp->Move(dx, dy);
1967 screen_tmp->SetSurfaceAlpha(&alpha, Rect(0,0,1,1));
1968 screen_tmp->SimpleBlit(Dsurface(dest));
1969 delete screen_tmp;
1970 }
1971 cmd.clear();
1972 }
1973 }
1974
1975 void GrpImpl::impl_grpPan(Cmd& cmd) {
1976 if (cmd.cmd4 == 0) {
1977 Rect r_from(cmd.args[0].value, cmd.args[1].value);
1978 Rect r_to(cmd.args[2].value, cmd.args[3].value);
1979 int src_pdt = cmd.args[4].value;
1980 Rect r(cmd.args[5].value,cmd.args[6].value,cmd.args[7].value+1,cmd.args[8].value+1);
1981 int tm = cmd.args[9].value;
1982 fprintf(stderr,"??? cmd time %d\n",tm);
1983 // anm1 = new ScnGrpMove(event, screen, parent.Root(), surface, r, Ssurface(2), r_from, r_to, tm);
1984 // status = WAIT_ANM;
1985 }
1986 }
1987
1988 void GrpImpl::impl_snmBgScroll(Cmd& cmd) {
1989 if (cmd.cmd4 == 0) { // スクロールする画像効果(Princess Bride)
1990 if (anm2 != NULL) {
1991 anm2->Abort();
1992 delete anm2;
1993 anm2 = NULL;
1994 }
1995 PicBase* pic; Surface* s;
1996 Rect r(cmd.args[1].value, cmd.args[2].value, cmd.args[3].value+1, cmd.args[4].value+1);
1997 const char* name = cmd.Str(cmd.args[5]);
1998 Rect sr_start(cmd.args[6].value,cmd.args[7].value);
1999 Rect sr_end(cmd.args[8].value,cmd.args[9].value);
2000 int tm = cmd.args[10].value;
2001 LoadSurface(name, 2); /* PDT2 に読み込み、と決め打ち */
2002
2003 anm2 = new ScnGrpMove(event, screen, parent.Root(), Dsurface(1), r, Ssurface(2), sr_start, sr_end, tm);
2004 cmd.cmd_type = CMD_SAVECMDGRP;
2005 }
2006 }
2007
2008 void GrpImpl::impl_snmPlay(Cmd& cmd) {
2009 if (cmd.cmd4 == 0) {
2010 // カードが落ちるアニメーション
2011 int i;
2012 ScnGrpAnm* new_anm = new ScnGrpAnm(event, screen, *this);
2013 if (cmd.cmd3 == 0x834 || cmd.cmd3 == 0x835) {
2014 AbortAnm();
2015 anm1 = new_anm;
2016 if (cmd.cmd3 == 0x835) {
2017 status = WAIT_ANM;
2018 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
2019 }
2020 } else {
2021 anm2 = new_anm;
2022 }
2023 for (i=0; i<cmd.argc; i++) {
2024 const char* name = cmd.Str(cmd.args[i*3+1]);
2025 int tm = cmd.args[i*3+2].value;
2026 new_anm->push_back(ScnGrpAnmAtom(name,tm));
2027 }
2028 new_anm->CalcTotal();
2029 cmd.clear();
2030 }
2031 }
2032
2033 void GrpImpl::impl_cgGet(Cmd& cmd) {
2034 if (cmd.cmd3 == 0x5dc) // Total number of CG
2035 cmd.SetSysvar(cgm_size);
2036
2037 if (cmd.cmd3 == 0x5dd) // Number of CG viewed
2038 cmd.SetSysvar(cgm_data.size());
2039
2040 if (cmd.cmd3 == 0x5de) // Percentage of CG viewed
2041 cmd.SetSysvar(cgm_data.size() * 100 / cgm_size);
2042 }
2043
2044 void GrpImpl::impl_cgStatus(Cmd& cmd) {
2045 string s = cmd.Str(cmd.args[0]);
2046 if (cgm_info.find(s) == cgm_info.end()) {
2047 fprintf(stderr,"cmd 01-04:05e0 : cannot find cgm-info of '%s'\n",s.c_str());
2048 cmd.SetSysvar(-1);
2049 }
2050 else {
2051 int n = cgm_info[s];
2052 if (cmd.cmd3 == 1503) cmd.SetSysvar(n);
2053 else {
2054 if (cgm_data.find(n) == cgm_data.end()) cmd.SetSysvar(0);
2055 else cmd.SetSysvar(1);
2056 }
2057 }
2058 }
2059
2060 void GrpImpl::impl_objClear(Cmd& cmd) { //FIXME: may be broken (doesn't reflect what Haeleth says)
2061 if (cmd.cmd1 == 1)
2062 DeleteObj(cmd.args[0].value);
2063 if (cmd.cmd1 == 2)
2064 DeleteSubObj(cmd.args[0].value, cmd.args[1].value);
2065 cmd.clear();
2066 }
2067
2068 void GrpImpl::impl_createObj(Cmd& cmd) {
2069 /**************:
2070 0x47 : オブジェクト内容の設定
2071 1100: G00 file
2072 1003: GAN file
2073 1100: rect
2074 1200: string
2075 1300: weather effects
2076 1400: number
2077 */
2078 int base_argc = 0;
2079
2080 if (cmd.cmd1 == 1) { // 1: group object
2081 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除
2082 if (cmd.cmd2 == 71)
2083 DeleteObjPic(cmd.args[0].value); // 旧ファイル名のsurfaceを削除
2084 }
2085 else { // 2: single object in group
2086 DeleteSubObjPic(cmd.args[0].value, cmd.args[1].value); // 旧ファイル名のsurfaceを削除
2087 if (cmd.cmd2 == 71)
2088 DeleteSubObjPic(cmd.args[0].value, cmd.args[1].value); // 旧ファイル名のsurfaceを削除
2089 }
2090
2091 GrpObj* g = (cmd.cmd2 == 71) ? &grpobj[cmd.args[0].value] : &bs_obj[cmd.args[0].value];
2092 if (cmd.cmd1 == 2) // 2: single object in a group
2093 g = &g->children_obj[cmd.args[1].value];
2094
2095 if (cmd.cmd1 == 2)
2096 base_argc = 1;
2097
2098 if (cmd.cmd3 == 1000) { /* ファイル名設定 */
2099 g->gtype = GrpObj::FILE; //FIXME: Strange thing in the main menu; that happens with objComposite
2100 string name = cmd.Str(cmd.args[base_argc + 1]);
2101 if (name.find('?') != -1) {
2102 //Maybe it's for shading or something like that?
2103 printf("Warning: the part after the '?' was removed: '%s'\n", name.c_str());
2104 name.erase(name.find('?')); // '?' 以降の意味がわからない
2105 }
2106 g->name = name;
2107 } else if (cmd.cmd3 == 1003) { /* ファイル名設定(GAN含む) */
2108 g->gtype = GrpObj::GAN;
2109 if (cmd.Str(cmd.args[base_argc + 1]) == string("???"))
2110 g->name = cmd.Str(cmd.args[base_argc + 2]);
2111 else
2112 g->name = cmd.Str(cmd.args[base_argc + 1]);
2113 g->gan_name = cmd.Str(cmd.args[base_argc + 2]);
2114
2115 if (cmd.cmd4 >= 1 && cmd.args[base_argc + 3].value == 0)
2116 g->attr = GrpObj::Attribute(g->attr | GrpObj::HIDDEN);
2117 else
2118 g->attr = GrpObj::Attribute(g->attr & ~(GrpObj::HIDDEN));
2119
2120 if (cmd.argc >= base_argc + 5)
2121 g->SetPos(1, cmd.args[base_argc + 4].value, -cmd.args[base_argc + 5].value);
2122
2123 if (g->name.find('?') != -1) {
2124 g->name.erase(g->name.find('?'));
2125 g->gan_name = cmd.Str(cmd.args[base_argc + 2]);
2126 }
2127 } else if (cmd.cmd3 == 1200) { // 画像を文字列として指定
2128 g->gtype = GrpObj::MOJI;
2129 g->print_moji = cmd.Str(cmd.args[base_argc + 1]);
2130 g->attr = GrpObj::Attribute(g->attr & (~GrpObj::HIDDEN)); // 常に表示がデフォルト?
2131 cmd.clear();
2132 } else if (cmd.cmd3 == 1400) { // 数値を画像として表示
2133 g->gtype = GrpObj::DIGIT;
2134 g->name = cmd.Str(cmd.args[base_argc + 1]);
2135 }
2136
2137 CreateObj(cmd.args[0].value);
2138 if (cmd.cmd1 == 2)
2139 CreateSubObj(cmd.args[0].value, cmd.args[1].value);
2140
2141 if (cmd.cmd3 == 1000 || cmd.cmd3 == 1003 || cmd.cmd3 == 1200 || cmd.cmd3 == 1400) {
2142 // FILE, GAN, MOJI, DIGIT ならば座標等の設定を行う
2143 if (cmd.cmd4 >= 1) {
2144 if (cmd.args[2+base_argc].value == 0) {
2145 g->attr = GrpObj::Attribute(g->attr | GrpObj::HIDDEN);
2146 } else {
2147 g->attr = GrpObj::Attribute(g->attr & (~GrpObj::HIDDEN));
2148 }
2149 SetObjChanged(cmd.args[0].value);
2150 }
2151 if (cmd.cmd4 >= 2) { // 座標等も設定
2152 g->SetPos(0, cmd.args[3+base_argc].value, cmd.args[4+base_argc].value);
2153 }
2154 if ( (cmd.cmd3 == 1000 || cmd.cmd3 == 1003) && cmd.cmd4 >= 3) { // pattern 番号も設定
2155 g->SetSurfaceNum(cmd.args[5+base_argc].value);
2156 base_argc++; // 1000 (FILE) / 1003 (GAN) の場合のみこのオプションは存在する
2157 }
2158 cmd.clear();
2159 } else {
2160 fprintf(stderr,"CreateObj : cmd.cmd3 = %04x ; not supported!\n",cmd.cmd3);
2161 }
2162 }
2163
2164 void GrpImpl::impl_gan(Cmd& cmd) {
2165 int base_arg = 0;
2166 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg);
2167
2168 if (cmd.cmd3 == 3) { // ganIsPlaying
2169 if (g->anm == NULL || g->anm->IsEnd())
2170 cmd.SetSysvar(0);
2171 else
2172 cmd.SetSysvar(1);
2173 }
2174 else if (cmd.cmd3 == 1000) { // ganStop
2175 if (g->anm == NULL || g->anm->IsEnd())
2176 g->SetSurfaceNum(cmd.args[1].value);
2177 else {
2178 g->anm->Abort();
2179 g->SetSurfaceNum(cmd.args[1].value);
2180 }
2181 SetObjChanged(cmd.args[0].value);
2182 cmd.clear();
2183 }
2184 else if (cmd.cmd3 == 2003) { // objPlay
2185 g->CreateGanSpecial(event, 0, cmd.args[1].value);
2186 // g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN));
2187 SetObjChanged(cmd.args[0].value);
2188 cmd.clear();
2189 }
2190 else if (cmd.cmd3 == 3001 || cmd.cmd3 == 3003 || cmd.cmd3 == 3005 ||
2191 cmd.cmd3 == 1001 || cmd.cmd3 == 1003 || cmd.cmd3 == 1005) { // ganPlay*
2192 g->CreateGan(event, cmd.args[1].value);
2193 // g.attr = GrpObj::Attribute(g.attr & (~GrpObj::HIDDEN));
2194 SetObjChanged(cmd.args[0].value);
2195 cmd.clear();
2196 }
2197 }
2198
2199 void GrpImpl::impl_objSetPos(Cmd& cmd) {
2200 //obj or objBg
2201 int base_arg = 0;
2202 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2203
2204 int index, x, y;
2205 if (cmd.cmd3 == 1006 || cmd.cmd3 == 2006) { //objAdjust
2206 index = cmd.args[1+base_arg].value + 1;
2207 x = cmd.args[2+base_arg].value;
2208 y = cmd.args[3+base_arg].value;
2209 }
2210 else {
2211 index = 0;
2212 if (cmd.cmd3 == 1000) {
2213 x = cmd.args[1+base_arg].value;
2214 y = cmd.args[2+base_arg].value;
2215 }
2216 else {
2217 g->GetPos(index, x, y);
2218 if (cmd.cmd3 == 1001)
2219 x = cmd.args[1+base_arg].value;
2220 else
2221 y = cmd.args[1+base_arg].value;
2222 }
2223 }
2224
2225 g->SetPos(index, x, y);
2226 cmd.clear();
2227 }
2228
2229 void GrpImpl::impl_objAlpha(Cmd& cmd) {
2230 int base_arg = 0;
2231 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2232
2233 g->SetAlpha(cmd.args[base_arg + 1].value);
2234 cmd.clear();
2235 }
2236
2237 void GrpImpl::impl_objShow(Cmd& cmd) {
2238 int base_arg = 0;
2239 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2240
2241 if (cmd.args[base_arg + 1].value)
2242 g->attr = GrpObj::Attribute(g->attr & (~GrpObj::HIDDEN));
2243 else
2244 g->attr = GrpObj::Attribute(g->attr | GrpObj::HIDDEN);
2245
2246 g->attr = GrpObj::Attribute(g->attr | GrpObj::UPDATE_VISIBLE);
2247 // グループ単位で次の RefreshObj で表示・消去
2248 if (cmd.cmd2 == 0x51) //not Bg
2249 SetObjChanged(cmd.args[0].value);
2250 cmd.clear();
2251 }
2252
2253 void GrpImpl::impl_objColour(Cmd& cmd) {
2254 int base_arg = 0;
2255 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2256
2257 g->print_r = cmd.args[base_arg+1].value;
2258 g->print_g = cmd.args[base_arg+2].value;
2259 g->print_b = cmd.args[base_arg+3].value;
2260 g->SetUpdate();
2261 cmd.clear();
2262 }
2263
2264 void GrpImpl::impl_objComposite(Cmd& cmd) {//FIXME
2265 int base_arg = 0;
2266 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2267
2268 if (cmd.args[base_arg + 1].value == 1) {
2269 g->attr = GrpObj::Attribute(g->attr | GrpObj::SATURATE);
2270 cmd.clear();
2271 } else if (cmd.args[base_arg + 1].value == 0) {
2272 g->attr = GrpObj::Attribute(g->attr & (~GrpObj::SATURATE));
2273 cmd.clear();
2274 }
2275 g->SetUpdate();
2276 }
2277
2278 void GrpImpl::impl_objSetText(Cmd& cmd) {
2279 int base_arg = 0;
2280 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2281
2282 g->print_moji = cmd.Str(cmd.args[base_arg + 1]);
2283 g->SetUpdate();
2284 cmd.clear();
2285 }
2286
2287 void GrpImpl::impl_objTextOpts(Cmd& cmd) {
2288 int base_arg = 0;
2289 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2290
2291 // 画像を文字列として設定:文字の大きさなど
2292 g->print_size = cmd.args[base_arg + 1].value;
2293 /* 前景色を得る */
2294 int cr, cg, cb;
2295 char key[17];
2296 sprintf(key, "#COLOR_TABLE.%03d", cmd.args[base_arg + 5].value);
2297 if (config->GetParam(key, 3, &cr, &cg, &cb)) { // color not found
2298 cr = cg = cb = 0;
2299 }
2300 g->print_r = cr;
2301 g->print_g = cg;
2302 g->print_b = cb;
2303 g->SetUpdate();
2304 cmd.clear();
2305 }
2306
2307 void GrpImpl::impl_objOrder(Cmd& cmd) {
2308 int base_arg = 0;
2309 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2310
2311 int order = cmd.args[base_arg + 1].value;
2312 g->order = order;
2313 ZMoveObj(cmd.args[0].value);
2314 cmd.clear();
2315 }
2316
2317 void GrpImpl::impl_objDispArea(Cmd& cmd) {
2318 int base_arg = 0;
2319 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2320
2321 // オブジェクトのどの部分を画面に表示するか(クリップ領域)の設定
2322 int rx, ry, w, h;
2323 if (cmd.args.size() == base_arg + 5) {
2324 int rx = cmd.args[base_arg + 1].value;
2325 int ry = cmd.args[base_arg + 2].value;
2326 int w = cmd.args[base_arg + 3].value;
2327 int h = cmd.args[base_arg + 4].value;
2328 if (cmd.cmd3 == 1005) {
2329 w -= rx;
2330 h -= ry;
2331 }
2332 }
2333 else {
2334 rx = ry = 0;
2335 w = screen->Width();
2336 h = screen->Height();
2337 }
2338 g->SetClipArea(rx, ry, w, h); //TODO: case when cmd.args.size() == 1
2339 cmd.clear();
2340 }
2341
2342 void GrpImpl::impl_objSetDigits(Cmd& cmd) {
2343 int base_arg = 0;
2344 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2345
2346 g->dig_number = cmd.args[base_arg + 1].value;
2347 g->SetUpdate();
2348 cmd.clear();
2349 }
2350
2351 void GrpImpl::impl_objNumOpts(Cmd& cmd) {
2352 int base_arg = 0;
2353 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2354
2355 g->dig_digit = cmd.args[base_arg + 1].value;
2356 int attr = g->attr;
2357 attr &= ~(GrpObj::DIG_ZERO | GrpObj::DIG_SIGN | GrpObj::DIG_PACK);
2358 if (cmd.args[base_arg + 2].value) attr |= GrpObj::DIG_ZERO;
2359 if (cmd.args[base_arg + 3].value) attr |= GrpObj::DIG_SIGN;
2360 if (cmd.args[base_arg + 4].value) attr |= GrpObj::DIG_PACK;
2361 g->attr = GrpObj::Attribute(attr);
2362 g->SetUpdate();
2363 cmd.clear();
2364 }
2365
2366 void GrpImpl::impl_objPattNo(Cmd& cmd) {
2367 int base_arg = 0;
2368 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2369
2370 g->SetSurfaceNum(cmd.args[base_arg + 1].value);
2371 cmd.clear();
2372 }
2373
2374 void GrpImpl::impl_objScale(Cmd& cmd) {
2375 int base_arg = 0;
2376 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2377
2378 int zoom = (cmd.args[base_arg + 1].value + cmd.args[base_arg + 2].value)/2; //FIXME: eurk
2379 zoom = zoom*256/100;
2380 g->SetZoomRotate(zoom, -1);
2381 cmd.clear();
2382 }
2383
2384 void GrpImpl::impl_objRotate(Cmd& cmd) {
2385 int base_arg = 0;
2386 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, (cmd.cmd2 == 0x51));
2387
2388 int angle = cmd.args[base_arg + 1].value;
2389 angle /= 10;
2390 if (angle < 0) {
2391 angle %= 360;
2392 angle += 360;
2393 }
2394 angle %= 360;
2395 g->SetZoomRotate(-1, angle);
2396 cmd.clear();
2397 }
2398
2399 void GrpImpl::impl_objPosDims(Cmd& cmd) {
2400 int base_arg = 0;
2401 GrpObj* g = GetGraphicObjVarMode(cmd, base_arg, true);
2402
2403 VarInfo arg1 = cmd.args[base_arg + 1];
2404 VarInfo arg2 = cmd.args[base_arg + 2];
2405
2406 int val1, val2;
2407
2408 if (cmd.cmd3 == 1000)
2409 g->GetPos(0, val1, val2);
2410 else if (cmd.cmd3 == 1100)
2411 g->GetSrcGeom(val1, val2);
2412
2413 cmd.SetFlagvar(arg1, val1);
2414 cmd.SetFlagvar(arg2, val2);
2415 }
2416
2417 void GrpImpl::impl_refresh(Cmd& cmd) {
2418 // 本来は grpstack clear らしい
2419 RefreshObj();
2420 // Princess Bride の中途 Staff roll
2421 // このタイミングで描画するのが都合がいいので、
2422 //シナリオループを抜けて描画を起動
2423 cmd.cmd_type = CMD_WAITFRAMEUPDATE;
2424 }
2425
2426 void GrpImpl::impl_bgmLoop(Cmd& cmd) {
2427 if (cmd.cmd4 == 0 || cmd.cmd4 == 2) {
2428 int count = 8000;
2429 if (cmd.cmd3 == 2)
2430 count = 0; //bgmPlay, play once
2431 music->PlayCDROM((char*)cmd.Str(cmd.args[0]), count);
2432 cmd.cmd_type = CMD_SAVECMD_ONCE;
2433 }
2434 }
2435
2436 void GrpImpl::impl_bgmStop(Cmd& cmd) {
2437 if (cmd.cmd4 == 0) {
2438 if (cmd.cmd3 == 5)
2439 music->StopCDROM(0);
2440 else if (cmd.cmd3 == 105)
2441 music->StopCDROM(cmd.args[0].value);
2442 cmd.cmd_type = CMD_SAVECMD_ONCE;
2443 }
2444 }
2445
2446 void GrpImpl::impl_playWav(Cmd& cmd) {
2447 if (cmd.cmd3 == 2) {
2448 music->PlaySE(cmd.Str(cmd.args[0]), 1); //loop
2449 cmd.cmd_type = CMD_SAVECMD_ONCE;
2450 }
2451 else {
2452 music->PlaySE(cmd.Str(cmd.args[0]));
2453 cmd.clear();
2454 }
2455 if (cmd.cmd3 == 1)
2456 status = WAIT_SE;
2457 }
2458
2459 void GrpImpl::impl_playSE(Cmd& cmd) {
2460 music->PlaySE(cmd.args[0].value);
2461 cmd.clear();
2462 }
2463
2464 void GrpImpl::impl_stopWav(Cmd& cmd) {
2465 if (cmd.cmd3 == 5)
2466 music->StopSE();
2467 else if (cmd.cmd3 == 105)
2468 music->StopSE(cmd.args[0].value);
2469
2470 cmd.cmd_type = CMD_SAVECMD_ONCE;
2471 }
2472
2473 void GrpImpl::impl_SetVolMod(Cmd& cmd) {
2474 music->volmod[cmd.cmd3-0x8b6] = cmd.args[0].value;
2475 config->SetParam("#VOLMOD", 4, music->volmod[0], music->volmod[1], music->volmod[2], music->volmod[3]);
2476 cmd.clear();
2477 }
2478
2479 void GrpImpl::impl_GetVolMod(Cmd& cmd) {
2480 cmd.SetSysvar(music->volmod[cmd.cmd3-0x91a]);
2481 }
2482
2483 void GrpImpl::impl_koePlay(Cmd& cmd) {
2484 eprintf("play koe %d",cmd.args[0].value);
2485 if (cmd.cmd4 == 1) {
2486 eprintf(", para? %d",cmd.args[1].value);
2487 }
2488 eprintf("\n");
2489 char buf[1024]; sprintf(buf, "%d",cmd.args[0].value);
2490 if ( !(skip_mode & SKIP_TEXT)) music->PlayKoe(buf);
2491 cmd.clear();
2492 }
2493
2494 /*It may be useful... or not.
2495 void GrpImpl::impl_objSwap(Cmd& cmd) {
2496 if (cmd.cmd1 == 1 && cmd.args.size() == 2) {
2497 SwapObj(cmd.args[0].value, cmd.args[1].value);
2498 }
2499 cmd.clear();
2500 }*/
2501
2502 void GrpImpl::impl_movPlay(Cmd& cmd) {
2503 if ( cmd.cmd4 == 0) {
2504 const char* str = cmd.Str(cmd.args[0]);
2505 int x = cmd.args[1].value;
2506 int y = cmd.args[2].value;
2507 int x2 = cmd.args[3].value;
2508 int y2 = cmd.args[4].value;
2509 eprintf("play movie ; name %s pos %d,%d - %d,%d\n",str,x,y,x2,y2);
2510 music->PlayMovie(str, x, y, x2, y2,1);
2511 status = WAIT_MOVIE;
2512 event.RegisterGlobalPressFunc(&Pressed, (void*)this);
2513 cmd.clear();
2514 }
2515 }
2516
2517 void GrpImpl::Exec(Cmd& cmd) {
2518 if (cmd.cmd_type == CMD_TEXTEND) { 1542 if (cmd.cmd_type == CMD_TEXTEND) {
2519 music->StopKoe(500); // テキスト終了で声を止める 1543 music->StopKoe(500); // テキスト終了で声を止める
2520 cmd.clear(); 1544 cmd.clear();
2521 return; 1545 return;
2522 } 1546 }
2553 if (g->attr & GrpObj::UPDATE_ALL) 1577 if (g->attr & GrpObj::UPDATE_ALL)
2554 SetObjChanged(cmd.args[0].value); 1578 SetObjChanged(cmd.args[0].value);
2555 } 1579 }
2556 } 1580 }
2557 1581
2558
2559 /********************************************************
2560 **
2561 ** class Grp
2562 */
2563
2564 Grp::Grp(Event::Container& _event, PicContainer& _parent, const Flags& f, set<int>& _cgm) {
2565 pimpl = new GrpImpl(_event, _parent, f, _cgm);
2566 }
2567
2568 Grp::~Grp() {
2569 delete pimpl;
2570 }
2571
2572 bool Grp::Wait(unsigned int current_time, Cmd& cmd) {
2573 return pimpl->Wait(current_time, cmd);
2574 }
2575
2576 void Grp::Exec(Cmd& cmd) {
2577 pimpl->Exec(cmd);
2578 }
2579
2580 void Grp::SetSkipMode(SkipMode mode) {
2581 pimpl->SetSkipMode(mode);
2582 }
2583
2584 void Grp::InitSel(void) {
2585 pimpl->InitSel();
2586 }
2587
2588 void Grp::Save(std::string& str) {
2589 pimpl->Save(str);
2590 }
2591
2592 void Grp::Load(const char* str) {
2593 pimpl->Load(str);
2594 }
2595 void Grp::SaveSys(std::string& str) {
2596 pimpl->SaveSys(str);
2597 }
2598
2599 void Grp::LoadSys(const char* str) {
2600 pimpl->LoadSys(str);
2601 }