diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/objects/Stinger.cpp | 17 | ||||
-rw-r--r-- | src/objects/Stinger.h | 7 |
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, }; |