25 #ifndef FREESCAPE_AREA_H 26 #define FREESCAPE_AREA_H 29 #include "math/vector3d.h" 31 #include "freescape/language/instruction.h" 32 #include "freescape/objects/object.h" 33 #include "freescape/objects/group.h" 43 enum RenderDepthLayer {
45 kRenderDepthBackground,
46 kRenderDepthForeground
49 Area(uint16 areaID, uint16 areaFlags, ObjectMap *objectsByID, ObjectMap *entrancesByID,
bool isCastle);
53 Object *objectWithID(uint16 objectID);
54 Object *entranceWithID(uint16 objectID);
57 void changeObjectID(uint16 objectID, uint16 newObjectID);
58 ObjectArray getSensors();
61 ObjectMap *getObjectsByID() {
return _objectsByID; }
62 ObjectMap *getEntrancesByID() {
return _entrancesByID; }
63 uint16 getAreaFlags();
65 void remapColor(
int index,
int color);
66 void unremapColor(
int index);
67 void draw(
Renderer *gfx, uint32 animationTicks, Math::Vector3d camera, Math::Vector3d direction,
float roll,
bool insideWait,
float fov,
float aspectRatio,
float nearClipPlane,
float farClipPlane);
68 void drawDepthLayer(
Renderer *gfx, uint32 animationTicks, Math::Vector3d camera, Math::Vector3d direction,
float roll,
bool insideWait, RenderDepthLayer depthLayer,
float foregroundDistance,
float fov,
float aspectRatio,
float nearClipPlane,
float farClipPlane);
69 void drawGroup(
Renderer *gfx,
Group *group,
bool runAnimation);
72 Object *checkCollisionRay(
const Math::Ray &ray,
int raySize,
bool skipTransparent =
false);
73 bool checkInSight(
const Math::Ray &ray,
float maxDistance);
74 Math::Vector3d separateFromWall(
const Math::Vector3d &position);
75 Math::Vector3d separateCameraFromWall(
const Math::Vector3d &eye,
float separation);
76 ObjectArray checkCollisions(
const Math::AABB &boundingBox);
77 bool checkIfPlayerWasCrushed(
const Math::AABB &boundingBox);
78 Math::Vector3d resolveCollisions(Math::Vector3d
const &lastPosition, Math::Vector3d
const &newPosition,
int playerHeight);
79 void addObjectFromArea(int16
id,
Area *global);
80 void addGroupFromArea(int16
id,
Area *global);
81 void addObject(
Object *obj);
83 void addStructure(
Area *global);
84 void removeObject(int16
id);
86 void resetAreaGroups();
88 bool hasDrawableObjects()
const {
return !_drawableObjects.
empty(); }
89 bool hasActiveGroups();
100 uint32 _gasPocketRadius;
108 uint8 _usualBackgroundColor;
109 uint8 _underFireBackgroundColor;
112 uint8 _extraColor[4];
119 Math::Vector3d _lastCameraPosition;
120 Math::Vector3d _lastCameraDirection;
121 float _lastCameraRoll;
123 float _lastAspectRatio;
124 float _lastNearClipPlane;
125 float _lastFarClipPlane;
126 ObjectArray _sortedObjects;
127 ObjectArray _depthLayerSortedObjects;
128 Math::Vector3d _lastDepthLayerCameraPosition;
129 Math::Vector3d _lastDepthLayerCameraDirection;
130 float _lastDepthLayerCameraRoll;
131 float _lastDepthLayerFov;
132 float _lastDepthLayerAspectRatio;
133 float _lastDepthLayerNearClipPlane;
134 float _lastDepthLayerFarClipPlane;
135 RenderDepthLayer _lastRenderDepthLayer;
136 float _lastForegroundDistance;
137 uint32 _lastDepthLayerTick;
141 bool _hasSyntheticFloor;
142 ObjectMap *_objectsByID;
143 ObjectMap *_entrancesByID;
144 ObjectArray _drawableObjects;
145 ObjectMap _addedObjects;
146 Object *objectWithIDFromMap(ObjectMap *map, uint16 objectID);
151 #endif // FREESCAPE_AREA_H
bool empty() const
Definition: array.h:352