Merge branch 'miami' into miami

This commit is contained in:
erorcun
2020-06-16 23:02:21 +03:00
committed by GitHub
33 changed files with 2738 additions and 1531 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,11 +10,11 @@
#include "Weapon.h"
#include "WeaponInfo.h"
#include "AnimationId.h"
#include "PathFind.h"
#define FEET_OFFSET 1.04f
#define CHECK_NEARBY_THINGS_MAX_DIST 15.0f
struct CPathNode;
class CAccident;
class CObject;
class CFire;
@ -346,6 +346,9 @@ enum eMoveState {
PEDMOVE_NONE,
PEDMOVE_STILL,
PEDMOVE_WALK,
PEDMOVE_UNK,
PEDMOVE_RUN,
PEDMOVE_SPRINT,
};
@ -521,13 +524,20 @@ public:
int32 m_nPrevMoveState;
eWaitState m_nWaitState;
uint32 m_nWaitTimer;
void *m_pPathNodesStates[8]; // unused, probably leftover from VC
CVector2D m_stPathNodeStates[10];
uint16 m_nPathNodes;
int16 m_nCurPathNode;
int8 m_nPathDir;
CPathNode *m_pLastPathNode;
CPathNode *m_pNextPathNode;
CPathNode* m_pathNodesToGo[8];
int16 m_nNumPathNodes;
int16 m_nCurPathNodeId;
CEntity* m_followPathWalkAroundEnt;
CEntity* m_followPathTargetEnt;
uint32 m_pathNodeTimer;
CPathNode m_pathNodeObjPool[8];
CPathNode* m_pCurPathNode;
char m_nPathDir;
CPathNode* m_pLastPathNode;
CPathNode* m_pNextPathNode;
CVector m_followPathDestPos;
float m_followPathAbortDist;
eMoveState m_followPathMoveState;
float m_fHealth;
float m_fArmour;
uint32 m_nExtendedRangeTimer;
@ -584,6 +594,7 @@ public:
CEntity *m_pPointGunAt;
CVector m_vecHitLastPos;
uint32 m_lastFightMove;
uint32 m_lastHitState; // TODO(Miami): What's this?
uint8 m_fightButtonPressure;
FightState m_fightState;
bool m_takeAStepAfterAttack;
@ -746,7 +757,8 @@ public:
void SetAttack(CEntity*);
void StartFightAttack(uint8);
void SetWaitState(eWaitState, void*);
bool FightStrike(CVector&);
bool FightStrike(CVector&, bool);
void FightHitPed(CPed*, CVector&, CVector&, int16);
int GetLocalDirection(const CVector2D &);
void StartFightDefend(uint8, uint8, uint8);
void PlayHitSound(CPed*);
@ -756,6 +768,7 @@ public:
void RemoveInCarAnims(void);
void CollideWithPed(CPed*);
void SetDirectionToWalkAroundObject(CEntity*);
bool SetDirectionToWalkAroundVehicle(CVehicle*);
void RemoveWeaponAnims(int, float);
void CreateDeadPedMoney(void);
void CreateDeadPedWeaponPickups(void);
@ -778,7 +791,7 @@ public:
bool FindBestCoordsFromNodes(CVector, CVector*);
void Wait(void);
void ProcessObjective(void);
bool SeekFollowingPath(CVector*);
CVector *SeekFollowingPath(void);
void Flee(void);
void FollowPath(void);
CVector GetFormationPosition(void);
@ -1009,6 +1022,13 @@ public:
else
return (AnimationId)0;
}
static AnimationId GetFightIdleWithMeleeAnim(CWeaponInfo* weapon) {
if (!!weapon->m_bFightMode)
return ANIM_MELEE_IDLE_FIGHTMODE;
else
return (AnimationId)0;
}
// --
// My additions, because there were many, many instances of that.

View File

@ -4,47 +4,65 @@
#include "General.h"
#include "Ped.h"
// --MIAMI: Done
// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL)
PedAudioData CommentWaitTime[39] = {
{500, 800, 500, 2},
{500, 800, 500, 2},
{500, 800, 500, 2},
{500, 800, 500, 2},
{100, 2, 100, 2},
{700, 500, 1000, 500},
{700, 500, 1000, 500},
{5000, 2000, 15000, 3000},
{5000, 2000, 15000, 3000},
{5000, 2000, 15000, 3000},
{6000, 6000, 6000, 6000},
{1000, 1000, 2000, 2000},
{1000, 500, 2000, 1500},
{1000, 500, 2000, 1500},
{800, 200, 1000, 500},
{800, 200, 1000, 500},
{800, 400, 2000, 1000},
{800, 400, 2000, 1000},
{400, 300, 2000, 1000},
{2000, 1000, 2500, 1500},
{200, 200, 200, 200},
{6000, 3000, 5000, 6000},
{6000, 3000, 9000, 5000},
{6000, 3000, 9000, 5000},
{6000, 3000, 9000, 5000},
{400, 300, 4000, 1000},
{400, 300, 4000, 1000},
{400, 300, 4000, 1000},
{1000, 500, 3000, 1000},
{1000, 500, 1000, 1000},
{3000, 2000, 3000, 2000},
{1000, 500, 3000, 6000},
{1000, 500, 2000, 4000},
{1000, 500, 2000, 5000},
{1000, 500, 3000, 2000},
{1600, 1000, 2000, 2000},
{3000, 2000, 5000, 3000},
{1000, 1000, 1000, 1000},
{1000, 1000, 5000, 5000},
PedAudioData CommentWaitTime[56] = {
{ 500, 800, 500, 2 },
{ 500, 800, 500, 2 },
{ 500, 800, 500, 2 },
{ 500, 800, 500, 2 },
{ 100, 2, 100, 2 },
{ 500, 500, 2000, 1000 },
{ 2000, 50, 2050, 1000 },
{ 5000, 2000, 7000, 3000 },
{ 5000, 2000, 7000, 3000 },
{ 300, 200, 500, 200 },
{ 3000, 1000, 4000, 1000 },
{ 6000, 6000, 6000, 6000 },
{ 4000, 1000, 5000, 1000 },
{ 3000, 1000, 4000, 1000 },
{ 1000, 1000, 2000, 2000 },
{ 1000, 500, 2000, 1500 },
{ 1700, 1000, 3000, 1000 },
{ 800, 200, 1000, 500 },
{ 800, 200, 1000, 500 },
{ 800, 400, 2000, 1000 },
{ 800, 400, 2000, 1000 },
{ 2000, 2000, 4000, 4000 },
{ 2000, 2000, 4000, 1000 },
{ 4000, 1000, 5000, 1000 },
{ 800, 400, 1200, 500 },
{ 5000, 1000, 6000, 2000 },
{ 5000, 1000, 6000, 2000 },
{ 5000, 1000, 6000, 2000 },
{ 5000, 1000, 6000, 2000 },
{ 5000, 1000, 6000, 2000 },
{ 5000, 1000, 6000, 2000 },
{ 5000, 1000, 6000, 2000 },
{ 4000, 2000, 7000, 2000 },
{ 1000, 300, 2000, 1000 },
{ 1500, 1000, 2500, 1000 },
{ 200, 200, 200, 200 },
{ 2000, 1000, 4000, 1000 },
{ 2000, 1000, 4000, 1000 },
{ 1000, 500, 3000, 1000 },
{ 1000, 500, 1000, 1000 },
{ 3000, 2000, 5000, 1000 },
{ 3000, 2000, 5000, 1000 },
{ 3000, 2000, 3000, 2000 },
{ 2000, 1000, 3000, 1000 },
{ 2500, 1000, 5000, 5000 },
{ 2000, 1000, 3000, 2000 },
{ 4000, 1000, 5000, 1000 },
{ 1000, 500, 2000, 4000 },
{ 1000, 500, 2000, 5000 },
{ 2000, 500, 2500, 500 },
{ 1000, 500, 3000, 2000 },
{ 1600, 1000, 2000, 2000 },
{ 2000, 1000, 4000, 2000 },
{ 1500, 1000, 2500, 1000 },
{ 1000, 1000, 5000, 5000 },
{ 0, 0, 0, 0 }
};
// --MIAMI: Done
@ -54,7 +72,7 @@ CPed::ServiceTalkingWhenDead(void)
return m_queuedSound == SOUND_PED_DEATH;
}
// --MIAMI: Done except ifdef
// --MIAMI: Done
void
CPed::ServiceTalking(void)
{
@ -84,7 +102,7 @@ CPed::ServiceTalking(void)
}
}
// --MIAMI: Done except ifdef
// --MIAMI: Done
void
CPed::Say(uint16 audio)
{

View File

@ -52,6 +52,7 @@ public:
bool PointGunInDirectionUsingArm(float targetYaw, float targetPitch);
bool PointGunAtPosition(CVector const& position);
void GetComponentPosition(RwV3d &pos, uint32 node);
void GetComponentPosition(CVector &pos, uint32 node) { GetComponentPosition(*(RwV3d*)pos, node); }
void RotateTorso(AnimBlendFrameData* animBlend, LimbOrientation* limb, bool changeRoll);
void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch);
void ExtractYawAndPitchLocalSkinned(AnimBlendFrameData *node, float *yaw, float *pitch);

View File

@ -81,7 +81,7 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
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_pMeleeList[i] = nil;
}
m_nCheckPlayersIndex = 0;
m_nPadUpPressedInMilliseconds = 0;
@ -1711,6 +1711,18 @@ CPlayerPed::PlayIdleAnimations(CPad *padUsed)
}
}
void
CPlayerPed::RemovePedFromMeleeList(CPed *ped)
{
int i = 0;
for (; m_pMeleeList[i] != ped; i++) {
if (i >= ARRAY_SIZE(m_pMeleeList))
return;
}
m_pMeleeList[i] = nil;
ped->m_attackTimer = 0;
}
#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));

View File

@ -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_pCheckPlayers[6]; //checks something with players, could be a leftover from original multiplayer
CPlayerPed* m_pMeleeList[6];
char unused1;
int16 m_nCheckPlayersIndex;
float m_fWalkAngle; //angle between heading and walking direction
@ -84,6 +84,7 @@ public:
void PlayerControlZelda(CPad*);
bool DoesPlayerWantNewWeapon(eWeaponType, bool);
void PlayIdleAnimations(CPad*);
void RemovePedFromMeleeList(CPed*);
static void SetupPlayerPed(int32);
static void DeactivatePlayerPed(int32);