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 QUEEN_QUEEN_H
24 #define QUEEN_QUEEN_H
25 
26 #include "engines/engine.h"
27 #include "common/random.h"
28 
29 namespace Common {
30 class SeekableReadStream;
31 }
32 
33 /**
34  * This is the namespace of the Queen engine.
35  *
36  * Status of this engine: ???
37  *
38  * Games using this engine:
39  * - Flight of the Amazon Queen
40  */
41 namespace Queen {
42 
43 struct GameStateHeader {
44 	uint32 version;
45 	uint32 flags;
46 	uint32 dataSize;
47 	char description[32];
48 };
49 
50 class BamScene;
51 class BankManager;
52 class Command;
53 class Debugger;
54 class Display;
55 class Graphics;
56 class Grid;
57 class Input;
58 class Logic;
59 class Resource;
60 class Sound;
61 class Walk;
62 
63 class QueenEngine : public Engine {
64 public:
65 
66 	QueenEngine(OSystem *syst);
67 	~QueenEngine() override;
68 
bam()69 	BamScene *bam() const { return _bam; }
bankMan()70 	BankManager *bankMan() const { return _bankMan; }
command()71 	Command *command() const { return _command; }
debugger()72 	Debugger *debugger() const { return _debugger; }
display()73 	Display *display() const { return _display; }
graphics()74 	Graphics *graphics() const { return _graphics; }
grid()75 	Grid *grid() const { return _grid; }
input()76 	Input *input() const { return _input; }
logic()77 	Logic *logic() const { return _logic; }
resource()78 	Resource *resource() const { return _resource; }
sound()79 	Sound *sound() const { return _sound; }
walk()80 	Walk *walk() const { return _walk; }
81 
82 	Common::RandomSource randomizer;
83 
84 	void registerDefaultSettings();
85 	void checkOptionSettings();
86 	void readOptionSettings();
87 	void writeOptionSettings();
88 
talkSpeed()89 	int talkSpeed() const { return _talkSpeed; }
talkSpeed(int speed)90 	void talkSpeed(int speed) { _talkSpeed = speed; }
subtitles()91 	bool subtitles() const { return _subtitles; }
subtitles(bool enable)92 	void subtitles(bool enable) { _subtitles = enable; }
93 
94 	void update(bool checkPlayerInput = false);
95 
96 	bool canLoadOrSave() const;
97 	bool canLoadGameStateCurrently() override;
98 	bool canSaveGameStateCurrently() override;
99 	Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
100 	Common::Error loadGameState(int slot) override;
getAutosaveSlot()101 	virtual int getAutosaveSlot() const override { return 99; }
102 	virtual Common::String getSaveStateName(int slot) const override;
103 	void makeGameStateName(int slot, char *buf) const;
104 	int getGameStateSlot(const char *filename) const;
105 	void findGameStateDescriptions(char descriptions[100][32]);
106 	Common::SeekableReadStream *readGameStateHeader(int slot, GameStateHeader *gsh);
107 
108 	enum {
109 		SAVESTATE_CUR_VER  = 1,
110 		SAVESTATE_MAX_NUM  = 100,
111 		SAVESTATE_MAX_SIZE = 30000,
112 
113 		SLOT_LISTPREFIX    = -2,
114 		SLOT_AUTOSAVE      = -1,
115 		SLOT_QUICKSAVE     = 0,
116 
117 		MIN_TEXT_SPEED     = 4,
118 		MAX_TEXT_SPEED     = 100
119 	};
120 
121 protected:
122 
123 	// Engine APIs
124 	Common::Error run() override;
125 	bool hasFeature(EngineFeature f) const override;
126 	void syncSoundSettings() override;
127 
128 
129 	int _talkSpeed;
130 	bool _subtitles;
131 	uint32 _lastUpdateTime;
132 	bool _gameStarted;
133 
134 	BamScene *_bam;
135 	BankManager *_bankMan;
136 	Command *_command;
137 	Debugger *_debugger;
138 	Display *_display;
139 	Graphics *_graphics;
140 	Grid *_grid;
141 	Input *_input;
142 	Logic *_logic;
143 	Resource *_resource;
144 	Sound *_sound;
145 	Walk *_walk;
146 };
147 
148 } // End of namespace Queen
149 
150 #endif
151