ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
mediastation.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 MEDIASTATION_H
23 #define MEDIASTATION_H
24 
25 #include "audio/mixer.h"
26 #include "common/scummsys.h"
27 #include "common/system.h"
28 #include "common/error.h"
29 #include "common/fs.h"
30 #include "common/hash-str.h"
31 #include "common/random.h"
32 #include "common/serializer.h"
33 #include "common/events.h"
34 #include "common/util.h"
35 #include "engines/engine.h"
36 #include "engines/savestate.h"
37 #include "graphics/screen.h"
38 
39 #include "mediastation/detection.h"
40 #include "mediastation/datafile.h"
41 #include "mediastation/boot.h"
42 #include "mediastation/context.h"
43 #include "mediastation/asset.h"
44 #include "mediastation/cursors.h"
45 
46 namespace MediaStation {
47 
48 struct MediaStationGameDescription;
49 
50 // Most Media Station titles follow this file structure from the root directory
51 // of the CD-ROM:
52 // - [TITLE].EXE (main game executable, name vares based on game)
53 // - DATA/ (subdirectory that holds actual game data including bytecode)
54 // - 100.CXT
55 // - ... other CXTs, varies per title
56 static const char *const directoryGlobs[] = {
57  "DATA", // For most titles
58  "program", // For D.W. the Picky Eater
59  "PZDATA", // For Puzzle Castle demo
60  nullptr
61 };
62 
63 class MediaStationEngine : public Engine {
64 public:
65  MediaStationEngine(OSystem *syst, const ADGameDescription *gameDesc);
66  ~MediaStationEngine() override;
67 
68  uint32 getFeatures() const;
69  Common::String getGameId() const;
70  Common::Platform getPlatform() const;
71  const char *getAppName() const;
72  bool hasFeature(EngineFeature f) const override {
73  return
75  };
76 
77  bool isFirstGenerationEngine();
78  void processEvents();
79  void refreshActiveHotspot();
80  void redraw();
81 
82  void setPalette(Asset *palette);
83  void addPlayingAsset(Asset *assetToAdd);
84 
85  Asset *getAssetById(uint assetId);
86  Asset *getAssetByChunkReference(uint chunkReference);
87  Function *getFunctionById(uint functionId);
88 
89  Operand callMethod(BuiltInMethod methodId, Common::Array<Operand> &args);
90  Operand callBuiltInFunction(BuiltInFunction function, Common::Array<Operand> &args);
92  Common::RandomSource _randomSource;
93 
94  Graphics::Screen *_screen = nullptr;
95  Context *_currentContext = nullptr;
96 
97  Common::Point _mousePos;
98  Common::Array<Common::Rect> _dirtyRects;
99  bool _needsHotspotRefresh = false;
100 
101  // All Media Station titles run at 640x480.
102  const uint16 SCREEN_WIDTH = 640;
103  const uint16 SCREEN_HEIGHT = 480;
104 
105 protected:
106  Common::Error run() override;
107 
108 private:
109  Common::Event _event;
110  Common::FSNode _gameDataDir;
111  const ADGameDescription *_gameDescription;
112 
113  // In Media Station, only the cursors are stored in the executable; everything
114  // else is in the Context (*.CXT) data files.
115  CursorManager *_cursor;
116  void setCursor(uint id);
117 
118  Boot *_boot = nullptr;
119  Common::List<Asset *> _assetsPlaying;
120  Common::HashMap<uint, Context *> _loadedContexts;
121  Asset *_currentHotspot = nullptr;
122 
123  uint _requestedScreenBranchId = 0;
124  Common::Array<uint> _requestedContextReleaseId;
125  void doBranchToScreen();
126 
127  Context *loadContext(uint32 contextId);
128  void setPaletteFromHeader(AssetHeader *header);
129  void releaseContext(uint32 contextId);
130  Asset *findAssetToAcceptMouseEvents();
131 
132  void effectTransition(Common::Array<Operand> &args);
133 };
134 
136 #define SHOULD_QUIT ::MediaStation::g_engine->shouldQuit()
137 
138 } // End of namespace MediaStation
139 
140 #endif // MEDIASTATION_H
Definition: str.h:59
EngineFeature
Definition: engine.h:253
Definition: asset.h:33
Definition: error.h:84
Definition: context.h:57
Definition: advancedDetector.h:163
Definition: random.h:44
Definition: list.h:44
Definition: cursors.h:35
Definition: asset.h:37
Definition: screen.h:48
Engine * g_engine
Definition: engine.h:267
bool hasFeature(EngineFeature f) const override
Definition: mediastation.h:72
Definition: function.h:32
Definition: operand.h:35
Definition: boot.h:192
Definition: hashmap.h:85
Definition: events.h:199
Definition: fs.h:69
Definition: mediastation.h:63
Definition: rect.h:45
Definition: assetheader.h:162
Definition: system.h:161
Definition: engine.h:144
Common::Error run() override
Platform
Definition: platform.h:46