diff options
author | erorcun <erorcunerorcun@hotmail.com.tr> | 2021-07-03 00:32:47 +0200 |
---|---|---|
committer | erorcun <erorcunerorcun@hotmail.com.tr> | 2021-07-03 00:42:24 +0200 |
commit | a8549e86a7c29c38e6a0570b8ecd88f03db98e9a (patch) | |
tree | 381f2ba0a0facce8923787276940187cf2cb8578 /src | |
parent | Peds: Efforts to find the reason of crashes on GCC 7.5.0 (diff) | |
download | re3-a8549e86a7c29c38e6a0570b8ecd88f03db98e9a.tar re3-a8549e86a7c29c38e6a0570b8ecd88f03db98e9a.tar.gz re3-a8549e86a7c29c38e6a0570b8ecd88f03db98e9a.tar.bz2 re3-a8549e86a7c29c38e6a0570b8ecd88f03db98e9a.tar.lz re3-a8549e86a7c29c38e6a0570b8ecd88f03db98e9a.tar.xz re3-a8549e86a7c29c38e6a0570b8ecd88f03db98e9a.tar.zst re3-a8549e86a7c29c38e6a0570b8ecd88f03db98e9a.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/core/Crime.h | 2 | ||||
-rw-r--r-- | src/peds/Ped.cpp | 33 | ||||
-rw-r--r-- | src/peds/Ped.h | 2 | ||||
-rw-r--r-- | src/weapons/Weapon.cpp | 4 |
4 files changed, 27 insertions, 14 deletions
diff --git a/src/core/Crime.h b/src/core/Crime.h index 8dfae5b8..05829040 100644 --- a/src/core/Crime.h +++ b/src/core/Crime.h @@ -25,7 +25,7 @@ class CCrimeBeingQd { public: eCrimeType m_nType; - uint32 m_nId; + int32 m_nId; uint32 m_nTime; CVector m_vecPosn; bool m_bReported; diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 0acc4daf..bde6f8d7 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -3049,7 +3049,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints) CColModel *hisCol = CModelInfo::GetModelInfo(collidingEnt->GetModelIndex())->GetColModel(); if (!bUsesCollision) - return false; + return 0; if (collidingEnt->IsVehicle() && ((CVehicle*)collidingEnt)->IsBoat()) collidedWithBoat = true; @@ -6094,7 +6094,7 @@ CPed::FollowPath(void) } void -CPed::SetEvasiveStep(CEntity *reason, uint8 animType) +CPed::SetEvasiveStep(CPhysical *reason, uint8 animType) { AnimationId stepAnim; @@ -6112,22 +6112,29 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType) if (neededTurn > PI) neededTurn = TWOPI - neededTurn; - CVehicle *veh = (CVehicle*)reason; - if (reason->IsVehicle() && veh->m_vehType == VEHICLE_TYPE_CAR) { + if (reason->IsVehicle() && ((CVehicle*)reason)->IsCar()) { + CVehicle *veh = (CVehicle*)reason; if (veh->m_nCarHornTimer != 0) { vehPressedHorn = true; if (!IsPlayer()) animType = 1; } } - if (neededTurn <= DEGTORAD(90.0f) || veh->GetModelIndex() == MI_RCBANDIT || vehPressedHorn || animType != 0) { - SetLookFlag(veh, true); - if ((CGeneral::GetRandomNumber() & 1) && veh->GetModelIndex() != MI_RCBANDIT && animType == 0) { + +#ifdef FIX_BUGS + #define IS_RCBANDIT (reason->IsVehicle() && reason->GetModelIndex() == MI_RCBANDIT) +#else + #define IS_RCBANDIT (reason->GetModelIndex() == MI_RCBANDIT) +#endif + + if (neededTurn <= DEGTORAD(90.0f) || IS_RCBANDIT || vehPressedHorn || animType != 0) { + SetLookFlag(reason, true); + if ((CGeneral::GetRandomNumber() & 1) && !IS_RCBANDIT && animType == 0) { stepAnim = ANIM_STD_HAILTAXI; } else { - float vehDirection = CGeneral::GetRadianAngleBetweenPoints( - veh->m_vecMoveSpeed.x, veh->m_vecMoveSpeed.y, + float dangerDirection = CGeneral::GetRadianAngleBetweenPoints( + reason->m_vecMoveSpeed.x, reason->m_vecMoveSpeed.y, 0.0f, 0.0f); // Let's turn our back to the "reason" @@ -6137,14 +6144,14 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType) angleToFace -= TWOPI; // We don't want to run towards car's direction - float dangerZone = angleToFace - vehDirection; + float dangerZone = angleToFace - dangerDirection; dangerZone = CGeneral::LimitRadianAngle(dangerZone); // So, add or subtract 90deg (jump to left/right) according to that if (dangerZone > 0.0f) - angleToFace = vehDirection - HALFPI; + angleToFace = dangerDirection - HALFPI; else - angleToFace = vehDirection + HALFPI; + angleToFace = dangerDirection + HALFPI; stepAnim = ANIM_STD_NUM; if (animType == 0 || animType == 1) @@ -6166,6 +6173,8 @@ CPed::SetEvasiveStep(CEntity *reason, uint8 animType) SetPedState(PED_STEP_AWAY); } } + +#undef IS_RCBANDIT } void diff --git a/src/peds/Ped.h b/src/peds/Ped.h index 6d32b65e..33839aa7 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -625,7 +625,7 @@ public: void SetAimFlag(CEntity* to); void SetAimFlag(float angle); void SetAmmo(eWeaponType weaponType, uint32 ammo); - void SetEvasiveStep(CEntity*, uint8); + void SetEvasiveStep(CPhysical*, uint8); void GrantAmmo(eWeaponType, uint32); void SetEvasiveDive(CPhysical*, uint8); void SetAttack(CEntity*); diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 5704c111..43a85db8 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -2266,7 +2266,11 @@ CWeapon::HitsGround(CEntity *holder, CVector *fireSource, CEntity *aimingTo) void CWeapon::BlowUpExplosiveThings(CEntity *thing) { +#ifdef FIX_BUGS + if ( thing && thing->IsObject() ) +#else if ( thing ) +#endif { CObject *object = (CObject*)thing; int32 mi = object->GetModelIndex(); |