2019-06-14 23:34:19 +00:00
|
|
|
#include "common.h"
|
|
|
|
#include "patcher.h"
|
2019-07-25 20:34:29 +00:00
|
|
|
#include "PlayerPed.h"
|
2019-06-14 23:34:19 +00:00
|
|
|
#include "PlayerInfo.h"
|
2019-07-10 07:57:08 +00:00
|
|
|
#include "Frontend.h"
|
2019-07-25 20:34:29 +00:00
|
|
|
#include "Vehicle.h"
|
2019-09-28 18:39:58 +00:00
|
|
|
#include "PlayerSkin.h"
|
2019-10-07 21:29:30 +00:00
|
|
|
#include "Darkel.h"
|
|
|
|
#include "Messages.h"
|
|
|
|
#include "Text.h"
|
|
|
|
#include "Stats.h"
|
2019-07-03 22:16:24 +00:00
|
|
|
|
2019-07-09 21:49:44 +00:00
|
|
|
WRAPPER void CPlayerInfo::MakePlayerSafe(bool) { EAXJMP(0x4A1400); }
|
|
|
|
WRAPPER void CPlayerInfo::AwardMoneyForExplosion(CVehicle *vehicle) { EAXJMP(0x4A15F0); }
|
2019-09-12 00:43:18 +00:00
|
|
|
WRAPPER void CPlayerInfo::Process(void) { EAXJMP(0x49FD30); }
|
2019-07-10 07:57:08 +00:00
|
|
|
|
2019-10-07 21:29:30 +00:00
|
|
|
void
|
|
|
|
CPlayerInfo::SetPlayerSkin(char *skin)
|
2019-07-10 07:57:08 +00:00
|
|
|
{
|
|
|
|
strncpy(m_aSkinName, skin, 32);
|
|
|
|
LoadPlayerSkin();
|
|
|
|
}
|
2019-07-25 20:34:29 +00:00
|
|
|
|
2019-10-07 21:29:30 +00:00
|
|
|
CVector&
|
|
|
|
CPlayerInfo::GetPos()
|
2019-07-25 20:34:29 +00:00
|
|
|
{
|
|
|
|
if (m_pPed->bInVehicle && m_pPed->m_pMyVehicle)
|
|
|
|
return m_pPed->m_pMyVehicle->GetPosition();
|
|
|
|
return m_pPed->GetPosition();
|
|
|
|
}
|
2019-09-28 18:39:58 +00:00
|
|
|
|
2019-10-07 21:29:30 +00:00
|
|
|
void
|
|
|
|
CPlayerInfo::LoadPlayerSkin()
|
2019-09-28 18:39:58 +00:00
|
|
|
{
|
|
|
|
DeletePlayerSkin();
|
|
|
|
|
|
|
|
m_pSkinTexture = CPlayerSkin::GetSkinTexture(m_aSkinName);
|
|
|
|
if (!m_pSkinTexture)
|
|
|
|
m_pSkinTexture = CPlayerSkin::GetSkinTexture(DEFAULT_SKIN_NAME);
|
|
|
|
}
|
|
|
|
|
2019-10-07 21:29:30 +00:00
|
|
|
void
|
|
|
|
CPlayerInfo::DeletePlayerSkin()
|
2019-09-28 18:39:58 +00:00
|
|
|
{
|
|
|
|
if (m_pSkinTexture) {
|
|
|
|
RwTextureDestroy(m_pSkinTexture);
|
|
|
|
m_pSkinTexture = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-07 21:29:30 +00:00
|
|
|
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++;
|
|
|
|
}
|
|
|
|
|
2019-10-21 21:39:59 +00:00
|
|
|
bool
|
|
|
|
CPlayerInfo::IsPlayerInRemoteMode()
|
|
|
|
{
|
|
|
|
return m_pRemoteVehicle || m_bInRemoteMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CPlayerInfo::PlayerFailedCriticalMission()
|
|
|
|
{
|
|
|
|
if (m_WBState != WBSTATE_PLAYING)
|
|
|
|
return;
|
|
|
|
m_WBState = WBSTATE_FAILED_CRITICAL_MISSION;
|
|
|
|
m_nWBTime = CTimer::GetTimeInMilliseconds();
|
|
|
|
CDarkel::ResetOnPlayerDeath();
|
|
|
|
}
|
|
|
|
|
2019-09-28 18:39:58 +00:00
|
|
|
STARTPATCHES
|
|
|
|
InjectHook(0x4A1700, &CPlayerInfo::LoadPlayerSkin, PATCH_JUMP);
|
|
|
|
InjectHook(0x4A1750, &CPlayerInfo::DeletePlayerSkin, PATCH_JUMP);
|
2019-10-07 21:29:30 +00:00
|
|
|
InjectHook(0x4A12E0, &CPlayerInfo::KillPlayer, PATCH_JUMP);
|
|
|
|
InjectHook(0x4A1330, &CPlayerInfo::ArrestPlayer, PATCH_JUMP);
|
2019-09-28 18:39:58 +00:00
|
|
|
ENDPATCHES
|