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,
bool insideWait,
float fov,
float aspectRatio,
float nearClipPlane,
float farClipPlane);
68 void drawDepthLayer(
Renderer *gfx, uint32 animationTicks, Math::Vector3d camera, Math::Vector3d direction,
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 hasActiveGroups();
99 uint32 _gasPocketRadius;
107 uint8 _usualBackgroundColor;
108 uint8 _underFireBackgroundColor;
111 uint8 _extraColor[4];
118 Math::Vector3d _lastCameraPosition;
119 Math::Vector3d _lastCameraDirection;
121 float _lastAspectRatio;
122 float _lastNearClipPlane;
123 float _lastFarClipPlane;
124 ObjectArray _sortedObjects;
125 ObjectArray _depthLayerSortedObjects;
126 Math::Vector3d _lastDepthLayerCameraPosition;
127 Math::Vector3d _lastDepthLayerCameraDirection;
128 float _lastDepthLayerFov;
129 float _lastDepthLayerAspectRatio;
130 float _lastDepthLayerNearClipPlane;
131 float _lastDepthLayerFarClipPlane;
132 RenderDepthLayer _lastRenderDepthLayer;
133 float _lastForegroundDistance;
134 uint32 _lastDepthLayerTick;
138 bool _hasSyntheticFloor;
139 ObjectMap *_objectsByID;
140 ObjectMap *_entrancesByID;
141 ObjectArray _drawableObjects;
142 ObjectMap _addedObjects;
143 Object *objectWithIDFromMap(ObjectMap *map, uint16 objectID);
148 #endif // FREESCAPE_AREA_H