mirror of
https://github.com/halpz/re3.git
synced 2025-06-30 00:16:22 +00:00
@ -23,7 +23,8 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
|
||||
switch (copType) {
|
||||
case COP_STREET:
|
||||
SetModelIndex(MI_COP);
|
||||
GiveWeapon(WEAPONTYPE_COLT45, 1000);
|
||||
// GiveWeapon(WEAPONTYPE_NIGHTSTICK, 1000, true); // TODO(Miami)
|
||||
GiveDelayedWeapon(WEAPONTYPE_COLT45, 1000);
|
||||
m_currentWeapon = WEAPONTYPE_UNARMED;
|
||||
m_fArmour = 0.0f;
|
||||
m_wepSkills = 208; /* TODO: what is this? seems unused */
|
||||
@ -31,17 +32,15 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
|
||||
break;
|
||||
case COP_FBI:
|
||||
SetModelIndex(MI_FBI);
|
||||
GiveWeapon(WEAPONTYPE_COLT45, 1000);
|
||||
GiveWeapon(WEAPONTYPE_AK47, 1000);
|
||||
SetCurrentWeapon(WEAPONTYPE_AK47);
|
||||
GiveDelayedWeapon(WEAPONTYPE_MP5, 1000);
|
||||
SetCurrentWeapon(WEAPONTYPE_MP5);
|
||||
m_fArmour = 100.0f;
|
||||
m_wepSkills = 176; /* TODO: what is this? seems unused */
|
||||
m_wepAccuracy = 76;
|
||||
break;
|
||||
case COP_SWAT:
|
||||
SetModelIndex(MI_SWAT);
|
||||
GiveWeapon(WEAPONTYPE_COLT45, 1000);
|
||||
GiveWeapon(WEAPONTYPE_UZI, 1000);
|
||||
GiveDelayedWeapon(WEAPONTYPE_UZI, 1000);
|
||||
SetCurrentWeapon(WEAPONTYPE_UZI);
|
||||
m_fArmour = 50.0f;
|
||||
m_wepSkills = 32; /* TODO: what is this? seems unused */
|
||||
@ -49,10 +48,8 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
|
||||
break;
|
||||
case COP_ARMY:
|
||||
SetModelIndex(MI_ARMY);
|
||||
GiveWeapon(WEAPONTYPE_COLT45, 1000);
|
||||
GiveWeapon(WEAPONTYPE_M16, 1000);
|
||||
GiveWeapon(WEAPONTYPE_GRENADE, 10);
|
||||
SetCurrentWeapon(WEAPONTYPE_M16);
|
||||
GiveDelayedWeapon(WEAPONTYPE_MP5, 1000);
|
||||
SetCurrentWeapon(WEAPONTYPE_MP5);
|
||||
m_fArmour = 100.0f;
|
||||
m_wepSkills = 32; /* TODO: what is this? seems unused */
|
||||
m_wepAccuracy = 84;
|
||||
@ -69,7 +66,7 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP)
|
||||
case 7: SetModelIndex(MI_VICE8); break;
|
||||
default: assert(0); break;
|
||||
}
|
||||
GiveWeapon(WEAPONTYPE_UZI, 1000);
|
||||
GiveDelayedWeapon(WEAPONTYPE_UZI, 1000);
|
||||
SetCurrentWeapon(WEAPONTYPE_UZI);
|
||||
m_fArmour = 100.0f;
|
||||
m_wepSkills = 176;
|
||||
|
@ -314,7 +314,7 @@ CEmergencyPed::MedicAI(void)
|
||||
m_nEmergencyPedState = EMERGENCY_PED_STAND_STILL;
|
||||
} else {
|
||||
m_nEmergencyPedState = EMERGENCY_PED_FACE_TO_PATIENT;
|
||||
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CPR, 4.0f);
|
||||
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_MEDIC, ANIM_CPR, 4.0f);
|
||||
bIsDucking = true;
|
||||
}
|
||||
SetLookTimer(2000);
|
||||
|
1300
src/peds/Ped.cpp
1300
src/peds/Ped.cpp
File diff suppressed because it is too large
Load Diff
@ -476,8 +476,9 @@ public:
|
||||
uint8 m_stateUnused;
|
||||
uint32 m_timerUnused;
|
||||
CVector2D *m_wanderRangeBounds; // array with 2 CVector2D (actually unused CRange2D class) - unused
|
||||
CWeapon m_weapons[WEAPONTYPE_TOTAL_INVENTORY_WEAPONS];
|
||||
CWeapon m_weapons[TOTAL_WEAPON_SLOTS];
|
||||
eWeaponType m_storedWeapon;
|
||||
uint32 m_storedWeaponAmmo;
|
||||
uint8 m_currentWeapon; // eWeaponType
|
||||
uint8 m_maxWeaponTypeAllowed; // eWeaponType
|
||||
uint8 m_wepSkills;
|
||||
@ -503,12 +504,26 @@ public:
|
||||
uint32 m_duckTimer;
|
||||
uint32 m_duckAndCoverTimer;
|
||||
uint32 m_bloodyFootprintCountOrDeathTime; // Death time when bDoBloodyFootprints is false. Weird decision
|
||||
uint32 m_shotTime;
|
||||
uint32 m_shotTimeAdd;
|
||||
uint8 m_panicCounter;
|
||||
bool m_deadBleeding;
|
||||
int8 m_bodyPartBleeding; // PedNode, but -1 if there isn't
|
||||
CPed *m_nearPeds[10];
|
||||
uint16 m_numNearPeds;
|
||||
int8 m_lastWepDam;
|
||||
uint16 m_pedMoney;
|
||||
int8 m_lastWepDam;
|
||||
CEntity *m_lastDamEntity;
|
||||
CEntity *m_attachedTo;
|
||||
CVector m_vecAttachOffset;
|
||||
uint16 m_attachType;
|
||||
float m_attachRot;
|
||||
uint32 m_attachWepAmmo;
|
||||
uint32 m_threatFlags;
|
||||
uint32 m_threatCheck;
|
||||
uint32 m_lastThreatCheck;
|
||||
uint32 m_sayType;
|
||||
uint32 m_sayTimer;
|
||||
uint32 m_lastSoundStart;
|
||||
uint32 m_soundStart;
|
||||
uint16 m_lastQueuedSound;
|
||||
@ -556,7 +571,8 @@ public:
|
||||
void ClearAttack(void);
|
||||
bool IsPedHeadAbovePos(float zOffset);
|
||||
void RemoveWeaponModel(int modelId);
|
||||
void SetCurrentWeapon(uint32 weaponType);
|
||||
void SetCurrentWeapon(eWeaponType weaponType);
|
||||
void SetCurrentWeapon(int weapon);
|
||||
void Duck(void);
|
||||
void ClearDuck(void);
|
||||
void ClearPointGunAt(void);
|
||||
@ -567,7 +583,7 @@ public:
|
||||
void PlayFootSteps(void);
|
||||
void QuitEnteringCar(void);
|
||||
void BuildPedLists(void);
|
||||
uint32 GiveWeapon(eWeaponType weaponType, uint32 ammo);
|
||||
int32 GiveWeapon(eWeaponType weaponType, uint32 ammo, bool unused = false);
|
||||
void CalculateNewOrientation(void);
|
||||
float WorkOutHeadingForMovingFirstPerson(float);
|
||||
void CalculateNewVelocity(void);
|
||||
@ -639,6 +655,7 @@ public:
|
||||
void RemoveInCarAnims(void);
|
||||
void CollideWithPed(CPed*);
|
||||
void SetDirectionToWalkAroundObject(CEntity*);
|
||||
void RemoveWeaponAnims(int, float);
|
||||
void CreateDeadPedMoney(void);
|
||||
void CreateDeadPedWeaponPickups(void);
|
||||
void SetAttackTimer(uint32);
|
||||
@ -654,7 +671,6 @@ public:
|
||||
void EnterCar(void);
|
||||
uint8 GetNearestTrainPedPosition(CVehicle*, CVector&);
|
||||
uint8 GetNearestTrainDoor(CVehicle*, CVector&);
|
||||
void LineUpPedWithTrain(void);
|
||||
void ExitCar(void);
|
||||
void Fight(void);
|
||||
bool FindBestCoordsFromNodes(CVector, CVector*);
|
||||
@ -701,7 +717,6 @@ public:
|
||||
void SetExitCar(CVehicle*, uint32);
|
||||
void SetFormation(eFormation);
|
||||
bool WillChat(CPed*);
|
||||
void SetEnterTrain(CVehicle*, uint32);
|
||||
void SetEnterCar_AllClear(CVehicle*, uint32, uint32);
|
||||
void SetSolicit(uint32 time);
|
||||
void ScanForInterestingStuff(void);
|
||||
@ -710,6 +725,9 @@ public:
|
||||
bool WarpPedToNearLeaderOffScreen(void);
|
||||
void Solicit(void);
|
||||
void SetExitBoat(CVehicle*);
|
||||
void ClearFollowPath();
|
||||
void GiveDelayedWeapon(eWeaponType weapon, uint32 ammo);
|
||||
void RequestDelayedWeapon();
|
||||
|
||||
// Static methods
|
||||
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);
|
||||
@ -737,8 +755,9 @@ public:
|
||||
static void PedSetDraggedOutCarCB(CAnimBlendAssociation *assoc, void *arg);
|
||||
static void PedAnimStepOutCarCB(CAnimBlendAssociation *assoc, void *arg);
|
||||
static void PedSetInTrainCB(CAnimBlendAssociation *assoc, void *arg);
|
||||
static void PedSetOutTrainCB(CAnimBlendAssociation *assoc, void *arg);
|
||||
static void PedSetOutTrainCB(CAnimBlendAssociation *assoc, void *arg); // TODO(Miami): Should be under GTA_TRAIN
|
||||
static void FinishedAttackCB(CAnimBlendAssociation *assoc, void *arg);
|
||||
static void FinishedReloadCB(CAnimBlendAssociation *assoc, void *arg);
|
||||
static void FinishFightMoveCB(CAnimBlendAssociation *assoc, void *arg);
|
||||
static void PedAnimDoorCloseRollingCB(CAnimBlendAssociation *assoc, void *arg);
|
||||
static void FinishJumpCB(CAnimBlendAssociation *assoc, void *arg);
|
||||
@ -767,8 +786,14 @@ public:
|
||||
void SetPedStats(ePedStats);
|
||||
bool IsGangMember(void);
|
||||
void Die(void);
|
||||
#ifdef GTA_TRAIN
|
||||
void EnterTrain(void);
|
||||
void ExitTrain(void);
|
||||
void SetExitTrain(CVehicle*);
|
||||
void SetPedPositionInTrain(void);
|
||||
void LineUpPedWithTrain(void);
|
||||
void SetEnterTrain(CVehicle*, uint32);
|
||||
#endif
|
||||
void Fall(void);
|
||||
bool IsPedShootable(void);
|
||||
void Look(void);
|
||||
@ -776,11 +801,9 @@ public:
|
||||
void RestoreHeadPosition(void);
|
||||
void PointGunAt(void);
|
||||
bool ServiceTalkingWhenDead(void);
|
||||
void SetPedPositionInTrain(void);
|
||||
void SetShootTimer(uint32);
|
||||
void SetSeekCar(CVehicle*, uint32);
|
||||
void SetSeekBoatPosition(CVehicle*);
|
||||
void SetExitTrain(CVehicle*);
|
||||
void WanderRange(void);
|
||||
void SetFollowRoute(int16, int16);
|
||||
void SeekBoatPosition(void);
|
||||
@ -793,8 +816,8 @@ public:
|
||||
bool CanPedJumpThis(CEntity*);
|
||||
#endif
|
||||
|
||||
bool HasWeapon(uint8 weaponType) { return m_weapons[weaponType].m_eWeaponType == weaponType; }
|
||||
CWeapon &GetWeapon(uint8 weaponType) { return m_weapons[weaponType]; }
|
||||
bool HasWeaponSlot(uint8 slot) { return m_weapons[slot].m_eWeaponType != WEAPONTYPE_UNARMED; }
|
||||
CWeapon &GetWeapon(uint8 slot) { return m_weapons[slot]; }
|
||||
CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; }
|
||||
|
||||
PedState GetPedState(void) { return m_nPedState; }
|
||||
@ -811,6 +834,35 @@ public:
|
||||
void ReplaceWeaponWhenExitingVehicle(void);
|
||||
void RemoveWeaponWhenEnteringVehicle(void);
|
||||
bool IsNotInWreckedVehicle();
|
||||
|
||||
// My addons. Maybe inlined in VC?
|
||||
AnimationId GetFireAnimNotDucking(CWeaponInfo* weapon) {
|
||||
// TODO(Miami): Revert that when weapons got ported
|
||||
if (weapon->m_AnimToPlay == ASSOCGRP_STD)
|
||||
return ANIM_FIGHT_PPUNCH;
|
||||
|
||||
if (m_nPedType == PEDTYPE_COP && !!weapon->m_bCop3rd)
|
||||
return ANIM_WEAPON_FIRE_3RD;
|
||||
else
|
||||
return weapon->m_bAnimDetonate ? ANIM_BOMBER : ANIM_WEAPON_FIRE;
|
||||
}
|
||||
|
||||
static AnimationId GetFireAnimGround(CWeaponInfo* weapon, bool kickFloorIfNone = true) {
|
||||
// TODO(Miami): Revert that when weapons got ported
|
||||
if (weapon->m_AnimToPlay == ASSOCGRP_STD)
|
||||
return ANIM_KICK_FLOOR;
|
||||
|
||||
if (!!weapon->m_bGround2nd)
|
||||
return ANIM_WEAPON_CROUCHFIRE;
|
||||
else if (!!weapon->m_bGround3rd)
|
||||
return ANIM_WEAPON_SPECIAL;
|
||||
else if (kickFloorIfNone)
|
||||
return ANIM_KICK_FLOOR;
|
||||
else
|
||||
return (AnimationId)0;
|
||||
}
|
||||
// --
|
||||
|
||||
// My additions, because there were many, many instances of that.
|
||||
inline void SetFindPathAndFlee(CEntity *fleeFrom, int time, bool walk = false)
|
||||
{
|
||||
@ -829,6 +881,7 @@ public:
|
||||
if (walk)
|
||||
SetMoveState(PEDMOVE_WALK);
|
||||
}
|
||||
// --
|
||||
|
||||
// Using this to abstract nodes of skinned and non-skinned meshes
|
||||
CVector GetNodePosition(int32 node)
|
||||
@ -878,6 +931,7 @@ public:
|
||||
|
||||
void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg);
|
||||
|
||||
// TODO(Miami): Change those when Ped struct is done
|
||||
#ifndef PED_SKIN
|
||||
VALIDATE_SIZE(CPed, 0x53C);
|
||||
#endif
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "Pools.h"
|
||||
#include "Darkel.h"
|
||||
#include "CarCtrl.h"
|
||||
#include "MBlur.h"
|
||||
|
||||
#define PAD_MOVE_TO_GAME_WORLD_MOVE 60.0f
|
||||
|
||||
@ -31,6 +32,7 @@ CPlayerPed::~CPlayerPed()
|
||||
delete m_pWanted;
|
||||
}
|
||||
|
||||
// --MIAMI: Done except commented out things
|
||||
CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
||||
{
|
||||
m_fMoveSpeed = 0.0f;
|
||||
@ -44,26 +46,47 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
||||
m_nSelectedWepSlot = WEAPONTYPE_UNARMED;
|
||||
m_nSpeedTimer = 0;
|
||||
m_bSpeedTimerFlag = false;
|
||||
|
||||
// This should be something inlined
|
||||
// TODO(Miami)
|
||||
|
||||
// if (pPointGunAt)
|
||||
// m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
|
||||
m_pPointGunAt = nil;
|
||||
if (m_nPedState == PED_FOLLOW_PATH)
|
||||
ClearFollowPath();
|
||||
|
||||
// TODO(Miami)
|
||||
// This should be something inlined
|
||||
|
||||
m_nPedState = PED_IDLE;
|
||||
m_fMaxStamina = 150.0f;
|
||||
m_fCurrentStamina = m_fMaxStamina;
|
||||
m_fStaminaProgress = 0.0f;
|
||||
m_nEvadeAmount = 0;
|
||||
field_1367 = 0;
|
||||
m_pEvadingFrom = nil;
|
||||
m_nHitAnimDelayTimer = 0;
|
||||
m_fAttackButtonCounter = 0.0f;
|
||||
m_bHaveTargetSelected = false;
|
||||
m_bHasLockOnTarget = false;
|
||||
m_bDrunkVisualsWearOff = true;
|
||||
m_bCanBeDamaged = true;
|
||||
m_fWalkAngle = 0.0f;
|
||||
m_fFPSMoveHeading = 0.0f;
|
||||
m_pMinigunTopAtomic = nil;
|
||||
m_fGunSpinSpeed = 0.0;
|
||||
m_fGunSpinAngle = 0.0;
|
||||
m_nTargettableObjects[0] = m_nTargettableObjects[1] = m_nTargettableObjects[2] = m_nTargettableObjects[3] = -1;
|
||||
field_1413 = 0;
|
||||
unused1 = false;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
m_vecSafePos[i] = CVector(0.0f, 0.0f, 0.0f);
|
||||
m_pPedAtSafePos[i] = nil;
|
||||
m_pCheckPlayers[i] = nil;
|
||||
}
|
||||
m_nCheckPlayersIndex = 0;
|
||||
m_nPadUpPressedInMilliseconds = 0;
|
||||
m_nPadDownPressedInMilliseconds = 0;
|
||||
// TODO(Miami): Idle anim block index
|
||||
}
|
||||
|
||||
void CPlayerPed::ClearWeaponTarget()
|
||||
@ -181,8 +204,9 @@ CPlayerPed::UseSprintEnergy(void)
|
||||
}
|
||||
}
|
||||
|
||||
// --MIAMI: Use that on everywhere except ProcessPlayerWeapon
|
||||
void
|
||||
CPlayerPed::MakeChangesForNewWeapon(int8 weapon)
|
||||
CPlayerPed::MakeChangesForNewWeapon(eWeaponType weapon)
|
||||
{
|
||||
if (m_nPedState == PED_SNIPER_MODE) {
|
||||
RestorePreviousState();
|
||||
@ -195,7 +219,7 @@ CPlayerPed::MakeChangesForNewWeapon(int8 weapon)
|
||||
if (!(CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_bCanAim))
|
||||
ClearWeaponTarget();
|
||||
|
||||
CAnimBlendAssociation *weaponAnim = RpAnimBlendClumpGetAssociation(GetClump(), CWeaponInfo::GetWeaponInfo(WEAPONTYPE_SNIPERRIFLE)->m_AnimToPlay);
|
||||
CAnimBlendAssociation* weaponAnim = RpAnimBlendClumpGetAssociation(GetClump(), CWeaponInfo::GetWeaponInfo(WEAPONTYPE_SNIPERRIFLE)->m_bAnimDetonate ? 62 : 205);
|
||||
if (weaponAnim) {
|
||||
weaponAnim->SetRun();
|
||||
weaponAnim->flags |= ASSOC_FADEOUTWHENDONE;
|
||||
@ -203,6 +227,14 @@ CPlayerPed::MakeChangesForNewWeapon(int8 weapon)
|
||||
TheCamera.ClearPlayerWeaponMode();
|
||||
}
|
||||
|
||||
// --MIAMI: Done, but this should be only called from ProcessPlayerWeapon
|
||||
void
|
||||
CPlayerPed::MakeChangesForNewWeapon(int32 slot)
|
||||
{
|
||||
if(slot != -1)
|
||||
MakeChangesForNewWeapon(m_weapons[slot].m_eWeaponType);
|
||||
}
|
||||
|
||||
void
|
||||
CPlayerPed::ReApplyMoveAnims(void)
|
||||
{
|
||||
@ -222,14 +254,19 @@ CPlayerPed::ReApplyMoveAnims(void)
|
||||
}
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerPed::SetInitialState(void)
|
||||
{
|
||||
m_nDrunkenness = 0;
|
||||
m_nFadeDrunkenness = 0;
|
||||
CMBlur::ClearDrunkBlur();
|
||||
m_nDrunkCountdown = 0;
|
||||
m_bAdrenalineActive = false;
|
||||
m_nAdrenalineTime = 0;
|
||||
CTimer::SetTimeStep(1.0f);
|
||||
CTimer::SetTimeScale(1.0f);
|
||||
m_pSeekTarget = nil;
|
||||
m_vecSeekPos = { 0.0f, 0.0f, 0.0f };
|
||||
m_vecSeekPos = CVector(0.0f, 0.0f, 0.0f);
|
||||
m_fleeFromPosX = 0.0f;
|
||||
m_fleeFromPosY = 0.0f;
|
||||
m_fleeFrom = nil;
|
||||
@ -241,9 +278,14 @@ CPlayerPed::SetInitialState(void)
|
||||
ClearLookFlag();
|
||||
bIsPointingGunAt = false;
|
||||
bRenderPedInCar = true;
|
||||
|
||||
if (m_pFire)
|
||||
m_pFire->Extinguish();
|
||||
|
||||
RpAnimBlendClumpRemoveAllAssociations(GetClump());
|
||||
if (m_nPedState == PED_FOLLOW_PATH)
|
||||
ClearFollowPath();
|
||||
|
||||
m_nPedState = PED_IDLE;
|
||||
SetMoveState(PEDMOVE_STILL);
|
||||
m_nLastPedState = PED_NONE;
|
||||
@ -257,6 +299,11 @@ CPlayerPed::SetInitialState(void)
|
||||
m_bCanBeDamaged = true;
|
||||
m_pedStats->m_temper = 50;
|
||||
m_fWalkAngle = 0.0f;
|
||||
if (m_attachedTo && !bUsesCollision)
|
||||
bUsesCollision = true;
|
||||
|
||||
m_attachedTo = nil;
|
||||
m_attachWepAmmo = 0;
|
||||
}
|
||||
|
||||
void
|
||||
@ -497,8 +544,9 @@ CPlayerPed::DoWeaponSmoothSpray(void)
|
||||
{
|
||||
if (m_nPedState == PED_ATTACK && !m_pPointGunAt) {
|
||||
eWeaponType weapon = GetWeapon()->m_eWeaponType;
|
||||
if (weapon == WEAPONTYPE_FLAMETHROWER || weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI || weapon == WEAPONTYPE_SHOTGUN ||
|
||||
weapon == WEAPONTYPE_AK47 || weapon == WEAPONTYPE_M16 || weapon == WEAPONTYPE_HELICANNON)
|
||||
if (weapon == WEAPONTYPE_FLAMETHROWER || weapon == WEAPONTYPE_COLT45 || weapon == WEAPONTYPE_UZI ||
|
||||
weapon == WEAPONTYPE_TEC9 || weapon == WEAPONTYPE_SILENCED_INGRAM || weapon == WEAPONTYPE_MP5 ||
|
||||
weapon == WEAPONTYPE_SHOTGUN || weapon == WEAPONTYPE_AK47 || weapon == WEAPONTYPE_M16 || weapon == WEAPONTYPE_HELICANNON)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -586,56 +634,71 @@ CPlayerPed::PlayerControlSniper(CPad *padUsed)
|
||||
GetWeapon()->Update(m_audioEntityId);
|
||||
}
|
||||
|
||||
// --MIAMI: Made compatible with slots, but still TODO
|
||||
// I think R* also used goto in here.
|
||||
void
|
||||
CPlayerPed::ProcessWeaponSwitch(CPad *padUsed)
|
||||
{
|
||||
if (CDarkel::FrenzyOnGoing())
|
||||
if (CDarkel::FrenzyOnGoing() || m_attachedTo)
|
||||
goto switchDetectDone;
|
||||
|
||||
if (padUsed->CycleWeaponRightJustDown() && !m_pPointGunAt) {
|
||||
if (!m_pPointGunAt && /* !byte_A10B57 && */ GetWeapon()->m_eWeaponType != WEAPONTYPE_DETONATOR) {
|
||||
if (padUsed->CycleWeaponRightJustDown()) {
|
||||
|
||||
if (TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON_RUNABOUT
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER_RUNABOUT
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_ROCKETLAUNCHER
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_ROCKETLAUNCHER_RUNABOUT) {
|
||||
if (TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON_RUNABOUT
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER_RUNABOUT
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_ROCKETLAUNCHER
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_ROCKETLAUNCHER_RUNABOUT) {
|
||||
|
||||
for (m_nSelectedWepSlot = m_currentWeapon + 1; m_nSelectedWepSlot < WEAPONTYPE_TOTAL_INVENTORY_WEAPONS; ++m_nSelectedWepSlot) {
|
||||
if (HasWeapon(m_nSelectedWepSlot) && GetWeapon(m_nSelectedWepSlot).HasWeaponAmmoToBeUsed()) {
|
||||
goto switchDetectDone;
|
||||
for (m_nSelectedWepSlot = m_currentWeapon + 1; m_nSelectedWepSlot < TOTAL_WEAPON_SLOTS; ++m_nSelectedWepSlot) {
|
||||
if (HasWeaponSlot(m_nSelectedWepSlot) && GetWeapon(m_nSelectedWepSlot).HasWeaponAmmoToBeUsed()) {
|
||||
goto spentAmmoCheck;
|
||||
}
|
||||
}
|
||||
m_nSelectedWepSlot = 0;
|
||||
}
|
||||
m_nSelectedWepSlot = WEAPONTYPE_UNARMED;
|
||||
}
|
||||
} else if (padUsed->CycleWeaponLeftJustDown() && !m_pPointGunAt) {
|
||||
if (TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_ROCKETLAUNCHER) {
|
||||
|
||||
for (m_nSelectedWepSlot = m_currentWeapon - 1; ; --m_nSelectedWepSlot) {
|
||||
if (m_nSelectedWepSlot < WEAPONTYPE_UNARMED)
|
||||
m_nSelectedWepSlot = WEAPONTYPE_DETONATOR;
|
||||
|
||||
if (HasWeapon(m_nSelectedWepSlot) && GetWeapon(m_nSelectedWepSlot).HasWeaponAmmoToBeUsed()) {
|
||||
goto switchDetectDone;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (CWeaponInfo::GetWeaponInfo((eWeaponType)m_currentWeapon)->m_eWeaponFire != WEAPON_FIRE_MELEE) {
|
||||
if (GetWeapon(m_currentWeapon).m_nAmmoTotal <= 0) {
|
||||
} else if (padUsed->CycleWeaponLeftJustDown()) {
|
||||
if (TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_ROCKETLAUNCHER) {
|
||||
|
||||
for (m_nSelectedWepSlot = m_currentWeapon - 1; m_nSelectedWepSlot >= 0; --m_nSelectedWepSlot) {
|
||||
if (m_nSelectedWepSlot == WEAPONTYPE_BASEBALLBAT && HasWeapon(WEAPONTYPE_BASEBALLBAT)
|
||||
|| GetWeapon(m_nSelectedWepSlot).m_nAmmoTotal > 0 && m_nSelectedWepSlot != WEAPONTYPE_MOLOTOV && m_nSelectedWepSlot != WEAPONTYPE_GRENADE) {
|
||||
for (m_nSelectedWepSlot = m_currentWeapon - 1; ; --m_nSelectedWepSlot) {
|
||||
if (m_nSelectedWepSlot < 0)
|
||||
m_nSelectedWepSlot = 9;
|
||||
|
||||
if (HasWeaponSlot(m_nSelectedWepSlot) && GetWeapon(m_nSelectedWepSlot).HasWeaponAmmoToBeUsed()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
spentAmmoCheck:
|
||||
if (CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_eWeaponFire != WEAPON_FIRE_MELEE
|
||||
/*&& (!padUsed->GetWeapon() || GetWeapon()->m_eWeaponType != WEAPONTYPE_MINIGUN) */) {
|
||||
if (GetWeapon()->m_nAmmoTotal <= 0) {
|
||||
if (TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER
|
||||
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_ROCKETLAUNCHER) {
|
||||
|
||||
if (GetWeapon()->m_eWeaponType != WEAPONTYPE_DETONATOR
|
||||
|| GetWeapon(2).m_eWeaponType != WEAPONTYPE_DETONATOR_GRENADE)
|
||||
m_nSelectedWepSlot = m_currentWeapon - 1;
|
||||
else
|
||||
m_nSelectedWepSlot = 2;
|
||||
|
||||
// BUG: m_nSelectedWepSlot is slot in VC but they compared against weapon types, lol.
|
||||
for (; m_nSelectedWepSlot >= 0; --m_nSelectedWepSlot) {
|
||||
if (m_nSelectedWepSlot == WEAPONTYPE_BASEBALLBAT && GetWeapon(6).m_eWeaponType == WEAPONTYPE_BASEBALLBAT
|
||||
|| GetWeapon(m_nSelectedWepSlot).m_nAmmoTotal > 0
|
||||
/*&& m_nSelectedWepSlot != WEAPONTYPE_MOLOTOV && m_nSelectedWepSlot != WEAPONTYPE_GRENADE && m_nSelectedWepSlot != WEAPONTYPE_TEARGAS */) {
|
||||
goto switchDetectDone;
|
||||
}
|
||||
}
|
||||
m_nSelectedWepSlot = WEAPONTYPE_UNARMED;
|
||||
m_nSelectedWepSlot = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -643,6 +706,7 @@ CPlayerPed::ProcessWeaponSwitch(CPad *padUsed)
|
||||
switchDetectDone:
|
||||
if (m_nSelectedWepSlot != m_currentWeapon) {
|
||||
if (m_nPedState != PED_ATTACK && m_nPedState != PED_AIM_GUN && m_nPedState != PED_FIGHT)
|
||||
RemoveWeaponAnims(m_currentWeapon, -1000.0f);
|
||||
MakeChangesForNewWeapon(m_nSelectedWepSlot);
|
||||
}
|
||||
}
|
||||
@ -934,6 +998,7 @@ CPlayerPed::FindWeaponLockOnTarget(void)
|
||||
return true;
|
||||
}
|
||||
|
||||
// --MIAMI: Done, but uncomment new weapon types when weapons got ported
|
||||
void
|
||||
CPlayerPed::ProcessAnimGroups(void)
|
||||
{
|
||||
@ -946,17 +1011,29 @@ CPlayerPed::ProcessAnimGroups(void)
|
||||
if (m_fWalkAngle > 0.0f) {
|
||||
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER)
|
||||
groupToSet = ASSOCGRP_ROCKETLEFT;
|
||||
else if (/*GetWeapon()->m_eWeaponType == WEAPONTYPE_CHAINSAW || */
|
||||
GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER
|
||||
/* || GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN*/ )
|
||||
groupToSet = ASSOCGRP_CHAINSAWLEFT;
|
||||
else
|
||||
groupToSet = ASSOCGRP_PLAYERLEFT;
|
||||
} else {
|
||||
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER)
|
||||
groupToSet = ASSOCGRP_ROCKETRIGHT;
|
||||
else if (/*GetWeapon()->m_eWeaponType == WEAPONTYPE_CHAINSAW || */
|
||||
GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER
|
||||
/* || GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN*/)
|
||||
groupToSet = ASSOCGRP_CHAINSAWRIGHT;
|
||||
else
|
||||
groupToSet = ASSOCGRP_PLAYERRIGHT;
|
||||
}
|
||||
} else {
|
||||
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER)
|
||||
groupToSet = ASSOCGRP_ROCKETBACK;
|
||||
else if (/*GetWeapon()->m_eWeaponType == WEAPONTYPE_CHAINSAW || */
|
||||
GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER
|
||||
/* || GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN*/)
|
||||
groupToSet = ASSOCGRP_CHAINSAWBACK;
|
||||
else
|
||||
groupToSet = ASSOCGRP_PLAYERBACK;
|
||||
}
|
||||
@ -964,9 +1041,21 @@ CPlayerPed::ProcessAnimGroups(void)
|
||||
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER) {
|
||||
groupToSet = ASSOCGRP_PLAYERROCKET;
|
||||
} else {
|
||||
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_BASEBALLBAT) {
|
||||
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_BASEBALLBAT
|
||||
/* || GetWeapon()->m_eWeaponType == WEAPONTYPE_MACHETE */)
|
||||
groupToSet = ASSOCGRP_PLAYERBBBAT;
|
||||
} else if (GetWeapon()->m_eWeaponType != WEAPONTYPE_COLT45 && GetWeapon()->m_eWeaponType != WEAPONTYPE_UZI) {
|
||||
else if (/*GetWeapon()->m_eWeaponType == WEAPONTYPE_CHAINSAW || */
|
||||
GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER
|
||||
/* || GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN*/)
|
||||
groupToSet = ASSOCGRP_PLAYERCHAINSAW;
|
||||
else if (GetWeapon()->m_eWeaponType != WEAPONTYPE_COLT45 && GetWeapon()->m_eWeaponType != WEAPONTYPE_UZI
|
||||
// I hope this was inlined...
|
||||
/*
|
||||
&& GetWeapon()->m_eWeaponType != WEAPONTYPE_PYTHON*/ && GetWeapon()->m_eWeaponType != WEAPONTYPE_TEC9
|
||||
&& GetWeapon()->m_eWeaponType != WEAPONTYPE_SILENCED_INGRAM && GetWeapon()->m_eWeaponType != WEAPONTYPE_MP5 /*
|
||||
&& GetWeapon()->m_eWeaponType != WEAPONTYPE_GOLFCLUB && GetWeapon()->m_eWeaponType != WEAPONTYPE_KATANA
|
||||
&& GetWeapon()->m_eWeaponType != WEAPONTYPE_CAMERA
|
||||
*/) {
|
||||
if (!GetWeapon()->IsType2Handed()) {
|
||||
groupToSet = ASSOCGRP_PLAYER;
|
||||
} else {
|
||||
@ -1185,7 +1274,7 @@ CPlayerPed::PlayerControlZelda(CPad *padUsed)
|
||||
float neededTurn = CGeneral::LimitRadianAngle(padHeading - camOrientation);
|
||||
if (doSmoothSpray) {
|
||||
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER || GetWeapon()->m_eWeaponType == WEAPONTYPE_COLT45
|
||||
|| GetWeapon()->m_eWeaponType == WEAPONTYPE_UZI)
|
||||
|| CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType)->m_nWeaponSlot == 5)
|
||||
m_fRotationDest = m_fRotationCur - leftRight / 128.0f * (PI / 80.0f) * CTimer::GetTimeStep();
|
||||
else
|
||||
m_fRotationDest = m_fRotationCur - leftRight / 128.0f * (PI / 128.0f) * CTimer::GetTimeStep();
|
||||
|
@ -18,22 +18,32 @@ public:
|
||||
int8 m_nSelectedWepSlot; // eWeaponType
|
||||
bool m_bSpeedTimerFlag;
|
||||
uint8 m_nEvadeAmount;
|
||||
int8 field_1367;
|
||||
uint32 m_nSpeedTimer;
|
||||
uint32 m_nHitAnimDelayTimer;
|
||||
uint32 m_nSpeedTimer; // m_nStandStillTimer?
|
||||
uint32 m_nHitAnimDelayTimer; // m_nShotDelay?
|
||||
float m_fAttackButtonCounter;
|
||||
bool m_bHaveTargetSelected; // may have better name
|
||||
CEntity *m_pEvadingFrom; // is this CPhysical?
|
||||
int32 m_nTargettableObjects[4];
|
||||
uint32 m_nAdrenalineTime;
|
||||
uint8 m_nDrunkenness; // Needed to work out whether we lost target this frame
|
||||
uint8 m_nFadeDrunkenness;
|
||||
uint8 m_nDrunkCountdown; //countdown in frames when the drunk effect ends
|
||||
bool m_bAdrenalineActive;
|
||||
bool m_bHasLockOnTarget;
|
||||
uint32 m_nAdrenalineTime;
|
||||
bool m_bCanBeDamaged;
|
||||
int8 field_1413;
|
||||
bool m_bDrunkVisualsWearOff; // TODO(Miami): That may be something else
|
||||
CVector m_vecSafePos[6]; // safe places from the player, for example behind a tree
|
||||
CPed *m_pPedAtSafePos[6];
|
||||
float m_fWalkAngle;
|
||||
CPlayerPed* m_pCheckPlayers[6]; //checks something with players, could be a leftover from original multiplayer
|
||||
char unused1;
|
||||
int16 m_nCheckPlayersIndex;
|
||||
float m_fWalkAngle; //angle between heading and walking direction
|
||||
float m_fFPSMoveHeading;
|
||||
RpAtomic* m_pMinigunTopAtomic; //atomic for the spinning part of the minigun model
|
||||
float m_fGunSpinSpeed; // for minigun
|
||||
float m_fGunSpinAngle;
|
||||
unsigned int m_nPadDownPressedInMilliseconds;
|
||||
unsigned int m_nPadUpPressedInMilliseconds;
|
||||
|
||||
CPlayerPed();
|
||||
~CPlayerPed();
|
||||
@ -45,7 +55,8 @@ public:
|
||||
void SetWantedLevelNoDrop(int32 level);
|
||||
void KeepAreaAroundPlayerClear(void);
|
||||
void AnnoyPlayerPed(bool);
|
||||
void MakeChangesForNewWeapon(int8);
|
||||
void MakeChangesForNewWeapon(int32);
|
||||
void MakeChangesForNewWeapon(eWeaponType);
|
||||
void SetInitialState(void);
|
||||
void ProcessControl(void);
|
||||
void ClearAdrenaline(void);
|
||||
|
@ -471,9 +471,28 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors,
|
||||
ped->SetOrientation(0.0f, 0.0f, 0.0f);
|
||||
CWorld::Add(ped);
|
||||
if (ms_bGivePedsWeapons) {
|
||||
eWeaponType weapon = (eWeaponType)CGeneral::GetRandomNumberInRange(WEAPONTYPE_UNARMED, WEAPONTYPE_DETONATOR);
|
||||
eWeaponType weapon;
|
||||
|
||||
// TODO(Miami): Look here when weapons have been ported
|
||||
switch (CGeneral::GetRandomNumber() & 3) {
|
||||
case 0:
|
||||
weapon = WEAPONTYPE_COLT45;
|
||||
break;
|
||||
case 1:
|
||||
//weapon = WEAPONTYPE_NIGHTSTICK;
|
||||
//break;
|
||||
case 2:
|
||||
//weapon = WEAPONTYPE_GOLFCLUB;
|
||||
//break;
|
||||
case 3:
|
||||
weapon = WEAPONTYPE_TEC9;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (weapon != WEAPONTYPE_UNARMED) {
|
||||
ped->SetCurrentWeapon(ped->GiveWeapon(weapon, 25001));
|
||||
ped->GiveDelayedWeapon(weapon, 25001);
|
||||
ped->SetCurrentWeapon(CWeaponInfo::GetWeaponInfo(weapon)->m_nWeaponSlot);
|
||||
}
|
||||
}
|
||||
return ped;
|
||||
@ -501,12 +520,14 @@ CPopulation::AddPed(ePedType pedType, uint32 miOrCopType, CVector const &coors,
|
||||
ped->SetOrientation(0.0f, 0.0f, 0.0f);
|
||||
CWorld::Add(ped);
|
||||
|
||||
uint32 weapon;
|
||||
eWeaponType weapon;
|
||||
if (CGeneral::GetRandomNumberInRange(0, 100) >= 50)
|
||||
weapon = ped->GiveWeapon((eWeaponType)CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon2, 25001);
|
||||
weapon = (eWeaponType)CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon2;
|
||||
else
|
||||
weapon = ped->GiveWeapon((eWeaponType)CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon1, 25001);
|
||||
ped->SetCurrentWeapon(weapon);
|
||||
weapon = (eWeaponType)CGangs::GetGangInfo(pedType - PEDTYPE_GANG1)->m_Weapon1;
|
||||
|
||||
ped->GiveDelayedWeapon(weapon, 25001);
|
||||
ped->SetCurrentWeapon(CWeaponInfo::GetWeaponInfo(weapon)->m_nWeaponSlot);
|
||||
return ped;
|
||||
}
|
||||
case PEDTYPE_EMERGENCY:
|
||||
|
Reference in New Issue
Block a user