finished cullzones

This commit is contained in:
aap 2020-08-21 13:28:33 +02:00
parent cc2f13710d
commit 13c34b0863
2 changed files with 32 additions and 5 deletions

View File

@ -11,6 +11,8 @@
#include "ZoneCull.h" #include "ZoneCull.h"
#include "Zones.h" #include "Zones.h"
//--MIAMI: done
int32 CCullZones::NumAttributeZones; int32 CCullZones::NumAttributeZones;
CAttributeZone CCullZones::aAttributeZones[NUMATTRIBZONES]; CAttributeZone CCullZones::aAttributeZones[NUMATTRIBZONES];
@ -18,6 +20,7 @@ int32 CCullZones::CurrentWantedLevelDrop_Player;
int32 CCullZones::CurrentFlags_Camera; int32 CCullZones::CurrentFlags_Camera;
int32 CCullZones::CurrentFlags_Player; int32 CCullZones::CurrentFlags_Player;
bool CCullZones::bCurrentSubwayIsInvisible; bool CCullZones::bCurrentSubwayIsInvisible;
bool CCullZones::bAtBeachForAudio;
void void
CCullZones::Init(void) CCullZones::Init(void)
@ -37,6 +40,7 @@ CCullZones::Update(void)
switch(CTimer::GetFrameCounter() & 7){ switch(CTimer::GetFrameCounter() & 7){
case 0: case 0:
case 4: case 4:
UpdateAtBeachForAudio();
break; break;
case 2: 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 void
CCullZones::ForceCullZoneCoors(CVector coors) CCullZones::ForceCullZoneCoors(CVector coors)
{ {

View File

@ -10,8 +10,9 @@ enum eZoneAttribs
ATTRZONE_NOTCULLZONE = 0x20, ATTRZONE_NOTCULLZONE = 0x20,
ATTRZONE_DOINEEDCOLLISION = 0x40, ATTRZONE_DOINEEDCOLLISION = 0x40,
ATTRZONE_SUBWAYVISIBLE = 0x80, ATTRZONE_SUBWAYVISIBLE = 0x80,
ATTRZONE_POLICEABANDONCARS = 0x100,
ATTRZONE_WATERFUDGE = 0x400, ATTRZONE_ROOMFORAUDIO = 0x200,
ATTRZONE_WATERFUDGE = 0x400,
}; };
struct CAttributeZone struct CAttributeZone
@ -36,9 +37,11 @@ public:
static int32 CurrentFlags_Camera; static int32 CurrentFlags_Camera;
static int32 CurrentFlags_Player; static int32 CurrentFlags_Player;
static bool bCurrentSubwayIsInvisible; static bool bCurrentSubwayIsInvisible;
static bool bAtBeachForAudio;
static void Init(void); static void Init(void);
static void Update(void); static void Update(void);
static void UpdateAtBeachForAudio(void);
static void ForceCullZoneCoors(CVector coors); static void ForceCullZoneCoors(CVector coors);
static int32 FindAttributesForCoors(CVector coors, int32 *wantedLevel); static int32 FindAttributesForCoors(CVector coors, int32 *wantedLevel);
static CAttributeZone *FindZoneWithStairsAttributeForPlayer(void); static CAttributeZone *FindZoneWithStairsAttributeForPlayer(void);
@ -55,9 +58,8 @@ public:
static bool DoINeedToLoadCollision(void) { return (CurrentFlags_Player & ATTRZONE_DOINEEDCOLLISION) != 0; } static bool DoINeedToLoadCollision(void) { return (CurrentFlags_Player & ATTRZONE_DOINEEDCOLLISION) != 0; }
static bool PlayerNoRain(void) { return (CurrentFlags_Player & ATTRZONE_NORAIN) != 0; } static bool PlayerNoRain(void) { return (CurrentFlags_Player & ATTRZONE_NORAIN) != 0; }
static bool CamNoRain(void) { return (CurrentFlags_Camera & 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 bool WaterFudge(void) { return (CurrentFlags_Camera & ATTRZONE_WATERFUDGE) != 0; }
static int32 GetWantedLevelDrop(void) { return CurrentWantedLevelDrop_Player; } static int32 GetWantedLevelDrop(void) { return CurrentWantedLevelDrop_Player; }
//--MIAMI: TODO
static bool PoliceAbandonCars(void) { return false; }
}; };