summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-08-31 20:35:05 +0200
committerSergeanur <s.anureev@yandex.ua>2020-08-31 20:35:26 +0200
commit6778640b52b474e0d06f09c3fdfdb15138936b6b (patch)
treef559bedd6d4f0c240b600244a7d93f0f8752dfa7
parentvars rename (diff)
downloadre3-6778640b52b474e0d06f09c3fdfdb15138936b6b.tar
re3-6778640b52b474e0d06f09c3fdfdb15138936b6b.tar.gz
re3-6778640b52b474e0d06f09c3fdfdb15138936b6b.tar.bz2
re3-6778640b52b474e0d06f09c3fdfdb15138936b6b.tar.lz
re3-6778640b52b474e0d06f09c3fdfdb15138936b6b.tar.xz
re3-6778640b52b474e0d06f09c3fdfdb15138936b6b.tar.zst
re3-6778640b52b474e0d06f09c3fdfdb15138936b6b.zip
-rw-r--r--src/objects/Stinger.cpp17
-rw-r--r--src/objects/Stinger.h7
2 files changed, 12 insertions, 12 deletions
diff --git a/src/objects/Stinger.cpp b/src/objects/Stinger.cpp
index 61424885..0b96322b 100644
--- a/src/objects/Stinger.cpp
+++ b/src/objects/Stinger.cpp
@@ -172,24 +172,26 @@ CStinger::Process()
&& pOwner->GetPedState() == PED_DEPLOY_STINGER
&& RpAnimBlendClumpGetAssociation(pOwner->GetClump(), ANIM_WEAPON_THROWU)->currentTime > 0.39f)
{
- m_nSpikeState = STINGERSTATE_STATE1;
+ m_nSpikeState = STINGERSTATE_DEPLOYING;
for (int i = 0; i < NUM_STINGER_SEGMENTS; i++)
CWorld::Add(pSpikes[i]);
pOwner->SetIdle();
}
break;
- case STINGERSTATE_STATE2:
+ case STINGERSTATE_DEPLOYED:
if (pOwner != nil && pOwner->m_nPedType == PEDTYPE_COP)
((CCopPed*)pOwner)->m_bThrowsSpikeTrap = false;
break;
- case STINGERSTATE_STATE3:
+ case STINGERSTATE_UNDEPLOYING:
if (CTimer::GetTimeInMilliseconds() > m_nTimeOfDeploy + 2500)
m_nSpikeState = STINGERSTATE_REMOVE;
// no break
- case STINGERSTATE_STATE1:
- if (m_nSpikeState != STINGERSTATE_STATE1 || CTimer::GetTimeInMilliseconds() <= m_nTimeOfDeploy + 2500) {
+ case STINGERSTATE_DEPLOYING:
+ if (m_nSpikeState == STINGERSTATE_DEPLOYING && CTimer::GetTimeInMilliseconds() > m_nTimeOfDeploy + 2500)
+ m_nSpikeState = STINGERSTATE_DEPLOYED;
+ else {
float progress = (CTimer::GetTimeInMilliseconds() - m_nTimeOfDeploy) / 2500.0f;
- if (m_nSpikeState != STINGERSTATE_STATE1)
+ if (m_nSpikeState != STINGERSTATE_DEPLOYING)
progress = 1.0f - progress;
float degangle = progress * ARRAY_SIZE(m_vPositions);
@@ -221,8 +223,7 @@ CStinger::Process()
}
pSpikes[spike]->SetPosition(pos3d);
}
- } else
- m_nSpikeState = STINGERSTATE_STATE2;
+ }
break;
case STINGERSTATE_REMOVE:
Remove();
diff --git a/src/objects/Stinger.h b/src/objects/Stinger.h
index 80ac3d1e..d1b57ce7 100644
--- a/src/objects/Stinger.h
+++ b/src/objects/Stinger.h
@@ -13,12 +13,11 @@ public:
class CStinger
{
- // TODO: better names
enum {
STINGERSTATE_NONE = 0,
- STINGERSTATE_STATE1,
- STINGERSTATE_STATE2,
- STINGERSTATE_STATE3,
+ STINGERSTATE_DEPLOYING,
+ STINGERSTATE_DEPLOYED,
+ STINGERSTATE_UNDEPLOYING,
STINGERSTATE_REMOVE,
};