ScummVM API documentation
snatcher.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 SNATCHER_H
23#define SNATCHER_H
24
25#include "common/rect.h"
26#include "engines/engine.h"
27#include "snatcher/detection.h"
28#include "snatcher/info.h"
29
30class SnatcherMetaEngine;
31
32namespace Snatcher {
33
34class ActionSequenceHandler;
35class CmdQueue;
36class FanTranslationHandler;
37class FIO;
38class GraphicsEngine;
39class MemAccessHandler;
40class ResourcePointer;
41class SaveLoadManager;
42class ScriptEngine;
43class SoundEngine;
44class SceneModule;
45class UI;
46
47struct GameState;
48struct Script;
49
50class SnatcherEngine : public Engine {
51friend class CmdQueue;
52friend class SaveLoadManager;
53public:
55 ~SnatcherEngine() override;
56
57 SoundEngine *sound() const { return _snd; }
58 GraphicsEngine *gfx() const { return _gfx; }
59
60private:
61 // Startup
62 Common::Error run() override;
63 bool initResource();
64 bool initGfx(Common::Platform platform, bool use8BitColorMode);
65 bool initSaveLoad();
66 bool initSound(Audio::Mixer *mixer, Common::Platform platform, int soundOptions);
67 bool initScriptEngine();
68 void reset();
69 void playBootLogoAnimation(const GameState &state);
70
71 // Main loop
72 bool start();
73 void delayUntil(uint32 end);
74 void checkEvents(const GameState &state);
75
76 void updateMainState(GameState &state);
77 void updateModuleState(GameState &state);
78
79 const uint32 _frameLen;
80 uint16 _reset;
81
82 // ConfigManager sync
83 void syncSoundSettings() override;
84 void applyGameSettings() override;
85 bool _updateGameSettings;
86
87 // GMM, Save, Load
88 void pauseEngineIntern(bool pause) override;
89 bool canLoadGameStateCurrently(Common::U32String*) override;
90 bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
91 Common::Error loadGameState(int slot) override;
92 Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
93
94 SaveLoadManager *_saveMan;
95
96 // MetaEngine
97 bool hasFeature(EngineFeature f) const override;
98 GameDescription _game;
99
100 // Resource
101 FIO *_fio;
102 SceneModule *_module;
103 ResourcePointer *_scd;
104
105 // Graphics
106 GraphicsEngine *_gfx;
107 VMInfo _gfxInfo;
108
109 // Interface
111 UI *_ui;
112
113 // Sound
114 SoundEngine *_snd;
115
116 // Script
117 CmdQueue *_cmdQueue;
118 MemAccessHandler *_memHandler;
119 ScriptEngine *_scriptEngine;
120
121 // Fan Translations
122 FanTranslationHandler *_translator;
123
124public:
125 // Input
126 struct Input {
127 Input() : singleFrameControllerFlags(0), sustainedControllerFlags(0), singleFrameControllerFlagsRemapped(0), sustainedControllerFlagsRemapped(0), lightGunPos() {}
128 uint16 singleFrameControllerFlags;
129 uint16 sustainedControllerFlags;
130 uint16 singleFrameControllerFlagsRemapped;
131 uint16 sustainedControllerFlagsRemapped;
132 Common::Point lightGunPos;
133 };
134
135 const Input &input() const { return _input; }
136 void calibrateLightGun(GameState &state);
137 void toggleKeyRepeat(bool enableRepeat) { _keyRepeat = enableRepeat; }
138 void allowLightGunInput(bool enable);
139
140private:
141 uint16 _lastKeys;
142 uint16 _releaseKeys;
143 Common::Point _realLightGunPos;
144 bool _keyRepeat;
145 bool _enableLightGun;
146
147 Input _input;
148};
149
150} // End of namespace Snatcher
151
152#endif // SNATCHER_H
Definition: mixer.h:70
Definition: error.h:81
Definition: str.h:59
Definition: ustr.h:57
Definition: engine.h:155
EngineFeature
Definition: engine.h:293
Definition: system.h:166
Definition: action.h:36
Definition: script.h:44
Definition: resource.h:121
Definition: fantranslations.h:33
Definition: graphics.h:50
Definition: memory.h:42
Definition: resource.h:52
Definition: saveload.h:44
Definition: resource.h:96
Definition: script.h:135
Definition: snatcher.h:50
Definition: sound.h:42
Definition: ui.h:42
Platform
Definition: platform.h:93
Definition: rect.h:144
Definition: detection.h:33
Definition: state.h:94
Definition: snatcher.h:126
Definition: info.h:30