1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef BLADERUNNER_SCENE_OBJECTS_H
#define BLADERUNNER_SCENE_OBJECTS_H
#include "bladerunner/boundingbox.h"
#include "common/rect.h"
namespace BladeRunner {
class BladeRunnerEngine;
class View;
enum SceneObjectType {
SceneObjectTypeUnknown = -1,
SceneObjectTypeActor = 0,
SceneObjectTypeObject = 1,
SceneObjectTypeItem = 2
};
#define SCENE_OBJECTS_COUNT 115
#define SCENE_OBJECTS_ACTORS_OFFSET 0
#define SCENE_OBJECTS_ITEMS_OFFSET 74
#define SCENE_OBJECTS_OBJECTS_OFFSET 198
struct SceneObject {
int _sceneObjectId;
SceneObjectType _sceneObjectType;
BoundingBox _boundingBox;
Common::Rect _screenRectangle;
float _distanceToCamera;
int _present;
int _isClickable;
int _isObstacle;
int _unknown1;
int _isTarget;
int _isMoving;
int _isRetired;
};
class SceneObjects {
#if _DEBUG
friend class BladeRunnerEngine;
#endif
BladeRunnerEngine *_vm;
private:
View *_view;
int _count;
SceneObject *_sceneObjects;
int *_sceneObjectsSortedByDistance;
public:
SceneObjects(BladeRunnerEngine *vm, View *view);
~SceneObjects();
bool addActor(int sceneObjectId, BoundingBox *boundingBox, Common::Rect *screenRectangle, uint8 isClickable, uint8 unknown1, uint8 isTarget, uint8 isRetired);
bool addObject(int sceneObjectId, BoundingBox *boundingBox, uint8 isClickable, uint8 isObstacle, uint8 unknown1, uint8 isTarget);
bool addItem(int sceneObjectId, BoundingBox *boundingBox, Common::Rect *screenRectangle, uint8 isTarget, uint8 isObstacle);
bool remove(int sceneObjectId);
void clear();
int findByXYZ(int *isClickable, int *isObstacle, int *isTarget, float x, float y, float z, int findClickables, int findObstacles, int findTargets);
bool existsOnXZ(int exceptSceneObjectId, float x, float z, bool a5, bool a6);
void setMoving(int sceneObjectId, bool isMoving);
void setRetired(int sceneObjectId, bool isRetired);
bool isBetweenTwoXZ(int sceneObjectId, float x1, float z1, float x2, float z2);
void setIsClickable(int sceneObjectId, bool isClickable);
void setIsObstacle(int sceneObjectId, bool isObstacle);
void setIsTarget(int sceneObjectId, bool isTarget);
void updateObstacles();
private:
int findById(int sceneObjectId);
bool addSceneObject(int sceneObjectId, SceneObjectType sceneObjectType, BoundingBox *boundingBox, Common::Rect *screenRectangle, uint8 isClickable, uint8 isObstacle, uint8 unknown1, uint8 isTarget, uint unknown2, uint isRetired);
int findEmpty();
};
} // End of namespace BladeRunner
#endif
|