From daed13485ef47d9c8992e53e1a976fba237fca50 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 15 Apr 2020 08:03:53 +0300 Subject: CWeapon done, ps2 cheats fix --- src/peds/Ped.cpp | 2 +- src/peds/Ped.h | 5 +++++ src/peds/PlayerPed.cpp | 8 ++++---- src/peds/PlayerPed.h | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src/peds') diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 2cd942f9..4ee31a30 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -1231,7 +1231,7 @@ CPed::Attack(void) weaponAnimAssoc->SetCurrentTime(0.0f); if (IsPlayer()) { - ((CPlayerPed*)this)->field_1376 = 0.0f; + ((CPlayerPed*)this)->m_fAttackButtonCounter = 0.0f; ((CPlayerPed*)this)->m_bHaveTargetSelected = false; } } diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 2edd5d68..ea8c4080 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -796,7 +796,12 @@ public: PedState GetPedState(void) { return m_nPedState; } void SetPedState(PedState state) { m_nPedState = state; } + bool Dead(void) { return m_nPedState == PED_DEAD; } + bool Dying(void) { return m_nPedState == PED_DIE; } bool DyingOrDead(void) { return m_nPedState == PED_DIE || m_nPedState == PED_DEAD; } + bool OnGround(void) { return m_nPedState == PED_FALL || m_nPedState == PED_DIE || m_nPedState == PED_DEAD; } + + bool Driving(void) { return m_nPedState == PED_DRIVING; } bool InVehicle(void) { return bInVehicle && m_pMyVehicle; } // True when ped is sitting/standing in vehicle, not in enter/exit state. bool EnteringCar(void) { return m_nPedState == PED_ENTER_CAR || m_nPedState == PED_CARJACK; } diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index ccc0a43a..dcd9486f 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -43,8 +43,8 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1) m_fStaminaProgress = 0.0f; m_nEvadeAmount = 0; field_1367 = 0; - m_nShotDelay = 0; - field_1376 = 0.0f; + m_nHitAnimDelayTimer = 0; + m_fAttackButtonCounter = 0.0f; m_bHaveTargetSelected = false; m_bHasLockOnTarget = false; m_bCanBeDamaged = true; @@ -1024,10 +1024,10 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) if (padUsed->WeaponJustDown()) { m_bHaveTargetSelected = true; } else if (!m_bHaveTargetSelected) { - field_1376 += CTimer::GetTimeStepNonClipped(); + m_fAttackButtonCounter += CTimer::GetTimeStepNonClipped(); } } else { - field_1376 = 0.0f; + m_fAttackButtonCounter = 0.0f; m_bHaveTargetSelected = false; } SetAttack(nil); diff --git a/src/peds/PlayerPed.h b/src/peds/PlayerPed.h index c139bbbc..c6823c2d 100644 --- a/src/peds/PlayerPed.h +++ b/src/peds/PlayerPed.h @@ -20,8 +20,8 @@ public: uint8 m_nEvadeAmount; int8 field_1367; uint32 m_nSpeedTimer; - int32 m_nShotDelay; - float field_1376; // m_fAttackButtonCounter? + uint32 m_nHitAnimDelayTimer; + float m_fAttackButtonCounter; // m_fAttackButtonCounter? bool m_bHaveTargetSelected; // may have better name int8 field_1381; int8 field_1382; -- cgit v1.2.3 From 4da1879975ef28cb7f406166d62d154d03ef47d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Wed, 15 Apr 2020 19:19:45 +0300 Subject: Many fixes and cleanup --- src/peds/Ped.cpp | 17 ++++++-------- src/peds/Ped.h | 10 ++++----- src/peds/Population.cpp | 60 ++++++++++++++++++++++++------------------------- 3 files changed, 42 insertions(+), 45 deletions(-) (limited to 'src/peds') diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index cee2b323..d6077ed8 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -62,7 +62,7 @@ CPed *gapTempPedList[50]; uint16 gnNumTempPedList; -CColPoint &aTempPedColPts = *(CColPoint*)0x62DB14; +CColPoint aTempPedColPts[MAX_COLLISION_POINTS]; // Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL) PedAudioData CommentWaitTime[39] = { @@ -106,8 +106,6 @@ PedAudioData CommentWaitTime[39] = { {1000, 1000, 1000, 1000}, {1000, 1000, 5000, 5000}, }; -// *(CPedAudioData(*)[39]) * (uintptr*)0x5F94C4; - uint16 nPlayerInComboMove; RpClump *flyingClumpTemp; @@ -139,10 +137,9 @@ FightMove tFightMoves[NUM_FIGHTMOVES] = { {ANIM_HIT_BEHIND, 0.0f, 0.0f, 0.0f, 0.0f, HITLEVEL_NULL, 0, 0}, {ANIM_FIGHT2_IDLE, 0.0f, 0.0f, 0.0f, 0.0f, HITLEVEL_NULL, 0, 0}, }; -// *(FightMove(*)[NUM_FIGHTMOVES])* (uintptr*)0x5F9844; -uint16 &CPed::nThreatReactionRangeMultiplier = *(uint16*)0x5F8C98; -uint16 &CPed::nEnterCarRangeMultiplier = *(uint16*)0x5F8C94; +uint16 CPed::nThreatReactionRangeMultiplier = 1; +uint16 CPed::nEnterCarRangeMultiplier = 1; CVector vecPedCarDoorAnimOffset; CVector vecPedCarDoorLoAnimOffset; @@ -151,9 +148,9 @@ CVector vecPedQuickDraggedOutCarAnimOffset; CVector vecPedDraggedOutCarAnimOffset; CVector vecPedTrainDoorAnimOffset; -bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44; -bool &CPed::bPedCheat2 = *(bool*)0x95CD5A; -bool &CPed::bPedCheat3 = *(bool*)0x95CD59; +bool CPed::bNastyLimbsCheat; +bool CPed::bPedCheat2; +bool CPed::bPedCheat3; CVector2D CPed::ms_vec2DFleePosition; void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); } @@ -4143,7 +4140,7 @@ CPed::SetGetUp(void) && ((CTimer::GetFrameCounter() + m_randomSeed % 256 + 5) % 8 || CCollision::ProcessColModels(GetMatrix(), *CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(), collidingVeh->GetMatrix(), *CModelInfo::GetModelInfo(collidingVeh->m_modelIndex)->GetColModel(), - &aTempPedColPts, nil, nil) > 0)) { + aTempPedColPts, nil, nil) > 0)) { bGetUpAnimStarted = false; if (IsPlayer()) diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 2edd5d68..321d5bff 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -823,14 +823,14 @@ public: } // set by 0482:set_threat_reaction_range_multiplier opcode - static uint16 &nThreatReactionRangeMultiplier; + static uint16 nThreatReactionRangeMultiplier; // set by 0481:set_enter_car_range_multiplier opcode - static uint16 &nEnterCarRangeMultiplier; + static uint16 nEnterCarRangeMultiplier; - static bool &bNastyLimbsCheat; - static bool &bPedCheat2; - static bool &bPedCheat3; + static bool bNastyLimbsCheat; + static bool bPedCheat2; + static bool bPedCheat3; static CVector2D ms_vec2DFleePosition; #ifdef TOGGLEABLE_BETA_FEATURES diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index 6959487f..e26e2eaf 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -47,36 +47,36 @@ const RegenerationPoint aSafeZones[] = { CVector(-321.0f, -1043.0f, -13.2f), CVector(-328.0f, -1045.0f, -13.2f), CVector(-398.0f, -1044.0f, -13.5f), CVector(-390.0f, -1040.5f, -13.5f) }, { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 425.0f, 280.0f, 471.0f, 447.0f, 20.0f, 5.0f, CVector(-292.0f, -457.0f, -11.6f), CVector(-310.0f, -461.0f, -11.6f), CVector(-413.0f, -461.0f, -11.5f), CVector(-399.0f, -457.0f, -11.3f) } -}; // *(RegenerationPoint(*)[8]) * (uintptr*)0x5FA578; - -PedGroup CPopulation::ms_pPedGroups[NUMPEDGROUPS]; // = *(PedGroup(*)[NUMPEDGROUPS]) * (uintptr*)0x6E9248; -bool CPopulation::ms_bGivePedsWeapons; // = *(bool*)0x95CCF6; -int32 CPopulation::m_AllRandomPedsThisType = -1; // = *(int32*)0x5FA570; -float CPopulation::PedDensityMultiplier = 1.0f; // = *(float*)0x5FA56C; -uint32 CPopulation::ms_nTotalMissionPeds; // = *(uint32*)0x8F5F70; -int32 CPopulation::MaxNumberOfPedsInUse = 25; // *(int32*)0x5FA574; -uint32 CPopulation::ms_nNumCivMale; // = *(uint32*)0x8F2548; -uint32 CPopulation::ms_nNumCivFemale; // = *(uint32*)0x8F5F44; -uint32 CPopulation::ms_nNumCop; // = *(uint32*)0x885AFC; -bool CPopulation::bZoneChangeHasHappened; // = *(bool*)0x95CD79; -uint32 CPopulation::ms_nNumEmergency; // = *(uint32*)0x94071C; -int8 CPopulation::m_CountDownToPedsAtStart; // = *(int8*)0x95CD4F; -uint32 CPopulation::ms_nNumGang1; // = *(uint32*)0x8F1B1C; -uint32 CPopulation::ms_nNumGang2; // = *(uint32*)0x8F1B14; -uint32 CPopulation::ms_nTotalPeds; // = *(uint32*)0x95CB50; -uint32 CPopulation::ms_nNumGang3; // = *(uint32*)0x8F2548; -uint32 CPopulation::ms_nTotalGangPeds; // = *(uint32*)0x885AF0; -uint32 CPopulation::ms_nNumGang4; // = *(uint32*)0x8F1B2C; -uint32 CPopulation::ms_nTotalCivPeds; // = *(uint32*)0x8F2C3C; -uint32 CPopulation::ms_nNumGang5; // = *(uint32*)0x8F1B30; -uint32 CPopulation::ms_nNumDummy; // = *(uint32*)0x8F1A98; -uint32 CPopulation::ms_nNumGang6; // = *(uint32*)0x8F1B20; -uint32 CPopulation::ms_nNumGang9; // = *(uint32*)0x8F1B10; -uint32 CPopulation::ms_nNumGang7; // = *(uint32*)0x8F1B28; -uint32 CPopulation::ms_nNumGang8; // = *(uint32*)0x8F1B0C; -CVector CPopulation::RegenerationPoint_a; // = *(CVector*)0x8E2AA4; -CVector CPopulation::RegenerationPoint_b; // = *(CVector*)0x8E2A98; -CVector CPopulation::RegenerationForward; // = *(CVector*)0x8F1AD4; +}; + +PedGroup CPopulation::ms_pPedGroups[NUMPEDGROUPS]; +bool CPopulation::ms_bGivePedsWeapons; +int32 CPopulation::m_AllRandomPedsThisType = -1; +float CPopulation::PedDensityMultiplier = 1.0f; +uint32 CPopulation::ms_nTotalMissionPeds; +int32 CPopulation::MaxNumberOfPedsInUse = 25; +uint32 CPopulation::ms_nNumCivMale; +uint32 CPopulation::ms_nNumCivFemale; +uint32 CPopulation::ms_nNumCop; +bool CPopulation::bZoneChangeHasHappened; +uint32 CPopulation::ms_nNumEmergency; +int8 CPopulation::m_CountDownToPedsAtStart; +uint32 CPopulation::ms_nNumGang1; +uint32 CPopulation::ms_nNumGang2; +uint32 CPopulation::ms_nTotalPeds; +uint32 CPopulation::ms_nNumGang3; +uint32 CPopulation::ms_nTotalGangPeds; +uint32 CPopulation::ms_nNumGang4; +uint32 CPopulation::ms_nTotalCivPeds; +uint32 CPopulation::ms_nNumGang5; +uint32 CPopulation::ms_nNumDummy; +uint32 CPopulation::ms_nNumGang6; +uint32 CPopulation::ms_nNumGang9; +uint32 CPopulation::ms_nNumGang7; +uint32 CPopulation::ms_nNumGang8; +CVector CPopulation::RegenerationPoint_a; +CVector CPopulation::RegenerationPoint_b; +CVector CPopulation::RegenerationForward; void CPopulation::Initialise() -- cgit v1.2.3 From c3647ee51e05df419ebb456416cb84e7f902e581 Mon Sep 17 00:00:00 2001 From: Fire-Head Date: Wed, 15 Apr 2020 20:34:58 +0300 Subject: rem comment --- src/peds/PlayerPed.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/peds') diff --git a/src/peds/PlayerPed.h b/src/peds/PlayerPed.h index c6823c2d..f96d8e6a 100644 --- a/src/peds/PlayerPed.h +++ b/src/peds/PlayerPed.h @@ -21,7 +21,7 @@ public: int8 field_1367; uint32 m_nSpeedTimer; uint32 m_nHitAnimDelayTimer; - float m_fAttackButtonCounter; // m_fAttackButtonCounter? + float m_fAttackButtonCounter; bool m_bHaveTargetSelected; // may have better name int8 field_1381; int8 field_1382; -- cgit v1.2.3