ScummVM API documentation
scene.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 TWINE_SCENE_SCENE_H
23#define TWINE_SCENE_SCENE_H
24
25#include "common/scummsys.h"
26#include "twine/scene/actor.h"
27#include "twine/shared.h"
28
29namespace TwinE {
30
31#define NUM_SCENES_FLAGS 80
32
33#define NUM_MAX_ACTORS 100
34#define NUM_MAX_ZONES 100
35#define NUM_MAX_TRACKS 200
36
37enum class ScenePositionType {
38 kNoPosition = 0,
39 kZone = 1,
40 kScene = 2,
41 kReborn = 3
42};
43
44// ZONES
45
46#define ZONE_INIT_ON 1
47#define ZONE_ON 2
48#define ZONE_ACTIVE 4
49#define ZONE_OBLIGATOIRE 8
50
54struct ZoneStruct {
55 IVec3 mins;
56 IVec3 maxs;
57 ZoneType type = ZoneType::kCube;
58 int32 num;
59 union {
60 struct {
61 int32 x;
62 int32 y;
63 int32 z;
64 } ChangeScene;
65 struct {
66 int32 x;
67 int32 y;
68 int32 z;
69 } CameraView;
71 struct {
72 int32 textColor;
74 struct {
75 BonusParameter typesFlag;
76 int32 amount;
80 int32 used;
81 } Bonus;
82 struct {
83 int32 info0;
84 int32 info1;
85 int32 info2;
86 int32 info3;
87 int32 info4;
88 int32 info5;
89 int32 info6;
90 int32 info7;
91 } generic;
92 } infoData;
93};
94
95class TwinEEngine;
96
115class Scene {
116private:
117 TwinEEngine *_engine;
118
119 void loadModel(ActorStruct &actor, int32 modelIndex, bool lba1);
120
122 void processZoneExtraBonus(ZoneStruct *zone);
123 void setActorStaticFlags(ActorStruct *act, uint32 staticFlags);
124 void setBonusParameterFlags(ActorStruct *act, uint16 bonusFlags);
125 bool loadSceneLBA1();
126 bool loadSceneLBA2();
127
129 bool loadScene(int32 index);
131 void clearScene();
132
133 // the first actor is the own hero
134 ActorStruct _sceneActors[NUM_MAX_ACTORS]; // ListObjet
135 int32 _currentSceneSize = 0;
136 bool _isOutsideScene = false; // lba2
137
139 int32 _timerNextAmbiance = 0;
140 int16 _sampleAmbiance[4]{0};
141 int16 _sampleRepeat[4]{0};
142 int16 _sampleRound[4]{0};
143 int16 _sampleFrequency[4]{0}; // lba2
144 int16 _sampleVolume[4]{0}; // lba2
145 int16 _sampleMinDelay = 0; // SecondMin
146 int16 _sampleMinDelayRnd = 0; // SecondEcart
147
148 int16 _samplePlayed = 0;
149
150public:
151 int16 _cubeJingle = 0;
152private:
153 IVec3 _sceneHeroPos; // CubeStartX, CubeStartY, CubeStartZ
154 IVec3 _zoneHeroPos; // NewPosX, NewPosY, NewPosZ
155
156 int32 _currentGameOverScene = 0;
157
158 uint8 *_currentScene = nullptr;
159 void dumpSceneScripts() const;
160 void dumpSceneScript(const char *type, int actorIdx, const uint8* script, int size) const;
161public:
162 Scene(TwinEEngine *engine) : _engine(engine) {}
163 ~Scene();
164
165 int32 _newCube = LBA1SceneId::Citadel_Island_Prison;
166 int32 _numCube = LBA1SceneId::Citadel_Island_Prison; // NumCube
167 int32 _oldcube = LBA1SceneId::Citadel_Island_Prison;
168
169 int32 _planet = -1;
170
171 int32 _numHolomapTraj = -1;
172
173 TextBankId _sceneTextBank = TextBankId::None;
174 int32 _alphaLight = 0;
175 int32 _betaLight = 0;
176
177 uint8 _island = 0;
178 uint8 _shadowLevel = 0; // lba2
179 uint8 _modeLabyrinthe = 0; // lba2
180 uint8 _cinemaMode = 0; // lba2
181 uint8 _currentCubeX = 0; // lba2
182 uint8 _currentCubeY = 0; // lba2
183
184 IVec3 _sceneStart;
185
187 int16 _startYFalling = 0;
188
190 ScenePositionType _flagChgCube = ScenePositionType::kNoPosition; // twinsenPositionModeInNewCube
191
192 // ACTORS
193 int32 _nbObjets = 0;
194 ActorStruct *_sceneHero = nullptr;
195
197 int16 _mecaPenguinIdx = 0;
198
200 int16 _numObjFollow = OWN_ACTOR_SCENE_INDEX;
202 bool _flagClimbing = false;
204 int16 _currentScriptValue = 0;
205
206 int16 _talkingActor = 0;
207
208 // TRACKS Tell the actor where to go
209 int32 _sceneNumTracks = 0;
210 IVec3 _sceneTracks[NUM_MAX_TRACKS];
211
212 bool _flagRenderGrid = true; // FlagAffGrille
213
214 uint8 _listFlagCube[NUM_SCENES_FLAGS]{0}; // ListVarCube
215
216 int32 _sceneNumZones = 0; // NbZones
217 ZoneStruct _sceneZones[NUM_MAX_ZONES]; // ListZone
218
219 ActorStruct *getActor(int32 actorIdx); // ListObjet
220
221 void playSceneMusic();
222
223 void reloadCurrentScene();
224
227
229 bool loadSceneCubeXY(int sceneNum, int32 *cubeX, int32 *cubeY);
230
232 void processEnvironmentSound(); // GereAmbiance
233 void initSceneVars();
234
235 bool isGameRunning() const;
236 void stopRunningGame();
237
242 void checkZoneSce(int32 actorIdx);
243};
244
245inline bool Scene::isGameRunning() const {
246 return _currentScene != nullptr;
247}
248
249} // namespace TwinE
250
251#endif
Definition: actor.h:137
Definition: scene.h:115
void changeCube()
bool loadSceneCubeXY(int sceneNum, int32 *cubeX, int32 *cubeY)
void processEnvironmentSound()
void checkZoneSce(int32 actorIdx)
Definition: twine.h:207
Definition: actor.h:119
Definition: shared.h:127
Definition: scene.h:54
int32 textColor
Definition: scene.h:72
int32 used
Definition: scene.h:80
struct TwinE::ZoneStruct::@1318::@1321 DisplayText