diff options
author | Sergeanur <s.anureev@yandex.ua> | 2019-10-07 23:29:30 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2019-10-08 16:13:23 +0200 |
commit | 69963cea68b3057c0e590e30ee438dff801a4d07 (patch) | |
tree | 72a25c528dcab00922643b6b820703226b8a6d82 /src/core/PlayerInfo.cpp | |
parent | Fixed crash when aboarding train (diff) | |
download | re3-69963cea68b3057c0e590e30ee438dff801a4d07.tar re3-69963cea68b3057c0e590e30ee438dff801a4d07.tar.gz re3-69963cea68b3057c0e590e30ee438dff801a4d07.tar.bz2 re3-69963cea68b3057c0e590e30ee438dff801a4d07.tar.lz re3-69963cea68b3057c0e590e30ee438dff801a4d07.tar.xz re3-69963cea68b3057c0e590e30ee438dff801a4d07.tar.zst re3-69963cea68b3057c0e590e30ee438dff801a4d07.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/PlayerInfo.cpp | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/src/core/PlayerInfo.cpp b/src/core/PlayerInfo.cpp index dc72848d..be2c0687 100644 --- a/src/core/PlayerInfo.cpp +++ b/src/core/PlayerInfo.cpp @@ -5,25 +5,32 @@ #include "Frontend.h" #include "Vehicle.h" #include "PlayerSkin.h" +#include "Darkel.h" +#include "Messages.h" +#include "Text.h" +#include "Stats.h" WRAPPER void CPlayerInfo::MakePlayerSafe(bool) { EAXJMP(0x4A1400); } WRAPPER void CPlayerInfo::AwardMoneyForExplosion(CVehicle *vehicle) { EAXJMP(0x4A15F0); } WRAPPER void CPlayerInfo::Process(void) { EAXJMP(0x49FD30); } -void CPlayerInfo::SetPlayerSkin(char *skin) +void +CPlayerInfo::SetPlayerSkin(char *skin) { strncpy(m_aSkinName, skin, 32); LoadPlayerSkin(); } -CVector& CPlayerInfo::GetPos() +CVector& +CPlayerInfo::GetPos() { if (m_pPed->bInVehicle && m_pPed->m_pMyVehicle) return m_pPed->m_pMyVehicle->GetPosition(); return m_pPed->GetPosition(); } -void CPlayerInfo::LoadPlayerSkin() +void +CPlayerInfo::LoadPlayerSkin() {
DeletePlayerSkin();
@@ -32,7 +39,8 @@ void CPlayerInfo::LoadPlayerSkin() m_pSkinTexture = CPlayerSkin::GetSkinTexture(DEFAULT_SKIN_NAME); } -void CPlayerInfo::DeletePlayerSkin() +void +CPlayerInfo::DeletePlayerSkin() {
if (m_pSkinTexture) {
RwTextureDestroy(m_pSkinTexture);
@@ -40,7 +48,33 @@ void CPlayerInfo::DeletePlayerSkin() } } +void
+CPlayerInfo::KillPlayer()
+{
+ if (m_WBState != WBSTATE_PLAYING) return;
+
+ m_WBState = WBSTATE_WASTED;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ CDarkel::ResetOnPlayerDeath();
+ CMessages::AddBigMessage(TheText.Get("DEAD"), 4000, 2);
+ CStats::TimesDied++;
+} + +void
+CPlayerInfo::ArrestPlayer()
+{
+ if (m_WBState != WBSTATE_PLAYING) return;
+
+ m_WBState = WBSTATE_BUSTED;
+ m_nWBTime = CTimer::GetTimeInMilliseconds();
+ CDarkel::ResetOnPlayerDeath();
+ CMessages::AddBigMessage(TheText.Get("BUSTED"), 5000, 2);
+ CStats::TimesArrested++;
+} + STARTPATCHES InjectHook(0x4A1700, &CPlayerInfo::LoadPlayerSkin, PATCH_JUMP); InjectHook(0x4A1750, &CPlayerInfo::DeletePlayerSkin, PATCH_JUMP); +InjectHook(0x4A12E0, &CPlayerInfo::KillPlayer, PATCH_JUMP); +InjectHook(0x4A1330, &CPlayerInfo::ArrestPlayer, PATCH_JUMP); ENDPATCHES |