mirror of
https://github.com/halpz/re3.git
synced 2025-07-03 20:00:49 +00:00
Peds, Hud, CFO 1/2, fixes - including zone names
This commit is contained in:
1267
src/peds/Ped.cpp
1267
src/peds/Ped.cpp
File diff suppressed because it is too large
Load Diff
@ -30,6 +30,13 @@ struct PedAudioData
|
||||
int m_nMaxRandomDelayTime;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
ATTACK_IN_PROGRESS,
|
||||
CANT_ATTACK,
|
||||
WATCH_UNTIL_HE_DISAPPEARS,
|
||||
};
|
||||
|
||||
enum eFormation
|
||||
{
|
||||
FORMATION_UNDEFINED,
|
||||
@ -474,7 +481,7 @@ public:
|
||||
uint32 bNeverEverTargetThisPed : 1;
|
||||
uint32 bCrouchWhenScared : 1;
|
||||
uint32 bKnockedOffBike : 1;
|
||||
//uint32 b158_8
|
||||
uint32 b158_8 : 1;
|
||||
uint32 b158_10 : 1;
|
||||
uint32 bBoughtIceCream : 1;
|
||||
uint32 b158_40 : 1;
|
||||
@ -944,6 +951,8 @@ public:
|
||||
void ClearWaitState(void);
|
||||
void Undress(const char*);
|
||||
void Dress(void);
|
||||
int32 KillCharOnFootMelee(CVector&, CVector&, CVector&);
|
||||
int32 KillCharOnFootArmed(CVector&, CVector&, CVector&);
|
||||
|
||||
bool HasWeaponSlot(uint8 slot) { return m_weapons[slot].m_eWeaponType != WEAPONTYPE_UNARMED; }
|
||||
CWeapon& GetWeapon(uint8 slot) { return m_weapons[slot]; }
|
||||
|
@ -7,10 +7,11 @@
|
||||
#include "Sprite.h"
|
||||
#include "Text.h"
|
||||
|
||||
|
||||
// TODO(Miami)
|
||||
static char ObjectiveText[][28] = {
|
||||
"No Obj",
|
||||
"Wait on Foot",
|
||||
"Wait on Foot For Cop",
|
||||
"Flee on Foot Till Safe",
|
||||
"Guard Spot",
|
||||
"Guard Area",
|
||||
@ -21,6 +22,8 @@ static char ObjectiveText[][28] = {
|
||||
"Flee Char on Foot Till Safe",
|
||||
"Flee Char on Foot Always",
|
||||
"GoTo Char on Foot",
|
||||
"GoTo Char on Foot Walking",
|
||||
"Hassle Char",
|
||||
"Follow Char in Formation",
|
||||
"Leave Car",
|
||||
"Enter Car as Passenger",
|
||||
@ -42,10 +45,9 @@ static char ObjectiveText[][28] = {
|
||||
"Catch Train",
|
||||
"Buy IceCream",
|
||||
"Steal Any Car",
|
||||
"Steal Any Mission Car",
|
||||
"Mug Char",
|
||||
#ifdef VC_PED_PORTS
|
||||
"Leave Car and Die"
|
||||
#endif
|
||||
"Leave Car and Die",
|
||||
};
|
||||
|
||||
static char StateText[][18] = {
|
||||
|
@ -35,7 +35,7 @@ CPlayerPed::~CPlayerPed()
|
||||
delete m_pWanted;
|
||||
}
|
||||
|
||||
// --MIAMI: Done except commented out things
|
||||
// --MIAMI: Done
|
||||
CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
||||
{
|
||||
m_fMoveSpeed = 0.0f;
|
||||
@ -53,10 +53,8 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
||||
m_nSpeedTimer = 0;
|
||||
m_bSpeedTimerFlag = false;
|
||||
|
||||
// TODO(Miami)
|
||||
// if (pPointGunAt)
|
||||
// m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
|
||||
|
||||
if (m_pPointGunAt)
|
||||
m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
|
||||
m_pPointGunAt = nil;
|
||||
SetPedState(PED_IDLE);
|
||||
#ifndef FIX_BUGS
|
||||
@ -69,13 +67,14 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
||||
m_fAttackButtonCounter = 0.0f;
|
||||
m_bHaveTargetSelected = false;
|
||||
m_bHasLockOnTarget = false;
|
||||
m_bDrunkVisualsWearOff = true;
|
||||
m_bCanBeDamaged = true;
|
||||
m_bDrunkVisualsWearOff = false;
|
||||
m_fWalkAngle = 0.0f;
|
||||
m_fFPSMoveHeading = 0.0f;
|
||||
m_pMinigunTopAtomic = nil;
|
||||
m_fGunSpinSpeed = 0.0;
|
||||
m_fGunSpinAngle = 0.0;
|
||||
m_nPadDownPressedInMilliseconds = 0;
|
||||
m_nTargettableObjects[0] = m_nTargettableObjects[1] = m_nTargettableObjects[2] = m_nTargettableObjects[3] = -1;
|
||||
unused1 = false;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
@ -85,17 +84,16 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
|
||||
}
|
||||
m_nCheckPlayersIndex = 0;
|
||||
m_nPadUpPressedInMilliseconds = 0;
|
||||
m_nPadDownPressedInMilliseconds = 0;
|
||||
idleAnimBlockIndex = CAnimManager::GetAnimationBlockIndex("playidles");
|
||||
}
|
||||
|
||||
void CPlayerPed::ClearWeaponTarget()
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerPed::ClearWeaponTarget()
|
||||
{
|
||||
if (m_nPedType == PEDTYPE_PLAYER1) {
|
||||
|
||||
// TODO(Miami)
|
||||
// if (m_pPointGunAt)
|
||||
// m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
|
||||
if (m_pPointGunAt)
|
||||
m_pPointGunAt->CleanUpOldReference(&m_pPointGunAt);
|
||||
|
||||
m_pPointGunAt = nil;
|
||||
TheCamera.ClearPlayerWeaponMode();
|
||||
@ -1816,6 +1814,7 @@ CPlayerPed::PlayIdleAnimations(CPad *padUsed)
|
||||
}
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerPed::RemovePedFromMeleeList(CPed *ped)
|
||||
{
|
||||
@ -1828,6 +1827,100 @@ CPlayerPed::RemovePedFromMeleeList(CPed *ped)
|
||||
ped->m_attackTimer = 0;
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerPed::GetMeleeAttackCoords(CVector& coords, int8 dir, float dist)
|
||||
{
|
||||
coords = GetPosition();
|
||||
switch (dir) {
|
||||
case 0:
|
||||
coords.y += dist;
|
||||
break;
|
||||
case 1:
|
||||
coords.x += Sqrt(3.f / 4.f) * dist;
|
||||
coords.y += 0.5f * dist;
|
||||
break;
|
||||
case 2:
|
||||
coords.x += Sqrt(3.f / 4.f) * dist;
|
||||
coords.y -= 0.5f * dist;
|
||||
break;
|
||||
case 3:
|
||||
coords.y -= dist;
|
||||
break;
|
||||
case 4:
|
||||
coords.x -= Sqrt(3.f / 4.f) * dist;
|
||||
coords.y -= 0.5f * dist;
|
||||
break;
|
||||
case 5:
|
||||
coords.x -= Sqrt(3.f / 4.f) * dist;
|
||||
coords.y += 0.5f * dist;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
int32
|
||||
CPlayerPed::FindMeleeAttackPoint(CPed *victim, CVector &dist, uint32 &endOfAttackOut)
|
||||
{
|
||||
endOfAttackOut = 0;
|
||||
bool thereIsAnEmptySlot = false;
|
||||
int dirToAttack = -1;
|
||||
for (int i = 0; i < ARRAY_SIZE(m_pMeleeList); i++) {
|
||||
CPed* pedAtThisDir = m_pMeleeList[i];
|
||||
if (pedAtThisDir) {
|
||||
if (pedAtThisDir == victim) {
|
||||
dirToAttack = i;
|
||||
} else {
|
||||
if (pedAtThisDir->m_attackTimer > endOfAttackOut)
|
||||
endOfAttackOut = pedAtThisDir->m_attackTimer;
|
||||
}
|
||||
} else {
|
||||
thereIsAnEmptySlot = true;
|
||||
}
|
||||
}
|
||||
|
||||
// We don't have victim ped in our melee list
|
||||
if (dirToAttack == -1 && thereIsAnEmptySlot) {
|
||||
float angle = Atan2(-dist.x, -dist.y);
|
||||
float adjustedAngle = angle + DEGTORAD(30.0f);
|
||||
if (adjustedAngle < 0.f)
|
||||
adjustedAngle += TWOPI;
|
||||
|
||||
int wantedDir = Floor(adjustedAngle / DEGTORAD(60.0f));
|
||||
|
||||
// And we have another ped at the direction of victim ped, so store victim to next empty direction to it's real direction. (Bollocks)
|
||||
if (m_pMeleeList[wantedDir]) {
|
||||
int closestDirToPreferred = -99;
|
||||
int preferredDir = wantedDir;
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(m_pMeleeList); i++) {
|
||||
if (!m_pMeleeList[i]) {
|
||||
if (Abs(i - preferredDir) < Abs(closestDirToPreferred - preferredDir))
|
||||
closestDirToPreferred = i;
|
||||
}
|
||||
}
|
||||
if (closestDirToPreferred > 0)
|
||||
dirToAttack = closestDirToPreferred;
|
||||
} else {
|
||||
|
||||
// Luckily the direction of victim ped is already empty, good
|
||||
dirToAttack = wantedDir;
|
||||
}
|
||||
|
||||
if (dirToAttack != -1) {
|
||||
m_pMeleeList[dirToAttack] = victim;
|
||||
victim->RegisterReference((CEntity**) &m_pMeleeList[dirToAttack]);
|
||||
if (endOfAttackOut > CTimer::GetTimeInMilliseconds())
|
||||
victim->m_attackTimer = endOfAttackOut + CGeneral::GetRandomNumberInRange(1000, 2000);
|
||||
else
|
||||
victim->m_attackTimer = CTimer::GetTimeInMilliseconds() + CGeneral::GetRandomNumberInRange(500, 1000);
|
||||
}
|
||||
}
|
||||
return dirToAttack;
|
||||
}
|
||||
|
||||
#ifdef COMPATIBLE_SAVES
|
||||
#define CopyFromBuf(buf, data) memcpy(&data, buf, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
|
||||
#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); SkipSaveBuf(buf, sizeof(data));
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
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];
|
||||
CPlayerPed* m_pMeleeList[6];
|
||||
CPed *m_pMeleeList[6]; // reachable peds at each direction(6)
|
||||
char unused1;
|
||||
int16 m_nCheckPlayersIndex;
|
||||
float m_fWalkAngle; //angle between heading and walking direction
|
||||
@ -85,6 +85,8 @@ public:
|
||||
bool DoesPlayerWantNewWeapon(eWeaponType, bool);
|
||||
void PlayIdleAnimations(CPad*);
|
||||
void RemovePedFromMeleeList(CPed*);
|
||||
void GetMeleeAttackCoords(CVector&, int8, float);
|
||||
int32 FindMeleeAttackPoint(CPed*, CVector&, uint32&);
|
||||
|
||||
static void SetupPlayerPed(int32);
|
||||
static void DeactivatePlayerPed(int32);
|
||||
|
Reference in New Issue
Block a user