summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-07-31 20:43:52 +0300
committerSergeanur <s.anureev@yandex.ua>2021-07-31 20:43:52 +0300
commita481b900b948f5e9c40e334b789f663f7d6d5932 (patch)
tree28484bf4bcc267a941b7746fafbce7c57938eb18 /src
parentbf035b8167fae156dc28b2952044b29e6f601600 (diff)
parentd923cd2f240d29a062c91a2b00c110f74986f281 (diff)
Merge branch 'miami' into lcs
# Conflicts: # src/control/CarCtrl.cpp # src/modelinfo/MloModelInfo.cpp # src/modelinfo/MloModelInfo.h # src/renderer/Renderer.cpp # src/rw/VisibilityPlugins.cpp # src/rw/VisibilityPlugins.h
Diffstat (limited to 'src')
-rw-r--r--src/audio/DMAudio.cpp2
-rw-r--r--src/control/CarCtrl.cpp9
-rw-r--r--src/core/config.h4
-rw-r--r--src/peds/Ped.cpp12
-rw-r--r--src/peds/Population.cpp9
5 files changed, 31 insertions, 5 deletions
diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp
index f5b08c71..3843007d 100644
--- a/src/audio/DMAudio.cpp
+++ b/src/audio/DMAudio.cpp
@@ -65,7 +65,7 @@ cDMAudio::DestroyAllGameCreatedEntities(void)
void
cDMAudio::SetOutputMode(bool8 surround)
{
- return AudioManager.SetOutputMode(surround);
+ AudioManager.SetOutputMode(surround);
}
void
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index f50111ec..93fde4eb 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -983,9 +983,12 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
}
float distanceToPlayer = (pVehicle->GetPosition() - vecPlayerPos).Magnitude2D();
float despawnMultiplier = 1.0f;
+#ifndef EXTENDED_OFFSCREEN_DESPAWN_RANGE
if (FindPlayerVehicle() && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON && !FrontEndMenuManager.m_PrefsUseWideScreen)
despawnMultiplier = 0.75f;
+#endif
float threshold = OFFSCREEN_DESPAWN_RANGE * despawnMultiplier;
+#ifndef EXTENDED_OFFSCREEN_DESPAWN_RANGE
if (pVehicle->GetIsOnScreen() ||
TheCamera.Cams[TheCamera.ActiveCam].LookingLeft ||
TheCamera.Cams[TheCamera.ActiveCam].LookingRight ||
@@ -997,11 +1000,15 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
pVehicle->bIsLawEnforcer ||
pVehicle->bIsCarParkVehicle ||
CTimer::GetTimeInMilliseconds() < pVehicle->m_nSetPieceExtendedRangeTime
- ){
+ )
+#endif
+ {
threshold = ONSCREEN_DESPAWN_RANGE * despawnMultiplier * TheCamera.GenerationDistMultiplier;
}
+#ifndef EXTENDED_OFFSCREEN_DESPAWN_RANGE
if (TheCamera.GetForward().z < -0.9f)
threshold = 70.0f;
+#endif
if (pVehicle->bExtendedRange)
threshold *= EXTENDED_RANGE_DESPAWN_MULTIPLIER;
if (distanceToPlayer > threshold && !CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
diff --git a/src/core/config.h b/src/core/config.h
index 681d239b..d8340c37 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -284,6 +284,9 @@ enum Config {
#define NO_MOVIES // add option to disable intro videos
+#define EXTENDED_OFFSCREEN_DESPAWN_RANGE // Use onscreen despawn range for offscreen peds and vehicles to avoid them despawning in the distance when you look
+ // away
+
#if defined(__LP64__) || defined(_WIN64)
#define FIX_BUGS_64 // Must have fixes to be able to run 64 bit build
#endif
@@ -460,6 +463,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
#undef PS2_ALPHA_TEST
#undef NO_ISLAND_LOADING
#undef PS2_AUDIO_CHANNELS
+ #undef EXTENDED_OFFSCREEN_DESPAWN_RANGE
#endif
// if these defines are enabled saves are not vanilla compatible without COMPATIBLE_SAVES
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index e284dad5..dc143098 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -511,8 +511,20 @@ CPed::BuildPedLists(void)
continue;
deadsRegistered++;
}
+#ifdef FIX_BUGS
+ // If the gap ped list is full, sort it and truncate it
+ // before pushing more unsorted peds
+ if( gnNumTempPedList == ARRAY_SIZE(gapTempPedList) - 1 )
+ {
+ gapTempPedList[gnNumTempPedList] = nil;
+ SortPeds(gapTempPedList, 0, gnNumTempPedList - 1);
+ gnNumTempPedList = ARRAY_SIZE(m_nearPeds);
+ }
+#endif
+
gapTempPedList[gnNumTempPedList] = ped;
gnNumTempPedList++;
+ // NOTE: We cannot absolutely fill the gap list, as the list is null-terminated before being passed to SortPeds
assert(gnNumTempPedList < ARRAY_SIZE(gapTempPedList));
}
}
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 0f68c679..75c454b6 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -1105,8 +1105,9 @@ CPopulation::ManagePopulation(void)
if (PedCreationDistMultiplier() * (PED_REMOVE_DIST_SPECIAL * TheCamera.GenerationDistMultiplier) < dist ||
(!ped->bCullExtraFarAway && PedCreationDistMultiplier() * PED_REMOVE_DIST * TheCamera.GenerationDistMultiplier < dist)) {
pedIsFarAway = true;
-
- } else if (PedCreationDistMultiplier() * (MIN_CREATION_DIST + CREATION_RANGE) * OFFSCREEN_CREATION_MULT < dist) {
+ }
+#ifndef EXTENDED_OFFSCREEN_DESPAWN_RANGE
+ else if (PedCreationDistMultiplier() * (MIN_CREATION_DIST + CREATION_RANGE) * OFFSCREEN_CREATION_MULT < dist) {
if (CTimer::GetTimeInMilliseconds() > ped->m_nExtendedRangeTimer && !ped->GetIsOnScreen()) {
if (TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::MODE_SNIPER
&& TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::MODE_SNIPER_RUNABOUT
@@ -1118,7 +1119,9 @@ CPopulation::ManagePopulation(void)
}
}
- } else {
+ }
+#endif
+ else {
ped->m_nExtendedRangeTimer = ped->m_nPedType == PEDTYPE_COP ? CTimer::GetTimeInMilliseconds() + 10000 : CTimer::GetTimeInMilliseconds() + 4000;
}