diff options
Diffstat (limited to 'src/peds')
-rw-r--r-- | src/peds/CopPed.cpp | 3 | ||||
-rw-r--r-- | src/peds/Gangs.cpp | 3 | ||||
-rw-r--r-- | src/peds/Ped.cpp | 1 | ||||
-rw-r--r-- | src/peds/PedFight.cpp | 8 | ||||
-rw-r--r-- | src/peds/PedIK.cpp | 16 | ||||
-rw-r--r-- | src/peds/PedType.cpp | 3 | ||||
-rw-r--r-- | src/peds/PlayerPed.cpp | 15 | ||||
-rw-r--r-- | src/peds/Population.cpp | 2 |
8 files changed, 29 insertions, 22 deletions
diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp index 1efd7733..fbfa7249 100644 --- a/src/peds/CopPed.cpp +++ b/src/peds/CopPed.cpp @@ -644,6 +644,9 @@ CCopPed::ProcessControl(void) int numCopsNear = 0; for (int i = 0; i < player->m_numNearPeds; ++i) { CPed *nearPed = player->m_nearPeds[i]; +#ifdef FIX_BUGS + if (nearPed) +#endif if (nearPed->m_nPedType == PEDTYPE_COP && nearPed->m_nPedState != PED_DEAD) ++numCopsNear; } diff --git a/src/peds/Gangs.cpp b/src/peds/Gangs.cpp index e6de0770..5cec5e12 100644 --- a/src/peds/Gangs.cpp +++ b/src/peds/Gangs.cpp @@ -5,6 +5,7 @@ #include "General.h" #include "Streaming.h" #include "Weapon.h" +#include "SaveBuf.h" CGangInfo CGangs::Gang[NUM_GANGS]; bool CGangs::GangAttackWithCops[NUM_GANGS]; @@ -120,6 +121,6 @@ INITSAVEBUF CheckSaveHeader(buf, 'G','N','G','\0', size - SAVE_HEADER_SIZE); for (int i = 0; i < NUM_GANGS; i++) - Gang[i] = ReadSaveBuf<CGangInfo>(buf); + ReadSaveBuf(&Gang[i], buf); VALIDATESAVEBUF(size); } diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 160b903c..1a8c4e35 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -39,6 +39,7 @@ #include "CutsceneShadow.h" #include "Clock.h" #include "Wanted.h" +#include "SaveBuf.h" CPed *gapTempPedList[50]; uint16 gnNumTempPedList; diff --git a/src/peds/PedFight.cpp b/src/peds/PedFight.cpp index a94dc9bd..7ec8b7dd 100644 --- a/src/peds/PedFight.cpp +++ b/src/peds/PedFight.cpp @@ -1309,7 +1309,7 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) if (IsPlayer()) moveAssoc->speed = 1.2f; - m_takeAStepAfterAttack = 0; + m_takeAStepAfterAttack = false; m_fightButtonPressure = 0; } else if (IsPlayer() && GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED && GetWeapon()->m_eWeaponType != WEAPONTYPE_BRASSKNUCKLE && @@ -3929,7 +3929,7 @@ CPed::DriveVehicle(void) targetLRLean = 0.0f; timeBlend = Pow(0.86f, CTimer::GetTimeStep()); } else { - targetLRLean = clamp(bike->m_fLeanLRAngle / bike->pBikeHandling->fFullAnimLean, -1.0f, 1.0f); + targetLRLean = Clamp(bike->m_fLeanLRAngle / bike->pBikeHandling->fFullAnimLean, -1.0f, 1.0f); timeBlend = Pow(0.86f, CTimer::GetTimeStep()); } @@ -4116,7 +4116,7 @@ CPed::DriveVehicle(void) lDriveAssoc->blendAmount = 0.0f; if (rDriveAssoc) - rDriveAssoc->blendAmount = clamp(steerAngle * -100.0f / 61.0f, 0.0f, 1.0f); + rDriveAssoc->blendAmount = Clamp(steerAngle * -100.0f / 61.0f, 0.0f, 1.0f); else if (m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT)) CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_STD_BOAT_DRIVE_RIGHT); else if (m_pMyVehicle->bLowVehicle) @@ -4129,7 +4129,7 @@ CPed::DriveVehicle(void) rDriveAssoc->blendAmount = 0.0f; if (lDriveAssoc) - lDriveAssoc->blendAmount = clamp(steerAngle * 100.0f / 61.0f, 0.0f, 1.0f); + lDriveAssoc->blendAmount = Clamp(steerAngle * 100.0f / 61.0f, 0.0f, 1.0f); else if (m_pMyVehicle->IsBoat() && !(m_pMyVehicle->pHandling->Flags & HANDLING_SIT_IN_BOAT)) CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_STD_BOAT_DRIVE_LEFT); else if (m_pMyVehicle->bLowVehicle) diff --git a/src/peds/PedIK.cpp b/src/peds/PedIK.cpp index 475e04f1..6730d731 100644 --- a/src/peds/PedIK.cpp +++ b/src/peds/PedIK.cpp @@ -79,7 +79,7 @@ CPedIK::MoveLimb(LimbOrientation &limb, float targetYaw, float targetPitch, Limb } if (limb.yaw > moveInfo.maxYaw || limb.yaw < moveInfo.minYaw) { - limb.yaw = clamp(limb.yaw, moveInfo.minYaw, moveInfo.maxYaw); + limb.yaw = Clamp(limb.yaw, moveInfo.minYaw, moveInfo.maxYaw); result = ANGLES_SET_TO_MAX; } @@ -97,7 +97,7 @@ CPedIK::MoveLimb(LimbOrientation &limb, float targetYaw, float targetPitch, Limb } if (limb.pitch > moveInfo.maxPitch || limb.pitch < moveInfo.minPitch) { - limb.pitch = clamp(limb.pitch, moveInfo.minPitch, moveInfo.maxPitch); + limb.pitch = Clamp(limb.pitch, moveInfo.minPitch, moveInfo.maxPitch); result = ANGLES_SET_TO_MAX; } return result; @@ -122,14 +122,14 @@ CPedIK::LookInDirection(float targetYaw, float targetPitch) m_headOrient.yaw = Atan2(-m->at.y, -m->at.x); m_headOrient.yaw -= m_ped->m_fRotationCur; m_headOrient.yaw = CGeneral::LimitRadianAngle(m_headOrient.yaw); - float up = clamp(m->up.z, -1.0f, 1.0f); + float up = Clamp(m->up.z, -1.0f, 1.0f); m_headOrient.pitch = Atan2(-up, Sqrt(1.0f - SQR(-up))); } // parent of head is neck RwMatrix *m = GetComponentMatrix(m_ped, PED_NECK); yaw = CGeneral::LimitRadianAngle(Atan2(-m->at.y, -m->at.x)); - float up = clamp(m->up.z, -1.0f, 1.0f); + float up = Clamp(m->up.z, -1.0f, 1.0f); pitch = Atan2(-up, Sqrt(1.0f - SQR(-up))); float headYaw = CGeneral::LimitRadianAngle(targetYaw - (yaw + m_torsoOrient.yaw)); float headPitch = CGeneral::LimitRadianAngle(targetPitch - pitch) * Cos(Min(Abs(headYaw), HALFPI)); @@ -336,11 +336,11 @@ CPedIK::RestoreLookAt(void) void CPedIK::ExtractYawAndPitchWorld(RwMatrix *mat, float *yaw, float *pitch) { - float f = clamp(DotProduct(mat->up, CVector(0.0f, 1.0f, 0.0f)), -1.0f, 1.0f); + float f = Clamp(DotProduct(mat->up, CVector(0.0f, 1.0f, 0.0f)), -1.0f, 1.0f); *yaw = Acos(f); if (mat->up.x > 0.0f) *yaw = -*yaw; - f = clamp(DotProduct(mat->right, CVector(0.0f, 0.0f, 1.0f)), -1.0f, 1.0f); + f = Clamp(DotProduct(mat->right, CVector(0.0f, 0.0f, 1.0f)), -1.0f, 1.0f); *pitch = Acos(f); if (mat->up.z > 0.0f) *pitch = -*pitch; } @@ -348,11 +348,11 @@ CPedIK::ExtractYawAndPitchWorld(RwMatrix *mat, float *yaw, float *pitch) void CPedIK::ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch) { - float f = clamp(DotProduct(mat->at, CVector(0.0f, 0.0f, 1.0f)), -1.0f, 1.0f); + float f = Clamp(DotProduct(mat->at, CVector(0.0f, 0.0f, 1.0f)), -1.0f, 1.0f); *yaw = Acos(f); if (mat->at.y > 0.0f) *yaw = -*yaw; - f = clamp(DotProduct(mat->right, CVector(1.0f, 0.0f, 0.0f)), -1.0f, 1.0f); + f = Clamp(DotProduct(mat->right, CVector(1.0f, 0.0f, 0.0f)), -1.0f, 1.0f); *pitch = Acos(f); if (mat->up.x > 0.0f) *pitch = -*pitch; } diff --git a/src/peds/PedType.cpp b/src/peds/PedType.cpp index bacb1a78..dcd4c717 100644 --- a/src/peds/PedType.cpp +++ b/src/peds/PedType.cpp @@ -3,6 +3,7 @@ #include "General.h" #include "FileMgr.h" #include "PedType.h" +#include "SaveBuf.h" CPedType *CPedType::ms_apPedType[NUM_PEDTYPES]; CPedStats *CPedStats::ms_apPedStats[NUM_PEDSTATS]; @@ -201,7 +202,7 @@ INITSAVEBUF CheckSaveHeader(buf, 'P', 'T', 'P', '\0', size - SAVE_HEADER_SIZE); for(int i = 0; i < NUM_PEDTYPES; i++) - *ms_apPedType[i] = ReadSaveBuf<CPedType>(buf); + ReadSaveBuf(ms_apPedType[i], buf); VALIDATESAVEBUF(size) } diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 5c40419e..c82fe850 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -23,6 +23,7 @@ #include "Replay.h" #include "PedPlacement.h" #include "VarConsole.h" +#include "SaveBuf.h" #define PAD_MOVE_TO_GAME_WORLD_MOVE 60.0f @@ -836,8 +837,8 @@ CPlayerPed::PlayerControlFighter(CPad *padUsed) if (padMove > 0.0f) { m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(0.0f, 0.0f, -leftRight, upDown) - TheCamera.Orientation; - m_takeAStepAfterAttack = padMove > 2 * PAD_MOVE_TO_GAME_WORLD_MOVE; - if (padUsed->GetSprint() && padMove > 1 * PAD_MOVE_TO_GAME_WORLD_MOVE) + m_takeAStepAfterAttack = padMove > (2 * PAD_MOVE_TO_GAME_WORLD_MOVE); + if (padUsed->GetSprint() && padMove > (1 * PAD_MOVE_TO_GAME_WORLD_MOVE)) bIsAttacking = false; } @@ -2080,13 +2081,13 @@ CPlayerPed::UpdateMeleeAttackers(void) void CPlayerPed::RemovePedFromMeleeList(CPed *ped) { - int i = 0; - for (; m_pMeleeList[i] != ped; i++) { - if (i >= ARRAY_SIZE(m_pMeleeList)) + for (uint16 i = 0; i < ARRAY_SIZE(m_pMeleeList); i++) { + if (m_pMeleeList[i] == ped) { + m_pMeleeList[i] = nil; + ped->m_attackTimer = 0; return; + } } - m_pMeleeList[i] = nil; - ped->m_attackTimer = 0; } void diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index f0e41231..0f68c679 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -413,7 +413,7 @@ CPopulation::PedCreationDistMultiplier() return 1.0f; float vehSpeed = veh->m_vecMoveSpeed.Magnitude2D(); - return clamp(vehSpeed - 0.1f + 1.0f, 1.0f, 1.5f); + return Clamp(vehSpeed - 0.1f + 1.0f, 1.0f, 1.5f); } CPed* |