annotate scn2k/scn2k_impl.h @ 67:419761c8d9b9

Add configure option to build scn2kdump.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 23 Feb 2011 01:48:51 +0100
parents 4416cfac86ae
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
1 /*
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
2 * Copyright (c) 2004-2006 Kazunori "jagarl" Ueno
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
3 * All rights reserved.
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
4 *
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
5 * Redistribution and use in source and binary forms, with or without
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
6 * modification, are permitted provided that the following conditions
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
7 * are met:
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
8 * 1. Redistributions of source code must retain the above copyright
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
9 * notice, this list of conditions and the following disclaimer.
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
10 * 2. Redistributions in binary form must reproduce the above copyright
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
11 * notice, this list of conditions and the following disclaimer in the
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
12 * documentation and/or other materials provided with the distribution.
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
13 * 3. The name of the author may not be used to endorse or promote products
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
14 * derived from this software without specific prior written permission.
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
15 *
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
26 */
5ae5533b3a9a * Added some license headers
thib
parents: 0
diff changeset
27
0
223b71206888 Initial import
thib
parents:
diff changeset
28 #ifndef __SCN2k_IMPL_H__
223b71206888 Initial import
thib
parents:
diff changeset
29 #define __SCN2k_IMPL_H__
223b71206888 Initial import
thib
parents:
diff changeset
30
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
31 #include "scn2k.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
32 #include "window/widget.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
33 #include "window/event.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
34 #include <vector>
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
35 #include <string>
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
36 #include <map>
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
37 #include <set>
0
223b71206888 Initial import
thib
parents:
diff changeset
38
223b71206888 Initial import
thib
parents:
diff changeset
39 struct StackItem {
223b71206888 Initial import
thib
parents:
diff changeset
40 int scn_number;
223b71206888 Initial import
thib
parents:
diff changeset
41 int scn_pt;
223b71206888 Initial import
thib
parents:
diff changeset
42 StackItem(int number, int pt) : scn_number(number), scn_pt(pt) {}
223b71206888 Initial import
thib
parents:
diff changeset
43 };
223b71206888 Initial import
thib
parents:
diff changeset
44
223b71206888 Initial import
thib
parents:
diff changeset
45 struct SaveTitle {
223b71206888 Initial import
thib
parents:
diff changeset
46 virtual std::string operator()(int number) const = 0;
223b71206888 Initial import
thib
parents:
diff changeset
47 };
223b71206888 Initial import
thib
parents:
diff changeset
48
223b71206888 Initial import
thib
parents:
diff changeset
49 struct Scn2kMenu {
223b71206888 Initial import
thib
parents:
diff changeset
50 Cmd cmd;
223b71206888 Initial import
thib
parents:
diff changeset
51 class Scn2kMenuImpl* pimpl;
223b71206888 Initial import
thib
parents:
diff changeset
52 enum MenuType { MENU_LOAD, MENU_SAVE, MENU_CONFIG, MENU_BACKLOG, MENU_BACKLOG2};
223b71206888 Initial import
thib
parents:
diff changeset
53 MenuType type;
223b71206888 Initial import
thib
parents:
diff changeset
54 enum MenuStatus { MENU_CONTINUE=0, MENU_CMD=1, MENU_DELETE=2};
223b71206888 Initial import
thib
parents:
diff changeset
55 MenuStatus status;
223b71206888 Initial import
thib
parents:
diff changeset
56 void InitPanel(Event::Container& event, PicContainer& parent);
223b71206888 Initial import
thib
parents:
diff changeset
57 void InitTitle(const SaveTitle&);
223b71206888 Initial import
thib
parents:
diff changeset
58 void Cancel(void);
223b71206888 Initial import
thib
parents:
diff changeset
59 void Exec(Cmd& cmd);
223b71206888 Initial import
thib
parents:
diff changeset
60 void activate(void);
223b71206888 Initial import
thib
parents:
diff changeset
61 void deactivate(void);
223b71206888 Initial import
thib
parents:
diff changeset
62 Scn2kMenu(MenuType type, class Scn2k& scn_impl, const Flags& flags, Text& text, int system_version);
223b71206888 Initial import
thib
parents:
diff changeset
63 ~Scn2kMenu();
223b71206888 Initial import
thib
parents:
diff changeset
64 };
223b71206888 Initial import
thib
parents:
diff changeset
65
223b71206888 Initial import
thib
parents:
diff changeset
66 struct Scn2kSaveTitle : SaveTitle {
223b71206888 Initial import
thib
parents:
diff changeset
67 const class Scn2k& impl;
223b71206888 Initial import
thib
parents:
diff changeset
68 std::string operator() (int number) const;
223b71206888 Initial import
thib
parents:
diff changeset
69 Scn2kSaveTitle(const Scn2k& _impl) : impl(_impl) {}
223b71206888 Initial import
thib
parents:
diff changeset
70 };
223b71206888 Initial import
thib
parents:
diff changeset
71
223b71206888 Initial import
thib
parents:
diff changeset
72 class Scn2k : Event::Time {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
73 private:
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
74 Event::Container& event;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
75 PicContainer& parent;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
76 AyuSysConfig *config;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
77 WidMouseCursor* mcursor;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
78 Flags flag;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
79 Text text_exec;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
80 Grp grp_exec;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
81 int system_version;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
82 SkipMode skip_mode;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
83 int scn_number;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
84 int scn_point;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
85 enum {
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
86 SCN_INFO = 999999, SCN_INFO_MENU = 10000001,
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
87 SCN_INFO_LOCALS = 10000100, SCN_INFO_LOCALSTR = 10000200,
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
88 SCN_INFO_RETSTR = 10000300
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 53
diff changeset
89 }; // stack に積まれる特殊な番号
0
223b71206888 Initial import
thib
parents:
diff changeset
90
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
91 int save_scn, save_point;
0
223b71206888 Initial import
thib
parents:
diff changeset
92
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
93 char* script_start;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
94 char* script_end;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
95 const char* script;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
96
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
97 int backlog_script_scn;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
98 char* backlog_script_start;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
99 char* backlog_script_end;
0
223b71206888 Initial import
thib
parents:
diff changeset
100
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
101 std::string window_title;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
102 std::vector<StackItem> stack;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
103 std::vector<std::string> stack_strbuffer;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
104 std::vector<CmdSimplified> cmd_stack;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
105 std::vector<std::string> rollback_save;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
106 std::string new_rollback_save;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
107 std::map<int, std::set<int> > text_readflag;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
108 char* cmd_stack_str;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
109 char cmd_stack_str_orig[32768];
0
223b71206888 Initial import
thib
parents:
diff changeset
110
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
111 Cmdtype dialog_type;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
112 class WidDialog* dialog;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
113 Scn2kMenu* menu;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
114 bool menu_mouseshown;
0
223b71206888 Initial import
thib
parents:
diff changeset
115
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
116 Surface* mouse_surface;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
117 int mouse_type;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
118 int mouse_pressed;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
119 void ShowCursor();
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
120 void HideCursor();
0
223b71206888 Initial import
thib
parents:
diff changeset
121
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
122 void SetSkipMode(SkipMode mode);
0
223b71206888 Initial import
thib
parents:
diff changeset
123
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
124 virtual void Elapsed(unsigned int current_time);
0
223b71206888 Initial import
thib
parents:
diff changeset
125
65
4416cfac86ae Convert EUC-JP files to UTF8
Thibaut Girka <thib@sitedethib.com>
parents: 53
diff changeset
126 // セーブ関連
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
127 std::string MakeSaveFile(void) const;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
128 bool StatSaveFile(int num, int& year, int& month, int& day, int& wday, int& hour,int& min, int& sec, int& msec, std::string& title) const;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
129 void SaveImpl(std::string& s);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
130 void LoadImpl(const char* s);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
131 void Save(Cmd& cmd);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
132 void Load(Cmd& cmd);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
133 void SaveRollback(void);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
134 void LoadRollback(Cmd& cmd);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
135 void SaveSys(void);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
136 void LoadSys(void);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
137
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
138 public:
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
139 Scn2k(Event::Container& _event, PicContainer& _parent);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
140 ~Scn2k();
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
141 static char* OpenScript(int scn_number, char*& end, int* call_vec, int& system_version);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
142 bool ChangeScript(int scn_number, int call_no);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
143 bool ReadCmdAt(Cmd& cmd, int scn, int pt);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
144 void show_textwindow(int type);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
145 void hide_textwindow(void);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
146 void SysExec(Cmd& cmd);
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
147 bool SysWait(Cmd& cmd);
0
223b71206888 Initial import
thib
parents:
diff changeset
148
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 31
diff changeset
149 friend struct Scn2kSaveTitle;
0
223b71206888 Initial import
thib
parents:
diff changeset
150 };
223b71206888 Initial import
thib
parents:
diff changeset
151 #endif