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

View File

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

View File

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