Merge pull request #815 from aap/miami

CPed review part 1
This commit is contained in:
aap 2020-11-16 09:45:47 +01:00 committed by GitHub
commit 8a8f2d4e5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 344 additions and 457 deletions

File diff suppressed because it is too large Load Diff

View File

@ -451,9 +451,7 @@ public:
uint32 bVehExitWillBeInstant : 1; uint32 bVehExitWillBeInstant : 1;
uint32 bHasAlreadyBeenRecorded : 1; uint32 bHasAlreadyBeenRecorded : 1;
uint32 bFallenDown : 1; uint32 bFallenDown : 1;
#ifdef PED_SKIN uint32 bDontAcceptIKLookAts : 1;
uint32 bDontAcceptIKLookAts : 1; // TODO: find uses of this
#endif
uint32 bReachedAttractorHeadingTarget : 1; uint32 bReachedAttractorHeadingTarget : 1;
uint32 bTurnedAroundOnAttractor : 1; uint32 bTurnedAroundOnAttractor : 1;
@ -513,10 +511,7 @@ public:
CEntity* m_pEventEntity; CEntity* m_pEventEntity;
float m_fAngleToEvent; float m_fAngleToEvent;
AnimBlendFrameData *m_pFrames[PED_NODE_MAX]; AnimBlendFrameData *m_pFrames[PED_NODE_MAX];
#ifdef PED_SKIN
// stored inside the clump with non-skin ped
RpAtomic *m_pWeaponModel; RpAtomic *m_pWeaponModel;
#endif
AssocGroupId m_animGroup; AssocGroupId m_animGroup;
CAnimBlendAssociation *m_pVehicleAnim; CAnimBlendAssociation *m_pVehicleAnim;
CVector2D m_vecAnimMoveDelta; CVector2D m_vecAnimMoveDelta;
@ -579,8 +574,7 @@ public:
CAccident *m_lastAccident; CAccident *m_lastAccident;
uint32 m_nPedType; uint32 m_nPedType;
CPedStats *m_pedStats; CPedStats *m_pedStats;
float m_fleeFromPosX; CVector2D m_fleeFromPos;
float m_fleeFromPosY;
CEntity *m_fleeFrom; CEntity *m_fleeFrom;
uint32 m_fleeTimer; uint32 m_fleeTimer;
CEntity* m_threatEx; // TODO(Miami): What is this? CEntity* m_threatEx; // TODO(Miami): What is this?

View File

@ -75,28 +75,29 @@ CPed::ServiceTalkingWhenDead(void)
void void
CPed::ServiceTalking(void) CPed::ServiceTalking(void)
{ {
if (!bBodyPartJustCameOff || m_bodyPartBleeding != PED_HEAD) { if (bBodyPartJustCameOff && m_bodyPartBleeding == PED_HEAD)
if (!CGame::germanGame && m_pFire) return;
m_queuedSound = SOUND_PED_BURNING;
if (m_queuedSound != SOUND_NO_SOUND) { if (!CGame::germanGame && m_pFire)
if (m_queuedSound == SOUND_PED_DEATH) m_queuedSound = SOUND_PED_BURNING;
m_soundStart = CTimer::GetTimeInMilliseconds() - 1;
if (CTimer::GetTimeInMilliseconds() > m_soundStart) { if (m_queuedSound != SOUND_NO_SOUND) {
DMAudio.PlayOneShot(m_audioEntityId, m_queuedSound, 1.0f); if (m_queuedSound == SOUND_PED_DEATH)
m_lastSoundStart = CTimer::GetTimeInMilliseconds(); m_soundStart = CTimer::GetTimeInMilliseconds() - 1;
m_soundStart =
CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nFixedDelayTime
+ CTimer::GetTimeInMilliseconds()
+ CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideFixedDelayTime);
if (m_queuedSound == SOUND_PED_PLAYER_BEFORESEX && IsPlayer()) if (CTimer::GetTimeInMilliseconds() > m_soundStart) {
m_soundStart += 2000; DMAudio.PlayOneShot(m_audioEntityId, m_queuedSound, 1.0f);
m_lastSoundStart = CTimer::GetTimeInMilliseconds();
m_soundStart =
CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nFixedDelayTime
+ CTimer::GetTimeInMilliseconds()
+ CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideFixedDelayTime);
m_lastQueuedSound = m_queuedSound; if (m_queuedSound == SOUND_PED_PLAYER_BEFORESEX && IsPlayer())
m_queuedSound = SOUND_NO_SOUND; m_soundStart += 2000;
}
m_lastQueuedSound = m_queuedSound;
m_queuedSound = SOUND_NO_SOUND;
} }
} }
} }
@ -104,8 +105,6 @@ CPed::ServiceTalking(void)
void void
CPed::Say(uint16 audio) CPed::Say(uint16 audio)
{ {
uint16 audioToPlay = audio;
if (3.0f + TheCamera.GetPosition().z < GetPosition().z) if (3.0f + TheCamera.GetPosition().z < GetPosition().z)
return; return;
@ -138,19 +137,19 @@ CPed::Say(uint16 audio)
} }
} }
if (audioToPlay < m_queuedSound) { if (audio < m_queuedSound) {
if (audioToPlay != m_lastQueuedSound || audioToPlay == SOUND_PED_DEATH if (audio != m_lastQueuedSound || audio == SOUND_PED_DEATH
// See VC Ped Speech patch // See VC Ped Speech patch
#ifdef FIX_BUGS #ifdef FIX_BUGS
|| CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime || CommentWaitTime[audio - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime
+ (uint32)CGeneral::GetRandomNumberInRange(0, CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nMaxRandomDelayTime) + (uint32)CGeneral::GetRandomNumberInRange(0, CommentWaitTime[audio - SOUND_PED_DEATH].m_nMaxRandomDelayTime)
#else #else
|| CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime || CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime
+ (uint32)CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nMaxRandomDelayTime) + (uint32)CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nMaxRandomDelayTime)
#endif #endif
+ m_lastSoundStart <= CTimer::GetTimeInMilliseconds()) { + m_lastSoundStart <= CTimer::GetTimeInMilliseconds()) {
m_queuedSound = audioToPlay; m_queuedSound = audio;
} }
} }
} }

View File

@ -268,8 +268,7 @@ CPlayerPed::SetInitialState(void)
CTimer::SetTimeScale(1.0f); CTimer::SetTimeScale(1.0f);
m_pSeekTarget = nil; m_pSeekTarget = nil;
m_vecSeekPos = CVector(0.0f, 0.0f, 0.0f); m_vecSeekPos = CVector(0.0f, 0.0f, 0.0f);
m_fleeFromPosX = 0.0f; m_fleeFromPos = CVector2D(0.0f, 0.0f);
m_fleeFromPosY = 0.0f;
m_fleeFrom = nil; m_fleeFrom = nil;
m_fleeTimer = 0; m_fleeTimer = 0;
m_objective = OBJECTIVE_NONE; m_objective = OBJECTIVE_NONE;