summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/ZoneCull.cpp25
-rw-r--r--src/core/ZoneCull.h12
2 files changed, 32 insertions, 5 deletions
diff --git a/src/core/ZoneCull.cpp b/src/core/ZoneCull.cpp
index 729cc35d..69c7a796 100644
--- a/src/core/ZoneCull.cpp
+++ b/src/core/ZoneCull.cpp
@@ -11,6 +11,8 @@
#include "ZoneCull.h"
#include "Zones.h"
+//--MIAMI: done
+
int32 CCullZones::NumAttributeZones;
CAttributeZone CCullZones::aAttributeZones[NUMATTRIBZONES];
@@ -18,6 +20,7 @@ int32 CCullZones::CurrentWantedLevelDrop_Player;
int32 CCullZones::CurrentFlags_Camera;
int32 CCullZones::CurrentFlags_Player;
bool CCullZones::bCurrentSubwayIsInvisible;
+bool CCullZones::bAtBeachForAudio;
void
CCullZones::Init(void)
@@ -37,6 +40,7 @@ CCullZones::Update(void)
switch(CTimer::GetFrameCounter() & 7){
case 0:
case 4:
+ UpdateAtBeachForAudio();
break;
case 2:
@@ -57,6 +61,27 @@ CCullZones::Update(void)
}
}
+// TODO? put somewhere else?
+bool
+IsPointWithinArbitraryArea(float px, float py, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
+{
+ if((px-x1)*(x2-x1) - (py-y1)*(y2-y1) < 0.0f) return false;
+ if((px-x2)*(x3-x2) - (py-y2)*(y3-y2) < 0.0f) return false;
+ if((px-x3)*(x4-x3) - (py-y3)*(y4-y3) < 0.0f) return false;
+ if((px-x4)*(x1-x4) - (py-y4)*(y1-y4) < 0.0f) return false;
+ return true;
+}
+
+void
+CCullZones::UpdateAtBeachForAudio(void)
+{
+ bAtBeachForAudio = IsPointWithinArbitraryArea(TheCamera.GetPosition().x, TheCamera.GetPosition().y,
+ 400.0f, -1644.4f,
+ 751.9f, 1267.8f,
+ 971.9f, 1216.2f,
+ 840.0f, -1744.0f);
+}
+
void
CCullZones::ForceCullZoneCoors(CVector coors)
{
diff --git a/src/core/ZoneCull.h b/src/core/ZoneCull.h
index aae06ca0..8200b09a 100644
--- a/src/core/ZoneCull.h
+++ b/src/core/ZoneCull.h
@@ -10,8 +10,9 @@ enum eZoneAttribs
ATTRZONE_NOTCULLZONE = 0x20,
ATTRZONE_DOINEEDCOLLISION = 0x40,
ATTRZONE_SUBWAYVISIBLE = 0x80,
-
- ATTRZONE_WATERFUDGE = 0x400,
+ ATTRZONE_POLICEABANDONCARS = 0x100,
+ ATTRZONE_ROOMFORAUDIO = 0x200,
+ ATTRZONE_WATERFUDGE = 0x400,
};
struct CAttributeZone
@@ -36,9 +37,11 @@ public:
static int32 CurrentFlags_Camera;
static int32 CurrentFlags_Player;
static bool bCurrentSubwayIsInvisible;
+ static bool bAtBeachForAudio;
static void Init(void);
static void Update(void);
+ static void UpdateAtBeachForAudio(void);
static void ForceCullZoneCoors(CVector coors);
static int32 FindAttributesForCoors(CVector coors, int32 *wantedLevel);
static CAttributeZone *FindZoneWithStairsAttributeForPlayer(void);
@@ -55,9 +58,8 @@ public:
static bool DoINeedToLoadCollision(void) { return (CurrentFlags_Player & ATTRZONE_DOINEEDCOLLISION) != 0; }
static bool PlayerNoRain(void) { return (CurrentFlags_Player & ATTRZONE_NORAIN) != 0; }
static bool CamNoRain(void) { return (CurrentFlags_Camera & ATTRZONE_NORAIN) != 0; }
+ static bool PoliceAbandonCars(void) { return (CurrentFlags_Camera & ATTRZONE_POLICEABANDONCARS) != 0; }
+ static bool InRoomForAudio(void) { return (CurrentFlags_Camera & ATTRZONE_ROOMFORAUDIO) != 0; }
static bool WaterFudge(void) { return (CurrentFlags_Camera & ATTRZONE_WATERFUDGE) != 0; }
static int32 GetWantedLevelDrop(void) { return CurrentWantedLevelDrop_Player; }
-
- //--MIAMI: TODO
- static bool PoliceAbandonCars(void) { return false; }
};