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