aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/menu.h
blob: 4c30aeb3c6336d4299b099bf9976e0216d50eabb (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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/* 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.
 *
 */

#ifndef HDB_MENU_H
#define HDB_MENU_H

namespace HDB {

#define STARS_MONKEYSTONE_7			0xfe257d	// magic value in the config file for the unlocking of the Monkeystone secret #7
#define STARS_MONKEYSTONE_7_FAKE	0x11887e	// fake value that means it hasn't been unlocked
#define STARS_MONKEYSTONE_14		0x3341fe	// <same> for the Monkeystone #14
#define STARS_MONKEYSTONE_14_FAKE	0x1cefd0	// fake value that means it hasn't been unlocked
#define STARS_MONKEYSTONE_21		0x77ace3	// <same> for the Monkeystone #21
#define STARS_MONKEYSTONE_21_FAKE	0x3548fe	// fake value that means it hasn't been unlocked

#define	CONFIG_MUSICVOL		"music_volume"
#define	CONFIG_SOUNDVOL		"sound_volume"
#define	CONFIG_MSTONE7		"hdb_memory_heap"
#define	CONFIG_MSTONE14		"lua_stack_offset"
#define	CONFIG_MSTONE21		"fmod_mix_timer"
#define	CONFIG_SOUNDCACHE	"sound_cache_max"
#define	CONFIG_GFXCACHE		"gfx_cache_max"
#define	CONFIG_CHEAT		"hypercheat"

#define	CONFIG_KEY_UP		"keyup"
#define	CONFIG_KEY_DOWN		"keydown"
#define	CONFIG_KEY_LEFT		"keyleft"
#define	CONFIG_KEY_RIGHT	"keyright"
#define	CONFIG_KEY_USE		"keyuse"
#define	CONFIG_VOICES		"voices"

#define	TITLE_DELAY1		2				// time to wait before OOH OOH
#define	TITLE_DELAY2		0.5				// time to spend doing OOH OOH
#define	TITLE_DELAY3		1				// time to wait before ending title

#define centerPic(x)	(kScreenWidth / 2 - x->_width / 2)

enum {
	kStarRedX = 70,
	kStarRedY = 20,
	kStarGreenX = 70,
	kStarGreenY = 100,
	kStarBlueX = 70,
	kStarBlueY = 180,

	kMenuX = 48 * 8,
	kMenuY = 80,

	kMenuItemWidth = 88,
	kMenuItemHeight = 40,

	kMResumeY =	48 * 4,
	kMQuitY = 48 * 3,
	kMOptionsY = 48 * 2,
	kMLoadY = 48 * 1,
	kMControlsY = 270,

	kMenuExitY = kScreenHeight - 80,
	kMenuExitXLeft = 60,
	kMenuExitYTop = 48,
	kMenuVortSaveY = 220,
	kMenuVortSaveX = 76,

	kMRocketX = 18 * 8,
	kMRocketY = 48,
	kMRocketYBottom = 28 * 8,
	kMRocketEXHX = 6 * 8 - 4,
	kMRocketEXHX2 = 11 * 8 - 4,
	kMTitleY = 34 * 8,
	kOohOhhX = 256,
	kOohOhhY = 224,

	kNewGameX = 220,
	kNewGameX2 = kNewGameX + 50,

	kModePuzzleY = 130,
	kModeActionY = 220,

	kOptionsX = 8 * 26,
	kOptionsY = 8 * 10,

	kVortSaveX = 200 - 44,
	kVortSaveTextX = kVortSaveX + 40,
	kVortSaveY = 72,
	kSaveSlotX = 200,
	kSaveSlotY = 80,

	kQuitX = 0,
	kQuitY = 0,
	kQuitYesX1 = 30 * 8,
	kQuitYesX2 = 38 * 8 + 4,
	kQuitYesY1 = 50 * 8,
	kQuitYesY2 = 53 * 8 + 4,
	kQuitNoX1 = 41 * 8,
	kQuitNoX2 = 49 * 8 + 4,
	kQuitNoY1 = 50 * 8,
	kQuitNoY2 = 53 * 8 + 4,

	kControlX = 60,
	kControlY = 40,
	kControlUpX = 276 + kControlX,
	kControlUpY = 114 + kControlY,
	kControlDownX = 276 + kControlX,
	kControlDownY = 129 + kControlY,
	kControlLeftX = 396 + kControlX,
	kControlLeftY = 114 + kControlY,
	kControlRightX = 396 + kControlX,
	kControlRightY = 129 + kControlY,
	kControlUseX = 330 + kControlX,
	kControlUseY = 209 + kControlY,
	kControlWidth = 32,
	kControlHeight = 16,

	kAssignX = kControlX + 20 * 8,
	kAssignY = kControlY + 150,

	kBackoutX = 0,
	kBackoutY = kScreenHeight - 32,

	kWarpBackoutX = kBackoutX,
	kWarpBackoutY = kBackoutY,

	kWarpX = 214,
	kWarpY = 160,

	kScreenFade = 512,
	kNebulaCount = 7,
	kMaxStars = 10,

	kOptionSPC = 16,
	kOptionLineSPC = 32
};

struct Star {
	int x, y, speed, anim, delay;

	Star() : x(0), y(0), speed(0), anim(0), delay(0) {}
};

class Menu {
public:

	bool init();

	void readConfig();
	void writeConfig();

	bool startTitle();
	void drawTitle();
	void startMenu();
	void changeToMenu();	// Changing from Intro to Menu
	void drawMenu();
	void freeMenu();

	void processInput(int x, int y);	// this is where the items are clicked!
	void controlsInput(int x, int y);	// take mouse input and pass through to menu
	void controlsDraw();
	void drawNebula();
	void drawRocketAndSelections();		// draw the background stuff
	void drawSlider(int x, int y, int offset);
	void drawToggle(int x, int y, bool flag);
	void drawWarpScreen();
	void saveSong(SoundType song) {
		_resumeSong = song;
	}

	void fillSavegameSlots();

	void setMenuKey(int status) {
		_menuKey = status;
	}
	int getMenuKey() {
		return _menuKey;
	}

	Save _saveGames[kNumSaveSlots + 1];

	int _starWarp;
	int _titleCycle;
	uint32 _titleDelay;
	bool _titleActive;
	SoundType _resumeSong;	// the song that was playing before entering the Options screen

	Picture *_oohOohGfx;
	Picture *_titleScreen, *_titleLogo, *_hdbLogoScreen, *_menuBackoutGfx, *_controlButtonGfx, *_controlsGfx, *_menuBackspaceGfx;

	int _rocketY, _rocketYVel, _rocketEx;	// Rocket Vars
	Picture	*_rocketEx1, *_rocketEx2, *_rocketMain, *_rocketSecond;
	int	_rocketX;

	int	_nebulaX, _nebulaY, _nebulaYVel, _nebulaWhich;
	Picture *_nebulaGfx[kNebulaCount];

	Picture	*_newGfx, *_loadGfx, *_optionsGfx, *_quitGfx, *_resumeGfx, *_slotGfx;
	Picture	*_modePuzzleGfx, *_modeActionGfx, *_modeLoadGfx, *_modeSaveGfx, *_quitScreen;
	Tile *_vortexian[3];
	Picture	*_star[3], *_warpGfx;
	uint32 _quitTimer;
	Picture	*_starRedGfx[2], *_starGreenGfx[2], *_starBlueGfx[2], *_versionGfx;

	bool _menuActive, _optionsScrolling, _newgameActive, _sayHDB;
	int	_gamefilesActive, _clickDelay, _saveSlot, _optionsActive, _quitActive, _warpActive;
	int	_optionsScrollX, _optionsXV, _oBannerY;
	int	_nextScreen, _loadOrSave;

	Common::KeyCode _keyAssignUp, _keyAssignDown, _keyAssignLeft, _keyAssignRight, _keyAssignUse;
	Picture	*_contArrowUp, *_contArrowDown, *_contArrowLeft, *_contArrowRight, *_contAssign, *_warpPlaque;
//	void	ShowControl(int x, int y, short key);

	bool _waitingForKey;
	int	_whichKey;

	Picture	*_sliderLeft, *_sliderMid, *_sliderRight, *_sliderKnob;
	Picture	*_gCheckEmpty, *_gCheckOn, *_gCheckOff, *_gCheckLeft, *_gCheckRight;

	SoundType _introSong, _titleSong;

	Star _fStars[kMaxStars];

	char nebulaNames[kNebulaCount][32] = {
		BACKSCROLL_PLANET1,
		BACKSCROLL_PLANET2,
		BACKSCROLL_PLANET3,
		BACKSCROLL_PLANET4,
		BACKSCROLL_PLANET5,
		BACKSCROLL_GALAXY1,
		BACKSCROLL_GALAXY2
	};

	int _menuKey;
};

} // End of Namespace

#endif // !HDB_SOUND_H