2019-05-15 10:52:37 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "Game.h"
|
2020-02-17 18:56:13 -05:00
|
|
|
#include "Gangs.h"
|
2019-05-15 10:52:37 -04:00
|
|
|
|
|
|
|
enum eZoneType
|
|
|
|
{
|
2020-05-06 06:23:26 -04:00
|
|
|
ZONE_DEFAULT,
|
|
|
|
ZONE_NAVIG,
|
|
|
|
ZONE_INFO,
|
2019-05-15 10:52:37 -04:00
|
|
|
ZONE_MAPZONE,
|
|
|
|
};
|
|
|
|
|
|
|
|
class CZone
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
char name[8];
|
|
|
|
float minx;
|
|
|
|
float miny;
|
|
|
|
float minz;
|
|
|
|
float maxx;
|
|
|
|
float maxy;
|
|
|
|
float maxz;
|
|
|
|
eZoneType type;
|
|
|
|
eLevelName level;
|
|
|
|
int16 zoneinfoDay;
|
|
|
|
int16 zoneinfoNight;
|
|
|
|
CZone *child;
|
|
|
|
CZone *parent;
|
|
|
|
CZone *next;
|
2019-06-05 16:32:49 -04:00
|
|
|
|
2019-07-06 06:27:21 -04:00
|
|
|
wchar *GetTranslatedName(void);
|
2019-05-15 10:52:37 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
class CZoneInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Car data
|
2019-06-01 17:17:39 -04:00
|
|
|
int16 carDensity;
|
|
|
|
int16 carThreshold[6];
|
|
|
|
int16 copThreshold;
|
2020-02-17 18:56:13 -05:00
|
|
|
int16 gangThreshold[NUM_GANGS];
|
2019-05-15 10:52:37 -04:00
|
|
|
|
|
|
|
// Ped data
|
|
|
|
uint16 pedDensity;
|
|
|
|
uint16 copDensity;
|
2020-02-17 18:56:13 -05:00
|
|
|
uint16 gangDensity[NUM_GANGS];
|
2019-05-15 10:52:37 -04:00
|
|
|
uint16 pedGroup;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class CTheZones
|
|
|
|
{
|
2020-04-17 01:54:14 -04:00
|
|
|
static CZone *m_pPlayersZone;
|
|
|
|
static int16 FindIndex;
|
2019-05-15 10:52:37 -04:00
|
|
|
|
2020-04-17 01:54:14 -04:00
|
|
|
static uint16 NumberOfAudioZones;
|
|
|
|
static int16 AudioZoneArray[NUMAUDIOZONES];
|
|
|
|
static uint16 TotalNumberOfMapZones;
|
|
|
|
static uint16 TotalNumberOfZones;
|
|
|
|
static CZone ZoneArray[NUMZONES];
|
|
|
|
static CZone MapZoneArray[NUMMAPZONES];
|
|
|
|
static uint16 TotalNumberOfZoneInfos;
|
|
|
|
static CZoneInfo ZoneInfoArray[2*NUMZONES];
|
2020-05-06 06:23:26 -04:00
|
|
|
public:
|
|
|
|
static eLevelName m_CurrLevel;
|
2019-05-15 10:52:37 -04:00
|
|
|
|
|
|
|
static void Init(void);
|
|
|
|
static void Update(void);
|
|
|
|
static void CreateZone(char *name, eZoneType type,
|
|
|
|
float minx, float miny, float minz,
|
|
|
|
float maxx, float maxy, float maxz,
|
|
|
|
eLevelName level);
|
|
|
|
static void CreateMapZone(char *name, eZoneType type,
|
|
|
|
float minx, float miny, float minz,
|
|
|
|
float maxx, float maxy, float maxz,
|
|
|
|
eLevelName level);
|
|
|
|
static CZone *GetZone(uint16 i) { return &ZoneArray[i]; }
|
2020-05-06 06:23:26 -04:00
|
|
|
static CZone *GetAudioZone(uint16 i) { return &ZoneArray[AudioZoneArray[i]]; }
|
2019-05-15 10:52:37 -04:00
|
|
|
static void PostZoneCreation(void);
|
|
|
|
static void InsertZoneIntoZoneHierarchy(CZone *zone);
|
|
|
|
static bool InsertZoneIntoZoneHierRecursive(CZone *z1, CZone *z2);
|
|
|
|
static bool ZoneIsEntirelyContainedWithinOtherZone(CZone *z1, CZone *z2);
|
2020-05-06 06:23:26 -04:00
|
|
|
static bool PointLiesWithinZone(const CVector *v, CZone *zone);
|
|
|
|
static eLevelName GetLevelFromPosition(const CVector *v);
|
2019-05-15 10:52:37 -04:00
|
|
|
static CZone *FindSmallestZonePosition(const CVector *v);
|
|
|
|
static CZone *FindSmallestZonePositionType(const CVector *v, eZoneType type);
|
|
|
|
static CZone *FindSmallestZonePositionILN(const CVector *v);
|
2020-05-11 19:24:57 -04:00
|
|
|
static int16 FindZoneByLabelAndReturnIndex(Const char *name);
|
2019-05-15 10:52:37 -04:00
|
|
|
static CZoneInfo *GetZoneInfo(const CVector *v, uint8 day);
|
|
|
|
static void GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info);
|
|
|
|
static void SetZoneCarInfo(uint16 zoneid, uint8 day, int16 carDensity,
|
|
|
|
int16 gang0Num, int16 gang1Num, int16 gang2Num,
|
|
|
|
int16 gang3Num, int16 gang4Num, int16 gang5Num,
|
|
|
|
int16 gang6Num, int16 gang7Num, int16 gang8Num,
|
|
|
|
int16 copNum,
|
|
|
|
int16 car0Num, int16 car1Num, int16 car2Num,
|
|
|
|
int16 car3Num, int16 car4Num, int16 car5Num);
|
|
|
|
static void SetZonePedInfo(uint16 zoneid, uint8 day, int16 pedDensity,
|
|
|
|
int16 gang0Density, int16 gang1Density, int16 gang2Density, int16 gang3Density,
|
|
|
|
int16 gang4Density, int16 gang5Density, int16 gang6Density, int16 gang7Density,
|
|
|
|
int16 gang8Density, int16 copDensity);
|
|
|
|
static void SetCarDensity(uint16 zoneid, uint8 day, uint16 cardensity);
|
|
|
|
static void SetPedDensity(uint16 zoneid, uint8 day, uint16 peddensity);
|
|
|
|
static void SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup);
|
|
|
|
static int16 FindAudioZone(CVector *pos);
|
|
|
|
static eLevelName FindZoneForPoint(const CVector &pos);
|
2021-01-16 08:44:59 -05:00
|
|
|
static CZone *GetPointerForZoneIndex(ssize_t i) { return i == -1 ? nil : &ZoneArray[i]; }
|
|
|
|
static ssize_t GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - ZoneArray; }
|
2019-05-15 10:52:37 -04:00
|
|
|
static void AddZoneToAudioZoneArray(CZone *zone);
|
|
|
|
static void InitialiseAudioZoneArray(void);
|
2019-07-06 06:27:21 -04:00
|
|
|
static void SaveAllZones(uint8 *buffer, uint32 *length);
|
|
|
|
static void LoadAllZones(uint8 *buffer, uint32 length);
|
2019-05-15 10:52:37 -04:00
|
|
|
};
|