2019-06-29 07:38:37 -04:00
|
|
|
#include "common.h"
|
|
|
|
#include "patcher.h"
|
|
|
|
#include "PlayerPed.h"
|
2019-07-04 16:31:21 -04:00
|
|
|
#include "Camera.h"
|
|
|
|
#include "WeaponEffects.h"
|
2019-08-01 18:04:30 -04:00
|
|
|
#include "ModelIndices.h"
|
2019-10-07 17:29:30 -04:00
|
|
|
#include "World.h"
|
2019-06-29 07:38:37 -04:00
|
|
|
|
2019-06-30 06:59:55 -04:00
|
|
|
CPlayerPed::~CPlayerPed()
|
|
|
|
{
|
|
|
|
delete m_pWanted;
|
|
|
|
}
|
|
|
|
|
2019-06-29 11:07:57 -04:00
|
|
|
WRAPPER void CPlayerPed::ReApplyMoveAnims(void) { EAXJMP(0x4F07C0); }
|
2019-07-09 16:38:05 -04:00
|
|
|
WRAPPER void CPlayerPed::SetupPlayerPed(int32) { EAXJMP(0x4EFB60); }
|
|
|
|
WRAPPER void CPlayerPed::DeactivatePlayerPed(int32) { EAXJMP(0x4EFC00); }
|
|
|
|
WRAPPER void CPlayerPed::ReactivatePlayerPed(int32) { EAXJMP(0x4EFC20); }
|
2019-07-11 06:48:49 -04:00
|
|
|
WRAPPER void CPlayerPed::KeepAreaAroundPlayerClear(void) { EAXJMP(0x4F3460); }
|
2019-08-01 18:04:30 -04:00
|
|
|
WRAPPER void CPlayerPed::MakeChangesForNewWeapon(int8) { EAXJMP(0x4F2560); }
|
|
|
|
WRAPPER void CPlayerPed::SetInitialState(void) { EAXJMP(0x4EFC40); }
|
|
|
|
WRAPPER void CPlayerPed::SetMoveAnim(void) { EAXJMP(0x4F3760); }
|
|
|
|
WRAPPER void CPlayerPed::ProcessControl(void) { EAXJMP(0x4EFD90); }
|
2019-07-11 06:48:49 -04:00
|
|
|
|
2019-08-01 18:04:30 -04:00
|
|
|
CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
|
|
|
{
|
|
|
|
m_fMoveSpeed = 0.0f;
|
|
|
|
SetModelIndex(MI_PLAYER);
|
|
|
|
SetInitialState();
|
|
|
|
|
|
|
|
m_pWanted = new CWanted();
|
|
|
|
m_pWanted->Initialise();
|
|
|
|
m_pArrestingCop = nil;
|
|
|
|
m_currentWeapon = WEAPONTYPE_UNARMED;
|
|
|
|
m_nSelectedWepSlot = 0;
|
|
|
|
m_nSpeedTimer = 0;
|
|
|
|
m_bSpeedTimerFlag = 0;
|
|
|
|
m_pPointGunAt = nil;
|
|
|
|
m_nPedState = PED_IDLE;
|
|
|
|
m_fMaxStamina = 150.0f;
|
|
|
|
m_fCurrentStamina = m_fMaxStamina;
|
|
|
|
m_fStaminaProgress = 0.0f;
|
|
|
|
m_bShouldEvade = 0;
|
|
|
|
field_1367 = 0;
|
|
|
|
m_nShotDelay = 0;
|
|
|
|
field_1376 = 0.0f;
|
|
|
|
field_1380 = 0;
|
|
|
|
m_bHasLockOnTarget = false;
|
|
|
|
m_bCanBeDamaged = true;
|
|
|
|
m_fWalkAngle = 0.0f;
|
|
|
|
m_fFPSMoveHeading = 0.0f;
|
|
|
|
m_nTargettableObjects[0] = m_nTargettableObjects[1] = m_nTargettableObjects[2] = m_nTargettableObjects[3] = -1;
|
|
|
|
field_1413 = 0;
|
|
|
|
for (int i = 0; i < 6; i++) {
|
|
|
|
m_vecSafePos[i] = CVector(0.0f, 0.0f, 0.0f);
|
2019-09-29 12:44:51 -04:00
|
|
|
m_pPedAtSafePos[i] = nil;
|
2019-08-01 18:04:30 -04:00
|
|
|
}
|
|
|
|
}
|
2019-06-30 06:59:55 -04:00
|
|
|
|
2019-07-04 16:31:21 -04:00
|
|
|
void CPlayerPed::ClearWeaponTarget()
|
|
|
|
{
|
2019-08-22 18:44:38 -04:00
|
|
|
if (m_nPedType == PEDTYPE_PLAYER1) {
|
|
|
|
m_pPointGunAt = nil;
|
2019-07-04 16:31:21 -04:00
|
|
|
TheCamera.ClearPlayerWeaponMode();
|
|
|
|
CWeaponEffects::ClearCrosshair();
|
|
|
|
}
|
|
|
|
ClearPointGunAt();
|
|
|
|
}
|
|
|
|
|
2019-07-09 12:50:35 -04:00
|
|
|
void
|
|
|
|
CPlayerPed::SetWantedLevel(int32 level)
|
|
|
|
{
|
|
|
|
m_pWanted->SetWantedLevel(level);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
CPlayerPed::SetWantedLevelNoDrop(int32 level)
|
|
|
|
{
|
|
|
|
m_pWanted->SetWantedLevelNoDrop(level);
|
|
|
|
}
|
|
|
|
|
2019-07-17 22:41:57 -04:00
|
|
|
// I don't know the actual purpose of parameter
|
2019-07-17 22:26:46 -04:00
|
|
|
void
|
2019-08-22 18:44:38 -04:00
|
|
|
CPlayerPed::AnnoyPlayerPed(bool annoyedByPassingEntity)
|
2019-07-17 22:26:46 -04:00
|
|
|
{
|
2019-07-17 22:41:57 -04:00
|
|
|
if (m_pedStats->m_temper < 52) {
|
|
|
|
m_pedStats->m_temper++;
|
|
|
|
} else {
|
2019-08-22 18:44:38 -04:00
|
|
|
if (annoyedByPassingEntity) {
|
2019-07-17 22:41:57 -04:00
|
|
|
if (m_pedStats->m_temper < 55) {
|
|
|
|
m_pedStats->m_temper++;
|
2019-07-17 22:26:46 -04:00
|
|
|
} else {
|
2019-07-17 22:41:57 -04:00
|
|
|
m_pedStats->m_temper = 46;
|
2019-07-17 22:26:46 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-13 15:04:55 -04:00
|
|
|
void
|
|
|
|
CPlayerPed::ClearAdrenaline(void)
|
|
|
|
{
|
|
|
|
if (m_bAdrenalineActive && m_nAdrenalineTime != 0) {
|
|
|
|
m_nAdrenalineTime = 0;
|
2019-10-19 05:37:31 -04:00
|
|
|
CTimer::SetTimeScale(1.0f);
|
2019-09-13 15:04:55 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-07 17:29:30 -04:00
|
|
|
CPlayerInfo *
|
|
|
|
CPlayerPed::GetPlayerInfoForThisPlayerPed()
|
|
|
|
{
|
|
|
|
if (CWorld::Players[0].m_pPed == this)
|
|
|
|
return &CWorld::Players[0];
|
|
|
|
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
2019-07-08 02:46:42 -04:00
|
|
|
class CPlayerPed_ : public CPlayerPed
|
|
|
|
{
|
|
|
|
public:
|
2019-08-01 18:04:30 -04:00
|
|
|
CPlayerPed* ctor(void) { return ::new (this) CPlayerPed(); }
|
2019-07-08 02:46:42 -04:00
|
|
|
void dtor(void) { CPlayerPed::~CPlayerPed(); }
|
|
|
|
};
|
2019-07-04 16:31:21 -04:00
|
|
|
|
2019-07-08 02:46:42 -04:00
|
|
|
STARTPATCHES
|
2019-08-01 18:04:30 -04:00
|
|
|
InjectHook(0x4EF7E0, &CPlayerPed_::ctor, PATCH_JUMP);
|
2019-07-08 02:46:42 -04:00
|
|
|
InjectHook(0x4EFB30, &CPlayerPed_::dtor, PATCH_JUMP);
|
|
|
|
InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP);
|
2019-07-17 22:26:46 -04:00
|
|
|
InjectHook(0x4F3700, &CPlayerPed::AnnoyPlayerPed, PATCH_JUMP);
|
2019-10-07 17:29:30 -04:00
|
|
|
InjectHook(0x4F36C0, &CPlayerPed::GetPlayerInfoForThisPlayerPed, PATCH_JUMP);
|
2019-07-08 02:46:42 -04:00
|
|
|
ENDPATCHES
|