This commit is contained in:
eray orçunus 2019-09-13 22:04:55 +03:00
parent 4041159855
commit 88f0ef75e8
8 changed files with 678 additions and 259 deletions

View File

@ -67,6 +67,7 @@ int32 (&CCarCtrl::TotalNumOfCarsOfRating)[7] = *(int32(*)[7])*(uintptr*)0x8F1A60
int32 (&CCarCtrl::NextCarOfRating)[7] = *(int32(*)[7])*(uintptr*)0x9412AC;
int32 (&CCarCtrl::CarArrays)[7][MAX_CAR_MODELS_IN_ARRAY] = *(int32(*)[7][MAX_CAR_MODELS_IN_ARRAY])*(uintptr*)0x6EB860;
CVehicle* (&apCarsToKeep)[MAX_CARS_TO_KEEP] = *(CVehicle*(*)[MAX_CARS_TO_KEEP])*(uintptr*)0x70D830;
uint32 (&aCarsToKeepTime)[MAX_CARS_TO_KEEP] = *(uint32(*)[MAX_CARS_TO_KEEP])*(uintptr*)0x87F9A8;
WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); }
WRAPPER void CCarCtrl::UpdateCarCount(CVehicle*, bool) { EAXJMP(0x4202E0); }
@ -745,6 +746,34 @@ CCarCtrl::IsThisVehicleInteresting(CVehicle* pVehicle)
return false;
}
void
CCarCtrl::RegisterVehicleOfInterest(CVehicle* pVehicle)
{
for(int i = 0; i < MAX_CARS_TO_KEEP; i++) {
if (apCarsToKeep[i] == pVehicle) {
aCarsToKeepTime[i] = CTimer::GetTimeInMilliseconds();
return;
}
}
for (int i = 0; i < MAX_CARS_TO_KEEP; i++) {
if (!apCarsToKeep[i]) {
apCarsToKeep[i] = pVehicle;
aCarsToKeepTime[i] = CTimer::GetTimeInMilliseconds();
return;
}
}
uint32 oldestCarWeKeepTime = UINT_MAX;
int oldestCarWeKeepIndex = 0;
for (int i = 0; i < MAX_CARS_TO_KEEP; i++) {
if (apCarsToKeep[i] && aCarsToKeepTime[i] < oldestCarWeKeepTime) {
oldestCarWeKeepTime = aCarsToKeepTime[i];
oldestCarWeKeepIndex = i;
}
}
apCarsToKeep[oldestCarWeKeepIndex] = pVehicle;
aCarsToKeepTime[oldestCarWeKeepIndex] = CTimer::GetTimeInMilliseconds();
}
void
CCarCtrl::UpdateCarOnRails(CVehicle* pVehicle)
{

View File

@ -58,6 +58,7 @@ public:
static void RemoveDistantCars(void);
static void PossiblyRemoveVehicle(CVehicle*);
static bool IsThisVehicleInteresting(CVehicle*);
static void RegisterVehicleOfInterest(CVehicle*);
static int32 CountCarsOfType(int32 mi);
static void SlowCarOnRailsDownForTrafficAndLights(CVehicle*);
static bool PickNextNodeAccordingStrategy(CVehicle*);

View File

@ -1459,7 +1459,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
A->m_phy_flagA80 = true;
}else if(A->IsPed() && Aped->m_pCollidingEntity == B){
skipCollision = true;
if(!Aped->m_ped_flagH1)
if(!Aped->bKnockedUpIntoAir)
A->m_phy_flagA80 = true;
}else if(B->IsPed() && Bped->m_pCollidingEntity == A){
skipCollision = true;

File diff suppressed because it is too large Load Diff

View File

@ -277,7 +277,7 @@ public:
uint8 bIsLanding : 1;
uint8 bIsRunning : 1; // on some conditions
uint8 bHitSomethingLastFrame : 1;
uint8 m_ped_flagB80 : 1; // something related with reaction to colliding vehicle
uint8 m_ped_flagB80 : 1; // bIsNearCar? something related with reaction to colliding vehicle
uint8 m_ped_flagC1 : 1;
uint8 bRespondsToThreats : 1;
@ -288,9 +288,9 @@ public:
uint8 m_ped_flagC40 : 1;
uint8 bFindNewNodeAfterStateRestore : 1;
uint8 m_ped_flagD1 : 1; // so far only used for reaction type to fire/explosion
uint8 m_ped_flagD2 : 1; // set when event has been seen
uint8 m_ped_flagD4 : 1; // so far only creates blood pool in hands up state
uint8 bHasACamera : 1; // does ped possess a camera to document accidents involves fire/explosion
uint8 m_ped_flagD2 : 1; // set when ped witnessed an event
uint8 m_ped_flagD4 : 1; // bPedIsBleeding? so far only creates blood pool in hands up state
uint8 m_ped_flagD8 : 1;
uint8 bIsPedDieAnimPlaying : 1;
uint8 bUsePedNodeSeek : 1;
@ -304,11 +304,11 @@ public:
uint8 bIsDucking : 1;
uint8 bGetUpAnimStarted : 1;
uint8 bDoBloodyFootprints : 1;
uint8 m_ped_flagE80 : 1; // bDontDragMeOutCar? bStayInCarOnJack?
uint8 bFleeAfterExitingCar : 1;
uint8 bWanderPathAfterExitingCar : 1;
uint8 m_ped_flagF2 : 1;
uint8 m_ped_flagF4 : 1; // Unfinished feature from VC
uint8 m_ped_flagF4 : 1; // Unfinished feature from VC, probably bDontDragMeOutCar
uint8 m_ped_flagF8 : 1;
uint8 bWillBeQuickJacked : 1;
uint8 bCancelEnteringCar : 1; // after door is opened or couldn't be opened due to it's locked
@ -317,14 +317,14 @@ public:
uint8 m_ped_flagG1 : 1;
uint8 m_ped_flagG2 : 1;
uint8 m_ped_flagG4 : 1;
uint8 m_ped_flagG4 : 1; // bStillOnValidPoly?
uint8 bStartWanderPathOnFoot : 1; // exits the car if he's in it, reset after path found
uint8 m_ped_flagG10 : 1;
uint8 m_ped_flagG10 : 1; // bOnBoat? (but not in the sense of driving)
uint8 bBusJacked : 1;
uint8 m_ped_flagG40 : 1; // had to exit car due to someone jacked it from RF door
uint8 bGonnaKillTheCarJacker : 1; // only set when car is jacked from right door
uint8 bFadeOut : 1;
uint8 m_ped_flagH1 : 1;
uint8 bKnockedUpIntoAir : 1; // has ped been knocked up into the air by a car collision
uint8 m_ped_flagH2 : 1;
uint8 m_ped_flagH4 : 1;
uint8 bClearObjective : 1;
@ -645,6 +645,7 @@ public:
void ReactToPointGun(CEntity*);
void SeekCar(void);
void SeekBoatPosition(void);
bool PositionPedOutOfCollision(void);
// Static methods
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);
@ -722,6 +723,7 @@ public:
RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; }
PedState GetPedState(void) { return m_nPedState; }
void SetPedState(PedState state) { m_nPedState = state; }
bool DyingOrDead(void) { return m_nPedState == PED_DIE || m_nPedState == PED_DEAD; }
// set by 0482:set_threat_reaction_range_multiplier opcode
static uint16 &nThreatReactionRangeMultiplier;

View File

@ -94,6 +94,15 @@ CPlayerPed::AnnoyPlayerPed(bool annoyedByPassingEntity)
}
}
void
CPlayerPed::ClearAdrenaline(void)
{
if (m_bAdrenalineActive && m_nAdrenalineTime != 0) {
m_nAdrenalineTime = 0;
CTimer::SetTimeStep(1.0f);
}
}
class CPlayerPed_ : public CPlayerPed
{
public:

View File

@ -29,7 +29,7 @@ public:
bool m_bHasLockOnTarget;
int8 field_1406;
int8 field_1407;
uint32 m_bAdrenalineTime;
uint32 m_nAdrenalineTime;
bool m_bCanBeDamaged;
int8 field_1413;
int8 field_1414;
@ -52,6 +52,7 @@ public:
void SetInitialState(void);
void SetMoveAnim(void);
void ProcessControl(void);
void ClearAdrenaline(void);
static void SetupPlayerPed(int32);
static void DeactivatePlayerPed(int32);

View File

@ -269,7 +269,7 @@ public:
bool ShufflePassengersToMakeSpace(void);
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; }
bool IsWrecked(void) { return !this || m_status == STATUS_WRECKED; }
CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); }
static bool &bWheelsOnlyCheat;