ScummVM API documentation
sherlock.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 SHERLOCK_SHERLOCK_H
23 #define SHERLOCK_SHERLOCK_H
24 
25 #include "common/scummsys.h"
26 #include "common/array.h"
27 #include "common/endian.h"
28 #include "common/hash-str.h"
29 #include "common/serializer.h"
30 #include "common/random.h"
31 #include "common/savefile.h"
32 #include "common/util.h"
33 
34 #include "engines/engine.h"
35 
36 #include "sherlock/animation.h"
37 #include "sherlock/debugger.h"
38 #include "sherlock/events.h"
39 #include "sherlock/fixed_text.h"
40 #include "sherlock/inventory.h"
41 #include "sherlock/journal.h"
42 #include "sherlock/map.h"
43 #include "sherlock/music.h"
44 #include "sherlock/people.h"
45 #include "sherlock/resources.h"
46 #include "sherlock/saveload.h"
47 #include "sherlock/scene.h"
48 #include "sherlock/screen.h"
49 #include "sherlock/sound.h"
50 #include "sherlock/talk.h"
51 #include "sherlock/user_interface.h"
52 #include "sherlock/detection.h"
53 
54 namespace Sherlock {
55 
56 enum {
57  kDebugLevelScript = 1 << 0,
58  kDebugLevelAdLibDriver = 2 << 0,
59  kDebugLevelMT32Driver = 3 << 0,
60  kDebugLevelMusic = 4 << 0
61 };
62 
63 #define SHERLOCK_SCREEN_WIDTH _vm->_screen->width()
64 #define SHERLOCK_SCREEN_HEIGHT _vm->_screen->height()
65 #define SHERLOCK_SCENE_WIDTH _vm->_screen->_backBuffer1.width()
66 #define SHERLOCK_SCENE_HEIGHT (IS_SERRATED_SCALPEL ? 138 : 480)
67 #define SCENES_COUNT (IS_SERRATED_SCALPEL ? 63 : 101)
68 #define MAX_BGSHAPES (IS_SERRATED_SCALPEL ? 64 : 150)
69 
70 #define COL_INFO_FOREGROUND (IS_SERRATED_SCALPEL ? (byte)Scalpel::INFO_FOREGROUND : (byte)Tattoo::INFO_FOREGROUND)
71 #define COL_PEN_COLOR (IS_SERRATED_SCALPEL ? (byte)Scalpel::PEN_COLOR : (byte)Tattoo::PEN_COLOR)
72 #define COL_PEN_HIGHLIGHT (IS_SERRATED_SCALPEL ? 15 : 129)
73 
74 class Resource;
75 
76 class SherlockEngine : public Engine {
77 private:
81  void sceneLoop();
82 
86  void handleInput();
87 protected:
91  virtual void initialize();
92 
93  virtual void showOpening() = 0;
94 
95  virtual void startScene() {}
96 
100  bool hasFeature(EngineFeature f) const override;
101 
105  virtual void loadConfig();
106 public:
107  const SherlockGameDescription *_gameDescription;
108  Animation *_animation;
109  Debugger *_debugger;
110  Events *_events;
111  FixedText *_fixedText;
112  Inventory *_inventory;
113  Journal *_journal;
114  Map *_map;
115  Music *_music;
116  People *_people;
117  Resources *_res;
118  SaveManager *_saves;
119  Scene *_scene;
120  Screen *_screen;
121  Sound *_sound;
122  Talk *_talk;
123  UserInterface *_ui;
124  Common::RandomSource _randomSource;
125  Common::Array<bool> _flags;
126  bool _useEpilogue2;
127  int _loadGameSlot;
128  bool _canLoadSave;
129  bool _showOriginalSavesDialog;
130  bool _interactiveFl;
131  bool _isScreenDoubled;
132  bool _startupAutosave;
133 public:
134  SherlockEngine(OSystem *syst, const SherlockGameDescription *gameDesc);
135  ~SherlockEngine() override;
136 
140  Common::Error run() override;
141 
145  bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
146 
150  bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
151 
155  Common::Error loadGameState(int slot) override;
156 
160  Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
161 
165  void syncSoundSettings() override;
166 
170  virtual void saveConfig();
171 
175  virtual bool isDemo() const;
176 
180  GameType getGameID() const;
181 
186 
191 
195  int getRandomNumber(int limit) { return _randomSource.getRandomNumber(limit - 1); }
196 
202  bool readFlags(int flagNum);
203 
208  void setFlags(int flagNum);
209 
214  void setFlagsDirect(int flagNum);
215 
219  void synchronize(Serializer &s);
220 };
221 
222 #define IS_ROSE_TATTOO (_vm->getGameID() == GType_RoseTattoo)
223 #define IS_SERRATED_SCALPEL (_vm->getGameID() == GType_SerratedScalpel)
224 #define IS_3DO (_vm->getPlatform() == Common::kPlatform3DO)
225 
226 } // End of namespace Sherlock
227 
228 #endif
Definition: fixed_text.h:74
void synchronize(Serializer &s)
Definition: str.h:59
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
Definition: detection.h:34
Definition: events.h:39
EngineFeature
Definition: engine.h:253
Common::Language getLanguage() const
Definition: error.h:84
virtual void initialize()
Definition: inventory.h:78
Definition: random.h:44
Definition: talk.h:164
Definition: animation.h:29
Definition: animation.h:35
Definition: sound.h:40
uint getRandomNumber(uint max)
void setFlags(int flagNum)
Definition: scene.h:145
Definition: resources.h:83
Definition: saveload.h:59
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: debugger.h:35
Definition: serializer.h:79
virtual bool isDemo() const
GameType getGameID() const
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
virtual void loadConfig()
bool readFlags(int flagNum)
Definition: ustr.h:57
Definition: map.h:32
Common::Error loadGameState(int slot) override
Definition: sherlock.h:76
Common::Error run() override
virtual void saveConfig()
Definition: journal.h:50
int getRandomNumber(int limit)
Definition: sherlock.h:195
Definition: screen.h:40
Definition: music.h:59
Definition: system.h:161
Definition: user_interface.h:62
bool hasFeature(EngineFeature f) const override
Definition: engine.h:144
void syncSoundSettings() override
void setFlagsDirect(int flagNum)
Platform
Definition: platform.h:46
Definition: people.h:98
Common::Platform getPlatform() const
debug level for "EMCInterpreter" functions
Definition: kyra_v1.h:97
Language
Definition: language.h:45