Skip to content

Commit 0425ad2

Browse files
patrikjuvonensaml1er
authored andcommitted
0009522: reset jetpack and choking states upon animation - and the other way around (#229)
* clear jetpack and choking upon anim and likewise, fixes 9522 * CClientPed::SetChoking: clear animation here as well
1 parent 6149954 commit 0425ad2

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

Client/mods/deathmatch/logic/CClientPed.cpp

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,10 +1919,16 @@ void CClientPed::SetFrozen(bool bFrozen)
19191919
{
19201920
if (m_pTaskManager)
19211921
{
1922-
m_pTaskManager->RemoveTask(TASK_PRIORITY_PRIMARY);
1922+
// Let them have a jetpack (#9522)
1923+
if (!HasJetPack())
1924+
m_pTaskManager->RemoveTask(TASK_PRIORITY_PRIMARY);
1925+
19231926
m_pTaskManager->RemoveTask(TASK_PRIORITY_EVENT_RESPONSE_TEMP);
19241927
m_pTaskManager->RemoveTask(TASK_PRIORITY_EVENT_RESPONSE_NONTEMP);
1925-
m_pTaskManager->RemoveTask(TASK_PRIORITY_PHYSICAL_RESPONSE);
1928+
1929+
// Let's let them choke too
1930+
if (!IsChoking())
1931+
m_pTaskManager->RemoveTask(TASK_PRIORITY_PHYSICAL_RESPONSE);
19261932
}
19271933

19281934
if (m_pPlayerPed)
@@ -4310,6 +4316,13 @@ void CClientPed::SetChoking(bool bChoking)
43104316
// His not choking. Make him choke if that's what we're supposed to do.
43114317
if (bChoking)
43124318
{
4319+
// Remove jetpack now so it doesn't stay on (#9522#c25612)
4320+
if (HasJetPack())
4321+
SetHasJetPack(false);
4322+
4323+
// Let's kill any animation
4324+
KillAnimation();
4325+
43134326
// Create the choking task
43144327
CTaskSimpleChoking* pTask = g_pGame->GetTasks()->CreateTaskSimpleChoking(NULL, true);
43154328
if (pTask)
@@ -4518,6 +4531,13 @@ bool CClientPed::SetHasJetPack(bool bHasJetPack)
45184531
m_pTaskManager->RemoveTask(TASK_PRIORITY_EVENT_RESPONSE_NONTEMP);
45194532
}
45204533

4534+
// Kill choking state now so it doesn't stay on (#9522#c26644)
4535+
if (IsChoking())
4536+
SetChoking(false);
4537+
4538+
// Kill animation as well
4539+
KillAnimation();
4540+
45214541
CTaskSimpleJetPack* pJetPackTask = g_pGame->GetTasks()->CreateTaskSimpleJetpack();
45224542
if (pJetPackTask)
45234543
{
@@ -5634,6 +5654,14 @@ void CClientPed::RunAnimation(AssocGroupId animGroup, AnimationId animID)
56345654

56355655
if (m_pPlayerPed)
56365656
{
5657+
// Remove jetpack now so it doesn't stay on (#9522#c25612)
5658+
if (HasJetPack())
5659+
SetHasJetPack(false);
5660+
5661+
// Let's not choke them any longer
5662+
if (IsChoking())
5663+
SetChoking(false);
5664+
56375665
CTask* pTask = g_pGame->GetTasks()->CreateTaskSimpleRunAnim(animGroup, animID, 4.0f, TASK_SIMPLE_ANIM, "TASK_SIMPLE_ANIM");
56385666
if (pTask)
56395667
{
@@ -5660,6 +5688,14 @@ void CClientPed::RunNamedAnimation(CAnimBlock* pBlock, const char* szAnimName, i
56605688

56615689
if (pBlock->IsLoaded())
56625690
{
5691+
// Remove jetpack now so it doesn't stay on (#9522#c25612)
5692+
if (HasJetPack())
5693+
SetHasJetPack(false);
5694+
5695+
// Let's not choke them any longer
5696+
if (IsChoking())
5697+
SetChoking(false);
5698+
56635699
/*
56645700
Saml1er: Setting flags to 0x10 will tell GTA:SA that animation needs to be decompressed.
56655701
If not, animation will either crash or do some weird things.

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3863,6 +3863,10 @@ bool CStaticFunctionDefinitions::GivePedJetPack(CElement* pElement)
38633863
CPed* pPed = static_cast<CPed*>(pElement);
38643864
if (pPed->IsSpawned() && !pPed->GetOccupiedVehicle() && !pPed->HasJetPack())
38653865
{
3866+
// Remove choking state
3867+
if (pPed->IsChoking())
3868+
pPed->SetChoking(false);
3869+
38663870
pPed->SetHasJetPack(true);
38673871

38683872
CBitStream BitStream;
@@ -3992,6 +3996,10 @@ bool CStaticFunctionDefinitions::SetPedChoking(CElement* pElement, bool bChoking
39923996
// Not already (not) choking?
39933997
if (bChoking != pPed->IsChoking())
39943998
{
3999+
// Remove jetpack now so it doesn't stay on (#9522#c25612)
4000+
if (pPed->HasJetPack())
4001+
pPed->SetHasJetPack(false);
4002+
39954003
pPed->SetChoking(bChoking);
39964004

39974005
CBitStream bitStream;
@@ -4203,6 +4211,14 @@ bool CStaticFunctionDefinitions::SetPedAnimation(CElement* pElement, const char*
42034211
CPed* pPed = static_cast<CPed*>(pElement);
42044212
if (pPed->IsSpawned())
42054213
{
4214+
// Remove jetpack now so it doesn't stay on (#9522#c25612)
4215+
if (pPed->HasJetPack())
4216+
pPed->SetHasJetPack(false);
4217+
4218+
// Remove choking state
4219+
if (pPed->IsChoking())
4220+
pPed->SetChoking(false);
4221+
42064222
// TODO: save their animation?
42074223

42084224
// Tell the players

0 commit comments

Comments
 (0)