From d6a853bd60441eb2722389840256b576778185ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Sat, 20 Jun 2020 22:44:31 +0300 Subject: [PATCH] killing peds increase chaos level --- src/core/PlayerInfo.cpp | 2 ++ src/peds/Ped.cpp | 13 +++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index 0be5f73e..ed2690eb 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -146,6 +146,8 @@ CPlayerInfo::Clear(void) m_bDriveByAllowed = true; m_nPreviousTimeRewardedForExplosion = 0; m_nExplosionsSinceLastReward = 0; + m_nHavocLevel = 0; + m_fMediaAttention = 0; m_nCurrentBustedAudio = 1; m_nBustedAudioStatus = BUSTEDAUDIO_NONE; } diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 8f7e02b7..c3c4f864 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -4069,7 +4069,8 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi bool willLinger = false; int random; - // TODO(Miami): PlayerInfo thingies here + if (damagedBy == FindPlayerPed() && damagedBy != this && damage > 3.0f) + ++CWorld::Players[CWorld::PlayerInFocus].m_nHavocLevel; if (player == this) { if (!player->m_bCanBeDamaged) @@ -4535,11 +4536,11 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi m_pMyVehicle->SetStatus(STATUS_ABANDONED); } SetDie(dieAnim, dieDelta, dieSpeed); - /* + if (damagedBy == FindPlayerPed() && damagedBy != this) { - // TODO(Miami): PlayerInfo stuff + CWorld::Players[CWorld::PlayerInFocus].m_nHavocLevel += 10; + CWorld::Players[CWorld::PlayerInFocus].m_fMediaAttention += 5.f; } - */ } } for (int i = 0; i < ARRAY_SIZE(pVehicle->pPassengers); i++) { @@ -4575,9 +4576,9 @@ CPed::InflictDamage(CEntity *damagedBy, eWeaponType method, float damage, ePedPi SetDie(dieAnim, dieDelta, dieSpeed); if (damagedBy == player || damagedBy && damagedBy == FindPlayerVehicle()) { - - // TODO(Miami): PlayerInfo stuff CDarkel::RegisterKillByPlayer(this, method, headShot); + CWorld::Players[CWorld::PlayerInFocus].m_nHavocLevel += 10; + CWorld::Players[CWorld::PlayerInFocus].m_fMediaAttention += 5.f; m_threatEntity = player; } else { CDarkel::RegisterKillNotByPlayer(this, method);