mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-24 01:59:15 +01:00
CZoneInfo mostly done; not its dependencies
This commit is contained in:
parent
8bb22b2ad8
commit
19b21cafcd
@ -664,6 +664,7 @@ CCarCtrl::ChooseGangCarModel(int32 gang)
|
|||||||
void
|
void
|
||||||
CCarCtrl::AddToCarArray(int32 id, int32 vehclass)
|
CCarCtrl::AddToCarArray(int32 id, int32 vehclass)
|
||||||
{
|
{
|
||||||
|
assert(TotalNumOfCarsOfRating[vehclass] < MAX_CAR_MODELS_IN_ARRAY);
|
||||||
CarArrays[vehclass][TotalNumOfCarsOfRating[vehclass]++] = id;
|
CarArrays[vehclass][TotalNumOfCarsOfRating[vehclass]++] = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ class CZoneInfo;
|
|||||||
|
|
||||||
enum{
|
enum{
|
||||||
MAX_CARS_TO_KEEP = 2,
|
MAX_CARS_TO_KEEP = 2,
|
||||||
MAX_CAR_MODELS_IN_ARRAY = 256,
|
MAX_CAR_MODELS_IN_ARRAY = 25,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define LANE_WIDTH 5.0f
|
#define LANE_WIDTH 5.0f
|
||||||
@ -34,9 +34,11 @@ public:
|
|||||||
TAXI,
|
TAXI,
|
||||||
MOPED,
|
MOPED,
|
||||||
MOTORBIKE,
|
MOTORBIKE,
|
||||||
|
|
||||||
LEISUREBOAT,
|
LEISUREBOAT,
|
||||||
WORKERBOAT,
|
WORKERBOAT,
|
||||||
TOTAL_CUSTOM_CLASSES,
|
|
||||||
|
COPS,
|
||||||
MAFIA,
|
MAFIA,
|
||||||
TRIAD,
|
TRIAD,
|
||||||
DIABLO,
|
DIABLO,
|
||||||
@ -46,7 +48,11 @@ public:
|
|||||||
NINES,
|
NINES,
|
||||||
GANG8,
|
GANG8,
|
||||||
GANG9,
|
GANG9,
|
||||||
COPS
|
COPSBOAT,
|
||||||
|
|
||||||
|
NUM_CAR_CLASSES = MOTORBIKE+1,
|
||||||
|
NUM_BOAT_CLASSES = 2,
|
||||||
|
TOTAL_CUSTOM_CLASSES = NUM_CAR_CLASSES + NUM_BOAT_CLASSES
|
||||||
};
|
};
|
||||||
|
|
||||||
static void SwitchVehicleToRealPhysics(CVehicle*);
|
static void SwitchVehicleToRealPhysics(CVehicle*);
|
||||||
|
@ -3089,18 +3089,20 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
|
|||||||
case COMMAND_SET_ZONE_CAR_INFO:
|
case COMMAND_SET_ZONE_CAR_INFO:
|
||||||
{
|
{
|
||||||
char label[12];
|
char label[12];
|
||||||
|
int16 gangDensities[NUM_GANGS];
|
||||||
|
int i;
|
||||||
|
|
||||||
CTheScripts::ReadTextLabelFromScript(&m_nIp, label);
|
CTheScripts::ReadTextLabelFromScript(&m_nIp, label);
|
||||||
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
m_nIp += KEY_LENGTH_IN_SCRIPT;
|
||||||
CollectParameters(&m_nIp, 16);
|
CollectParameters(&m_nIp, 12);
|
||||||
int zone = CTheZones::FindZoneByLabelAndReturnIndex(label, ZONE_INFO);
|
int zone = CTheZones::FindZoneByLabelAndReturnIndex(label, ZONE_INFO);
|
||||||
if (zone < 0) {
|
if (zone < 0) {
|
||||||
debug("Couldn't find zone - %s\n", label);
|
debug("Couldn't find zone - %s\n", label);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CTheZones::SetZoneCarInfo(zone, ScriptParams[0], ScriptParams[1], ScriptParams[2], ScriptParams[3],
|
for(i = 0; i < NUM_GANGS; i++)
|
||||||
ScriptParams[4], ScriptParams[5], ScriptParams[6], ScriptParams[7], ScriptParams[8], 0, 0,
|
gangDensities[i] = ScriptParams[2+i];
|
||||||
ScriptParams[9], ScriptParams[10], ScriptParams[11], ScriptParams[12],
|
CTheZones::SetZoneCarInfo(zone, ScriptParams[0], ScriptParams[1], ScriptParams[11], gangDensities);
|
||||||
ScriptParams[13], ScriptParams[14], ScriptParams[15]);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Not implemented.
|
/* Not implemented.
|
||||||
|
@ -826,54 +826,34 @@ CFileLoader::LoadVehicleObject(const char *line)
|
|||||||
|
|
||||||
mi->m_handlingId = mod_HandlingManager.GetHandlingId(handlingId);
|
mi->m_handlingId = mod_HandlingManager.GetHandlingId(handlingId);
|
||||||
|
|
||||||
// Well this is kinda dumb....
|
if(strncmp(vehclass, "normal", 7) == 0)
|
||||||
if(strncmp(vehclass, "normal", 7) == 0){
|
|
||||||
mi->m_vehicleClass = CCarCtrl::NORMAL;
|
mi->m_vehicleClass = CCarCtrl::NORMAL;
|
||||||
while(frequency-- > 0)
|
else if(strncmp(vehclass, "poorfamily", 11) == 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::NORMAL);
|
|
||||||
}else if(strncmp(vehclass, "poorfamily", 11) == 0){
|
|
||||||
mi->m_vehicleClass = CCarCtrl::POOR;
|
mi->m_vehicleClass = CCarCtrl::POOR;
|
||||||
while(frequency-- > 0)
|
else if(strncmp(vehclass, "richfamily", 11) == 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::POOR);
|
|
||||||
}else if(strncmp(vehclass, "richfamily", 11) == 0){
|
|
||||||
mi->m_vehicleClass = CCarCtrl::RICH;
|
mi->m_vehicleClass = CCarCtrl::RICH;
|
||||||
while(frequency-- > 0)
|
else if(strncmp(vehclass, "executive", 10) == 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::RICH);
|
|
||||||
}else if(strncmp(vehclass, "executive", 10) == 0){
|
|
||||||
mi->m_vehicleClass = CCarCtrl::EXEC;
|
mi->m_vehicleClass = CCarCtrl::EXEC;
|
||||||
while(frequency-- > 0)
|
else if(strncmp(vehclass, "worker", 7) == 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::EXEC);
|
|
||||||
}else if(strncmp(vehclass, "worker", 7) == 0){
|
|
||||||
mi->m_vehicleClass = CCarCtrl::WORKER;
|
mi->m_vehicleClass = CCarCtrl::WORKER;
|
||||||
while(frequency-- > 0)
|
else if(strncmp(vehclass, "big", 4) == 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::WORKER);
|
|
||||||
}else if(strncmp(vehclass, "big", 4) == 0){
|
|
||||||
mi->m_vehicleClass = CCarCtrl::BIG;
|
mi->m_vehicleClass = CCarCtrl::BIG;
|
||||||
while(frequency-- > 0)
|
else if(strncmp(vehclass, "taxi", 5) == 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::BIG);
|
|
||||||
}else if(strncmp(vehclass, "taxi", 5) == 0){
|
|
||||||
mi->m_vehicleClass = CCarCtrl::TAXI;
|
mi->m_vehicleClass = CCarCtrl::TAXI;
|
||||||
while(frequency-- > 0)
|
else if(strncmp(vehclass, "moped", 6) == 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::TAXI);
|
|
||||||
}else if(strncmp(vehclass, "moped", 6) == 0){
|
|
||||||
mi->m_vehicleClass = CCarCtrl::MOPED;
|
mi->m_vehicleClass = CCarCtrl::MOPED;
|
||||||
while(frequency-- > 0)
|
else if(strncmp(vehclass, "motorbike", 10) == 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::MOPED);
|
|
||||||
}else if(strncmp(vehclass, "motorbike", 10) == 0){
|
|
||||||
mi->m_vehicleClass = CCarCtrl::MOTORBIKE;
|
mi->m_vehicleClass = CCarCtrl::MOTORBIKE;
|
||||||
while(frequency-- > 0)
|
else if(strncmp(vehclass, "leisureboat", 12) == 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::MOTORBIKE);
|
|
||||||
}else if(strncmp(vehclass, "leisureboat", 12) == 0){
|
|
||||||
mi->m_vehicleClass = CCarCtrl::LEISUREBOAT;
|
mi->m_vehicleClass = CCarCtrl::LEISUREBOAT;
|
||||||
while(frequency-- > 0)
|
else if(strncmp(vehclass, "workerboat", 11) == 0)
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::LEISUREBOAT);
|
|
||||||
}else if(strncmp(vehclass, "workerboat", 11) == 0){
|
|
||||||
mi->m_vehicleClass = CCarCtrl::WORKERBOAT;
|
mi->m_vehicleClass = CCarCtrl::WORKERBOAT;
|
||||||
while(frequency-- > 0)
|
else if(strncmp(vehclass, "ignore", 11) == 0){
|
||||||
CCarCtrl::AddToCarArray(id, CCarCtrl::WORKERBOAT);
|
|
||||||
}else if(strncmp(vehclass, "ignore", 11) == 0){
|
|
||||||
mi->m_vehicleClass = -1;
|
mi->m_vehicleClass = -1;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
CCarCtrl::AddToCarArray(id, mi->m_vehicleClass);
|
||||||
|
mi->m_frequency = frequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1305,6 +1305,7 @@ if(model < 0)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--MIAMI: TODO
|
||||||
void
|
void
|
||||||
CStreaming::StreamZoneModels(const CVector &pos)
|
CStreaming::StreamZoneModels(const CVector &pos)
|
||||||
{
|
{
|
||||||
@ -1318,7 +1319,7 @@ CStreaming::StreamZoneModels(const CVector &pos)
|
|||||||
|
|
||||||
// unload pevious group
|
// unload pevious group
|
||||||
if(ms_currentPedGrp != -1)
|
if(ms_currentPedGrp != -1)
|
||||||
for(i = 0; i < 8; i++){
|
for(i = 0; i < NUMMODELSPERPEDGROUP; i++){
|
||||||
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
|
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
|
||||||
break;
|
break;
|
||||||
SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
|
SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]);
|
||||||
@ -1327,7 +1328,7 @@ CStreaming::StreamZoneModels(const CVector &pos)
|
|||||||
|
|
||||||
ms_currentPedGrp = info.pedGroup;
|
ms_currentPedGrp = info.pedGroup;
|
||||||
|
|
||||||
for(i = 0; i < 8; i++){
|
for(i = 0; i < NUMMODELSPERPEDGROUP; i++){
|
||||||
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
|
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
|
||||||
break;
|
break;
|
||||||
RequestModel(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i], STREAMFLAGS_DONT_REMOVE);
|
RequestModel(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i], STREAMFLAGS_DONT_REMOVE);
|
||||||
@ -1337,29 +1338,20 @@ CStreaming::StreamZoneModels(const CVector &pos)
|
|||||||
|
|
||||||
gangsToLoad = 0;
|
gangsToLoad = 0;
|
||||||
gangCarsToLoad = 0;
|
gangCarsToLoad = 0;
|
||||||
if(info.gangDensity[0] != 0) gangsToLoad |= 1<<0;
|
if(info.gangPedThreshold[0] != info.copPedThreshold)
|
||||||
if(info.gangDensity[1] != 0) gangsToLoad |= 1<<1;
|
gangsToLoad = 1;
|
||||||
if(info.gangDensity[2] != 0) gangsToLoad |= 1<<2;
|
for(i = 1; i < NUM_GANGS; i++)
|
||||||
if(info.gangDensity[3] != 0) gangsToLoad |= 1<<3;
|
if(info.gangPedThreshold[i] != info.gangPedThreshold[i-1])
|
||||||
if(info.gangDensity[4] != 0) gangsToLoad |= 1<<4;
|
gangsToLoad |= 1<<i;
|
||||||
if(info.gangDensity[5] != 0) gangsToLoad |= 1<<5;
|
if(info.gangThreshold[0] != info.copThreshold)
|
||||||
if(info.gangDensity[6] != 0) gangsToLoad |= 1<<6;
|
gangCarsToLoad = 1;
|
||||||
if(info.gangDensity[7] != 0) gangsToLoad |= 1<<7;
|
for(i = 1; i < NUM_GANGS; i++)
|
||||||
if(info.gangDensity[8] != 0) gangsToLoad |= 1<<8;
|
if(info.gangThreshold[i] != info.gangThreshold[i-1])
|
||||||
if(info.gangThreshold[0] != info.copDensity) gangCarsToLoad |= 1<<0;
|
gangCarsToLoad |= 1<<i;
|
||||||
if(info.gangThreshold[1] != info.gangThreshold[0]) gangCarsToLoad |= 1<<1;
|
|
||||||
if(info.gangThreshold[2] != info.gangThreshold[1]) gangCarsToLoad |= 1<<2;
|
|
||||||
if(info.gangThreshold[3] != info.gangThreshold[2]) gangCarsToLoad |= 1<<3;
|
|
||||||
if(info.gangThreshold[4] != info.gangThreshold[3]) gangCarsToLoad |= 1<<4;
|
|
||||||
if(info.gangThreshold[5] != info.gangThreshold[4]) gangCarsToLoad |= 1<<5;
|
|
||||||
if(info.gangThreshold[6] != info.gangThreshold[5]) gangCarsToLoad |= 1<<6;
|
|
||||||
if(info.gangThreshold[7] != info.gangThreshold[6]) gangCarsToLoad |= 1<<7;
|
|
||||||
if(info.gangThreshold[8] != info.gangThreshold[7]) gangCarsToLoad |= 1<<8;
|
|
||||||
|
|
||||||
if(gangsToLoad == ms_loadedGangs && gangCarsToLoad == ms_loadedGangCars)
|
if(gangsToLoad == ms_loadedGangs && gangCarsToLoad == ms_loadedGangCars)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// This makes things simpler than the game does it
|
|
||||||
gangsToLoad |= gangCarsToLoad;
|
gangsToLoad |= gangCarsToLoad;
|
||||||
|
|
||||||
for(i = 0; i < NUM_GANGS; i++){
|
for(i = 0; i < NUM_GANGS; i++){
|
||||||
@ -1397,7 +1389,7 @@ CStreaming::RemoveCurrentZonesModels(void)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
if(ms_currentPedGrp != -1)
|
if(ms_currentPedGrp != -1)
|
||||||
for(i = 0; i < 8; i++){
|
for(i = 0; i < NUMMODELSPERPEDGROUP; i++){
|
||||||
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
|
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] == -1)
|
||||||
break;
|
break;
|
||||||
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != MI_MALE01)
|
if(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != MI_MALE01)
|
||||||
|
@ -25,27 +25,6 @@ CZoneInfo CTheZones::ZoneInfoArray[2*NUMINFOZONES];
|
|||||||
|
|
||||||
#define SWAPF(a, b) { float t; t = a; a = b; b = t; }
|
#define SWAPF(a, b) { float t; t = a; a = b; b = t; }
|
||||||
|
|
||||||
static void
|
|
||||||
CheckZoneInfo(CZoneInfo *info)
|
|
||||||
{
|
|
||||||
assert(info->carThreshold[0] >= 0);
|
|
||||||
assert(info->carThreshold[0] <= info->carThreshold[1]);
|
|
||||||
assert(info->carThreshold[1] <= info->carThreshold[2]);
|
|
||||||
assert(info->carThreshold[2] <= info->carThreshold[3]);
|
|
||||||
assert(info->carThreshold[3] <= info->carThreshold[4]);
|
|
||||||
assert(info->carThreshold[4] <= info->carThreshold[5]);
|
|
||||||
assert(info->carThreshold[5] <= info->copThreshold);
|
|
||||||
assert(info->copThreshold <= info->gangThreshold[0]);
|
|
||||||
assert(info->gangThreshold[0] <= info->gangThreshold[1]);
|
|
||||||
assert(info->gangThreshold[1] <= info->gangThreshold[2]);
|
|
||||||
assert(info->gangThreshold[2] <= info->gangThreshold[3]);
|
|
||||||
assert(info->gangThreshold[3] <= info->gangThreshold[4]);
|
|
||||||
assert(info->gangThreshold[4] <= info->gangThreshold[5]);
|
|
||||||
assert(info->gangThreshold[5] <= info->gangThreshold[6]);
|
|
||||||
assert(info->gangThreshold[6] <= info->gangThreshold[7]);
|
|
||||||
assert(info->gangThreshold[7] <= info->gangThreshold[8]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//--MIAMI: done
|
//--MIAMI: done
|
||||||
wchar*
|
wchar*
|
||||||
CZone::GetTranslatedName(void)
|
CZone::GetTranslatedName(void)
|
||||||
@ -53,11 +32,11 @@ CZone::GetTranslatedName(void)
|
|||||||
return TheText.Get(name);
|
return TheText.Get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: check out zoneinfo
|
//--MIAMI: done
|
||||||
void
|
void
|
||||||
CTheZones::Init(void)
|
CTheZones::Init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i, j;
|
||||||
for(i = 0; i < NUMAUDIOZONES; i++)
|
for(i = 0; i < NUMAUDIOZONES; i++)
|
||||||
AudioZoneArray[i] = -1;
|
AudioZoneArray[i] = -1;
|
||||||
NumberOfAudioZones = 0;
|
NumberOfAudioZones = 0;
|
||||||
@ -69,27 +48,39 @@ CTheZones::Init(void)
|
|||||||
memset(&InfoZoneArray[i], 0, sizeof(CZone));
|
memset(&InfoZoneArray[i], 0, sizeof(CZone));
|
||||||
|
|
||||||
CZoneInfo *zonei;
|
CZoneInfo *zonei;
|
||||||
int x = 1000/6;
|
int x = 1000/9;
|
||||||
for(i = 0; i < 2*NUMINFOZONES; i++){
|
for(i = 0; i < 2*NUMINFOZONES; i++){
|
||||||
zonei = &ZoneInfoArray[i];
|
// Cars
|
||||||
zonei->carDensity = 10;
|
|
||||||
zonei->carThreshold[0] = x;
|
ZoneInfoArray[i].carDensity = 10;
|
||||||
zonei->carThreshold[1] = zonei->carThreshold[0] + x;
|
ZoneInfoArray[i].carThreshold[0] = x;
|
||||||
zonei->carThreshold[2] = zonei->carThreshold[1] + x;
|
ZoneInfoArray[i].carThreshold[1] = ZoneInfoArray[i].carThreshold[0] + x;
|
||||||
zonei->carThreshold[3] = zonei->carThreshold[2] + x;
|
ZoneInfoArray[i].carThreshold[2] = ZoneInfoArray[i].carThreshold[1] + x;
|
||||||
zonei->carThreshold[4] = zonei->carThreshold[3];
|
ZoneInfoArray[i].carThreshold[3] = ZoneInfoArray[i].carThreshold[2] + x;
|
||||||
zonei->carThreshold[5] = zonei->carThreshold[4];
|
ZoneInfoArray[i].carThreshold[4] = ZoneInfoArray[i].carThreshold[3] + x;
|
||||||
zonei->copThreshold = zonei->carThreshold[5] + x;
|
ZoneInfoArray[i].carThreshold[5] = ZoneInfoArray[i].carThreshold[4] + x;
|
||||||
zonei->gangThreshold[0] = zonei->copThreshold;
|
ZoneInfoArray[i].carThreshold[6] = ZoneInfoArray[i].carThreshold[5] + x;
|
||||||
zonei->gangThreshold[1] = zonei->gangThreshold[0];
|
ZoneInfoArray[i].carThreshold[7] = ZoneInfoArray[i].carThreshold[6] + x;
|
||||||
zonei->gangThreshold[2] = zonei->gangThreshold[1];
|
ZoneInfoArray[i].carThreshold[8] = 1000;
|
||||||
zonei->gangThreshold[3] = zonei->gangThreshold[2];
|
|
||||||
zonei->gangThreshold[4] = zonei->gangThreshold[3];
|
ZoneInfoArray[i].boatThreshold[0] = 500;
|
||||||
zonei->gangThreshold[5] = zonei->gangThreshold[4];
|
ZoneInfoArray[i].boatThreshold[1] = 1000;
|
||||||
zonei->gangThreshold[6] = zonei->gangThreshold[5];
|
|
||||||
zonei->gangThreshold[7] = zonei->gangThreshold[6];
|
// What's going on here? this looks more like density
|
||||||
zonei->gangThreshold[8] = zonei->gangThreshold[7];
|
ZoneInfoArray[i].copThreshold = 50;
|
||||||
CheckZoneInfo(zonei);
|
for(j = 0; j < NUM_GANGS; j++)
|
||||||
|
ZoneInfoArray[i].gangThreshold[j] = ZoneInfoArray[i].copThreshold;
|
||||||
|
|
||||||
|
// Peds
|
||||||
|
|
||||||
|
ZoneInfoArray[i].pedDensity = 12;
|
||||||
|
|
||||||
|
// What's going on here? this looks more like density
|
||||||
|
ZoneInfoArray[i].copPedThreshold = 50;
|
||||||
|
for(j = 0; j < NUM_GANGS; j++)
|
||||||
|
ZoneInfoArray[i].gangPedThreshold[j] = ZoneInfoArray[i].copPedThreshold;
|
||||||
|
|
||||||
|
ZoneInfoArray[i].pedGroup = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TotalNumberOfZoneInfos = 1; // why 1?
|
TotalNumberOfZoneInfos = 1; // why 1?
|
||||||
@ -450,6 +441,7 @@ CTheZones::GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info)
|
|||||||
{
|
{
|
||||||
CZoneInfo *day, *night;
|
CZoneInfo *day, *night;
|
||||||
float d, n;
|
float d, n;
|
||||||
|
int i;
|
||||||
|
|
||||||
day = GetZoneInfo(pos, 1);
|
day = GetZoneInfo(pos, 1);
|
||||||
night = GetZoneInfo(pos, 0);
|
night = GetZoneInfo(pos, 0);
|
||||||
@ -469,109 +461,45 @@ CTheZones::GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info)
|
|||||||
n = 1.0f - d;
|
n = 1.0f - d;
|
||||||
}
|
}
|
||||||
info->carDensity = day->carDensity * d + night->carDensity * n;
|
info->carDensity = day->carDensity * d + night->carDensity * n;
|
||||||
info->carThreshold[0] = day->carThreshold[0] * d + night->carThreshold[0] * n;
|
for(i = 0; i < ARRAY_SIZE(info->carThreshold); i++)
|
||||||
info->carThreshold[1] = day->carThreshold[1] * d + night->carThreshold[1] * n;
|
info->carThreshold[i] = day->carThreshold[i] * d + night->carThreshold[i] * n;
|
||||||
info->carThreshold[2] = day->carThreshold[2] * d + night->carThreshold[2] * n;
|
for(i = 0; i < ARRAY_SIZE(info->boatThreshold); i++)
|
||||||
info->carThreshold[3] = day->carThreshold[3] * d + night->carThreshold[3] * n;
|
info->boatThreshold[i] = day->boatThreshold[i] * d + night->boatThreshold[i] * n;
|
||||||
info->carThreshold[4] = day->carThreshold[4] * d + night->carThreshold[4] * n;
|
for(i = 0; i < ARRAY_SIZE(info->gangThreshold); i++)
|
||||||
info->carThreshold[5] = day->carThreshold[5] * d + night->carThreshold[5] * n;
|
info->gangThreshold[i] = day->gangThreshold[i] * d + night->gangThreshold[i] * n;
|
||||||
info->copThreshold = day->copThreshold * d + night->copThreshold * n;
|
|
||||||
info->gangThreshold[0] = day->gangThreshold[0] * d + night->gangThreshold[0] * n;
|
|
||||||
info->gangThreshold[1] = day->gangThreshold[1] * d + night->gangThreshold[1] * n;
|
|
||||||
info->gangThreshold[2] = day->gangThreshold[2] * d + night->gangThreshold[2] * n;
|
|
||||||
info->gangThreshold[3] = day->gangThreshold[3] * d + night->gangThreshold[3] * n;
|
|
||||||
info->gangThreshold[4] = day->gangThreshold[4] * d + night->gangThreshold[4] * n;
|
|
||||||
info->gangThreshold[5] = day->gangThreshold[5] * d + night->gangThreshold[5] * n;
|
|
||||||
info->gangThreshold[6] = day->gangThreshold[6] * d + night->gangThreshold[6] * n;
|
|
||||||
info->gangThreshold[7] = day->gangThreshold[7] * d + night->gangThreshold[7] * n;
|
|
||||||
info->gangThreshold[8] = day->gangThreshold[8] * d + night->gangThreshold[8] * n;
|
|
||||||
|
|
||||||
|
info->copThreshold = day->copThreshold * d + night->copThreshold * n;
|
||||||
info->pedDensity = day->pedDensity * d + night->pedDensity * n;
|
info->pedDensity = day->pedDensity * d + night->pedDensity * n;
|
||||||
info->copDensity = day->copDensity * d + night->copDensity * n;
|
info->copPedThreshold = day->copPedThreshold * d + night->copPedThreshold * n;
|
||||||
info->gangDensity[0] = day->gangDensity[0] * d + night->gangDensity[0] * n;
|
for(i = 0; i < ARRAY_SIZE(info->gangPedThreshold); i++)
|
||||||
info->gangDensity[1] = day->gangDensity[1] * d + night->gangDensity[1] * n;
|
info->gangPedThreshold[i] = day->gangPedThreshold[i] * d + night->gangPedThreshold[i] * n;
|
||||||
info->gangDensity[2] = day->gangDensity[2] * d + night->gangDensity[2] * n;
|
|
||||||
info->gangDensity[3] = day->gangDensity[3] * d + night->gangDensity[3] * n;
|
|
||||||
info->gangDensity[4] = day->gangDensity[4] * d + night->gangDensity[4] * n;
|
|
||||||
info->gangDensity[5] = day->gangDensity[5] * d + night->gangDensity[5] * n;
|
|
||||||
info->gangDensity[6] = day->gangDensity[6] * d + night->gangDensity[6] * n;
|
|
||||||
info->gangDensity[7] = day->gangDensity[7] * d + night->gangDensity[7] * n;
|
|
||||||
info->gangDensity[8] = day->gangDensity[8] * d + night->gangDensity[8] * n;
|
|
||||||
}
|
}
|
||||||
if(CClock::GetIsTimeInRange(5, 19))
|
if(CClock::GetIsTimeInRange(5, 19))
|
||||||
info->pedGroup = day->pedGroup;
|
info->pedGroup = day->pedGroup;
|
||||||
else
|
else
|
||||||
info->pedGroup = night->pedGroup;
|
info->pedGroup = night->pedGroup;
|
||||||
|
|
||||||
CheckZoneInfo(info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CTheZones::SetZoneCarInfo(uint16 zoneid, uint8 day, int16 carDensity,
|
CTheZones::SetZoneCarInfo(uint16 zoneid, uint8 day, int16 carDensity,
|
||||||
int16 gang0Num, int16 gang1Num, int16 gang2Num,
|
int16 copCarDensity, const int16 *gangCarDensities)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
CZone *zone;
|
CZone *zone;
|
||||||
CZoneInfo *info;
|
CZoneInfo *info;
|
||||||
zone = GetInfoZone(zoneid);
|
zone = GetInfoZone(zoneid);
|
||||||
info = &ZoneInfoArray[day ? zone->zoneinfoDay : zone->zoneinfoNight];
|
info = &ZoneInfoArray[day ? zone->zoneinfoDay : zone->zoneinfoNight];
|
||||||
|
|
||||||
CheckZoneInfo(info);
|
info->carDensity = carDensity;
|
||||||
|
info->copThreshold = copCarDensity;
|
||||||
if(carDensity != -1) info->carDensity = carDensity;
|
info->gangThreshold[0] = gangCarDensities[0] + copCarDensity;
|
||||||
int16 oldCar1Num = info->carThreshold[1] - info->carThreshold[0];
|
info->gangThreshold[1] = gangCarDensities[1] + info->gangThreshold[0];
|
||||||
int16 oldCar2Num = info->carThreshold[2] - info->carThreshold[1];
|
info->gangThreshold[2] = gangCarDensities[2] + info->gangThreshold[1];
|
||||||
int16 oldCar3Num = info->carThreshold[3] - info->carThreshold[2];
|
info->gangThreshold[3] = gangCarDensities[3] + info->gangThreshold[2];
|
||||||
int16 oldCar4Num = info->carThreshold[4] - info->carThreshold[3];
|
info->gangThreshold[4] = gangCarDensities[4] + info->gangThreshold[3];
|
||||||
int16 oldCar5Num = info->carThreshold[5] - info->carThreshold[4];
|
info->gangThreshold[5] = gangCarDensities[5] + info->gangThreshold[4];
|
||||||
int16 oldCopNum = info->copThreshold - info->carThreshold[5];
|
info->gangThreshold[6] = gangCarDensities[6] + info->gangThreshold[5];
|
||||||
int16 oldGang0Num = info->gangThreshold[0] - info->copThreshold;
|
info->gangThreshold[7] = gangCarDensities[7] + info->gangThreshold[6];
|
||||||
int16 oldGang1Num = info->gangThreshold[1] - info->gangThreshold[0];
|
info->gangThreshold[8] = gangCarDensities[8] + info->gangThreshold[7];
|
||||||
int16 oldGang2Num = info->gangThreshold[2] - info->gangThreshold[1];
|
|
||||||
int16 oldGang3Num = info->gangThreshold[3] - info->gangThreshold[2];
|
|
||||||
int16 oldGang4Num = info->gangThreshold[4] - info->gangThreshold[3];
|
|
||||||
int16 oldGang5Num = info->gangThreshold[5] - info->gangThreshold[4];
|
|
||||||
int16 oldGang6Num = info->gangThreshold[6] - info->gangThreshold[5];
|
|
||||||
int16 oldGang7Num = info->gangThreshold[7] - info->gangThreshold[6];
|
|
||||||
int16 oldGang8Num = info->gangThreshold[8] - info->gangThreshold[7];
|
|
||||||
|
|
||||||
if(car0Num != -1) info->carThreshold[0] = car0Num;
|
|
||||||
if(car1Num != -1) info->carThreshold[1] = info->carThreshold[0] + car1Num;
|
|
||||||
else info->carThreshold[1] = info->carThreshold[0] + oldCar1Num;
|
|
||||||
if(car2Num != -1) info->carThreshold[2] = info->carThreshold[1] + car2Num;
|
|
||||||
else info->carThreshold[2] = info->carThreshold[1] + oldCar2Num;
|
|
||||||
if(car3Num != -1) info->carThreshold[3] = info->carThreshold[2] + car3Num;
|
|
||||||
else info->carThreshold[3] = info->carThreshold[2] + oldCar3Num;
|
|
||||||
if(car4Num != -1) info->carThreshold[4] = info->carThreshold[3] + car4Num;
|
|
||||||
else info->carThreshold[4] = info->carThreshold[3] + oldCar4Num;
|
|
||||||
if(car5Num != -1) info->carThreshold[5] = info->carThreshold[4] + car5Num;
|
|
||||||
else info->carThreshold[5] = info->carThreshold[4] + oldCar5Num;
|
|
||||||
if(copNum != -1) info->copThreshold = info->carThreshold[5] + copNum;
|
|
||||||
else info->copThreshold = info->carThreshold[5] + oldCopNum;
|
|
||||||
if(gang0Num != -1) info->gangThreshold[0] = info->copThreshold + gang0Num;
|
|
||||||
else info->gangThreshold[0] = info->copThreshold + oldGang0Num;
|
|
||||||
if(gang1Num != -1) info->gangThreshold[1] = info->gangThreshold[0] + gang1Num;
|
|
||||||
else info->gangThreshold[1] = info->gangThreshold[0] + oldGang1Num;
|
|
||||||
if(gang2Num != -1) info->gangThreshold[2] = info->gangThreshold[1] + gang2Num;
|
|
||||||
else info->gangThreshold[2] = info->gangThreshold[1] + oldGang2Num;
|
|
||||||
if(gang3Num != -1) info->gangThreshold[3] = info->gangThreshold[2] + gang3Num;
|
|
||||||
else info->gangThreshold[3] = info->gangThreshold[2] + oldGang3Num;
|
|
||||||
if(gang4Num != -1) info->gangThreshold[4] = info->gangThreshold[3] + gang4Num;
|
|
||||||
else info->gangThreshold[4] = info->gangThreshold[3] + oldGang4Num;
|
|
||||||
if(gang5Num != -1) info->gangThreshold[5] = info->gangThreshold[4] + gang5Num;
|
|
||||||
else info->gangThreshold[5] = info->gangThreshold[4] + oldGang5Num;
|
|
||||||
if(gang6Num != -1) info->gangThreshold[6] = info->gangThreshold[5] + gang6Num;
|
|
||||||
else info->gangThreshold[6] = info->gangThreshold[5] + oldGang6Num;
|
|
||||||
if(gang7Num != -1) info->gangThreshold[7] = info->gangThreshold[6] + gang7Num;
|
|
||||||
else info->gangThreshold[7] = info->gangThreshold[6] + oldGang7Num;
|
|
||||||
if(gang8Num != -1) info->gangThreshold[8] = info->gangThreshold[7] + gang8Num;
|
|
||||||
else info->gangThreshold[8] = info->gangThreshold[7] + oldGang8Num;
|
|
||||||
|
|
||||||
CheckZoneInfo(info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -584,17 +512,27 @@ CTheZones::SetZonePedInfo(uint16 zoneid, uint8 day, int16 pedDensity,
|
|||||||
CZoneInfo *info;
|
CZoneInfo *info;
|
||||||
zone = GetInfoZone(zoneid);
|
zone = GetInfoZone(zoneid);
|
||||||
info = &ZoneInfoArray[day ? zone->zoneinfoDay : zone->zoneinfoNight];
|
info = &ZoneInfoArray[day ? zone->zoneinfoDay : zone->zoneinfoNight];
|
||||||
if(pedDensity != -1) info->pedDensity = pedDensity;
|
info->pedDensity = pedDensity;
|
||||||
if(copDensity != -1) info->copDensity = copDensity;
|
info->copPedThreshold = copDensity;
|
||||||
if(gang0Density != -1) info->gangDensity[0] = gang0Density;
|
info->gangPedThreshold[0] = gang0Density;
|
||||||
if(gang1Density != -1) info->gangDensity[1] = gang1Density;
|
info->gangPedThreshold[1] = gang1Density;
|
||||||
if(gang2Density != -1) info->gangDensity[2] = gang2Density;
|
info->gangPedThreshold[2] = gang2Density;
|
||||||
if(gang3Density != -1) info->gangDensity[3] = gang3Density;
|
info->gangPedThreshold[3] = gang3Density;
|
||||||
if(gang4Density != -1) info->gangDensity[4] = gang4Density;
|
info->gangPedThreshold[4] = gang4Density;
|
||||||
if(gang5Density != -1) info->gangDensity[5] = gang5Density;
|
info->gangPedThreshold[5] = gang5Density;
|
||||||
if(gang6Density != -1) info->gangDensity[6] = gang6Density;
|
info->gangPedThreshold[6] = gang6Density;
|
||||||
if(gang7Density != -1) info->gangDensity[7] = gang7Density;
|
info->gangPedThreshold[7] = gang7Density;
|
||||||
if(gang8Density != -1) info->gangDensity[8] = gang8Density;
|
info->gangPedThreshold[8] = gang8Density;
|
||||||
|
|
||||||
|
info->gangPedThreshold[0] += info->copPedThreshold;
|
||||||
|
info->gangPedThreshold[1] = info->gangPedThreshold[0];
|
||||||
|
info->gangPedThreshold[2] = info->gangPedThreshold[1];
|
||||||
|
info->gangPedThreshold[3] = info->gangPedThreshold[2];
|
||||||
|
info->gangPedThreshold[4] = info->gangPedThreshold[3];
|
||||||
|
info->gangPedThreshold[5] = info->gangPedThreshold[4];
|
||||||
|
info->gangPedThreshold[6] = info->gangPedThreshold[5];
|
||||||
|
info->gangPedThreshold[7] = info->gangPedThreshold[6];
|
||||||
|
info->gangPedThreshold[8] = info->gangPedThreshold[7];
|
||||||
}
|
}
|
||||||
|
|
||||||
//--MIAMI: done, unused
|
//--MIAMI: done, unused
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Gangs.h"
|
#include "Gangs.h"
|
||||||
|
#include "CarCtrl.h"
|
||||||
|
|
||||||
enum eZoneType
|
enum eZoneType
|
||||||
{
|
{
|
||||||
@ -37,14 +38,15 @@ class CZoneInfo
|
|||||||
public:
|
public:
|
||||||
// Car data
|
// Car data
|
||||||
int16 carDensity;
|
int16 carDensity;
|
||||||
int16 carThreshold[6];
|
int16 carThreshold[CCarCtrl::NUM_CAR_CLASSES];
|
||||||
int16 copThreshold;
|
int16 boatThreshold[CCarCtrl::NUM_BOAT_CLASSES];
|
||||||
int16 gangThreshold[NUM_GANGS];
|
int16 gangThreshold[NUM_GANGS];
|
||||||
|
int16 copThreshold;
|
||||||
|
|
||||||
// Ped data
|
// Ped data
|
||||||
uint16 pedDensity;
|
uint16 pedDensity;
|
||||||
uint16 copDensity;
|
uint16 gangPedThreshold[NUM_GANGS];
|
||||||
uint16 gangDensity[NUM_GANGS];
|
uint16 copPedThreshold;
|
||||||
uint16 pedGroup;
|
uint16 pedGroup;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -90,12 +92,7 @@ public:
|
|||||||
static CZoneInfo *GetZoneInfo(const CVector *v, uint8 day);
|
static CZoneInfo *GetZoneInfo(const CVector *v, uint8 day);
|
||||||
static void GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info);
|
static void GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info);
|
||||||
static void SetZoneCarInfo(uint16 zoneid, uint8 day, int16 carDensity,
|
static void SetZoneCarInfo(uint16 zoneid, uint8 day, int16 carDensity,
|
||||||
int16 gang0Num, int16 gang1Num, int16 gang2Num,
|
int16 copCarDensity, const int16 *gangCarDensities /*[NUMGANGS]*/);
|
||||||
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,
|
static void SetZonePedInfo(uint16 zoneid, uint8 day, int16 pedDensity,
|
||||||
int16 gang0Density, int16 gang1Density, int16 gang2Density, int16 gang3Density,
|
int16 gang0Density, int16 gang1Density, int16 gang2Density, int16 gang3Density,
|
||||||
int16 gang4Density, int16 gang5Density, int16 gang6Density, int16 gang7Density,
|
int16 gang4Density, int16 gang5Density, int16 gang6Density, int16 gang7Density,
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
int32 m_handlingId;
|
int32 m_handlingId;
|
||||||
int32 m_vehicleClass;
|
int32 m_vehicleClass;
|
||||||
int32 m_level;
|
int32 m_level;
|
||||||
|
int16 m_frequency;
|
||||||
CVector m_positions[NUM_VEHICLE_POSITIONS];
|
CVector m_positions[NUM_VEHICLE_POSITIONS];
|
||||||
uint32 m_compRules;
|
uint32 m_compRules;
|
||||||
float m_bikeSteerAngle;
|
float m_bikeSteerAngle;
|
||||||
@ -121,4 +122,3 @@ public:
|
|||||||
static int GetMaximumNumberOfPassengersFromNumberOfDoors(int id);
|
static int GetMaximumNumberOfPassengersFromNumberOfDoors(int id);
|
||||||
static void SetComponentsToUse(int8 c1, int8 c2) { ms_compsToUse[0] = c1; ms_compsToUse[1] = c2; }
|
static void SetComponentsToUse(int8 c1, int8 c2) { ms_compsToUse[0] = c1; ms_compsToUse[1] = c2; }
|
||||||
};
|
};
|
||||||
static_assert(sizeof(CVehicleModelInfo) == 0x1F8, "CVehicleModelInfo: error");
|
|
||||||
|
@ -564,14 +564,12 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree
|
|||||||
|
|
||||||
if (ms_nTotalPeds < maxPossiblePedsForArea || addCop) {
|
if (ms_nTotalPeds < maxPossiblePedsForArea || addCop) {
|
||||||
int decisionThreshold = CGeneral::GetRandomNumberInRange(0, 1000);
|
int decisionThreshold = CGeneral::GetRandomNumberInRange(0, 1000);
|
||||||
if (decisionThreshold < zoneInfo.copDensity || addCop) {
|
if (decisionThreshold < zoneInfo.copPedThreshold || addCop) {
|
||||||
pedTypeToAdd = PEDTYPE_COP;
|
pedTypeToAdd = PEDTYPE_COP;
|
||||||
modelToAdd = ChoosePolicePedOccupation();
|
modelToAdd = ChoosePolicePedOccupation();
|
||||||
} else {
|
} else {
|
||||||
int16 density = zoneInfo.copDensity;
|
|
||||||
for (int i = 0; i < NUM_GANGS; i++) {
|
for (int i = 0; i < NUM_GANGS; i++) {
|
||||||
density += zoneInfo.gangDensity[i];
|
if (decisionThreshold < zoneInfo.gangPedThreshold[i]) {
|
||||||
if (decisionThreshold < density) {
|
|
||||||
pedTypeToAdd = PEDTYPE_GANG1 + i;
|
pedTypeToAdd = PEDTYPE_GANG1 + i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user