aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/gui_eob.h
blob: e4daff6ada123183a6e638e177da2aae2fb55858 (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
/* 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.
 *
 */

#if defined(ENABLE_EOB) || defined(ENABLE_LOL)

#ifndef KYRA_GUI_EOB_H
#define KYRA_GUI_EOB_H

#include "kyra/gui.h"

#ifdef ENABLE_EOB

namespace Kyra {

struct EoBRect16 {
	int16 x1;
	int16 y1;
	uint16 x2;
	uint16 y2;
};

class DarkMoonEngine;
class Screen_EoB;

class GUI_EoB : public GUI {
	friend class EoBCoreEngine;
	friend class CharacterGenerator;
public:
	GUI_EoB(EoBCoreEngine *vm);
	virtual ~GUI_EoB();

	void initStaticData() {}

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

	// Non button based menu handling (main menu, character generation)
	void simpleMenu_setup(int sd, int maxItem, const char *const *strings, int32 menuItemsMask, int unk, int lineSpacing);
	int simpleMenu_process(int sd, const char *const *strings, void *b, int32 menuItemsMask, int unk);

	// Button based menus (camp menu, load menu)
	void runCampMenu();
	bool runLoadMenu(int x, int y);

	bool confirmDialogue2(int dim, int id, int deflt);
	void messageDialogue(int dim, int id, int buttonTextCol);
	void messageDialogue2(int dim, int id, int buttonTextCol);

	void updateBoxFrameHighLight(int box);

	int getTextInput(char *dest, int x, int y, int destMaxLen, int textColor1, int textColor2, int cursorColor);

	// Transfer party
	void transferWaitBox();
	Common::String transferTargetMenu(Common::Array<Common::String> &targets);
	bool transferFileMenu(Common::String &targetName, Common::String &selection);

	// utilities for thumbnail creation
	void createScreenThumbnail(Graphics::Surface &dst);

private:
	int simpleMenu_getMenuItem(int index, int32 menuItemsMask, int itemOffset);
	void simpleMenu_flashSelection(const char *str, int x, int y, int color1, int color2, int color3);
	void simpleMenu_initMenuItemsMask(int menuId, int maxItem, int32 menuItemsMask, int unk);

	bool runSaveMenu(int x, int y);
	int selectSaveSlotDialogue(int x, int y, int id);
	void runMemorizePrayMenu(int charIndex, int spellType);
	void scribeScrollDialogue();
	bool restParty();

	bool confirmDialogue(int id);
	int selectCharacterDialogue(int id);
	void displayTextBox(int id);

	Button *initMenu(int id);
	void drawMenuButton(Button *b, bool clicked, bool highlight, bool noFill);
	void drawMenuButtonBox(int x, int y, int w, int h, bool clicked, bool noFill);
	void drawTextBox(int dim, int id);
	void drawSaveSlotButton(int slot, int redrawBox, int textCol);
	void memorizePrayMenuPrintString(int spellId, int bookPageIndex, int spellType, bool noFill, bool highLight);
	void updateOptionsStrings();
	const char *getMenuString(int id);

	Button *linkButton(Button *list, Button *newbt);
	void releaseButtons(Button *list);

	void setupSaveMenuSlots();
	int getHighlightSlot();
	void sortSaveSlots();

	void restParty_updateRestTime(int hours, bool init);

	char **_menuStringsPrefsTemp;
	char **_saveSlotStringsTemp;
	int16 *_saveSlotIdTemp;
	int _savegameOffset;
	int16 _saveSlotX;
	int16 _saveSlotY;

	EoBCoreEngine *_vm;
	Screen_EoB *_screen;

	bool _pressFlag;

	Button *_specialProcessButton;
	Button *_backupButtonList;
	uint16 _flagsMouseLeft;
	uint16 _flagsMouseRight;
	uint16 _flagsModifier;
	uint16 _progress;
	uint16 _prcButtonUnk3;
	uint16 _cflag;

	int _menuLineSpacing;
	int _menuLastInFlags;

	uint8 _numPages;
	uint8 _numVisPages;
	int8 *_numAssignedSpellsOfType;
	uint32 _clericSpellAvltyFlags;
	uint32 _paladinSpellAvltyFlags;
	bool _needRest;

	int _menuCur;
	int _menuNumItems;
	bool _charSelectRedraw;

	int _updateBoxIndex;
	int _updateBoxColorIndex;
	const uint8 *_highLightColorTable;
	uint32 _highLightBoxTimer;

	static const EoBRect16 _highlightFrames[];
	static const uint8 _highlightColorTableVGA[];
	static const uint8 _highlightColorTableEGA[];
};

} // End of namespace Kyra

#endif // ENABLE_EOB

#endif

#endif // ENABLE_EOB || ENABLE_LOL