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);
73 bool checkInSight(
const Math::Ray &ray,
float maxDistance);
74 Math::Vector3d separateFromWall(
const Math::Vector3d &position);
75 ObjectArray checkCollisions(
const Math::AABB &boundingBox);
76 bool checkIfPlayerWasCrushed(
const Math::AABB &boundingBox);
77 Math::Vector3d resolveCollisions(Math::Vector3d
const &lastPosition, Math::Vector3d
const &newPosition,
int playerHeight);
78 void addObjectFromArea(int16
id,
Area *global);
79 void addGroupFromArea(int16
id,
Area *global);
80 void addObject(
Object *obj);
82 void addStructure(
Area *global);
83 void removeObject(int16
id);
85 void resetAreaGroups();
87 bool hasActiveGroups();
98 uint32 _gasPocketRadius;
106 uint8 _usualBackgroundColor;
107 uint8 _underFireBackgroundColor;
110 uint8 _extraColor[4];
117 Math::Vector3d _lastCameraPosition;
118 Math::Vector3d _lastCameraDirection;
120 float _lastAspectRatio;
121 float _lastNearClipPlane;
122 float _lastFarClipPlane;
123 ObjectArray _sortedObjects;
124 ObjectArray _depthLayerSortedObjects;
125 Math::Vector3d _lastDepthLayerCameraPosition;
126 Math::Vector3d _lastDepthLayerCameraDirection;
127 float _lastDepthLayerFov;
128 float _lastDepthLayerAspectRatio;
129 float _lastDepthLayerNearClipPlane;
130 float _lastDepthLayerFarClipPlane;
131 RenderDepthLayer _lastRenderDepthLayer;
132 float _lastForegroundDistance;
133 uint32 _lastDepthLayerTick;
137 ObjectMap *_objectsByID;
138 ObjectMap *_entrancesByID;
139 ObjectArray _drawableObjects;
140 ObjectMap _addedObjects;
141 Object *objectWithIDFromMap(ObjectMap *map, uint16 objectID);
146 #endif // FREESCAPE_AREA_H