aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/gui_lok.h
blob: 16b7ef918329382f8f261234712e88703416a115 (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
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * 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 KYRA_GUI_LOK_H
#define KYRA_GUI_LOK_H

#include "kyra/gui.h"

namespace Kyra {

#define GUI_V1_BUTTON(button, a, b, c, d, e, f, g, h, i, j, k) \
	do { \
		button.nextButton = 0; \
		button.index = a; \
		button.unk6 = button.unk8 = 0; \
		button.data0Val1 = b; \
		button.data1Val1 = c; \
		button.data2Val1 = d; \
		button.data0ShapePtr = button.data1ShapePtr = button.data2ShapePtr = 0; \
		button.flags = e; \
		button.dimTableIndex = f; \
		button.x = g; \
		button.y = h; \
		button.width = i; \
		button.height = j; \
		button.flags2 = k; \
		button.mouseWheel = 0; \
	} while (0)

#define GUI_V1_MENU(menu, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) \
	do { \
		menu.x = a; \
		menu.y = b; \
		menu.width = c; \
		menu.height = d; \
		menu.bkgdColor = e; \
		menu.color1 = f; \
		menu.color2 = g; \
		menu.menuNameString = h; \
		menu.textColor = i; \
		menu.titleX = j; \
		menu.titleY = k; \
		menu.highlightedItem = l; \
		menu.numberOfItems = m; \
		menu.scrollUpButtonX = n; \
		menu.scrollUpButtonY = o; \
		menu.scrollDownButtonX = p; \
		menu.scrollDownButtonY = q; \
	} while (0)

#define GUI_V1_MENU_ITEM(item, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) \
	do { \
		item.enabled = a; \
		item.itemString = d; \
		item.x = e; \
		item.y = g; \
		item.width = h; \
		item.height = i; \
		item.textColor = j; \
		item.highlightColor = k; \
		item.titleX = l; \
		item.bkgdColor = n; \
		item.color1 = o; \
		item.color2 = p; \
		item.saveSlot = q; \
		item.labelString = r; \
		item.labelX = s; \
		item.labelY = t; \
		item.unk1F = v; \
	} while (0)

class KyraEngine_LoK;

class GUI_LoK : public GUI {
	friend class KyraEngine_LoK;
public:
	GUI_LoK(KyraEngine_LoK *vm, Screen_LoK *screen);
	~GUI_LoK();

	void processButton(Button *button);
	int processButtonList(Button *buttonList, uint16 inputFlags, int8 mouseWheel);

	int buttonMenuCallback(Button *caller);
private:
	void initStaticResource();

	Button _menuButtonData[6];
	Button _scrollUpButton;
	Button _scrollDownButton;
	Button *getButtonListData() { return _menuButtonData; }
	Button *getScrollUpButton() { return &_scrollUpButton; }
	Button *getScrollDownButton() { return &_scrollDownButton; }

	Menu *_menu;

	void setGUILabels();

	void setupSavegames(Menu &menu, int num);

	int resumeGame(Button *button);
	int loadGameMenu(Button *button);
	int saveGameMenu(Button *button);
	int gameControlsMenu(Button *button);
	int quitPlaying(Button *button);
	int quitConfirmYes(Button *button);
	int quitConfirmNo(Button *button);
	int loadGame(Button *button);
	int saveGame(Button *button);
	int savegameConfirm(Button *button);
	int cancelSubMenu(Button *button);
	int scrollUp(Button *button);
	int scrollDown(Button *button);
	int controlsChangeMusic(Button *button);
	int controlsChangeSounds(Button *button);
	int controlsChangeWalk(Button *button);
	int controlsChangeText(Button *button);
	int controlsChangeVoice(Button *button);
	int controlsApply(Button *button);

	bool quitConfirm(const char *str);
	void getInput();
	void updateSavegameString();
	void redrawTextfield();
	void fadePalette();
	void restorePalette();
	void setupControls(Menu &menu);

	uint8 defaultColor1() const { return 12; }
	uint8 defaultColor2() const { return 248; }

	const char *getMenuTitle(const Menu &menu) { return menu.menuNameString; }
	const char *getMenuItemTitle(const MenuItem &menuItem) { return menuItem.itemString; }
	const char *getMenuItemLabel(const MenuItem &menuItem) { return menuItem.labelString; }

	KyraEngine_LoK *_vm;
	Screen_LoK *_screen;

	uint32 _lastScreenUpdate;

	bool _menuRestoreScreen;
	uint8 _toplevelMenu;
	int _savegameOffset;
	char _savegameName[35];
	const char *_specialSavegameString;
	Common::KeyState _keyPressed;
	int8 _mouseWheel;

	Button::Callback _scrollUpFunctor;
	Button::Callback _scrollDownFunctor;
	Button::Callback getScrollUpButtonHandler() const { return _scrollUpFunctor; }
	Button::Callback getScrollDownButtonHandler() const { return _scrollDownFunctor; }

	const char *_voiceTextString;
	const char *_textSpeedString;
	const char *_onString;
	const char *_offString;
	const char *_onCDString;
};

} // end of namespace Kyra

#endif