ScummVM API documentation
game.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 ALG_GAME_H
23#define ALG_GAME_H
24
25#include "common/random.h"
26
27#include "audio/audiostream.h"
28#include "audio/mixer.h"
29
30#include "alg/alg.h"
31#include "alg/scene.h"
32#include "alg/video.h"
33
34namespace Alg {
35
36class Game {
37
38public:
39 Game(AlgEngine *vm);
40 virtual ~Game();
41 virtual void init();
42 virtual Common::Error run();
43 virtual bool saveState(Common::OutSaveFile *outSaveFile) = 0;
44 virtual bool loadState(Common::InSaveFile *inSaveFile) = 0;
45 bool debug_dumpLibFile();
46 bool _debug_drawRects = false;
47 bool _debug_godMode = false;
48 bool _debug_unlimitedAmmo = false;
49
50protected:
51 AlgEngine *_vm = nullptr;
52 AlgVideoDecoder *_videoDecoder = nullptr;
53 SceneInfo *_sceneInfo = nullptr;
54 Common::RandomSource *_rnd = nullptr;
55
56 Common::File _libFile;
58
59 uint8 *_palette = nullptr;
60 bool _paletteDirty = false;
61
62 Graphics::Surface *_background = nullptr;
63 Graphics::Surface *_screen = nullptr;
64
65 Audio::SoundHandle _sfxAudioHandle;
66
67 Zone *_menuZone = nullptr;
68 Zone *_subMenuZone = nullptr;
69
70 bool _leftDown = false;
71 bool _rightDown = false;
72 Common::Point _mousePos;
73
74 const uint32 _pauseDiffScale[3] = {0x10000, 0x8000, 0x4000};
75 const uint32 _rectDiffScale[3] = {0x10000, 0x0C000, 0x8000};
76
77 void shutdown();
78 bool pollEvents();
79 void loadLibArchive(const Common::Path &path);
80 Audio::SeekableAudioStream *loadSoundFile(const Common::Path &path);
81 void playSound(Audio::SeekableAudioStream *stream);
82 bool loadScene(Scene *scene);
83 virtual void updateScreen();
84 uint32 getMsTime();
85 bool fired(Common::Point *point);
86 Rect *checkZone(Zone *zone, Common::Point *point);
87 uint32 getFrame(Scene *scene);
88 int8 skipToNewScene(Scene *scene);
89 virtual void debug_drawZoneRects();
90
91 // Script functions: Zone
92 void zoneGlobalHit(Common::Point *point);
93 // Script functions: RectHit
94 void rectHitDoNothing(Rect *rect);
95 void rectNewScene(Rect *rect);
96 // Script functions: Scene PreOps
97 void scenePsoDrawRct(Scene *scene);
98 void scenePsoPause(Scene *scene);
99 void scenePsoDrawRctFadeIn(Scene *scene);
100 void scenePsoFadeIn(Scene *scene);
101 void scenePsoPauseFadeIn(Scene *scene);
102 void scenePsoPreRead(Scene *scene);
103 void scenePsoPausePreRead(Scene *scene);
104 // Script functions: Scene Scene InsOps
105 void sceneIsoDoNothing(Scene *scene);
106 void sceneIsoStartGame(Scene *scene);
107 void sceneIsoPause(Scene *scene);
108 // Script functions: Scene Scene NxtScn
109 void sceneNxtscnDoNothing(Scene *scene);
110 void sceneDefaultNxtscn(Scene *scene);
111 // Script functions: ShowMsg
112 void sceneSmDonothing(Scene *scene);
113 // Script functions: ScnNxtFrm
114 void sceneNxtfrm(Scene *scene);
115
116 bool _buttonDown = false;
117 bool _fired = 0;
118 uint32 _currentFrame = 0;
119 bool _gameInProgress = false;
120 bool _hadPause = false;
121 bool _inMenu = false;
122 uint32 _pauseTime = 0;
123 bool _sceneSkipped = false;
124 uint32 _videoFrameSkip = 3;
125 uint32 _nextFrameTime = 0;
126 uint16 _videoPosX = 0;
127 uint16 _videoPosY = 0;
128
129 Common::String _curScene;
130 Common::String _startScene;
131};
132
133} // End of namespace Alg
134
135#endif
Definition: alg.h:46
Definition: video.h:32
Definition: game.h:36
Definition: scene.h:72
Definition: scene.h:101
Definition: scene.h:135
Definition: scene.h:85
Definition: audiostream.h:212
Definition: mixer.h:49
Definition: error.h:81
Definition: file.h:47
Definition: savefile.h:54
Definition: path.h:52
Definition: random.h:44
Definition: stream.h:745
Definition: str.h:59
Definition: rect.h:144
Definition: surface.h:67