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