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
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (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, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23  *
24  */
25 
26 #ifndef PEGASUS_MENU_H
27 #define PEGASUS_MENU_H
28 
29 #include "pegasus/constants.h"
30 #include "pegasus/fader.h"
31 #include "pegasus/input.h"
32 #include "pegasus/movie.h"
33 #include "pegasus/sound.h"
34 #include "pegasus/surface.h"
35 #include "pegasus/util.h"
36 
37 namespace Pegasus {
38 
39 class GameMenu : public IDObject, public InputHandler {
40 public:
41 	GameMenu(const uint32);
~GameMenu()42 	~GameMenu() override {}
43 
44 	virtual void becomeCurrentHandler();
45 	virtual void restorePreviousHandler();
46 
getLastCommand()47 	GameMenuCommand getLastCommand() { return _lastCommand; }
clearLastCommand()48 	void clearLastCommand() { _lastCommand = kMenuCmdNoCommand; }
49 
50 protected:
setLastCommand(const GameMenuCommand command)51 	void setLastCommand(const GameMenuCommand command) { _lastCommand = command; }
52 
53 	InputHandler *_previousHandler;
54 	GameMenuCommand _lastCommand;
55 
56 	void drawScore(GameScoreType, GameScoreType, const Common::Rect &, Surface *);
57 
58 private:
59 	void drawNumber(GameScoreType, CoordType &, CoordType, Surface *);
60 };
61 
62 class Hotspot;
63 
64 class MainMenu : public GameMenu {
65 public:
66 	MainMenu();
67 	~MainMenu() override;
68 
69 	void handleInput(const Input &input, const Hotspot *) override;
70 	void startMainMenuLoop();
71 	void stopMainMenuLoop();
72 
73 protected:
74 	void updateDisplay();
75 
76 	uint32 _menuSelection;
77 
78 	// Full and Demo
79 	Picture _menuBackground;
80 	Picture _startButton;
81 	Picture _creditsButton;
82 	Picture _quitButton;
83 	Picture _largeSelect;
84 	Picture _smallSelect;
85 
86 	// Full only
87 	bool _adventureMode;
88 	Picture _overviewButton;
89 	Picture _restoreButton;
90 	Picture _adventureButton;
91 	Picture _walkthroughButton;
92 
93 	Sound _menuLoop;
94 	SoundFader _menuFader;
95 };
96 
97 class CreditsMenu : public GameMenu {
98 public:
99 	CreditsMenu();
100 	~CreditsMenu() override;
101 
102 	void handleInput(const Input &input, const Hotspot *) override;
103 	void startCreditsMenuLoop();
104 	void stopCreditsMenuLoop();
105 
106 protected:
107 	void newMenuSelection(const int);
108 	void newMovieTime(const TimeValue);
109 
110 	int _menuSelection;
111 	Picture _menuBackground;
112 	Movie _creditsMovie;
113 	Picture _mainMenuButton;
114 	Picture _largeSelect;
115 	Picture _smallSelect;
116 
117 	Sound _menuLoop;
118 	SoundFader _menuFader;
119 };
120 
121 class DeathMenu : public GameMenu {
122 public:
123 	DeathMenu(const DeathReason);
~DeathMenu()124 	~DeathMenu() override {}
125 
126 	void handleInput(const Input &input, const Hotspot *) override;
127 
playerWon()128 	bool playerWon() { return _playerWon; }
129 
130 protected:
131 	void drawAllScores();
132 
133 	void updateDisplay();
134 
135 	bool _playerWon;
136 	int _menuSelection;
137 	DeathReason _deathReason;
138 
139 	Picture _deathBackground;
140 	Picture _continueButton;
141 	Picture _restoreButton;
142 	Picture _mainMenuButton;
143 	Picture _quitButton;
144 
145 	Picture _largeSelect;
146 	Picture _smallSelect;
147 
148 	Sound _triumphSound;
149 };
150 
151 class PauseMenu : public GameMenu {
152 public:
153 	PauseMenu();
~PauseMenu()154 	~PauseMenu() override {}
155 
156 	void handleInput(const Input &input, const Hotspot *) override;
157 
158 protected:
159 	void updateDisplay();
160 
161 	uint32 _menuSelection;
162 	Picture _pauseBackground;
163 	Picture _saveButton;
164 	Picture _restoreButton;
165 	Picture _walkthroughButton;
166 	Picture _continueButton;
167 	SoundLevel _soundFXLevel;
168 	SoundLevel _ambienceLevel;
169 	Picture _quitButton;
170 	Picture _largeSelect;
171 	Picture _smallSelect;
172 };
173 
174 } // End of namespace Pegasus
175 
176 #endif
177