ScummVM API documentation
castle.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#ifndef SCUMM_INSANE_MORTIMER_CASTLE_H
22#define SCUMM_INSANE_MORTIMER_CASTLE_H
23
24#include "common/random.h"
25#include "scumm/insane/mortimer/flight.h"
26#include "scumm/insane/mortimer/text.h"
27
28namespace Scumm {
29
31public:
33 bool start(int scene, uint flightDifficulty, uint riddleDifficulty, bool girl);
34 bool loadMovie();
35 void update();
36 void click(const Common::Point &point);
37 bool skip();
38 void movieFinished();
39 void hit();
40 void clearDamage() { _damage = 0; }
41 void forceChoice(bool correct) { _forcedChoice = correct ? 1 : 2; }
42 void setProgrammer(bool enabled) { _programmer = enabled; }
43 void drawOverlay(Graphics::Surface &screen, const Common::Point &mouse, const Common::Point &origin, byte mouth) const;
44 const MortimerSound *takeSpeech(bool playing);
45
46 bool needsMovie() const { return _moviePending; }
47 bool courseView() const { return _stage <= kExit && interactive(); }
48 bool acceptsShots() const { return (_stage == kEntry || _stage == kRoom) && !_choosing && !_leaving && !_holdFrames; }
49 bool choosing() const { return _choosing; }
50 bool paused() const { return _choosing || _stage == kIdle || _holdFrames; }
51 bool finished() const { return _stage == kFinished; }
52 bool solved() const { return _stage == kCorrect || _stage == kFinished; }
53 bool hasSpeech() const { return _nextVoice < _voices.size(); }
54 bool forceSubtitles() const { return _stage == kSong; }
55 uint damage() const { return _damage; }
56 int sceneId() const;
57 const char *subtitleName() const;
58 const Common::String &movieName() const { return _movieName; }
59 const Common::String &errorMessage() const { return _error.empty() ? MortimerMovie::errorMessage() : _error; }
60
61protected:
62 void handleAction(const byte *data, uint32 size) override;
63
64private:
65 enum Stage { kEntry, kRoom, kLeft, kDrop, kExit, kGate, kSong, kIdle, kRiddle, kWrong, kCorrect, kFinished };
66 struct SpeechBlock {
68 uint next = 0, count = 0, size = 0;
69 };
70
71 bool loadResources();
72 bool loadText();
73 bool newPuzzle();
74 void enter(Stage stage);
75 void retry(bool crash);
76 void resolveChoice();
77 void showChoices();
78 void selectSide(uint side);
79 int animal(uint side) const;
80 void drawText(Graphics::Surface &screen, const Common::String &text, int x, int y, int width, byte color) const;
81
83 Common::Array<MortimerSprite> _goggles, _icons, _spin, _flames[4], _plaques[28], _mouth, _cursor;
84 MortimerFont _font, _captionFont;
85 Common::String _riddles[2][2], _hint;
86 Common::String _movieName, _error;
87 SpeechBlock _speechBlocks[2];
88 MortimerSound _speech[2], _hintSound, _explanation;
89 Common::Array<uint> _voices;
90 uint _nextVoice, _flightDifficulty, _riddleDifficulty, _puzzle, _step, _damage, _checkpointDamage;
91 uint _wrongChoices, _crashes, _frame, _choiceFrame, _hintFrames, _holdFrames;
92 uint _rooms[5], _sides[6];
93 int _answer, _selection, _forcedChoice;
94 Stage _stage;
95 bool _moviePending, _choosing, _leaving, _correct, _resourcesLoaded, _programmer;
96};
97
98} // End of namespace Scumm
99
100#endif
size_type size() const
Definition: array.h:316
Definition: random.h:44
Definition: str.h:59
Definition: castle.h:30
Definition: flight.h:28
Definition: text.h:30
Definition: actor.h:30
Definition: rect.h:144
Definition: surface.h:67
Definition: movie.h:49