1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef QUEEN_JOURNAL_H
24 #define QUEEN_JOURNAL_H
25 
26 #include "common/util.h"
27 
28 class OSystem;
29 
30 namespace Queen {
31 
32 class QueenEngine;
33 
34 class Journal {
35 public:
36 
37 	Journal(QueenEngine *vm);
38 	void use();
39 
40 	enum {
41 		JOURNAL_BANK   = 8,
42 		JOURNAL_FRAMES = 40
43 	};
44 
45 	enum {
46 		ZN_REVIEW_ENTRY = 1,
47 		ZN_MAKE_ENTRY   = 2,
48 		ZN_YES          = ZN_MAKE_ENTRY,
49 		ZN_CLOSE        = 3,
50 		ZN_NO           = ZN_CLOSE,
51 		ZN_GIVEUP       = 4,
52 		ZN_TEXT_SPEED   = 5,
53 		ZN_SFX_TOGGLE   = 6,
54 		ZN_MUSIC_VOLUME = 7,
55 		ZN_DESC_1       = 8,
56 		ZN_DESC_2       = 9,
57 		ZN_DESC_3       = 10,
58 		ZN_DESC_4       = 11,
59 		ZN_DESC_5       = 12,
60 		ZN_DESC_6       = 13,
61 		ZN_DESC_7       = 14,
62 		ZN_DESC_8       = 15,
63 		ZN_DESC_9       = 16,
64 		ZN_DESC_10      = 17,
65 		ZN_PAGE_A       = 18,
66 		ZN_PAGE_B       = 19,
67 		ZN_PAGE_C       = 20,
68 		ZN_PAGE_D       = 21,
69 		ZN_PAGE_E       = 22,
70 		ZN_PAGE_F       = 23,
71 		ZN_PAGE_G       = 24,
72 		ZN_PAGE_H       = 25,
73 		ZN_PAGE_I       = 26,
74 		ZN_PAGE_J       = 27,
75 		ZN_INFO_BOX     = 28,
76 		ZN_MUSIC_TOGGLE = 29,
77 		ZN_VOICE_TOGGLE = 30,
78 		ZN_TEXT_TOGGLE  = 31
79 	};
80 
81 	enum {
82 		BOB_LEFT_RECT_1   =  1,
83 		BOB_LEFT_RECT_2   =  2,
84 		BOB_LEFT_RECT_3   =  3,
85 		BOB_LEFT_RECT_4   =  4,
86 		BOB_TALK_SPEED    =  5,
87 		BOB_SFX_TOGGLE    =  6,
88 		BOB_MUSIC_VOLUME  =  7,
89 		BOB_SAVE_DESC     =  8,
90 		BOB_SAVE_PAGE     =  9,
91 		BOB_SPEECH_TOGGLE = 10,
92 		BOB_TEXT_TOGGLE   = 11,
93 		BOB_MUSIC_TOGGLE  = 12,
94 		BOB_INFO_BOX      = 13
95 	};
96 
97 	enum {
98 		FRAME_BLUE_1    =  1,
99 		FRAME_BLUE_2    =  2,
100 		FRAME_ORANGE    =  3,
101 		FRAME_GREY      =  5,
102 		FRAME_CHECK_BOX = 16,
103 		FRAME_BLUE_PIN  = 18,
104 		FRAME_GREEN_PIN = 19,
105 		FRAME_INFO_BOX  = 20
106 	};
107 
108 	enum {
109 		TXT_CLOSE        = 30,
110 		TXT_GIVE_UP      = 31,
111 		TXT_MAKE_ENTRY   = 32,
112 		TXT_REVIEW_ENTRY = 33,
113 		TXT_YES          = 34,
114 		TXT_NO           = 35
115 	};
116 
117 	enum {
118 		NUM_SAVES_PER_PAGE = 10,
119 		MAX_PANEL_TEXTS    = 8,
120 		MAX_ZONES          = 31
121 	};
122 
123 	enum PanelMode {
124 		PM_NORMAL,
125 		PM_INFO_BOX,
126 		PM_YES_NO
127 	};
128 
129 	enum QuitMode {
130 		QM_LOOP,
131 		QM_RESTORE,
132 		QM_CONTINUE
133 	};
134 
135 
136 private:
137 
138 	void continueGame();
139 
140 	void setup();
141 	void redraw();
142 	void update();
143 
144 	void showBob(int bobNum, int16 x, int16 y, int frameNum);
145 	void hideBob(int bobNum);
146 
147 	void drawSaveDescriptions();
148 	void drawSaveSlot();
149 
150 	void enterYesNoPanelMode(int16 prevZoneNum, int titleNum);
151 	void exitYesNoPanelMode();
152 	void enterInfoPanelMode();
153 	void exitInfoPanelMode();
154 
155 	void handleMouseWheel(int inc);
156 	void handleMouseDown(int x, int y);
157 	void handleKeyDown(uint16 ascii, int keycode);
158 
159 	void drawPanelText(int y, const char *text);
160 	void drawCheckBox(bool active, int bobNum, int16 x, int16 y, int frameNum);
161 	void drawSlideBar(int value, int maxValue, int bobNum, int16 y, int frameNum);
162 	void drawPanel(const int *frames, const int *titles, int n);
163 	void drawNormalPanel();
164 	void drawYesNoPanel(int titleNum);
165 	void drawConfigPanel();
166 	void drawInfoPanel();
167 
168 	void initTextField(const char *desc);
169 	void updateTextField(uint16 ascii, int keycode);
170 	void closeTextField();
171 
172 	struct TextField {
173 		bool enabled;
174 		int posCursor;
175 		uint textCharsCount;
176 		char text[32];
177 		int x, y;
178 		int w, h;
179 	};
180 
181 	struct Zone {
182 		int num;
183 		int16 x1, y1, x2, y2;
184 	};
185 
186 	PanelMode _panelMode;
187 	QuitMode _quitMode;
188 
189 	int _currentSavePage;
190 	int _currentSaveSlot;
191 
192 	int _prevJoeX, _prevJoeY;
193 
194 	int _panelTextCount;
195 	int _panelTextY[MAX_PANEL_TEXTS];
196 	TextField _textField;
197 	uint16 _prevZoneNum;
198 	char _saveDescriptions[100][32];
199 
200 	OSystem *_system;
201 	QueenEngine *_vm;
202 
203 	static const Zone _zones[MAX_ZONES];
204 };
205 
206 } // End of namespace Queen
207 
208 #endif
209