summaryrefslogtreecommitdiffstats
path: root/src/peds/PedChat.cpp
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-11-13 13:14:22 +0100
committeraap <aap@papnet.eu>2020-11-13 13:14:22 +0100
commit8ab0d25b4a95a652244536667673348fa16eb895 (patch)
tree1f209ed6972ee3600517e4f3dd18b21d1122b354 /src/peds/PedChat.cpp
parentfixed bike collision damage (diff)
downloadre3-8ab0d25b4a95a652244536667673348fa16eb895.tar
re3-8ab0d25b4a95a652244536667673348fa16eb895.tar.gz
re3-8ab0d25b4a95a652244536667673348fa16eb895.tar.bz2
re3-8ab0d25b4a95a652244536667673348fa16eb895.tar.lz
re3-8ab0d25b4a95a652244536667673348fa16eb895.tar.xz
re3-8ab0d25b4a95a652244536667673348fa16eb895.tar.zst
re3-8ab0d25b4a95a652244536667673348fa16eb895.zip
Diffstat (limited to '')
-rw-r--r--src/peds/PedChat.cpp57
1 files changed, 28 insertions, 29 deletions
diff --git a/src/peds/PedChat.cpp b/src/peds/PedChat.cpp
index b7732274..71739902 100644
--- a/src/peds/PedChat.cpp
+++ b/src/peds/PedChat.cpp
@@ -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 (m_queuedSound != SOUND_NO_SOUND) {
- if (m_queuedSound == SOUND_PED_DEATH)
- m_soundStart = CTimer::GetTimeInMilliseconds() - 1;
-
- 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_PED_PLAYER_BEFORESEX && IsPlayer())
- m_soundStart += 2000;
-
- m_lastQueuedSound = m_queuedSound;
- m_queuedSound = SOUND_NO_SOUND;
- }
+ if (bBodyPartJustCameOff && m_bodyPartBleeding == PED_HEAD)
+ return;
+
+ if (!CGame::germanGame && m_pFire)
+ m_queuedSound = SOUND_PED_BURNING;
+
+ if (m_queuedSound != SOUND_NO_SOUND) {
+ if (m_queuedSound == SOUND_PED_DEATH)
+ m_soundStart = CTimer::GetTimeInMilliseconds() - 1;
+
+ 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_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;
}
}
}