summaryrefslogtreecommitdiffstats
path: root/src/core/PlayerInfo.cpp
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-10-08 22:57:58 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2019-10-08 22:57:58 +0200
commit9e5a5f2ab6432ec64a6a7f7ac78fa514fdf5038e (patch)
tree0041b54ddeb9d9dd1eee4a1ef474bb953f2608fe /src/core/PlayerInfo.cpp
parentfixed bugs (diff)
parentFull CGameLogic (diff)
downloadre3-9e5a5f2ab6432ec64a6a7f7ac78fa514fdf5038e.tar
re3-9e5a5f2ab6432ec64a6a7f7ac78fa514fdf5038e.tar.gz
re3-9e5a5f2ab6432ec64a6a7f7ac78fa514fdf5038e.tar.bz2
re3-9e5a5f2ab6432ec64a6a7f7ac78fa514fdf5038e.tar.lz
re3-9e5a5f2ab6432ec64a6a7f7ac78fa514fdf5038e.tar.xz
re3-9e5a5f2ab6432ec64a6a7f7ac78fa514fdf5038e.tar.zst
re3-9e5a5f2ab6432ec64a6a7f7ac78fa514fdf5038e.zip
Diffstat (limited to 'src/core/PlayerInfo.cpp')
-rw-r--r--src/core/PlayerInfo.cpp42
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