mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-23 17:49:16 +01:00
Ped & fixes, including peds dive into danger fix
This commit is contained in:
parent
3bb607f9cb
commit
8fd63e5ca6
@ -210,7 +210,7 @@ PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg)
|
|||||||
CPed *ped = (CPed*)arg;
|
CPed *ped = (CPed*)arg;
|
||||||
|
|
||||||
if (assoc->blendAmount > 0.5f)
|
if (assoc->blendAmount > 0.5f)
|
||||||
ped->m_ped_flagC10 = true;
|
ped->bUpdateAnimHeading = true;
|
||||||
|
|
||||||
if (ped->m_nPedState == PED_MAKE_CALL)
|
if (ped->m_nPedState == PED_MAKE_CALL)
|
||||||
ped->m_nPedState = PED_IDLE;
|
ped->m_nPedState = PED_IDLE;
|
||||||
@ -244,10 +244,10 @@ PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg)
|
|||||||
|
|
||||||
CPed *ped = CPhoneInfo::pedWhoPickingUpPhone;
|
CPed *ped = CPhoneInfo::pedWhoPickingUpPhone;
|
||||||
ped->m_nMoveState = PEDMOVE_STILL;
|
ped->m_nMoveState = PEDMOVE_STILL;
|
||||||
CAnimManager::BlendAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_IDLE_STANCE, 8.0f);
|
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_IDLE_STANCE, 8.0f);
|
||||||
|
|
||||||
if (assoc->blendAmount > 0.5f && ped)
|
if (assoc->blendAmount > 0.5f && ped)
|
||||||
CAnimManager::BlendAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_PHONE_TALK, 8.0f);
|
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_PHONE_TALK, 8.0f);
|
||||||
|
|
||||||
CPhoneInfo::pedWhoPickingUpPhone = nil;
|
CPhoneInfo::pedWhoPickingUpPhone = nil;
|
||||||
}
|
}
|
||||||
|
@ -1304,6 +1304,17 @@ CCam::GetWeaponFirstPersonOn()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
CCamera::Find3rdPersonQuickAimPitch(void)
|
||||||
|
{
|
||||||
|
float clampedFrontZ = clamp(Cams[ActiveCam].Front.z, -1.0f, 1.0f);
|
||||||
|
|
||||||
|
// float rot = atan2(clampedFrontZ, sqrt(1.0f - sq(clampedFrontZ)));
|
||||||
|
float rot = Asin(clampedFrontZ);
|
||||||
|
|
||||||
|
return -(DEGTORAD(((0.5f - m_f3rdPersonCHairMultY) * 1.8f * 0.5f * Cams[ActiveCam].FOV)) + rot);
|
||||||
|
}
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
InjectHook(0x42C760, (bool (CCamera::*)(const CVector ¢er, float radius, const CMatrix *mat))&CCamera::IsSphereVisible, PATCH_JUMP);
|
InjectHook(0x42C760, (bool (CCamera::*)(const CVector ¢er, float radius, const CMatrix *mat))&CCamera::IsSphereVisible, PATCH_JUMP);
|
||||||
InjectHook(0x46FD00, &CCamera::SetFadeColour, PATCH_JUMP);
|
InjectHook(0x46FD00, &CCamera::SetFadeColour, PATCH_JUMP);
|
||||||
|
@ -469,6 +469,8 @@ int m_iModeObbeCamIsInForCar;
|
|||||||
void Restore(void);
|
void Restore(void);
|
||||||
void SetWidescreenOff(void);
|
void SetWidescreenOff(void);
|
||||||
|
|
||||||
|
float Find3rdPersonQuickAimPitch(void);
|
||||||
|
|
||||||
void dtor(void) { this->CCamera::~CCamera(); }
|
void dtor(void) { this->CCamera::~CCamera(); }
|
||||||
};
|
};
|
||||||
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
|
static_assert(offsetof(CCamera, m_WideScreenOn) == 0x70, "CCamera: error");
|
||||||
|
@ -7,6 +7,7 @@ public:
|
|||||||
CVector2D(void) {}
|
CVector2D(void) {}
|
||||||
CVector2D(float x, float y) : x(x), y(y) {}
|
CVector2D(float x, float y) : x(x), y(y) {}
|
||||||
CVector2D(const CVector &v) : x(v.x), y(v.y) {}
|
CVector2D(const CVector &v) : x(v.x), y(v.y) {}
|
||||||
|
float Heading(void) const { return Atan2(-x, y); }
|
||||||
float Magnitude(void) const { return Sqrt(x*x + y*y); }
|
float Magnitude(void) const { return Sqrt(x*x + y*y); }
|
||||||
float MagnitudeSqr(void) const { return x*x + y*y; }
|
float MagnitudeSqr(void) const { return x*x + y*y; }
|
||||||
|
|
||||||
|
869
src/peds/Ped.cpp
869
src/peds/Ped.cpp
File diff suppressed because it is too large
Load Diff
@ -13,6 +13,47 @@
|
|||||||
|
|
||||||
struct CPathNode;
|
struct CPathNode;
|
||||||
|
|
||||||
|
struct FightMove
|
||||||
|
{
|
||||||
|
AnimationId animId;
|
||||||
|
float startFireTime;
|
||||||
|
float endFireTime;
|
||||||
|
float comboFollowOnTime;
|
||||||
|
float strikeRadius;
|
||||||
|
uint8 hitLevel;
|
||||||
|
uint8 damage;
|
||||||
|
uint8 flags;
|
||||||
|
};
|
||||||
|
static_assert(sizeof(FightMove) == 0x18, "FightMove: error");
|
||||||
|
|
||||||
|
enum PedFightMoves
|
||||||
|
{
|
||||||
|
FIGHTMOVE_NULL,
|
||||||
|
FIGHTMOVE_STDPUNCH,
|
||||||
|
FIGHTMOVE_IDLE,
|
||||||
|
FIGHTMOVE_SHUFFLE_F,
|
||||||
|
FIGHTMOVE_KNEE,
|
||||||
|
FIGHTMOVE_HEADBUTT,
|
||||||
|
FIGHTMOVE_PUNCHJAB,
|
||||||
|
FIGHTMOVE_PUNCHHOOK,
|
||||||
|
FIGHTMOVE_KICK,
|
||||||
|
FIGHTMOVE_LONGKICK,
|
||||||
|
FIGHTMOVE_ROUNDHOUSE,
|
||||||
|
FIGHTMOVE_BODYBLOW,
|
||||||
|
FIGHTMOVE_GROUNDKICK,
|
||||||
|
FIGHTMOVE_HITFRONT,
|
||||||
|
FIGHTMOVE_HITBACK,
|
||||||
|
FIGHTMOVE_HITRIGHT,
|
||||||
|
FIGHTMOVE_HITLEFT,
|
||||||
|
FIGHTMOVE_HITBODY,
|
||||||
|
FIGHTMOVE_HITCHEST,
|
||||||
|
FIGHTMOVE_HITHEAD,
|
||||||
|
FIGHTMOVE_HITBIGSTEP,
|
||||||
|
FIGHTMOVE_HITONFLOOR,
|
||||||
|
FIGHTMOVE_HITBEHIND,
|
||||||
|
FIGHTMOVE_IDLE2NORM
|
||||||
|
};
|
||||||
|
|
||||||
enum ePedPieceTypes
|
enum ePedPieceTypes
|
||||||
{
|
{
|
||||||
PEDPIECE_TORSO,
|
PEDPIECE_TORSO,
|
||||||
@ -209,7 +250,7 @@ public:
|
|||||||
uint8 bRespondsToThreats : 1;
|
uint8 bRespondsToThreats : 1;
|
||||||
uint8 bRenderPedInCar : 1;
|
uint8 bRenderPedInCar : 1;
|
||||||
uint8 bChangedSeat : 1;
|
uint8 bChangedSeat : 1;
|
||||||
uint8 m_ped_flagC10 : 1; // related with phone
|
uint8 bUpdateAnimHeading : 1;
|
||||||
uint8 bBodyPartJustCameOff : 1;
|
uint8 bBodyPartJustCameOff : 1;
|
||||||
uint8 m_ped_flagC40 : 1;
|
uint8 m_ped_flagC40 : 1;
|
||||||
uint8 m_ped_flagC80 : 1;
|
uint8 m_ped_flagC80 : 1;
|
||||||
@ -223,12 +264,12 @@ public:
|
|||||||
uint8 m_ped_flagD40 : 1; // reset when objective changes
|
uint8 m_ped_flagD40 : 1; // reset when objective changes
|
||||||
uint8 m_bScriptObjectiveCompleted : 1;
|
uint8 m_bScriptObjectiveCompleted : 1;
|
||||||
|
|
||||||
uint8 m_ped_flagE1 : 1;
|
uint8 bKindaStayInSamePlace : 1;
|
||||||
uint8 m_ped_flagE2 : 1;
|
uint8 m_ped_flagE2 : 1;
|
||||||
uint8 bNotAllowedToDuck : 1;
|
uint8 bNotAllowedToDuck : 1;
|
||||||
uint8 bCrouchWhenShooting : 1;
|
uint8 bCrouchWhenShooting : 1;
|
||||||
uint8 bIsDucking : 1; // set if you don't want ped to attack
|
uint8 bIsDucking : 1; // set if you don't want ped to attack
|
||||||
uint8 m_ped_flagE20 : 1; // getup complete?
|
uint8 bGetUpAnimStarted : 1;
|
||||||
uint8 bDoBloodyFootprints : 1;
|
uint8 bDoBloodyFootprints : 1;
|
||||||
uint8 m_ped_flagE80 : 1;
|
uint8 m_ped_flagE80 : 1;
|
||||||
|
|
||||||
@ -253,17 +294,17 @@ public:
|
|||||||
uint8 m_ped_flagH1 : 1;
|
uint8 m_ped_flagH1 : 1;
|
||||||
uint8 m_ped_flagH2 : 1;
|
uint8 m_ped_flagH2 : 1;
|
||||||
uint8 m_ped_flagH4 : 1;
|
uint8 m_ped_flagH4 : 1;
|
||||||
uint8 m_ped_flagH8 : 1;
|
uint8 bClearObjective : 1;
|
||||||
uint8 m_ped_flagH10 : 1;
|
uint8 m_ped_flagH10 : 1;
|
||||||
uint8 m_ped_flagH20 : 1;
|
uint8 m_ped_flagH20 : 1;
|
||||||
uint8 m_ped_flagH40 : 1;
|
uint8 m_ped_flagH40 : 1;
|
||||||
uint8 m_ped_flagH80 : 1;
|
uint8 m_ped_flagH80 : 1;
|
||||||
|
|
||||||
uint8 m_ped_flagI1 : 1;
|
uint8 m_ped_flagI1 : 1;
|
||||||
uint8 m_ped_flagI2 : 1; // if set, limbs won't came off
|
uint8 bNoCriticalHits : 1; // if set, limbs won't came off
|
||||||
uint8 m_ped_flagI4 : 1;
|
uint8 m_ped_flagI4 : 1;
|
||||||
uint8 bHasAlreadyBeenRecorded : 1;
|
uint8 bHasAlreadyBeenRecorded : 1;
|
||||||
uint8 m_ped_flagI10 : 1;
|
uint8 bIsFell : 1;
|
||||||
uint8 m_ped_flagI20 : 1;
|
uint8 m_ped_flagI20 : 1;
|
||||||
uint8 m_ped_flagI40 : 1;
|
uint8 m_ped_flagI40 : 1;
|
||||||
uint8 m_ped_flagI80 : 1;
|
uint8 m_ped_flagI80 : 1;
|
||||||
@ -299,8 +340,8 @@ public:
|
|||||||
PedState m_nPedState;
|
PedState m_nPedState;
|
||||||
PedState m_nLastPedState;
|
PedState m_nLastPedState;
|
||||||
eMoveState m_nMoveState;
|
eMoveState m_nMoveState;
|
||||||
int32 m_nStoredActionState;
|
int32 m_nStoredMoveState;
|
||||||
int32 m_nPrevActionState;
|
int32 m_nPrevMoveState;
|
||||||
eWaitState m_nWaitState;
|
eWaitState m_nWaitState;
|
||||||
uint32 m_nWaitTimer;
|
uint32 m_nWaitTimer;
|
||||||
void *m_pPathNodesStates[8]; // seems unused
|
void *m_pPathNodesStates[8]; // seems unused
|
||||||
@ -363,10 +404,11 @@ public:
|
|||||||
uint8 m_wepAccuracy;
|
uint8 m_wepAccuracy;
|
||||||
CEntity *m_pPointGunAt;
|
CEntity *m_pPointGunAt;
|
||||||
CVector m_vecHitLastPos;
|
CVector m_vecHitLastPos;
|
||||||
uint32 m_lastHitState;
|
PedFightMoves m_lastFightMove;
|
||||||
uint8 m_fightFlags1;
|
uint8 m_fightButtonPressure;
|
||||||
uint8 m_fightFlags2;
|
int8 m_fightUnk2; // TODO
|
||||||
uint8 pad_4B2[2];
|
uint8 m_fightUnk1; // TODO
|
||||||
|
uint8 pad_4B3;
|
||||||
CFire* m_pFire;
|
CFire* m_pFire;
|
||||||
CEntity *m_pLookTarget;
|
CEntity *m_pLookTarget;
|
||||||
float m_fLookDirection;
|
float m_fLookDirection;
|
||||||
@ -503,6 +545,16 @@ public:
|
|||||||
void SetAimFlag(float angle);
|
void SetAimFlag(float angle);
|
||||||
void SetAmmo(eWeaponType weaponType, uint32 ammo);
|
void SetAmmo(eWeaponType weaponType, uint32 ammo);
|
||||||
void SetEvasiveStep(CEntity*, uint8);
|
void SetEvasiveStep(CEntity*, uint8);
|
||||||
|
void SetEvasiveDive(CPhysical*, uint8);
|
||||||
|
void SetAttack(CEntity*);
|
||||||
|
void StartFightAttack(uint8);
|
||||||
|
void LoadFightData(void);
|
||||||
|
void SetWaitState(eWaitState, void*);
|
||||||
|
bool FightStrike(CVector&);
|
||||||
|
int GetLocalDirection(CVector2D&);
|
||||||
|
void StartFightDefend(uint8, uint8, uint8);
|
||||||
|
void PlayHitSound(CPed*);
|
||||||
|
void SetFall(int, AnimationId, uint8);
|
||||||
|
|
||||||
// Static methods
|
// Static methods
|
||||||
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
|
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
|
||||||
@ -577,6 +629,8 @@ public:
|
|||||||
static bool &bPedCheat2;
|
static bool &bPedCheat2;
|
||||||
static bool &bPedCheat3;
|
static bool &bPedCheat3;
|
||||||
static CColPoint &ms_tempColPoint;
|
static CColPoint &ms_tempColPoint;
|
||||||
|
static uint16 &unknownFightThing; // TODO
|
||||||
|
static FightMove (&ms_fightMoves)[24];
|
||||||
};
|
};
|
||||||
|
|
||||||
void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg);
|
void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg);
|
||||||
|
@ -104,8 +104,7 @@ CPedIK::GetWorldMatrix(RwFrame *source, RwMatrix *destination)
|
|||||||
return destination;
|
return destination;
|
||||||
}
|
}
|
||||||
|
|
||||||
// A helper function that adjusts "limb" parameter according to limitations. Doesn't move the limb.
|
uint32
|
||||||
int8
|
|
||||||
CPedIK::MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, LimbMovementInfo &moveInfo)
|
CPedIK::MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, LimbMovementInfo &moveInfo)
|
||||||
{
|
{
|
||||||
int result = 1;
|
int result = 1;
|
||||||
|
@ -47,7 +47,7 @@ public:
|
|||||||
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
|
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
|
||||||
void ExtractYawAndPitchLocal(RwMatrixTag*, float*, float*);
|
void ExtractYawAndPitchLocal(RwMatrixTag*, float*, float*);
|
||||||
void ExtractYawAndPitchWorld(RwMatrixTag*, float*, float*);
|
void ExtractYawAndPitchWorld(RwMatrixTag*, float*, float*);
|
||||||
int8 MoveLimb(LimbOrientation &a1, float a2, float a3, LimbMovementInfo &a4);
|
uint32 MoveLimb(LimbOrientation &a1, float a2, float a3, LimbMovementInfo &a4);
|
||||||
bool RestoreGunPosn(void);
|
bool RestoreGunPosn(void);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(CPedIK) == 0x28, "CPedIK: error");
|
static_assert(sizeof(CPedIK) == 0x28, "CPedIK: error");
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
#include "Weapon.h"
|
#include "Weapon.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#include "WeaponInfo.h"
|
#include "WeaponInfo.h"
|
||||||
|
#include "Ped.h"
|
||||||
|
#include "World.h"
|
||||||
|
|
||||||
WRAPPER bool CWeapon::Fire(CEntity*, CVector*) { EAXJMP(0x55C380); }
|
WRAPPER bool CWeapon::Fire(CEntity*, CVector*) { EAXJMP(0x55C380); }
|
||||||
WRAPPER void CWeapon::FireFromCar(CAutomobile *car, bool left) { EAXJMP(0x55C940); }
|
WRAPPER void CWeapon::FireFromCar(CAutomobile *car, bool left) { EAXJMP(0x55C940); }
|
||||||
@ -50,7 +52,42 @@ CWeapon::IsTypeMelee(void)
|
|||||||
return m_eWeaponType == WEAPONTYPE_UNARMED || m_eWeaponType == WEAPONTYPE_BASEBALLBAT;
|
return m_eWeaponType == WEAPONTYPE_UNARMED || m_eWeaponType == WEAPONTYPE_BASEBALLBAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
CWeapon::HitsGround(CEntity *holder, CVector *firePos, CEntity *aimingTo)
|
||||||
|
{
|
||||||
|
if (!holder->IsPed() || !((CPed*)holder)->m_pSeekTarget)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
CWeaponInfo *ourType = CWeaponInfo::GetWeaponInfo(m_eWeaponType);
|
||||||
|
CVector adjustedOffset = ourType->m_vecFireOffset;
|
||||||
|
adjustedOffset.z += 0.6f;
|
||||||
|
|
||||||
|
CVector point1, point2;
|
||||||
|
CEntity *foundEnt = nil;
|
||||||
|
CColPoint foundCol;
|
||||||
|
|
||||||
|
if (firePos)
|
||||||
|
point1 = *firePos;
|
||||||
|
else
|
||||||
|
point1 = holder->GetMatrix() * adjustedOffset;
|
||||||
|
|
||||||
|
CEntity *aimEntity = aimingTo ? aimingTo : ((CPed*)holder)->m_pSeekTarget;
|
||||||
|
point2 = aimEntity->GetPosition();
|
||||||
|
point2.z += 0.6f;
|
||||||
|
|
||||||
|
CWorld::ProcessLineOfSight(point1, point2, foundCol, foundEnt, true, false, false, false, false, false, false);
|
||||||
|
if (foundEnt && foundEnt->IsBuilding()) {
|
||||||
|
// That was supposed to be Magnitude, according to leftover code in assembly
|
||||||
|
float diff = (foundCol.point.z - point1.z);
|
||||||
|
if (diff < 0.0f && diff > -3.0f)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
InjectHook(0x55C330, &CWeapon::Initialise, PATCH_JUMP);
|
InjectHook(0x55C330, &CWeapon::Initialise, PATCH_JUMP);
|
||||||
InjectHook(0x5639D0, &CWeapon::Reload, PATCH_JUMP);
|
InjectHook(0x5639D0, &CWeapon::Reload, PATCH_JUMP);
|
||||||
|
InjectHook(0x564890, &CWeapon::HitsGround, PATCH_JUMP);
|
||||||
ENDPATCHES
|
ENDPATCHES
|
@ -70,7 +70,7 @@ public:
|
|||||||
void AddGunshell(CEntity*, CVector const&, CVector2D const&, float);
|
void AddGunshell(CEntity*, CVector const&, CVector2D const&, float);
|
||||||
bool IsTypeMelee(void);
|
bool IsTypeMelee(void);
|
||||||
bool IsType2Handed(void);
|
bool IsType2Handed(void);
|
||||||
|
|
||||||
static void DoTankDoomAiming(CEntity *playerVehicle, CEntity *playerPed, CVector *start, CVector *end);
|
static void DoTankDoomAiming(CEntity *playerVehicle, CEntity *playerPed, CVector *start, CVector *end);
|
||||||
|
bool HitsGround(CEntity* holder, CVector* firePos, CEntity* aimingTo);
|
||||||
};
|
};
|
||||||
static_assert(sizeof(CWeapon) == 0x18, "CWeapon: error");
|
static_assert(sizeof(CWeapon) == 0x18, "CWeapon: error");
|
||||||
|
Loading…
Reference in New Issue
Block a user