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  * Additional copyright for this file:
8  * Copyright (C) 1995-1997 Presto Studios, Inc.
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  *
23  */
24 
25 #ifndef PEGASUS_MENU_H
26 #define PEGASUS_MENU_H
27 
28 #include "pegasus/constants.h"
29 #include "pegasus/fader.h"
30 #include "pegasus/input.h"
31 #include "pegasus/movie.h"
32 #include "pegasus/sound.h"
33 #include "pegasus/surface.h"
34 #include "pegasus/util.h"
35 
36 namespace Pegasus {
37 
38 class GameMenu : public IDObject, public InputHandler {
39 public:
40  GameMenu(const uint32);
41  ~GameMenu() override {}
42 
43  virtual void becomeCurrentHandler();
44  virtual void restorePreviousHandler();
45 
46  GameMenuCommand getLastCommand() { return _lastCommand; }
47  void clearLastCommand() { _lastCommand = kMenuCmdNoCommand; }
48 
49 protected:
50  void setLastCommand(const GameMenuCommand command) { _lastCommand = command; }
51 
52  InputHandler *_previousHandler;
53  GameMenuCommand _lastCommand;
54 
55  void drawScore(GameScoreType, GameScoreType, const Common::Rect &, Surface *);
56 
57 private:
58  void drawNumber(GameScoreType, CoordType &, CoordType, Surface *);
59 };
60 
61 class Hotspot;
62 
63 class MainMenu : public GameMenu {
64 public:
65  MainMenu();
66  ~MainMenu() override;
67 
68  void handleInput(const Input &input, const Hotspot *) override;
69  void startMainMenuLoop();
70  void stopMainMenuLoop();
71 
72 protected:
73  void updateDisplay();
74 
75  uint32 _menuSelection;
76 
77  // Full and Demo
78  Picture _menuBackground;
79  Picture _startButton;
80  Picture _creditsButton;
81  Picture _quitButton;
82  Picture _largeSelect;
83  Picture _smallSelect;
84 
85  // Full only
86  bool _adventureMode;
87  Picture _overviewButton;
88  Picture _restoreButton;
89  Picture _adventureButton;
90  Picture _walkthroughButton;
91 
92  Sound _menuLoop;
93  SoundFader _menuFader;
94 };
95 
96 class CreditsMenu : public GameMenu {
97 public:
98  CreditsMenu();
99  ~CreditsMenu() override;
100 
101  void handleInput(const Input &input, const Hotspot *) override;
102  void startCreditsMenuLoop();
103  void stopCreditsMenuLoop();
104 
105 protected:
106  void newMenuSelection(const int);
107  void newMovieTime(const TimeValue);
108 
109  int _menuSelection;
110  Picture _menuBackground;
111  Movie _creditsMovie;
112  Picture _mainMenuButton;
113  Picture _largeSelect;
114  Picture _smallSelect;
115 
116  Sound _menuLoop;
117  SoundFader _menuFader;
118 };
119 
120 class DeathMenu : public GameMenu {
121 public:
122  DeathMenu(const DeathReason);
123  ~DeathMenu() override {}
124 
125  void handleInput(const Input &input, const Hotspot *) override;
126 
127  bool playerWon() { return _playerWon; }
128 
129 protected:
130  void drawAllScores();
131 
132  void updateDisplay();
133 
134  bool _playerWon;
135  int _menuSelection;
136  DeathReason _deathReason;
137 
138  Picture _deathBackground;
139  Picture _continueButton;
140  Picture _restoreButton;
141  Picture _mainMenuButton;
142  Picture _quitButton;
143 
144  Picture _largeSelect;
145  Picture _smallSelect;
146 
147  Sound _triumphSound;
148 };
149 
150 class PauseMenu : public GameMenu {
151 public:
152  PauseMenu();
153  ~PauseMenu() override {}
154 
155  void handleInput(const Input &input, const Hotspot *) override;
156 
157 protected:
158  void updateDisplay();
159 
160  uint32 _menuSelection;
161  Picture _pauseBackground;
162  Picture _saveButton;
163  Picture _restoreButton;
164  Picture _walkthroughButton;
165  Picture _continueButton;
166  SoundLevel _soundFXLevel;
167  SoundLevel _ambienceLevel;
168  Picture _quitButton;
169  Picture _largeSelect;
170  Picture _smallSelect;
171 };
172 
173 } // End of namespace Pegasus
174 
175 #endif
Definition: elements.h:234
Definition: movie.h:40
Definition: rect.h:144
Definition: menu.h:96
Definition: hotspot.h:85
Definition: input.h:322
Definition: fader.h:109
Definition: util.h:38
Definition: menu.h:38
Definition: menu.h:63
Definition: menu.h:120
Definition: menu.h:150
Definition: surface.h:50
Definition: sound.h:50
Definition: input.h:410
Definition: ai_action.h:33
Definition: surface.h:125