Changeset 56:c7bcc0ec2267
- Timestamp:
- 04/30/09 21:05:09 (3 years ago)
- Branch:
- default
- convert_revision:
- svn:d0a2da98-017c-47d2-8c43-22b54484806d/trunk@57
- Files:
-
- 8 added
- 9 modified
-
THANKS (added)
-
scn2k/Makefile.am (modified) (1 diff)
-
scn2k/scn2k.h (modified) (2 diffs)
-
scn2k/scn2k_cmd.h (added)
-
scn2k/scn2k_flags.h (added)
-
scn2k/scn2k_grp.cc (modified) (40 diffs)
-
scn2k/scn2k_grp.h (added)
-
scn2k/scn2k_grpimpl.cc (added)
-
scn2k/scn2k_text.cc (modified) (27 diffs)
-
scn2k/scn2k_text.h (added)
-
scn2k/scn2k_textimpl.cc (added)
-
system/system_config.h (modified) (2 diffs)
-
window/Makefile.am (modified) (1 diff)
-
window/render.cc (modified) (1 diff)
-
window/render.h (added)
-
window/surface.h (modified) (1 diff)
-
window/system.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
scn2k/Makefile.am
r54 r56 1 1 noinst_LIBRARIES = libscn2k.a 2 libscn2k_a_SOURCES = scn2k_cmd.cc scn2k_text.cc scn2k_grp.cc scn2k_impl.cc \ 2 libscn2k_a_SOURCES = scn2k_cmd.cc scn2k_cmd.h scn2k_flags.h\ 3 scn2k_text.cc scn2k_text.h scn2k_textimpl.cc\ 4 scn2k_grp.cc scn2k_grp.h scn2k_grpimpl.cc\ 5 scn2k_impl.cc \ 3 6 command_handler.cc \ 4 7 scn2k.h scn2k_impl.h -
scn2k/scn2k.h
r55 r56 34 34 #include <set> 35 35 36 #include "scn2k_cmd.h" 37 #include "scn2k_grp.h" 38 #include "scn2k_text.h" 39 36 40 /* 37 41 namespace Widget { … … 60 64 class Surface; 61 65 62 void dprintf(const char* fmt, ...);63 void eprintf(const char* fmt, ...);64 65 struct VarInfo {66 #define TYPE_NONSYSVARMAX 567 #define TYPE_VARMAX 968 #define TYPE_VARLOCSTR 1069 #define TYPE_VARSYSSTR 1270 #define TYPE_VARSTR 1871 #define TYPE_STR 5872 #define TYPE_VAL 6873 #define TYPE_SYS 0xc874 #define TYPE_END 0x7f75 76 #define TYPE_SYS_SYS 077 #define TYPE_SYS_SKIPMODE 178 int type;79 int number;80 int value;81 VarInfo() { type = TYPE_VAL; value = 0;}82 VarInfo(int n) { type = TYPE_VAL; value = n;}83 VarInfo(const VarInfo& i) { type = i.type; number = i.number; value = i.value;}84 };85 86 87 class Flags {88 /* flag:89 ** type 0-5 : ¥í¡Œ¥«¥ëÀ°¿ô¡¢³Æ2000žÄ90 ** type 6, 25 : ¥°¥í¡Œ¥Ð¥ëÀ°¿ô¡¢2000žÄ91 ** type 10,11: ¥í¡Œ¥«¥ëÀ°¿ô??¡¢³Æ2000žÄ92 ** type 12 : ¥°¥í¡Œ¥Ð¥ëÊž»úÎó¡¢2000žÄ (º£€Ï̵»ë€·€Æ€âÎÉ€€€¬)93 ** type 18 : ¥í¡Œ¥«¥ëÊž»úÎó¡¢2000žÄ94 ** type 25: ¥·¥¹¥Æ¥àÊÑ¿ô¡Ê¥Þ¥Š¥¹ºÂÉž€Ê€É¡©¡Ë 1000 žÄ¡©95 ** type 26-32, 51 : 1-bit access to 0-6, 2596 ** type 52-58, 77 : 2-bit access to 0-6, 2597 ** type 78-84, 103 : 4-bit access to 0-6, 2598 ** type 104-110, 129 : 8-bit access to 0-6, 2599 */100 private:101 typedef unsigned int uint;102 int sys;103 int var[TYPE_VARMAX+1][2000];104 std::string str[2000];105 std::string sys_str[2000];106 std::string loc_str[3];107 public:108 Flags(void);109 int operator () () const;110 int operator () (VarInfo info) const;111 void Str(int type, unsigned int number, char* buf, int sz) const;112 std::string Str(int type, unsigned int number) const;113 std::set<int> cgm_data;114 115 bool IsInt(int type) const;116 int MaxIndex(int type) const;117 118 void Set(VarInfo info, int value);119 int Get(int type, int number) const;120 void SetSys(int value);121 void SetStr(VarInfo info, std::string val);122 123 bool Exec(class Cmd& cmd);124 125 void Save(std::string& str);126 void Load(const char* str);127 128 void SaveSys(std::string& str);129 void LoadSys(const char* str);130 };131 132 /* commands */133 #define STRHEAP_SIZE 10000134 enum Cmdtype {135 CMD_NOP, CMD_FLAGS, CMD_JMP, CMD_TEXT, CMD_OTHER, CMD_SYSVAR,136 CMD_TEXTEND,137 CMD_SAVECMDGRP, CMD_SAVECMDGRP_START, CMD_SAVECMDGRP_ONCE, CMD_SAVECMD_ONCE, CMD_WAITFRAMEUPDATE,CMD_SAVEPOINT, CMD_ROLLBACKPOINT,138 CMD_SAVEREQ, CMD_SAVE,139 CMD_LOADREQ, CMD_LOAD,140 CMD_MENUREQ,141 CMD_BACKLOGREQ, CMD_BACKLOGREQ_FWD,142 CMD_END};143 144 struct CmdSimplified { // Cmd ÊÝžÍÑ145 int type, cmd1, cmd2, cmd3, cmd4, argc;146 char* args;147 void Save(std::string& save);148 void Load(const char* save, char*& args_buffer);149 void copy(const CmdSimplified& from, char*& args_buffer);150 };151 152 class SimpleCmd {153 public:154 SimpleCmd(int a, int b, int c);155 SimpleCmd();156 157 bool operator==(const SimpleCmd& cmd) const;158 bool operator<(const SimpleCmd& cmd) const;159 160 public:161 int cmd1, cmd2, cmd3;162 };163 164 class Cmd : public SimpleCmd{165 public:166 Cmdtype cmd_type;167 int cmd4;168 int argc;169 int pos, scn;170 const char* rawdata;171 char cmdstr[1024];172 std::vector<VarInfo> args;173 174 private:175 const Flags& flags;176 bool errorflag;177 int system_version;178 179 int GetArgs(const char*& d);180 int GetArgsSpecial(int normal_args,const char*& d);181 void GetSelection(const char*& d);182 int GetSwitch(const char*& d);183 int GetSimpleSwitch(const char*& d);184 int GetExpression(const char*& d, struct VarInfo* info = 0);185 int GetExpressionCond(const char*& d);186 int GetLeftToken(const char*& d, struct VarInfo& info);187 int GetString(const char*& d);188 int CopyString(const char* d);189 int StrVar(int type, int number);190 static char strtype[256];191 static int StrType(const char* d) { return strtype[*(unsigned const char*)d];}192 193 public:194 const char* Str(const VarInfo& info) const;195 int AddStr(char* s);196 197 private:198 char strheap[STRHEAP_SIZE];199 int strend;200 void SetError(void) { errorflag = true;}201 void ResetString(void) {202 strend = 0;203 }204 205 public:206 void GetCmd(Flags& f, const char*& d);207 void SetSysvar(int n, int v);208 void SetSysvar(int v) { SetSysvar(TYPE_SYS_SYS, v); }209 void SetFlagvar(VarInfo info, int v);210 void SetStrvar(VarInfo info, const std::string& s);211 bool IsError() { return errorflag;}212 void clear(void);213 virtual const char * CmdDescr(int, int, int, int) { return "Not supported"; }214 Cmd(const Flags& f, int _sys_ver);215 void read(const CmdSimplified& cmd);216 void write(CmdSimplified& cmd, char*& args_buffer) const;217 };218 219 class CommandHandler {220 public:221 typedef void (CommandHandler::*CmdImpl)(Cmd& cmd);222 typedef struct {223 const char* descr;224 CmdImpl function;225 } CommandInfo;226 void RegisterCommand(int cmd1, int cmd2, int cmd3, const char* descr, CmdImpl func);227 bool Exec(Cmd& cmd);228 void PrintCmd(Cmd& cmd);229 230 private:231 typedef std::map<SimpleCmd, CommandInfo> CommandMap;232 CommandMap command_map;233 };234 235 enum SkipMode {236 SKIP_NO=0, SKIP_TEXT=1, SKIP_GRP_FAST=16, SKIP_GRP_NOEFFEC=32,237 SKIP_GRP_NODRAW=64, SKIPEND_TEXT=256, SKIPEND_KEY=512, SKIP_IN_MENU=1024238 };239 240 #include "font/text.h"241 242 struct BacklogItem {243 enum {SaveSelect = -2};244 int scn, pos;245 int koe;246 std::string face;247 struct TextStream text;248 BacklogItem(void);249 void Clear(void);250 void AddTextPos(Cmd&);251 void DeleteTextPos();252 void SetSavepos(int pos);253 BacklogItem& operator =(const BacklogItem&);254 };255 256 class Text {257 private:258 class TextImpl* pimpl;259 public:260 std::vector<BacklogItem> backlog;261 BacklogItem backlog_item;262 Text(Event::Container& _event, PicContainer& _parent);263 ~Text();264 void InitWindow(void);265 void Exec(Cmd& cmd);266 bool Wait(unsigned int current_time, Cmd& cmd);267 void SetSkipMode(SkipMode mode);268 void hide(void);269 void show(void);270 void show(int num);271 void Save(std::string& str, bool rollback_save);272 void Load(const char* str);273 void DrawBacklog(BacklogItem& item, Cmd& cmd);274 };275 276 #include "../window/rect.h"277 278 class Grp {279 private:280 class GrpImpl* pimpl;281 public:282 Grp(Event::Container& _event, PicContainer& _parent, const Flags& f, std::set<int>& _cgm_data);283 ~Grp();284 bool Wait(unsigned int current_time, Cmd& cmd);285 void Exec(Cmd& cmd);286 void SetSkipMode(SkipMode mode);287 void InitSel(void);288 void Save(std::string& str);289 void Load(const char* str);290 void SaveSys(std::string& str);291 void LoadSys(const char* str);292 };293 294 66 void dprintf(const char* fmt, ...); // debug ÍÑ 295 67 void eprintf(const char* fmt, ...); // ¥³¥Þ¥ó¥ÉŒÂ¹Ô(XXXexec)ÄÉÀ×ÍÑ -
scn2k/scn2k_grp.cc
r55 r56 27 27 28 28 #include "scn2k.h" 29 #include "window/widget.h"30 29 #include "system/file.h" 31 30 #include "system/system_config.h" 32 31 #include "font/text.h" 33 #include <set> 34 35 using namespace std; 36 37 extern void DSurfaceFill(Surface* dest, const Rect& rect, int r, int g, int b, int a=0xff); 38 extern void DSurfaceMove(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstpos); 39 extern Rect DSurfaceRenderText(TextGlyphStream::iterator start, TextGlyphStream::iterator end, const Rect& srcrect, 40 Surface* dst, const Rect& dstrect); 32 #include "window/render.h" 33 41 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*1690 };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 256126 #define WORKPDT 255127 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 handling173 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]; // œñ€¹þ€ß²ÄÇœ€Ê Surface227 Surface* ssurface[MAXPDT]; // ¥Õ¥¡¥€¥ë€ÎÆâÍÆÅù¡¢ÆÉ€ß¹þ€ß€Î€ß²ÄÇœ€ÊŸõÂրΠSurface228 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 37 ** GrpObj(implementation) … … 753 538 */ 754 539 /* Princess Bride: ÇØ·Ê²è€Î°ìÉô€Î€ß°Üư¡¢€ÎŒÂÁõ */ 755 struct ScnGrpMove : public WidAnmTime { 756 Surface* dest; 757 Surface* src; 758 PicRoot& root; 759 Rect dest_r, from, to; 760 ScnGrpMove(Event::Container& container, PicBase* _pic, PicRoot& root, Surface* dest, const Rect& _dest_r, Surface* src, const Rect& from, const Rect& to, int total_time); 761 void Exec(int count); 762 }; 540 763 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 542 WidAnmTime(container, _pic, total_time), … … 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 566 void ScnGrpAnm::CalcTotal(void) { 806 567 /* total time €ò·×»» */ … … 826 587 /***************************************************** 827 588 * 828 * Grp Impl(implementation) : ÄêµÁ589 * Grp 829 590 * 830 591 */ … … 832 593 #include "music2/music.h" 833 594 834 Grp Impl::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 596 event(_event), 836 597 flags(f), … … 862 623 LoadCgm(); 863 624 864 RegisterCommand(1, 30, 0, "stackClear", (CmdImpl) &Grp Impl::impl_stackClear);865 RegisterCommand(1, 33, 70, "grpBuffer", (CmdImpl) &Grp Impl::impl_grpBuffer);866 RegisterCommand(1, 33, 73, "grpOpenBG", (CmdImpl) &Grp Impl::impl_grpOpen);867 RegisterCommand(1, 33, 75, "grpMulti", (CmdImpl) &Grp Impl::impl_grpMulti); //FIXME: or not...868 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &Grp Impl::impl_grpOpen);869 RegisterCommand(1, 33, 32, "shake", (CmdImpl) &Grp Impl::impl_shake);870 RegisterCommand(1, 33, 100, "grpCopy", (CmdImpl) &Grp Impl::impl_grpCopy);871 RegisterCommand(1, 33, 1201, "recFill", (CmdImpl) &Grp Impl::impl_recFill);872 RegisterCommand(1, 33, 1100, "recCopy", (CmdImpl) &Grp Impl::impl_recCopy);625 RegisterCommand(1, 30, 0, "stackClear", (CmdImpl) &Grp::impl_stackClear); 626 RegisterCommand(1, 33, 70, "grpBuffer", (CmdImpl) &Grp::impl_grpBuffer); 627 RegisterCommand(1, 33, 73, "grpOpenBG", (CmdImpl) &Grp::impl_grpOpen); 628 RegisterCommand(1, 33, 75, "grpMulti", (CmdImpl) &Grp::impl_grpMulti); //FIXME: or not... 629 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &Grp::impl_grpOpen); 630 RegisterCommand(1, 33, 32, "shake", (CmdImpl) &Grp::impl_shake); 631 RegisterCommand(1, 33, 100, "grpCopy", (CmdImpl) &Grp::impl_grpCopy); 632 RegisterCommand(1, 33, 1201, "recFill", (CmdImpl) &Grp::impl_recFill); 633 RegisterCommand(1, 33, 1100, "recCopy", (CmdImpl) &Grp::impl_recCopy); 873 634 RegisterCommand(1, 33, 1101, "recMaskCopy", NULL); //FIXME 874 RegisterCommand(1, 33, 1600, "recAdd", (CmdImpl) &Grp Impl::impl_recAdd);875 RegisterCommand(1, 33, 406, "grpPan", (CmdImpl) &Grp Impl::impl_grpPan);876 877 RegisterCommand(1, 34, 3120, "snmBgScroll", (CmdImpl) &Grp Impl::impl_snmBgScroll);878 RegisterCommand(1, 34, 3100, "snmBgPlay", (CmdImpl) &Grp Impl::impl_snmPlay);879 RegisterCommand(1, 34, 2100, "snmPlay", (CmdImpl) &Grp Impl::impl_snmPlay);880 RegisterCommand(1, 34, 2101, "snmPlayEx", (CmdImpl) &Grp Impl::impl_snmPlay);881 882 RegisterCommand(1, 4, 1500, "cgGetTotal", (CmdImpl) &Grp Impl::impl_cgGet);883 RegisterCommand(1, 4, 1501, "cgGetViewed", (CmdImpl) &Grp Impl::impl_cgGet);884 RegisterCommand(1, 4, 1502, "cgGetViewedPcnt", (CmdImpl) &Grp Impl::impl_cgGet);885 RegisterCommand(1, 4, 1503, "cgGetFlag", (CmdImpl) &Grp Impl::impl_cgStatus);886 RegisterCommand(1, 4, 1504, "cgStatus", (CmdImpl) &Grp Impl::impl_cgStatus);635 RegisterCommand(1, 33, 1600, "recAdd", (CmdImpl) &Grp::impl_recAdd); 636 RegisterCommand(1, 33, 406, "grpPan", (CmdImpl) &Grp::impl_grpPan); 637 638 RegisterCommand(1, 34, 3120, "snmBgScroll", (CmdImpl) &Grp::impl_snmBgScroll); 639 RegisterCommand(1, 34, 3100, "snmBgPlay", (CmdImpl) &Grp::impl_snmPlay); 640 RegisterCommand(1, 34, 2100, "snmPlay", (CmdImpl) &Grp::impl_snmPlay); 641 RegisterCommand(1, 34, 2101, "snmPlayEx", (CmdImpl) &Grp::impl_snmPlay); 642 643 RegisterCommand(1, 4, 1500, "cgGetTotal", (CmdImpl) &Grp::impl_cgGet); 644 RegisterCommand(1, 4, 1501, "cgGetViewed", (CmdImpl) &Grp::impl_cgGet); 645 RegisterCommand(1, 4, 1502, "cgGetViewedPcnt", (CmdImpl) &Grp::impl_cgGet); 646 RegisterCommand(1, 4, 1503, "cgGetFlag", (CmdImpl) &Grp::impl_cgStatus); 647 RegisterCommand(1, 4, 1504, "cgStatus", (CmdImpl) &Grp::impl_cgStatus); 887 648 888 649 RegisterCommand(1, 4, 0x6a4, "CreateInput", NULL); 889 650 RegisterCommand(1, 4, 0x6ae, "SetInput", NULL); 890 651 891 RegisterCommand(1, 61, 10, "objClear", (CmdImpl) &Grp Impl::impl_objClear);892 RegisterCommand(1, 61, 11, "objDelete", (CmdImpl) &Grp Impl::impl_objClear);893 894 RegisterCommand(1, 71, 1000, " createObjG00", (CmdImpl) &GrpImpl::impl_createObj);895 RegisterCommand(1, 71, 1003, " createObjGAN", (CmdImpl) &GrpImpl::impl_createObj);896 RegisterCommand(1, 71, 1100, " createObjRect", (CmdImpl) &GrpImpl::impl_createObj);897 RegisterCommand(1, 71, 1200, " createObjText", (CmdImpl) &GrpImpl::impl_createObj);898 RegisterCommand(1, 71, 1300, " createObjWeaver", (CmdImpl) &GrpImpl::impl_createObj);899 RegisterCommand(1, 71, 1400, " createObjDigit", (CmdImpl) &GrpImpl::impl_createObj);900 901 RegisterCommand(2, 71, 1000, " createSubObjG00", (CmdImpl) &GrpImpl::impl_createObj);902 RegisterCommand(2, 71, 1003, " createSubObjGAN", (CmdImpl) &GrpImpl::impl_createObj);903 RegisterCommand(2, 71, 1100, " createSubObjRect", (CmdImpl) &GrpImpl::impl_createObj);904 RegisterCommand(2, 71, 1200, " createSubObjText", (CmdImpl) &GrpImpl::impl_createObj);905 RegisterCommand(2, 71, 1300, " createSubObjWeaver", (CmdImpl) &GrpImpl::impl_createObj);906 RegisterCommand(2, 71, 1400, " createSubObjDigit", (CmdImpl) &GrpImpl::impl_createObj);652 RegisterCommand(1, 61, 10, "objClear", (CmdImpl) &Grp::impl_objClear); 653 RegisterCommand(1, 61, 11, "objDelete", (CmdImpl) &Grp::impl_objClear); 654 655 RegisterCommand(1, 71, 1000, "objOfFile", (CmdImpl) &Grp::impl_createObj); 656 RegisterCommand(1, 71, 1003, "objOfFileGan", (CmdImpl) &Grp::impl_createObj); 657 RegisterCommand(1, 71, 1100, "objOfArea", (CmdImpl) &Grp::impl_createObj); 658 RegisterCommand(1, 71, 1200, "objOfText", (CmdImpl) &Grp::impl_createObj); 659 RegisterCommand(1, 71, 1300, "objDriftOfFile", (CmdImpl) &Grp::impl_createObj); 660 RegisterCommand(1, 71, 1400, "objOfDigits", (CmdImpl) &Grp::impl_createObj); 661 662 RegisterCommand(2, 71, 1000, "subObjOfFile", (CmdImpl) &Grp::impl_createObj); 663 RegisterCommand(2, 71, 1003, "subObjOfGan", (CmdImpl) &Grp::impl_createObj); 664 RegisterCommand(2, 71, 1100, "subObjOfArea", (CmdImpl) &Grp::impl_createObj); 665 RegisterCommand(2, 71, 1200, "subObjOfText", (CmdImpl) &Grp::impl_createObj); 666 RegisterCommand(2, 71, 1300, "subObjDriftOfFile", (CmdImpl) &Grp::impl_createObj); 667 RegisterCommand(2, 71, 1400, "subObjOfDigits", (CmdImpl) &Grp::impl_createObj); 907 668 908 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); 910 RegisterCommand(1, 72, 1003, "createBgObjGAN", (CmdImpl) &GrpImpl::impl_createObj); 911 RegisterCommand(1, 72, 1100, "createBgObjRect", (CmdImpl) &GrpImpl::impl_createObj); 912 RegisterCommand(1, 72, 1200, "createBgObjText", (CmdImpl) &GrpImpl::impl_createObj); 913 RegisterCommand(1, 72, 1300, "createBgObjWeaver", (CmdImpl) &GrpImpl::impl_createObj); 914 RegisterCommand(1, 72, 1400, "createBgObjDigit", (CmdImpl) &GrpImpl::impl_createObj); 915 916 RegisterCommand(2, 72, 1000, "createBgSubObjG00", NULL);//FIXME 917 RegisterCommand(2, 72, 1003, "createBgSubObjGAN", NULL);//FIXME 918 RegisterCommand(2, 72, 1100, "createBgSubObjRect", NULL);//FIXME 919 RegisterCommand(2, 72, 1200, "createBgSubObjText", NULL);//FIXME 920 RegisterCommand(2, 72, 1300, "createBgSubObjWeaver", NULL);//FIXME 921 RegisterCommand(2, 72, 1400, "createBgSubObjDigit", NULL);//FIXME 922 670 RegisterCommand(1, 72, 1000, "objBgOfFile", (CmdImpl) &Grp::impl_createObj); 671 RegisterCommand(1, 72, 1003, "objBgOfFileGan", (CmdImpl) &Grp::impl_createObj); 672 RegisterCommand(1, 72, 1100, "objBgOfArea", (CmdImpl) &Grp::impl_createObj); 673 RegisterCommand(1, 72, 1200, "objBgOfText", (CmdImpl) &Grp::impl_createObj); 674 RegisterCommand(1, 72, 1300, "objBgDriftOfFile", (CmdImpl) &Grp::impl_createObj); 675 RegisterCommand(1, 72, 1400, "objBgOfDigits", (CmdImpl) &Grp::impl_createObj); 676 677 RegisterCommand(2, 72, 1000, "subObjBgOfFile", NULL);//FIXME 678 RegisterCommand(2, 72, 1003, "subObjBgOfGan", NULL);//FIXME 679 RegisterCommand(2, 72, 1100, "subObjBgOfArea", NULL);//FIXME 680 RegisterCommand(2, 72, 1200, "subObjBgOfText", NULL);//FIXME 681 RegisterCommand(2, 72, 1300, "subObjBgDriftOfFile", NULL);//FIXME 682 RegisterCommand(2, 72, 1400, "subObjBgOfDigits", NULL);//FIXME; 923 683 924 684 RegisterCommand(1, 73, 0, "ganStop?", NULL); //That's what xclannad says, but I'm not sure... 925 RegisterCommand(1, 73, 1000, "ganStop", (CmdImpl) &Grp Impl::impl_gan); //That's what rldev says926 RegisterCommand(1, 73, 3, "ganIsPlaying", (CmdImpl) &Grp Impl::impl_gan);927 RegisterCommand(1, 73, 2003, "objPlay", (CmdImpl) &Grp Impl::impl_gan);928 RegisterCommand(1, 73, 1001, "ganLoop", (CmdImpl) &Grp Impl::impl_gan);929 RegisterCommand(1, 73, 1003, "ganPlay", (CmdImpl) &Grp Impl::impl_gan);930 RegisterCommand(1, 73, 1005, "ganPlayOnce", (CmdImpl) &Grp Impl::impl_gan);931 RegisterCommand(1, 73, 3001, "ganLoop2", (CmdImpl) &Grp Impl::impl_gan);932 RegisterCommand(1, 73, 3003, "ganPlay2", (CmdImpl) &Grp Impl::impl_gan);933 RegisterCommand(1, 73, 3005, "ganPlayOnce2", (CmdImpl) &Grp Impl::impl_gan);685 RegisterCommand(1, 73, 1000, "ganStop", (CmdImpl) &Grp::impl_gan); //That's what rldev says 686 RegisterCommand(1, 73, 3, "ganIsPlaying", (CmdImpl) &Grp::impl_gan); 687 RegisterCommand(1, 73, 2003, "objPlay", (CmdImpl) &Grp::impl_gan); 688 RegisterCommand(1, 73, 1001, "ganLoop", (CmdImpl) &Grp::impl_gan); 689 RegisterCommand(1, 73, 1003, "ganPlay", (CmdImpl) &Grp::impl_gan); 690 RegisterCommand(1, 73, 1005, "ganPlayOnce", (CmdImpl) &Grp::impl_gan); 691 RegisterCommand(1, 73, 3001, "ganLoop2", (CmdImpl) &Grp::impl_gan); 692 RegisterCommand(1, 73, 3003, "ganPlay2", (CmdImpl) &Grp::impl_gan); 693 RegisterCommand(1, 73, 3005, "ganPlayOnce2", (CmdImpl) &Grp::impl_gan); 934 694 935 695 RegisterCommand(2, 73, 0, "ganSubStop?", NULL); //FIXME … … 940 700 RegisterCommand(2, 73, 1003, "ganSubPlay", NULL); //FIXME 941 701 RegisterCommand(2, 73, 1005, "ganSubPlayOnce", NULL); //FIXME 942 RegisterCommand(2, 73, 3001, "ganSubLoop2", (CmdImpl) &Grp Impl::impl_gan); //FIXME702 RegisterCommand(2, 73, 3001, "ganSubLoop2", (CmdImpl) &Grp::impl_gan); //FIXME 943 703 RegisterCommand(2, 73, 3003, "ganSubPlay2", NULL); //FIXME 944 704 RegisterCommand(2, 73, 3005, "ganSubPlayOnce2", NULL); //FIXME 945 705 946 706 947 RegisterCommand(1, 81, 1000, "objMove", (CmdImpl) &Grp Impl::impl_objSetPos);948 RegisterCommand(1, 82, 1000, "objBgMove", (CmdImpl) &Grp Impl::impl_objSetPos);949 RegisterCommand(1, 81, 1001, "objLeft", (CmdImpl) &Grp Impl::impl_objSetPos);950 RegisterCommand(1, 82, 1001, "objBgLeft", (CmdImpl) &Grp Impl::impl_objSetPos);951 RegisterCommand(1, 81, 1002, "objTop", (CmdImpl) &Grp Impl::impl_objSetPos);952 RegisterCommand(1, 82, 1002, "objBgTop", (CmdImpl) &Grp Impl::impl_objSetPos);953 RegisterCommand(1, 81, 1003, "objAlpha", (CmdImpl) &Grp Impl::impl_objAlpha);954 RegisterCommand(1, 82, 1003, "objBgAlpha", (CmdImpl) &Grp Impl::impl_objAlpha);955 RegisterCommand(1, 81, 1004, "objShow", (CmdImpl) &Grp Impl::impl_objShow);956 RegisterCommand(1, 82, 1004, "objBgShow", (CmdImpl) &Grp Impl::impl_objShow);707 RegisterCommand(1, 81, 1000, "objMove", (CmdImpl) &Grp::impl_objSetPos); 708 RegisterCommand(1, 82, 1000, "objBgMove", (CmdImpl) &Grp::impl_objSetPos); 709 RegisterCommand(1, 81, 1001, "objLeft", (CmdImpl) &Grp::impl_objSetPos); 710 RegisterCommand(1, 82, 1001, "objBgLeft", (CmdImpl) &Grp::impl_objSetPos); 711 RegisterCommand(1, 81, 1002, "objTop", (CmdImpl) &Grp::impl_objSetPos); 712 RegisterCommand(1, 82, 1002, "objBgTop", (CmdImpl) &Grp::impl_objSetPos); 713 RegisterCommand(1, 81, 1003, "objAlpha", (CmdImpl) &Grp::impl_objAlpha); 714 RegisterCommand(1, 82, 1003, "objBgAlpha", (CmdImpl) &Grp::impl_objAlpha); 715 RegisterCommand(1, 81, 1004, "objShow", (CmdImpl) &Grp::impl_objShow); 716 RegisterCommand(1, 82, 1004, "objBgShow", (CmdImpl) &Grp::impl_objShow); 957 717 RegisterCommand(1, 81, 1005, "objDispArea", NULL); 958 718 RegisterCommand(1, 82, 1005, "objBgDispArea", NULL); 959 RegisterCommand(1, 81, 1006, "objAdjust", (CmdImpl) &Grp Impl::impl_objSetPos);960 RegisterCommand(1, 82, 1006, "objBgAdjust", NULL); //FIXME: (CmdImpl) &Grp Impl::impl_objSetPos);719 RegisterCommand(1, 81, 1006, "objAdjust", (CmdImpl) &Grp::impl_objSetPos); 720 RegisterCommand(1, 82, 1006, "objBgAdjust", NULL); //FIXME: (CmdImpl) &Grp::impl_objSetPos); 961 721 RegisterCommand(1, 81, 1007, "objAdjustX", NULL); 962 722 RegisterCommand(1, 82, 1007, "objBgAdjustX", NULL); 963 723 RegisterCommand(1, 81, 1008, "objAdjustY", NULL); 964 724 RegisterCommand(1, 82, 1008, "objBgAdjustY", NULL); 965 RegisterCommand(1, 81, 2006, "objAdjust2?", NULL); //FIXME: (CmdImpl) &Grp Impl::impl_objSetPos); I don't know if it is usefull or properly implemented966 RegisterCommand(1, 82, 2006, "objBgAdjust2?", NULL); //FIXME: (CmdImpl) &Grp Impl::impl_objSetPos); See above967 RegisterCommand(1, 81, 1016, "objColour", NULL); //FIXME: (CmdImpl) &Grp Impl::impl_objColour);968 RegisterCommand(1, 82, 1016, "objBgColour", NULL); //FIXME: (CmdImpl) &Grp Impl::impl_objColour);725 RegisterCommand(1, 81, 2006, "objAdjust2?", NULL); //FIXME: (CmdImpl) &Grp::impl_objSetPos); I don't know if it is usefull or properly implemented 726 RegisterCommand(1, 82, 2006, "objBgAdjust2?", NULL); //FIXME: (CmdImpl) &Grp::impl_objSetPos); See above 727 RegisterCommand(1, 81, 1016, "objColour", NULL); //FIXME: (CmdImpl) &Grp::impl_objColour); 728 RegisterCommand(1, 82, 1016, "objBgColour", NULL); //FIXME: (CmdImpl) &Grp::impl_objColour); 969 729 RegisterCommand(1, 81, 1017, "objColR", NULL); 970 730 RegisterCommand(1, 82, 1017, "objBgColR", NULL); … … 975 735 RegisterCommand(1, 81, 1020, "objColLevel", NULL); 976 736 RegisterCommand(1, 82, 1020, "objBgColLevel", NULL); 977 RegisterCommand(1, 81, 1021, "objComposite", NULL);//(CmdImpl) &Grp Impl::impl_objComposite); //FIXME: May be broken978 RegisterCommand(1, 82, 1021, "objBgComposite", (CmdImpl) &Grp Impl::impl_objComposite);979 RegisterCommand(1, 81, 1024, "objSetText", (CmdImpl) &Grp Impl::impl_objSetText);980 RegisterCommand(1, 82, 1024, "objBgSetText", (CmdImpl) &Grp Impl::impl_objSetText);981 RegisterCommand(1, 81, 1025, "objTextOpts", (CmdImpl) &Grp Impl::impl_objTextOpts); //FIXME: Incomplete982 RegisterCommand(1, 82, 1025, "objBgTextOpts", (CmdImpl) &Grp Impl::impl_objTextOpts);983 RegisterCommand(1, 81, 1032, "objOrder", (CmdImpl) &Grp Impl::impl_objOrder);984 RegisterCommand(1, 82, 1032, "objBgOrder", (CmdImpl) &Grp Impl::impl_objOrder);985 RegisterCommand(1, 81, 1034, "objDispRect", (CmdImpl) &Grp Impl::impl_objDispArea);986 RegisterCommand(1, 82, 1034, "objBgDispRect", (CmdImpl) &Grp Impl::impl_objDispArea);987 RegisterCommand(1, 81, 1037, "objSetDigits", (CmdImpl) &Grp Impl::impl_objSetDigits);988 RegisterCommand(1, 82, 1037, "objBgSetDigits", (CmdImpl) &Grp Impl::impl_objSetDigits);989 RegisterCommand(1, 81, 1038, "objNumOpts", (CmdImpl) &Grp Impl::impl_objNumOpts);990 RegisterCommand(1, 82, 1038, "objBgNumOpts", (CmdImpl) &Grp Impl::impl_objNumOpts);991 RegisterCommand(1, 81, 1039, "objPattNo", (CmdImpl) &Grp Impl::impl_objPattNo);992 RegisterCommand(1, 82, 1039, "objBgPattNo", (CmdImpl) &Grp Impl::impl_objPattNo);993 RegisterCommand(1, 81, 1046, "objScale", (CmdImpl) &Grp Impl::impl_objScale); //FIXME: Broken behaviour994 RegisterCommand(1, 82, 1046, "objBgScale", (CmdImpl) &Grp Impl::impl_objScale);737 RegisterCommand(1, 81, 1021, "objComposite", NULL);//(CmdImpl) &Grp::impl_objComposite); //FIXME: May be broken 738 RegisterCommand(1, 82, 1021, "objBgComposite", (CmdImpl) &Grp::impl_objComposite); 739 RegisterCommand(1, 81, 1024, "objSetText", (CmdImpl) &Grp::impl_objSetText); 740 RegisterCommand(1, 82, 1024, "objBgSetText", (CmdImpl) &Grp::impl_objSetText); 741 RegisterCommand(1, 81, 1025, "objTextOpts", (CmdImpl) &Grp::impl_objTextOpts); //FIXME: Incomplete 742 RegisterCommand(1, 82, 1025, "objBgTextOpts", (CmdImpl) &Grp::impl_objTextOpts); 743 RegisterCommand(1, 81, 1032, "objOrder", (CmdImpl) &Grp::impl_objOrder); 744 RegisterCommand(1, 82, 1032, "objBgOrder", (CmdImpl) &Grp::impl_objOrder); 745 RegisterCommand(1, 81, 1034, "objDispRect", (CmdImpl) &Grp::impl_objDispArea); 746 RegisterCommand(1, 82, 1034, "objBgDispRect", (CmdImpl) &Grp::impl_objDispArea); 747 RegisterCommand(1, 81, 1037, "objSetDigits", (CmdImpl) &Grp::impl_objSetDigits); 748 RegisterCommand(1, 82, 1037, "objBgSetDigits", (CmdImpl) &Grp::impl_objSetDigits); 749 RegisterCommand(1, 81, 1038, "objNumOpts", (CmdImpl) &Grp::impl_objNumOpts); 750 RegisterCommand(1, 82, 1038, "objBgNumOpts", (CmdImpl) &Grp::impl_objNumOpts); 751 RegisterCommand(1, 81, 1039, "objPattNo", (CmdImpl) &Grp::impl_objPattNo); 752 RegisterCommand(1, 82, 1039, "objBgPattNo", (CmdImpl) &Grp::impl_objPattNo); 753 RegisterCommand(1, 81, 1046, "objScale", (CmdImpl) &Grp::impl_objScale); //FIXME: Broken behaviour 754 RegisterCommand(1, 82, 1046, "objBgScale", (CmdImpl) &Grp::impl_objScale); 995 755 RegisterCommand(1, 81, 1047, "objWidth", NULL); 996 756 RegisterCommand(1, 82, 1047, "objBgWidth", NULL); 997 RegisterCommand(1, 81, 1049, "objRotate", (CmdImpl) &Grp Impl::impl_objRotate);998 RegisterCommand(1, 82, 1049, "objBgRotate", (CmdImpl) &Grp Impl::impl_objRotate);999 1000 RegisterCommand(2, 81, 1000, "childObjMove", (CmdImpl) &Grp Impl::impl_objSetPos);1001 RegisterCommand(2, 82, 1000, "childObjBgMove", (CmdImpl) &Grp Impl::impl_objSetPos);757 RegisterCommand(1, 81, 1049, "objRotate", (CmdImpl) &Grp::impl_objRotate); 758 RegisterCommand(1, 82, 1049, "objBgRotate", (CmdImpl) &Grp::impl_objRotate); 759 760 RegisterCommand(2, 81, 1000, "childObjMove", (CmdImpl) &Grp::impl_objSetPos); 761 RegisterCommand(2, 82, 1000, "childObjBgMove", (CmdImpl) &Grp::impl_objSetPos); 1002 762 RegisterCommand(2, 81, 1001, "childObjLeft", NULL); 1003 763 RegisterCommand(2, 82, 1001, "childObjBgLeft", NULL); 1004 764 RegisterCommand(2, 81, 1002, "childObjTop", NULL); 1005 765 RegisterCommand(2, 82, 1002, "childObjBgTop", NULL); 1006 RegisterCommand(2, 81, 1003, "childObjAlpha", (CmdImpl) &Grp Impl::impl_objAlpha);1007 RegisterCommand(2, 82, 1003, "childObjBgAlpha", (CmdImpl) &Grp Impl::impl_objAlpha);1008 RegisterCommand(2, 81, 1004, "childObjShow", (CmdImpl) &Grp Impl::impl_objShow);1009 RegisterCommand(2, 82, 1004, "childObjBgShow", (CmdImpl) &Grp Impl::impl_objShow);766 RegisterCommand(2, 81, 1003, "childObjAlpha", (CmdImpl) &Grp::impl_objAlpha); 767 RegisterCommand(2, 82, 1003, "childObjBgAlpha", (CmdImpl) &Grp::impl_objAlpha); 768 RegisterCommand(2, 81, 1004, "childObjShow", (CmdImpl) &Grp::impl_objShow); 769 RegisterCommand(2, 82, 1004, "childObjBgShow", (CmdImpl) &Grp::impl_objShow); 1010 770 RegisterCommand(2, 81, 1005, "childObjDispArea", NULL); 1011 771 RegisterCommand(2, 82, 1005, "childObjBgDispArea", NULL); 1012 RegisterCommand(2, 81, 1006, "childObjAdjust", (CmdImpl) &Grp Impl::impl_objSetPos);1013 RegisterCommand(2, 82, 1006, "childObjBgAdjust", (CmdImpl) &Grp Impl::impl_objSetPos);772 RegisterCommand(2, 81, 1006, "childObjAdjust", (CmdImpl) &Grp::impl_objSetPos); 773 RegisterCommand(2, 82, 1006, "childObjBgAdjust", (CmdImpl) &Grp::impl_objSetPos); 1014 774 RegisterCommand(2, 81, 1007, "childObjAdjustX", NULL); 1015 775 RegisterCommand(2, 82, 1007, "childObjBgAdjustX", NULL); … … 1030 790 RegisterCommand(2, 81, 1021, "childObjComposite", NULL); 1031 791 RegisterCommand(2, 82, 1021, "childObjBgComposite", NULL); 1032 RegisterCommand(2, 81, 1024, "childObjSetText", (CmdImpl) &Grp Impl::impl_objSetText);1033 RegisterCommand(2, 82, 1024, "childObjBgSetText", (CmdImpl) &Grp Impl::impl_objSetText);1034 RegisterCommand(2, 81, 1025, "childObjTextOpts", (CmdImpl) &Grp Impl::impl_objTextOpts);1035 RegisterCommand(2, 82, 1025, "childObjBgTextOpts", (CmdImpl) &Grp Impl::impl_objTextOpts);792 RegisterCommand(2, 81, 1024, "childObjSetText", (CmdImpl) &Grp::impl_objSetText); 793 RegisterCommand(2, 82, 1024, "childObjBgSetText", (CmdImpl) &Grp::impl_objSetText); 794 RegisterCommand(2, 81, 1025, "childObjTextOpts", (CmdImpl) &Grp::impl_objTextOpts); 795 RegisterCommand(2, 82, 1025, "childObjBgTextOpts", (CmdImpl) &Grp::impl_objTextOpts); 1036 796 RegisterCommand(2, 81, 1032, "childObjOrder", NULL); 1037 797 RegisterCommand(2, 82, 1032, "childObjBgOrder", NULL); 1038 798 RegisterCommand(2, 81, 1034, "childObjDispRect", NULL); 1039 799 RegisterCommand(2, 82, 1034, "childObjBgDispRect", NULL); 1040 RegisterCommand(2, 81, 1037, "childObjSetDigits", (CmdImpl) &Grp Impl::impl_objSetDigits);1041 RegisterCommand(2, 82, 1037, "childObjBgSetDigits", (CmdImpl) &Grp Impl::impl_objSetDigits);1042 RegisterCommand(2, 81, 1038, "childObjNumOpts", (CmdImpl) &Grp Impl::impl_objNumOpts);1043 RegisterCommand(2, 82, 1038, "childObjBgNumOpts", (CmdImpl) &Grp Impl::impl_objNumOpts);1044 RegisterCommand(2, 81, 1039, "childObjPattNo", (CmdImpl) &Grp Impl::impl_objPattNo);1045 RegisterCommand(2, 82, 1039, "childObjBgPattNo", (CmdImpl) &Grp Impl::impl_objPattNo);1046 RegisterCommand(2, 81, 1046, "childObjScale", (CmdImpl) &Grp Impl::impl_objScale);1047 RegisterCommand(2, 82, 1046, "childObjBgScale", (CmdImpl) &Grp Impl::impl_objScale);800 RegisterCommand(2, 81, 1037, "childObjSetDigits", (CmdImpl) &Grp::impl_objSetDigits); 801 RegisterCommand(2, 82, 1037, "childObjBgSetDigits", (CmdImpl) &Grp::impl_objSetDigits); 802 RegisterCommand(2, 81, 1038, "childObjNumOpts", (CmdImpl) &Grp::impl_objNumOpts); 803 RegisterCommand(2, 82, 1038, "childObjBgNumOpts", (CmdImpl) &Grp::impl_objNumOpts); 804 RegisterCommand(2, 81, 1039, "childObjPattNo", (CmdImpl) &Grp::impl_objPattNo); 805 RegisterCommand(2, 82, 1039, "childObjBgPattNo", (CmdImpl) &Grp::impl_objPattNo); 806 RegisterCommand(2, 81, 1046, "childObjScale", (CmdImpl) &Grp::impl_objScale); 807 RegisterCommand(2, 82, 1046, "childObjBgScale", (CmdImpl) &Grp::impl_objScale); 1048 808 RegisterCommand(2, 81, 1047, "childObjWidth", NULL); 1049 809 RegisterCommand(2, 82, 1047, "childObjBgWidth", NULL); … … 1051 811 RegisterCommand(2, 82, 1049, "childObjBgRotate", NULL); 1052 812 1053 RegisterCommand(1, 84, 1000, "objGetPos", (CmdImpl) &Grp Impl::impl_objPosDims);1054 RegisterCommand(1, 84, 1100, "objGetDims", (CmdImpl) &Grp Impl::impl_objPosDims);1055 1056 RegisterCommand(2, 84, 1000, "childObjGetPos", (CmdImpl) &Grp Impl::impl_objPosDims);1057 RegisterCommand(2, 84, 1100, "childObjGetDims", (CmdImpl) &Grp Impl::impl_objPosDims);1058 1059 RegisterCommand(1, 31, 0, "refresh", (CmdImpl) &Grp Impl::impl_refresh);1060 1061 RegisterCommand(1, 20, 0, "bgmLoop", (CmdImpl) &Grp Impl::impl_bgmLoop);1062 RegisterCommand(1, 20, 1, "bgmPlayEx", (CmdImpl) &Grp Impl::impl_bgmLoop); //FIXME: wait1063 RegisterCommand(1, 20, 2, "bgmPlay", (CmdImpl) &Grp Impl::impl_bgmLoop);1064 RegisterCommand(1, 20, 5, "bgmStop", (CmdImpl) &Grp Impl::impl_bgmStop);1065 RegisterCommand(1, 20, 105, "bgmFadeOut", (CmdImpl) &Grp Impl::impl_bgmStop);1066 1067 RegisterCommand(1, 21, 0, "wavPlay", (CmdImpl) &Grp Impl::impl_playWav);1068 RegisterCommand(1, 21, 1, "wavPlayEx", (CmdImpl) &Grp Impl::impl_playWav);1069 RegisterCommand(1, 21, 2, "wavLoop", (CmdImpl) &Grp Impl::impl_playWav);813 RegisterCommand(1, 84, 1000, "objGetPos", (CmdImpl) &Grp::impl_objPosDims); 814 RegisterCommand(1, 84, 1100, "objGetDims", (CmdImpl) &Grp::impl_objPosDims); 815 816 RegisterCommand(2, 84, 1000, "childObjGetPos", (CmdImpl) &Grp::impl_objPosDims); 817 RegisterCommand(2, 84, 1100, "childObjGetDims", (CmdImpl) &Grp::impl_objPosDims); 818 819 RegisterCommand(1, 31, 0, "refresh", (CmdImpl) &Grp::impl_refresh); 820 821 RegisterCommand(1, 20, 0, "bgmLoop", (CmdImpl) &Grp::impl_bgmLoop); 822 RegisterCommand(1, 20, 1, "bgmPlayEx", (CmdImpl) &Grp::impl_bgmLoop); //FIXME: wait 823 RegisterCommand(1, 20, 2, "bgmPlay", (CmdImpl) &Grp::impl_bgmLoop); 824 RegisterCommand(1, 20, 5, "bgmStop", (CmdImpl) &Grp::impl_bgmStop); 825 RegisterCommand(1, 20, 105, "bgmFadeOut", (CmdImpl) &Grp::impl_bgmStop); 826 827 RegisterCommand(1, 21, 0, "wavPlay", (CmdImpl) &Grp::impl_playWav); 828 RegisterCommand(1, 21, 1, "wavPlayEx", (CmdImpl) &Grp::impl_playWav); 829 RegisterCommand(1, 21, 2, "wavLoop", (CmdImpl) &Grp::impl_playWav); 1070 830 RegisterCommand(1, 21, 3, "wavWait", NULL); 1071 831 RegisterCommand(1, 21, 4, "wavPlaying", NULL); 1072 RegisterCommand(1, 21, 5, "wavStop", (CmdImpl) &Grp Impl::impl_stopWav);1073 RegisterCommand(1, 21, 105, "wavFadeout", (CmdImpl) &Grp Impl::impl_stopWav);1074 1075 RegisterCommand(1, 22, 0, "sePlay", (CmdImpl) &Grp Impl::impl_playSE);1076 1077 RegisterCommand(1, 4, 2230, "SetBgmVolMod", (CmdImpl) &Grp Impl::impl_SetVolMod);1078 RegisterCommand(1, 4, 2231, "SetKoeVolMod", (CmdImpl) &Grp Impl::impl_SetVolMod);1079 RegisterCommand(1, 4, 2232, "SetPCMVolMod", (CmdImpl) &Grp Impl::impl_SetVolMod);1080 RegisterCommand(1, 4, 2233, "SetSeVolMod", (CmdImpl) &Grp Impl::impl_SetVolMod);1081 RegisterCommand(1, 4, 2330, "BgmVolMod", (CmdImpl) &Grp Impl::impl_GetVolMod);1082 RegisterCommand(1, 4, 2331, "KoeVolMod", (CmdImpl) &Grp Impl::impl_GetVolMod);1083 RegisterCommand(1, 4, 2332, "PCMVolMod", (CmdImpl) &Grp Impl::impl_GetVolMod);1084 RegisterCommand(1, 4, 2333, "SeVolMod", (CmdImpl) &Grp Impl::impl_GetVolMod);1085 1086 RegisterCommand(1, 23, 0, "koePlay", (CmdImpl) &Grp Impl::impl_koePlay);1087 RegisterCommand(1, 23, 1, "koePlayEx", (CmdImpl) &Grp Impl::impl_koePlay); //FIXME1088 RegisterCommand(1, 23, 7, "koePlayExC", (CmdImpl) &Grp Impl::impl_koePlay); //FIXME1089 RegisterCommand(1, 23, 8, "koeDoPlay", (CmdImpl) &Grp Impl::impl_koePlay); //FIXME1090 RegisterCommand(1, 23, 9, "koeDoPlayEx", (CmdImpl) &Grp Impl::impl_koePlay); //FIXME1091 RegisterCommand(1, 23, 10, "koeDoPlayExC", (CmdImpl) &Grp Impl::impl_koePlay); //FIXME1092 1093 RegisterCommand(1, 26, 1, "movPlayEx", (CmdImpl) &Grp Impl::impl_movPlay);1094 RegisterCommand(1, 26, 20, "movPlayExC", (CmdImpl) &Grp Impl::impl_movPlay);832 RegisterCommand(1, 21, 5, "wavStop", (CmdImpl) &Grp::impl_stopWav); 833 RegisterCommand(1, 21, 105, "wavFadeout", (CmdImpl) &Grp::impl_stopWav); 834 835 RegisterCommand(1, 22, 0, "sePlay", (CmdImpl) &Grp::impl_playSE); 836 837 RegisterCommand(1, 4, 2230, "SetBgmVolMod", (CmdImpl) &Grp::impl_SetVolMod); 838 RegisterCommand(1, 4, 2231, "SetKoeVolMod", (CmdImpl) &Grp::impl_SetVolMod); 839 RegisterCommand(1, 4, 2232, "SetPCMVolMod", (CmdImpl) &Grp::impl_SetVolMod); 840 RegisterCommand(1, 4, 2233, "SetSeVolMod", (CmdImpl) &Grp::impl_SetVolMod); 841 RegisterCommand(1, 4, 2330, "BgmVolMod", (CmdImpl) &Grp::impl_GetVolMod); 842 RegisterCommand(1, 4, 2331, "KoeVolMod", (CmdImpl) &Grp::impl_GetVolMod); 843 RegisterCommand(1, 4, 2332, "PCMVolMod", (CmdImpl) &Grp::impl_GetVolMod); 844 RegisterCommand(1, 4, 2333, "SeVolMod", (CmdImpl) &Grp::impl_GetVolMod); 845 846 RegisterCommand(1, 23, 0, "koePlay", (CmdImpl) &Grp::impl_koePlay); 847 RegisterCommand(1, 23, 1, "koePlayEx", (CmdImpl) &Grp::impl_koePlay); //FIXME 848 RegisterCommand(1, 23, 7, "koePlayExC", (CmdImpl) &Grp::impl_koePlay); //FIXME 849 RegisterCommand(1, 23, 8, "koeDoPlay", (CmdImpl) &Grp::impl_koePlay); //FIXME 850 RegisterCommand(1, 23, 9, "koeDoPlayEx", (CmdImpl) &Grp::impl_koePlay); //FIXME 851 RegisterCommand(1, 23, 10, "koeDoPlayExC", (CmdImpl) &Grp::impl_koePlay); //FIXME 852 853 RegisterCommand(1, 26, 1, "movPlayEx", (CmdImpl) &Grp::impl_movPlay); 854 RegisterCommand(1, 26, 20, "movPlayExC", (CmdImpl) &Grp::impl_movPlay); 1095 855 1096 856 RegisterCommand(1, 61, 14, "objSwap?", NULL); … … 1105 865 } 1106 866 1107 GrpImpl::~GrpImpl() { 1108 867 Grp::~Grp() { 1109 868 map<int,GrpObj>::iterator it; 1110 869 for (it=grpobj.begin(); it!=grpobj.end(); it++) { … … 1124 883 } 1125 884 1126 Surface* Grp Impl::Dsurface(int pdt) {885 Surface* Grp::Dsurface(int pdt) { 1127 886 if (pdt == 0) return surface; 1128 887 if (dsurface[pdt] == 0) { // €È€ê€¢€š€º²èÌÌ€ÎÂ瀀µ€È€€€Š€³€È€Ë€¹€ë … … 1140 899 } 1141 900 1142 GrpObj* Grp Impl::GetGraphicObj(int grp, bool fg) {901 GrpObj* Grp::GetGraphicObj(int grp, bool fg) { 1143 902 if (fg) 1144 903 return &grpobj[grp]; … … 1147 906 } 1148 907 1149 GrpObj* Grp Impl::GetGraphicObj(int grp, int index, bool fg) {908 GrpObj* Grp::GetGraphicObj(int grp, int index, bool fg) { 1150 909 GrpObj* g = GetGraphicObj(grp, fg); 1151 910 return &g->children_obj[index]; 1152 911 } 1153 912 1154 GrpObj* Grp Impl::GetGraphicObjVarMode(Cmd& cmd, int &base_arg, bool fg) {913 GrpObj* Grp::GetGraphicObjVarMode(Cmd& cmd, int &base_arg, bool fg) { 1155 914 GrpObj* g; 1156 915 if (cmd.cmd1 == 2) { … … 1164 923 1165 924 #include <SDL.h> 1166 Surface* Grp Impl::Ssurface(int pdt) {925 Surface* Grp::Ssurface(int pdt) { 1167 926 if (pdt == 0) return surface; 1168 927 if (ssurface[pdt]) { … … 1172 931 } 1173 932 1174 void Grp Impl::LoadSurface(const char* str, int pdt) {933 void Grp::LoadSurface(const char* str, int pdt) { 1175 934 string s = str; 1176 935 if (cgm_info.find(s) != cgm_info.end()) { … … 1202 961 } 1203 962 1204 void Grp Impl::InitSel(void) {963 void Grp::InitSel(void) { 1205 964 int i; 1206 965 int args[16]; … … 1229 988 } 1230 989 1231 void Grp Impl::SetSkipMode(SkipMode _mode) {990 void Grp::SetSkipMode(SkipMode _mode) { 1232 991 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) { 1233 992 RefreshObj(); … … 1237 996 } 1238 997 1239 void Grp Impl::SetObjChanged(int num) {998 void Grp::SetObjChanged(int num) { 1240 999 changed_obj.insert(num); 1241 1000 } 1242 1001 1243 void Grp Impl::RefreshObj(void) {1002 void Grp::RefreshObj(void) { 1244 1003 if (!deleted_pic.empty()) { 1245 1004 vector<PicBase*>::iterator it; … … 1267 1026 1268 1027 #include <SDL.h> 1269 void Grp Impl::StartAnm(int type) {1028 void Grp::StartAnm(int type) { 1270 1029 SEL sel; 1271 1030 … … 1349 1108 } 1350 1109 1351 void Grp Impl::StartShake(int total, const int* pattern) {1110 void Grp::StartShake(int total, const int* pattern) { 1352 1111 if (anm2) { 1353 1112 fprintf(stderr,"Warning: StartShake() called before another animation finished\n"); … … 1372 1131 } 1373 1132 1374 void Grp Impl::AbortAnm(void) {1133 void Grp::AbortAnm(void) { 1375 1134 if (anm1 == NULL) return; 1376 1135 anm1->Abort(); … … 1393 1152 } 1394 1153 1395 void Grp Impl::LoadSurface(const char* str) {1154 void Grp::LoadSurface(const char* str) { 1396 1155 if (anm1 != NULL) AbortAnm(); // Á°€ÎÉÁ²è€¬œª€ï€Ã€Æ€Ê€±€ì€Ð¶¯À©œªÎ» 1397 1156 LoadSurface(str, 1); … … 1399 1158 } 1400 1159 1401 void Grp Impl::LoadSurface(void) {1160 void Grp::LoadSurface(void) { 1402 1161 if (anm1 != NULL) AbortAnm(); // Á°€ÎÉÁ²è€¬œª€ï€Ã€Æ€Ê€±€ì€Ð¶¯À©œªÎ» 1403 1162 LoadSurface(bg_name.c_str(), 1); 1404 1163 } 1405 1164 1406 void Grp Impl::AddSurface(const char* str) {1165 void Grp::AddSurface(const char* str) { 1407 1166 if (anm1 != NULL) AbortAnm(); // Á°€ÎÉÁ²è€¬œª€ï€Ã€Æ€Ê€±€ì€Ð¶¯À©œªÎ» 1408 1167 LoadSurface(bg_name.c_str()); … … 1422 1181 } 1423 1182 1424 void Grp Impl::CreateObj(int index) {1183 void Grp::CreateObj(int index) { 1425 1184 GrpObjMap::iterator cur = grpobj.find(index); 1426 1185 if (cur == grpobj.end()) return; … … 1434 1193 } 1435 1194 1436 void Grp Impl::CreateSubObj(int grp_index, int index) {1195 void Grp::CreateSubObj(int grp_index, int index) { 1437 1196 GrpObjMap::iterator cur = grpobj.find(grp_index); 1438 1197 if (cur == grpobj.end()) return; … … 1450 1209 } 1451 1210 1452 void Grp Impl::ZMoveObj(int index) {1211 void Grp::ZMoveObj(int index) { 1453 1212 GrpObjMap::iterator cur = grpobj.find(index); 1454 1213 if (cur == grpobj.end()) return; … … 1477 1236 } 1478 1237 1479 void Grp Impl::SwapObj(int index1, int index2) {1238 void Grp::SwapObj(int index1, int index2) { 1480 1239 // ¥Ç¥Õ¥©¥ë¥ÈÃÍ€«€é order €¬Êѹ¹€µ€ì€Æ€€€¿Ÿì¹ç€Î€ß¡¢order €ÏÊÝž€µ€ì€ë 1481 1240 // €Þ€º€ÏΟÊý€Îobject€òswap … … 1512 1271 } 1513 1272 1514 bool Grp Impl::Pressed(int x, int y, void* pointer) { // ¥Þ¥Š¥¹¥¯¥ê¥Ã¥¯€Ç¥¥ã¥ó¥»¥ë1515 Grp Impl* g = (GrpImpl*)pointer;1273 bool Grp::Pressed(int x, int y, void* pointer) { // ¥Þ¥Š¥¹¥¯¥ê¥Ã¥¯€Ç¥¥ã¥ó¥»¥ë 1274 Grp* g = (Grp*)pointer; 1516 1275 if (g->status == WAIT_MOVIE) 1517 1276 g->music->StopMovie(); … … 1562 1321 }; 1563 1322 1564 void Grp Impl::LoadCgm() {1323 void Grp::LoadCgm() { 1565 1324 /* cgm ¥Õ¥¡¥€¥ëÆÉ€ß¹þ€ß */ 1566 1325 const char* fname = config->GetParaStr("#CGTABLE_FILE"); … … 1602 1361 /***************************************************** 1603 1362 * 1604 * Grp Impl:: Save, Load : ¥»¡Œ¥Ö¥Õ¥¡¥€¥ëœèÍý1363 * Grp :: Save, Load : ¥»¡Œ¥Ö¥Õ¥¡¥€¥ëœèÍý 1605 1364 * 1606 1365 */ 1607 void Grp Impl::Save(std::string& str) {1608 } 1609 1610 void Grp Impl::Load(const char* str) {1366 void Grp::Save(std::string& str) { 1367 } 1368 1369 void Grp::Load(const char* str) { 1611 1370 status = NORMAL; 1612 1371 if (anm1 != NULL) { … … 1629 1388 } 1630 1389 1631 void Grp Impl::SaveSys(string& save) {1390 void Grp::SaveSys(string& save) { 1632 1391 char buf[1024]; 1633 1392 save = "\n[Graphics]\n"; … … 1642 1401 } 1643 1402 1644 void Grp Impl::LoadSys(const char* save) {1403 void Grp::LoadSys(const char* save) { 1645 1404 cgm_data.clear(); 1646 1405 save = strstr(save, "\n[Graphics]\n"); … … 1669 1428 /***************************************************** 1670 1429 * 1671 * Grp Impl:: Wait , Exec : ¥³¥Þ¥ó¥ÉŒÂ¹ÔÉô1430 * Grp :: Wait , Exec : ¥³¥Þ¥ó¥ÉŒÂ¹ÔÉô 1672 1431 * 1673 1432 */ … … 1675 1434 static int draw_n = 0; 1676 1435 extern bool grpdump_req; 1677 bool Grp Impl::Wait(unsigned int current_time, Cmd& cmd) {1436 bool Grp::Wait(unsigned int current_time, Cmd& cmd) { 1678 1437 if (grpdump_req) { 1679 1438 grpdump_req = 0; … … 1752 1511 } 1753 1512 1754 void Grp Impl::DeleteObjPic(int num) { // object €Î surface €Î€ßºïœü1513 void Grp::DeleteObjPic(int num) { // object €Î surface €Î€ßºïœü 1755 1514 if (grpobj.find(num) == grpobj.end()) return; 1756 1515 deleted_pic.push_back(grpobj[num].DeletePic()); 1757 1516 } 1758 1517 1759 void Grp Impl::DeleteSubObjPic(int num_grp, int num) {1518 void Grp::DeleteSubObjPic(int num_grp, int num) { 1760 1519 if (grpobj.find(num_grp) == grpobj.end()) return; 1761 1520 if (grpobj[num_grp].children_obj.find(num) == grpobj[num_grp].children_obj.end()) return; … … 1763 1522 } 1764 1523 1765 void Grp Impl::DeleteObj(int num) {1524 void Grp::DeleteObj(int num) { 1766 1525 if (grpobj.find(num) == grpobj.end()) return; 1767 1526 deleted_pic.push_back(grpobj[num].DeletePic()); … … 1773 1532 } 1774 1533 1775 void Grp Impl::DeleteSubObj(int num_grp, int num) {1534 void Grp::DeleteSubObj(int num_grp, int num) { 1776 1535 if (grpobj.find(num_grp) == grpobj.end()) return; 1777 1536 if (grpobj[num_grp].children_obj.find(num) == grpobj[num_grp].children_obj.end()) return; … … 1780 1539 } 1781 1540 1782 void GrpImpl::impl_stackClear (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) { 1541 void Grp::Exec(Cmd& cmd) { 2518 1542 if (cmd.cmd_type == CMD_TEXTEND) { 2519 1543 music->StopKoe(500); // ¥Æ¥¥¹¥ÈœªÎ»€ÇÀŒ€ò»ß€á€ë … … 2556 1580 } 2557 1581 2558 2559 /********************************************************2560 **2561 ** class Grp2562 */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 } -
scn2k/scn2k_text.cc
r55 r56 10 10 Flush €¹€ë€È¥Ð¥Ã¥Õ¥¡Æâ€ÎÊž»ú€ò€¹€Ù€ÆÉÁ²è€¹€ë 11 11 Wait €¹€ë€ÈÁŽÉÁ²èžå¡¢¥¯¥ê¥Ã¥¯€µ€ì€ë€Þ€Ç¥«¡Œ¥œ¥ë€òÉœŒš€¹€ë€Þ€ÇÂÔ€Ä 12 Text ImplŠ€ÎŸõÂրȀ·€Æ€Ï Wait €Î€ß€ò»ý€Ä (PREPARE€ËÌá€ë€Î€òÂÔ€Ä)12 Text Š€ÎŸõÂրȀ·€Æ€Ï Wait €Î€ß€ò»ý€Ä (PREPARE€ËÌá€ë€Î€òÂÔ€Ä) 13 13 €¿€À€·¡¢Skip €Îž¢Íø€Ï€É€Ã€Á€¬€â€Ä¡©¡ÊžœŸõ€Ï¡©¡Ë 14 14 … … 56 56 */ 57 57 58 #include "window/event.h" 59 #include "window/picture.h" 60 #include "window/widget.h" 58 #include "scn2k_text.h" 59 61 60 #include "system/file.h" 62 #include "system/system_config.h"63 61 #include "scn2k.h" 64 62 … … 66 64 using namespace std; 67 65 68 // kanji conv : ¥Ç¥Ð¥Ã¥°ÉœŒšÍÑ 69 void kconv(const unsigned char* src, unsigned char* dest); 70 void kconv_rev(const unsigned char* src, unsigned char* dest); 71 string kconv(const string& s); 72 string kconv_rev(const string& s); 73 // render.cc 74 void DSurfaceFillA(Surface* src, const Rect& rect, int r, int g, int b, int a); // ¥Æ¥¥¹¥È¥Š¥£¥ó¥É¥ŠÇØ·Ê€ÎÀßÄê 75 void DSurfaceMove(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstrect); // ¥³¥Ô¡Œ 66 #include "window/render.h" 76 67 77 68 /**************************************************************:: 78 69 ** 79 ** Text Impl(interface)70 ** Text(implementation) 80 71 */ 81 struct TimerAtom { 82 int from; 83 int to; 84 unsigned int start_time; 85 unsigned int total_time; 86 }; 87 88 struct TextWindow { 89 /* @@@ : SetWindowColor €Ç€Î surface ºÆÀßÄê€ËÃí°Õ */ 90 WidText* wid; 91 bool name_visible; 92 WidLabel* name; 93 PicContainer* name_container; 94 PicBase* face; 95 PicBase* face_pics[8]; 96 TextWindow(PicContainer& parent, Event::Container& event, int window_no, void* callback); 97 ~TextWindow() { 98 if (name_container != NULL) { 99 delete name_container; 100 name_container = NULL; 101 } 102 int i; 103 for (i=0; i<8; i++) { 104 if (face_pics[i] != NULL) { 105 delete face_pics[i]; 106 face_pics[i] = NULL; 107 } 108 } 109 if (wid != NULL) { 110 delete wid; 111 wid = NULL; 112 } 113 } 114 Rect WakuSize(PicContainer& pic, int waku_no); 115 void MakeWaku(PicContainer& pic, Event::Container& event, int waku_no,int window_no, bool* use_btn, void* callback); 116 void show(void) { 117 wid->show(); 118 if (name_container && name_visible) name_container->show(); 119 if (face) face->show(); 120 } 121 void hide(void) { 122 wid->hide(); 123 if (name_container) name_container->hide(); 124 if (face) face->hide(); 125 } 126 void ShowFace(const char* path) { 127 if (!face) return; 128 face->SetSurface( path, 0,0); 129 } 130 void ResetFace(void) { 131 if (!face) return; 132 face->SetSurface( (Surface*)0, 0,0); 133 } 134 void StartText(const TextStream& _stream) { 135 wid->Clear(); 136 wid->stream = _stream; 137 if (name_container) { 138 char namestr[1024]; 139 namestr[0] = 0; 140 wid->stream.RemoveName(namestr, 1024); 141 if (namestr[0] == 0) { 142 name_container->hide(); 143 } else { 144 if (name) { 145 name_container->show_all(); 146 name->SetText(namestr); 147 } 148 } 149 } 150 wid->Start(); 151 } 152 void SetName(const char* n) { 153 if (name_container && name) { 154 if (n[0]) { 155 name_container->show(); 156 name->SetText(n); 157 name_visible = true; 158 } else { 159 name_container->hide(); 160 name_visible = false; 161 } 162 } 163 } 164 }; 165 166 class TextImpl : public CommandHandler { 167 public: 168 TextImpl(Event::Container& _event, PicContainer& _parent, vector<BacklogItem>& parent_backlog, BacklogItem& parent_backlog_item); 169 ~TextImpl(); 170 void InitWindow(void); 171 void SetWindowColor(int r, int g, int b, int a, bool is_transparent); 172 void SetTextSpeed(int new_speed); 173 void SetTextWait(int new_wait); 174 void CreateSelect(Cmd& cmd); 175 void Exec(Cmd& cmd); 176 bool Wait(unsigned int current_time, Cmd& cmd); 177 void hide(void); 178 void show(void) { show(text_window_number); } 179 void show(int num); 180 void DrawBacklog(BacklogItem& item, Cmd& cmd); 181 void Save(std::string& str, bool select_save); 182 void Load(const char* str); 183 void SetSkipMode(SkipMode _mode); 184 void CreateSelBG(void); 185 186 void AddText(const char* str); 187 188 static void PressFuncSkip(void* pointer, WidButton* from); 189 static void PressFuncLoad(void* pointer, WidButton* from); 190 static void PressFuncSave(void* pointer, WidButton* from); 191 static void PressFuncBacklog(void* pointer, WidButton* from); 192 static void PressFuncBacklogFwd(void* pointer, WidButton* from); 193 194 private: 195 static void PressFuncButton(void* pointer, WidButton* from); 196 static bool PressFunc(int x, int y, void* pointer); 197 void SetCursor(int num); 198 199 public: 200 TextWindow* text; 201 typedef enum {NORMAL=0, WAIT_TEXT=1, WAIT=2, 202 WAIT_CLICK=3, WAIT_ABORT=4, WAIT_CLICK_MOUSEPOS = 5, 203 WAIT_CLICK_MOUSEPOSEND_L = 6, WAIT_CLICK_MOUSEPOSEND_R = 7, 204 WAIT_SELECT_INBOX = 10, WAIT_SELECT_OUTBOX=11, WAIT_SELECT_VALUE = 12, 205 WAIT_EXTRN_MASK = 64, SAVEMASK = 128, LOADMASK = 256, SKIPMASK = 512, 206 CLEARSCR_MASK = 1024, STATSAVE_MASK = 2048, CLEARSCR_WAIT_MASK=(1<<12), 207 SKIPEND_MASK = (1<<13), BACKLOG_MASK=(1<<14), BACKLOG_MASK_FWD=(1<<15), 208 BACKLOG_MASK_KOE=(1<<16), BACKLOG_WAIT_MASK=(1<<17), 209 ALLMASK = (CLEARSCR_MASK | WAIT_EXTRN_MASK | SAVEMASK | 210 LOADMASK | SKIPMASK | BACKLOG_MASK | BACKLOG_MASK_FWD | 211 BACKLOG_MASK_KOE | BACKLOG_WAIT_MASK | STATSAVE_MASK | 212 CLEARSCR_WAIT_MASK | SKIPEND_MASK) 213 } Status; 214 Status status, status_saved, status_mask; 215 216 private: 217 std::string ruby_text; 218 bool ruby_text_flag; 219 unsigned int wait_time; 220 unsigned int old_time; 221 unsigned int base_time; 222 int text_window_number; 223 bool text_parsing; 224 TextStream text_stream; 225 SkipMode skip_mode; 226 int save_selectcount; 227 228 std::map<int, TimerAtom> timer_var; 229 std::vector<WidTextButton*> selects; 230 std::vector<int> sel_backlog_pos; 231 string replace_name[26]; 232 string replace_name2[26]; 233 PicContainer* sel_widget; 234 PicWidget* backlog_widget; 235 236 vector<BacklogItem>& backlog; 237 BacklogItem& backlog_item; 238 BacklogItem cur_backlog_item; 239 BacklogItem drawn_backlog_item; 240 241 TextWindow* widgets[32]; 242 WidTimeCursor* kcursor; 243 Surface* sel_bg1; 244 Surface* sel_bg2; 245 Rect sel_bg_rect; 246 247 VarInfo wait_savedvar[2]; 248 249 AyuSysConfig *config; 250 251 Event::Container& event; 252 PicContainer& parent; 253 254 //Opcode handling 255 void impl_txtClear(Cmd& cmd); 256 void impl_logKoe(Cmd& cmd); 257 void impl_pause(Cmd& cmd); 258 void impl_br(Cmd& cmd); 259 void impl_FaceOpen(Cmd& cmd); 260 void impl_FaceClear(Cmd& cmd); 261 }; 262 263 /**************************************************************:: 264 ** 265 ** TextImpl(implementation) 266 */ 267 TextImpl::TextImpl(Event::Container& _event, PicContainer& _parent, vector<BacklogItem>& parent_backlog, BacklogItem& parent_backlog_item) : 268 text(0),status(TextImpl::NORMAL), status_saved(TextImpl::NORMAL), status_mask(TextImpl::NORMAL), ruby_text_flag(false), 72 Text::Text(Event::Container& _event, PicContainer& _parent) : 73 text(0),status(Text::NORMAL), status_saved(Text::NORMAL), status_mask(Text::NORMAL), ruby_text_flag(false), 269 74 old_time(0), base_time(0), text_window_number(0), text_parsing(false), skip_mode(SKIP_NO), save_selectcount(0), sel_widget(0), 270 backlog_widget(0), backlog(parent_backlog), backlog_item(parent_backlog_item),parent(_parent), event(_event),75 backlog_widget(0), parent(_parent), event(_event), 271 76 kcursor(0), sel_bg1(0), sel_bg2(0), sel_bg_rect(0,0,0,0) { 272 77 config = AyuSysConfig::GetInstance(); … … 278 83 event.RegisterGlobalPressFunc(&PressFunc, (void*)this); 279 84 280 RegisterCommand(1, 33, 73, "grpOpenBg", (CmdImpl) &TextImpl::impl_txtClear); 281 RegisterCommand(1, 33, 75, "grpMulti", (CmdImpl) &TextImpl::impl_txtClear); 282 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &TextImpl::impl_txtClear); 283 284 RegisterCommand(1, 23, 0, "koePlay", (CmdImpl) &TextImpl::impl_logKoe); 285 RegisterCommand(1, 23, 8, "koeDoPlay", (CmdImpl) &TextImpl::impl_logKoe); 286 287 RegisterCommand(0, 3, 151, "msgHide", (CmdImpl) &TextImpl::impl_txtClear); 288 RegisterCommand(0, 3, 17, "pause", (CmdImpl) &TextImpl::impl_pause); 289 RegisterCommand(0, 3, 3, "par", (CmdImpl) &TextImpl::impl_br); //FIXME 290 RegisterCommand(0, 3, 201, "br", (CmdImpl) &TextImpl::impl_br); 291 RegisterCommand(0, 3, 1000, "FaceOpen", (CmdImpl) &TextImpl::impl_FaceOpen); 292 RegisterCommand(0, 3, 1001, "FaceClear", (CmdImpl) &TextImpl::impl_FaceClear); 293 } 294 295 TextImpl::~TextImpl() { 296 if (sel_widget) delete sel_widget; 85 RegisterCommand(1, 33, 73, "grpOpenBg", (CmdImpl) &Text::impl_txtClear); 86 RegisterCommand(1, 33, 75, "grpMulti", (CmdImpl) &Text::impl_txtClear); 87 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &Text::impl_txtClear); 88 89 RegisterCommand(1, 23, 0, "koePlay", (CmdImpl) &Text::impl_logKoe); 90 RegisterCommand(1, 23, 8, "koeDoPlay", (CmdImpl) &Text::impl_logKoe); 91 92 RegisterCommand(0, 3, 151, "msgHide", (CmdImpl) &Text::impl_txtClear); 93 RegisterCommand(0, 3, 17, "pause", (CmdImpl) &Text::impl_pause); 94 RegisterCommand(0, 3, 3, "par", (CmdImpl) &Text::impl_br); //FIXME 95 RegisterCommand(0, 3, 201, "br", (CmdImpl) &Text::impl_br); 96 RegisterCommand(0, 3, 1000, "FaceOpen", (CmdImpl) &Text::impl_FaceOpen); 97 RegisterCommand(0, 3, 1001, "FaceClear", (CmdImpl) &Text::impl_FaceClear); 98 RegisterCommand(0, 3, 120, "__doruby", (CmdImpl) &Text::impl_doRuby); //FIXME: I don't know how it works 99 RegisterCommand(0, 3, 102, "TextWindow", (CmdImpl) &Text::impl_TextWindow); 100 RegisterCommand(0, 3, 103, "FastText", NULL);//FIXME: (CmdImpl) &Text::impl_FastText); 101 RegisterCommand(0, 3, 104, "NormalText", NULL); 102 RegisterCommand(0, 3, 152, "msgClear", (CmdImpl) &Text::impl_msgClear); 103 104 RegisterCommand(0, 2, 1, "select", (CmdImpl) &Text::impl_createSelect); 105 RegisterCommand(0, 2, 3, "select2?", (CmdImpl) &Text::impl_createSelect); //What difference with select? 106 107 RegisterCommand(0, 4, 1000, "ShowBackground", (CmdImpl) &Text::impl_ShowBackground); 108 RegisterCommand(0, 4, 1100, "SetSkipMode", (CmdImpl) &Text::impl_SetSkipMode); 109 RegisterCommand(1, 4, 100, "wait", (CmdImpl) &Text::impl_Wait); 110 RegisterCommand(1, 4, 111, "time", (CmdImpl) &Text::impl_Wait); 111 RegisterCommand(1, 4, 121, "timeEx", (CmdImpl) &Text::impl_Wait); 112 } 113 114 Text::~Text() { 115 if (sel_widget != NULL) 116 delete sel_widget; 297 117 int i; 298 118 for (i=0; i<32; i++) { 299 if (widgets[i]) delete widgets[i]; 300 } 301 if (backlog_widget) delete backlog_widget; 302 if (sel_bg1) parent.Root().DeleteSurface(sel_bg1); 303 if (sel_bg2) parent.Root().DeleteSurface(sel_bg2); 119 if (widgets[i] != NULL) 120 delete widgets[i]; 121 } 122 if (backlog_widget != NULL) 123 delete backlog_widget; 124 if (sel_bg1 != NULL) 125 parent.Root().DeleteSurface(sel_bg1); 126 if (sel_bg2 != NULL) 127 parent.Root().DeleteSurface(sel_bg2); 304 128 event.DeleteGlobalPressFunc(&PressFunc, (void*)this); 305 129 } 306 130 307 bool Text Impl::PressFunc(int x, int y, void* pointer) {308 Text Impl* t = (TextImpl*)pointer;131 bool Text::PressFunc(int x, int y, void* pointer) { 132 Text* t = (Text*)pointer; 309 133 if (t->status == WAIT_CLICK) { 310 134 t->status = WAIT_ABORT; … … 329 153 return true; // event not deleted 330 154 } 331 void TextImpl::PressFuncButton(void* pointer, WidButton* from) { 332 TextImpl* t = (TextImpl*)pointer; 155 156 void Text::PressFuncButton(void* pointer, WidButton* from) { 157 Text* t = (Text*)pointer; 333 158 if (t->status != WAIT_SELECT_INBOX && t->status != WAIT_SELECT_OUTBOX) return; 334 159 vector<WidTextButton*>::iterator it; … … 338 163 } 339 164 if (it == t->selects.end()) { 340 fprintf(stderr,"Text Impl::PressFuncButton: Cannot find select widget\n");165 fprintf(stderr,"Text::PressFuncButton: Cannot find select widget\n"); 341 166 return; 342 167 } 343 168 t->status = Status(WAIT_SELECT_VALUE + sel); 344 return; 345 } 346 347 void TextImpl::SetSkipMode(SkipMode _mode) { 169 } 170 171 void Text::SetSkipMode(SkipMode _mode) { 348 172 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) { 349 173 if (status_mask & BACKLOG_WAIT_MASK) { // backlog mode €«€éÉüµ¢ … … 376 200 } 377 201 378 /* hash_map €¬Í߀·€€¡Ä¡Ä*/ 379 #include <map> 380 #include <list> 381 struct SaveFaceHash { // ¥Ð¥Ã¥¯¥í¥°¥»¡Œ¥Ö»þ€ÎŽé²èÁüŽÉÍý€ò¹Ô€Š 382 map<string, int> facetonum; 383 typedef pair<string,int> Node; 384 typedef list<Node> List; 385 List container; 386 int id_max; 387 static int size_max; 388 SaveFaceHash() : id_max(0) { 389 } 390 void NewNode(string face, int face_id) { 391 facetonum[face] = face_id; 392 container.push_front(Node(face, face_id)); 393 if (container.size() > size_max) { 394 Node remove = container.back(); 395 container.pop_back(); 396 facetonum.erase(remove.first); 397 } 398 } 399 int Add(string face) { 400 int id; int ret = -1; 401 int i; List::iterator it; 402 if (face.empty()) return -1; 403 if (facetonum.find(face) == facetonum.end()) { 404 id = ++id_max; 405 NewNode(face, id); 406 ret = -1; 407 } else { 408 id = facetonum[face]; 409 for (i=0, it=container.begin(); it != container.end(); i++, it++) { 410 if (it->second == id) { 411 ret = i; 412 Node n = *it; 413 container.erase(it); 414 container.push_front(n); 415 break; 416 } 417 } 418 } 419 return ret; 420 } 421 string Get(int num) { 422 if (num < 0) return ""; 423 List::iterator it = container.begin(); 424 for (; it != container.end(); it++) { 425 if (num == 0) return it->first; 426 num--; 427 } 428 return ""; 429 } 430 }; 431 432 int SaveFaceHash::size_max = 20; 433 434 void TextImpl::Save(string& str, bool rollback_save) { 202 void Text::InitWindow(void) { 203 int i; 204 int w; 205 std::string str; 206 207 for (w=0; w<32; w++) { 208 widgets[w] = new TextWindow(parent, event, w, (void*)this); 209 if (widgets[w]->wid == 0) { 210 delete widgets[w]; 211 widgets[w] = NULL; 212 } 213 } 214 SetCursor(0); 215 for (i=0; i<26; i++) { 216 char buf[1024]; 217 sprintf(buf, "#NAME.%c", i+'A'); 218 const char* s = config->GetParaStr(buf); 219 if (s != NULL) replace_name[i] = s; 220 } 221 // replace_name2 : œéŽüÀßÄê 222 // œí¡¢œ©Àž¡¢œí (CLANNAD) 223 char name_nagisa[3] = {'\x8f', '\x8d', '\0'}; 224 char name_akio[5] = {'\x8f', '\x48', '\x90', '\xb6', '\0'}; 225 replace_name2[0] = name_nagisa; 226 replace_name2[1] = name_akio; 227 replace_name2[2] = name_nagisa; 228 text = NULL; 229 /* ¥Æ¥¥¹¥È®ÅÙ€ÎÀßÄê */ 230 int speed, mod, wait, auto_mod; 231 config->GetParam("#INIT_MESSAGE_SPEED", 1, &speed); 232 config->GetParam("#INIT_MESSAGE_SPEED_MOD", 1, &mod); 233 config->GetParam("#MESSAGE_KEY_WAIT_USE", 1, &auto_mod); 234 config->GetParam("#MESSAGE_KEY_WAIT_TIME", 1, &wait); 235 if (mod) speed = -1; 236 if (!auto_mod) wait = -1; 237 SetTextSpeed(speed); 238 SetTextWait(wait); 239 } 240 241 void Text::Save(string& str, bool rollback_save) { 435 242 char buf[1024]; 436 243 str = "\n"; 437 str += "[Text ImplWindow]\n";438 sprintf(buf, "Text ImplWindow=%d\n",text_window_number);244 str += "[Text Window]\n"; 245 sprintf(buf, "TextWindow=%d\n",text_window_number); 439 246 str += buf; 440 247 if (rollback_save) { … … 459 266 SaveFaceHash face_log; 460 267 do { 461 int cur_scn = -1; int cur_pos = -1; 462 sprintf(buf, "Backlog.%d=",++cnt); 463 str += buf; 464 for (; it != backlog.end(); it++) { 465 buf[0] = 0; int buflen = 0; 466 if (it->scn == -1) continue; 467 if (it->pos == -1 && it->scn != 0) continue; 468 469 buf[buflen++] = ';'; 470 if (it->scn == 0 && it->pos == -1) { 471 buflen += snprintf(buf+buflen, 1000-buflen, "\"%s\".", it->text.Save().c_str()); 472 } else { 473 if (cur_scn != -1 && cur_scn != it->scn) break; // scn change 474 if (cur_pos != -1 && cur_pos/5000 != it->pos/5000) break; // pos exceeded 475 if (!it->text.container.empty()) { 476 buflen += snprintf(buf+buflen, 1000-buflen, "\"%s\"", it->text.Save().c_str()); 268 int cur_scn = -1; int cur_pos = -1; 269 sprintf(buf, "Backlog.%d=",++cnt); 270 str += buf; 271 for (; it != backlog.end(); it++) { 272 buf[0] = 0; 273 int buflen = 0; 274 if (it->scn == -1) 275 continue; 276 if (it->pos == -1 && it->scn != 0) 277 continue; 278 279 buf[buflen++] = ';'; 280 if (it->scn == 0 && it->pos == -1) 281 buflen += snprintf(buf+buflen, 1000-buflen, "\"%s\".", it->text.Save().c_str()); 282 else { 283 if (cur_scn != -1 && cur_scn != it->scn) break; // scn change 284 if (cur_pos != -1 && cur_pos/5000 != it->pos/5000) break; // pos exceeded 285 if (!it->text.container.empty()) { 286 buflen += snprintf(buf+buflen, 1000-buflen, "\"%s\"", it->text.Save().c_str()); 287 } 288 if (cur_scn == -1) { // scene change 289 buflen += snprintf(buf+buflen, 1000-buflen, ":%d:%d",it->scn,it->pos); 290 cur_scn = it->scn; 291 } 292 else 293 buflen += snprintf(buf+buflen, 1000-buflen, "%d",it->pos); 294 cur_pos = it->pos; 477 295 } 478 if (cur_scn == -1) { // scene change 479 buflen += snprintf(buf+buflen, 1000-buflen, ":%d:%d",it->scn,it->pos); 480 cur_scn = it->scn; 481 } else { 482 buflen += snprintf(buf+buflen, 1000-buflen, "%d",it->pos); 296 if (it->koe != -1) 297 buflen += snprintf(buf+buflen, 1000-buflen, ",%d",it->koe); 298 if (!it->face.empty()) { 299 if (it->koe == -1) buf[buflen++] = ','; 300 int face_num = face_log.Add(it->face); 301 if (face_num >= 0 && face_num < 20) 302 buflen += snprintf(buf+buflen, 1000-buflen, ",%c", 'A'+face_num); 303 else 304 buflen += snprintf(buf+buflen, 1000-buflen, ",\"%s\"", it->face.c_str()); 483 305 } 484 cur_pos = it->pos; 485 } 486 if (it->koe != -1) 487 buflen += snprintf(buf+buflen, 1000-buflen, ",%d",it->koe); 488 if (!it->face.empty()) { 489 if (it->koe == -1) buf[buflen++] = ','; 490 int face_num = face_log.Add(it->face); 491 if (face_num >= 0 && face_num < 20) 492 buflen += snprintf(buf+buflen, 1000-buflen, ",%c", 'A'+face_num); 493 else 494 buflen += snprintf(buf+buflen, 1000-buflen, ",\"%s\"", it->face.c_str()); 495 } 496 buf[buflen++] = '\0'; 497 if (buflen >= 1000) { // Ëü€¬°ì¡¢¥Ð¥Ã¥¯¥í¥°£±¥¢¥€¥Æ¥à€ÎÂ瀀µ€¬ 1000byte €ò±Û€š€ë€È€ 498 fprintf(stderr,"Fatal : Cannot save backlog crrectly; Please send bug report to the author.\n"); 499 } else str += buf; 500 } 501 str += "\n"; 502 } while(it != backlog.end()); 503 } 504 return; 505 } 506 507 void TextImpl::Load(const char* str) { 306 buf[buflen++] = '\0'; 307 if (buflen >= 1000) { // Ëü€¬°ì¡¢¥Ð¥Ã¥¯¥í¥°£±¥¢¥€¥Æ¥à€ÎÂ瀀µ€¬ 1000byte €ò±Û€š€ë€È€ 308 fprintf(stderr,"Fatal : Cannot save backlog crrectly; Please send bug report to the author.\n"); 309 } else str += buf; 310 } 311 str += "\n"; 312 } while(it != backlog.end()); 313 } 314 } 315 316 void Text::Load(const char* str) { 508 317 if (text) text->wid->Clear(); 509 318 hide(); … … 531 340 drawn_backlog_item.Clear(); 532 341 533 str = strstr(str, "\n[Text ImplWindow]\n");342 str = strstr(str, "\n[Text Window]\n"); 534 343 535 344 if (str) { 536 345 SaveFaceHash face_log; 537 str += strlen("\n[Text ImplWindow]\n");346 str += strlen("\n[Text Window]\n"); 538 347 const char* strend = str; 539 348 do { … … 545 354 546 355 if (str[0] == '[') break; // next section 547 if (strncmp(str, "Text ImplWindow=",15) == 0) {356 if (strncmp(str, "TextWindow=",15) == 0) { 548 357 str += 15; 549 358 sscanf(str, "%d", &text_window_number); … … 633 442 } 634 443 635 void Text Impl::hide(void) {444 void Text::hide(void) { 636 445 if (text) text->hide(); 637 446 if (kcursor) kcursor->hide(); 638 447 text = NULL; 639 448 } 640 void Text Impl::show(int num) {449 void Text::show(int num) { 641 450 if (num != text_window_number) { 642 451 hide(); … … 661 470 } 662 471 663 void Text Impl::DrawBacklog(BacklogItem& item, Cmd& cmd) {472 void Text::DrawBacklog(BacklogItem& item, Cmd& cmd) { 664 473 show(); 665 474 text->wid->deactivate(); … … 682 491 } 683 492 684 void Text Impl::CreateSelBG(void) {493 void Text::CreateSelBG(void) { 685 494 if (sel_bg1 != NULL || sel_bg2 != NULL) return; 686 495 … … 705 514 } 706 515 707 void Text Impl::CreateSelect(Cmd& cmd) {708 char key[ 1024];516 void Text::CreateSelect(Cmd& cmd) { 517 char key[23]; 709 518 sprintf(key, "#WINDOW.%03d.SELCOM_USE",text_window_number); 710 519 int sel_type = 0; … … 826 635 } 827 636 828 void Text Impl::AddText(const char* str_o) {637 void Text::AddText(const char* str_o) { 829 638 char str[10001]; 830 639 if (text == NULL) return; … … 891 700 } 892 701 893 void TextImpl::impl_txtClear(Cmd& cmd) { 894 if (text != NULL) { 895 text->ResetFace(); 896 if (cmd.cmd2 == 3 && cmd.cmd3 == 151) 897 text->wid->Clear(); 898 } 899 cur_backlog_item.face = ""; 900 if (cmd.cmd2 == 3 && cmd.cmd3 == 151) 901 text_stream.Clear(); 902 hide(); 903 } 904 905 void TextImpl::impl_logKoe(Cmd& cmd) { 906 // PlayKoe ; ÀŒœÐÎÏ¥³¥Þ¥ó¥É€ò¥Á¥§¥Ã¥¯€¹€ë */ 907 cur_backlog_item.koe = cmd.args[0].value; 908 } 909 910 void TextImpl::impl_pause(Cmd& cmd) { 911 if (text != NULL) { 912 eprintf("start\n"); 913 text->StartText(text_stream); 914 if (skip_mode & SKIP_TEXT) text->wid->Flush(); 915 else if (kcursor) kcursor->show(); 916 status = WAIT_TEXT; 917 text_parsing = false; 918 } 919 backlog_item = cur_backlog_item; 920 if (cur_backlog_item.scn == 0 && cur_backlog_item.pos == -1) backlog_item.text = text_stream; 921 cur_backlog_item.Clear(); 922 923 cmd.clear(); 924 cmd.cmd_type = CMD_WAITFRAMEUPDATE; // ²èÁüÉÁ²è€ËÌá€ë(skip»þ€Ë¥Æ¥¥¹¥È€¬ÉÁ²è€µ€ì€ä€¹€¯€¹€ë€¿€á) 925 } 926 927 void TextImpl::impl_br(Cmd& cmd) { 928 text_stream.AddReturn(); 929 cur_backlog_item.DeleteTextPos(); 930 cmd.clear(); 931 } 932 933 void TextImpl::impl_FaceOpen(Cmd& cmd) { 934 if (text == NULL) 935 show(); 936 string s = cmd.Str(cmd.args[0]); 937 s += ".g00"; 938 if (text != NULL) 939 text->ShowFace(s.c_str()); 940 cur_backlog_item.face = s; 941 cmd.cmd_type = CMD_SAVECMD_ONCE; 942 } 943 944 void TextImpl::impl_FaceClear(Cmd& cmd) { 945 if (text == NULL) 946 show(); 947 if (text) 948 text->ResetFace(); 949 cur_backlog_item.face = ""; 950 cmd.cmd_type = CMD_SAVECMD_ONCE; 951 } 952 953 void TextImpl::Exec(Cmd& cmd) { 702 void Text::Exec(Cmd& cmd) { 954 703 if (cmd.cmd_type == CMD_TEXT) { 955 704 if (text == NULL) { … … 980 729 CommandHandler::Exec(cmd); 981 730 982 if (cmd.cmd1 == 0 && cmd.cmd2 == 3) { 983 if (cmd.cmd3 == 0x78) { // ¥ë¥ÓŽØÏ¢ 984 if (text == NULL) { 985 show(); 986 } 987 if (cmd.cmd4 == 1) { 988 ruby_text_flag = true; 989 eprintf("SetRubyTextImpl."); 990 cmd.clear(); 991 } else if (cmd.cmd4 == 0) { 992 if (ruby_text.length() == 0) { // ¥ë¥Ó€ò¿¶€ë¥Æ¥¥¹¥È€¬€Ê€€ 993 eprintf("Cannot find ruby text.\n"); 994 return; 995 } 996 if (cmd.args.size() != 1) return; 997 char debug1[1024], debug2[1024]; 998 kconv( (unsigned char*)ruby_text.c_str(), (unsigned char*)debug1); 999 kconv( (unsigned char*)cmd.Str(cmd.args[0]), (unsigned char*)debug2); 1000 eprintf("SetRuby. %s, %s",debug1, debug2); 1001 text_stream.AddRuby(ruby_text.c_str(), cmd.Str(cmd.args[0])); 1002 cur_backlog_item.DeleteTextPos(); 1003 cmd.clear(); 1004 } 1005 } else if (cmd.cmd3 == 0x66) { // ¥Æ¥¥¹¥È¥Š¥£¥ó¥É¥Š€Î·Á 1006 if (cmd.cmd4 == 0) { 1007 eprintf("set text window <- %d\n",cmd.args[0].value); 1008 if (text) show(cmd.args[0].value); 1009 else text_window_number = cmd.args[0].value; 1010 } else if (cmd.cmd4 == 1) { // default value 1011 eprintf("set text window <- default\n"); 1012 if (text) show(0); 1013 else text_window_number = 0; 1014 } 1015 cmd.clear(); 1016 } else if (cmd.cmd3 == 0x67) { // ¥Æ¥¥¹¥È¥Š¥£¥ó¥É¥ŠÉœŒš¡© 1017 show(); 1018 // ÉœŒš€ÎºÝ€Ï¥Æ¥¥¹¥È€ò¥¯¥ê¥¢€·€Ê€€¡© 1019 // if (text) text->wid->Clear(); 1020 // text_stream.Clear(); 1021 cmd.clear(); 1022 } else if (cmd.cmd3 == 0x68) { // ¥Æ¥¥¹¥ÈÉœŒš¡© 1023 // ÁŽ¥Æ¥¥¹¥ÈÉœŒš 1024 if (text) { 1025 text->StartText(text_stream); 1026 text->wid->Flush(); 1027 } 1028 cmd.clear(); 1029 } else if (cmd.cmd3 == 0x98) { // ¥Æ¥¥¹¥È¥Š¥£¥ó¥É¥Š¥¯¥ê¥¢¡© 1030 show(); 1031 if (text) text->wid->Clear(); 1032 text_stream.Clear(); 1033 cmd.clear(); 1034 } 1035 } else if (cmd.cmd1 == 0 && cmd.cmd2 == 2 && (cmd.cmd3 == 1 || cmd.cmd3 == 3) && cmd.cmd4 == 0) { 1036 // ÁªÂò»è 1037 CreateSelect(cmd); 1038 //FIXME: Check if it's really clean 1039 if (text_parsing) { 1040 show(); 1041 text->StartText(text_stream); 1042 if (skip_mode & SKIP_TEXT) text->wid->Flush(); 1043 else if (kcursor) kcursor->hide(); 1044 text_parsing = false; 1045 text_stream.Clear(); 1046 } 1047 cmd.cmd_type = CMD_ROLLBACKPOINT; /* ÁªÂò»è€Ï¥»¡Œ¥Ö°ÌÃÖ / ¥·¥Ê¥ê¥ªŽ¬€Ì့°ÌÃÖ */ 1048 // cmd.clear(); 1049 } else if (cmd.cmd1 == 0 && cmd.cmd2 == 4) { 1050 if (cmd.cmd3 == 0x44c) { // ¥Æ¥¥¹¥È¥¹¥¥Ã¥×³«»Ï 1051 status_mask = Status(SKIPMASK | status_mask); 1052 cmd.clear(); 1053 } else if (cmd.cmd3 == 0x3e8) { // ¥Š¥£¥ó¥É¥ŠŸÃµî 1054 status_mask = Status(CLEARSCR_MASK | status_mask); 1055 cmd.clear(); 1056 } 1057 } else if (cmd.cmd1 == 1 && cmd.cmd2 == 0x04) { 731 if (cmd.cmd1 == 1 && cmd.cmd2 == 4) { 1058 732 /* ¥Š¥§¥€¥ÈŽØÏ¢Ì¿Îá */ 1059 if (cmd.cmd3 == 0x64 || cmd.cmd3 == 0x6f || cmd.cmd3 == 0x79) { 1060 eprintf("wait %dmsec\n",cmd.args[0].value); 1061 if (cmd.cmd3 == 0x64 && text) { 1062 /* 0x64 €À€ÈÊž»úÉÁ²èÃæ€ÎÂÔ€Á€Ë»È€Š€³€È€¬€¢€ë */ 1063 text->StartText(text_stream); 1064 text->wid->Flush(); 1065 } 1066 if (cmd.cmd3 == 0x6f || cmd.cmd3 == 0x79) wait_time = base_time + cmd.args[0].value; 1067 else wait_time = old_time + cmd.args[0].value; 1068 status = WAIT; 1069 cmd.cmd_type = CMD_WAITFRAMEUPDATE; // ²èÁüÉÁ²è€ËÌá€ë(skip»þ€Ë¥Æ¥¥¹¥È€¬ÉÁ²è€µ€ì€ä€¹€¯€¹€ë€¿€á) 1070 } else if (cmd.cmd3 == 0x65 || cmd.cmd3 == 0x70) { 733 if (cmd.cmd3 == 0x65 || cmd.cmd3 == 0x70) { 1071 734 eprintf("wait %dmsec(click stop)\n",cmd.args[0].value); 1072 735 if (cmd.cmd3 == 0x70) wait_time = base_time + cmd.args[0].value; … … 1375 1038 1376 1039 extern int print_blit; 1377 bool Text Impl::Wait(unsigned int current_time, Cmd& cmd) {1040 bool Text::Wait(unsigned int current_time, Cmd& cmd) { 1378 1041 if (current_time != Event::Time::NEVER_WAKE) old_time = current_time; 1379 1042 /* … … 1561 1224 void clearbtn_press(void* pointer, WidButton* button) { 1562 1225 if (pointer == NULL) return; 1563 TextImpl* t = (TextImpl*)pointer; 1564 t->status_mask = TextImpl::Status(t->status_mask | TextImpl::CLEARSCR_MASK); 1226 Text* t = (Text*)pointer; 1227 t->status_mask = Text::Status(t->status_mask | Text::CLEARSCR_MASK); 1228 } 1229 1230 void Text::PressFuncSkip(void* pointer, WidButton* from) { 1231 if (pointer == NULL) return; 1232 Text* t = (Text*)pointer; 1233 t->status_mask = Text::Status(t->status_mask | Text::SKIPMASK); 1565 1234 return; 1566 1235 } 1567 void Text Impl::PressFuncSkip(void* pointer, WidButton* from) {1236 void Text::PressFuncLoad(void* pointer, WidButton* from) { 1568 1237 if (pointer == NULL) return; 1569 Text Impl* t = (TextImpl*)pointer;1570 t->status_mask = Text Impl::Status(t->status_mask | TextImpl::SKIPMASK);1571 return; 1572 } 1573 void Text Impl::PressFuncLoad(void* pointer, WidButton* from) {1238 Text* t = (Text*)pointer; 1239 t->status_mask = Text::Status(t->status_mask | Text::LOADMASK); 1240 } 1241 1242 void Text::PressFuncSave(void* pointer, WidButton* from) { 1574 1243 if (pointer == NULL) return; 1575 Text Impl* t = (TextImpl*)pointer;1576 t->status_mask = Text Impl::Status(t->status_mask | TextImpl::LOADMASK);1577 return; 1578 } 1579 void Text Impl::PressFuncSave(void* pointer, WidButton* from) {1244 Text* t = (Text*)pointer; 1245 t->status_mask = Text::Status(t->status_mask | Text::SAVEMASK); 1246 } 1247 1248 void Text::PressFuncBacklog(void* pointer, WidButton* from) { 1580 1249 if (pointer == NULL) return; 1581 Text Impl* t = (TextImpl*)pointer;1582 t->status_mask = Text Impl::Status(t->status_mask | TextImpl::SAVEMASK);1583 return; 1584 } 1585 void Text Impl::PressFuncBacklog(void* pointer, WidButton* from) {1250 Text* t = (Text*)pointer; 1251 t->status_mask = Text::Status(t->status_mask | Text::BACKLOG_MASK); 1252 } 1253 1254 void Text::PressFuncBacklogFwd(void* pointer, WidButton* from) { 1586 1255 if (pointer == NULL) return; 1587 TextImpl* t = (TextImpl*)pointer; 1588 t->status_mask = TextImpl::Status(t->status_mask | TextImpl::BACKLOG_MASK); 1589 return; 1590 } 1591 void TextImpl::PressFuncBacklogFwd(void* pointer, WidButton* from) { 1592 if (pointer == NULL) return; 1593 TextImpl* t = (TextImpl*)pointer; 1594 t->status_mask = TextImpl::Status(t->status_mask | TextImpl::BACKLOG_MASK_FWD); 1595 return; 1596 } 1256 Text* t = (Text*)pointer; 1257 t->status_mask = Text::Status(t->status_mask | Text::BACKLOG_MASK_FWD); 1258 } 1259 1597 1260 void movebtn_drag(int from_x, int from_y, int x, int y, void* pointer, WidButton* button) { 1598 1261 if (pointer == NULL) return; … … 1620 1283 1621 1284 static WidButton::PressFunc btnpress[BTNCNT] = { 1622 0, clearbtn_press, &Text Impl::PressFuncSkip,0,&TextImpl::PressFuncBacklogFwd,&TextImpl::PressFuncBacklog,&TextImpl::PressFuncBacklogFwd,&TextImpl::PressFuncSave,&TextImpl::PressFuncLoad,01285 0, clearbtn_press, &Text::PressFuncSkip,0,&Text::PressFuncBacklogFwd,&Text::PressFuncBacklog,&Text::PressFuncBacklogFwd,&Text::PressFuncSave,&Text::PressFuncLoad,0 1623 1286 }; 1624 1287 … … 1627 1290 }; 1628 1291 1629 void Text Impl::SetTextSpeed(int speed) {1292 void Text::SetTextSpeed(int speed) { 1630 1293 // 100 : 10char / sec 1631 1294 // 10 : 100char / sec … … 1639 1302 } 1640 1303 1641 void Text Impl::SetTextWait(int wait) {1304 void Text::SetTextWait(int wait) { 1642 1305 int i; 1643 1306 for (i=0; i<32; i++) … … 1645 1308 } 1646 1309 1647 void Text Impl::SetWindowColor(int r, int g, int b, int a, bool is_transparent) {1310 void Text::SetWindowColor(int r, int g, int b, int a, bool is_transparent) { 1648 1311 char key[1024]; 1649 1312 int w; … … 1669 1332 } 1670 1333 1671 void Text Impl::SetCursor(int cursor_no) {1334 void Text::SetCursor(int cursor_no) { 1672 1335 char key[1024]; 1673 1336 sprintf(key, "#CURSOR.%03d.NAME", cursor_no); … … 1774 1437 /**************************************************************:: 1775 1438 ** 1776 ** Text1777 */1778 Text::Text(Event::Container& _event, PicContainer& _parent) {1779 pimpl = new TextImpl(_event, _parent, backlog, backlog_item);1780 }1781 1782 Text::~Text() {1783 delete pimpl;1784 pimpl = NULL;1785 }1786 1787 void Text::InitWindow(void) {1788 pimpl->InitWindow();1789 }1790 1791 void Text::Exec(Cmd& cmd) {1792 pimpl->Exec(cmd);1793 }1794 1795 bool Text::Wait(unsigned int current_time, Cmd& cmd) {1796 return pimpl->Wait(current_time, cmd);1797 }1798 1799 void Text::SetSkipMode(SkipMode mode) {1800 pimpl->SetSkipMode(mode);1801 }1802 1803 void Text::Save(std::string& str, bool select_save) {1804 pimpl->Save(str, select_save);1805 }1806 1807 void Text::Load(const char* str) {1808 pimpl->Load(str);1809 }1810 1811 void Text::hide(void) {1812 pimpl->hide();1813 }1814 1815 void Text::show(void) {1816 pimpl->show();1817 }1818 1819 void Text::show(int num) {1820 pimpl->show(num);1821 }1822 1823 void Text::DrawBacklog(BacklogItem& item, Cmd& cmd) {1824 pimpl->DrawBacklog(item, cmd);1825 }1826 1827 /**************************************************************::1828 **1829 1439 ** BacklogItem 1830 1440 */ … … 1872 1482 pos = p; 1873 1483 } 1484 1485 1486 /**************************************************************:: 1487 ** 1488 ** TextWindow 1489 */ 1874 1490 1875 1491 Rect TextWindow::WakuSize(PicContainer& pic, int waku_no) { … … 2076 1692 } 2077 1693 2078 void TextImpl::InitWindow(void) { 1694 TextWindow::~TextWindow() 1695 { 1696 if (name_container != NULL) { 1697 delete name_container; 1698 name_container = NULL; 1699 } 2079 1700 int i; 2080 int w; 2081 std::string str; 2082 2083 for (w=0; w<32; w++) { 2084 widgets[w] = new TextWindow(parent, event, w, (void*)this); 2085 if (widgets[w]->wid == 0) { 2086 delete widgets[w]; 2087 widgets[w] = NULL; 2088 } 2089 } 2090 SetCursor(0); 2091 for (i=0; i<26; i++) { 2092 char buf[1024]; 2093 sprintf(buf, "#NAME.%c", i+'A'); 2094 const char* s = config->GetParaStr(buf); 2095 if (s != NULL) replace_name[i] = s; 2096 } 2097 // replace_name2 : œéŽüÀßÄê 2098 // œí¡¢œ©Àž¡¢œí (CLANNAD) 2099 char name_nagisa[3] = {'\x8f', '\x8d', '\0'}; 2100 char name_akio[5] = {'\x8f', '\x48', '\x90', '\xb6', '\0'}; 2101 replace_name2[0] = name_nagisa; 2102 replace_name2[1] = name_akio; 2103 replace_name2[2] = name_nagisa; 2104 text = NULL; 2105 /* ¥Æ¥¥¹¥È®ÅÙ€ÎÀßÄê */ 2106 int speed, mod, wait, auto_mod; 2107 config->GetParam("#INIT_MESSAGE_SPEED", 1, &speed); 2108 config->GetParam("#INIT_MESSAGE_SPEED_MOD", 1, &mod); 2109 config->GetParam("#MESSAGE_KEY_WAIT_USE", 1, &auto_mod); 2110 config->GetParam("#MESSAGE_KEY_WAIT_TIME", 1, &wait); 2111 if (mod) speed = -1; 2112 if (!auto_mod) wait = -1; 2113 SetTextSpeed(speed); 2114 SetTextWait(wait); 2115 return; 2116 } 1701 for (i=0; i<8; i++) { 1702 if (face_pics[i] != NULL) { 1703 delete face_pics[i]; 1704 face_pics[i] = NULL; 1705 } 1706 } 1707 if (wid != NULL) { 1708 delete wid; 1709 wid = NULL; 1710 } 1711 } 1712 1713 void TextWindow::show(void) 1714 { 1715 wid->show(); 1716 if (name_container != NULL && name_visible) 1717 name_container->show(); 1718 if (face != NULL) 1719 face->show(); 1720 } 1721 1722 void TextWindow::hide(void) 1723 { 1724 wid->hide(); 1725 if (name_container != NULL) 1726 name_container->hide(); 1727 if (face != NULL) 1728 face->hide(); 1729 } 1730 1731 void TextWindow::ShowFace(const char* path) 1732 { 1733 if (face == NULL) 1734 return; 1735 face->SetSurface(path, 0, 0); 1736 } 1737 1738 void TextWindow::ResetFace(void) { 1739 if (face == NULL) 1740 return; 1741 face->SetSurface((Surface*) NULL, 0, 0); 1742 } 1743 1744 void TextWindow::StartText(const TextStream& _stream) 1745 { 1746 wid->Clear(); 1747 wid->stream = _stream; 1748 if (name_container != NULL) { 1749 char namestr[1024]; 1750 namestr[0] = 0; 1751 wid->stream.RemoveName(namestr, 1024); 1752 if (namestr[0] == 0) { 1753 name_container->hide(); 1754 } 1755 else { 1756 if (name != NULL) { 1757 name_container->show_all(); 1758 name->SetText(namestr); 1759 } 1760 } 1761 } 1762 wid->Start(); 1763 } 1764 1765 void TextWindow::SetName(const char* n) 1766 { 1767 if (name_container != NULL && name != NULL) { 1768 if (n[0]) { 1769 name_container->show(); 1770 name->SetText(n); 1771 name_visible = true; 1772 } 1773 else { 1774 name_container->hide(); 1775 name_visible = false; 1776 } 1777 } 1778 } 1779 1780 /**************************************************************:: 1781 ** 1782 ** SaveFaceHash 1783 */ 1784 1785 void SaveFaceHash::NewNode(string face, int face_id) 1786 { 1787 facetonum[face] = face_id; 1788 container.push_front(Node(face, face_id)); 1789 if (container.size() > size_max) { 1790 Node remove = container.back(); 1791 container.pop_back(); 1792 facetonum.erase(remove.first); 1793 } 1794 } 1795 1796 int SaveFaceHash::Add(string face) 1797 { 1798 int id; 1799 int ret = -1; 1800 int i; 1801 List::iterator it; 1802 if (face.empty()) return -1; 1803 if (facetonum.find(face) == facetonum.end()) { 1804 id = ++id_max; 1805 NewNode(face, id); 1806 ret = -1; 1807 } 1808 else { 1809 id = facetonum[face]; 1810 for (i=0, it=container.begin(); it != container.end(); i++, it++) { 1811 if (it->second == id) { 1812 ret = i; 1813 Node n = *it; 1814 container.erase(it); 1815 container.push_front(n); 1816 break; 1817 } 1818 } 1819 } 1820 return ret; 1821 } 1822 1823 string SaveFaceHash::Get(int num) { 1824 if (num < 0) return ""; 1825 List::iterator it = container.begin(); 1826 for (; it != container.end(); it++) { 1827 if (num == 0) return it->first; 1828 num--; 1829 } 1830 return ""; 1831 } 1832 1833 int SaveFaceHash::size_max = 20; 1834 -
system/system_config.h
r53 r56 22 22 * 23 23 */ 24 25 #ifndef __SYSTEM_CONFIG_H__ 26 #define __SYSTEM_CONFIG_H__ 24 27 25 28 #include <string> … … 112 115 }; 113 116 117 #endif 118 -
window/Makefile.am
r32 r56 2 2 libwindow_a_SOURCES = render.cc event.cc system.cc picture.cc widget.cc \ 3 3 button.cc menuitem.cc rect.cc \ 4 event.h menuitem.h picture.h rect.h \4 event.h menuitem.h picture.h rect.h render.h \ 5 5 surface.h system.h widget.h 6 6 -
window/render.cc
r52 r56 28 28 #include "font/font.h" 29 29 #include "font/text.h" 30 #include "SDL.h" 31 #include "render.h" 30 32 #include "rect.h" 31 #include "SDL.h"32 33 #include "surface.h" 33 34 #include <stdio.h> 34 35 Rect DSurfaceRenderText(TextGlyphStream::iterator start, TextGlyphStream::iterator end, const Rect& srcrect,36 Surface* dst, const Rect& dstrect); // Êž»úÉÁ²è37 void DSurfaceFill(Surface* src, const Rect& rect, int r, int g, int b, int a); // ¥¯¥ê¥¢38 void DSurfaceFillA(Surface* src, const Rect& rect, int r, int g, int b, int a); // ¥Æ¥¥¹¥È¥Š¥£¥ó¥É¥ŠÇØ·Ê€ÎÀßÄê39 void DSurfaceMove(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstrect); // ¥³¥Ô¡Œ40 void DSurfaceBlitAlpha(Surface* src_o, const Rect& srcrect_o, Surface* dst_o, const Rect& dstrect_o, const unsigned char* alpha, const Rect& alpharect);41 void DSurfaceBlitSaturate(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstrect, unsigned char alpha);42 void DSurfaceBlitMultiply(Surface* src_o, const Rect& srcrect_o, Surface* dst_o, const Rect& dstrect_o);43 35 44 36 #ifndef ALPHA_MAX -
window/surface.h
r31 r56 29 29 #define __SURFACE_H__ 30 30 31 #include <SDL.h>32 #include "rect.h"31 #include <SDL.h> 32 #include "rect.h" 33 33 34 34 struct Surface : public SDL_Surface { -
window/system.h
r52 r56 35 35 36 36 namespace System { 37 struct Main { 38 int framerate; 39 static int event_filter(const SDL_Event* event); 40 static bool is_exit; 41 static bool is_video_update; 42 static Main* instance; 43 WidMouseCursor* cursor; 44 public: 45 Event::Container event; 46 PicRoot root; 47 Main(void); 48 ~Main(); 49 void Mainloop(void); 50 static void Quit(void); 51 static void DisableVideo(void); 52 static void EnableVideo(void); 37 class Main { 38 public: 39 Main(void); 40 ~Main(); 41 void Mainloop(void); 42 static void Quit(void); 43 static void DisableVideo(void); 44 static void EnableVideo(void); 53 45 #define DEFAULT_MOUSECURSOR (Surface*)0xffff0000 //FIXME: WTF?!? 54 static void SetCursor(Surface* s, const Rect& r); 46 static void SetCursor(Surface* s, const Rect& r); 47 48 private: 49 static int event_filter(const SDL_Event* event); 50 51 public: 52 Event::Container event; 53 PicRoot root; 54 55 private: 56 int framerate; 57 static bool is_exit; 58 static bool is_video_update; 59 static Main* instance; 60 WidMouseCursor* cursor; 55 61 }; 56 62 }
![(please configure the [header_logo] section in trac.ini)](/otakunoraifu/chrome/site/your_project_logo.png)