summaryrefslogtreecommitdiffstats
path: root/src/weapons/ShotInfo.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-08-07 10:18:46 +0200
committerGitHub <noreply@github.com>2020-08-07 10:18:46 +0200
commitf14b1fba09fa992a67abe10ca12897fd9db386be (patch)
tree10651feff629e4d2b9e31727d35ed7b00bb02a06 /src/weapons/ShotInfo.cpp
parentMerge pull request #676 from aap/master (diff)
parentSqueeze performance option, minor fixes (diff)
downloadre3-f14b1fba09fa992a67abe10ca12897fd9db386be.tar
re3-f14b1fba09fa992a67abe10ca12897fd9db386be.tar.gz
re3-f14b1fba09fa992a67abe10ca12897fd9db386be.tar.bz2
re3-f14b1fba09fa992a67abe10ca12897fd9db386be.tar.lz
re3-f14b1fba09fa992a67abe10ca12897fd9db386be.tar.xz
re3-f14b1fba09fa992a67abe10ca12897fd9db386be.tar.zst
re3-f14b1fba09fa992a67abe10ca12897fd9db386be.zip
Diffstat (limited to 'src/weapons/ShotInfo.cpp')
-rw-r--r--src/weapons/ShotInfo.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/weapons/ShotInfo.cpp b/src/weapons/ShotInfo.cpp
index f09ae052..c0ab9ac1 100644
--- a/src/weapons/ShotInfo.cpp
+++ b/src/weapons/ShotInfo.cpp
@@ -13,6 +13,9 @@
CShotInfo gaShotInfo[NUMSHOTINFOS];
float CShotInfo::ms_afRandTable[20];
+#ifdef SQUEEZE_PERFORMANCE
+uint32 shotInfoInUse;
+#endif
/*
Used for flamethrower. I don't know why it's name is CShotInfo.
@@ -41,6 +44,9 @@ CShotInfo::Initialise()
nextVal += 0.005f;
}
debug("CShotInfo ready\n");
+#ifdef SQUEEZE_PERFORMANCE
+ shotInfoInUse = 0;
+#endif
}
bool
@@ -54,6 +60,10 @@ CShotInfo::AddShot(CEntity *sourceEntity, eWeaponType weapon, CVector startPos,
if (slot == ARRAY_SIZE(gaShotInfo))
return false;
+#ifdef SQUEEZE_PERFORMANCE
+ shotInfoInUse++;
+#endif
+
gaShotInfo[slot].m_inUse = true;
gaShotInfo[slot].m_weapon = weapon;
gaShotInfo[slot].m_startPos = startPos;
@@ -87,6 +97,10 @@ CShotInfo::Shutdown()
void
CShotInfo::Update()
{
+#ifdef SQUEEZE_PERFORMANCE
+ if (shotInfoInUse == 0)
+ return;
+#endif
for (int slot = 0; slot < ARRAY_SIZE(gaShotInfo); slot++) {
CShotInfo &shot = gaShotInfo[slot];
if (shot.m_sourceEntity && shot.m_sourceEntity->IsPed() && !((CPed*)shot.m_sourceEntity)->IsPointerValid())
@@ -96,8 +110,12 @@ CShotInfo::Update()
continue;
CWeaponInfo *weaponInfo = CWeaponInfo::GetWeaponInfo(shot.m_weapon);
- if (CTimer::GetTimeInMilliseconds() > shot.m_timeout)
+ if (CTimer::GetTimeInMilliseconds() > shot.m_timeout) {
+#ifdef SQUEEZE_PERFORMANCE
+ shotInfoInUse--;
+#endif
shot.m_inUse = false;
+ }
if (weaponInfo->m_bSlowsDown)
shot.m_areaAffected *= pow(0.96, CTimer::GetTimeStep()); // FRAMERATE