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/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_SCENE_H
29#define HPL_SCENE_H
30
31#include "hpl1/engine/game/GameTypes.h"
32#include "hpl1/engine/system/SystemTypes.h"
33
34#include "hpl1/engine/game/Updateable.h"
35#include "hpl1/engine/scene/Camera3D.h"
36
37#include "common/list.h"
38#include "hpl1/engine/resources/MeshLoader.h"
39
40namespace hpl {
41
42class cAI;
43class cGraphics;
44class cResources;
45class cSystem;
46class cSound;
47class cPhysics;
48class cCollider2D;
49class iCamera;
50class cCamera2D;
51class cUpdater;
52class cWorld3D;
53class cWorld2D;
54
55typedef Common::List<iCamera *> tCameraList;
56typedef tCameraList::iterator tCameraListIt;
57
58typedef Common::List<cWorld3D *> tWorld3DList;
59typedef tWorld3DList::iterator tWorld3DListIt;
60
61class cScene : public iUpdateable {
62public:
63 cScene(cGraphics *apGraphics, cResources *apResources, cSound *apSound, cPhysics *apPhysics,
64 cSystem *apSystem, cAI *apAI);
65 ~cScene();
66
67 void Reset();
68
72 void UpdateRenderList(float afFrameTime);
76 void Render(cUpdater *apUpdater, float afFrameTime);
77
78 bool LoadMap2D(tString asFile);
79
80 void RenderWorld2D(cCamera2D *apCam, cWorld2D *apWorld);
81
82 void Update(float afTimeStep);
83
84 void ClearLoadedMaps() { m_setLoadedMaps.clear(); }
85 tStringSet *GetLoadedMapsSet() { return &m_setLoadedMaps; }
86
87 void SetDrawScene(bool abX);
88 bool GetDrawScene() { return mbDrawScene; }
89
91
92 cScriptVar *CreateLocalVar(const tString &asName);
93 cScriptVar *GetLocalVar(const tString &asName);
94 tScriptVarMap *GetLocalVarMap();
95 cScriptVar *CreateGlobalVar(const tString &asName);
96 cScriptVar *GetGlobalVar(const tString &asName);
97 tScriptVarMap *GetGlobalVarMap();
98
100
101 cCamera2D *CreateCamera2D(unsigned int alW, unsigned int alH);
102 cCamera3D *CreateCamera3D(eCameraMoveMode aMoveMode);
103
104 void DestroyCamera(iCamera *apCam);
105
110 void SetCamera(iCamera *pCam);
111 iCamera *GetCamera() { return mpActiveCamera; }
112 void SetCameraPosition(const cVector3f &avPos);
113 cVector3f GetCameraPosition();
114
115 void SetCameraIsListener(bool abX) { mbCameraIsListener = abX; }
116
118
119 cWorld3D *LoadWorld3D(const tString &asFile, bool abLoadScript, tWorldLoadFlag aFlags);
120 cWorld3D *CreateWorld3D(const tString &asName);
121 void DestroyWorld3D(cWorld3D *apWorld);
122
123 void SetWorld3D(cWorld3D *apWorld);
124 cWorld3D *GetWorld3D() { return mpCurrentWorld3D; }
125
126 bool HasLoadedWorld(const tString &asFile);
127
128 cWorld2D *GetWorld2D() { return mpCurrentWorld2D; }
129 cCollider2D *GetCollider2D() { return mpCollider2D; }
130
131 void SetUpdateMap(bool abX) { mbUpdateMap = abX; }
132 bool GetUpdateMap() { return mbUpdateMap; }
133
134 cSystem *GetSystem() { return mpSystem; }
135
136private:
137 cGraphics *mpGraphics;
138 cResources *mpResources;
139 cSound *mpSound;
140 cPhysics *mpPhysics;
141 cSystem *mpSystem;
142 cAI *mpAI;
143
144 cCollider2D *mpCollider2D;
145
146 bool mbDrawScene;
147 bool mbUpdateMap;
148
149 tWorld3DList mlstWorld3D;
150 cWorld3D *mpCurrentWorld3D;
151
152 cWorld2D *mpCurrentWorld2D;
153 tCameraList mlstCamera;
154 iCamera *mpActiveCamera;
155 bool mbCameraIsListener;
156
157 tScriptVarMap m_mapLocalVars;
158 tScriptVarMap m_mapGlobalVars;
159
160 tStringSet m_setLoadedMaps;
161};
162
163} // namespace hpl
164
165#endif // HPL_SCENE_H
ListInternal::Iterator< iCamera * > iterator
Definition: list.h:52
Definition: str.h:59
Definition: AI.h:40
Definition: Camera2D.h:38
Definition: Graphics.h:46
Definition: Physics.h:67
Definition: Resources.h:160
Definition: Scene.h:61
void UpdateRenderList(float afFrameTime)
void Render(cUpdater *apUpdater, float afFrameTime)
void SetCamera(iCamera *pCam)
Definition: Sound.h:40
Definition: System.h:36
Definition: Updater.h:46
Definition: World2D.h:64
Definition: Camera.h:43
Definition: Updateable.h:35