annotate scn2k/scn2k_text.cc @ 55:f1a27ee7e03c

* started the same changes on scn2k_text.cc * handle opcodes childObj*. In fact, it was handled (in a strange way, but it worked) before the previous changeset
author thib
date Wed, 22 Apr 2009 15:01:42 +0000
parents ddbcbd000206
children c7bcc0ec2267
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
223b71206888 Initial import
thib
parents:
diff changeset
1 /*
223b71206888 Initial import
thib
parents:
diff changeset
2 TODO:
223b71206888 Initial import
thib
parents:
diff changeset
3 ÆüÉդΥé¥Ù¥ë¤¬²èÌÌÀÚ¤êÂؤ¨»þ¤Ë·ç¤±¤ë¤Î¤ò½¤Àµ
223b71206888 Initial import
thib
parents:
diff changeset
4 ²èÁü¸ú²Ì : ¿Í´Ö¤ÎÆþ¤ì´¹¤ï¤ê¤Ê¤É
223b71206888 Initial import
thib
parents:
diff changeset
5 kcursor ¤ÎÁàºî¤ò WidText ¥¯¥é¥¹¤ËǤ¤»¤ë
223b71206888 Initial import
thib
parents:
diff changeset
6 WidText ¥¯¥é¥¹¤Ë¤Ï¿·¤¿¤Ë°Ê²¼¤ÎÁàºî¤ò²Ã¤¨¤ë
223b71206888 Initial import
thib
parents:
diff changeset
7 ¡¦¥¦¥§¥¤¥È½ªÎ»¸å¡¢¥¯¥ê¥¢¤Ê¤·¤Ë¿·¤¿¤Ê¥Æ¥­¥¹¥È¤òÄɲᢿ·¤¿¤Ëstart-wait¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
8 ¡¦Ê¸»ú¤ÎÉÁ²è (Start) ¤È Wait(¥«¡¼¥½¥ëɽ¼¨ÂÔ¤Á)¤ÎʬΥ¡£
223b71206888 Initial import
thib
parents:
diff changeset
9 Start ¤¹¤ë¤Èʸ»ú¤òÉÁ²è³«»Ï¤¹¤ë¡£¥¯¥ê¥Ã¥¯¤ÇÁ´ÉÁ²è¡£
223b71206888 Initial import
thib
parents:
diff changeset
10 Flush ¤¹¤ë¤È¥Ð¥Ã¥Õ¥¡Æâ¤Îʸ»ú¤ò¤¹¤Ù¤ÆÉÁ²è¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
11 Wait ¤¹¤ë¤ÈÁ´ÉÁ²è¸å¡¢¥¯¥ê¥Ã¥¯¤µ¤ì¤ë¤Þ¤Ç¥«¡¼¥½¥ë¤òɽ¼¨¤¹¤ë¤Þ¤ÇÂÔ¤Ä
223b71206888 Initial import
thib
parents:
diff changeset
12 TextImpl ¦¤Î¾õÂ֤Ȥ·¤Æ¤Ï Wait ¤Î¤ß¤ò»ý¤Ä (PREPARE¤ËÌá¤ë¤Î¤òÂÔ¤Ä)
223b71206888 Initial import
thib
parents:
diff changeset
13 ¤¿¤À¤·¡¢Skip ¤Î¸¢Íø¤Ï¤É¤Ã¤Á¤¬¤â¤Ä¡©¡Ê¸½¾õ¤Ï¡©¡Ë
223b71206888 Initial import
thib
parents:
diff changeset
14
223b71206888 Initial import
thib
parents:
diff changeset
15 GrpObj: NextObj ¤È GrpObj ¤òʬΥ¡£CreateObj ¤Ï¸½¾õÄ̤ꡢVisible=1 »þ¤Ë¹Ô¤¦¡£
223b71206888 Initial import
thib
parents:
diff changeset
16 ¤½¤ì¤¾¤ì num=0 (screen) ¤Î»Þleaf ¤È¤·¤Æ¼ÂÁõ¡£delete»þ¤Ï¿Æ¤Îdelete¤Î¤ß¤ò
223b71206888 Initial import
thib
parents:
diff changeset
17 ¹Ô¤¤¡¢»Ò¤ÏGrpObj¤Î¼ÂÂΤÀ¤±¤òºï½ü¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
18 Visible ¸å¤Îhide ¤Ï¼ÂºÝ¤Ë hide ¤È¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
19 ExecReservedCmd() ¤Ï¤Ê¤¯¤»¤ë¤Ï¤º¡£Delete() ¤â¤Ê¤¯¤Ê¤ë¡£
223b71206888 Initial import
thib
parents:
diff changeset
20 ¥«¥Î¥®¡§ReBlit() ¤¬¤¦¤Þ¤¯¤¤¤«¤Ê¤¤¤»¤¤¤Ç̾Á°¥¦¥£¥ó¥É¥¦¤¬¾Ã¤¨¤¿»þ¤ÎÇطʤ¬¤Ê¤¯¤Ê¤ë
223b71206888 Initial import
thib
parents:
diff changeset
21
223b71206888 Initial import
thib
parents:
diff changeset
22 ¤¯¤é¡§²óÁÛɽ¼¨
223b71206888 Initial import
thib
parents:
diff changeset
23 SEL²èÁü¸ú²Ì
223b71206888 Initial import
thib
parents:
diff changeset
24 DONE:
223b71206888 Initial import
thib
parents:
diff changeset
25 ¤È¤â¤è¤Î¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¼ÂÁõ¡¢¥Ü¥¿¥ó¼ÂÁõ
223b71206888 Initial import
thib
parents:
diff changeset
26 shake ¤Î²èÁü¸ú²Ì
223b71206888 Initial import
thib
parents:
diff changeset
27 ¥ª¥Ö¥¸¥§¥¯¥ÈÆâ¤Î¥Æ¥­¥¹¥È¿§¤Î¼ÂÁõ
223b71206888 Initial import
thib
parents:
diff changeset
28 ²èÁü¸ú²Ì¤Î²þÁ±
223b71206888 Initial import
thib
parents:
diff changeset
29 */
223b71206888 Initial import
thib
parents:
diff changeset
30
223b71206888 Initial import
thib
parents:
diff changeset
31 /*
223b71206888 Initial import
thib
parents:
diff changeset
32 * Copyright (c) 2004-2006 Kazunori "jagarl" Ueno
223b71206888 Initial import
thib
parents:
diff changeset
33 * All rights reserved.
223b71206888 Initial import
thib
parents:
diff changeset
34 *
223b71206888 Initial import
thib
parents:
diff changeset
35 * Redistribution and use in source and binary forms, with or without
223b71206888 Initial import
thib
parents:
diff changeset
36 * modification, are permitted provided that the following conditions
223b71206888 Initial import
thib
parents:
diff changeset
37 * are met:
223b71206888 Initial import
thib
parents:
diff changeset
38 * 1. Redistributions of source code must retain the above copyright
223b71206888 Initial import
thib
parents:
diff changeset
39 * notice, this list of conditions and the following disclaimer.
223b71206888 Initial import
thib
parents:
diff changeset
40 * 2. Redistributions in binary form must reproduce the above copyright
223b71206888 Initial import
thib
parents:
diff changeset
41 * notice, this list of conditions and the following disclaimer in the
223b71206888 Initial import
thib
parents:
diff changeset
42 * documentation and/or other materials provided with the distribution.
223b71206888 Initial import
thib
parents:
diff changeset
43 * 3. The name of the author may not be used to endorse or promote products
223b71206888 Initial import
thib
parents:
diff changeset
44 * derived from this software without specific prior written permission.
223b71206888 Initial import
thib
parents:
diff changeset
45 *
223b71206888 Initial import
thib
parents:
diff changeset
46 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
223b71206888 Initial import
thib
parents:
diff changeset
47 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
223b71206888 Initial import
thib
parents:
diff changeset
48 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
223b71206888 Initial import
thib
parents:
diff changeset
49 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
223b71206888 Initial import
thib
parents:
diff changeset
50 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
223b71206888 Initial import
thib
parents:
diff changeset
51 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
223b71206888 Initial import
thib
parents:
diff changeset
52 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
223b71206888 Initial import
thib
parents:
diff changeset
53 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
223b71206888 Initial import
thib
parents:
diff changeset
54 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
223b71206888 Initial import
thib
parents:
diff changeset
55 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
223b71206888 Initial import
thib
parents:
diff changeset
56 */
223b71206888 Initial import
thib
parents:
diff changeset
57
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
58 #include "window/event.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
59 #include "window/picture.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
60 #include "window/widget.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
61 #include "system/file.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
62 #include "system/system_config.h"
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
63 #include "scn2k.h"
0
223b71206888 Initial import
thib
parents:
diff changeset
64
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
65 #include <string>
0
223b71206888 Initial import
thib
parents:
diff changeset
66 using namespace std;
223b71206888 Initial import
thib
parents:
diff changeset
67
223b71206888 Initial import
thib
parents:
diff changeset
68 // kanji conv : ¥Ç¥Ð¥Ã¥°É½¼¨ÍÑ
223b71206888 Initial import
thib
parents:
diff changeset
69 void kconv(const unsigned char* src, unsigned char* dest);
223b71206888 Initial import
thib
parents:
diff changeset
70 void kconv_rev(const unsigned char* src, unsigned char* dest);
223b71206888 Initial import
thib
parents:
diff changeset
71 string kconv(const string& s);
223b71206888 Initial import
thib
parents:
diff changeset
72 string kconv_rev(const string& s);
223b71206888 Initial import
thib
parents:
diff changeset
73 // render.cc
223b71206888 Initial import
thib
parents:
diff changeset
74 void DSurfaceFillA(Surface* src, const Rect& rect, int r, int g, int b, int a); // ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦ÇطʤÎÀßÄê
223b71206888 Initial import
thib
parents:
diff changeset
75 void DSurfaceMove(Surface* src_o, const Rect& srcrect, Surface* dst_o, const Rect& dstrect); // ¥³¥Ô¡¼
223b71206888 Initial import
thib
parents:
diff changeset
76
223b71206888 Initial import
thib
parents:
diff changeset
77 /**************************************************************::
223b71206888 Initial import
thib
parents:
diff changeset
78 **
223b71206888 Initial import
thib
parents:
diff changeset
79 ** TextImpl(interface)
223b71206888 Initial import
thib
parents:
diff changeset
80 */
223b71206888 Initial import
thib
parents:
diff changeset
81 struct TimerAtom {
223b71206888 Initial import
thib
parents:
diff changeset
82 int from;
223b71206888 Initial import
thib
parents:
diff changeset
83 int to;
223b71206888 Initial import
thib
parents:
diff changeset
84 unsigned int start_time;
223b71206888 Initial import
thib
parents:
diff changeset
85 unsigned int total_time;
223b71206888 Initial import
thib
parents:
diff changeset
86 };
223b71206888 Initial import
thib
parents:
diff changeset
87
223b71206888 Initial import
thib
parents:
diff changeset
88 struct TextWindow {
223b71206888 Initial import
thib
parents:
diff changeset
89 /* @@@ : SetWindowColor ¤Ç¤Î surface ºÆÀßÄê¤ËÃí°Õ */
223b71206888 Initial import
thib
parents:
diff changeset
90 WidText* wid;
223b71206888 Initial import
thib
parents:
diff changeset
91 bool name_visible;
223b71206888 Initial import
thib
parents:
diff changeset
92 WidLabel* name;
223b71206888 Initial import
thib
parents:
diff changeset
93 PicContainer* name_container;
223b71206888 Initial import
thib
parents:
diff changeset
94 PicBase* face;
223b71206888 Initial import
thib
parents:
diff changeset
95 PicBase* face_pics[8];
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
96 TextWindow(PicContainer& parent, Event::Container& event, int window_no, void* callback);
0
223b71206888 Initial import
thib
parents:
diff changeset
97 ~TextWindow() {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
98 if (name_container != NULL) {
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
99 delete name_container;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
100 name_container = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
101 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
102 int i;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
103 for (i=0; i<8; i++) {
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
104 if (face_pics[i] != NULL) {
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
105 delete face_pics[i];
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
106 face_pics[i] = NULL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
107 }
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
108 }
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
109 if (wid != NULL) {
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
110 delete wid;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
111 wid = NULL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
112 }
0
223b71206888 Initial import
thib
parents:
diff changeset
113 }
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
114 Rect WakuSize(PicContainer& pic, int waku_no);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
115 void MakeWaku(PicContainer& pic, Event::Container& event, int waku_no,int window_no, bool* use_btn, void* callback);
0
223b71206888 Initial import
thib
parents:
diff changeset
116 void show(void) {
223b71206888 Initial import
thib
parents:
diff changeset
117 wid->show();
223b71206888 Initial import
thib
parents:
diff changeset
118 if (name_container && name_visible) name_container->show();
223b71206888 Initial import
thib
parents:
diff changeset
119 if (face) face->show();
223b71206888 Initial import
thib
parents:
diff changeset
120 }
223b71206888 Initial import
thib
parents:
diff changeset
121 void hide(void) {
223b71206888 Initial import
thib
parents:
diff changeset
122 wid->hide();
223b71206888 Initial import
thib
parents:
diff changeset
123 if (name_container) name_container->hide();
223b71206888 Initial import
thib
parents:
diff changeset
124 if (face) face->hide();
223b71206888 Initial import
thib
parents:
diff changeset
125 }
223b71206888 Initial import
thib
parents:
diff changeset
126 void ShowFace(const char* path) {
223b71206888 Initial import
thib
parents:
diff changeset
127 if (!face) return;
223b71206888 Initial import
thib
parents:
diff changeset
128 face->SetSurface( path, 0,0);
223b71206888 Initial import
thib
parents:
diff changeset
129 }
223b71206888 Initial import
thib
parents:
diff changeset
130 void ResetFace(void) {
223b71206888 Initial import
thib
parents:
diff changeset
131 if (!face) return;
223b71206888 Initial import
thib
parents:
diff changeset
132 face->SetSurface( (Surface*)0, 0,0);
223b71206888 Initial import
thib
parents:
diff changeset
133 }
223b71206888 Initial import
thib
parents:
diff changeset
134 void StartText(const TextStream& _stream) {
223b71206888 Initial import
thib
parents:
diff changeset
135 wid->Clear();
223b71206888 Initial import
thib
parents:
diff changeset
136 wid->stream = _stream;
223b71206888 Initial import
thib
parents:
diff changeset
137 if (name_container) {
223b71206888 Initial import
thib
parents:
diff changeset
138 char namestr[1024];
223b71206888 Initial import
thib
parents:
diff changeset
139 namestr[0] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
140 wid->stream.RemoveName(namestr, 1024);
223b71206888 Initial import
thib
parents:
diff changeset
141 if (namestr[0] == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
142 name_container->hide();
223b71206888 Initial import
thib
parents:
diff changeset
143 } else {
223b71206888 Initial import
thib
parents:
diff changeset
144 if (name) {
223b71206888 Initial import
thib
parents:
diff changeset
145 name_container->show_all();
223b71206888 Initial import
thib
parents:
diff changeset
146 name->SetText(namestr);
223b71206888 Initial import
thib
parents:
diff changeset
147 }
223b71206888 Initial import
thib
parents:
diff changeset
148 }
223b71206888 Initial import
thib
parents:
diff changeset
149 }
223b71206888 Initial import
thib
parents:
diff changeset
150 wid->Start();
223b71206888 Initial import
thib
parents:
diff changeset
151 }
223b71206888 Initial import
thib
parents:
diff changeset
152 void SetName(const char* n) {
223b71206888 Initial import
thib
parents:
diff changeset
153 if (name_container && name) {
223b71206888 Initial import
thib
parents:
diff changeset
154 if (n[0]) {
223b71206888 Initial import
thib
parents:
diff changeset
155 name_container->show();
223b71206888 Initial import
thib
parents:
diff changeset
156 name->SetText(n);
223b71206888 Initial import
thib
parents:
diff changeset
157 name_visible = true;
223b71206888 Initial import
thib
parents:
diff changeset
158 } else {
223b71206888 Initial import
thib
parents:
diff changeset
159 name_container->hide();
223b71206888 Initial import
thib
parents:
diff changeset
160 name_visible = false;
223b71206888 Initial import
thib
parents:
diff changeset
161 }
223b71206888 Initial import
thib
parents:
diff changeset
162 }
223b71206888 Initial import
thib
parents:
diff changeset
163 }
223b71206888 Initial import
thib
parents:
diff changeset
164 };
223b71206888 Initial import
thib
parents:
diff changeset
165
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
166 class TextImpl : public CommandHandler {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
167 public:
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
168 TextImpl(Event::Container& _event, PicContainer& _parent, vector<BacklogItem>& parent_backlog, BacklogItem& parent_backlog_item);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
169 ~TextImpl();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
170 void InitWindow(void);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
171 void SetWindowColor(int r, int g, int b, int a, bool is_transparent);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
172 void SetTextSpeed(int new_speed);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
173 void SetTextWait(int new_wait);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
174 void CreateSelect(Cmd& cmd);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
175 void Exec(Cmd& cmd);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
176 bool Wait(unsigned int current_time, Cmd& cmd);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
177 void hide(void);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
178 void show(void) { show(text_window_number); }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
179 void show(int num);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
180 void DrawBacklog(BacklogItem& item, Cmd& cmd);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
181 void Save(std::string& str, bool select_save);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
182 void Load(const char* str);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
183 void SetSkipMode(SkipMode _mode);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
184 void CreateSelBG(void);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
185
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
186 void AddText(const char* str);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
187
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
188 static void PressFuncSkip(void* pointer, WidButton* from);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
189 static void PressFuncLoad(void* pointer, WidButton* from);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
190 static void PressFuncSave(void* pointer, WidButton* from);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
191 static void PressFuncBacklog(void* pointer, WidButton* from);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
192 static void PressFuncBacklogFwd(void* pointer, WidButton* from);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
193
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
194 private:
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
195 static void PressFuncButton(void* pointer, WidButton* from);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
196 static bool PressFunc(int x, int y, void* pointer);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
197 void SetCursor(int num);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
198
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
199 public:
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
200 TextWindow* text;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
201 typedef enum {NORMAL=0, WAIT_TEXT=1, WAIT=2,
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
202 WAIT_CLICK=3, WAIT_ABORT=4, WAIT_CLICK_MOUSEPOS = 5,
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
203 WAIT_CLICK_MOUSEPOSEND_L = 6, WAIT_CLICK_MOUSEPOSEND_R = 7,
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
204 WAIT_SELECT_INBOX = 10, WAIT_SELECT_OUTBOX=11, WAIT_SELECT_VALUE = 12,
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
205 WAIT_EXTRN_MASK = 64, SAVEMASK = 128, LOADMASK = 256, SKIPMASK = 512,
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
206 CLEARSCR_MASK = 1024, STATSAVE_MASK = 2048, CLEARSCR_WAIT_MASK=(1<<12),
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
207 SKIPEND_MASK = (1<<13), BACKLOG_MASK=(1<<14), BACKLOG_MASK_FWD=(1<<15),
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
208 BACKLOG_MASK_KOE=(1<<16), BACKLOG_WAIT_MASK=(1<<17),
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
209 ALLMASK = (CLEARSCR_MASK | WAIT_EXTRN_MASK | SAVEMASK |
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
210 LOADMASK | SKIPMASK | BACKLOG_MASK | BACKLOG_MASK_FWD |
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
211 BACKLOG_MASK_KOE | BACKLOG_WAIT_MASK | STATSAVE_MASK |
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
212 CLEARSCR_WAIT_MASK | SKIPEND_MASK)
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
213 } Status;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
214 Status status, status_saved, status_mask;
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
215
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
216 private:
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
217 std::string ruby_text;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
218 bool ruby_text_flag;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
219 unsigned int wait_time;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
220 unsigned int old_time;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
221 unsigned int base_time;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
222 int text_window_number;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
223 bool text_parsing;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
224 TextStream text_stream;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
225 SkipMode skip_mode;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
226 int save_selectcount;
0
223b71206888 Initial import
thib
parents:
diff changeset
227
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
228 std::map<int, TimerAtom> timer_var;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
229 std::vector<WidTextButton*> selects;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
230 std::vector<int> sel_backlog_pos;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
231 string replace_name[26];
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
232 string replace_name2[26];
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
233 PicContainer* sel_widget;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
234 PicWidget* backlog_widget;
0
223b71206888 Initial import
thib
parents:
diff changeset
235
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
236 vector<BacklogItem>& backlog;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
237 BacklogItem& backlog_item;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
238 BacklogItem cur_backlog_item;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
239 BacklogItem drawn_backlog_item;
0
223b71206888 Initial import
thib
parents:
diff changeset
240
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
241 TextWindow* widgets[32];
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
242 WidTimeCursor* kcursor;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
243 Surface* sel_bg1;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
244 Surface* sel_bg2;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
245 Rect sel_bg_rect;
0
223b71206888 Initial import
thib
parents:
diff changeset
246
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
247 VarInfo wait_savedvar[2];
0
223b71206888 Initial import
thib
parents:
diff changeset
248
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
249 AyuSysConfig *config;
0
223b71206888 Initial import
thib
parents:
diff changeset
250
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
251 Event::Container& event;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
252 PicContainer& parent;
0
223b71206888 Initial import
thib
parents:
diff changeset
253
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
254 //Opcode handling
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
255 void impl_txtClear(Cmd& cmd);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
256 void impl_logKoe(Cmd& cmd);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
257 void impl_pause(Cmd& cmd);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
258 void impl_br(Cmd& cmd);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
259 void impl_FaceOpen(Cmd& cmd);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
260 void impl_FaceClear(Cmd& cmd);
0
223b71206888 Initial import
thib
parents:
diff changeset
261 };
223b71206888 Initial import
thib
parents:
diff changeset
262
223b71206888 Initial import
thib
parents:
diff changeset
263 /**************************************************************::
223b71206888 Initial import
thib
parents:
diff changeset
264 **
223b71206888 Initial import
thib
parents:
diff changeset
265 ** TextImpl(implementation)
223b71206888 Initial import
thib
parents:
diff changeset
266 */
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
267 TextImpl::TextImpl(Event::Container& _event, PicContainer& _parent, vector<BacklogItem>& parent_backlog, BacklogItem& parent_backlog_item) :
0
223b71206888 Initial import
thib
parents:
diff changeset
268 text(0),status(TextImpl::NORMAL), status_saved(TextImpl::NORMAL), status_mask(TextImpl::NORMAL), ruby_text_flag(false),
223b71206888 Initial import
thib
parents:
diff changeset
269 old_time(0), base_time(0), text_window_number(0), text_parsing(false), skip_mode(SKIP_NO), save_selectcount(0), sel_widget(0),
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
270 backlog_widget(0), backlog(parent_backlog), backlog_item(parent_backlog_item), parent(_parent), event(_event),
0
223b71206888 Initial import
thib
parents:
diff changeset
271 kcursor(0), sel_bg1(0), sel_bg2(0), sel_bg_rect(0,0,0,0) {
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
272 config = AyuSysConfig::GetInstance();
0
223b71206888 Initial import
thib
parents:
diff changeset
273 int i;
223b71206888 Initial import
thib
parents:
diff changeset
274 for (i=0; i<32; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
275 widgets[i] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
276 }
223b71206888 Initial import
thib
parents:
diff changeset
277 text_stream.kanji_type = TextStream::sjis;
223b71206888 Initial import
thib
parents:
diff changeset
278 event.RegisterGlobalPressFunc(&PressFunc, (void*)this);
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
279
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
280 RegisterCommand(1, 33, 73, "grpOpenBg", (CmdImpl) &TextImpl::impl_txtClear);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
281 RegisterCommand(1, 33, 75, "grpMulti", (CmdImpl) &TextImpl::impl_txtClear);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
282 RegisterCommand(1, 33, 76, "grpOpen", (CmdImpl) &TextImpl::impl_txtClear);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
283
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
284 RegisterCommand(1, 23, 0, "koePlay", (CmdImpl) &TextImpl::impl_logKoe);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
285 RegisterCommand(1, 23, 8, "koeDoPlay", (CmdImpl) &TextImpl::impl_logKoe);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
286
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
287 RegisterCommand(0, 3, 151, "msgHide", (CmdImpl) &TextImpl::impl_txtClear);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
288 RegisterCommand(0, 3, 17, "pause", (CmdImpl) &TextImpl::impl_pause);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
289 RegisterCommand(0, 3, 3, "par", (CmdImpl) &TextImpl::impl_br); //FIXME
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
290 RegisterCommand(0, 3, 201, "br", (CmdImpl) &TextImpl::impl_br);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
291 RegisterCommand(0, 3, 1000, "FaceOpen", (CmdImpl) &TextImpl::impl_FaceOpen);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
292 RegisterCommand(0, 3, 1001, "FaceClear", (CmdImpl) &TextImpl::impl_FaceClear);
0
223b71206888 Initial import
thib
parents:
diff changeset
293 }
223b71206888 Initial import
thib
parents:
diff changeset
294
223b71206888 Initial import
thib
parents:
diff changeset
295 TextImpl::~TextImpl() {
223b71206888 Initial import
thib
parents:
diff changeset
296 if (sel_widget) delete sel_widget;
223b71206888 Initial import
thib
parents:
diff changeset
297 int i;
223b71206888 Initial import
thib
parents:
diff changeset
298 for (i=0; i<32; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
299 if (widgets[i]) delete widgets[i];
223b71206888 Initial import
thib
parents:
diff changeset
300 }
223b71206888 Initial import
thib
parents:
diff changeset
301 if (backlog_widget) delete backlog_widget;
223b71206888 Initial import
thib
parents:
diff changeset
302 if (sel_bg1) parent.Root().DeleteSurface(sel_bg1);
223b71206888 Initial import
thib
parents:
diff changeset
303 if (sel_bg2) parent.Root().DeleteSurface(sel_bg2);
223b71206888 Initial import
thib
parents:
diff changeset
304 event.DeleteGlobalPressFunc(&PressFunc, (void*)this);
223b71206888 Initial import
thib
parents:
diff changeset
305 }
223b71206888 Initial import
thib
parents:
diff changeset
306
223b71206888 Initial import
thib
parents:
diff changeset
307 bool TextImpl::PressFunc(int x, int y, void* pointer) {
223b71206888 Initial import
thib
parents:
diff changeset
308 TextImpl* t = (TextImpl*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
309 if (t->status == WAIT_CLICK) {
223b71206888 Initial import
thib
parents:
diff changeset
310 t->status = WAIT_ABORT;
223b71206888 Initial import
thib
parents:
diff changeset
311 } else if (t->status == WAIT_CLICK_MOUSEPOS) {
223b71206888 Initial import
thib
parents:
diff changeset
312 t->status = WAIT_CLICK_MOUSEPOSEND_L;
223b71206888 Initial import
thib
parents:
diff changeset
313 } else if (t->status_mask & CLEARSCR_WAIT_MASK) {
223b71206888 Initial import
thib
parents:
diff changeset
314 t->status_mask = Status(t->status_mask & (~CLEARSCR_WAIT_MASK));
223b71206888 Initial import
thib
parents:
diff changeset
315 if (t->text) t->text->show();
223b71206888 Initial import
thib
parents:
diff changeset
316 if (t->kcursor) {
223b71206888 Initial import
thib
parents:
diff changeset
317 if (t->status == WAIT_TEXT) t->kcursor->show();
223b71206888 Initial import
thib
parents:
diff changeset
318 }
223b71206888 Initial import
thib
parents:
diff changeset
319 if (t->sel_widget) t->sel_widget->show();
223b71206888 Initial import
thib
parents:
diff changeset
320 if (t->backlog_widget) t->backlog_widget->show();
223b71206888 Initial import
thib
parents:
diff changeset
321 } else if (t->status_mask & BACKLOG_WAIT_MASK) {
223b71206888 Initial import
thib
parents:
diff changeset
322 t->status_mask = Status(t->status_mask | BACKLOG_MASK_KOE);
223b71206888 Initial import
thib
parents:
diff changeset
323 } else if ( (t->skip_mode & SKIP_TEXT) && (!(t->skip_mode & SKIP_IN_MENU)) ) {
223b71206888 Initial import
thib
parents:
diff changeset
324 if (t->status == WAIT_SELECT_INBOX) ;
223b71206888 Initial import
thib
parents:
diff changeset
325 else if (t->status == WAIT_SELECT_OUTBOX) ;
223b71206888 Initial import
thib
parents:
diff changeset
326 else if (t->status == WAIT_SELECT_VALUE) ;
223b71206888 Initial import
thib
parents:
diff changeset
327 else t->status_mask = Status(t->status_mask | SKIPEND_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
328 }
223b71206888 Initial import
thib
parents:
diff changeset
329 return true; // event not deleted
223b71206888 Initial import
thib
parents:
diff changeset
330 }
223b71206888 Initial import
thib
parents:
diff changeset
331 void TextImpl::PressFuncButton(void* pointer, WidButton* from) {
223b71206888 Initial import
thib
parents:
diff changeset
332 TextImpl* t = (TextImpl*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
333 if (t->status != WAIT_SELECT_INBOX && t->status != WAIT_SELECT_OUTBOX) return;
223b71206888 Initial import
thib
parents:
diff changeset
334 vector<WidTextButton*>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
335 int sel = 0;
223b71206888 Initial import
thib
parents:
diff changeset
336 for (it=t->selects.begin(); it != t->selects.end(); it++, sel++) {
223b71206888 Initial import
thib
parents:
diff changeset
337 if (from == *it) break;
223b71206888 Initial import
thib
parents:
diff changeset
338 }
223b71206888 Initial import
thib
parents:
diff changeset
339 if (it == t->selects.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
340 fprintf(stderr,"TextImpl::PressFuncButton: Cannot find select widget\n");
223b71206888 Initial import
thib
parents:
diff changeset
341 return;
223b71206888 Initial import
thib
parents:
diff changeset
342 }
223b71206888 Initial import
thib
parents:
diff changeset
343 t->status = Status(WAIT_SELECT_VALUE + sel);
223b71206888 Initial import
thib
parents:
diff changeset
344 return;
223b71206888 Initial import
thib
parents:
diff changeset
345 }
223b71206888 Initial import
thib
parents:
diff changeset
346
223b71206888 Initial import
thib
parents:
diff changeset
347 void TextImpl::SetSkipMode(SkipMode _mode) {
223b71206888 Initial import
thib
parents:
diff changeset
348 if ( (skip_mode & SKIP_IN_MENU) && (_mode & SKIP_IN_MENU) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
349 if (status_mask & BACKLOG_WAIT_MASK) { // backlog mode ¤«¤éÉüµ¢
223b71206888 Initial import
thib
parents:
diff changeset
350 status_mask = Status(status_mask & (~(BACKLOG_MASK|BACKLOG_MASK_FWD|BACKLOG_MASK_KOE|BACKLOG_WAIT_MASK)));
223b71206888 Initial import
thib
parents:
diff changeset
351 text->wid->Clear();
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
352 if (status == WAIT_TEXT && text != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
353 text->StartText(text_stream);
223b71206888 Initial import
thib
parents:
diff changeset
354 text->ShowFace(backlog_item.face.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
355 text->wid->Flush();
223b71206888 Initial import
thib
parents:
diff changeset
356 if (kcursor) kcursor->show();
223b71206888 Initial import
thib
parents:
diff changeset
357 }
223b71206888 Initial import
thib
parents:
diff changeset
358 drawn_backlog_item.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
359 }
223b71206888 Initial import
thib
parents:
diff changeset
360 if (text) text->wid->activate();
223b71206888 Initial import
thib
parents:
diff changeset
361 if (sel_widget) {
223b71206888 Initial import
thib
parents:
diff changeset
362 sel_widget->show();
223b71206888 Initial import
thib
parents:
diff changeset
363 if (kcursor) kcursor->hide();
223b71206888 Initial import
thib
parents:
diff changeset
364 }
223b71206888 Initial import
thib
parents:
diff changeset
365 if (backlog_widget) backlog_widget->show();
223b71206888 Initial import
thib
parents:
diff changeset
366 if (status_mask & STATSAVE_MASK) {
223b71206888 Initial import
thib
parents:
diff changeset
367 status_mask = Status(status_mask & (~STATSAVE_MASK));
223b71206888 Initial import
thib
parents:
diff changeset
368 status = status_saved;
223b71206888 Initial import
thib
parents:
diff changeset
369 }
223b71206888 Initial import
thib
parents:
diff changeset
370 } else if ( (skip_mode & SKIP_IN_MENU) == 0 && (_mode & SKIP_IN_MENU) ) {
223b71206888 Initial import
thib
parents:
diff changeset
371 if (text) text->wid->deactivate();
223b71206888 Initial import
thib
parents:
diff changeset
372 if (sel_widget) sel_widget->hide();
223b71206888 Initial import
thib
parents:
diff changeset
373 if (backlog_widget) backlog_widget->hide();
223b71206888 Initial import
thib
parents:
diff changeset
374 }
223b71206888 Initial import
thib
parents:
diff changeset
375 skip_mode = _mode;
223b71206888 Initial import
thib
parents:
diff changeset
376 }
223b71206888 Initial import
thib
parents:
diff changeset
377
223b71206888 Initial import
thib
parents:
diff changeset
378 /* hash_map ¤¬Íߤ·¤¤¡Ä¡Ä*/
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
379 #include <map>
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
380 #include <list>
0
223b71206888 Initial import
thib
parents:
diff changeset
381 struct SaveFaceHash { // ¥Ð¥Ã¥¯¥í¥°¥»¡¼¥Ö»þ¤Î´é²èÁü´ÉÍý¤ò¹Ô¤¦
223b71206888 Initial import
thib
parents:
diff changeset
382 map<string, int> facetonum;
223b71206888 Initial import
thib
parents:
diff changeset
383 typedef pair<string,int> Node;
223b71206888 Initial import
thib
parents:
diff changeset
384 typedef list<Node> List;
223b71206888 Initial import
thib
parents:
diff changeset
385 List container;
223b71206888 Initial import
thib
parents:
diff changeset
386 int id_max;
223b71206888 Initial import
thib
parents:
diff changeset
387 static int size_max;
223b71206888 Initial import
thib
parents:
diff changeset
388 SaveFaceHash() : id_max(0) {
223b71206888 Initial import
thib
parents:
diff changeset
389 }
223b71206888 Initial import
thib
parents:
diff changeset
390 void NewNode(string face, int face_id) {
223b71206888 Initial import
thib
parents:
diff changeset
391 facetonum[face] = face_id;
223b71206888 Initial import
thib
parents:
diff changeset
392 container.push_front(Node(face, face_id));
223b71206888 Initial import
thib
parents:
diff changeset
393 if (container.size() > size_max) {
223b71206888 Initial import
thib
parents:
diff changeset
394 Node remove = container.back();
223b71206888 Initial import
thib
parents:
diff changeset
395 container.pop_back();
223b71206888 Initial import
thib
parents:
diff changeset
396 facetonum.erase(remove.first);
223b71206888 Initial import
thib
parents:
diff changeset
397 }
223b71206888 Initial import
thib
parents:
diff changeset
398 }
223b71206888 Initial import
thib
parents:
diff changeset
399 int Add(string face) {
223b71206888 Initial import
thib
parents:
diff changeset
400 int id; int ret = -1;
223b71206888 Initial import
thib
parents:
diff changeset
401 int i; List::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
402 if (face.empty()) return -1;
223b71206888 Initial import
thib
parents:
diff changeset
403 if (facetonum.find(face) == facetonum.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
404 id = ++id_max;
223b71206888 Initial import
thib
parents:
diff changeset
405 NewNode(face, id);
223b71206888 Initial import
thib
parents:
diff changeset
406 ret = -1;
223b71206888 Initial import
thib
parents:
diff changeset
407 } else {
223b71206888 Initial import
thib
parents:
diff changeset
408 id = facetonum[face];
223b71206888 Initial import
thib
parents:
diff changeset
409 for (i=0, it=container.begin(); it != container.end(); i++, it++) {
223b71206888 Initial import
thib
parents:
diff changeset
410 if (it->second == id) {
223b71206888 Initial import
thib
parents:
diff changeset
411 ret = i;
223b71206888 Initial import
thib
parents:
diff changeset
412 Node n = *it;
223b71206888 Initial import
thib
parents:
diff changeset
413 container.erase(it);
223b71206888 Initial import
thib
parents:
diff changeset
414 container.push_front(n);
223b71206888 Initial import
thib
parents:
diff changeset
415 break;
223b71206888 Initial import
thib
parents:
diff changeset
416 }
223b71206888 Initial import
thib
parents:
diff changeset
417 }
223b71206888 Initial import
thib
parents:
diff changeset
418 }
223b71206888 Initial import
thib
parents:
diff changeset
419 return ret;
223b71206888 Initial import
thib
parents:
diff changeset
420 }
223b71206888 Initial import
thib
parents:
diff changeset
421 string Get(int num) {
223b71206888 Initial import
thib
parents:
diff changeset
422 if (num < 0) return "";
223b71206888 Initial import
thib
parents:
diff changeset
423 List::iterator it = container.begin();
223b71206888 Initial import
thib
parents:
diff changeset
424 for (; it != container.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
425 if (num == 0) return it->first;
223b71206888 Initial import
thib
parents:
diff changeset
426 num--;
223b71206888 Initial import
thib
parents:
diff changeset
427 }
223b71206888 Initial import
thib
parents:
diff changeset
428 return "";
223b71206888 Initial import
thib
parents:
diff changeset
429 }
223b71206888 Initial import
thib
parents:
diff changeset
430 };
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
431
0
223b71206888 Initial import
thib
parents:
diff changeset
432 int SaveFaceHash::size_max = 20;
223b71206888 Initial import
thib
parents:
diff changeset
433
223b71206888 Initial import
thib
parents:
diff changeset
434 void TextImpl::Save(string& str, bool rollback_save) {
223b71206888 Initial import
thib
parents:
diff changeset
435 char buf[1024];
223b71206888 Initial import
thib
parents:
diff changeset
436 str = "\n";
223b71206888 Initial import
thib
parents:
diff changeset
437 str += "[TextImpl Window]\n";
223b71206888 Initial import
thib
parents:
diff changeset
438 sprintf(buf, "TextImplWindow=%d\n",text_window_number);
223b71206888 Initial import
thib
parents:
diff changeset
439 str += buf;
223b71206888 Initial import
thib
parents:
diff changeset
440 if (rollback_save) {
223b71206888 Initial import
thib
parents:
diff changeset
441 ++save_selectcount;
223b71206888 Initial import
thib
parents:
diff changeset
442 BacklogItem save_item;
223b71206888 Initial import
thib
parents:
diff changeset
443 save_item.SetSavepos(save_selectcount);
223b71206888 Initial import
thib
parents:
diff changeset
444 backlog.push_back(save_item);
223b71206888 Initial import
thib
parents:
diff changeset
445 }
223b71206888 Initial import
thib
parents:
diff changeset
446 sprintf(buf, "SaveSelectCount=%d\n",save_selectcount);
223b71206888 Initial import
thib
parents:
diff changeset
447
223b71206888 Initial import
thib
parents:
diff changeset
448 str += buf;
223b71206888 Initial import
thib
parents:
diff changeset
449 int i;
223b71206888 Initial import
thib
parents:
diff changeset
450 for (i=0; i<26; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
451 if (replace_name2[i].empty()) continue;
223b71206888 Initial import
thib
parents:
diff changeset
452 sprintf(buf, "RName.%c=%s\n",i+'A',replace_name2[i].c_str());
223b71206888 Initial import
thib
parents:
diff changeset
453 str += buf;
223b71206888 Initial import
thib
parents:
diff changeset
454 }
223b71206888 Initial import
thib
parents:
diff changeset
455 int cnt = 0;
223b71206888 Initial import
thib
parents:
diff changeset
456 vector<BacklogItem>::iterator it;
223b71206888 Initial import
thib
parents:
diff changeset
457 it = backlog.begin();
223b71206888 Initial import
thib
parents:
diff changeset
458 if (!rollback_save) {
223b71206888 Initial import
thib
parents:
diff changeset
459 SaveFaceHash face_log;
223b71206888 Initial import
thib
parents:
diff changeset
460 do {
223b71206888 Initial import
thib
parents:
diff changeset
461 int cur_scn = -1; int cur_pos = -1;
223b71206888 Initial import
thib
parents:
diff changeset
462 sprintf(buf, "Backlog.%d=",++cnt);
223b71206888 Initial import
thib
parents:
diff changeset
463 str += buf;
223b71206888 Initial import
thib
parents:
diff changeset
464 for (; it != backlog.end(); it++) {
223b71206888 Initial import
thib
parents:
diff changeset
465 buf[0] = 0; int buflen = 0;
223b71206888 Initial import
thib
parents:
diff changeset
466 if (it->scn == -1) continue;
223b71206888 Initial import
thib
parents:
diff changeset
467 if (it->pos == -1 && it->scn != 0) continue;
223b71206888 Initial import
thib
parents:
diff changeset
468
223b71206888 Initial import
thib
parents:
diff changeset
469 buf[buflen++] = ';';
223b71206888 Initial import
thib
parents:
diff changeset
470 if (it->scn == 0 && it->pos == -1) {
223b71206888 Initial import
thib
parents:
diff changeset
471 buflen += snprintf(buf+buflen, 1000-buflen, "\"%s\".", it->text.Save().c_str());
223b71206888 Initial import
thib
parents:
diff changeset
472 } else {
223b71206888 Initial import
thib
parents:
diff changeset
473 if (cur_scn != -1 && cur_scn != it->scn) break; // scn change
223b71206888 Initial import
thib
parents:
diff changeset
474 if (cur_pos != -1 && cur_pos/5000 != it->pos/5000) break; // pos exceeded
223b71206888 Initial import
thib
parents:
diff changeset
475 if (!it->text.container.empty()) {
223b71206888 Initial import
thib
parents:
diff changeset
476 buflen += snprintf(buf+buflen, 1000-buflen, "\"%s\"", it->text.Save().c_str());
223b71206888 Initial import
thib
parents:
diff changeset
477 }
223b71206888 Initial import
thib
parents:
diff changeset
478 if (cur_scn == -1) { // scene change
223b71206888 Initial import
thib
parents:
diff changeset
479 buflen += snprintf(buf+buflen, 1000-buflen, ":%d:%d",it->scn,it->pos);
223b71206888 Initial import
thib
parents:
diff changeset
480 cur_scn = it->scn;
223b71206888 Initial import
thib
parents:
diff changeset
481 } else {
223b71206888 Initial import
thib
parents:
diff changeset
482 buflen += snprintf(buf+buflen, 1000-buflen, "%d",it->pos);
223b71206888 Initial import
thib
parents:
diff changeset
483 }
223b71206888 Initial import
thib
parents:
diff changeset
484 cur_pos = it->pos;
223b71206888 Initial import
thib
parents:
diff changeset
485 }
223b71206888 Initial import
thib
parents:
diff changeset
486 if (it->koe != -1)
223b71206888 Initial import
thib
parents:
diff changeset
487 buflen += snprintf(buf+buflen, 1000-buflen, ",%d",it->koe);
223b71206888 Initial import
thib
parents:
diff changeset
488 if (!it->face.empty()) {
223b71206888 Initial import
thib
parents:
diff changeset
489 if (it->koe == -1) buf[buflen++] = ',';
223b71206888 Initial import
thib
parents:
diff changeset
490 int face_num = face_log.Add(it->face);
223b71206888 Initial import
thib
parents:
diff changeset
491 if (face_num >= 0 && face_num < 20)
223b71206888 Initial import
thib
parents:
diff changeset
492 buflen += snprintf(buf+buflen, 1000-buflen, ",%c", 'A'+face_num);
223b71206888 Initial import
thib
parents:
diff changeset
493 else
223b71206888 Initial import
thib
parents:
diff changeset
494 buflen += snprintf(buf+buflen, 1000-buflen, ",\"%s\"", it->face.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
495 }
223b71206888 Initial import
thib
parents:
diff changeset
496 buf[buflen++] = '\0';
223b71206888 Initial import
thib
parents:
diff changeset
497 if (buflen >= 1000) { // Ëü¤¬°ì¡¢¥Ð¥Ã¥¯¥í¥°£±¥¢¥¤¥Æ¥à¤ÎÂ礭¤µ¤¬ 1000byte ¤ò±Û¤¨¤ë¤È¤­
223b71206888 Initial import
thib
parents:
diff changeset
498 fprintf(stderr,"Fatal : Cannot save backlog crrectly; Please send bug report to the author.\n");
223b71206888 Initial import
thib
parents:
diff changeset
499 } else str += buf;
223b71206888 Initial import
thib
parents:
diff changeset
500 }
223b71206888 Initial import
thib
parents:
diff changeset
501 str += "\n";
223b71206888 Initial import
thib
parents:
diff changeset
502 } while(it != backlog.end());
223b71206888 Initial import
thib
parents:
diff changeset
503 }
223b71206888 Initial import
thib
parents:
diff changeset
504 return;
223b71206888 Initial import
thib
parents:
diff changeset
505 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
506
0
223b71206888 Initial import
thib
parents:
diff changeset
507 void TextImpl::Load(const char* str) {
223b71206888 Initial import
thib
parents:
diff changeset
508 if (text) text->wid->Clear();
223b71206888 Initial import
thib
parents:
diff changeset
509 hide();
223b71206888 Initial import
thib
parents:
diff changeset
510 text_window_number = 0;
223b71206888 Initial import
thib
parents:
diff changeset
511 save_selectcount = 0;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
512 if (sel_widget != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
513 selects.clear();
223b71206888 Initial import
thib
parents:
diff changeset
514 sel_backlog_pos.clear();
223b71206888 Initial import
thib
parents:
diff changeset
515 delete sel_widget;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
516 sel_widget = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
517 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
518 if (backlog_widget != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
519 delete backlog_widget;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
520 backlog_widget = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
521 }
223b71206888 Initial import
thib
parents:
diff changeset
522 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
523 status_mask = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
524 status_saved = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
525 text_parsing = false;
223b71206888 Initial import
thib
parents:
diff changeset
526 text_stream.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
527 // backlog.clear();
223b71206888 Initial import
thib
parents:
diff changeset
528 vector<BacklogItem> new_backlog;
223b71206888 Initial import
thib
parents:
diff changeset
529 backlog_item.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
530 cur_backlog_item.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
531 drawn_backlog_item.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
532
223b71206888 Initial import
thib
parents:
diff changeset
533 str = strstr(str, "\n[TextImpl Window]\n");
223b71206888 Initial import
thib
parents:
diff changeset
534
223b71206888 Initial import
thib
parents:
diff changeset
535 if (str) {
223b71206888 Initial import
thib
parents:
diff changeset
536 SaveFaceHash face_log;
223b71206888 Initial import
thib
parents:
diff changeset
537 str += strlen("\n[TextImpl Window]\n");
223b71206888 Initial import
thib
parents:
diff changeset
538 const char* strend = str;
223b71206888 Initial import
thib
parents:
diff changeset
539 do {
223b71206888 Initial import
thib
parents:
diff changeset
540 str = strend;
223b71206888 Initial import
thib
parents:
diff changeset
541
223b71206888 Initial import
thib
parents:
diff changeset
542 strend = strchr(str, '\n');
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
543 if (strend == NULL) strend = str + strlen(str);
0
223b71206888 Initial import
thib
parents:
diff changeset
544 else strend++;
223b71206888 Initial import
thib
parents:
diff changeset
545
223b71206888 Initial import
thib
parents:
diff changeset
546 if (str[0] == '[') break; // next section
223b71206888 Initial import
thib
parents:
diff changeset
547 if (strncmp(str, "TextImplWindow=",15) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
548 str += 15;
223b71206888 Initial import
thib
parents:
diff changeset
549 sscanf(str, "%d", &text_window_number);
223b71206888 Initial import
thib
parents:
diff changeset
550 } else if (strncmp(str, "SaveSelectCount=",16) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
551 str += 16;
223b71206888 Initial import
thib
parents:
diff changeset
552 sscanf(str, "%d", &save_selectcount);
223b71206888 Initial import
thib
parents:
diff changeset
553 } else if (strncmp(str, "RName.", 6) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
554 int n = str[6]-'A';
223b71206888 Initial import
thib
parents:
diff changeset
555 if (n >= 0 && n < 26 && str[7] == '=') {
223b71206888 Initial import
thib
parents:
diff changeset
556 const char* s = strchr(str, '\n');
223b71206888 Initial import
thib
parents:
diff changeset
557 int len = -1;
223b71206888 Initial import
thib
parents:
diff changeset
558 if (s) len = s-(str+8);
223b71206888 Initial import
thib
parents:
diff changeset
559 if (len > 0) {
223b71206888 Initial import
thib
parents:
diff changeset
560 replace_name2[n].assign(str+8, len);
223b71206888 Initial import
thib
parents:
diff changeset
561 }
223b71206888 Initial import
thib
parents:
diff changeset
562 }
223b71206888 Initial import
thib
parents:
diff changeset
563 } else if (strncmp(str, "Backlog.", 8) == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
564 int cur_scn = -1;
223b71206888 Initial import
thib
parents:
diff changeset
565 int n = -1;
223b71206888 Initial import
thib
parents:
diff changeset
566 sscanf(str+8, "%d", &n); /* not used */
223b71206888 Initial import
thib
parents:
diff changeset
567 const char* next_str = strchr(str, ';');
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
568 while(next_str != NULL && next_str < strend) {
0
223b71206888 Initial import
thib
parents:
diff changeset
569 str = next_str + 1;
223b71206888 Initial import
thib
parents:
diff changeset
570 next_str = strchr(str, ';');
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
571 if (next_str == NULL) next_str = strend;
0
223b71206888 Initial import
thib
parents:
diff changeset
572
223b71206888 Initial import
thib
parents:
diff changeset
573 BacklogItem item;
223b71206888 Initial import
thib
parents:
diff changeset
574 if (str[0] == '"') {
223b71206888 Initial import
thib
parents:
diff changeset
575 const char* send = strchr(str+1, '"');
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
576 if (send == NULL || send > next_str) continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
577 string tmp_str; tmp_str.assign(str+1, send-str-1);
223b71206888 Initial import
thib
parents:
diff changeset
578 item.DeleteTextPos();
223b71206888 Initial import
thib
parents:
diff changeset
579 item.text.Load(tmp_str);
223b71206888 Initial import
thib
parents:
diff changeset
580 str = send + 1;
223b71206888 Initial import
thib
parents:
diff changeset
581 }
223b71206888 Initial import
thib
parents:
diff changeset
582 if (str[0] == '.') {
223b71206888 Initial import
thib
parents:
diff changeset
583 item.DeleteTextPos();
223b71206888 Initial import
thib
parents:
diff changeset
584 str++;
223b71206888 Initial import
thib
parents:
diff changeset
585 } else if (str[0] == ':') {
223b71206888 Initial import
thib
parents:
diff changeset
586 sscanf(str, ":%d:%d", &item.scn, &item.pos);
223b71206888 Initial import
thib
parents:
diff changeset
587 cur_scn = item.scn;
223b71206888 Initial import
thib
parents:
diff changeset
588
223b71206888 Initial import
thib
parents:
diff changeset
589 } else {
223b71206888 Initial import
thib
parents:
diff changeset
590 item.scn = cur_scn;
223b71206888 Initial import
thib
parents:
diff changeset
591 sscanf(str, "%d", &item.pos);
223b71206888 Initial import
thib
parents:
diff changeset
592 }
223b71206888 Initial import
thib
parents:
diff changeset
593 str = strchr(str, ',');
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
594 if (str == NULL || str > next_str) goto backlog_store;
0
223b71206888 Initial import
thib
parents:
diff changeset
595 str++;
223b71206888 Initial import
thib
parents:
diff changeset
596 if (str[0] == ';' || str[0] == ',')
223b71206888 Initial import
thib
parents:
diff changeset
597 item.koe = -1;
223b71206888 Initial import
thib
parents:
diff changeset
598 else
223b71206888 Initial import
thib
parents:
diff changeset
599 sscanf(str, "%d", &item.koe);
223b71206888 Initial import
thib
parents:
diff changeset
600 str = strchr(str, ',');
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
601 if (str == NULL || str > next_str) goto backlog_store;
0
223b71206888 Initial import
thib
parents:
diff changeset
602 str++;
223b71206888 Initial import
thib
parents:
diff changeset
603 if (*str == '"') {
223b71206888 Initial import
thib
parents:
diff changeset
604 const char* send = strchr(str+1, '"');
223b71206888 Initial import
thib
parents:
diff changeset
605 if (send) {
223b71206888 Initial import
thib
parents:
diff changeset
606 item.face.assign(str+1, send-str-1);
223b71206888 Initial import
thib
parents:
diff changeset
607 }
223b71206888 Initial import
thib
parents:
diff changeset
608 } else if (*str >= 'A' && *str <= 'Z') {
223b71206888 Initial import
thib
parents:
diff changeset
609 item.face = face_log.Get(*str - 'A');
223b71206888 Initial import
thib
parents:
diff changeset
610 }
223b71206888 Initial import
thib
parents:
diff changeset
611 face_log.Add(item.face);
223b71206888 Initial import
thib
parents:
diff changeset
612 backlog_store:
223b71206888 Initial import
thib
parents:
diff changeset
613 new_backlog.push_back(item);
223b71206888 Initial import
thib
parents:
diff changeset
614 }
223b71206888 Initial import
thib
parents:
diff changeset
615 }
223b71206888 Initial import
thib
parents:
diff changeset
616 } while (*strend != 0);
223b71206888 Initial import
thib
parents:
diff changeset
617 }
223b71206888 Initial import
thib
parents:
diff changeset
618 if (new_backlog.empty() && (!backlog.empty())) { // empty ¤Ê¤é save_selectcount ¤Þ¤Ç backlog ¤ò´¬¤­Ì᤹
223b71206888 Initial import
thib
parents:
diff changeset
619 vector<BacklogItem>::iterator it = backlog.end();
223b71206888 Initial import
thib
parents:
diff changeset
620 do {
223b71206888 Initial import
thib
parents:
diff changeset
621 it--;
223b71206888 Initial import
thib
parents:
diff changeset
622 if (it->scn == BacklogItem::SaveSelect && it->pos == save_selectcount) {
223b71206888 Initial import
thib
parents:
diff changeset
623 // Save °ÌÃÖ¤ò¸«¤Ä¤±¤¿¤é¤½¤ì°Ê¹ß¤ò erase
223b71206888 Initial import
thib
parents:
diff changeset
624 backlog.erase(it, backlog.end());
223b71206888 Initial import
thib
parents:
diff changeset
625 break;
223b71206888 Initial import
thib
parents:
diff changeset
626 }
223b71206888 Initial import
thib
parents:
diff changeset
627 } while(it != backlog.begin());
223b71206888 Initial import
thib
parents:
diff changeset
628 --save_selectcount;
223b71206888 Initial import
thib
parents:
diff changeset
629 } else {
223b71206888 Initial import
thib
parents:
diff changeset
630 backlog.swap(new_backlog);
223b71206888 Initial import
thib
parents:
diff changeset
631 }
223b71206888 Initial import
thib
parents:
diff changeset
632 // backlog.clear();
223b71206888 Initial import
thib
parents:
diff changeset
633 }
223b71206888 Initial import
thib
parents:
diff changeset
634
223b71206888 Initial import
thib
parents:
diff changeset
635 void TextImpl::hide(void) {
223b71206888 Initial import
thib
parents:
diff changeset
636 if (text) text->hide();
223b71206888 Initial import
thib
parents:
diff changeset
637 if (kcursor) kcursor->hide();
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
638 text = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
639 }
223b71206888 Initial import
thib
parents:
diff changeset
640 void TextImpl::show(int num) {
223b71206888 Initial import
thib
parents:
diff changeset
641 if (num != text_window_number) {
223b71206888 Initial import
thib
parents:
diff changeset
642 hide();
223b71206888 Initial import
thib
parents:
diff changeset
643 if (num >= 0 && num < 32 && widgets[num] != 0) {
223b71206888 Initial import
thib
parents:
diff changeset
644 text_window_number = num;
223b71206888 Initial import
thib
parents:
diff changeset
645 }
223b71206888 Initial import
thib
parents:
diff changeset
646 }
223b71206888 Initial import
thib
parents:
diff changeset
647 text = widgets[text_window_number];
223b71206888 Initial import
thib
parents:
diff changeset
648 text->show();
223b71206888 Initial import
thib
parents:
diff changeset
649 if (kcursor) {
223b71206888 Initial import
thib
parents:
diff changeset
650 int kx, ky, d;
223b71206888 Initial import
thib
parents:
diff changeset
651 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
652 sprintf(key, "#WINDOW.%03d.KEYCUR_MOD", text_window_number);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
653 config->GetParam(key, 3, &d, &kx, &ky);
0
223b71206888 Initial import
thib
parents:
diff changeset
654 // Àµ¤·¤¯¤Ê¤¤µ¤¤¬¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
655 kx += text->wid->Pic()->PosX();
223b71206888 Initial import
thib
parents:
diff changeset
656 ky += text->wid->Pic()->PosY();
223b71206888 Initial import
thib
parents:
diff changeset
657 // Èù̯¤Ë²¼¤Ë¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
658 ky += 8;
223b71206888 Initial import
thib
parents:
diff changeset
659 kcursor->Pic()->Move(kx, ky);
223b71206888 Initial import
thib
parents:
diff changeset
660 }
223b71206888 Initial import
thib
parents:
diff changeset
661 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
662
0
223b71206888 Initial import
thib
parents:
diff changeset
663 void TextImpl::DrawBacklog(BacklogItem& item, Cmd& cmd) {
18
4d7486cb20a9 Sync with upstream
thib
parents: 17
diff changeset
664 show();
0
223b71206888 Initial import
thib
parents:
diff changeset
665 text->wid->deactivate();
223b71206888 Initial import
thib
parents:
diff changeset
666 status_mask = Status(status_mask | BACKLOG_WAIT_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
667 drawn_backlog_item = item;
223b71206888 Initial import
thib
parents:
diff changeset
668 if (item.text.container.empty()) {
223b71206888 Initial import
thib
parents:
diff changeset
669 // cmd ¤«¤é text ÆâÍƤòºÆ¹½À®
223b71206888 Initial import
thib
parents:
diff changeset
670 TextStream saved_text = text_stream;
223b71206888 Initial import
thib
parents:
diff changeset
671 text_stream.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
672 AddText(cmd.Str(cmd.args[0]));
223b71206888 Initial import
thib
parents:
diff changeset
673 item.text = text_stream;
223b71206888 Initial import
thib
parents:
diff changeset
674 text_stream = saved_text;
223b71206888 Initial import
thib
parents:
diff changeset
675 }
18
4d7486cb20a9 Sync with upstream
thib
parents: 17
diff changeset
676 item.text.InsertColor(0, item.text.container.size(), 0xff,0xff,0);
17
a95c130b567b Shows name in backlog
thib
parents: 0
diff changeset
677 text->StartText(item.text);
0
223b71206888 Initial import
thib
parents:
diff changeset
678 text->wid->Flush();
223b71206888 Initial import
thib
parents:
diff changeset
679 if (item.face.empty()) text->ResetFace();
223b71206888 Initial import
thib
parents:
diff changeset
680 else text->ShowFace(item.face.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
681 if (kcursor) kcursor->hide();
223b71206888 Initial import
thib
parents:
diff changeset
682 }
223b71206888 Initial import
thib
parents:
diff changeset
683
223b71206888 Initial import
thib
parents:
diff changeset
684 void TextImpl::CreateSelBG(void) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
685 if (sel_bg1 != NULL || sel_bg2 != NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
686
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
687 const char* btnfile1 = config->GetParaStr("#SELBTN.000.NAME");
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
688 const char* btnfile2 = config->GetParaStr("#SELBTN.000.BACK");
0
223b71206888 Initial import
thib
parents:
diff changeset
689 char path[1024];
223b71206888 Initial import
thib
parents:
diff changeset
690 strcpy(path, btnfile1);
223b71206888 Initial import
thib
parents:
diff changeset
691 sel_bg1 = parent.Root().NewSurface(path);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
692 if (sel_bg1 == NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
693 sprintf(path,"%s.g00",btnfile1);
223b71206888 Initial import
thib
parents:
diff changeset
694 sel_bg1 = parent.Root().NewSurface(path);
223b71206888 Initial import
thib
parents:
diff changeset
695 }
223b71206888 Initial import
thib
parents:
diff changeset
696 strcpy(path, btnfile2);
223b71206888 Initial import
thib
parents:
diff changeset
697 sel_bg2 = parent.Root().NewSurface(path);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
698 if (sel_bg2 == NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
699 sprintf(path,"%s.g00",btnfile2);
223b71206888 Initial import
thib
parents:
diff changeset
700 sel_bg2 = parent.Root().NewSurface(path);
223b71206888 Initial import
thib
parents:
diff changeset
701 }
223b71206888 Initial import
thib
parents:
diff changeset
702 sel_bg_rect = Rect(0,0,0,0);
223b71206888 Initial import
thib
parents:
diff changeset
703 if (sel_bg1) sel_bg_rect.join(Rect(*sel_bg1));
223b71206888 Initial import
thib
parents:
diff changeset
704 if (sel_bg2) sel_bg_rect.join(Rect(*sel_bg2));
223b71206888 Initial import
thib
parents:
diff changeset
705 }
223b71206888 Initial import
thib
parents:
diff changeset
706
223b71206888 Initial import
thib
parents:
diff changeset
707 void TextImpl::CreateSelect(Cmd& cmd) {
223b71206888 Initial import
thib
parents:
diff changeset
708 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
709 sprintf(key, "#WINDOW.%03d.SELCOM_USE",text_window_number);
223b71206888 Initial import
thib
parents:
diff changeset
710 int sel_type = 0;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
711 if (cmd.cmd3 == 1) config->GetParam(key, 1, &sel_type);
38
658272d883ed * Support (more or less) button style selects (fuuko's ones)
thib
parents: 18
diff changeset
712 else if (cmd.cmd3 == 3) sel_type = 0;
0
223b71206888 Initial import
thib
parents:
diff changeset
713
223b71206888 Initial import
thib
parents:
diff changeset
714 int sel_size = cmd.args.size() / 2;
223b71206888 Initial import
thib
parents:
diff changeset
715 int i;
223b71206888 Initial import
thib
parents:
diff changeset
716 // cur_backlog_item ¤Ë¼¡¤Ëbacklog¤ËÆþ¤ë¤Ù¤­ÆâÍƤòºîÀ®
223b71206888 Initial import
thib
parents:
diff changeset
717 // CreateSelect() ¸å¡¢SAVEPOINT ¤Ê¤Î¤Ç¸½ºß¤Îbacklog¤ÎÆâÍÆ(Á°¤Î¥á¥Ã¥»¡¼¥¸)¤¬
223b71206888 Initial import
thib
parents:
diff changeset
718 // backlog ¤ËÂåÆþ¤µ¤ì¤ë¡£¤½¤Î¸å¡¢backlog_item ¤Ë cur_backlog_item ¤ÎÆâÍƤ¬¥»¥Ã¥È¤µ¤ì¤ë(Wait()Æâ)
223b71206888 Initial import
thib
parents:
diff changeset
719 char backlog_sel_text[11] = {0x81,0x69,0x91,0x49,0x91,0xf0,0x8e,0x88,0x81,0x6a,0x00};
223b71206888 Initial import
thib
parents:
diff changeset
720 cur_backlog_item.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
721 cur_backlog_item.AddTextPos(cmd);
223b71206888 Initial import
thib
parents:
diff changeset
722 cur_backlog_item.text.Add(backlog_sel_text);
223b71206888 Initial import
thib
parents:
diff changeset
723 cur_backlog_item.text.AddReturn();
223b71206888 Initial import
thib
parents:
diff changeset
724 sel_backlog_pos.clear();
223b71206888 Initial import
thib
parents:
diff changeset
725 for (i=0; i<sel_size; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
726 sel_backlog_pos.push_back(cur_backlog_item.text.container.size());
223b71206888 Initial import
thib
parents:
diff changeset
727 cur_backlog_item.text.Add(cmd.Str(cmd.args[i*2]));
223b71206888 Initial import
thib
parents:
diff changeset
728 cur_backlog_item.text.AddReturn();
223b71206888 Initial import
thib
parents:
diff changeset
729 }
223b71206888 Initial import
thib
parents:
diff changeset
730 sel_backlog_pos.push_back(cur_backlog_item.text.container.size());
223b71206888 Initial import
thib
parents:
diff changeset
731
223b71206888 Initial import
thib
parents:
diff changeset
732 if (sel_type == 0) { // Princess Bride: ÁªÂò¥¦¥£¥ó¥É¥¦¤òÊÌɽ¼¨
223b71206888 Initial import
thib
parents:
diff changeset
733 External_select:
223b71206888 Initial import
thib
parents:
diff changeset
734 CreateSelBG();
223b71206888 Initial import
thib
parents:
diff changeset
735 hide(); // ¤Ê¤Î¤Ç¡¢¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤Ï¾Ãµî
40
651237260724 * Center button-type selects
thib
parents: 39
diff changeset
736 int baseposx, baseposy, repposx, repposy, centerx, centery;
0
223b71206888 Initial import
thib
parents:
diff changeset
737 int mojisize, col1, col2;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
738 config->GetParam("#SELBTN.000.CENTERING", 2, &centerx, &centery);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
739 config->GetParam("#SELBTN.000.BASEPOS", 2, &baseposx, &baseposy);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
740 config->GetParam("#SELBTN.000.REPPOS", 2, &repposx, &repposy);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
741 config->GetParam("#SELBTN.000.MOJISIZE", 1, &mojisize);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
742 config->GetParam("#SELBTN.000.MOJIDEFAULTCOL", 1, &col1);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
743 config->GetParam("#SELBTN.000.MOJISELECTCOL", 1, &col2);
0
223b71206888 Initial import
thib
parents:
diff changeset
744 if (col1 == col2) col2 = 1; // CLANNAD ¤Ç¤È¤ê¤¢¤¨¤º¡£
223b71206888 Initial import
thib
parents:
diff changeset
745 int r, g, b;
223b71206888 Initial import
thib
parents:
diff changeset
746 sprintf(key, "#COLOR_TABLE.%03d", col1);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
747 config->GetParam(key, 3, &r, &g, &b);
0
223b71206888 Initial import
thib
parents:
diff changeset
748 Color fore(r,g,b);
223b71206888 Initial import
thib
parents:
diff changeset
749 sprintf(key, "#COLOR_TABLE.%03d", col2);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
750 config->GetParam(key, 3, &r, &g, &b);
0
223b71206888 Initial import
thib
parents:
diff changeset
751 Color seled(r,g,b);
223b71206888 Initial import
thib
parents:
diff changeset
752
223b71206888 Initial import
thib
parents:
diff changeset
753 /* ¥¦¥£¥¸¥Ã¥ÈºîÀ® */
223b71206888 Initial import
thib
parents:
diff changeset
754 /* ¥¦¥£¥ó¥É¥¦ÇطʤÎÂ礭¤µ¤òµá¤á¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
755 if (baseposx == 0 && sel_bg_rect.width() != 0)
223b71206888 Initial import
thib
parents:
diff changeset
756 baseposx = (parent.Width()-sel_bg_rect.width()) / 2; // ¥Ü¥¿¥ó°ÌÃÖ¤ò¥»¥ó¥¿¥ê¥ó¥°
40
651237260724 * Center button-type selects
thib
parents: 39
diff changeset
757 if (centerx)
651237260724 * Center button-type selects
thib
parents: 39
diff changeset
758 baseposx = (parent.Width()-sel_bg_rect.width()-sel_size*repposx) / 2;
651237260724 * Center button-type selects
thib
parents: 39
diff changeset
759 if (centery)
651237260724 * Center button-type selects
thib
parents: 39
diff changeset
760 baseposy = (parent.Height()-sel_bg_rect.height()-sel_size*repposy) / 2;
0
223b71206888 Initial import
thib
parents:
diff changeset
761
223b71206888 Initial import
thib
parents:
diff changeset
762 sel_widget = parent.create_node( Rect(0, 0, parent.Width(), parent.Height()),0);
223b71206888 Initial import
thib
parents:
diff changeset
763
223b71206888 Initial import
thib
parents:
diff changeset
764 for (i=0; i<sel_size; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
765 PicBase* p;
223b71206888 Initial import
thib
parents:
diff changeset
766 // ÇطʺîÀ®
223b71206888 Initial import
thib
parents:
diff changeset
767 if (sel_bg2) {
223b71206888 Initial import
thib
parents:
diff changeset
768 p = sel_widget->create_node(Rect(baseposx, baseposy, baseposx+sel_bg_rect.width(), baseposy+sel_bg_rect.height()),0);
223b71206888 Initial import
thib
parents:
diff changeset
769 p->SetSurface(sel_bg2, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
770 }
223b71206888 Initial import
thib
parents:
diff changeset
771 if (sel_bg1) {
223b71206888 Initial import
thib
parents:
diff changeset
772 p = sel_widget->create_node(Rect(baseposx, baseposy, baseposx+sel_bg_rect.width(), baseposy+sel_bg_rect.height()),0);
223b71206888 Initial import
thib
parents:
diff changeset
773 p->SetSurface(sel_bg1, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
774 }
223b71206888 Initial import
thib
parents:
diff changeset
775 /* ¥Ü¥¿¥óºîÀ® */
223b71206888 Initial import
thib
parents:
diff changeset
776 const char* str = cmd.Str(cmd.args[i*2]);
223b71206888 Initial import
thib
parents:
diff changeset
777 int value = cmd.args[i*2+1].value;
223b71206888 Initial import
thib
parents:
diff changeset
778 while(selects.size() <= value) selects.push_back(0); // vector ¤ÎÂ礭¤µ¤ò¹­¤²¤ë
223b71206888 Initial import
thib
parents:
diff changeset
779
223b71206888 Initial import
thib
parents:
diff changeset
780 kconv( (const unsigned char*)str, (unsigned char*)key);
223b71206888 Initial import
thib
parents:
diff changeset
781 selects[value] = new WidTextButton(event, sel_widget, key, mojisize, WidTextButton::CENTER,
223b71206888 Initial import
thib
parents:
diff changeset
782 Rect(baseposx, baseposy, baseposx+sel_bg_rect.width(), baseposy+sel_bg_rect.height()), 1, fore, seled, Color(0,0,0,0));
223b71206888 Initial import
thib
parents:
diff changeset
783 selects[value]->press_func = &PressFuncButton;
223b71206888 Initial import
thib
parents:
diff changeset
784 selects[value]->press_pointer = (void*)this;
223b71206888 Initial import
thib
parents:
diff changeset
785
223b71206888 Initial import
thib
parents:
diff changeset
786 baseposx += repposx;
223b71206888 Initial import
thib
parents:
diff changeset
787 baseposy += repposy;
223b71206888 Initial import
thib
parents:
diff changeset
788 }
223b71206888 Initial import
thib
parents:
diff changeset
789 sel_widget->show_all();
223b71206888 Initial import
thib
parents:
diff changeset
790 status = WAIT_SELECT_OUTBOX;
223b71206888 Initial import
thib
parents:
diff changeset
791 } else { // CLANNAD: ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦Æâ¤ËÁªÂò»èɽ¼¨
223b71206888 Initial import
thib
parents:
diff changeset
792 int mojisize;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
793 config->GetParam("#SELBTN.000.MOJISIZE", 1, &mojisize);
0
223b71206888 Initial import
thib
parents:
diff changeset
794 Color fore(0xff,0xff,0xff);
223b71206888 Initial import
thib
parents:
diff changeset
795 Color seled(0xff,0xff,0xff);
223b71206888 Initial import
thib
parents:
diff changeset
796
223b71206888 Initial import
thib
parents:
diff changeset
797 show();
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
798 if (text == NULL) goto External_select; // ¥Æ¥­¥¹¥È¡¦¥¦¥£¥ó¥É¥¦¤òɽ¼¨¤Ç¤­¤Ê¤±¤ì¤Ð³°ÉôÁªÂò»è¤Ë¤¹¤ë
0
223b71206888 Initial import
thib
parents:
diff changeset
799 text->wid->Clear();
223b71206888 Initial import
thib
parents:
diff changeset
800 if (kcursor) kcursor->hide();
223b71206888 Initial import
thib
parents:
diff changeset
801 /* ¥¦¥£¥¸¥Ã¥ÈºîÀ® : ¥Æ¥­¥¹¥Èɽ¼¨ÈϰϤÈƱ¤¸*/
223b71206888 Initial import
thib
parents:
diff changeset
802 int posx = text->wid->pictext->PosX();
223b71206888 Initial import
thib
parents:
diff changeset
803 int posy = text->wid->pictext->PosY();
223b71206888 Initial import
thib
parents:
diff changeset
804 int sel_w = text->wid->pictext->Width();
223b71206888 Initial import
thib
parents:
diff changeset
805 int sel_h = text->wid->pictext->Height();
223b71206888 Initial import
thib
parents:
diff changeset
806 sel_widget = text->wid->PicNode()->create_node(Rect(posx, posy, posx+sel_w, posy+sel_h), 0);
223b71206888 Initial import
thib
parents:
diff changeset
807
223b71206888 Initial import
thib
parents:
diff changeset
808 int sel_y = 0;
223b71206888 Initial import
thib
parents:
diff changeset
809 for (i=0; i<sel_size; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
810 /* ¥Ü¥¿¥óºîÀ® */
223b71206888 Initial import
thib
parents:
diff changeset
811 const char* str = cmd.Str(cmd.args[i*2]);
223b71206888 Initial import
thib
parents:
diff changeset
812 int value = cmd.args[i*2+1].value;
223b71206888 Initial import
thib
parents:
diff changeset
813 while(selects.size() <= value) selects.push_back(0); // vector ¤ÎÂ礭¤µ¤ò¹­¤²¤ë
223b71206888 Initial import
thib
parents:
diff changeset
814
223b71206888 Initial import
thib
parents:
diff changeset
815 kconv( (const unsigned char*)str, (unsigned char*)key);
223b71206888 Initial import
thib
parents:
diff changeset
816 selects[value] = new WidTextButton(event, sel_widget, key, mojisize, WidTextButton::Attribute(WidTextButton::REVERSE | WidTextButton::NOPADDING),
223b71206888 Initial import
thib
parents:
diff changeset
817 Rect(0, sel_y, sel_w, sel_y), 1, fore, seled, Color(0,0,0,0));
223b71206888 Initial import
thib
parents:
diff changeset
818 selects[value]->press_func = &PressFuncButton;
223b71206888 Initial import
thib
parents:
diff changeset
819 selects[value]->press_pointer = (void*)this;
223b71206888 Initial import
thib
parents:
diff changeset
820
223b71206888 Initial import
thib
parents:
diff changeset
821 sel_y += selects[value]->Pic()->Height() + 1;
223b71206888 Initial import
thib
parents:
diff changeset
822 }
223b71206888 Initial import
thib
parents:
diff changeset
823 sel_widget->show_all();
223b71206888 Initial import
thib
parents:
diff changeset
824 status = WAIT_SELECT_INBOX;
223b71206888 Initial import
thib
parents:
diff changeset
825 }
223b71206888 Initial import
thib
parents:
diff changeset
826 }
223b71206888 Initial import
thib
parents:
diff changeset
827
223b71206888 Initial import
thib
parents:
diff changeset
828 void TextImpl::AddText(const char* str_o) {
223b71206888 Initial import
thib
parents:
diff changeset
829 char str[10001];
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
830 if (text == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
831 /* ¤Þ¤º¡¢replace string ¤òÊÑ´¹ */
223b71206888 Initial import
thib
parents:
diff changeset
832 int i;
223b71206888 Initial import
thib
parents:
diff changeset
833 int cnt = 0;
223b71206888 Initial import
thib
parents:
diff changeset
834 /* ¡ö = 81 96 A-Z = 0x82 [0x60-0x79] */
223b71206888 Initial import
thib
parents:
diff changeset
835 /* ¡ó = 81 93 A-Z = 0x82 [0x60-0x79] */
223b71206888 Initial import
thib
parents:
diff changeset
836 for (i=0; cnt<10000 && str_o[i] != 0; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
837 if (str_o[i] < 0) {
223b71206888 Initial import
thib
parents:
diff changeset
838 if ( (unsigned char)str_o[i] == 0x81 && (unsigned char)str_o[i+1] == 0x96 && (unsigned char)str_o[i+2] == 0x82) {
223b71206888 Initial import
thib
parents:
diff changeset
839 int c = str_o[i+3];
223b71206888 Initial import
thib
parents:
diff changeset
840 if (c >= 0x60 && c <= 0x79 && replace_name[c-0x60].length() != 0) { // ̾Á°ÊÑ´¹
223b71206888 Initial import
thib
parents:
diff changeset
841 i += 3;
223b71206888 Initial import
thib
parents:
diff changeset
842 strcpy(str+cnt, replace_name[c-0x60].c_str());
223b71206888 Initial import
thib
parents:
diff changeset
843 cnt += replace_name[c-0x60].length();
223b71206888 Initial import
thib
parents:
diff changeset
844 continue;
223b71206888 Initial import
thib
parents:
diff changeset
845 }
223b71206888 Initial import
thib
parents:
diff changeset
846 } else if ( (unsigned char)str_o[i] == 0x81 && (unsigned char)str_o[i+1] == 0x93 && (unsigned char)str_o[i+2] == 0x82) {
223b71206888 Initial import
thib
parents:
diff changeset
847 int c = str_o[i+3];
223b71206888 Initial import
thib
parents:
diff changeset
848 if (c >= 0x60 && c <= 0x79 && replace_name2[c-0x60].length() != 0) { // ̾Á°ÊÑ´¹£²
223b71206888 Initial import
thib
parents:
diff changeset
849 i += 3;
223b71206888 Initial import
thib
parents:
diff changeset
850 strcpy(str+cnt, replace_name2[c-0x60].c_str());
223b71206888 Initial import
thib
parents:
diff changeset
851 cnt += replace_name2[c-0x60].length();
223b71206888 Initial import
thib
parents:
diff changeset
852 continue;
223b71206888 Initial import
thib
parents:
diff changeset
853 }
223b71206888 Initial import
thib
parents:
diff changeset
854 }
223b71206888 Initial import
thib
parents:
diff changeset
855 str[cnt++] = str_o[i++];
223b71206888 Initial import
thib
parents:
diff changeset
856 }
223b71206888 Initial import
thib
parents:
diff changeset
857 str[cnt++] = str_o[i];
223b71206888 Initial import
thib
parents:
diff changeset
858 }
223b71206888 Initial import
thib
parents:
diff changeset
859 str[cnt] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
860 str[10000] = 0;
223b71206888 Initial import
thib
parents:
diff changeset
861 char* str_top = str;
223b71206888 Initial import
thib
parents:
diff changeset
862
223b71206888 Initial import
thib
parents:
diff changeset
863 for (char* s = str_top; *s != 0; s++) {
223b71206888 Initial import
thib
parents:
diff changeset
864 // if (*(unsigned char*)s == 0xa1 && *(unsigned char*)(s+1) == 0xda) { /* euc */
223b71206888 Initial import
thib
parents:
diff changeset
865 if (*(unsigned char*)s == 0x81 && *(unsigned char*)(s+1) == 0x79) { /* sjis */
223b71206888 Initial import
thib
parents:
diff changeset
866 // ̾Á°
223b71206888 Initial import
thib
parents:
diff changeset
867 *s = 0;
223b71206888 Initial import
thib
parents:
diff changeset
868 if (s != str_top) text_stream.Add(str_top);
223b71206888 Initial import
thib
parents:
diff changeset
869 s += 2;
223b71206888 Initial import
thib
parents:
diff changeset
870 char* name_top = s;
223b71206888 Initial import
thib
parents:
diff changeset
871 for (; *s != 0; s++) {
223b71206888 Initial import
thib
parents:
diff changeset
872 // if (*(unsigned char*)s == 0xa1 && *(unsigned char*)(s+1) == 0xdb) { /* euc */
223b71206888 Initial import
thib
parents:
diff changeset
873 if (*(unsigned char*)s == 0x81 && *(unsigned char*)(s+1) == 0x7a) { /* sjis */
223b71206888 Initial import
thib
parents:
diff changeset
874 *s = 0;
223b71206888 Initial import
thib
parents:
diff changeset
875 s += 2;
223b71206888 Initial import
thib
parents:
diff changeset
876 text_stream.AddName(name_top);
223b71206888 Initial import
thib
parents:
diff changeset
877 break;
223b71206888 Initial import
thib
parents:
diff changeset
878 }
223b71206888 Initial import
thib
parents:
diff changeset
879 if (*s < 0 && s[1] != 0) s++; // Á´³Ñʸ»ú¤Ê¤é£²»úÈô¤Ð¤¹
223b71206888 Initial import
thib
parents:
diff changeset
880 }
223b71206888 Initial import
thib
parents:
diff changeset
881 str_top = s;
223b71206888 Initial import
thib
parents:
diff changeset
882 }
223b71206888 Initial import
thib
parents:
diff changeset
883 if (*s == 0x0a) {
223b71206888 Initial import
thib
parents:
diff changeset
884 *s = 0;
223b71206888 Initial import
thib
parents:
diff changeset
885 text_stream.Add(str_top);
223b71206888 Initial import
thib
parents:
diff changeset
886 text_stream.AddReturn();
223b71206888 Initial import
thib
parents:
diff changeset
887 str_top = s;
223b71206888 Initial import
thib
parents:
diff changeset
888 } else if (*s < 0 && s[1] != 0) s++;
223b71206888 Initial import
thib
parents:
diff changeset
889 }
223b71206888 Initial import
thib
parents:
diff changeset
890 text_stream.Add(str_top);
223b71206888 Initial import
thib
parents:
diff changeset
891 }
223b71206888 Initial import
thib
parents:
diff changeset
892
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
893 void TextImpl::impl_txtClear(Cmd& cmd) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
894 if (text != NULL) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
895 text->ResetFace();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
896 if (cmd.cmd2 == 3 && cmd.cmd3 == 151)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
897 text->wid->Clear();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
898 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
899 cur_backlog_item.face = "";
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
900 if (cmd.cmd2 == 3 && cmd.cmd3 == 151)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
901 text_stream.Clear();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
902 hide();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
903 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
904
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
905 void TextImpl::impl_logKoe(Cmd& cmd) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
906 // PlayKoe ; À¼½ÐÎÏ¥³¥Þ¥ó¥É¤ò¥Á¥§¥Ã¥¯¤¹¤ë */
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
907 cur_backlog_item.koe = cmd.args[0].value;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
908 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
909
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
910 void TextImpl::impl_pause(Cmd& cmd) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
911 if (text != NULL) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
912 eprintf("start\n");
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
913 text->StartText(text_stream);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
914 if (skip_mode & SKIP_TEXT) text->wid->Flush();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
915 else if (kcursor) kcursor->show();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
916 status = WAIT_TEXT;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
917 text_parsing = false;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
918 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
919 backlog_item = cur_backlog_item;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
920 if (cur_backlog_item.scn == 0 && cur_backlog_item.pos == -1) backlog_item.text = text_stream;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
921 cur_backlog_item.Clear();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
922
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
923 cmd.clear();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
924 cmd.cmd_type = CMD_WAITFRAMEUPDATE; // ²èÁüÉÁ²è¤ËÌá¤ë(skip»þ¤Ë¥Æ¥­¥¹¥È¤¬ÉÁ²è¤µ¤ì¤ä¤¹¤¯¤¹¤ë¤¿¤á)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
925 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
926
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
927 void TextImpl::impl_br(Cmd& cmd) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
928 text_stream.AddReturn();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
929 cur_backlog_item.DeleteTextPos();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
930 cmd.clear();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
931 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
932
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
933 void TextImpl::impl_FaceOpen(Cmd& cmd) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
934 if (text == NULL)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
935 show();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
936 string s = cmd.Str(cmd.args[0]);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
937 s += ".g00";
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
938 if (text != NULL)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
939 text->ShowFace(s.c_str());
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
940 cur_backlog_item.face = s;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
941 cmd.cmd_type = CMD_SAVECMD_ONCE;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
942 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
943
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
944 void TextImpl::impl_FaceClear(Cmd& cmd) {
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
945 if (text == NULL)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
946 show();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
947 if (text)
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
948 text->ResetFace();
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
949 cur_backlog_item.face = "";
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
950 cmd.cmd_type = CMD_SAVECMD_ONCE;
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
951 }
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
952
0
223b71206888 Initial import
thib
parents:
diff changeset
953 void TextImpl::Exec(Cmd& cmd) {
223b71206888 Initial import
thib
parents:
diff changeset
954 if (cmd.cmd_type == CMD_TEXT) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
955 if (text == NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
956 show();
223b71206888 Initial import
thib
parents:
diff changeset
957 }
223b71206888 Initial import
thib
parents:
diff changeset
958 if (cmd.args.size() != 1) return;
223b71206888 Initial import
thib
parents:
diff changeset
959 if (ruby_text_flag) {
223b71206888 Initial import
thib
parents:
diff changeset
960 ruby_text = cmd.Str(cmd.args[0]);
223b71206888 Initial import
thib
parents:
diff changeset
961 ruby_text_flag = 0;
223b71206888 Initial import
thib
parents:
diff changeset
962 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
963 return;
223b71206888 Initial import
thib
parents:
diff changeset
964 }
223b71206888 Initial import
thib
parents:
diff changeset
965 cur_backlog_item.AddTextPos(cmd);
223b71206888 Initial import
thib
parents:
diff changeset
966 AddText(cmd.Str(cmd.args[0]));
223b71206888 Initial import
thib
parents:
diff changeset
967 char debug[1024];
223b71206888 Initial import
thib
parents:
diff changeset
968 kconv( (unsigned char*)cmd.Str(cmd.args[0]), (unsigned char*)debug);
223b71206888 Initial import
thib
parents:
diff changeset
969 eprintf("text: %s\n",debug);
223b71206888 Initial import
thib
parents:
diff changeset
970 if (text_parsing)
223b71206888 Initial import
thib
parents:
diff changeset
971 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
972 else
223b71206888 Initial import
thib
parents:
diff changeset
973 cmd.cmd_type = CMD_SAVEPOINT;
223b71206888 Initial import
thib
parents:
diff changeset
974 text_parsing = true; /* ¥Æ¥­¥¹¥ÈÂÔ¤Áľ¸å¤Î¥Æ¥­¥¹¥È°ÌÃ֡᥻¡¼¥Ö°ÌÃÖ */
223b71206888 Initial import
thib
parents:
diff changeset
975 return;
223b71206888 Initial import
thib
parents:
diff changeset
976 }
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
977
0
223b71206888 Initial import
thib
parents:
diff changeset
978 if (cmd.cmd_type != CMD_OTHER) return;
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
979
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
980 CommandHandler::Exec(cmd);
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
981
0
223b71206888 Initial import
thib
parents:
diff changeset
982 if (cmd.cmd1 == 0 && cmd.cmd2 == 3) {
55
f1a27ee7e03c * started the same changes on scn2k_text.cc
thib
parents: 53
diff changeset
983 if (cmd.cmd3 == 0x78) { // ¥ë¥Ó´ØÏ¢
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
984 if (text == NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
985 show();
223b71206888 Initial import
thib
parents:
diff changeset
986 }
223b71206888 Initial import
thib
parents:
diff changeset
987 if (cmd.cmd4 == 1) {
223b71206888 Initial import
thib
parents:
diff changeset
988 ruby_text_flag = true;
223b71206888 Initial import
thib
parents:
diff changeset
989 eprintf("SetRubyTextImpl.");
223b71206888 Initial import
thib
parents:
diff changeset
990 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
991 } else if (cmd.cmd4 == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
992 if (ruby_text.length() == 0) { // ¥ë¥Ó¤ò¿¶¤ë¥Æ¥­¥¹¥È¤¬¤Ê¤¤
223b71206888 Initial import
thib
parents:
diff changeset
993 eprintf("Cannot find ruby text.\n");
223b71206888 Initial import
thib
parents:
diff changeset
994 return;
223b71206888 Initial import
thib
parents:
diff changeset
995 }
223b71206888 Initial import
thib
parents:
diff changeset
996 if (cmd.args.size() != 1) return;
223b71206888 Initial import
thib
parents:
diff changeset
997 char debug1[1024], debug2[1024];
223b71206888 Initial import
thib
parents:
diff changeset
998 kconv( (unsigned char*)ruby_text.c_str(), (unsigned char*)debug1);
223b71206888 Initial import
thib
parents:
diff changeset
999 kconv( (unsigned char*)cmd.Str(cmd.args[0]), (unsigned char*)debug2);
223b71206888 Initial import
thib
parents:
diff changeset
1000 eprintf("SetRuby. %s, %s",debug1, debug2);
223b71206888 Initial import
thib
parents:
diff changeset
1001 text_stream.AddRuby(ruby_text.c_str(), cmd.Str(cmd.args[0]));
223b71206888 Initial import
thib
parents:
diff changeset
1002 cur_backlog_item.DeleteTextPos();
223b71206888 Initial import
thib
parents:
diff changeset
1003 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1004 }
223b71206888 Initial import
thib
parents:
diff changeset
1005 } else if (cmd.cmd3 == 0x66) { // ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤Î·Á
223b71206888 Initial import
thib
parents:
diff changeset
1006 if (cmd.cmd4 == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1007 eprintf("set text window <- %d\n",cmd.args[0].value);
223b71206888 Initial import
thib
parents:
diff changeset
1008 if (text) show(cmd.args[0].value);
223b71206888 Initial import
thib
parents:
diff changeset
1009 else text_window_number = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1010 } else if (cmd.cmd4 == 1) { // default value
223b71206888 Initial import
thib
parents:
diff changeset
1011 eprintf("set text window <- default\n");
223b71206888 Initial import
thib
parents:
diff changeset
1012 if (text) show(0);
223b71206888 Initial import
thib
parents:
diff changeset
1013 else text_window_number = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1014 }
223b71206888 Initial import
thib
parents:
diff changeset
1015 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1016 } else if (cmd.cmd3 == 0x67) { // ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦É½¼¨¡©
223b71206888 Initial import
thib
parents:
diff changeset
1017 show();
223b71206888 Initial import
thib
parents:
diff changeset
1018 // ɽ¼¨¤ÎºÝ¤Ï¥Æ¥­¥¹¥È¤ò¥¯¥ê¥¢¤·¤Ê¤¤¡©
223b71206888 Initial import
thib
parents:
diff changeset
1019 // if (text) text->wid->Clear();
223b71206888 Initial import
thib
parents:
diff changeset
1020 // text_stream.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
1021 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1022 } else if (cmd.cmd3 == 0x68) { // ¥Æ¥­¥¹¥Èɽ¼¨¡©
223b71206888 Initial import
thib
parents:
diff changeset
1023 // Á´¥Æ¥­¥¹¥Èɽ¼¨
223b71206888 Initial import
thib
parents:
diff changeset
1024 if (text) {
223b71206888 Initial import
thib
parents:
diff changeset
1025 text->StartText(text_stream);
223b71206888 Initial import
thib
parents:
diff changeset
1026 text->wid->Flush();
223b71206888 Initial import
thib
parents:
diff changeset
1027 }
223b71206888 Initial import
thib
parents:
diff changeset
1028 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1029 } else if (cmd.cmd3 == 0x98) { // ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¥¯¥ê¥¢¡©
223b71206888 Initial import
thib
parents:
diff changeset
1030 show();
223b71206888 Initial import
thib
parents:
diff changeset
1031 if (text) text->wid->Clear();
223b71206888 Initial import
thib
parents:
diff changeset
1032 text_stream.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
1033 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1034 }
223b71206888 Initial import
thib
parents:
diff changeset
1035 } else if (cmd.cmd1 == 0 && cmd.cmd2 == 2 && (cmd.cmd3 == 1 || cmd.cmd3 == 3) && cmd.cmd4 == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1036 // ÁªÂò»è
223b71206888 Initial import
thib
parents:
diff changeset
1037 CreateSelect(cmd);
39 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 }
0
223b71206888 Initial import
thib
parents:
diff changeset
1047 cmd.cmd_type = CMD_ROLLBACKPOINT; /* ÁªÂò»è¤Ï¥»¡¼¥Ö°ÌÃÖ / ¥·¥Ê¥ê¥ª´¬¤­Ìᤷ°ÌÃÖ */
223b71206888 Initial import
thib
parents:
diff changeset
1048 // cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1049 } else if (cmd.cmd1 == 0 && cmd.cmd2 == 4) {
223b71206888 Initial import
thib
parents:
diff changeset
1050 if (cmd.cmd3 == 0x44c) { // ¥Æ¥­¥¹¥È¥¹¥­¥Ã¥×³«»Ï
223b71206888 Initial import
thib
parents:
diff changeset
1051 status_mask = Status(SKIPMASK | status_mask);
223b71206888 Initial import
thib
parents:
diff changeset
1052 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1053 } else if (cmd.cmd3 == 0x3e8) { // ¥¦¥£¥ó¥É¥¦¾Ãµî
223b71206888 Initial import
thib
parents:
diff changeset
1054 status_mask = Status(CLEARSCR_MASK | status_mask);
223b71206888 Initial import
thib
parents:
diff changeset
1055 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1056 }
223b71206888 Initial import
thib
parents:
diff changeset
1057 } else if (cmd.cmd1 == 1 && cmd.cmd2 == 0x04) {
223b71206888 Initial import
thib
parents:
diff changeset
1058 /* ¥¦¥§¥¤¥È´ØϢ̿Îá */
223b71206888 Initial import
thib
parents:
diff changeset
1059 if (cmd.cmd3 == 0x64 || cmd.cmd3 == 0x6f || cmd.cmd3 == 0x79) {
223b71206888 Initial import
thib
parents:
diff changeset
1060 eprintf("wait %dmsec\n",cmd.args[0].value);
223b71206888 Initial import
thib
parents:
diff changeset
1061 if (cmd.cmd3 == 0x64 && text) {
223b71206888 Initial import
thib
parents:
diff changeset
1062 /* 0x64 ¤À¤Èʸ»úÉÁ²èÃæ¤ÎÂÔ¤Á¤Ë»È¤¦¤³¤È¤¬¤¢¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
1063 text->StartText(text_stream);
223b71206888 Initial import
thib
parents:
diff changeset
1064 text->wid->Flush();
223b71206888 Initial import
thib
parents:
diff changeset
1065 }
223b71206888 Initial import
thib
parents:
diff changeset
1066 if (cmd.cmd3 == 0x6f || cmd.cmd3 == 0x79) wait_time = base_time + cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1067 else wait_time = old_time + cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1068 status = WAIT;
223b71206888 Initial import
thib
parents:
diff changeset
1069 cmd.cmd_type = CMD_WAITFRAMEUPDATE; // ²èÁüÉÁ²è¤ËÌá¤ë(skip»þ¤Ë¥Æ¥­¥¹¥È¤¬ÉÁ²è¤µ¤ì¤ä¤¹¤¯¤¹¤ë¤¿¤á)
223b71206888 Initial import
thib
parents:
diff changeset
1070 } else if (cmd.cmd3 == 0x65 || cmd.cmd3 == 0x70) {
223b71206888 Initial import
thib
parents:
diff changeset
1071 eprintf("wait %dmsec(click stop)\n",cmd.args[0].value);
223b71206888 Initial import
thib
parents:
diff changeset
1072 if (cmd.cmd3 == 0x70) wait_time = base_time + cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1073 else wait_time = old_time + cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1074 status = WAIT_CLICK;
223b71206888 Initial import
thib
parents:
diff changeset
1075 cmd.cmd_type = CMD_WAITFRAMEUPDATE; // ²èÁüÉÁ²è¤ËÌá¤ë(skip»þ¤Ë¥Æ¥­¥¹¥È¤¬ÉÁ²è¤µ¤ì¤ä¤¹¤¯¤¹¤ë¤¿¤á)
223b71206888 Initial import
thib
parents:
diff changeset
1076 } else if (cmd.cmd3 == 0x83) {
223b71206888 Initial import
thib
parents:
diff changeset
1077 /* ¥Þ¥¦¥¹¤¬¥¯¥ê¥Ã¥¯¤µ¤ì¤ë¤Þ¤ÇÂÔ¤Ä */
223b71206888 Initial import
thib
parents:
diff changeset
1078 eprintf("wait and get mouse pos at click\n");
223b71206888 Initial import
thib
parents:
diff changeset
1079 wait_time = old_time + 1000 * 1000;
223b71206888 Initial import
thib
parents:
diff changeset
1080 status = WAIT_CLICK_MOUSEPOS;
223b71206888 Initial import
thib
parents:
diff changeset
1081 wait_savedvar[0] = cmd.args[0];
223b71206888 Initial import
thib
parents:
diff changeset
1082 wait_savedvar[1] = cmd.args[1];
223b71206888 Initial import
thib
parents:
diff changeset
1083 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1084 } else if (cmd.cmd3 == 0x1fe) {
223b71206888 Initial import
thib
parents:
diff changeset
1085 eprintf("get timer value[%d]\n",cmd.args[0].value);
223b71206888 Initial import
thib
parents:
diff changeset
1086 if (timer_var.find(cmd.args[0].value) == timer_var.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
1087 cmd.SetSysvar(0);
223b71206888 Initial import
thib
parents:
diff changeset
1088 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1089 TimerAtom& atom = timer_var[cmd.args[0].value];
223b71206888 Initial import
thib
parents:
diff changeset
1090 if (atom.total_time <= 0) atom.total_time = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1091 int cur_tm = old_time - atom.start_time;
223b71206888 Initial import
thib
parents:
diff changeset
1092 if (cur_tm < 0) cur_tm = atom.total_time; // ¥¨¥é¡¼¤Ê¤éºÇ½ª»þ´Ö¤Ë¹ç¤ï¤»¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1093 if (cur_tm > atom.total_time) cur_tm = atom.total_time;
223b71206888 Initial import
thib
parents:
diff changeset
1094 // use 'long long'(64bit) or 'double'(80bit) type, since total_time, to and from is 32 bit.
223b71206888 Initial import
thib
parents:
diff changeset
1095 int v = atom.from + (long long)(atom.to-atom.from)*cur_tm/int(atom.total_time);
223b71206888 Initial import
thib
parents:
diff changeset
1096 cmd.SetSysvar(v);
223b71206888 Initial import
thib
parents:
diff changeset
1097 }
223b71206888 Initial import
thib
parents:
diff changeset
1098 /* From rldev-1.40, reallive.kfn
223b71206888 Initial import
thib
parents:
diff changeset
1099 0x72 fun Timer (store) <1:Sys:00114, 1> ('counter') ()
223b71206888 Initial import
thib
parents:
diff changeset
1100 0x73 fun CmpTimer (store) <1:Sys:00115, 1> ('time') ('time', 'counter')
223b71206888 Initial import
thib
parents:
diff changeset
1101 0x74 fun SetTimer <1:Sys:00116, 1> ('time') ('time', 'counter')
223b71206888 Initial import
thib
parents:
diff changeset
1102
223b71206888 Initial import
thib
parents:
diff changeset
1103 0x78 fun ResetExTimer <1:Sys:00120, 1> ('counter') ()
223b71206888 Initial import
thib
parents:
diff changeset
1104 0x79 fun timeEx <1:Sys:00121, 1> ('time') ('time', 'counter')
223b71206888 Initial import
thib
parents:
diff changeset
1105 0x7a fun timeExC (store) <1:Sys:00122, 1> ('time') ('time', 'counter')
223b71206888 Initial import
thib
parents:
diff changeset
1106 0x7b fun timeExC2 (store) <1:Sys:00123, 1> ('time') ('time', 'counter') // UNDOCUMENTED
223b71206888 Initial import
thib
parents:
diff changeset
1107 0x7c fun ExTimer (store) <1:Sys:00124, 1> ('counter') ()
223b71206888 Initial import
thib
parents:
diff changeset
1108 0x7d fun CmpExTimer (store) <1:Sys:00125, 1> ('time') ('time', 'counter')
223b71206888 Initial import
thib
parents:
diff changeset
1109 0x7e fun SetExTimer <1:Sys:00126, 1> ('time') ('time', 'counter')
223b71206888 Initial import
thib
parents:
diff changeset
1110 */
223b71206888 Initial import
thib
parents:
diff changeset
1111
223b71206888 Initial import
thib
parents:
diff changeset
1112 } else if (cmd.cmd3 == 0x6e || cmd.cmd3 == 0x78) { // set basetime
223b71206888 Initial import
thib
parents:
diff changeset
1113 if (cmd.cmd4 == 1) {
223b71206888 Initial import
thib
parents:
diff changeset
1114 eprintf("set basetime\n");
223b71206888 Initial import
thib
parents:
diff changeset
1115 base_time = old_time;
223b71206888 Initial import
thib
parents:
diff changeset
1116 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1117 } else if (cmd.cmd4 == 0) { // n-th base time
223b71206888 Initial import
thib
parents:
diff changeset
1118 int index = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1119 eprintf("set basetime (%d)\n",index);
223b71206888 Initial import
thib
parents:
diff changeset
1120 TimerAtom& atom = timer_var[index];
223b71206888 Initial import
thib
parents:
diff changeset
1121 atom.from = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1122 atom.to = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1123 atom.total_time = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1124 atom.start_time = old_time;
223b71206888 Initial import
thib
parents:
diff changeset
1125 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1126 }
223b71206888 Initial import
thib
parents:
diff changeset
1127 } else if (cmd.cmd3 == 0x72 || cmd.cmd3 == 0x7c) { // get time
223b71206888 Initial import
thib
parents:
diff changeset
1128 if (cmd.cmd4 == 1) { // get time
223b71206888 Initial import
thib
parents:
diff changeset
1129 eprintf("get time\n");
223b71206888 Initial import
thib
parents:
diff changeset
1130 cmd.SetSysvar(old_time - base_time);
223b71206888 Initial import
thib
parents:
diff changeset
1131 } else if (cmd.cmd4 == 0) { // n-th get time
223b71206888 Initial import
thib
parents:
diff changeset
1132 int index = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1133 eprintf("get time %dth\n",index);
223b71206888 Initial import
thib
parents:
diff changeset
1134 if (timer_var.find(index) == timer_var.end()) cmd.SetSysvar(0);
223b71206888 Initial import
thib
parents:
diff changeset
1135 else cmd.SetSysvar(old_time - timer_var[index].start_time);
223b71206888 Initial import
thib
parents:
diff changeset
1136 }
223b71206888 Initial import
thib
parents:
diff changeset
1137 } else if (cmd.cmd3 == 0x26c || cmd.cmd3 == 0x270) { // set basetime(multi)
223b71206888 Initial import
thib
parents:
diff changeset
1138 int j = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1139 eprintf("set basetime\n");
223b71206888 Initial import
thib
parents:
diff changeset
1140 int i; for (i=0; i<cmd.argc; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1141 int cnt = cmd.args[j++].value; // £³¤Ê¤Î¤Ç̵»ë
223b71206888 Initial import
thib
parents:
diff changeset
1142 int num = cmd.args[j++].value;
223b71206888 Initial import
thib
parents:
diff changeset
1143 TimerAtom& atom = timer_var[num];
223b71206888 Initial import
thib
parents:
diff changeset
1144 atom.from = cmd.args[j++].value;
223b71206888 Initial import
thib
parents:
diff changeset
1145 atom.to = cmd.args[j++].value;
223b71206888 Initial import
thib
parents:
diff changeset
1146 atom.total_time = cmd.args[j++].value;
223b71206888 Initial import
thib
parents:
diff changeset
1147 atom.start_time = old_time;
223b71206888 Initial import
thib
parents:
diff changeset
1148 }
223b71206888 Initial import
thib
parents:
diff changeset
1149 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1150 } else if (cmd.cmd3 == 0x276) { // get time (multi)
223b71206888 Initial import
thib
parents:
diff changeset
1151 eprintf("get timer value\n");
223b71206888 Initial import
thib
parents:
diff changeset
1152 vector<VarInfo> args = cmd.args;
223b71206888 Initial import
thib
parents:
diff changeset
1153 vector<VarInfo>::iterator it = args.begin();
223b71206888 Initial import
thib
parents:
diff changeset
1154 int argc = cmd.argc;
223b71206888 Initial import
thib
parents:
diff changeset
1155 int active_timers = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1156 int i; for (i=0; i<argc; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1157 int cnt = (it++)->value;
223b71206888 Initial import
thib
parents:
diff changeset
1158 int num = (it++)->value;
223b71206888 Initial import
thib
parents:
diff changeset
1159
223b71206888 Initial import
thib
parents:
diff changeset
1160 if (timer_var.find(num) == timer_var.end()) {
223b71206888 Initial import
thib
parents:
diff changeset
1161 cmd.SetFlagvar(*it++, 0);
223b71206888 Initial import
thib
parents:
diff changeset
1162 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1163 TimerAtom& atom = timer_var[num];
223b71206888 Initial import
thib
parents:
diff changeset
1164 if (atom.total_time <= 0) atom.total_time = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1165 int cur_tm = old_time - atom.start_time;
223b71206888 Initial import
thib
parents:
diff changeset
1166 if (cur_tm < 0) cur_tm = atom.total_time; // ¥¨¥é¡¼¤Ê¤éºÇ½ª»þ´Ö¤Ë¹ç¤ï¤»¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1167 if (cur_tm > atom.total_time) cur_tm = atom.total_time;
223b71206888 Initial import
thib
parents:
diff changeset
1168 // use 'long long'(64bit) or 'double'(80bit) type, since total_time, to and from is 32 bit.
223b71206888 Initial import
thib
parents:
diff changeset
1169 int v = atom.from + (long long)(atom.to-atom.from)*cur_tm/int(atom.total_time);
223b71206888 Initial import
thib
parents:
diff changeset
1170 cmd.SetFlagvar(*it++, v);
223b71206888 Initial import
thib
parents:
diff changeset
1171 if (atom.total_time != -1 && cur_tm < atom.total_time) active_timers++;
223b71206888 Initial import
thib
parents:
diff changeset
1172 }
223b71206888 Initial import
thib
parents:
diff changeset
1173 }
223b71206888 Initial import
thib
parents:
diff changeset
1174 if (active_timers) active_timers = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1175 cmd.SetSysvar(active_timers);
223b71206888 Initial import
thib
parents:
diff changeset
1176 } else if (cmd.cmd3 == 0x1f4) {
223b71206888 Initial import
thib
parents:
diff changeset
1177 TimerAtom& atom = timer_var[cmd.args[0].value];
223b71206888 Initial import
thib
parents:
diff changeset
1178 atom.from = cmd.args[1].value;
223b71206888 Initial import
thib
parents:
diff changeset
1179 atom.to = cmd.args[2].value;
223b71206888 Initial import
thib
parents:
diff changeset
1180 atom.total_time = cmd.args[3].value;
223b71206888 Initial import
thib
parents:
diff changeset
1181 atom.start_time = old_time;
223b71206888 Initial import
thib
parents:
diff changeset
1182 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1183 } else if (cmd.cmd3 == 0x3e8) {
223b71206888 Initial import
thib
parents:
diff changeset
1184 /* rand() */
223b71206888 Initial import
thib
parents:
diff changeset
1185 int min = 0, max;
223b71206888 Initial import
thib
parents:
diff changeset
1186 if (cmd.args.size() == 2) {
223b71206888 Initial import
thib
parents:
diff changeset
1187 min = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1188 max = cmd.args[1].value;
223b71206888 Initial import
thib
parents:
diff changeset
1189 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1190 max = cmd.args[1].value;
223b71206888 Initial import
thib
parents:
diff changeset
1191 }
223b71206888 Initial import
thib
parents:
diff changeset
1192 if (min > max) {
223b71206888 Initial import
thib
parents:
diff changeset
1193 int tmp = max;
223b71206888 Initial import
thib
parents:
diff changeset
1194 max = min;
223b71206888 Initial import
thib
parents:
diff changeset
1195 min = tmp;
223b71206888 Initial import
thib
parents:
diff changeset
1196 }
223b71206888 Initial import
thib
parents:
diff changeset
1197 int r = random();
223b71206888 Initial import
thib
parents:
diff changeset
1198 if (min == max) r = min;
223b71206888 Initial import
thib
parents:
diff changeset
1199 else r = (r % (max-min)) + min;
223b71206888 Initial import
thib
parents:
diff changeset
1200 cmd.SetSysvar(r);
223b71206888 Initial import
thib
parents:
diff changeset
1201 } else if (cmd.cmd3 == 0x3ea) {
223b71206888 Initial import
thib
parents:
diff changeset
1202 int val = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1203 if (val < 0) val = -val;
223b71206888 Initial import
thib
parents:
diff changeset
1204 cmd.SetSysvar(val);
223b71206888 Initial import
thib
parents:
diff changeset
1205 } else if (cmd.cmd3 == 0x3ec) {
223b71206888 Initial import
thib
parents:
diff changeset
1206 /* min ¤À¤è¤Ê¤¢¡¦¡¦¡¦*/
223b71206888 Initial import
thib
parents:
diff changeset
1207 int min = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1208 int max = cmd.args[1].value;
223b71206888 Initial import
thib
parents:
diff changeset
1209 if (max < min) min = max;
223b71206888 Initial import
thib
parents:
diff changeset
1210 cmd.SetSysvar(min);
223b71206888 Initial import
thib
parents:
diff changeset
1211 } else if (cmd.cmd3 == 0x3ef) {
223b71206888 Initial import
thib
parents:
diff changeset
1212 /* min */
223b71206888 Initial import
thib
parents:
diff changeset
1213 int min = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1214 int max = cmd.args[1].value;
223b71206888 Initial import
thib
parents:
diff changeset
1215 if (max < min) min = max;
223b71206888 Initial import
thib
parents:
diff changeset
1216 cmd.SetSysvar(min);
223b71206888 Initial import
thib
parents:
diff changeset
1217 } else if (cmd.cmd3 == 0x320) {
223b71206888 Initial import
thib
parents:
diff changeset
1218 /* range conversion : ÈæΨ¤Ë´Ý¤á¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
1219 // ¥¢¥ë¥´¥ê¥º¥à¤Ï´Ö°ã¤¨¤Æ¤ë¤è¤¦¤Êµ¤¤¬¤¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1220 //
223b71206888 Initial import
thib
parents:
diff changeset
1221 if (cmd.args.size() >= 7) {
223b71206888 Initial import
thib
parents:
diff changeset
1222 int val = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1223 int offset = cmd.args[1].value;
223b71206888 Initial import
thib
parents:
diff changeset
1224 int r_min = cmd.args[2].value;
223b71206888 Initial import
thib
parents:
diff changeset
1225 int v_min = cmd.args[3].value;
223b71206888 Initial import
thib
parents:
diff changeset
1226 int v_max = cmd.args[4].value;
223b71206888 Initial import
thib
parents:
diff changeset
1227 int r_max = cmd.args[5].value;
223b71206888 Initial import
thib
parents:
diff changeset
1228 int mode = cmd.args[6].value;
223b71206888 Initial import
thib
parents:
diff changeset
1229 // rldev : mode == 1,3 : 'acceralating curve', 2,3: 'decelerating curve'
223b71206888 Initial import
thib
parents:
diff changeset
1230 // Ê£¿ô¤Î°ú¿ô¥ê¥¹¥È(r_min¤«¤émode¤Þ¤Ç¤Î¥ê¥¹¥È)¤â¤Ä¤³¤È¤â¤¢¤ê¡¢¤½¤Î¾ì¹ç¤Ï
223b71206888 Initial import
thib
parents:
diff changeset
1231 // "cancel out in some way" ¤é¤·¤¤
223b71206888 Initial import
thib
parents:
diff changeset
1232 if (mode == 1 || mode == 3) val += offset;
223b71206888 Initial import
thib
parents:
diff changeset
1233 else if (mode == 2 || mode == 4) val -= offset;
223b71206888 Initial import
thib
parents:
diff changeset
1234 if (cmd.args.size() != 7)
223b71206888 Initial import
thib
parents:
diff changeset
1235 fprintf(stderr,"\n%d/%d: cmd 01-04:0320 : XXXX NOT SUPPORTED LIST : DOUBLE RANGE CONVERSION! XXXXXXXXXXX\n",cmd.scn,cmd.pos);
223b71206888 Initial import
thib
parents:
diff changeset
1236 if (val < v_min) val = v_min;
223b71206888 Initial import
thib
parents:
diff changeset
1237 if (val > v_max) val = v_max;
223b71206888 Initial import
thib
parents:
diff changeset
1238 val = (r_max-r_min)*(val-v_min)/(v_max-v_min) + r_min;
223b71206888 Initial import
thib
parents:
diff changeset
1239 cmd.SetSysvar(val);
223b71206888 Initial import
thib
parents:
diff changeset
1240 }
223b71206888 Initial import
thib
parents:
diff changeset
1241 } else if (cmd.cmd3 == 0x3f1) {
223b71206888 Initial import
thib
parents:
diff changeset
1242 /* range Æâ¤Ë´Ý¤á¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
1243 int min = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1244 int val = cmd.args[1].value;
223b71206888 Initial import
thib
parents:
diff changeset
1245 int max = cmd.args[2].value;
223b71206888 Initial import
thib
parents:
diff changeset
1246 if (min > max) {
223b71206888 Initial import
thib
parents:
diff changeset
1247 int tmp = max;
223b71206888 Initial import
thib
parents:
diff changeset
1248 max = min;
223b71206888 Initial import
thib
parents:
diff changeset
1249 min = tmp;
223b71206888 Initial import
thib
parents:
diff changeset
1250 }
223b71206888 Initial import
thib
parents:
diff changeset
1251 if (val < min) val = min;
223b71206888 Initial import
thib
parents:
diff changeset
1252 if (val > max) val = max;
223b71206888 Initial import
thib
parents:
diff changeset
1253 cmd.SetSysvar(val);
223b71206888 Initial import
thib
parents:
diff changeset
1254 } else if (cmd.cmd3 == 0x16c && cmd.cmd4 == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
1255 /* ¤Ê¤ó¤«¤è¤¯¤ï¤«¤é¤Ê¤¤¤±¤É¥«¡¼¥½¥ë·Á¾õÊѹ¹¤Ë¤·¤È¤¯ */
223b71206888 Initial import
thib
parents:
diff changeset
1256 SetCursor(cmd.args[0].value);
223b71206888 Initial import
thib
parents:
diff changeset
1257 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1258 } else if (cmd.cmd3 == 0x0bc1) { // ¥á¥Ë¥å¡¼¤«¤é¤Î¥í¡¼¥É
223b71206888 Initial import
thib
parents:
diff changeset
1259 cmd.cmd_type = CMD_LOADREQ;
223b71206888 Initial import
thib
parents:
diff changeset
1260 } else if ( (cmd.cmd3 >= 0x8d4 && cmd.cmd3 <= 0x8d8) || cmd.cmd3 == 0x8db || cmd.cmd3 == 0x93f || cmd.cmd3 == 0xa39) {
223b71206888 Initial import
thib
parents:
diff changeset
1261 // ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤Î¿§ÀßÄê
223b71206888 Initial import
thib
parents:
diff changeset
1262 int r, g, b, a, flag;
223b71206888 Initial import
thib
parents:
diff changeset
1263 if (cmd.cmd3 == 0xa39) { // ¸µÀßÄê¤ò¼è¤ê½Ð¤¹
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1264 config->GetOriginalParam("#WINDOW_ATTR", 5, &r, &g, &b, &a, &flag);
0
223b71206888 Initial import
thib
parents:
diff changeset
1265 } else {
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1266 config->GetParam("#WINDOW_ATTR", 5, &r, &g, &b, &a, &flag);
0
223b71206888 Initial import
thib
parents:
diff changeset
1267 }
223b71206888 Initial import
thib
parents:
diff changeset
1268 if (cmd.cmd3 == 0xa39 || cmd.cmd3 == 0x93f) { // ÀßÄê¤òÊÑ¿ô¤Ë¼è¤ê½Ð¤¹
223b71206888 Initial import
thib
parents:
diff changeset
1269 if (cmd.args.size() != 5) {
223b71206888 Initial import
thib
parents:
diff changeset
1270 fprintf(stderr,"cmd 01-04:%4d : invalid arg size\n", cmd.cmd3);
223b71206888 Initial import
thib
parents:
diff changeset
1271 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1272 vector<VarInfo> args(cmd.args);
223b71206888 Initial import
thib
parents:
diff changeset
1273 cmd.SetFlagvar(args[0], r);
223b71206888 Initial import
thib
parents:
diff changeset
1274 cmd.SetFlagvar(args[1], g);
223b71206888 Initial import
thib
parents:
diff changeset
1275 cmd.SetFlagvar(args[2], b);
223b71206888 Initial import
thib
parents:
diff changeset
1276 cmd.SetFlagvar(args[3], a);
223b71206888 Initial import
thib
parents:
diff changeset
1277 cmd.SetFlagvar(args[4], flag);
223b71206888 Initial import
thib
parents:
diff changeset
1278 }
223b71206888 Initial import
thib
parents:
diff changeset
1279 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1280 switch(cmd.cmd3) {
223b71206888 Initial import
thib
parents:
diff changeset
1281 case 0x8d4: r = cmd.args[0].value; break;
223b71206888 Initial import
thib
parents:
diff changeset
1282 case 0x8d5: g = cmd.args[0].value; break;
223b71206888 Initial import
thib
parents:
diff changeset
1283 case 0x8d6: b = cmd.args[0].value; break;
223b71206888 Initial import
thib
parents:
diff changeset
1284 case 0x8d7: a = cmd.args[0].value; break;
223b71206888 Initial import
thib
parents:
diff changeset
1285 case 0x8d8: flag = cmd.args[0].value; break;
223b71206888 Initial import
thib
parents:
diff changeset
1286 case 0x8db:
223b71206888 Initial import
thib
parents:
diff changeset
1287 r = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1288 g = cmd.args[1].value;
223b71206888 Initial import
thib
parents:
diff changeset
1289 b = cmd.args[2].value;
223b71206888 Initial import
thib
parents:
diff changeset
1290 a = cmd.args[3].value;
223b71206888 Initial import
thib
parents:
diff changeset
1291 flag = cmd.args[4].value;
223b71206888 Initial import
thib
parents:
diff changeset
1292 break;
223b71206888 Initial import
thib
parents:
diff changeset
1293 }
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1294 config->SetParam("#WINDOW_ATTR", 5, r, g, b, a, flag);
0
223b71206888 Initial import
thib
parents:
diff changeset
1295 SetWindowColor(r, g, b, a, flag);
223b71206888 Initial import
thib
parents:
diff changeset
1296 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1297 }
223b71206888 Initial import
thib
parents:
diff changeset
1298 } else if (cmd.cmd3 == 0xa28 || cmd.cmd3 == 0xa29 || cmd.cmd3 == 0xa2c || cmd.cmd3 == 0xa2d || cmd.cmd3 == 0xa2e) {
223b71206888 Initial import
thib
parents:
diff changeset
1299 int v = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1300 switch(cmd.cmd3) {
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1301 case 0xa28: case 0xa2d: config->GetOriginalParam("#INIT_MESSAGE_SPEED", 1, &v); break;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1302 case 0xa29: config->GetOriginalParam("#INIT_MESSAGE_SPEED_MOD", 1, &v); break;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1303 case 0xa2c: config->GetOriginalParam("#MESSAGE_KEY_WAIT_USE", 1, &v); break;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1304 case 0xa2e: config->GetOriginalParam("#MESSAGE_KEY_WAIT_TIME", 1, &v); break;
0
223b71206888 Initial import
thib
parents:
diff changeset
1305 }
223b71206888 Initial import
thib
parents:
diff changeset
1306 cmd.SetSysvar(v);
223b71206888 Initial import
thib
parents:
diff changeset
1307 } else if (cmd.cmd3 == 0x913 || cmd.cmd3 == 0x914 || cmd.cmd3 == 0x92f || cmd.cmd3 == 0x8af || cmd.cmd3 == 0x8b0 || cmd.cmd3 == 0x8cb) {
223b71206888 Initial import
thib
parents:
diff changeset
1308 // ¥Æ¥­¥¹¥Èɽ¼¨Â®ÅÙ´ØÏ¢
223b71206888 Initial import
thib
parents:
diff changeset
1309 int m, speed;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1310 config->GetParam("#INIT_MESSAGE_SPEED", 1, &speed);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1311 config->GetParam("#INIT_MESSAGE_SPEED_MOD", 1, &m);
0
223b71206888 Initial import
thib
parents:
diff changeset
1312 if (cmd.cmd3 == 0x913 || cmd.cmd3 == 0x92f) fprintf(stderr,"TEXT speed %d\n",speed);
223b71206888 Initial import
thib
parents:
diff changeset
1313 else if (cmd.cmd3 == 0x914) fprintf(stderr,"TEXT mode %d\n",m);
223b71206888 Initial import
thib
parents:
diff changeset
1314 else if (cmd.cmd3 == 0x8af || cmd.cmd3 == 0x8cb) fprintf(stderr,"TEXT %d, %d <- speed %d\n",m,speed,cmd.args[0].value);
223b71206888 Initial import
thib
parents:
diff changeset
1315 else fprintf(stderr,"TEXT %d, %d <- mode %d\n",m,speed,cmd.args[0].value);
223b71206888 Initial import
thib
parents:
diff changeset
1316 if (cmd.cmd3 == 0x913 || cmd.cmd3 == 0x92f) cmd.SetSysvar(speed);
223b71206888 Initial import
thib
parents:
diff changeset
1317 else if (cmd.cmd3 == 0x914) cmd.SetSysvar(m);
223b71206888 Initial import
thib
parents:
diff changeset
1318 else {
223b71206888 Initial import
thib
parents:
diff changeset
1319 if (cmd.cmd3 == 0x8af || cmd.cmd3 == 0x8cb) speed = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1320 else m = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1321 if (speed < 10) speed = 10;
223b71206888 Initial import
thib
parents:
diff changeset
1322 else if (speed > 1000) speed = 1000;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1323 config->SetParam("#INIT_MESSAGE_SPEED", 1, speed);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1324 config->SetParam("#INIT_MESSAGE_SPEED_MOD", 1, m);
0
223b71206888 Initial import
thib
parents:
diff changeset
1325 if (m) speed = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1326 SetTextSpeed(speed);
223b71206888 Initial import
thib
parents:
diff changeset
1327 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1328 }
223b71206888 Initial import
thib
parents:
diff changeset
1329 } else if (cmd.cmd3 == 0x92e || cmd.cmd3 == 0x930 || cmd.cmd3 == 0x8ca || cmd.cmd3 == 0x8cc) {
223b71206888 Initial import
thib
parents:
diff changeset
1330 // ¥Æ¥­¥¹¥È¥ª¡¼¥È¥â¡¼¥É´ØÏ¢
223b71206888 Initial import
thib
parents:
diff changeset
1331 int m, wait;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1332 config->GetParam("#MESSAGE_KEY_WAIT_USE", 1, &m);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1333 config->GetParam("#MESSAGE_KEY_WAIT_TIME", 1, &wait);
0
223b71206888 Initial import
thib
parents:
diff changeset
1334 if (cmd.cmd3 == 0x92e) fprintf(stderr,"AUTO mode %d\n",m);
223b71206888 Initial import
thib
parents:
diff changeset
1335 else if (cmd.cmd3 == 0x930) fprintf(stderr,"AUTO wait %d\n",wait);
223b71206888 Initial import
thib
parents:
diff changeset
1336 else if (cmd.cmd3 == 0x8ca) fprintf(stderr,"AUTO %d,%d <- mode %d\n",m,wait,cmd.args[0].value);
223b71206888 Initial import
thib
parents:
diff changeset
1337 else fprintf(stderr,"AUTO %d,%d <- wait %d\n",m,wait,cmd.args[0].value);
223b71206888 Initial import
thib
parents:
diff changeset
1338
223b71206888 Initial import
thib
parents:
diff changeset
1339 if (cmd.cmd3 == 0x92e) cmd.SetSysvar(m);
223b71206888 Initial import
thib
parents:
diff changeset
1340 else if (cmd.cmd3 == 0x930) cmd.SetSysvar(wait);
223b71206888 Initial import
thib
parents:
diff changeset
1341 else {
223b71206888 Initial import
thib
parents:
diff changeset
1342 if (cmd.cmd3 == 0x8ca) m = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1343 else wait = cmd.args[1].value;
223b71206888 Initial import
thib
parents:
diff changeset
1344 if (wait < 0) wait = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1345 else if (wait > 60000) wait = 60000;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1346 config->SetParam("#MESSAGE_KEY_WAIT_USE", 1, m);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1347 config->SetParam("#MESSAGE_KEY_WAIT_TIME", 1, wait);
0
223b71206888 Initial import
thib
parents:
diff changeset
1348 if (m) SetTextWait(wait);
223b71206888 Initial import
thib
parents:
diff changeset
1349 else SetTextWait(-1);
223b71206888 Initial import
thib
parents:
diff changeset
1350 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1351 }
223b71206888 Initial import
thib
parents:
diff changeset
1352 } else if (cmd.cmd3 == 0x51f && cmd.cmd4 == 0) { // replace_name2 ¤ÎÀßÄê
223b71206888 Initial import
thib
parents:
diff changeset
1353 int n = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1354 if (n>=0 && n<26) {
223b71206888 Initial import
thib
parents:
diff changeset
1355 replace_name2[n] = cmd.Str(cmd.args[1]);
223b71206888 Initial import
thib
parents:
diff changeset
1356 }
223b71206888 Initial import
thib
parents:
diff changeset
1357 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1358 } else if (cmd.cmd3 == 0x51e && cmd.cmd4 == 0) { // replace_name2 ¤òÆÀ¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1359 int n = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1360 if (n >= 0 && n < 26) {
223b71206888 Initial import
thib
parents:
diff changeset
1361 cmd.SetStrvar(cmd.args[1], replace_name2[n]);
223b71206888 Initial import
thib
parents:
diff changeset
1362 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1363 cmd.SetStrvar(cmd.args[1], "");
223b71206888 Initial import
thib
parents:
diff changeset
1364 }
223b71206888 Initial import
thib
parents:
diff changeset
1365 } else if (cmd.cmd3 == 0x514 && cmd.cmd4 == 0) { // replace_name ¤òÆÀ¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1366 int n = cmd.args[0].value;
223b71206888 Initial import
thib
parents:
diff changeset
1367 if (n >= 0 && n < 26) {
223b71206888 Initial import
thib
parents:
diff changeset
1368 cmd.SetStrvar(cmd.args[1], replace_name[n]);
223b71206888 Initial import
thib
parents:
diff changeset
1369 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1370 cmd.SetStrvar(cmd.args[1], "");
223b71206888 Initial import
thib
parents:
diff changeset
1371 }
223b71206888 Initial import
thib
parents:
diff changeset
1372 }
223b71206888 Initial import
thib
parents:
diff changeset
1373 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1374 }
0
223b71206888 Initial import
thib
parents:
diff changeset
1375
223b71206888 Initial import
thib
parents:
diff changeset
1376 extern int print_blit;
223b71206888 Initial import
thib
parents:
diff changeset
1377 bool TextImpl::Wait(unsigned int current_time, Cmd& cmd) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1378 if (current_time != Event::Time::NEVER_WAKE) old_time = current_time;
0
223b71206888 Initial import
thib
parents:
diff changeset
1379 /*
223b71206888 Initial import
thib
parents:
diff changeset
1380 if (event.presscount(MOUSE_UP)) {
223b71206888 Initial import
thib
parents:
diff changeset
1381 if (text) text->Pic()->ReBlit();
223b71206888 Initial import
thib
parents:
diff changeset
1382 }
223b71206888 Initial import
thib
parents:
diff changeset
1383 if (event.presscount(MOUSE_DOWN)) {
223b71206888 Initial import
thib
parents:
diff changeset
1384 print_blit^=1;
223b71206888 Initial import
thib
parents:
diff changeset
1385 }
223b71206888 Initial import
thib
parents:
diff changeset
1386 */
223b71206888 Initial import
thib
parents:
diff changeset
1387
223b71206888 Initial import
thib
parents:
diff changeset
1388 if (status == NORMAL && status_mask == NORMAL) return false;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1389
0
223b71206888 Initial import
thib
parents:
diff changeset
1390 if (status_mask & WAIT_EXTRN_MASK) return true;
223b71206888 Initial import
thib
parents:
diff changeset
1391 if (status_mask & (BACKLOG_MASK|BACKLOG_MASK_FWD) ) {
223b71206888 Initial import
thib
parents:
diff changeset
1392 if (status_mask & BACKLOG_WAIT_MASK) ;
223b71206888 Initial import
thib
parents:
diff changeset
1393 else {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1394 if ( (status == WAIT_TEXT && text != NULL) || status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1395 if(text && text->wid->status != WidText::PREPARE && text->wid->status != WidText::WAIT && text->wid->status != WidText::WAIT2) {
223b71206888 Initial import
thib
parents:
diff changeset
1396 text->wid->Flush(); // ɽ¼¨¤òºÇ¸å¤Î¾õÂ֤ˤ¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1397 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1398 if (status == WAIT_TEXT && text != NULL && kcursor != NULL) kcursor->show();
0
223b71206888 Initial import
thib
parents:
diff changeset
1399 }
223b71206888 Initial import
thib
parents:
diff changeset
1400 }
223b71206888 Initial import
thib
parents:
diff changeset
1401 if (status_mask & BACKLOG_MASK) {
223b71206888 Initial import
thib
parents:
diff changeset
1402 cmd.cmd_type = CMD_BACKLOGREQ;
223b71206888 Initial import
thib
parents:
diff changeset
1403 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1404 cmd.cmd_type = CMD_BACKLOGREQ_FWD;
223b71206888 Initial import
thib
parents:
diff changeset
1405 }
223b71206888 Initial import
thib
parents:
diff changeset
1406 status_mask = Status(status_mask & ~(BACKLOG_MASK|BACKLOG_MASK_FWD));
223b71206888 Initial import
thib
parents:
diff changeset
1407 return false;
223b71206888 Initial import
thib
parents:
diff changeset
1408 }
223b71206888 Initial import
thib
parents:
diff changeset
1409 if ( (status_mask & BACKLOG_WAIT_MASK) && (status_mask & BACKLOG_MASK_KOE)) {
223b71206888 Initial import
thib
parents:
diff changeset
1410 if (drawn_backlog_item.koe != -1) {
223b71206888 Initial import
thib
parents:
diff changeset
1411 cmd.cmd_type = CMD_OTHER;
223b71206888 Initial import
thib
parents:
diff changeset
1412 cmd.cmd1 = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1413 cmd.cmd2 = 0x17;
223b71206888 Initial import
thib
parents:
diff changeset
1414 cmd.cmd3 = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1415 cmd.cmd4 = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1416 cmd.args.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1417 cmd.args.push_back(VarInfo(drawn_backlog_item.koe));
223b71206888 Initial import
thib
parents:
diff changeset
1418 cmd.args.push_back(VarInfo(0));
223b71206888 Initial import
thib
parents:
diff changeset
1419 }
223b71206888 Initial import
thib
parents:
diff changeset
1420 status_mask = Status(status_mask & ~BACKLOG_MASK_KOE);
223b71206888 Initial import
thib
parents:
diff changeset
1421 return false;
223b71206888 Initial import
thib
parents:
diff changeset
1422 }
223b71206888 Initial import
thib
parents:
diff changeset
1423 if (skip_mode & SKIP_IN_MENU) return false;
223b71206888 Initial import
thib
parents:
diff changeset
1424 if (status_mask & SAVEMASK) {
223b71206888 Initial import
thib
parents:
diff changeset
1425 cmd.cmd_type = CMD_SAVEREQ;
223b71206888 Initial import
thib
parents:
diff changeset
1426 status_mask = Status(status_mask & ~SAVEMASK);
223b71206888 Initial import
thib
parents:
diff changeset
1427 return false;
223b71206888 Initial import
thib
parents:
diff changeset
1428 }
223b71206888 Initial import
thib
parents:
diff changeset
1429 if (status_mask & LOADMASK) {
223b71206888 Initial import
thib
parents:
diff changeset
1430 cmd.cmd_type = CMD_LOADREQ;
223b71206888 Initial import
thib
parents:
diff changeset
1431 status_mask = Status(status_mask & ~LOADMASK);
223b71206888 Initial import
thib
parents:
diff changeset
1432 return false;
223b71206888 Initial import
thib
parents:
diff changeset
1433 }
223b71206888 Initial import
thib
parents:
diff changeset
1434 if (status_mask & SKIPEND_MASK) {
223b71206888 Initial import
thib
parents:
diff changeset
1435 if ( (skip_mode & SKIP_TEXT) && (skip_mode & SKIPEND_TEXT)) {
223b71206888 Initial import
thib
parents:
diff changeset
1436 if (skip_mode & SKIPEND_KEY) { // shift skip Ãæ
223b71206888 Initial import
thib
parents:
diff changeset
1437 SkipMode new_mode = SkipMode(skip_mode & (~SKIPEND_TEXT));
223b71206888 Initial import
thib
parents:
diff changeset
1438 if (new_mode & (SKIP_GRP_NOEFFEC || SKIP_GRP_NODRAW))
223b71206888 Initial import
thib
parents:
diff changeset
1439 new_mode = SkipMode(new_mode & (~SKIP_GRP_FAST));
223b71206888 Initial import
thib
parents:
diff changeset
1440 cmd.SetSysvar(TYPE_SYS_SKIPMODE, new_mode);
223b71206888 Initial import
thib
parents:
diff changeset
1441 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1442 cmd.SetSysvar(TYPE_SYS_SKIPMODE, SKIP_NO);
223b71206888 Initial import
thib
parents:
diff changeset
1443 }
223b71206888 Initial import
thib
parents:
diff changeset
1444 }
223b71206888 Initial import
thib
parents:
diff changeset
1445 status_mask = Status(status_mask & ~SKIPEND_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
1446 }
223b71206888 Initial import
thib
parents:
diff changeset
1447 if (status_mask & SKIPMASK) {
223b71206888 Initial import
thib
parents:
diff changeset
1448 if (skip_mode != SKIP_NO) {
223b71206888 Initial import
thib
parents:
diff changeset
1449 cmd.SetSysvar(TYPE_SYS_SKIPMODE, skip_mode | SKIPEND_TEXT);
223b71206888 Initial import
thib
parents:
diff changeset
1450 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1451 cmd.SetSysvar(TYPE_SYS_SKIPMODE, SKIP_TEXT | SKIP_GRP_FAST | SKIPEND_TEXT);
223b71206888 Initial import
thib
parents:
diff changeset
1452 }
223b71206888 Initial import
thib
parents:
diff changeset
1453 status_mask = Status(status_mask & ~SKIPMASK);
223b71206888 Initial import
thib
parents:
diff changeset
1454 return false;
223b71206888 Initial import
thib
parents:
diff changeset
1455 }
223b71206888 Initial import
thib
parents:
diff changeset
1456 if (event.presscount(MOUSE_RIGHT)) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1457 if ( (status == WAIT_TEXT && text != NULL) || status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1458 if(text && text->wid->status != WidText::PREPARE && text->wid->status != WidText::WAIT && text->wid->status != WidText::WAIT2) {
223b71206888 Initial import
thib
parents:
diff changeset
1459 text->wid->Flush(); // ɽ¼¨¤òºÇ¸å¤Î¾õÂ֤ˤ¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1460 }
223b71206888 Initial import
thib
parents:
diff changeset
1461 cmd.cmd_type = CMD_MENUREQ;
223b71206888 Initial import
thib
parents:
diff changeset
1462 if (!(status_mask & STATSAVE_MASK)) {
223b71206888 Initial import
thib
parents:
diff changeset
1463 status_saved = status;
223b71206888 Initial import
thib
parents:
diff changeset
1464 status_mask = Status(status_mask | STATSAVE_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
1465 }
223b71206888 Initial import
thib
parents:
diff changeset
1466 return false;
223b71206888 Initial import
thib
parents:
diff changeset
1467 } else if (status == WAIT_CLICK_MOUSEPOS) {
223b71206888 Initial import
thib
parents:
diff changeset
1468 status = WAIT_CLICK_MOUSEPOSEND_R;
223b71206888 Initial import
thib
parents:
diff changeset
1469 }
223b71206888 Initial import
thib
parents:
diff changeset
1470 }
223b71206888 Initial import
thib
parents:
diff changeset
1471 if (event.presscount(MOUSE_UP)) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1472 if ( (status == WAIT_TEXT && text != NULL) || status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1473 if(text && text->wid->status != WidText::PREPARE && text->wid->status != WidText::WAIT && text->wid->status != WidText::WAIT2) {
223b71206888 Initial import
thib
parents:
diff changeset
1474 text->wid->Flush(); // ɽ¼¨¤òºÇ¸å¤Î¾õÂ֤ˤ¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1475 }
223b71206888 Initial import
thib
parents:
diff changeset
1476 cmd.cmd_type = CMD_BACKLOGREQ;
223b71206888 Initial import
thib
parents:
diff changeset
1477 if (!(status_mask & STATSAVE_MASK)) {
223b71206888 Initial import
thib
parents:
diff changeset
1478 status_saved = status;
223b71206888 Initial import
thib
parents:
diff changeset
1479 status_mask = Status(status_mask | STATSAVE_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
1480 }
223b71206888 Initial import
thib
parents:
diff changeset
1481 return false;
223b71206888 Initial import
thib
parents:
diff changeset
1482 }
223b71206888 Initial import
thib
parents:
diff changeset
1483 }
223b71206888 Initial import
thib
parents:
diff changeset
1484 if (status_mask & CLEARSCR_MASK) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1485 if ( (status == WAIT_TEXT && text != NULL ) || status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1486 if (skip_mode) skip_mode = SKIP_NO;
223b71206888 Initial import
thib
parents:
diff changeset
1487 if (text && text->wid->status != WidText::PREPARE && text->wid->status != WidText::WAIT && text->wid->status != WidText::WAIT2) {
223b71206888 Initial import
thib
parents:
diff changeset
1488 text->wid->Flush(); // ɽ¼¨¤òºÇ¸å¤Î¾õÂ֤ˤ¹¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1489 return true;
223b71206888 Initial import
thib
parents:
diff changeset
1490 }
223b71206888 Initial import
thib
parents:
diff changeset
1491 status_mask = Status(status_mask & (~CLEARSCR_MASK) | CLEARSCR_WAIT_MASK);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1492 if (text != NULL) text->hide();
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1493 if (kcursor != NULL) kcursor->hide();
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1494 if (sel_widget != NULL) sel_widget->hide();
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1495 if (backlog_widget != NULL) backlog_widget->hide();
0
223b71206888 Initial import
thib
parents:
diff changeset
1496 return true;
223b71206888 Initial import
thib
parents:
diff changeset
1497 }
223b71206888 Initial import
thib
parents:
diff changeset
1498 status_mask = Status(status_mask & (~CLEARSCR_MASK));
223b71206888 Initial import
thib
parents:
diff changeset
1499 return false;
223b71206888 Initial import
thib
parents:
diff changeset
1500 }
223b71206888 Initial import
thib
parents:
diff changeset
1501 if (status_mask & CLEARSCR_WAIT_MASK) {
223b71206888 Initial import
thib
parents:
diff changeset
1502 return true;
223b71206888 Initial import
thib
parents:
diff changeset
1503 }
223b71206888 Initial import
thib
parents:
diff changeset
1504 if (status == WAIT_TEXT) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1505 if (text == NULL) {
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1506 status = NORMAL;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1507 return false;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1508 }
0
223b71206888 Initial import
thib
parents:
diff changeset
1509 if (skip_mode & SKIP_TEXT) {
223b71206888 Initial import
thib
parents:
diff changeset
1510 } else if (text->wid->status != WidText::PREPARE) {
223b71206888 Initial import
thib
parents:
diff changeset
1511 return true;
223b71206888 Initial import
thib
parents:
diff changeset
1512 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1513 if (kcursor != NULL) kcursor->hide();
0
223b71206888 Initial import
thib
parents:
diff changeset
1514 text_stream.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
1515 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
1516 cmd.cmd_type = CMD_TEXTEND;
223b71206888 Initial import
thib
parents:
diff changeset
1517 return false;
223b71206888 Initial import
thib
parents:
diff changeset
1518 }
223b71206888 Initial import
thib
parents:
diff changeset
1519 if (status == WAIT) {
223b71206888 Initial import
thib
parents:
diff changeset
1520 if (skip_mode & SKIP_TEXT) ;
223b71206888 Initial import
thib
parents:
diff changeset
1521 else if (wait_time > current_time) return true;
223b71206888 Initial import
thib
parents:
diff changeset
1522 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
1523 } else if (status == WAIT_CLICK) {
223b71206888 Initial import
thib
parents:
diff changeset
1524 if (skip_mode & SKIP_TEXT) ;
223b71206888 Initial import
thib
parents:
diff changeset
1525 else if (wait_time > current_time) return true;
223b71206888 Initial import
thib
parents:
diff changeset
1526 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
1527 cmd.SetSysvar(0);
223b71206888 Initial import
thib
parents:
diff changeset
1528 } else if (status == WAIT_ABORT) {
223b71206888 Initial import
thib
parents:
diff changeset
1529 cmd.SetSysvar(1);
223b71206888 Initial import
thib
parents:
diff changeset
1530 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
1531 } else if (status == WAIT_CLICK_MOUSEPOS || status == WAIT_CLICK_MOUSEPOSEND_L || status == WAIT_CLICK_MOUSEPOSEND_R) {
223b71206888 Initial import
thib
parents:
diff changeset
1532 if (status == WAIT_CLICK_MOUSEPOS && (skip_mode & SKIP_TEXT) == 0) return true; // keep wait
223b71206888 Initial import
thib
parents:
diff changeset
1533 else {
223b71206888 Initial import
thib
parents:
diff changeset
1534 int x, y;
223b71206888 Initial import
thib
parents:
diff changeset
1535 event.MousePos(x,y);
223b71206888 Initial import
thib
parents:
diff changeset
1536 if (status == WAIT_CLICK_MOUSEPOS) x = y = 0; // skip mode
223b71206888 Initial import
thib
parents:
diff changeset
1537 cmd.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1538 cmd.SetFlagvar(wait_savedvar[0], x);
223b71206888 Initial import
thib
parents:
diff changeset
1539 cmd.SetFlagvar(wait_savedvar[1], y);
223b71206888 Initial import
thib
parents:
diff changeset
1540 if (status == WAIT_CLICK_MOUSEPOSEND_R) cmd.SetSysvar(-1);
223b71206888 Initial import
thib
parents:
diff changeset
1541 else cmd.SetSysvar(0);
223b71206888 Initial import
thib
parents:
diff changeset
1542 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
1543 }
223b71206888 Initial import
thib
parents:
diff changeset
1544 } else if (status == WAIT_SELECT_INBOX || status == WAIT_SELECT_OUTBOX) {
223b71206888 Initial import
thib
parents:
diff changeset
1545 return true;
223b71206888 Initial import
thib
parents:
diff changeset
1546 } else if ( int(status) >= WAIT_SELECT_VALUE) {
223b71206888 Initial import
thib
parents:
diff changeset
1547 int sel_val = int(status) - WAIT_SELECT_VALUE;
223b71206888 Initial import
thib
parents:
diff changeset
1548 cmd.SetSysvar(sel_val);
223b71206888 Initial import
thib
parents:
diff changeset
1549 selects.clear();
223b71206888 Initial import
thib
parents:
diff changeset
1550 delete sel_widget;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1551 sel_widget = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1552 status = NORMAL;
223b71206888 Initial import
thib
parents:
diff changeset
1553 // CreateSelect() ¤ÇºîÀ®¤µ¤ì¤¿ cur_backlog_item ¤ò backlog_item ¤ØÈ¿±Ç¤µ¤»¤ë
223b71206888 Initial import
thib
parents:
diff changeset
1554 cur_backlog_item.text.InsertColor(sel_backlog_pos[sel_val], sel_backlog_pos[sel_val+1], 0xff, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
1555 backlog_item = cur_backlog_item;
223b71206888 Initial import
thib
parents:
diff changeset
1556 cur_backlog_item.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
1557 }
223b71206888 Initial import
thib
parents:
diff changeset
1558 return false;
223b71206888 Initial import
thib
parents:
diff changeset
1559 }
223b71206888 Initial import
thib
parents:
diff changeset
1560
223b71206888 Initial import
thib
parents:
diff changeset
1561 void clearbtn_press(void* pointer, WidButton* button) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1562 if (pointer == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1563 TextImpl* t = (TextImpl*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
1564 t->status_mask = TextImpl::Status(t->status_mask | TextImpl::CLEARSCR_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
1565 return;
223b71206888 Initial import
thib
parents:
diff changeset
1566 }
223b71206888 Initial import
thib
parents:
diff changeset
1567 void TextImpl::PressFuncSkip(void* pointer, WidButton* from) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1568 if (pointer == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1569 TextImpl* t = (TextImpl*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
1570 t->status_mask = TextImpl::Status(t->status_mask | TextImpl::SKIPMASK);
223b71206888 Initial import
thib
parents:
diff changeset
1571 return;
223b71206888 Initial import
thib
parents:
diff changeset
1572 }
223b71206888 Initial import
thib
parents:
diff changeset
1573 void TextImpl::PressFuncLoad(void* pointer, WidButton* from) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1574 if (pointer == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1575 TextImpl* t = (TextImpl*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
1576 t->status_mask = TextImpl::Status(t->status_mask | TextImpl::LOADMASK);
223b71206888 Initial import
thib
parents:
diff changeset
1577 return;
223b71206888 Initial import
thib
parents:
diff changeset
1578 }
223b71206888 Initial import
thib
parents:
diff changeset
1579 void TextImpl::PressFuncSave(void* pointer, WidButton* from) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1580 if (pointer == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1581 TextImpl* t = (TextImpl*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
1582 t->status_mask = TextImpl::Status(t->status_mask | TextImpl::SAVEMASK);
223b71206888 Initial import
thib
parents:
diff changeset
1583 return;
223b71206888 Initial import
thib
parents:
diff changeset
1584 }
223b71206888 Initial import
thib
parents:
diff changeset
1585 void TextImpl::PressFuncBacklog(void* pointer, WidButton* from) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1586 if (pointer == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1587 TextImpl* t = (TextImpl*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
1588 t->status_mask = TextImpl::Status(t->status_mask | TextImpl::BACKLOG_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
1589 return;
223b71206888 Initial import
thib
parents:
diff changeset
1590 }
223b71206888 Initial import
thib
parents:
diff changeset
1591 void TextImpl::PressFuncBacklogFwd(void* pointer, WidButton* from) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1592 if (pointer == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1593 TextImpl* t = (TextImpl*)pointer;
223b71206888 Initial import
thib
parents:
diff changeset
1594 t->status_mask = TextImpl::Status(t->status_mask | TextImpl::BACKLOG_MASK_FWD);
223b71206888 Initial import
thib
parents:
diff changeset
1595 return;
223b71206888 Initial import
thib
parents:
diff changeset
1596 }
223b71206888 Initial import
thib
parents:
diff changeset
1597 void movebtn_drag(int from_x, int from_y, int x, int y, void* pointer, WidButton* button) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1598 if (pointer == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1599 fprintf(stderr,"drag.\n");
223b71206888 Initial import
thib
parents:
diff changeset
1600 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1601
0
223b71206888 Initial import
thib
parents:
diff changeset
1602 #define BTNCNT 10
47
5f548e5957a8 * get rid of the "deprecated conversion from string constant to ‘char*’" warnings
thib
parents: 43
diff changeset
1603 static const char* btnname[BTNCNT] = {
0
223b71206888 Initial import
thib
parents:
diff changeset
1604 "MOVE",
223b71206888 Initial import
thib
parents:
diff changeset
1605 "CLEAR",
223b71206888 Initial import
thib
parents:
diff changeset
1606 "READJUMP",
223b71206888 Initial import
thib
parents:
diff changeset
1607 "AUTOMODE",
223b71206888 Initial import
thib
parents:
diff changeset
1608 "MSGBK",
223b71206888 Initial import
thib
parents:
diff changeset
1609 "MSGBKLEFT",
223b71206888 Initial import
thib
parents:
diff changeset
1610 "MSGBKRIGHT",
223b71206888 Initial import
thib
parents:
diff changeset
1611 "EXBTN_000",
223b71206888 Initial import
thib
parents:
diff changeset
1612 "EXBTN_001",
223b71206888 Initial import
thib
parents:
diff changeset
1613 "EXBTN_002"
223b71206888 Initial import
thib
parents:
diff changeset
1614 };
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1615
0
223b71206888 Initial import
thib
parents:
diff changeset
1616 static int btnpos[BTNCNT] = { // g00 ¥Õ¥¡¥¤¥ëÆâ¤Î¥Ü¥¿¥ó¾ðÊó¤Î°ÌÃÖ
223b71206888 Initial import
thib
parents:
diff changeset
1617 // 0, 1, 13, 12, 2, 3, 4, 5, 6, 7 // princess bride?
223b71206888 Initial import
thib
parents:
diff changeset
1618 0, 1, 13, 14, 2, 3, 4, 5, 6, 7 // tomoyo after?
223b71206888 Initial import
thib
parents:
diff changeset
1619 };
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1620
0
223b71206888 Initial import
thib
parents:
diff changeset
1621 static WidButton::PressFunc btnpress[BTNCNT] = {
223b71206888 Initial import
thib
parents:
diff changeset
1622 0, clearbtn_press, &TextImpl::PressFuncSkip,0,&TextImpl::PressFuncBacklogFwd,&TextImpl::PressFuncBacklog,&TextImpl::PressFuncBacklogFwd,&TextImpl::PressFuncSave,&TextImpl::PressFuncLoad,0
223b71206888 Initial import
thib
parents:
diff changeset
1623 };
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1624
0
223b71206888 Initial import
thib
parents:
diff changeset
1625 static WidButton::DragFunc btndrag[BTNCNT] = {
223b71206888 Initial import
thib
parents:
diff changeset
1626 movebtn_drag, 0,0,0,0, 0,0,0,0, 0
223b71206888 Initial import
thib
parents:
diff changeset
1627 };
223b71206888 Initial import
thib
parents:
diff changeset
1628
223b71206888 Initial import
thib
parents:
diff changeset
1629 void TextImpl::SetTextSpeed(int speed) {
223b71206888 Initial import
thib
parents:
diff changeset
1630 // 100 : 10char / sec
223b71206888 Initial import
thib
parents:
diff changeset
1631 // 10 : 100char / sec
223b71206888 Initial import
thib
parents:
diff changeset
1632 // text widget:
223b71206888 Initial import
thib
parents:
diff changeset
1633 if (speed <= 0) speed = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1634 else if (speed > 1000) speed = 1;
223b71206888 Initial import
thib
parents:
diff changeset
1635 else speed = 1000 / speed;
223b71206888 Initial import
thib
parents:
diff changeset
1636 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1637 for (i=0; i<32; i++)
223b71206888 Initial import
thib
parents:
diff changeset
1638 if (widgets[i]) widgets[i]->wid->SetSpeed(speed);
223b71206888 Initial import
thib
parents:
diff changeset
1639 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1640
0
223b71206888 Initial import
thib
parents:
diff changeset
1641 void TextImpl::SetTextWait(int wait) {
223b71206888 Initial import
thib
parents:
diff changeset
1642 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1643 for (i=0; i<32; i++)
223b71206888 Initial import
thib
parents:
diff changeset
1644 if (widgets[i]) widgets[i]->wid->SetWait(wait);
223b71206888 Initial import
thib
parents:
diff changeset
1645 }
223b71206888 Initial import
thib
parents:
diff changeset
1646
223b71206888 Initial import
thib
parents:
diff changeset
1647 void TextImpl::SetWindowColor(int r, int g, int b, int a, bool is_transparent) {
223b71206888 Initial import
thib
parents:
diff changeset
1648 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1649 int w;
223b71206888 Initial import
thib
parents:
diff changeset
1650
223b71206888 Initial import
thib
parents:
diff changeset
1651 for (w=0; w<32; w++) {
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1652 if (widgets[w] == NULL) continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
1653 sprintf(key, "#WAKU.%03d.000.BACK", w);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1654 const char* back = config->GetParaStr(key);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1655 if (back == NULL || back[0] == 0) continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
1656 sprintf(key, "%s.g00", back);
223b71206888 Initial import
thib
parents:
diff changeset
1657 Surface* back_s = parent.Root().NewSurface(key);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1658 if (back_s == NULL) continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
1659 Rect rect(*back_s);
223b71206888 Initial import
thib
parents:
diff changeset
1660 Surface* new_s = parent.Root().NewSurface(rect.width(), rect.height(), ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
1661 DSurfaceMove(back_s, rect, new_s, rect);
223b71206888 Initial import
thib
parents:
diff changeset
1662 DSurfaceFillA(new_s, rect, r, g, b, a);
223b71206888 Initial import
thib
parents:
diff changeset
1663 widgets[w]->wid->Pic()->SetSurface(new_s, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
1664 widgets[w]->wid->Pic()->SetSurfaceFreeFlag(1);
223b71206888 Initial import
thib
parents:
diff changeset
1665 if (!is_transparent)
223b71206888 Initial import
thib
parents:
diff changeset
1666 widgets[w]->wid->Pic()->SetSurfaceAttribute(PicBase::BLIT_MULTIPLY);
223b71206888 Initial import
thib
parents:
diff changeset
1667 parent.Root().DeleteSurface(back_s);
223b71206888 Initial import
thib
parents:
diff changeset
1668 }
223b71206888 Initial import
thib
parents:
diff changeset
1669 }
223b71206888 Initial import
thib
parents:
diff changeset
1670
223b71206888 Initial import
thib
parents:
diff changeset
1671 void TextImpl::SetCursor(int cursor_no) {
223b71206888 Initial import
thib
parents:
diff changeset
1672 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1673 sprintf(key, "#CURSOR.%03d.NAME", cursor_no);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1674 string path = config->GetParaStr(key);
0
223b71206888 Initial import
thib
parents:
diff changeset
1675 if (path.length() == 0) return; // ̾Á°¤Ê¤·
223b71206888 Initial import
thib
parents:
diff changeset
1676 path += ".pdt";
223b71206888 Initial import
thib
parents:
diff changeset
1677 int w,h,cont,speed;
223b71206888 Initial import
thib
parents:
diff changeset
1678 sprintf(key, "#CURSOR.%03d.SIZE", cursor_no);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1679 config->GetParam(key, 2, &w, &h);
0
223b71206888 Initial import
thib
parents:
diff changeset
1680 sprintf(key, "#CURSOR.%03d.CONT", cursor_no);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1681 config->GetParam(key, 1, &cont);
0
223b71206888 Initial import
thib
parents:
diff changeset
1682 sprintf(key, "#CURSOR.%03d.SPEED", cursor_no);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1683 config->GetParam(key, 1, &speed);
0
223b71206888 Initial import
thib
parents:
diff changeset
1684
223b71206888 Initial import
thib
parents:
diff changeset
1685 // speed ¤Ç£±¼þ¡¢cont ²óÊѲ½
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1686 if (kcursor != NULL) delete kcursor;
0
223b71206888 Initial import
thib
parents:
diff changeset
1687
223b71206888 Initial import
thib
parents:
diff changeset
1688 kcursor = new WidTimeCursor(event, speed/cont, &parent, path.c_str(), 0, 0, w, 0, cont, Rect(0,0,w,h));
223b71206888 Initial import
thib
parents:
diff changeset
1689 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1690 for (i=0; i<32; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1691 if (widgets[i]) widgets[i]->wid->SetCursor(kcursor);
223b71206888 Initial import
thib
parents:
diff changeset
1692 }
223b71206888 Initial import
thib
parents:
diff changeset
1693 }
223b71206888 Initial import
thib
parents:
diff changeset
1694
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1695 void kconv(const unsigned char* src, unsigned char* dest) { //FIXME: code duplication?
0
223b71206888 Initial import
thib
parents:
diff changeset
1696 /* input : sjis output: euc */
223b71206888 Initial import
thib
parents:
diff changeset
1697 while(*src) {
223b71206888 Initial import
thib
parents:
diff changeset
1698 unsigned int high = *src++;
223b71206888 Initial import
thib
parents:
diff changeset
1699 if (high < 0x80) {
223b71206888 Initial import
thib
parents:
diff changeset
1700 /* ASCII */
223b71206888 Initial import
thib
parents:
diff changeset
1701 *dest++ = high; continue;
223b71206888 Initial import
thib
parents:
diff changeset
1702 } else if (high < 0xa0) {
223b71206888 Initial import
thib
parents:
diff changeset
1703 /* SJIS */
223b71206888 Initial import
thib
parents:
diff changeset
1704 high -= 0x71;
223b71206888 Initial import
thib
parents:
diff changeset
1705 } else if (high < 0xe0) {
223b71206888 Initial import
thib
parents:
diff changeset
1706 /* hankaku KANA */
223b71206888 Initial import
thib
parents:
diff changeset
1707 *dest++ = 0x8e; *dest++ = high;
223b71206888 Initial import
thib
parents:
diff changeset
1708 continue;
223b71206888 Initial import
thib
parents:
diff changeset
1709 } else { /* high >= 0xe0 : SJIS */
223b71206888 Initial import
thib
parents:
diff changeset
1710 high -= 0xb1;
223b71206888 Initial import
thib
parents:
diff changeset
1711 }
223b71206888 Initial import
thib
parents:
diff changeset
1712 /* SJIS convert */
223b71206888 Initial import
thib
parents:
diff changeset
1713 high = (high<<1) + 1;
223b71206888 Initial import
thib
parents:
diff changeset
1714
223b71206888 Initial import
thib
parents:
diff changeset
1715 unsigned int low = *src++;
223b71206888 Initial import
thib
parents:
diff changeset
1716 if (low == 0) break; /* incorrect code */
223b71206888 Initial import
thib
parents:
diff changeset
1717 if (low > 0x7f) low--;
223b71206888 Initial import
thib
parents:
diff changeset
1718 if (low >= 0x9e) {
223b71206888 Initial import
thib
parents:
diff changeset
1719 low -= 0x7d;
223b71206888 Initial import
thib
parents:
diff changeset
1720 high++;
223b71206888 Initial import
thib
parents:
diff changeset
1721 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1722 low -= 0x1f;
223b71206888 Initial import
thib
parents:
diff changeset
1723 }
223b71206888 Initial import
thib
parents:
diff changeset
1724 *dest++ = high | 0x80; *dest++ = low | 0x80;
223b71206888 Initial import
thib
parents:
diff changeset
1725 }
223b71206888 Initial import
thib
parents:
diff changeset
1726 *dest = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1727 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1728
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1729 void kconv_rev(const unsigned char* src, unsigned char* dest) { //FIXME: code duplication?
0
223b71206888 Initial import
thib
parents:
diff changeset
1730 /* input : euc output: sjis */
223b71206888 Initial import
thib
parents:
diff changeset
1731 while(*src) {
223b71206888 Initial import
thib
parents:
diff changeset
1732 unsigned int high = *src++;
223b71206888 Initial import
thib
parents:
diff changeset
1733 if (high < 0x80) {
223b71206888 Initial import
thib
parents:
diff changeset
1734 /* ASCII */
223b71206888 Initial import
thib
parents:
diff changeset
1735 *dest++ = high; continue;
223b71206888 Initial import
thib
parents:
diff changeset
1736 } else if (high == 0x8e) { /* hankaku KANA */
223b71206888 Initial import
thib
parents:
diff changeset
1737 high = *src;
223b71206888 Initial import
thib
parents:
diff changeset
1738 if (high >= 0xa0 && high < 0xe0)
223b71206888 Initial import
thib
parents:
diff changeset
1739 *dest++ = *src++;
223b71206888 Initial import
thib
parents:
diff changeset
1740 continue;
223b71206888 Initial import
thib
parents:
diff changeset
1741 } else {
223b71206888 Initial import
thib
parents:
diff changeset
1742 unsigned int low = *src++;
223b71206888 Initial import
thib
parents:
diff changeset
1743 if (low == 0) break; /* incorrect code , EOS */
223b71206888 Initial import
thib
parents:
diff changeset
1744 if (low < 0x80) continue; /* incorrect code */
223b71206888 Initial import
thib
parents:
diff changeset
1745 /* convert */
223b71206888 Initial import
thib
parents:
diff changeset
1746 low &= 0x7f; high &= 0x7f;
223b71206888 Initial import
thib
parents:
diff changeset
1747 low += (high & 1) ? 0x1f : 0x7d;
223b71206888 Initial import
thib
parents:
diff changeset
1748 high = (high-0x21)>>1;
223b71206888 Initial import
thib
parents:
diff changeset
1749 high += (high > 0x1e) ? 0xc1 : 0x81;
223b71206888 Initial import
thib
parents:
diff changeset
1750 *dest++ = high;
223b71206888 Initial import
thib
parents:
diff changeset
1751 if (low > 0x7f) low++;
223b71206888 Initial import
thib
parents:
diff changeset
1752 *dest++ = low;
223b71206888 Initial import
thib
parents:
diff changeset
1753 }
223b71206888 Initial import
thib
parents:
diff changeset
1754 }
223b71206888 Initial import
thib
parents:
diff changeset
1755 *dest = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1756 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1757
0
223b71206888 Initial import
thib
parents:
diff changeset
1758 string kconv(const string& s) {
223b71206888 Initial import
thib
parents:
diff changeset
1759 char* out = new char[s.length()*2+100];
223b71206888 Initial import
thib
parents:
diff changeset
1760 kconv((const unsigned char*)s.c_str(), (unsigned char*)out);
223b71206888 Initial import
thib
parents:
diff changeset
1761 string ret = out;
223b71206888 Initial import
thib
parents:
diff changeset
1762 delete[] out;
223b71206888 Initial import
thib
parents:
diff changeset
1763 return ret;
223b71206888 Initial import
thib
parents:
diff changeset
1764 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1765
0
223b71206888 Initial import
thib
parents:
diff changeset
1766 string kconv_rev(const string& s) {
223b71206888 Initial import
thib
parents:
diff changeset
1767 char* out = new char[s.length()*2+100];
223b71206888 Initial import
thib
parents:
diff changeset
1768 kconv_rev((const unsigned char*)s.c_str(), (unsigned char*)out);
223b71206888 Initial import
thib
parents:
diff changeset
1769 string ret = out;
223b71206888 Initial import
thib
parents:
diff changeset
1770 delete[] out;
223b71206888 Initial import
thib
parents:
diff changeset
1771 return ret;
223b71206888 Initial import
thib
parents:
diff changeset
1772 }
223b71206888 Initial import
thib
parents:
diff changeset
1773
223b71206888 Initial import
thib
parents:
diff changeset
1774 /**************************************************************::
223b71206888 Initial import
thib
parents:
diff changeset
1775 **
223b71206888 Initial import
thib
parents:
diff changeset
1776 ** Text
223b71206888 Initial import
thib
parents:
diff changeset
1777 */
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1778 Text::Text(Event::Container& _event, PicContainer& _parent) {
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1779 pimpl = new TextImpl(_event, _parent, backlog, backlog_item);
0
223b71206888 Initial import
thib
parents:
diff changeset
1780 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1781
0
223b71206888 Initial import
thib
parents:
diff changeset
1782 Text::~Text() {
223b71206888 Initial import
thib
parents:
diff changeset
1783 delete pimpl;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1784 pimpl = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1785 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1786
0
223b71206888 Initial import
thib
parents:
diff changeset
1787 void Text::InitWindow(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1788 pimpl->InitWindow();
223b71206888 Initial import
thib
parents:
diff changeset
1789 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1790
0
223b71206888 Initial import
thib
parents:
diff changeset
1791 void Text::Exec(Cmd& cmd) {
223b71206888 Initial import
thib
parents:
diff changeset
1792 pimpl->Exec(cmd);
223b71206888 Initial import
thib
parents:
diff changeset
1793 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1794
0
223b71206888 Initial import
thib
parents:
diff changeset
1795 bool Text::Wait(unsigned int current_time, Cmd& cmd) {
223b71206888 Initial import
thib
parents:
diff changeset
1796 return pimpl->Wait(current_time, cmd);
223b71206888 Initial import
thib
parents:
diff changeset
1797 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1798
0
223b71206888 Initial import
thib
parents:
diff changeset
1799 void Text::SetSkipMode(SkipMode mode) {
223b71206888 Initial import
thib
parents:
diff changeset
1800 pimpl->SetSkipMode(mode);
223b71206888 Initial import
thib
parents:
diff changeset
1801 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1802
0
223b71206888 Initial import
thib
parents:
diff changeset
1803 void Text::Save(std::string& str, bool select_save) {
223b71206888 Initial import
thib
parents:
diff changeset
1804 pimpl->Save(str, select_save);
223b71206888 Initial import
thib
parents:
diff changeset
1805 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1806
0
223b71206888 Initial import
thib
parents:
diff changeset
1807 void Text::Load(const char* str) {
223b71206888 Initial import
thib
parents:
diff changeset
1808 pimpl->Load(str);
223b71206888 Initial import
thib
parents:
diff changeset
1809 }
223b71206888 Initial import
thib
parents:
diff changeset
1810
223b71206888 Initial import
thib
parents:
diff changeset
1811 void Text::hide(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1812 pimpl->hide();
223b71206888 Initial import
thib
parents:
diff changeset
1813 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1814
0
223b71206888 Initial import
thib
parents:
diff changeset
1815 void Text::show(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1816 pimpl->show();
223b71206888 Initial import
thib
parents:
diff changeset
1817 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1818
0
223b71206888 Initial import
thib
parents:
diff changeset
1819 void Text::show(int num) {
223b71206888 Initial import
thib
parents:
diff changeset
1820 pimpl->show(num);
223b71206888 Initial import
thib
parents:
diff changeset
1821 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1822
0
223b71206888 Initial import
thib
parents:
diff changeset
1823 void Text::DrawBacklog(BacklogItem& item, Cmd& cmd) {
223b71206888 Initial import
thib
parents:
diff changeset
1824 pimpl->DrawBacklog(item, cmd);
223b71206888 Initial import
thib
parents:
diff changeset
1825 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1826
0
223b71206888 Initial import
thib
parents:
diff changeset
1827 /**************************************************************::
223b71206888 Initial import
thib
parents:
diff changeset
1828 **
223b71206888 Initial import
thib
parents:
diff changeset
1829 ** BacklogItem
223b71206888 Initial import
thib
parents:
diff changeset
1830 */
223b71206888 Initial import
thib
parents:
diff changeset
1831
223b71206888 Initial import
thib
parents:
diff changeset
1832 BacklogItem::BacklogItem(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1833 scn = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1834 pos = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1835 koe = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1836 face = "";
223b71206888 Initial import
thib
parents:
diff changeset
1837 text.kanji_type = TextStream::sjis;
223b71206888 Initial import
thib
parents:
diff changeset
1838 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1839
0
223b71206888 Initial import
thib
parents:
diff changeset
1840 void BacklogItem::Clear(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1841 scn = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1842 pos = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1843 koe = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1844 text.Clear();
223b71206888 Initial import
thib
parents:
diff changeset
1845 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1846
0
223b71206888 Initial import
thib
parents:
diff changeset
1847 void BacklogItem::AddTextPos(Cmd& cmd) {
223b71206888 Initial import
thib
parents:
diff changeset
1848 if (scn == -1 && pos == -1) {
223b71206888 Initial import
thib
parents:
diff changeset
1849 scn = cmd.scn;
223b71206888 Initial import
thib
parents:
diff changeset
1850 pos = cmd.pos;
223b71206888 Initial import
thib
parents:
diff changeset
1851 return;
223b71206888 Initial import
thib
parents:
diff changeset
1852 }
223b71206888 Initial import
thib
parents:
diff changeset
1853 DeleteTextPos();
223b71206888 Initial import
thib
parents:
diff changeset
1854 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1855
0
223b71206888 Initial import
thib
parents:
diff changeset
1856 void BacklogItem::DeleteTextPos(void) {
223b71206888 Initial import
thib
parents:
diff changeset
1857 scn = 0;
223b71206888 Initial import
thib
parents:
diff changeset
1858 pos = -1;
223b71206888 Initial import
thib
parents:
diff changeset
1859 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1860
0
223b71206888 Initial import
thib
parents:
diff changeset
1861 BacklogItem& BacklogItem::operator =(const BacklogItem& p) {
223b71206888 Initial import
thib
parents:
diff changeset
1862 scn = p.scn;
223b71206888 Initial import
thib
parents:
diff changeset
1863 pos = p.pos;
223b71206888 Initial import
thib
parents:
diff changeset
1864 koe = p.koe;
223b71206888 Initial import
thib
parents:
diff changeset
1865 face = p.face;
223b71206888 Initial import
thib
parents:
diff changeset
1866 text = p.text;
223b71206888 Initial import
thib
parents:
diff changeset
1867 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1868
0
223b71206888 Initial import
thib
parents:
diff changeset
1869 void BacklogItem::SetSavepos(int p) {
223b71206888 Initial import
thib
parents:
diff changeset
1870 Clear();
223b71206888 Initial import
thib
parents:
diff changeset
1871 scn = SaveSelect;
223b71206888 Initial import
thib
parents:
diff changeset
1872 pos = p;
223b71206888 Initial import
thib
parents:
diff changeset
1873 }
223b71206888 Initial import
thib
parents:
diff changeset
1874
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1875 Rect TextWindow::WakuSize(PicContainer& pic, int waku_no) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1876 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1877 sprintf(key, "#WAKU.%03d.000.NAME", waku_no);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1878 const char* name = AyuSysConfig::GetInstance()->GetParaStr(key);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1879 if (name == NULL) return Rect(0,0,0,0);
0
223b71206888 Initial import
thib
parents:
diff changeset
1880 std::string str = name; str += ".g00";
223b71206888 Initial import
thib
parents:
diff changeset
1881 Surface* s = pic.Root().NewSurface(str.c_str());
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1882 if (s == NULL) return Rect(0,0,0,0);
0
223b71206888 Initial import
thib
parents:
diff changeset
1883 Rect r(*s);
223b71206888 Initial import
thib
parents:
diff changeset
1884 pic.Root().DeleteSurface(s);
223b71206888 Initial import
thib
parents:
diff changeset
1885 return r;
223b71206888 Initial import
thib
parents:
diff changeset
1886 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1887
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1888 void TextWindow::MakeWaku(PicContainer& pic, Event::Container& event, int waku_no, int window_no, bool* use_btn, void* callback) {
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1889 AyuSysConfig *config = AyuSysConfig::GetInstance();
0
223b71206888 Initial import
thib
parents:
diff changeset
1890 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1891 std::string str;
223b71206888 Initial import
thib
parents:
diff changeset
1892 /* ÏȤòºîÀ® */
223b71206888 Initial import
thib
parents:
diff changeset
1893 sprintf(key, "#WAKU.%03d.000.NAME", waku_no);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1894 const char* name = config->GetParaStr(key);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1895 if (name != NULL && name[0] == 0) name = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1896 sprintf(key, "#WAKU.%03d.000.BACK", waku_no);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1897 const char* back = config->GetParaStr(key);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1898 if (back != NULL && back[0] == 0) back = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1899 sprintf(key, "#WAKU.%03d.000.BTN", waku_no);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1900 const char* btn = config->GetParaStr(key);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1901 if (btn != NULL && btn[0] == 0) btn = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
1902
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1903 if (name == NULL && back == NULL && btn == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1904
223b71206888 Initial import
thib
parents:
diff changeset
1905 /* ¤Þ¤º¡¢¥Æ¥­¥¹¥ÈÇطʤòÀßÄê */
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1906 if (back != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1907 str = back; str += ".g00";
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1908 int rc, gc, bc, ac, flag;
0
223b71206888 Initial import
thib
parents:
diff changeset
1909 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1910 sprintf(key, "#WINDOW.%03d.ATTR", window_no);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1911 if (config->GetParam(key, 5, &rc, &gc, &bc, &ac, &flag) == -1) {
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1912 config->GetParam("#WINDOW_ATTR", 5, &rc, &gc, &bc, &ac, &flag);
0
223b71206888 Initial import
thib
parents:
diff changeset
1913 }
223b71206888 Initial import
thib
parents:
diff changeset
1914 Surface* back_s = pic.Root().NewSurface(str.c_str());
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1915 if (back_s != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1916 Rect rect(*back_s);
223b71206888 Initial import
thib
parents:
diff changeset
1917 Surface* s = pic.Root().NewSurface(rect.width(), rect.height(), ALPHA_MASK);
223b71206888 Initial import
thib
parents:
diff changeset
1918 DSurfaceMove(back_s, rect, s, rect);
223b71206888 Initial import
thib
parents:
diff changeset
1919 DSurfaceFillA(s, rect, rc, gc, bc, ac); // Æ©ÌÀÅÙÀßÄê
223b71206888 Initial import
thib
parents:
diff changeset
1920 pic.SetSurface(s, 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
1921 pic.SetSurfaceFreeFlag(1);
223b71206888 Initial import
thib
parents:
diff changeset
1922 if (flag == 0) wid->Pic()->SetSurfaceAttribute(PicBase::BLIT_MULTIPLY);
223b71206888 Initial import
thib
parents:
diff changeset
1923 pic.Root().DeleteSurface(back_s);
223b71206888 Initial import
thib
parents:
diff changeset
1924 }
223b71206888 Initial import
thib
parents:
diff changeset
1925 }
223b71206888 Initial import
thib
parents:
diff changeset
1926 /* ¤½¤ÎÁ°¤ËÏȾþ¤ê¤òÀßÄê */
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1927 if (name != NULL) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1928 str = name; str += ".g00";
223b71206888 Initial import
thib
parents:
diff changeset
1929 Surface* s = pic.Root().NewSurface(str.c_str());
223b71206888 Initial import
thib
parents:
diff changeset
1930 if (s) {
223b71206888 Initial import
thib
parents:
diff changeset
1931 Rect rect(*s);
223b71206888 Initial import
thib
parents:
diff changeset
1932 pic.Root().DeleteSurface(s);
223b71206888 Initial import
thib
parents:
diff changeset
1933 PicBase* p = pic.create_leaf(Rect(0, 0, rect.width(), rect.height()),0);
223b71206888 Initial import
thib
parents:
diff changeset
1934 p->SetSurface(str.c_str(), 0, 0);
223b71206888 Initial import
thib
parents:
diff changeset
1935 p->ZMove(ZMOVE_BOTTOM);
223b71206888 Initial import
thib
parents:
diff changeset
1936 p->show();
223b71206888 Initial import
thib
parents:
diff changeset
1937 }
223b71206888 Initial import
thib
parents:
diff changeset
1938 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1939 if (btn == NULL) return;
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1940 if (use_btn == NULL) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1941 // ¥Ü¥¿¥ó¤ÎºîÀ®
223b71206888 Initial import
thib
parents:
diff changeset
1942 // »ÈÍѤ¹¤ë¥Ü¥¿¥ó¤Ë¤Ä¤¤¤Æ¤Ï¡¢É¬Íפ˱þ¤¸¤Æ show() ¤¹¤ë¤³¤È
223b71206888 Initial import
thib
parents:
diff changeset
1943
223b71206888 Initial import
thib
parents:
diff changeset
1944 /* ¥Ü¥¿¥ó¤Î°ÌÃÖ¾ðÊó¤òµá¤á¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
1945 str = btn; str += ".g00";
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1946 ARCINFO* info = FileSearcher::GetInstance()->Find(FileSearcher::PDT, str.c_str(), "g00");
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1947 if (info == NULL) return; // cannot find file
0
223b71206888 Initial import
thib
parents:
diff changeset
1948 const char* data = info->Read();
223b71206888 Initial import
thib
parents:
diff changeset
1949 /* g00 ¥Õ¥¡¥¤¥ë¤Î¥Ø¥Ã¥ÀÉôʬ¤Ë°ÌÃÖ¾ðÊó¤ÏÆþ¤Ã¤Æ¤¤¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
1950 /* ¸ºß¤·¤Ê¤±¤ì¤Ð¥Ü¥¿¥ó²èÁü¤Ç¤Ï¤Ê¤¤ */
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
1951 if (data == NULL || *data != 2) {
0
223b71206888 Initial import
thib
parents:
diff changeset
1952 delete info;
223b71206888 Initial import
thib
parents:
diff changeset
1953 return;
223b71206888 Initial import
thib
parents:
diff changeset
1954 }
223b71206888 Initial import
thib
parents:
diff changeset
1955 int index_count = read_little_endian_int(data+5); // 0x70 == 112 ( 8 ¸Ä¤º¤Ä¥°¥ë¡¼¥×¤Ê¤Î¤Ç¡¢14¸Ä¤Î¥Ü¥¿¥ó ) ¤¬É¸½à
223b71206888 Initial import
thib
parents:
diff changeset
1956 int i;
223b71206888 Initial import
thib
parents:
diff changeset
1957 for (i=0; i<BTNCNT; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
1958 if (!use_btn[i]) continue;
223b71206888 Initial import
thib
parents:
diff changeset
1959 if (btnpos[i]*8 >= index_count) {
223b71206888 Initial import
thib
parents:
diff changeset
1960 continue; // ¥Ü¥¿¥ó¤¬Â¸ºß¤·¤Ê¤¤
223b71206888 Initial import
thib
parents:
diff changeset
1961 }
223b71206888 Initial import
thib
parents:
diff changeset
1962 int x, y, w, h;
223b71206888 Initial import
thib
parents:
diff changeset
1963 sprintf(key, "#WAKU.%03d.000.%s_BOX", waku_no, btnname[i]);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1964 if (config->GetParam(key, 5, 0, &x, &y, &w, &h) == -1) continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
1965 int sx, sy, sdx, sdy, cnt;
223b71206888 Initial import
thib
parents:
diff changeset
1966 const char* d = data + 9 + btnpos[i]*24*8;
223b71206888 Initial import
thib
parents:
diff changeset
1967 sx = read_little_endian_int(d);
223b71206888 Initial import
thib
parents:
diff changeset
1968 sy = read_little_endian_int(d+4);
223b71206888 Initial import
thib
parents:
diff changeset
1969 sdx = read_little_endian_int(d+24) - sx;
223b71206888 Initial import
thib
parents:
diff changeset
1970 sdy = read_little_endian_int(d+24 + 4) - sy;
223b71206888 Initial import
thib
parents:
diff changeset
1971 cnt = 2;
223b71206888 Initial import
thib
parents:
diff changeset
1972 if (sx+sdx*2 == read_little_endian_int(d+2*24) && sy+sdy*2 == read_little_endian_int(d+2*24+4)) cnt = 3;
223b71206888 Initial import
thib
parents:
diff changeset
1973 WidButton* wid = new WidButton(event, &pic, str.c_str(), sx, sy, sdx, sdy, cnt, Rect(x, y, x+w, y+h), 1);
223b71206888 Initial import
thib
parents:
diff changeset
1974 if (btnpress[i]) { wid->press_func = btnpress[i]; wid->press_pointer = callback;}
223b71206888 Initial import
thib
parents:
diff changeset
1975 if (btndrag[i]) { wid->drag_func = btndrag[i]; wid->drag_pointer = callback;}
223b71206888 Initial import
thib
parents:
diff changeset
1976 }
223b71206888 Initial import
thib
parents:
diff changeset
1977 delete info;
223b71206888 Initial import
thib
parents:
diff changeset
1978 }
223b71206888 Initial import
thib
parents:
diff changeset
1979
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1980 TextWindow::TextWindow(PicContainer& parent, Event::Container& event, int win_no, void* callback) :
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1981 wid(0), name_visible(true),name(0),name_container(0), face(0)
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1982 {
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1983 AyuSysConfig *config = AyuSysConfig::GetInstance();
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1984 int i;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1985 for (i=0; i<8; i++)
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1986 face_pics[i]=0;
0
223b71206888 Initial import
thib
parents:
diff changeset
1987 char key[1024];
223b71206888 Initial import
thib
parents:
diff changeset
1988 bool use_btn[BTNCNT];
223b71206888 Initial import
thib
parents:
diff changeset
1989 int size, rep1, rep2, cntw, cnth, mposx, mposy, posd, posx, posy, minx, miny, waku_no, ruby;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1990 sprintf(key, "#WINDOW.%03d.MOJI_SIZE", win_no); if (config->GetParam(key, 1, &size) == -1) return;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1991 sprintf(key, "#WINDOW.%03d.MOJI_REP", win_no); if (config->GetParam(key, 2, &rep1, &rep2) == -1) return;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1992 sprintf(key, "#WINDOW.%03d.MOJI_CNT", win_no); if (config->GetParam(key, 2, &cntw, &cnth) == -1) return;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1993 sprintf(key, "#WINDOW.%03d.POS", win_no); if (config->GetParam(key, 3, &posd, &posx, &posy) == -1) return;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1994 sprintf(key, "#WINDOW.%03d.MOJI_POS", win_no); if (config->GetParam(key, 4, &mposy, NULL, &mposx, NULL) == -1) return;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1995 sprintf(key, "#WINDOW.%03d.MOJI_MIN", win_no); if (config->GetParam(key, 2, &minx, &miny) == -1) return;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1996 sprintf(key, "#WINDOW.%03d.WAKU_SETNO", win_no);if (config->GetParam(key, 1, &waku_no) == -1) return;
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
1997 sprintf(key, "#WINDOW.%03d.LUBY_SIZE", win_no); if (config->GetParam(key, 1, &ruby) == -1) return;
0
223b71206888 Initial import
thib
parents:
diff changeset
1998
223b71206888 Initial import
thib
parents:
diff changeset
1999 /* ¥Æ¥­¥¹¥È¥¦¥£¥¸¥Ã¥È¡§²èÌ̤ᦲ¼°ìÇդޤǻÈÍÑ */
223b71206888 Initial import
thib
parents:
diff changeset
2000 /* posd == 2 ¤Ê¤é²èÌ̲¼¤Ë¤Ò¤Ã¤Ä¤¯¤è¤¦¤ËÇÛÃÖ */
223b71206888 Initial import
thib
parents:
diff changeset
2001 Rect r(0,0);
223b71206888 Initial import
thib
parents:
diff changeset
2002 if (posd == 2) {
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2003 r = WakuSize(parent, waku_no);
0
223b71206888 Initial import
thib
parents:
diff changeset
2004 r = Rect(0, parent.Height()-r.height(), r.width(), parent.Height());
223b71206888 Initial import
thib
parents:
diff changeset
2005 posx = 0;
223b71206888 Initial import
thib
parents:
diff changeset
2006 posy = parent.Height()-r.height();
223b71206888 Initial import
thib
parents:
diff changeset
2007 } else /* posd == 0 ? */
223b71206888 Initial import
thib
parents:
diff changeset
2008 r = Rect(posx, posy, parent.Width(), parent.Height());
223b71206888 Initial import
thib
parents:
diff changeset
2009
223b71206888 Initial import
thib
parents:
diff changeset
2010 /* ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦¤ÎºîÀ® */
223b71206888 Initial import
thib
parents:
diff changeset
2011 int w = size*cntw; int h = (size+ruby+2)*cnth;
223b71206888 Initial import
thib
parents:
diff changeset
2012 wid = new WidText(event, &parent, r, Rect(mposx, mposy, mposx+w, mposy+h), size);
223b71206888 Initial import
thib
parents:
diff changeset
2013 wid->stream.kanji_type = TextStream::sjis;
223b71206888 Initial import
thib
parents:
diff changeset
2014 /* ´é¥¦¥£¥ó¥É¥¦¤ÎºîÀ® */
223b71206888 Initial import
thib
parents:
diff changeset
2015 for (i=0; i<8; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
2016 int x,y;
223b71206888 Initial import
thib
parents:
diff changeset
2017 sprintf(key, "#WINDOW.%03d.FACE.%03d", win_no, i);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2018 if (config->GetParam(key, 2, &x, &y) == -1) continue;
0
223b71206888 Initial import
thib
parents:
diff changeset
2019 /* ´é¥¦¥£¥ó¥É¥¦¤òºîÀ®¤¹¤ë */
223b71206888 Initial import
thib
parents:
diff changeset
2020 if (x >= 0 && y >= 0) {
223b71206888 Initial import
thib
parents:
diff changeset
2021 face_pics[i] = wid->PicNode()->create_leaf(Rect(x,y), PicBase::FIT_SURFACE);
223b71206888 Initial import
thib
parents:
diff changeset
2022 } else {
223b71206888 Initial import
thib
parents:
diff changeset
2023 face_pics[i] = parent.create_leaf(Rect(x+posx,y+posy), PicBase::FIT_SURFACE);
223b71206888 Initial import
thib
parents:
diff changeset
2024 }
223b71206888 Initial import
thib
parents:
diff changeset
2025 face_pics[i]->show();
223b71206888 Initial import
thib
parents:
diff changeset
2026 }
223b71206888 Initial import
thib
parents:
diff changeset
2027 face = face_pics[0];
223b71206888 Initial import
thib
parents:
diff changeset
2028 // ¥Ü¥¿¥ó¤ÎÀßÄê
223b71206888 Initial import
thib
parents:
diff changeset
2029 for (i=0; i<BTNCNT; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
2030 int num;
223b71206888 Initial import
thib
parents:
diff changeset
2031 sprintf(key, "#WINDOW.%03d.%s_USE", win_no, btnname[i]);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2032 config->GetParam(key, 1, &num);
0
223b71206888 Initial import
thib
parents:
diff changeset
2033 use_btn[i] = (num==0) ? false : true;
223b71206888 Initial import
thib
parents:
diff changeset
2034 }
223b71206888 Initial import
thib
parents:
diff changeset
2035 // make name window
223b71206888 Initial import
thib
parents:
diff changeset
2036 int shadow, name_mod, name_size, name_min, name_center, name_posx, name_posy, name_mposx, name_mposy;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2037 sprintf(key, "#WINDOW.%03d.MOJI_SHADOW", win_no); config->GetParam(key, 1, &shadow);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2038 sprintf(key, "#WINDOW.%03d.NAME_MOD", win_no); config->GetParam(key, 1, &name_mod);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2039 sprintf(key, "#WINDOW.%03d.NAME_MOJI_SIZE", win_no); config->GetParam(key, 1, &name_size);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2040 sprintf(key, "#WINDOW.%03d.NAME_MOJI_MIN", win_no); config->GetParam(key, 1, &name_min);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2041 sprintf(key, "#WINDOW.%03d.NAME_MOJI_POS", win_no); config->GetParam(key, 2, &name_mposx, &name_mposy);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2042 sprintf(key, "#WINDOW.%03d.NAME_CENTERING", win_no); config->GetParam(key, 1, &name_center);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2043 sprintf(key, "#WINDOW.%03d.NAME_POS", win_no); config->GetParam(key, 2, &name_posx, &name_posy);
0
223b71206888 Initial import
thib
parents:
diff changeset
2044 // if name_mode==0 name is in the text window
223b71206888 Initial import
thib
parents:
diff changeset
2045 // if name_mode == 1 open name window
223b71206888 Initial import
thib
parents:
diff changeset
2046 // if name_mode == 2 name is not used
223b71206888 Initial import
thib
parents:
diff changeset
2047 if (name_mod) {
223b71206888 Initial import
thib
parents:
diff changeset
2048 if (name_mod == 1) {
223b71206888 Initial import
thib
parents:
diff changeset
2049 int w = name_size*name_min; int h = name_size;
223b71206888 Initial import
thib
parents:
diff changeset
2050 int name_waku;
223b71206888 Initial import
thib
parents:
diff changeset
2051 sprintf(key, "#WINDOW.%03d.NAME_WAKU_SETNO", win_no);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2052 if (config->GetParam(key, 1, &name_waku) != -1 && name_waku != -1) {
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2053 Rect waku_r = WakuSize(parent, name_waku);
0
223b71206888 Initial import
thib
parents:
diff changeset
2054 waku_r.rmove(r.lx, r.ty); // ¥Æ¥­¥¹¥È¥¦¥£¥ó¥É¥¦°ÌÃÖ¤ËÆ°¤«¤¹
223b71206888 Initial import
thib
parents:
diff changeset
2055 waku_r.rmove(name_posx, name_posy-waku_r.height()); // NAME_POS ¤Ø°ÌÃÖÊäÀµ
223b71206888 Initial import
thib
parents:
diff changeset
2056 name_container = parent.create_node(waku_r, 0);
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2057 MakeWaku(*name_container, event, name_waku, win_no, 0, callback);
0
223b71206888 Initial import
thib
parents:
diff changeset
2058 Rect name_r(0,0,w,h);
223b71206888 Initial import
thib
parents:
diff changeset
2059 name_r.rmove(name_mposx, name_mposy);
223b71206888 Initial import
thib
parents:
diff changeset
2060 name = new WidLabel(name_container, name_r, true, 0, name_size);
223b71206888 Initial import
thib
parents:
diff changeset
2061 name->show();
223b71206888 Initial import
thib
parents:
diff changeset
2062 } else { // ̾Á°ÀìÍÑÏȤʤ·
223b71206888 Initial import
thib
parents:
diff changeset
2063 Rect name_r(0, 0, w, h);
223b71206888 Initial import
thib
parents:
diff changeset
2064 name_r.rmove(r.lx, r.ty);
223b71206888 Initial import
thib
parents:
diff changeset
2065 name_r.rmove(name_posx, name_posy-name_size);
223b71206888 Initial import
thib
parents:
diff changeset
2066 name_container = parent.create_node(name_r, 0);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
2067 name = new WidLabel(name_container, Rect(0, 0, w, h), true, 0, name_size);
0
223b71206888 Initial import
thib
parents:
diff changeset
2068 name->show();
223b71206888 Initial import
thib
parents:
diff changeset
2069 name_container->show();
223b71206888 Initial import
thib
parents:
diff changeset
2070 }
223b71206888 Initial import
thib
parents:
diff changeset
2071 } else { // name_mod == 2 or 3
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
2072 name_container = parent.create_node( Rect(0, 0, 1, 1), 0);
0
223b71206888 Initial import
thib
parents:
diff changeset
2073 }
223b71206888 Initial import
thib
parents:
diff changeset
2074 }
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2075 MakeWaku(*wid->PicNode(), event,waku_no, win_no, use_btn, callback);
0
223b71206888 Initial import
thib
parents:
diff changeset
2076 }
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
2077
0
223b71206888 Initial import
thib
parents:
diff changeset
2078 void TextImpl::InitWindow(void) {
43
01aa5ddf7dc8 A lot of very minor improvements (deleted some unused variables, and other things like that...)
thib
parents: 40
diff changeset
2079 int i;
0
223b71206888 Initial import
thib
parents:
diff changeset
2080 int w;
223b71206888 Initial import
thib
parents:
diff changeset
2081 std::string str;
223b71206888 Initial import
thib
parents:
diff changeset
2082
223b71206888 Initial import
thib
parents:
diff changeset
2083 for (w=0; w<32; w++) {
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2084 widgets[w] = new TextWindow(parent, event, w, (void*)this);
0
223b71206888 Initial import
thib
parents:
diff changeset
2085 if (widgets[w]->wid == 0) {
223b71206888 Initial import
thib
parents:
diff changeset
2086 delete widgets[w];
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
2087 widgets[w] = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
2088 }
223b71206888 Initial import
thib
parents:
diff changeset
2089 }
223b71206888 Initial import
thib
parents:
diff changeset
2090 SetCursor(0);
223b71206888 Initial import
thib
parents:
diff changeset
2091 for (i=0; i<26; i++) {
223b71206888 Initial import
thib
parents:
diff changeset
2092 char buf[1024];
223b71206888 Initial import
thib
parents:
diff changeset
2093 sprintf(buf, "#NAME.%c", i+'A');
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2094 const char* s = config->GetParaStr(buf);
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
2095 if (s != NULL) replace_name[i] = s;
0
223b71206888 Initial import
thib
parents:
diff changeset
2096 }
223b71206888 Initial import
thib
parents:
diff changeset
2097 // replace_name2 : ½é´üÀßÄê
223b71206888 Initial import
thib
parents:
diff changeset
2098 // ½í¡¢½©À¸¡¢½í (CLANNAD)
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
2099 char name_nagisa[3] = {'\x8f', '\x8d', '\0'};
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
2100 char name_akio[5] = {'\x8f', '\x48', '\x90', '\xb6', '\0'};
0
223b71206888 Initial import
thib
parents:
diff changeset
2101 replace_name2[0] = name_nagisa;
223b71206888 Initial import
thib
parents:
diff changeset
2102 replace_name2[1] = name_akio;
223b71206888 Initial import
thib
parents:
diff changeset
2103 replace_name2[2] = name_nagisa;
52
15a18fbe6f21 * Known bugs added to the README
thib
parents: 50
diff changeset
2104 text = NULL;
0
223b71206888 Initial import
thib
parents:
diff changeset
2105 /* ¥Æ¥­¥¹¥È®ÅÙ¤ÎÀßÄê */
223b71206888 Initial import
thib
parents:
diff changeset
2106 int speed, mod, wait, auto_mod;
53
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2107 config->GetParam("#INIT_MESSAGE_SPEED", 1, &speed);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2108 config->GetParam("#INIT_MESSAGE_SPEED_MOD", 1, &mod);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2109 config->GetParam("#MESSAGE_KEY_WAIT_USE", 1, &auto_mod);
ddbcbd000206 * MuSys, AyuSysConfig, FileSearcher (former FILESEARCHER) and KeyHolder (former KEYHOLDER) are now singletons
thib
parents: 52
diff changeset
2110 config->GetParam("#MESSAGE_KEY_WAIT_TIME", 1, &wait);
0
223b71206888 Initial import
thib
parents:
diff changeset
2111 if (mod) speed = -1;
223b71206888 Initial import
thib
parents:
diff changeset
2112 if (!auto_mod) wait = -1;
223b71206888 Initial import
thib
parents:
diff changeset
2113 SetTextSpeed(speed);
223b71206888 Initial import
thib
parents:
diff changeset
2114 SetTextWait(wait);
223b71206888 Initial import
thib
parents:
diff changeset
2115 return;
223b71206888 Initial import
thib
parents:
diff changeset
2116 }