comparison scn2k/scn2k_impl.h @ 0:223b71206888

Initial import
author thib
date Fri, 01 Aug 2008 16:32:45 +0000
parents
children 5ae5533b3a9a
comparison
equal deleted inserted replaced
-1:000000000000 0:223b71206888
1 #ifndef __SCN2k_IMPL_H__
2 #define __SCN2k_IMPL_H__
3
4 #include"scn2k.h"
5 #include"window/widget.h"
6 #include"window/event.h"
7 #include<vector>
8 #include<string>
9 #include<map>
10 #include<set>
11
12 struct StackItem {
13 int scn_number;
14 int scn_pt;
15 StackItem(int number, int pt) : scn_number(number), scn_pt(pt) {}
16 };
17
18 struct SaveTitle {
19 virtual std::string operator()(int number) const = 0;
20 };
21
22 struct Scn2kMenu {
23 Cmd cmd;
24 class Scn2kMenuImpl* pimpl;
25 enum MenuType { MENU_LOAD, MENU_SAVE, MENU_CONFIG, MENU_BACKLOG, MENU_BACKLOG2};
26 MenuType type;
27 enum MenuStatus { MENU_CONTINUE=0, MENU_CMD=1, MENU_DELETE=2};
28 MenuStatus status;
29 void InitPanel(Event::Container& event, PicContainer& parent);
30 void InitTitle(const SaveTitle&);
31 void Cancel(void);
32 void Exec(Cmd& cmd);
33 void activate(void);
34 void deactivate(void);
35 Scn2kMenu(MenuType type, class Scn2k& scn_impl, const Flags& flags, Text& text, int system_version);
36 ~Scn2kMenu();
37 };
38
39 struct Scn2kSaveTitle : SaveTitle {
40 const class Scn2k& impl;
41 std::string operator() (int number) const;
42 Scn2kSaveTitle(const Scn2k& _impl) : impl(_impl) {}
43 };
44
45 class Scn2k : Event::Time {
46 Event::Container& event;
47 PicContainer& parent;
48 AyuSysConfig& config;
49 WidMouseCursor* mcursor;
50 Flags flag;
51 Text text_exec;
52 Grp grp_exec;
53 int system_version;
54 SkipMode skip_mode;
55 int scn_number;
56 int scn_point;
57 enum {SCN_INFO=999999, SCN_INFO_MENU=10000001, SCN_INFO_LOCALS = 10000100, SCN_INFO_LOCALSTR = 10000200, SCN_INFO_RETSTR = 10000300}; // stack に積まれる特殊な番号
58
59 int save_scn, save_point;
60
61 char* script_start;
62 char* script_end;
63 const char* script;
64
65 int backlog_script_scn;
66 char* backlog_script_start;
67 char* backlog_script_end;
68
69 std::string window_title;
70 std::vector<StackItem> stack;
71 std::vector<std::string> stack_strbuffer;
72 std::vector<CmdSimplified> cmd_stack;
73 std::vector<std::string> rollback_save;
74 std::string new_rollback_save;
75 std::map<int, std::set<int> > text_readflag;
76 char* cmd_stack_str;
77 char cmd_stack_str_orig[32768];
78
79 Cmdtype dialog_type;
80 class WidDialog* dialog;
81 Scn2kMenu* menu;
82 bool menu_mouseshown;
83
84 Surface* mouse_surface;
85 int mouse_type;
86 int mouse_pressed;
87 void ShowCursor();
88 void HideCursor();
89
90 void SetSkipMode(SkipMode mode);
91
92 virtual void Elapsed(unsigned int current_time);
93
94 // セーブ関連
95 std::string MakeSaveFile(void) const;
96 bool StatSaveFile(int num, int& year, int& month, int& day, int& wday, int& hour,int& min, int& sec, int& msec, std::string& title) const;
97 void SaveImpl(std::string& s);
98 void LoadImpl(const char* s);
99 void Save(Cmd& cmd);
100 void Load(Cmd& cmd);
101 void SaveRollback(void);
102 void LoadRollback(Cmd& cmd);
103 void SaveSys(void);
104 void LoadSys(void);
105 public:
106 Scn2k(Event::Container& _event, PicContainer& _parent, class MuSys& mu, AyuSysConfig& config);
107 ~Scn2k();
108 static char* OpenScript(int scn_number, char*& end, int* call_vec, int& system_version);
109 bool ChangeScript(int scn_number, int call_no);
110 bool ReadCmdAt(Cmd& cmd, int scn, int pt);
111 void show_textwindow(int type);
112 void hide_textwindow(void);
113 void SysExec(Cmd& cmd);
114 bool SysWait(Cmd& cmd);
115
116 friend struct Scn2kSaveTitle;
117 };
118 #endif