Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Nikolay Korolev 2019-09-11 17:52:07 +03:00
commit c86c9b3118
10 changed files with 1700 additions and 143 deletions

View File

@ -102,7 +102,7 @@ static void(*CBArray_RE3[])(CAnimBlendAssociation*, void*) =
{
nil, &CPed::PedGetupCB, &CPed::PedStaggerCB, &CPed::PedEvadeCB, &CPed::FinishDieAnimCB,
&CPed::FinishedWaitCB, &CPed::FinishLaunchCB, &CPed::FinishHitHeadCB, &CPed::PedAnimGetInCB, &CPed::PedAnimDoorOpenCB,
&CPed::PedAnimPullPedOutCB, &CPed::PedAnimDoorCloseCB, &CPed::SetInCarCB, &CPed::PedSetOutCarCB, &CPed::PedAnimAlignCB,
&CPed::PedAnimPullPedOutCB, &CPed::PedAnimDoorCloseCB, &CPed::PedSetInCarCB, &CPed::PedSetOutCarCB, &CPed::PedAnimAlignCB,
&CPed::PedSetDraggedOutCarCB, &CPed::PedAnimStepOutCarCB, &CPed::PedSetInTrainCB, &CPed::PedSetOutTrainCB, &CPed::FinishedAttackCB,
&CPed::FinishFightMoveCB, &PhonePutDownCB, &PhonePickUpCB, &CPed::PedAnimDoorCloseRollingCB, &CPed::FinishJumpCB,
&CPed::PedLandCB, &FinishFuckUCB, &CPed::RestoreHeadingRateCB, &CPed::PedSetQuickDraggedOutCarPositionCB, &CPed::PedSetDraggedOutCarPositionCB

View File

@ -26,7 +26,7 @@ public:
int32 m_nVisibleMoney;
int32 m_nCollectedPackages;
int32 m_nTotalPackages;
int32 field_188;
uint32 m_nLastBumpPlayerCarTimer;
int32 m_nSwitchTaxiTime;
bool m_bSwitchTaxi;
int8 field_197;

View File

@ -131,3 +131,4 @@ enum Config {
#define USE_DEBUG_SCRIPT_LOADER
#define EXPLODING_AIRTRAIN // can blow up jumbo jet with rocket launcher
#define ANIMATE_PED_COL_MODEL
#define CANCELLABLE_CAR_ENTER

View File

@ -4,6 +4,7 @@
#include "ModelIndices.h"
WRAPPER void CCopPed::ProcessControl() { EAXJMP(0x4C1400); }
WRAPPER void CCopPed::SetArrestPlayer(CPed*) { EAXJMP(0x4C2B00); }
CCopPed::CCopPed(eCopType copType) : CPed(PEDTYPE_COP)
{

View File

@ -36,6 +36,7 @@ public:
void ClearPursuit(void);
void ProcessControl(void);
void SetArrestPlayer(CPed*);
};
static_assert(sizeof(CCopPed) == 0x558, "CCopPed: error");

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,13 @@ struct CPedAudioData
int m_nMaxRandomDelayTime;
};
enum FightState : int8 {
FIGHTSTATE_MOVE_FINISHED = -2,
FIGHTSTATE_JUST_ATTACKED,
FIGHTSTATE_NO_MOVE,
FIGHTSTATE_1
};
enum
{
ENDFIGHT_NORMAL,
@ -256,7 +263,7 @@ public:
// cf. https://github.com/DK22Pac/plugin-sdk/blob/master/plugin_sa/game_sa/CPed.h from R*
uint8 bIsStanding : 1;
uint8 m_ped_flagA2 : 1;
uint8 bIsAttacking : 1; // doesn't reset after fist fight, also stores (CTimer::GetTimeInMilliseconds() < m_lastHitTime)
uint8 bIsAttacking : 1; // doesn't reset after fist fight
uint8 bIsPointingGunAt : 1;
uint8 bIsLooking : 1;
uint8 bKeepTryingToLook : 1; // if we can't look somewhere due to unreachable angles
@ -268,9 +275,9 @@ public:
uint8 bIsTalking : 1;
uint8 bIsInTheAir : 1;
uint8 bIsLanding : 1;
uint8 bIsRunning : 1; // not fleeing
uint8 m_ped_flagB40 : 1;
uint8 m_ped_flagB80 : 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_flagC1 : 1;
uint8 bRespondsToThreats : 1;
@ -283,7 +290,7 @@ public:
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;
uint8 m_ped_flagD4 : 1; // so far only creates blood pool in hands up state
uint8 m_ped_flagD8 : 1;
uint8 bIsPedDieAnimPlaying : 1;
uint8 bUsePedNodeSeek : 1;
@ -294,35 +301,35 @@ public:
uint8 m_ped_flagE2 : 1;
uint8 bNotAllowedToDuck : 1;
uint8 bCrouchWhenShooting : 1;
uint8 bIsDucking : 1; // set if you don't want ped to attack
uint8 bIsDucking : 1;
uint8 bGetUpAnimStarted : 1;
uint8 bDoBloodyFootprints : 1;
uint8 m_ped_flagE80 : 1;
uint8 m_ped_flagF1 : 1;
uint8 bWanderPathAfterExitingCar : 1;
uint8 m_ped_flagF2 : 1;
uint8 m_ped_flagF4 : 1;
uint8 m_ped_flagF4 : 1; // Unfinished feature from VC
uint8 m_ped_flagF8 : 1;
uint8 bWillBeQuickJacked : 1;
uint8 m_ped_flagF20 : 1; // set when couldn't open locked car door
uint8 bCancelEnteringCar : 1; // after door is opened or couldn't be opened due to it's locked
uint8 m_ped_flagF40 : 1;
uint8 bDuckAndCover : 1;
uint8 m_ped_flagG1 : 1;
uint8 m_ped_flagG2 : 1;
uint8 m_ped_flagG4 : 1;
uint8 m_ped_flagG8 : 1; // ped starts to go somewhere when set
uint8 bStartWanderPathOnFoot : 1; // exits the car if he's in it, reset after path found
uint8 m_ped_flagG10 : 1;
uint8 m_ped_flagG20 : 1;
uint8 m_ped_flagG40 : 1;
uint8 m_ped_flagG80 : 1;
uint8 bFadeOut : 1;
uint8 m_ped_flagH1 : 1;
uint8 m_ped_flagH2 : 1;
uint8 m_ped_flagH4 : 1;
uint8 bClearObjective : 1;
uint8 m_ped_flagH10 : 1;
uint8 m_ped_flagH20 : 1;
uint8 m_ped_flagH20 : 1; // set if our own vehicle damaged us. I don't know how is that possible
uint8 m_ped_flagH40 : 1;
uint8 m_ped_flagH80 : 1;
@ -430,7 +437,7 @@ public:
CVector m_vecHitLastPos;
PedFightMoves m_lastFightMove;
uint8 m_fightButtonPressure;
int8 m_fightUnk2; // TODO
FightState m_fightState;
bool m_takeAStepAfterAttack;
uint8 pad_4B3;
CFire *m_pFire;
@ -442,14 +449,14 @@ public:
uint32 m_lookTimer;
uint32 m_standardTimer;
uint32 m_attackTimer;
uint32 m_lastHitTime; // obviously not correct
uint32 m_shootTimer; // shooting is a part of attack
uint32 m_hitRecoverTimer;
uint32 m_objectiveTimer;
uint32 m_duckTimer;
uint32 m_duckAndCoverTimer;
int32 m_bloodyFootprintCount;
uint8 m_panicCounter;
uint8 m_deadBleeding;
bool m_deadBleeding;
int8 m_bodyPartBleeding; // PedNode
uint8 m_field_4F3;
CPed *m_nearPeds[10];
@ -519,7 +526,7 @@ public:
void CalculateNewOrientation(void);
float WorkOutHeadingForMovingFirstPerson(float);
void CalculateNewVelocity(void);
bool CanPedJumpThis(int32);
bool CanPedJumpThis(CEntity*);
bool CanSeeEntity(CEntity*, float);
void RestorePreviousObjective(void);
void SetIdle(void);
@ -629,6 +636,15 @@ public:
void Mug(void);
void MoveHeadToLook(void);
void Pause(void);
void ProcessBuoyancy(void);
void ServiceTalking(void);
void SetJump(void);
void UpdatePosition(void);
void WanderRange(void);
void WanderPath(void);
void ReactToPointGun(CEntity*);
void SeekCar(void);
void SeekBoatPosition(void);
// Static methods
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);
@ -652,7 +668,7 @@ public:
static void PedAnimDoorOpenCB(CAnimBlendAssociation *assoc, void *arg);
static void PedAnimPullPedOutCB(CAnimBlendAssociation *assoc, void *arg);
static void PedAnimDoorCloseCB(CAnimBlendAssociation *assoc, void *arg);
static void SetInCarCB(CAnimBlendAssociation *assoc, void *arg);
static void PedSetInCarCB(CAnimBlendAssociation *assoc, void *arg);
static void PedSetOutCarCB(CAnimBlendAssociation *assoc, void *arg);
static void PedAnimAlignCB(CAnimBlendAssociation *assoc, void *arg);
static void PedSetDraggedOutCarCB(CAnimBlendAssociation *assoc, void *arg);
@ -694,6 +710,10 @@ public:
void Fall(void);
bool IsPedShootable(void);
void Look(void);
void SetInTheAir(void);
void RestoreHeadPosition(void);
void PointGunAt(void);
bool ServiceTalkingWhenDead(void);
bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; }
CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; }
@ -708,7 +728,7 @@ public:
static bool &bNastyLimbsCheat;
static bool &bPedCheat2;
static bool &bPedCheat3;
static CVector2D &ms_vec2DFleePosition;
static CVector2D ms_vec2DFleePosition;
static CPedAudioData (&CommentWaitTime)[38];
#ifndef MASTER

View File

@ -8,6 +8,7 @@ WRAPPER bool CPedIK::PointGunInDirection(float phi, float theta) { EAXJMP(0x4ED9
WRAPPER bool CPedIK::PointGunAtPosition(CVector *position) { EAXJMP(0x4ED920); }
WRAPPER void CPedIK::ExtractYawAndPitchLocal(RwMatrixTag*, float*, float*) { EAXJMP(0x4ED2C0); }
WRAPPER void CPedIK::ExtractYawAndPitchWorld(RwMatrixTag*, float*, float*) { EAXJMP(0x4ED140); }
WRAPPER bool CPedIK::RestoreLookAt(void) { EAXJMP(0x4ED810); }
// TODO: These are hardcoded into exe, reverse it.
LimbMovementInfo &CPedIK::ms_torsoInfo = *(LimbMovementInfo*)0x5F9F8C;

View File

@ -57,5 +57,6 @@ public:
bool RestoreGunPosn(void);
bool LookInDirection(float phi, float theta);
bool LookAtPosition(CVector const& pos);
bool RestoreLookAt(void);
};
static_assert(sizeof(CPedIK) == 0x28, "CPedIK: error");

View File

@ -3668,12 +3668,11 @@ CAutomobile::IsDoorReady(eDoors door)
if(Doors[door].IsClosed() || IsDoorMissing(door))
return true;
int doorflag = 0;
// TODO: enum?
switch(door){
case DOOR_FRONT_LEFT: doorflag = 1; break;
case DOOR_FRONT_RIGHT: doorflag = 4; break;
case DOOR_REAR_LEFT: doorflag = 2; break;
case DOOR_REAR_RIGHT: doorflag = 8; break;
case DOOR_FRONT_LEFT: doorflag = CAR_DOOR_FLAG_LF; break;
case DOOR_FRONT_RIGHT: doorflag = CAR_DOOR_FLAG_RF; break;
case DOOR_REAR_LEFT: doorflag = CAR_DOOR_FLAG_LR; break;
case DOOR_REAR_RIGHT: doorflag = CAR_DOOR_FLAG_RR; break;
}
return (doorflag & m_nGettingInFlags) == 0;
}
@ -4076,7 +4075,7 @@ CAutomobile::ProcessAutoBusDoors(void)
if(CTimer::GetTimeInMilliseconds() < m_nBusDoorTimerEnd){
if(m_nBusDoorTimerEnd != 0 && CTimer::GetTimeInMilliseconds() > m_nBusDoorTimerEnd-500){
// close door
if(!IsDoorMissing(DOOR_FRONT_LEFT) && (m_nGettingInFlags & 1) == 0){
if(!IsDoorMissing(DOOR_FRONT_LEFT) && (m_nGettingInFlags & CAR_DOOR_FLAG_LF) == 0){
if(IsDoorClosed(DOOR_FRONT_LEFT)){
m_nBusDoorTimerEnd = CTimer::GetTimeInMilliseconds();
OpenDoor(CAR_DOOR_LF, DOOR_FRONT_LEFT, 0.0f);
@ -4086,7 +4085,7 @@ CAutomobile::ProcessAutoBusDoors(void)
}
}
if(!IsDoorMissing(DOOR_FRONT_RIGHT) && (m_nGettingInFlags & 4) == 0){
if(!IsDoorMissing(DOOR_FRONT_RIGHT) && (m_nGettingInFlags & CAR_DOOR_FLAG_RF) == 0){
if(IsDoorClosed(DOOR_FRONT_RIGHT)){
m_nBusDoorTimerEnd = CTimer::GetTimeInMilliseconds();
OpenDoor(CAR_DOOR_RF, DOOR_FRONT_RIGHT, 0.0f);
@ -4099,9 +4098,9 @@ CAutomobile::ProcessAutoBusDoors(void)
}else{
// ended
if(m_nBusDoorTimerStart){
if(!IsDoorMissing(DOOR_FRONT_LEFT) && (m_nGettingInFlags & 1) == 0)
if(!IsDoorMissing(DOOR_FRONT_LEFT) && (m_nGettingInFlags & CAR_DOOR_FLAG_LF) == 0)
OpenDoor(CAR_DOOR_LF, DOOR_FRONT_LEFT, 0.0f);
if(!IsDoorMissing(DOOR_FRONT_RIGHT) && (m_nGettingInFlags & 4) == 0)
if(!IsDoorMissing(DOOR_FRONT_RIGHT) && (m_nGettingInFlags & CAR_DOOR_FLAG_RF) == 0)
OpenDoor(CAR_DOOR_RF, DOOR_FRONT_RIGHT, 0.0f);
m_nBusDoorTimerStart = 0;
m_nBusDoorTimerEnd = 0;