diff options
author | Filip Gawin <filip.gawin@zoho.com> | 2019-07-31 17:54:18 +0200 |
---|---|---|
committer | Filip Gawin <filip.gawin@zoho.com> | 2019-08-27 21:13:17 +0200 |
commit | af5bd951aeb43c341d5126bc4141992169e46d57 (patch) | |
tree | 08c819a7c31d30abb6915b21b80239ace256b692 /src/peds | |
parent | Merge pull request #197 from Nick007J/master (diff) | |
download | re3-af5bd951aeb43c341d5126bc4141992169e46d57.tar re3-af5bd951aeb43c341d5126bc4141992169e46d57.tar.gz re3-af5bd951aeb43c341d5126bc4141992169e46d57.tar.bz2 re3-af5bd951aeb43c341d5126bc4141992169e46d57.tar.lz re3-af5bd951aeb43c341d5126bc4141992169e46d57.tar.xz re3-af5bd951aeb43c341d5126bc4141992169e46d57.tar.zst re3-af5bd951aeb43c341d5126bc4141992169e46d57.zip |
Diffstat (limited to 'src/peds')
-rw-r--r-- | src/peds/Ped.cpp | 12 | ||||
-rw-r--r-- | src/peds/Ped.h | 9 | ||||
-rw-r--r-- | src/peds/PedPlacement.cpp | 4 | ||||
-rw-r--r-- | src/peds/PlayerPed.cpp | 8 | ||||
-rw-r--r-- | src/peds/PlayerPed.cpp.autosave | 110 |
5 files changed, 135 insertions, 8 deletions
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 53d94d86..59395d94 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -1792,7 +1792,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) neededPos.z = autoZPos.z; m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); } else if (neededPos.z <= currentZ && m_pVehicleAnim && vehAnim != ANIM_VAN_CLOSE_L && vehAnim != ANIM_VAN_CLOSE) { - adjustedTimeStep = min(m_pVehicleAnim->timeStep, 0.1f); + adjustedTimeStep = Min(m_pVehicleAnim->timeStep, 0.1f); // Smoothly change ped position neededPos.z = currentZ - (currentZ - neededPos.z) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep); @@ -1807,12 +1807,12 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase) if (m_pVehicleAnim && (vehAnim == ANIM_CAR_GETIN_RHS || vehAnim == ANIM_CAR_GETIN_LOW_RHS || vehAnim == ANIM_CAR_GETIN_LHS || vehAnim == ANIM_CAR_GETIN_LOW_LHS || vehAnim == ANIM_CAR_QJACK || vehAnim == ANIM_VAN_GETIN_L || vehAnim == ANIM_VAN_GETIN)) { - adjustedTimeStep = min(m_pVehicleAnim->timeStep, 0.1f); + adjustedTimeStep = Min(m_pVehicleAnim->timeStep, 0.1f); // Smoothly change ped position neededPos.z = (neededPos.z - currentZ) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep) + currentZ; } else if (m_nPedState == PED_ENTER_CAR || m_nPedState == PED_CARJACK) { - neededPos.z = max(currentZ, autoZPos.z); + neededPos.z = Max(currentZ, autoZPos.z); } } } @@ -3172,7 +3172,7 @@ CPed::CheckIfInTheAir(void) CEntity *foundEntity; float startZ = pos.z - 1.54f; - bool foundGround = CWorld::ProcessVerticalLine(pos, startZ, foundColPoint, foundEntity, true, true, false, true, false, false, false); + bool foundGround = CWorld::ProcessVerticalLine(pos, startZ, foundColPoint, foundEntity, true, true, false, true, false, false, nil); if (!foundGround && m_nPedState != PED_JUMP) { pos.z -= 1.04f; @@ -4771,12 +4771,12 @@ CPed::FightStrike(CVector &touchedNodePos) float moveMult; if (m_lastFightMove == FIGHTMOVE_GROUNDKICK) { - moveMult = min(damageMult * 0.6f, 4.0f); + moveMult = Min(damageMult * 0.6f, 4.0f); } else { if (nearPed->m_nPedState != PED_DIE || damageMult >= 20) { moveMult = damageMult; } else { - moveMult = min(damageMult * 2.0f, 14.0f); + moveMult = Min(damageMult * 2.0f, 14.0f); } } diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 5922e0e7..ff581150 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -718,6 +718,15 @@ public: #endif }; +class cPedParams +{ +public: + char m_bDistanceCalculated; + char gap_1[3]; + float m_fDistance; + CPed *m_pPed; +}; + void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg); static_assert(offsetof(CPed, m_nPedState) == 0x224, "CPed: error"); diff --git a/src/peds/PedPlacement.cpp b/src/peds/PedPlacement.cpp index f292f4fa..d7b7ec75 100644 --- a/src/peds/PedPlacement.cpp +++ b/src/peds/PedPlacement.cpp @@ -29,7 +29,7 @@ CPedPlacement::FindZCoorForPed(CVector* pos) if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, nil)) foundColZ2 = foundCol.point.z; - zForPed = max(foundColZ, foundColZ2); + zForPed = Max(foundColZ, foundColZ2); if (zForPed > -99.0f) pos->z = 1.04f + zForPed; @@ -38,7 +38,7 @@ CPedPlacement::FindZCoorForPed(CVector* pos) CEntity* CPedPlacement::IsPositionClearOfCars(CVector* pos) { - return CWorld::TestSphereAgainstWorld(*pos, 0.25f, false, true, true, false, false, false, false); + return CWorld::TestSphereAgainstWorld(*pos, 0.25f, nil, true, true, false, false, false, false); } STARTPATCHES diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 5ae8c4be..1dcbdf46 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -97,8 +97,16 @@ CPlayerPed::AnnoyPlayerPed(bool annoyedByPassingEntity) class CPlayerPed_ : public CPlayerPed { public: +<<<<<<< HEAD +<<<<<<< HEAD CPlayerPed* ctor(void) { return ::new (this) CPlayerPed(); } void dtor(void) { CPlayerPed::~CPlayerPed(); } +======= + void dtor(void) { this->~CPlayerPed(); } +>>>>>>> More audio ped +======= + void dtor(void) { CPlayerPed::~CPlayerPed(); } +>>>>>>> fix }; STARTPATCHES diff --git a/src/peds/PlayerPed.cpp.autosave b/src/peds/PlayerPed.cpp.autosave new file mode 100644 index 00000000..1bf1c7fc --- /dev/null +++ b/src/peds/PlayerPed.cpp.autosave @@ -0,0 +1,110 @@ +#include "common.h" +#include "patcher.h" +#include "PlayerPed.h" +#include "Camera.h" +#include "WeaponEffects.h" +#include "ModelIndices.h" + +CPlayerPed::~CPlayerPed() +{ + delete m_pWanted; +} + +WRAPPER void CPlayerPed::ReApplyMoveAnims(void) { EAXJMP(0x4F07C0); } +WRAPPER void CPlayerPed::SetupPlayerPed(int32) { EAXJMP(0x4EFB60); } +WRAPPER void CPlayerPed::DeactivatePlayerPed(int32) { EAXJMP(0x4EFC00); } +WRAPPER void CPlayerPed::ReactivatePlayerPed(int32) { EAXJMP(0x4EFC20); } +WRAPPER void CPlayerPed::KeepAreaAroundPlayerClear(void) { EAXJMP(0x4F3460); } +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); } + +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); + field_1488[i] = 0; + } +} + +void CPlayerPed::ClearWeaponTarget() +{ + if (m_nPedType == PEDTYPE_PLAYER1) { + m_pPointGunAt = nil; + TheCamera.ClearPlayerWeaponMode(); + CWeaponEffects::ClearCrosshair(); + } + ClearPointGunAt(); +} + +void +CPlayerPed::SetWantedLevel(int32 level) +{ + m_pWanted->SetWantedLevel(level); +} + +void +CPlayerPed::SetWantedLevelNoDrop(int32 level) +{ + m_pWanted->SetWantedLevelNoDrop(level); +} + +// I don't know the actual purpose of parameter +void +CPlayerPed::AnnoyPlayerPed(bool annoyedByPassingEntity) +{ + if (m_pedStats->m_temper < 52) { + m_pedStats->m_temper++; + } else { + if (annoyedByPassingEntity) { + if (m_pedStats->m_temper < 55) { + m_pedStats->m_temper++; + } else { + m_pedStats->m_temper = 46; + } + } + } +} + +class CPlayerPed_ : public CPlayerPed +{ +public: + + CPlayerPed* ctor(void) { return ::new (this) CPlayerPed(); } + void dtor(void) { CPlayerPed::~CPlayerPed(); } +}; + +STARTPATCHES + InjectHook(0x4EF7E0, &CPlayerPed_::ctor, PATCH_JUMP); + InjectHook(0x4EFB30, &CPlayerPed_::dtor, PATCH_JUMP); + InjectHook(0x4F28A0, &CPlayerPed::ClearWeaponTarget, PATCH_JUMP); + InjectHook(0x4F3700, &CPlayerPed::AnnoyPlayerPed, PATCH_JUMP); +ENDPATCHES |