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
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (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, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  */
22 
23 #ifndef BLADERUNNER_SCENE_H
24 #define BLADERUNNER_SCENE_H
25 
26 #include "bladerunner/vector.h"
27 
28 #include "common/str.h"
29 
30 namespace BladeRunner {
31 
32 class BladeRunnerEngine;
33 class BoundingBox;
34 class Regions;
35 class SaveFileReadStream;
36 class SaveFileWriteStream;
37 class Set;
38 class VQAPlayer;
39 
40 class Scene {
41 	friend class Debugger;
42 
43 	BladeRunnerEngine *_vm;
44 
45 	int         _setId;
46 	int         _sceneId;
47 	VQAPlayer  *_vqaPlayer;
48 
49 	int         _defaultLoop;
50 	bool        _defaultLoopSet;
51 	bool        _defaultLoopPreloadedSet;
52 	int         _specialLoopMode;
53 	int         _specialLoop;
54 	// int         _introFinished;
55 	int         _nextSetId;
56 	int         _nextSceneId;
57 	int         _frame;
58 
59 	Vector3     _actorStartPosition;
60 	int         _actorStartFacing;
61 	bool        _playerWalkedIn;
62 
63 public:
64 	Set        *_set;
65 	Regions    *_regions;
66 	Regions    *_exits;
67 
68 public:
69 	Scene(BladeRunnerEngine *vm);
70 	~Scene();
71 
72 	bool open(int setId, int sceneId, bool isLoadingGame);
73 	bool close(bool isLoadingGame);
74 	int  advanceFrame(bool useTime = true);
75 	void resume(bool isLoadingGame = false);
76 	void startDefaultLoop();
77 	void setActorStart(Vector3 position, int facing);
78 
79 	void loopSetDefault(int loopId);
80 	void loopStartSpecial(int specialLoopMode, int loopId, bool immediately);
81 
getSetId()82 	int getSetId() const { return _setId; }
getSceneId()83 	int getSceneId() const { return _sceneId; }
84 
didPlayerWalkIn()85 	bool didPlayerWalkIn() { bool r = _playerWalkedIn; _playerWalkedIn = false; return r; }
86 
87 	int findObject(const Common::String &objectName);
88 	bool objectSetHotMouse(int objectId);
89 	bool objectGetBoundingBox(int objectId, BoundingBox *boundingBox);
90 	void objectSetIsClickable(int objectId, bool isClickable, bool sceneLoaded);
91 	void objectSetIsObstacle(int objectId, bool isObstacle, bool sceneLoaded, bool updateWalkpath);
92 	void objectSetIsObstacleAll(bool isObstacle, bool sceneLoaded);
93 	void objectSetIsTarget(int objectId, bool isTarget, bool sceneLoaded);
94 	const Common::String &objectGetName(int objectId);
95 
96 	void save(SaveFileWriteStream &f);
97 	void load(SaveFileReadStream &f);
98 
99 private:
100 	void loopEnded(int frame, int loopId);
101 	static void loopEndedStatic(void *data, int frame, int loopId);
102 };
103 
104 } // End of namespace BladeRunner
105 
106 #endif
107