mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-23 09:39:16 +01:00
Merge branch 'master' into master
This commit is contained in:
commit
8804aafc6a
@ -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");
|
||||||
|
@ -4,8 +4,16 @@ class CEntity;
|
|||||||
|
|
||||||
enum eExplosionType
|
enum eExplosionType
|
||||||
{
|
{
|
||||||
EXPLOSION_3 = 3,
|
EXPLOSION_GRENADE,
|
||||||
EXPLOSION_4
|
EXPLOSION_MOLOTOV,
|
||||||
|
EXPLOSION_ROCKET,
|
||||||
|
EXPLOSION_CAR,
|
||||||
|
EXPLOSION_CAR_QUICK,
|
||||||
|
EXPLOSION_HELI,
|
||||||
|
EXPLOSION_MINE,
|
||||||
|
EXPLOSION_BARREL,
|
||||||
|
EXPLOSION_TANK_GRENADE,
|
||||||
|
EXPLOSION_HELI_BOMB
|
||||||
};
|
};
|
||||||
|
|
||||||
class CExplosion
|
class CExplosion
|
||||||
|
@ -45,10 +45,10 @@ public:
|
|||||||
int8 field_225;
|
int8 field_225;
|
||||||
int8 field_226;
|
int8 field_226;
|
||||||
int8 field_227;
|
int8 field_227;
|
||||||
int32 m_nTimeLostRemoteCar;
|
uint32 m_nTimeLostRemoteCar;
|
||||||
int32 m_nTimeLastHealthLoss;
|
uint32 m_nTimeLastHealthLoss;
|
||||||
int32 m_nTimeLastArmourLoss;
|
uint32 m_nTimeLastArmourLoss;
|
||||||
int32 field_240;
|
uint32 m_nTimeTankShotGun;
|
||||||
int32 m_nUpsideDownCounter;
|
int32 m_nUpsideDownCounter;
|
||||||
int32 field_248;
|
int32 field_248;
|
||||||
int16 m_nTrafficMultiplier;
|
int16 m_nTrafficMultiplier;
|
||||||
|
@ -296,6 +296,8 @@ DebugMenuPopulate(void)
|
|||||||
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
|
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Yakuza", [](){ SpawnCar(MI_YAKUZA); });
|
DebugMenuAddCmd("Spawn", "Spawn Yakuza", [](){ SpawnCar(MI_YAKUZA); });
|
||||||
DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); });
|
DebugMenuAddCmd("Spawn", "Spawn Dodo", [](){ SpawnCar(MI_DODO); });
|
||||||
|
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
|
||||||
|
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
|
||||||
|
|
||||||
|
|
||||||
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
|
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
|
||||||
|
@ -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; }
|
||||||
|
|
||||||
|
871
src/peds/Ped.cpp
871
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 bScriptObjectiveCompleted : 1;
|
uint8 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;
|
||||||
@ -504,6 +546,16 @@ public:
|
|||||||
void SetAmmo(eWeaponType weaponType, uint32 ammo);
|
void SetAmmo(eWeaponType weaponType, uint32 ammo);
|
||||||
void SetEvasiveStep(CEntity*, uint8);
|
void SetEvasiveStep(CEntity*, uint8);
|
||||||
void GrantAmmo(eWeaponType, uint32);
|
void GrantAmmo(eWeaponType, uint32);
|
||||||
|
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);
|
||||||
@ -579,6 +631,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");
|
||||||
|
@ -1421,9 +1421,111 @@ CAutomobile::FireTruckControl(void)
|
|||||||
{ EAXJMP(0x522590);
|
{ EAXJMP(0x522590);
|
||||||
}
|
}
|
||||||
|
|
||||||
WRAPPER void
|
void
|
||||||
CAutomobile::TankControl(void)
|
CAutomobile::TankControl(void)
|
||||||
{ EAXJMP(0x53D530);
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// These coords are 1 unit higher then they should be relative to model center
|
||||||
|
CVector turrentBase(0.0f, -1.394f, 2.296f);
|
||||||
|
CVector gunEnd(0.0f, 1.813f, 2.979f);
|
||||||
|
CVector baseToEnd = gunEnd - turrentBase;
|
||||||
|
|
||||||
|
if(this != FindPlayerVehicle())
|
||||||
|
return;
|
||||||
|
if(CWorld::Players[CWorld::PlayerInFocus].m_WBState != WBSTATE_PLAYING)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Rotate turret
|
||||||
|
float prevAngle = m_fCarGunLR;
|
||||||
|
m_fCarGunLR -= CPad::GetPad(0)->GetCarGunLeftRight() * 0.00015f * CTimer::GetTimeStep();
|
||||||
|
if(m_fCarGunLR < 0.0f)
|
||||||
|
m_fCarGunLR += TWOPI;
|
||||||
|
if(m_fCarGunLR > TWOPI)
|
||||||
|
m_fCarGunLR -= TWOPI;
|
||||||
|
if(m_fCarGunLR != prevAngle)
|
||||||
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_TANK_TURRET_ROTATE, Abs(m_fCarGunLR - prevAngle));
|
||||||
|
|
||||||
|
// Shoot
|
||||||
|
if(CPad::GetPad(0)->CarGunJustDown() &&
|
||||||
|
CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeTankShotGun + 800){
|
||||||
|
CWorld::Players[CWorld::PlayerInFocus].m_nTimeTankShotGun = CTimer::GetTimeInMilliseconds();
|
||||||
|
|
||||||
|
// more like -sin(angle), cos(angle), i.e. rotated (0,1,0)
|
||||||
|
CVector turretDir = CVector(Sin(-m_fCarGunLR), Cos(-m_fCarGunLR), 0.0f);
|
||||||
|
turretDir = Multiply3x3(GetMatrix(), turretDir);
|
||||||
|
|
||||||
|
float c = Cos(m_fCarGunLR);
|
||||||
|
float s = Sin(m_fCarGunLR);
|
||||||
|
CVector rotatedEnd(
|
||||||
|
c*baseToEnd.x - s*baseToEnd.y,
|
||||||
|
s*baseToEnd.x + c*baseToEnd.y,
|
||||||
|
baseToEnd.z - 1.0f); // correct offset here
|
||||||
|
rotatedEnd += turrentBase;
|
||||||
|
|
||||||
|
CVector point1 = GetMatrix() * rotatedEnd;
|
||||||
|
CVector point2 = point1 + 60.0f*turretDir;
|
||||||
|
m_vecMoveSpeed -= 0.06f*turretDir;
|
||||||
|
m_vecMoveSpeed.z += 0.05f;
|
||||||
|
|
||||||
|
CWeapon::DoTankDoomAiming(FindPlayerVehicle(), FindPlayerPed(), &point1, &point2);
|
||||||
|
CColPoint colpoint;
|
||||||
|
CEntity *entity = nil;
|
||||||
|
CWorld::ProcessLineOfSight(point1, point2, colpoint, entity, true, true, true, true, true, true, false);
|
||||||
|
if(entity)
|
||||||
|
point2 = colpoint.point - 0.04f*(colpoint.point - point1);
|
||||||
|
|
||||||
|
CExplosion::AddExplosion(nil, FindPlayerPed(), EXPLOSION_TANK_GRENADE, point2, 0);
|
||||||
|
|
||||||
|
// Add particles on the way to the explosion;
|
||||||
|
float shotDist = (point2 - point1).Magnitude();
|
||||||
|
int n = shotDist/4.0f;
|
||||||
|
RwRGBA black = { 0, 0, 0, 0 };
|
||||||
|
for(i = 0; i < n; i++){
|
||||||
|
float f = (float)i/n;
|
||||||
|
CParticle::AddParticle(PARTICLE_HELI_DUST,
|
||||||
|
point1 + f*(point2 - point1),
|
||||||
|
CVector(0.0f, 0.0f, 0.0f),
|
||||||
|
nil, 0.1f, black);
|
||||||
|
}
|
||||||
|
|
||||||
|
// More particles
|
||||||
|
CVector shotDir = point2 - point1;
|
||||||
|
shotDir.Normalise();
|
||||||
|
for(i = 0; i < 15; i++){
|
||||||
|
float f = i/15.0f;
|
||||||
|
CParticle::AddParticle(PARTICLE_GUNSMOKE2, point1,
|
||||||
|
shotDir*CGeneral::GetRandomNumberInRange(0.3f, 1.0f)*f,
|
||||||
|
nil, CGeneral::GetRandomNumberInRange(0.5f, 1.0f)*f, black);
|
||||||
|
}
|
||||||
|
|
||||||
|
// And some gun flashes near the gun
|
||||||
|
CVector flashPos = point1;
|
||||||
|
CVector nullDir(0.0f, 0.0f, 0.0f);
|
||||||
|
int lifeSpan = 250;
|
||||||
|
if(m_vecMoveSpeed.Magnitude() > 0.08f){
|
||||||
|
lifeSpan = 125;
|
||||||
|
flashPos.x += 0.5f*m_vecMoveSpeed.x;
|
||||||
|
flashPos.y += 0.5f*m_vecMoveSpeed.y;
|
||||||
|
}
|
||||||
|
CParticle::AddParticle(PARTICLE_GUNFLASH, flashPos, nullDir, nil, 0.4f, black, 0, 0, 0, lifeSpan);
|
||||||
|
flashPos += 0.3f*shotDir;
|
||||||
|
CParticle::AddParticle(PARTICLE_GUNFLASH, flashPos, nullDir, nil, 0.2f, black, 0, 0, 0, lifeSpan);
|
||||||
|
flashPos += 0.1f*shotDir;
|
||||||
|
CParticle::AddParticle(PARTICLE_GUNFLASH, flashPos, nullDir, nil, 0.15f, black, 0, 0, 0, lifeSpan);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actually update turret node
|
||||||
|
if(m_aCarNodes[CAR_WINDSCREEN]){
|
||||||
|
CMatrix mat;
|
||||||
|
CVector pos;
|
||||||
|
|
||||||
|
mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WINDSCREEN]));
|
||||||
|
pos = mat.GetPosition();
|
||||||
|
mat.SetRotateZ(m_fCarGunLR);
|
||||||
|
mat.Translate(pos);
|
||||||
|
mat.UpdateRW();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WRAPPER void
|
WRAPPER void
|
||||||
@ -2313,9 +2415,9 @@ CAutomobile::BlowUpCar(CEntity *culprit)
|
|||||||
gFireManager.StartFire(this, culprit, 0.8f, 1); // TODO
|
gFireManager.StartFire(this, culprit, 0.8f, 1); // TODO
|
||||||
CDarkel::RegisterCarBlownUpByPlayer(this);
|
CDarkel::RegisterCarBlownUpByPlayer(this);
|
||||||
if(GetModelIndex() == MI_RCBANDIT)
|
if(GetModelIndex() == MI_RCBANDIT)
|
||||||
CExplosion::AddExplosion(this, culprit, EXPLOSION_4, GetPosition(), 0); // TODO
|
CExplosion::AddExplosion(this, culprit, EXPLOSION_CAR_QUICK, GetPosition(), 0);
|
||||||
else
|
else
|
||||||
CExplosion::AddExplosion(this, culprit, EXPLOSION_3, GetPosition(), 0); // TODO
|
CExplosion::AddExplosion(this, culprit, EXPLOSION_CAR, GetPosition(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -3,11 +3,14 @@
|
|||||||
#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); }
|
||||||
WRAPPER void CWeapon::AddGunshell(CEntity*, CVector const&, CVector2D const&, float) { EAXJMP(0x55F770); }
|
WRAPPER void CWeapon::AddGunshell(CEntity*, CVector const&, CVector2D const&, float) { EAXJMP(0x55F770); }
|
||||||
WRAPPER void CWeapon::Update(int32 audioEntity) { EAXJMP(0x563A10); }
|
WRAPPER void CWeapon::Update(int32 audioEntity) { EAXJMP(0x563A10); }
|
||||||
|
WRAPPER void CWeapon::DoTankDoomAiming(CEntity *playerVehicle, CEntity *playerPed, CVector *start, CVector *end) { EAXJMP(0x563200); }
|
||||||
|
|
||||||
void
|
void
|
||||||
CWeapon::Initialise(eWeaponType type, int ammo)
|
CWeapon::Initialise(eWeaponType type, int ammo)
|
||||||
@ -49,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,5 +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);
|
||||||
|
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