1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 16:30:01 +00:00

Peds, bike center of mass and reversing fixes

This commit is contained in:
eray orçunus 2020-06-09 00:56:01 +03:00
parent f8b4c0ee1d
commit dba2b052a6
9 changed files with 711 additions and 353 deletions

View file

@ -183,7 +183,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
float distance = (pVehicle->AutoPilot.m_vecDestinationCoors - pVehicle->GetPosition()).Magnitude2D();
if ((pVehicle->bIsAmbulanceOnDuty || pVehicle->bIsFireTruckOnDuty) && distance < 20.0f)
pVehicle->AutoPilot.m_nCarMission = MISSION_EMERGENCYVEHICLE_STOP;
if (distance < 5.0f){
if (distance < 3.0f){
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
if (pVehicle->bParking) {
@ -236,8 +236,8 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
}
break;
case MISSION_GOTOCOORDS_ACCURATE:
if ((pVehicle->AutoPilot.m_vecDestinationCoors - pVehicle->GetPosition()).Magnitude2D() < 20.0f ||
pVehicle->AutoPilot.m_bIgnorePathfinding)
if ((pVehicle->AutoPilot.m_vecDestinationCoors - pVehicle->GetPosition()).Magnitude2D() < FindSwitchDistanceClose(pVehicle) ||
pVehicle->AutoPilot.m_bIgnorePathfinding)
pVehicle->AutoPilot.m_nCarMission = MISSION_GOTO_COORDS_STRAIGHT_ACCURATE;
break;
case MISSION_GOTO_COORDS_STRAIGHT_ACCURATE:
@ -402,7 +402,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
if (flatSpeed < SQR(0.018f) && CTimer::GetTimeInMilliseconds() - pVehicle->AutoPilot.m_nAntiReverseTimer > 2000){
pVehicle->AutoPilot.m_nTempAction = TEMPACT_REVERSE;
if (pVehicle->AutoPilot.m_nCarMission != MISSION_NONE &&
pVehicle->AutoPilot.m_nCarMission != MISSION_CRUISE || pVehicle->VehicleCreatedBy == RANDOM_VEHICLE)
pVehicle->AutoPilot.m_nCarMission != MISSION_CRUISE || pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 1500;
else
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 750;
@ -434,7 +434,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nCarMission = MISSION_BLOCKPLAYER_FARAWAY;
}
}
if (pVehicle->GetUp().z < 0.7f){
if (pVehicle->GetUp().z < -0.7f){
pVehicle->AutoPilot.m_nTempAction = TEMPACT_WAIT;
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 1000;
}

View file

@ -74,20 +74,18 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
break;
}
m_bIsInPursuit = false;
field_1350 = 1;
field_5FE = 1;
m_bIsDisabledCop = false;
m_fAbseilPos = 0.0f;
m_attackTimer = 0;
m_bBeatingSuspect = false;
m_bStopAndShootDisabledZone = false;
field_601 = false;
m_bZoneDisabled = false;
field_1364 = -1;
field_628 = -1;
m_nRoadblockNode = -1; // TODO(Miami): this will be nil
field_5FF = 0;
m_fAbseilPos = 0.0f;
m_bBeatingSuspect = false;
m_pPointGunAt = nil;
// VC also initializes in here, but as nil
#ifdef FIX_BUGS
m_nRoadblockNode = -1;
#endif
}
CCopPed::~CCopPed()

View file

@ -17,13 +17,15 @@ public:
float m_fDistanceToTarget;
bool m_bIsInPursuit;
bool m_bIsDisabledCop;
int8 field_1350;
int8 field_5FE;
int8 field_5FF;
bool m_bBeatingSuspect;
bool m_bStopAndShootDisabledZone;
bool field_601; // set when police dragging player from car
bool m_bZoneDisabled;
float m_fAbseilPos; // VC leftover, unused
float m_fAbseilPos;
eCopType m_nCopType;
int8 field_1364;
int8 field_628;
CCopPed(eCopType, int32 modifier = 0);
~CCopPed();

File diff suppressed because it is too large Load diff

View file

@ -469,14 +469,14 @@ public:
//uint32 b157_8
//uint32 b157_10
//uint32 b157_20
//uint32 b157_40
uint32 b157_40 : 1;
uint32 bIgnoreThreatsBehindObjects : 1;
uint32 bNeverEverTargetThisPed : 1;
uint32 bCrouchWhenScared : 1;
uint32 bKnockedOffBike : 1;
//uint32 b158_8
//uint32 b158_10
uint32 b158_10 : 1;
uint32 bBoughtIceCream : 1;
//uint32 b158_40
//uint32 b158_80
@ -654,14 +654,14 @@ public:
void AimGun(void);
void KillPedWithCar(CVehicle *veh, float impulse);
void Say(uint16 audio);
void SetLookFlag(CEntity *target, bool keepTryingToLook);
void SetLookFlag(float direction, bool keepTryingToLook);
void SetLookFlag(CEntity* target, bool keepTryingToLook, bool cancelPrevious = false);
void SetLookFlag(float direction, bool keepTryingToLook, bool cancelPrevious = false);
void SetLookTimer(int time);
void SetDie(AnimationId anim = ANIM_KO_SHOT_FRONT1, float arg1 = 4.0f, float arg2 = 0.0f);
void SetDead(void);
void ApplyHeadShot(eWeaponType weaponType, CVector pos, bool evenOnPlayer);
void RemoveBodyPart(PedNode nodeId, int8 direction);
bool OurPedCanSeeThisOne(CEntity *target);
bool OurPedCanSeeThisOne(CEntity *target, bool shootablesDoBlock = false);
void Avoid(void);
void Attack(void);
void ClearAimFlag(void);
@ -842,6 +842,7 @@ public:
void PedShuffle();
void DriveVehicle();
void PositionAttachedPed();
bool CanUseTorsoWhenLooking();
// Static methods
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);

View file

@ -7,30 +7,6 @@
class CObject;
enum eCarNodes
{
CAR_WHEEL_RF = 1,
CAR_WHEEL_RM,
CAR_WHEEL_RB,
CAR_WHEEL_LF,
CAR_WHEEL_LM,
CAR_WHEEL_LB,
CAR_BUMP_FRONT,
CAR_BUMP_REAR,
CAR_WING_RF,
CAR_WING_RR,
CAR_DOOR_RF,
CAR_DOOR_RR,
CAR_WING_LF,
CAR_WING_LR,
CAR_DOOR_LF,
CAR_DOOR_LR,
CAR_BONNET,
CAR_BOOT,
CAR_WINDSCREEN,
NUM_CAR_NODES,
};
// These are used for all the wheel arrays
// DON'T confuse with VEHWHEEL, which are vehicle components
enum {
@ -40,13 +16,6 @@ enum {
CARWHEEL_REAR_RIGHT
};
enum {
CAR_DOOR_FLAG_UNKNOWN = 0x0,
CAR_DOOR_FLAG_LF = 0x1,
CAR_DOOR_FLAG_LR = 0x2,
CAR_DOOR_FLAG_RF = 0x4,
CAR_DOOR_FLAG_RR = 0x8
};
class CAutomobile : public CVehicle
{
@ -196,19 +165,4 @@ public:
static const uint32 nSaveStructSize;
static void SetAllTaxiLights(bool set);
};
inline uint8 GetCarDoorFlag(int32 carnode) {
switch (carnode) {
case CAR_DOOR_LF:
return CAR_DOOR_FLAG_LF;
case CAR_DOOR_LR:
return CAR_DOOR_FLAG_LR;
case CAR_DOOR_RF:
return CAR_DOOR_FLAG_RF;
case CAR_DOOR_RR:
return CAR_DOOR_FLAG_RR;
default:
return CAR_DOOR_FLAG_UNKNOWN;
}
}
};

View file

@ -127,7 +127,7 @@ CBike::CBike(int32 id, uint8 CreatedBy)
bIsOnFire = false;
m_bike_flag80 = false;
m_fTireTemperature = 0.0f;
m_fTireTemperature = 1.0f;
m_fBrakeDestabilization = 0.0f;
field_490 = 0;

View file

@ -133,3 +133,17 @@ public:
void SetupModelNodes(void);
void ReduceHornCounter(void);
};
inline int8 GetBikeDoorFlag(int32 carnode) {
switch (carnode) {
case CAR_DOOR_RR:
case CAR_DOOR_LR:
return CAR_DOOR_FLAG_RR | CAR_DOOR_FLAG_LR;
case CAR_DOOR_RF:
case CAR_DOOR_LF:
case CAR_WINDSCREEN:
return CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF;
default:
return CAR_DOOR_FLAG_UNKNOWN;
}
}

View file

@ -20,6 +20,38 @@ enum {
PERMANENT_VEHICLE = 4,
};
enum eCarNodes
{
CAR_WHEEL_RF = 1,
CAR_WHEEL_RM,
CAR_WHEEL_RB,
CAR_WHEEL_LF,
CAR_WHEEL_LM,
CAR_WHEEL_LB,
CAR_BUMP_FRONT,
CAR_BUMP_REAR,
CAR_WING_RF,
CAR_WING_RR,
CAR_DOOR_RF,
CAR_DOOR_RR,
CAR_WING_LF,
CAR_WING_LR,
CAR_DOOR_LF,
CAR_DOOR_LR,
CAR_BONNET,
CAR_BOOT,
CAR_WINDSCREEN,
NUM_CAR_NODES,
};
enum {
CAR_DOOR_FLAG_UNKNOWN = 0x0,
CAR_DOOR_FLAG_LF = 0x1,
CAR_DOOR_FLAG_LR = 0x2,
CAR_DOOR_FLAG_RF = 0x4,
CAR_DOOR_FLAG_RR = 0x8
};
enum eCarLock {
CARLOCK_NOT_USED,
CARLOCK_UNLOCKED,
@ -379,3 +411,43 @@ public:
void DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle);
bool IsVehiclePointerValid(CVehicle* pVehicle);
// Names of functions below are made up by us.
// Used in III and VC.
inline int8 GetCarDoorFlag(int32 carnode) {
switch (carnode) {
case CAR_DOOR_LF:
return CAR_DOOR_FLAG_LF;
case CAR_DOOR_LR:
return CAR_DOOR_FLAG_LR;
case CAR_DOOR_RF:
return CAR_DOOR_FLAG_RF;
case CAR_DOOR_RR:
return CAR_DOOR_FLAG_RR;
default:
return CAR_DOOR_FLAG_UNKNOWN;
}
}
// VC. Accounts the case numMaxPassengers == 0, only for m_nGettingInFlags.
inline int8 GetEnterCarDoorFlag(int32 carnode, uint8 numMaxPassengers) {
switch (carnode) {
case CAR_DOOR_RF:
return CAR_DOOR_FLAG_RF;
case CAR_DOOR_RR:
return CAR_DOOR_FLAG_RR;
case CAR_DOOR_LF:
if (numMaxPassengers != 0)
return CAR_DOOR_FLAG_LF;
else
return CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR;
case CAR_DOOR_LR:
if (numMaxPassengers != 0)
return CAR_DOOR_FLAG_LR;
else
return CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR;
default:
return CAR_DOOR_FLAG_UNKNOWN;
}
}