ScummVM API documentation
in_game_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 TETRAEDGE_GAME_IN_GAME_SCENE_H
23#define TETRAEDGE_GAME_IN_GAME_SCENE_H
24
25#include "common/array.h"
26#include "common/str.h"
27#include "common/hashmap.h"
28
29#include "tetraedge/game/object3d.h"
30#include "tetraedge/game/billboard.h"
31#include "tetraedge/game/youki_manager.h"
32
33#include "tetraedge/te/te_act_zone.h"
34#include "tetraedge/te/te_bezier_curve.h"
35#include "tetraedge/te/te_free_move_zone.h"
36#include "tetraedge/te/te_scene.h"
37#include "tetraedge/te/te_light.h"
38#include "tetraedge/te/te_lua_gui.h"
39#include "tetraedge/te/te_particle.h"
40#include "tetraedge/te/te_pick_mesh2.h"
41
42namespace Tetraedge {
43
44class Character;
45class CharactersShadow;
46class TeLayout;
47
48class InGameScene : public TeScene {
49public:
50 friend class InGameSceneXmlParser;
51
53
54 struct AnimObject {
55 bool onFinished();
56
57 Common::String _name;
58 TeSpriteLayout *_layout;
59 };
60
61 struct Callback {
62 float _f;
63 Common::String _name;
64 };
65
66 struct SoundStep {
67 Common::String _stepSound1;
68 Common::String _stepSound2;
69 };
70
71 struct AnchorZone {
72 Common::String _name;
73 bool _activated;
74 TeVector3f32 _loc;
75 float _radius;
76 };
77
78 struct Object {
80 Common::String _name;
81 };
82
83 struct TeMarker {
84 Common::String _name;
85 Common::String _val;
86 };
87
88 struct Dummy {
89 Common::String _name;
90 TeVector3f32 _position;
91 TeQuaternion _rotation;
92 TeVector3f32 _scale;
93 };
94
95 static const int MAX_FIRE;
96 static const int MAX_SNOW;
97 static const int MAX_SMOKE;
98 static const float DUREE_MAX_FIRE;
99 static const float SCALE_FIRE;
100 static const int MAX_FLAKE;
101 static const float DUREE_MIN_FLAKE;
102 static const float DUREE_MAX_FLAKE;
103 static const float SCALE_FLAKE;
104 static const float DEPTH_MAX_FLAKE;
105
106 struct Fire {
110 };
111
112 struct Flamme {
113 Flamme() : _needsFires(false), _addFireOnUpdate(false) {};
114 ~Flamme();
116 Common::String _name;
117 TeVector3f32 _center;
118 TeVector3f32 _yMax;
119 TeVector3f32 _offsetMin;
120 TeVector3f32 _offsetMax;
121 bool _needsFires;
122 bool _addFireOnUpdate;
123 void initFire();
124 };
125
126 // TODO: Any other members of RippleMask?
127 class RippleMask : public TeModel {
128
129 };
130
131 struct SceneLight {
132 Common::String _name;
133 TeVector3f32 _v1;
134 TeVector3f32 _v2;
135 TeColor _color;
136 float _f;
137 };
138
139 void activateAnchorZone(const Common::String &name, bool val);
140 void addAnchorZone(const Common::String &s1, const Common::String &name, float radius);
141 void addBlockingObject(const Common::String &obj) {
142 _blockingObjects.push_back(obj);
143 }
144 bool addMarker(const Common::String &name, const Common::Path &imgPath, float x, float y, const Common::String &locType, const Common::String &markerVal, float anchorX, float anchorY);
145 static float angularDistance(float a1, float a2);
146 bool aroundAnchorZone(const AnchorZone *zone);
147 TeLayout *background();
148 Billboard *billboard(const Common::String &name);
149 bool changeBackground(const Common::Path &name);
150 Character *character(const Common::String &name);
151 virtual void close() override;
152 // Original has a typo, "converPathToMesh", corrected.
153 void convertPathToMesh(TeFreeMoveZone *zone);
154 TeIntrusivePtr<TeBezierCurve> curve(const Common::String &curveName);
155 void deleteAllCallback();
156 void deleteMarker(const Common::String &markerName);
157 // Original just calls these "deserialize" but that's a fairly vague name
158 // so renamed to be more meaningful.
159 void deserializeCam(Common::ReadStream &stream, TeIntrusivePtr<TeCamera> &cam);
160 void deserializeModel(Common::ReadStream &stream, TeIntrusivePtr<TeModel> &model, TePickMesh2 *pickmesh);
161 virtual void draw() override;
162 void drawKate();
163 void drawMask();
164 void drawReflection();
165 void drawPath();
166 Dummy dummy(const Common::String &name);
167 bool findKate();
168 const TeMarker *findMarker(const Common::String &name);
169 const TeMarker *findMarkerByInt(const Common::String &name);
170 SoundStep findSoundStep(const Common::String &name);
171 void freeGeometry();
172 void freeSceneObjects();
173 Common::Path getActZoneFileName() const;
174 Common::Path getBlockersFileName() const;
175 Common::Path getLightsFileName() const;
176 float getHeadHorizontalRotation(Character *cter, const TeVector3f32 &vec);
177 float getHeadVerticalRotation(Character *cter, const TeVector3f32 &vec);
178 Common::Path imagePathMarker(const Common::String &name);
179 void initScroll();
180 bool isMarker(const Common::String &name);
181 bool isObjectBlocking(const Common::String &name);
182 TeVector2f32 layerSize();
183
184 virtual bool load(const TetraedgeFSNode &node) override;
185 void loadBackground(const TetraedgeFSNode &node);
186 bool loadBillboard(const Common::String &name);
187 void loadBlockers();
188 bool loadCharacter(const Common::String &name);
189 void loadInteractions(const TetraedgeFSNode &node);
190 bool loadLights(const TetraedgeFSNode &node);
191 void loadMarkers(const TetraedgeFSNode &node);
192 bool loadObject(const Common::String &oname);
193 bool loadObjectMaterials(const Common::String &name);
194 bool loadObjectMaterials(const Common::Path &path, const Common::String &name);
195 bool loadPlayerCharacter(const Common::String &cname);
196
197 // Syberia 2 specific data..
198 void loadActZones();
199 bool loadCamera(const Common::String &name);
200 bool loadCurve(const Common::String &name);
201 bool loadDynamicLightBloc(const Common::String &name, const Common::String &texture, const Common::String &zone, const Common::String &scene);
202 // loadFlamme uses the xml doc
203 bool loadFreeMoveZone(const Common::String &name, TeVector2f32 &gridSize);
204 bool loadLight(const Common::String &fname, const Common::String &zone, const Common::String &scene);
205 bool loadMask(const Common::String &name, const Common::String &texture, const Common::String &zone, const Common::String &scene);
206 bool loadRBB(const Common::String &fname, const Common::String &zone, const Common::String &scene);
207 bool loadRippleMask(const Common::String &name, const Common::String &texture, const Common::String &zone, const Common::String &scene);
208 bool loadRObject(const Common::String &fname, const Common::String &zone, const Common::String &scene);
209 bool loadShadowMask(const Common::String &name, const Common::String &texture, const Common::String &zone, const Common::String &scene);
210 bool loadShadowReceivingObject(const Common::String &fname, const Common::String &zone, const Common::String &scene);
211 //bool loadSnowCustom() // todo: from xml file?
212 bool loadXml(const Common::String &zone, const Common::String &scene);
213 bool loadZBufferObject(const Common::String &fname, const Common::String &zone, const Common::String &scene);
214
215 void moveCharacterTo(const Common::String &charName, const Common::String &curveName, float curveOffset, float curveEnd);
216 Object3D *object3D(const Common::String &oname);
217 void onMainWindowSizeChanged();
218 TeFreeMoveZone *pathZone(const Common::String &zname);
219 void playVerticalScrolling(float time);
220
221 void reset();
222 void setImagePathMarker(const Common::String &markerName, const Common::Path &path);
223 void setPositionCharacter(const Common::String &charName, const Common::String &freeMoveZoneName, const TeVector3f32 &position);
224 void setStep(const Common::String &scene, const Common::String &step1, const Common::String &step2);
225 void setVisibleMarker(const Common::String &markerName, bool val);
226 TeLight *shadowLight();
227 void unloadCharacter(const Common::String &name);
228 void unloadObject(const Common::String &name);
229 void unloadSpriteLayouts();
230 void update() override;
231
232 // Does nothing, but to keep calls from original..
233 void updateScroll();
234 void updateViewport(int ival);
235
236 Character *_character;
237 Common::Array<Character *> _characters;
238
239 TeLuaGUI &bgGui() { return _bgGui; }
240 TeLuaGUI &hitObjectGui() { return _hitObjectGui; }
241 TeLuaGUI &markerGui() { return _markerGui; }
242
243 Common::Array<TePickMesh2 *> &clickMeshes() { return _clickMeshes; }
244
245 float shadowFarPlane() const { return _shadowFarPlane; }
246 float shadowNearPlane() const { return _shadowNearPlane; }
247 float shadowFov() const { return _shadowFov; }
248 const TeColor &shadowColor() const { return _shadowColor; }
249 int shadowLightNo() const { return _shadowLightNo; }
250 CharactersShadow *charactersShadow() { return _charactersShadow; }
251
252 TeIntrusivePtr<TeBezierCurve> curve() { return _curve; }
253 void setCurve(TeIntrusivePtr<TeBezierCurve> &c) { _curve = c; }
254 Common::Array<TeIntrusivePtr<TeModel>> &zoneModels() { return _zoneModels; }
255 Common::Array<TeIntrusivePtr<TeModel>> &shadowReceivingObjects() { return _shadowReceivingObjects; }
256 Common::Array<TeRectBlocker> &rectBlockers() { return _rectBlockers; }
257 Common::Array<TeBlocker> &blockers() { return _blockers; }
258 Common::Array<Object3D *> object3Ds() { return _object3Ds; }
259 void setWaitTime(double usecs) { _waitTime = usecs; }
260 TeTimer &waitTimeTimer() { return _waitTimeTimer; }
261 Common::Array<Common::SharedPtr<TeLight>> &lights() { return _lights; }
262 Common::Array<TeIntrusivePtr<TeParticle>> &particles() { return _particles; }
263
264 // Note: Zone name and scene name are only set in Syberia 2
265 const Common::String getZoneName() const { return _zoneName; }
266 const Common::String getSceneName() const { return _sceneName; }
267
268 void activateMask(const Common::String &name, bool val);
269 YoukiManager &youkiManager() { return _youkiManager; }
270
271private:
272 int _shadowLightNo;
273 CharactersShadow *_charactersShadow;
274 TeColor _shadowColor;
275 float _shadowFarPlane;
276 float _shadowNearPlane;
277 float _shadowFov;
278
279 double _waitTime;
280 TeTimer _waitTimeTimer;
281
282 Common::Array<TeBlocker> _blockers;
283 Common::Array<TeRectBlocker> _rectBlockers;
284 Common::Array<TeActZone> _actZones;
285 Common::Array<TeFreeMoveZone*> _freeMoveZones;
287 Common::Array<AnchorZone *> _anchorZones;
288 Common::Array<AnimObject *> _animObjects;
289 Common::Array<Object3D *> _object3Ds;
290 Common::Array<Billboard *> _billboards;
292 Common::Array<TePickMesh2 *> _clickMeshes;
293 Common::Array<RippleMask *> _rippleMasks;
294
297
299 Common::Array<Object> _objects;
301 Common::Array<Dummy> _dummies;
302 Common::Array<Flamme> _flammes;
303 Common::Array<SceneLight> _sceneLights;
307 Common::Array<TeIntrusivePtr<TeModel>> _shadowReceivingObjects;
308
309 TeIntrusivePtr<TeModel> _playerCharacterModel;
310 TeIntrusivePtr<TeBezierCurve> _curve;
311 Common::Array<Common::String> _blockingObjects;
312 TeLuaGUI _bgGui;
313 TeLuaGUI _markerGui;
314 TeLuaGUI _hitObjectGui;
315
317
318 TeVector2f32 _scrollOffset;
319 TeVector2f32 _scrollScale;
320 TeVector2f32 _viewportSize;
321
322 Common::Path _loadedPath;
323
324 // Syberia 2 specific items
325 static bool _collisionSlide;
326 Common::String _sceneName;
327 Common::String _zoneName;
328 bool _maskAlpha;
329 YoukiManager _youkiManager;
330 TeTimer _verticalScrollTimer;
331 float _verticalScrollTime;
332 bool _verticalScrollPlaying;
333};
334
335} // end namespace Tetraedge
336
337#endif // TETRAEDGE_GAME_IN_GAME_SCENE_H
Definition: array.h:52
void push_back(const T &element)
Definition: array.h:181
Definition: hashmap.h:85
Definition: path.h:52
Definition: stream.h:385
Definition: str.h:59
Definition: billboard.h:35
Definition: character.h:41
Definition: in_game_scene.h:127
Definition: in_game_scene.h:48
Definition: in_game_scene_xml_parser.h:34
Definition: object3d.h:35
Definition: te_color.h:30
Definition: te_curve_anim2.h:36
Definition: te_free_move_zone.h:57
Definition: te_intrusive_ptr.h:31
Definition: te_layout.h:35
Definition: te_light.h:39
Definition: te_lua_gui.h:51
Definition: te_marker.h:32
Definition: te_model.h:44
Definition: te_pick_mesh2.h:32
Definition: te_quaternion.h:32
Definition: te_scene.h:35
Definition: te_sprite_layout.h:30
Definition: te_vector2f32.h:32
Definition: te_vector3f32.h:33
Definition: tetraedge.h:65
Definition: in_game_scene.h:71
Definition: in_game_scene.h:54
Definition: in_game_scene.h:61
Definition: in_game_scene.h:88
Definition: in_game_scene.h:106
Definition: in_game_scene.h:112
Definition: in_game_scene.h:78
Definition: in_game_scene.h:131
Definition: in_game_scene.h:66
Definition: in_game_scene.h:83