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_SET_H
24 #define BLADERUNNER_SET_H
25 
26 #include "bladerunner/boundingbox.h"
27 
28 #include "common/scummsys.h"
29 #include "common/str.h"
30 
31 namespace BladeRunner {
32 
33 class BladeRunnerEngine;
34 
35 class SaveFileReadStream;
36 class SaveFileWriteStream;
37 class SetEffects;
38 class SceneObjects;
39 class VQADecoder;
40 
41 class Set {
42 	friend class Debugger;
43 
44 	struct Object {
45 		Common::String name;
46 		BoundingBox    bbox;
47 		uint8          isObstacle;
48 		uint8          isClickable;
49 		uint8          isHotMouse;
50 		uint8          isTarget;
51 		uint8          unknown1;
52 	};
53 
54 	struct Walkbox {
55 		Common::String name;
56 		float          altitude;
57 		int            vertexCount;
58 		Vector3        vertices[8];
59 	};
60 
61 	BladeRunnerEngine *_vm;
62 
63 	bool        _loaded;
64 	int         _objectCount;
65 	int         _walkboxCount;
66 	Object     *_objects;
67 	Walkbox    *_walkboxes;
68 	int         _walkboxStepSound[85];
69 	int         _footstepSoundOverride;
70 //	float       _unknown[10];
71 
72 public:
73 	SetEffects *_effects;
74 
75 public:
76 	Set(BladeRunnerEngine *vm);
77 	~Set();
78 
79 	bool open(const Common::String &name);
80 
81 	void addObjectsToScene(SceneObjects *sceneObjects) const;
getObjectCount()82 	uint32 getObjectCount() const { return _objectCount; }
83 
84 	float getAltitudeAtXZ(float x, float z, bool *inWalkbox) const;
85 
86 	int findWalkbox(float x, float z) const;
87 	int findObject(const Common::String &objectName) const;
88 
89 	bool objectSetHotMouse(int objectId) const;
90 	bool objectGetBoundingBox(int objectId, BoundingBox *boundingBox) const;
91 	void objectSetIsClickable(int objectId, bool isClickable);
92 	void objectSetIsObstacle(int objectId, bool isObstacle);
93 	void objectSetIsTarget(int objectId, bool isTarget);
94 	const Common::String &objectGetName(int objectId) const;
95 
96 	void setWalkboxStepSound(int walkboxId, int floorType);
97 	void setFoodstepSoundOverride(int floorType);
98 	void resetFoodstepSoundOverride();
99 
100 	int getWalkboxSoundWalkLeft(int walkboxId) const;
101 	int getWalkboxSoundWalkRight(int walkboxId) const;
102 	int getWalkboxSoundRunLeft(int walkboxId) const;
103 	int getWalkboxSoundRunRight(int walkboxId) const;
104 
105 	void save(SaveFileWriteStream &f);
106 	void load(SaveFileReadStream &f);
107 
108 private:
109 	static bool isXZInWalkbox(float x, float z, const Walkbox &walkbox);
110 #if BLADERUNNER_ORIGINAL_BUGS
111 #else
112 	void overrideSceneObjectInfo(int objectId) const;
113 	void setupNewObjectInSet(Common::String objName, BoundingBox objBbox);
114 	void patchInAdditionalObjectsInSet();
115 	void patchOutBadObjectsFromSet();
116 #endif // BLADERUNNER_ORIGINAL_BUGS
117 };
118 
119 } // End of namespace BladeRunner
120 
121 #endif
122