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 HDB_MENU_H
24 #define HDB_MENU_H
25 
26 #include "common/events.h"
27 #include "hdb/ai.h"
28 #include "hdb/sound.h"
29 
30 namespace HDB {
31 
32 #define	CONFIG_MUSICVOL		"music_volume"
33 #define	CONFIG_SOUNDVOL		"sound_volume"
34 #define	CONFIG_MSTONE7		"hdb_memory_heap"
35 #define	CONFIG_MSTONE14		"lua_stack_offset"
36 #define	CONFIG_MSTONE21		"fmod_mix_timer"
37 #define	CONFIG_SOUNDCACHE	"sound_cache_max"
38 #define	CONFIG_GFXCACHE		"gfx_cache_max"
39 #define	CONFIG_CHEAT		"hypercheat"
40 
41 #define	CONFIG_KEY_UP		"keyup"
42 #define	CONFIG_KEY_DOWN		"keydown"
43 #define	CONFIG_KEY_LEFT		"keyleft"
44 #define	CONFIG_KEY_RIGHT	"keyright"
45 #define	CONFIG_KEY_USE		"keyuse"
46 #define	CONFIG_VOICES		"voices"
47 
48 #define	TITLE_DELAY1		2				// time to wait before OOH OOH
49 #define	TITLE_DELAY2		0.5				// time to spend doing OOH OOH
50 #define	TITLE_DELAY3		1				// time to wait before ending title
51 
52 #define centerPic(x)	(g_hdb->_screenWidth / 2 - x->_width / 2)
53 
54 enum {
55 	kStarRedX = 70,
56 	kStarRedY = 20,
57 	kStarGreenX = 70,
58 	kStarGreenY = 100,
59 	kStarBlueX = 70,
60 	kStarBlueY = 180,
61 
62 	kOptionSPC = 16,
63 	kOptionLineSPC = 32,
64 
65 	kScreenFade = 512,
66 	kNebulaCount = 7,
67 	kMaxStars = 10
68 };
69 
70 struct Star {
71 	int x, y, speed, anim, delay;
72 
StarStar73 	Star() : x(0), y(0), speed(0), anim(0), delay(0) {}
74 };
75 
76 class Menu {
77 public:
78 
79 	Menu();
80 	~Menu();
81 
82 	bool init();
83 
84 	void readConfig();
85 	void writeConfig();
86 
87 	bool startTitle();
88 	void drawTitle();
89 	void startMenu();
90 	void changeToMenu();	// Changing from Intro to Menu
91 	void drawMenu();
92 	void freeMenu();
93 
94 	void processInput(int x, int y);	// this is where the items are clicked!
95 	void controlsInput(int x, int y);	// take mouse input and pass through to menu
96 	void controlsDraw();
97 	void drawNebula();
98 	void drawRocketAndSelections();		// draw the background stuff
99 	void drawSlider(int x, int y, int offset);
100 	void drawToggle(int x, int y, bool flag);
101 	void drawWarpScreen();
saveSong(SoundType song)102 	void saveSong(SoundType song) {
103 		_resumeSong = song;
104 	}
105 
106 	void fillSavegameSlots();
107 
setMenuKey(int status)108 	void setMenuKey(int status) {
109 		_menuKey = status;
110 	}
getMenuKey()111 	int getMenuKey() {
112 		return _menuKey;
113 	}
114 
115 	// Platform-specific Constants
116 	int _menuX, _menuY;
117 	int _menuItemWidth;
118 	int _menuItemHeight;
119 	int _mResumeY;
120 	int _mQuitY;
121 	int _mOptionsY;
122 	int _mLoadY;
123 	int _mControlsY;
124 	int _menuExitXLeft;
125 	int _menuExitY;
126 	int _menuExitYTop;
127 	int _menuVortSaveY;
128 	int _menuVortSaveX;
129 	int _mRocketX;
130 	int _mRocketY;
131 	int _mRocketYBottom;
132 	int _mRocketEXHX;
133 	int _mRocketEXHX2;
134 	int _mTitleY;
135 	int _oohOhhX;
136 	int _oohOhhY;
137 	int _newGameX;
138 	int _newGameX2;
139 	int _modePuzzleY;
140 	int _modeActionY;
141 	int _optionsX;
142 	int _optionsY;
143 	int _vortSaveX;
144 	int _vortSaveTextX;
145 	int _vortSaveY;
146 	int _saveSlotX;
147 	int _saveSlotY;
148 	int _quitX;
149 	int _quitY;
150 	int _quitYesX1;
151 	int _quitYesX2;
152 	int _quitYesY1;
153 	int _quitYesY2;
154 	int _quitNoX1;
155 	int _quitNoX2;
156 	int _quitNoY1;
157 	int _quitNoY2;
158 	int _controlX;
159 	int _controlY;
160 	int _controlUpX;
161 	int _controlUpY;
162 	int _controlDownX;
163 	int _controlDownY;
164 	int _controlLeftX;
165 	int _controlLeftY;
166 	int _controlRightX;
167 	int _controlRightY;
168 	int _controlUseX;
169 	int _controlUseY;
170 	int _controlWidth;
171 	int _controlHeight;
172 	int _assignX;
173 	int _assignY;
174 	int _backoutX;
175 	int _backoutY;
176 	int _warpBackoutX;
177 	int _warpBackoutY;
178 	int _warpX;
179 	int _warpY;
180 
181 	Save _saveGames[kNumSaveSlots + 1];
182 
183 	int _starWarp;
184 	int _titleCycle;
185 	uint32 _titleDelay;
186 	bool _titleActive;
187 	SoundType _resumeSong;	// the song that was playing before entering the Options screen
188 
189 	Picture *_oohOohGfx;
190 	Picture *_titleScreen, *_titleLogo, *_hdbLogoScreen, *_menuBackoutGfx, *_controlButtonGfx, *_controlsGfx, *_menuBackspaceGfx;
191 
192 	int _rocketY, _rocketYVel, _rocketEx;	// Rocket Vars
193 	Picture	*_rocketEx1, *_rocketEx2, *_rocketMain, *_rocketSecond;
194 	int	_rocketX;
195 
196 	int	_nebulaX, _nebulaY, _nebulaYVel, _nebulaWhich;
197 	Picture *_nebulaGfx[kNebulaCount];
198 
199 	Picture	*_newGfx, *_loadGfx, *_optionsGfx, *_quitGfx, *_resumeGfx, *_slotGfx;
200 	Picture	*_modePuzzleGfx, *_modeActionGfx, *_modeLoadGfx, *_modeSaveGfx, *_quitScreen;
201 	Tile *_vortexian[3];
202 	Picture	*_star[3], *_warpGfx;
203 	uint32 _quitTimer;
204 	Picture	*_starRedGfx[2], *_starGreenGfx[2], *_starBlueGfx[2], *_versionGfx;
205 	Picture *_screenshots1gfx, *_screenshots1agfx, *_screenshots2gfx, *_demoPlaqueGfx, *_handangoGfx;
206 
207 	bool _menuActive, _optionsScrolling, _newgameActive, _sayHDB;
208 	int	_gamefilesActive, _clickDelay, _saveSlot, _optionsActive, _quitActive, _warpActive;
209 	int	_optionsScrollX, _optionsXV, _oBannerY;
210 	int	_nextScreen;
211 
212 	Common::KeyCode _keyAssignUp, _keyAssignDown, _keyAssignLeft, _keyAssignRight, _keyAssignUse;
213 	Picture	*_contArrowUp, *_contArrowDown, *_contArrowLeft, *_contArrowRight, *_contAssign, *_warpPlaque;
214 
215 	Picture	*_sliderLeft, *_sliderMid, *_sliderRight, *_sliderKnob;
216 	Picture	*_gCheckEmpty, *_gCheckOn, *_gCheckOff, *_gCheckLeft, *_gCheckRight;
217 
218 	SoundType _introSong, _titleSong;
219 
220 	Star _fStars[kMaxStars];
221 
222 	int _menuKey;
223 };
224 
225 } // End of Namespace
226 
227 #endif // !HDB_SOUND_H
228