summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-07-13 17:10:17 +0200
committerSergeanur <s.anureev@yandex.ua>2020-07-13 17:10:17 +0200
commitd0f5464200be032ee464218cfe415f3ce0b119a7 (patch)
treedd6f068286bb29c72192689bf741c43fcb505ae1 /src/control
parentMerge pull request #654 from erorcun/miami (diff)
parentRename LEVEL_NONE to LEVEL_GENERIC (diff)
downloadre3-d0f5464200be032ee464218cfe415f3ce0b119a7.tar
re3-d0f5464200be032ee464218cfe415f3ce0b119a7.tar.gz
re3-d0f5464200be032ee464218cfe415f3ce0b119a7.tar.bz2
re3-d0f5464200be032ee464218cfe415f3ce0b119a7.tar.lz
re3-d0f5464200be032ee464218cfe415f3ce0b119a7.tar.xz
re3-d0f5464200be032ee464218cfe415f3ce0b119a7.tar.zst
re3-d0f5464200be032ee464218cfe415f3ce0b119a7.zip
Diffstat (limited to 'src/control')
-rw-r--r--src/control/GameLogic.cpp12
-rw-r--r--src/control/Phones.cpp1
-rw-r--r--src/control/Replay.cpp6
-rw-r--r--src/control/Restart.cpp8
-rw-r--r--src/control/Script.cpp18
5 files changed, 28 insertions, 17 deletions
diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp
index af1680ae..2af9464c 100644
--- a/src/control/GameLogic.cpp
+++ b/src/control/GameLogic.cpp
@@ -155,8 +155,8 @@ CGameLogic::Update()
CCarCtrl::ClearInterestingVehicleList();
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
CRestart::FindClosestHospitalRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
- CRestart::OverrideHospitalLevel = LEVEL_NONE;
- CRestart::OverridePoliceStationLevel = LEVEL_NONE;
+ CRestart::OverrideHospitalLevel = LEVEL_GENERIC;
+ CRestart::OverridePoliceStationLevel = LEVEL_GENERIC;
PassTime(720);
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
AfterDeathArrestSetUpShortCutTaxi();
@@ -261,8 +261,8 @@ CGameLogic::Update()
CCarCtrl::ClearInterestingVehicleList();
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
- CRestart::OverrideHospitalLevel = LEVEL_NONE;
- CRestart::OverridePoliceStationLevel = LEVEL_NONE;
+ CRestart::OverrideHospitalLevel = LEVEL_GENERIC;
+ CRestart::OverridePoliceStationLevel = LEVEL_GENERIC;
PassTime(720);
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
AfterDeathArrestSetUpShortCutTaxi();
@@ -313,8 +313,8 @@ CGameLogic::Update()
CCarCtrl::ClearInterestingVehicleList();
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
- CRestart::OverridePoliceStationLevel = LEVEL_NONE;
- CRestart::OverrideHospitalLevel = LEVEL_NONE;
+ CRestart::OverridePoliceStationLevel = LEVEL_GENERIC;
+ CRestart::OverrideHospitalLevel = LEVEL_GENERIC;
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
TheCamera.m_fCamShakeForce = 0.0f;
diff --git a/src/control/Phones.cpp b/src/control/Phones.cpp
index 4f1703f2..71f6c8e5 100644
--- a/src/control/Phones.cpp
+++ b/src/control/Phones.cpp
@@ -284,6 +284,7 @@ CPhoneInfo::Initialise(void)
CBuilding *building = pool->GetSlot(i);
if (building) {
if (building->GetModelIndex() == MI_PHONEBOOTH1) {
+ assert(m_nMax < ARRAY_SIZE(m_aPhones) && "NUMPHONES should be increased");
CPhone *maxPhone = &m_aPhones[m_nMax];
maxPhone->m_nState = PHONE_STATE_FREE;
maxPhone->m_vecPos = building->GetPosition();
diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp
index 4407254c..8b34cc3b 100644
--- a/src/control/Replay.cpp
+++ b/src/control/Replay.cpp
@@ -170,7 +170,7 @@ static void ApplyPanelDamageToCar(uint32 panels, CAutomobile* vehicle, bool flyi
void PrintElementsInPtrList(void)
{
- for (CPtrNode* node = CWorld::GetBigBuildingList(LEVEL_NONE).first; node; node = node->next) {
+ for (CPtrNode* node = CWorld::GetBigBuildingList(LEVEL_GENERIC).first; node; node = node->next) {
/* Most likely debug print was present here */
}
}
@@ -1143,7 +1143,7 @@ void CReplay::StoreStuffInMem(void)
pWorld1 = new uint8[sizeof(CSector) * NUMSECTORS_X * NUMSECTORS_Y];
memcpy(pWorld1, CWorld::GetSector(0, 0), NUMSECTORS_X * NUMSECTORS_Y * sizeof(CSector));
WorldPtrList = CWorld::GetMovingEntityList().first; // why
- BigBuildingPtrList = CWorld::GetBigBuildingList(LEVEL_NONE).first;
+ BigBuildingPtrList = CWorld::GetBigBuildingList(LEVEL_GENERIC).first;
pPickups = new uint8[sizeof(CPickup) * NUMPICKUPS];
memcpy(pPickups, CPickups::aPickUps, NUMPICKUPS * sizeof(CPickup));
pReferences = new uint8[(sizeof(CReference) * NUMREFERENCES)];
@@ -1189,7 +1189,7 @@ void CReplay::RestoreStuffFromMem(void)
delete[] pWorld1;
pWorld1 = nil;
CWorld::GetMovingEntityList().first = WorldPtrList;
- CWorld::GetBigBuildingList(LEVEL_NONE).first = BigBuildingPtrList;
+ CWorld::GetBigBuildingList(LEVEL_GENERIC).first = BigBuildingPtrList;
memcpy(CPickups::aPickUps, pPickups, sizeof(CPickup) * NUMPICKUPS);
delete[] pPickups;
pPickups = nil;
diff --git a/src/control/Restart.cpp b/src/control/Restart.cpp
index 64cabf5d..8fa018d6 100644
--- a/src/control/Restart.cpp
+++ b/src/control/Restart.cpp
@@ -24,8 +24,8 @@ uint16 CRestart::NumberOfPoliceRestarts;
void
CRestart::Initialise()
{
- OverridePoliceStationLevel = LEVEL_NONE;
- OverrideHospitalLevel = LEVEL_NONE;
+ OverridePoliceStationLevel = LEVEL_GENERIC;
+ OverrideHospitalLevel = LEVEL_GENERIC;
bFadeInAfterNextArrest = true;
bFadeInAfterNextDeath = true;
OverrideHeading = 0.0f;
@@ -86,7 +86,7 @@ CRestart::FindClosestHospitalRestartPoint(const CVector &pos, CVector *outPos, f
// find closest point on this level
for (int i = 0; i < NumberOfHospitalRestarts; i++) {
- if (CTheZones::GetLevelFromPosition(&HospitalRestartPoints[i]) == (OverrideHospitalLevel != LEVEL_NONE ? OverrideHospitalLevel : curlevel)) {
+ if (CTheZones::GetLevelFromPosition(&HospitalRestartPoints[i]) == (OverrideHospitalLevel != LEVEL_GENERIC ? OverrideHospitalLevel : curlevel)) {
float dist = (pos - HospitalRestartPoints[i]).MagnitudeSqr();
if (fMinDist >= dist) {
fMinDist = dist;
@@ -133,7 +133,7 @@ CRestart::FindClosestPoliceRestartPoint(const CVector &pos, CVector *outPos, flo
// find closest point on this level
for (int i = 0; i < NumberOfPoliceRestarts; i++) {
- if (CTheZones::GetLevelFromPosition(&PoliceRestartPoints[i]) == (OverridePoliceStationLevel != LEVEL_NONE ? OverridePoliceStationLevel : curlevel)) {
+ if (CTheZones::GetLevelFromPosition(&PoliceRestartPoints[i]) == (OverridePoliceStationLevel != LEVEL_GENERIC ? OverridePoliceStationLevel : curlevel)) {
float dist = (pos - PoliceRestartPoints[i]).MagnitudeSqr();
if (fMinDist >= dist) {
fMinDist = dist;
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 9407cc06..afc4fecb 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -9143,7 +9143,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
CEntity* apEntities[16];
CWorld::FindObjectsOfTypeInRange(mi, pos, range, true, &total, 16, apEntities, true, false, false, true, true);
if (total == 0)
- CWorld::FindObjectsOfTypeInRangeSectorList(mi, CWorld::GetBigBuildingList(LEVEL_NONE), pos, range, true, &total, 16, apEntities);
+ CWorld::FindObjectsOfTypeInRangeSectorList(mi, CWorld::GetBigBuildingList(LEVEL_GENERIC), pos, range, true, &total, 16, apEntities);
if (total == 0)
CWorld::FindObjectsOfTypeInRangeSectorList(mi, CWorld::GetBigBuildingList(CTheZones::GetLevelFromPosition(&pos)), pos, range, true, &total, 16, apEntities);
CEntity* pClosestEntity = nil;
@@ -9933,7 +9933,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
CEntity* apEntities[16];
CWorld::FindObjectsOfTypeInRange(mi1, pos, radius, true, &total, 16, apEntities, true, false, false, false, false);
if (total == 0)
- CWorld::FindObjectsOfTypeInRangeSectorList(mi1, CWorld::GetBigBuildingList(LEVEL_NONE), pos, radius, true, &total, 16, apEntities);
+ CWorld::FindObjectsOfTypeInRangeSectorList(mi1, CWorld::GetBigBuildingList(LEVEL_GENERIC), pos, radius, true, &total, 16, apEntities);
if (total == 0)
CWorld::FindObjectsOfTypeInRangeSectorList(mi1, CWorld::GetBigBuildingList(CTheZones::GetLevelFromPosition(&pos)), pos, radius, true, &total, 16, apEntities);
CEntity* pClosestEntity = nil;
@@ -10593,11 +10593,15 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CollectParameters(&m_nIp, 1);
CTimer::Stop();
CGame::currLevel = (eLevelName)ScriptParams[0];
+#ifndef NO_ISLAND_LOADING
CStreaming::RemoveUnusedBigBuildings(CGame::currLevel);
CStreaming::RemoveUnusedBuildings(CGame::currLevel);
+#endif
CCollision::SortOutCollisionAfterLoad();
+#ifndef NO_ISLAND_LOADING
CStreaming::RequestIslands(CGame::currLevel);
CStreaming::LoadAllRequestedModels(true);
+#endif
CTimer::Update();
return 0;
}
@@ -10626,7 +10630,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
if (ScriptParams[1])
pVehicle->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pVehicle->GetPosition());
else
- pVehicle->m_nZoneLevel = LEVEL_NONE;
+ pVehicle->m_nZoneLevel = LEVEL_GENERIC;
return 0;
}
case COMMAND_SET_CHAR_STAYS_IN_CURRENT_LEVEL:
@@ -10637,7 +10641,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
if (ScriptParams[1])
pPed->m_nZoneLevel = CTheZones::GetLevelFromPosition(&pPed->GetPosition());
else
- pPed->m_nZoneLevel = LEVEL_NONE;
+ pPed->m_nZoneLevel = LEVEL_GENERIC;
return 0;
}
*/
@@ -11275,18 +11279,24 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
CTimer::Stop();
CGame::currLevel = (eLevelName)ScriptParams[0];
if (CGame::currLevel != CCollision::ms_collisionInMemory) {
+#ifndef NO_ISLAND_LOADING
DMAudio.SetEffectsFadeVol(0);
CPad::StopPadsShaking();
CCollision::LoadCollisionScreen(CGame::currLevel);
DMAudio.Service();
+#endif
CPopulation::DealWithZoneChange(CCollision::ms_collisionInMemory, CGame::currLevel, false);
+#ifndef NO_ISLAND_LOADING
CStreaming::RemoveUnusedBigBuildings(CGame::currLevel);
CStreaming::RemoveUnusedBuildings(CGame::currLevel);
+#endif
CCollision::SortOutCollisionAfterLoad();
+#ifndef NO_ISLAND_LOADING
CStreaming::RequestIslands(CGame::currLevel);
CStreaming::RequestBigBuildings(CGame::currLevel);
CStreaming::LoadAllRequestedModels(true);
DMAudio.SetEffectsFadeVol(127);
+#endif
}
CTimer::Update();
return 0;