aboutsummaryrefslogtreecommitdiff
path: root/engines/queen/journal.h
blob: ab3e2a0ecd69e3bcd1076ef31f7b8e1b2144768c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/* ScummVM - Scumm Interpreter
 * Copyright (C) 2003-2006 The ScummVM project
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 * $URL$
 * $Id$
 *
 */

#ifndef QUEENJOURNAL_H
#define QUEENJOURNAL_H

#include "common/util.h"

class OSystem;

namespace Queen {

class QueenEngine;

class Journal {
public:

	Journal(QueenEngine *vm);
	void use();

	enum {
		JOURNAL_BANK   = 8,
		JOURNAL_FRAMES = 40
	};

	enum {
		ZN_REVIEW_ENTRY = 1,
		ZN_MAKE_ENTRY   = 2,
		ZN_YES          = ZN_MAKE_ENTRY,
		ZN_CLOSE        = 3,
		ZN_NO           = ZN_CLOSE,
		ZN_GIVEUP       = 4,
		ZN_TEXT_SPEED   = 5,
		ZN_SFX_TOGGLE   = 6,
		ZN_MUSIC_VOLUME = 7,
		ZN_DESC_1       = 8,
		ZN_DESC_2       = 9,
		ZN_DESC_3       = 10,
		ZN_DESC_4       = 11,
		ZN_DESC_5       = 12,
		ZN_DESC_6       = 13,
		ZN_DESC_7       = 14,
		ZN_DESC_8       = 15,
		ZN_DESC_9       = 16,
		ZN_DESC_10      = 17,
		ZN_PAGE_A       = 18,
		ZN_PAGE_B       = 19,
		ZN_PAGE_C       = 20,
		ZN_PAGE_D       = 21,
		ZN_PAGE_E       = 22,
		ZN_PAGE_F       = 23,
		ZN_PAGE_G       = 24,
		ZN_PAGE_H       = 25,
		ZN_PAGE_I       = 26,
		ZN_PAGE_J       = 27,
		ZN_INFO_BOX     = 28,
		ZN_MUSIC_TOGGLE = 29,
		ZN_VOICE_TOGGLE = 30,
		ZN_TEXT_TOGGLE  = 31
	};

	enum {
		BOB_LEFT_RECT_1   =  1,
		BOB_LEFT_RECT_2   =  2,
		BOB_LEFT_RECT_3   =  3,
		BOB_LEFT_RECT_4   =  4,
		BOB_TALK_SPEED    =  5,
		BOB_SFX_TOGGLE    =  6,
		BOB_MUSIC_VOLUME  =  7,
		BOB_SAVE_DESC     =  8,
		BOB_SAVE_PAGE     =  9,
		BOB_SPEECH_TOGGLE = 10,
		BOB_TEXT_TOGGLE   = 11,
		BOB_MUSIC_TOGGLE  = 12,
		BOB_INFO_BOX      = 13
	};

	enum {
		FRAME_BLUE_1    =  1,
		FRAME_BLUE_2    =  2,
		FRAME_ORANGE    =  3,
		FRAME_GREY      =  5,
		FRAME_CHECK_BOX = 16,
		FRAME_BLUE_PIN  = 18,
		FRAME_GREEN_PIN = 19,
		FRAME_INFO_BOX  = 20
	};

	enum {
		TXT_CLOSE        = 30,
		TXT_GIVE_UP      = 31,
		TXT_MAKE_ENTRY   = 32,
		TXT_REVIEW_ENTRY = 33,
		TXT_YES          = 34,
		TXT_NO           = 35
	};

	enum {
		NUM_SAVES_PER_PAGE = 10,
		MAX_PANEL_TEXTS    = 8,
		MAX_ZONES          = 31
	};

	enum PanelMode {
		PM_NORMAL,
		PM_INFO_BOX,
		PM_YES_NO
	};

	enum QuitMode {
		QM_LOOP,
		QM_RESTORE,
		QM_CONTINUE
	};


private:

	void continueGame();

	void setup();
	void redraw();
	void update();

	void showBob(int bobNum, int16 x, int16 y, int frameNum);
	void hideBob(int bobNum);

	void drawSaveDescriptions();
	void drawSaveSlot();

	void enterYesNoPanelMode(int16 prevZoneNum, int titleNum);
	void exitYesNoPanelMode();
	void enterInfoPanelMode();
	void exitInfoPanelMode();

	void handleMouseWheel(int inc);
	void handleMouseDown(int x, int y);
	void handleKeyDown(uint16 ascii, int keycode);

	void drawPanelText(int y, const char *text);
	void drawCheckBox(bool active, int bobNum, int16 x, int16 y, int frameNum);
	void drawSlideBar(int value, int maxValue, int bobNum, int16 y, int frameNum);
	void drawPanel(const int *frames, const int *titles, int n);
	void drawNormalPanel();
	void drawYesNoPanel(int titleNum);
	void drawConfigPanel();
	void drawInfoPanel();

	void initTextField(const char *desc);
	void updateTextField(uint16 ascii, int keycode);
	void closeTextField();

	struct TextField {
		bool enabled;
		int posCursor;
		uint textCharsCount;
		char text[32];
		int x, y;
		int w, h;
	};

	struct Zone {
		int num;
		int16 x1, y1, x2, y2;
	};

	PanelMode _panelMode;
	QuitMode _quitMode;

	int _currentSavePage;
	int _currentSaveSlot;

	int _prevJoeX, _prevJoeY;

	int _panelTextCount;
	int _panelTextY[MAX_PANEL_TEXTS];
	TextField _textField;
	uint16 _prevZoneNum;
	char _saveDescriptions[100][32];

	OSystem *_system;
	QueenEngine *_vm;

	static const Zone _zones[MAX_ZONES];
};

} // End of namespace Queen

#endif