mirror of
https://github.com/halpz/re3.git
synced 2025-06-30 02:16:23 +00:00
fixes for AudioManager::GetPhrase
This commit is contained in:
@ -11,20 +11,95 @@ cAudioManager::PlayerJustLeftCar(void)
|
||||
}
|
||||
|
||||
void
|
||||
cAudioManager::GetPhrase(uint32 *phrase, uint32 *prevPhrase,
|
||||
cAudioManager::GetPhrase(eAudioSamples *phrase, eAudioSamples *prevPhrase,
|
||||
eAudioSamples sample, uint32 maxOffset)
|
||||
{
|
||||
*phrase = (uint32)sample +
|
||||
(uint32)m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] %
|
||||
maxOffset;
|
||||
if(*phrase == *prevPhrase && ++*phrase >= (uint32)sample + maxOffset)
|
||||
*phrase = (uint32)sample;
|
||||
*phrase = eAudioSamples(
|
||||
sample +
|
||||
(uint32)m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] %
|
||||
maxOffset);
|
||||
if(*phrase == *prevPhrase &&
|
||||
++*(uint32 *)phrase >= (uint32)sample + maxOffset)
|
||||
*phrase = sample;
|
||||
*prevPhrase = *phrase;
|
||||
}
|
||||
|
||||
static bool &bUsedPlayerTalkSfx = *(bool *)0x6508f4;
|
||||
static eAudioSamples &lastPlayerTalkSfx = *(eAudioSamples *)0x6508f0;
|
||||
|
||||
uint32
|
||||
cAudioManager::GetPlayerTalkSfx(eSound sound)
|
||||
{
|
||||
eAudioSamples sfx;
|
||||
|
||||
if(!bUsedPlayerTalkSfx) {
|
||||
bUsedPlayerTalkSfx = true;
|
||||
lastPlayerTalkSfx = NO_SAMPLE;
|
||||
}
|
||||
switch(sound) {
|
||||
case SOUND_PED_DAMAGE:
|
||||
cAudioManager::GetPhrase(&sfx, &lastPlayerTalkSfx,
|
||||
AUDIO_SAMPLE_PED_DAMAGE_REACTION_1,
|
||||
11u);
|
||||
break;
|
||||
|
||||
case SOUND_PED_HIT:
|
||||
cAudioManager::GetPhrase(&sfx, &lastPlayerTalkSfx,
|
||||
AUDIO_SAMPLE_PED_HIT_REACTION_1, 10u);
|
||||
break;
|
||||
|
||||
case SOUND_PED_LAND:
|
||||
cAudioManager::GetPhrase(&sfx, &lastPlayerTalkSfx,
|
||||
AUDIO_SAMPLE_PED_FALL_REACTION_1, 6u);
|
||||
break;
|
||||
|
||||
default: sfx = NO_SAMPLE; break;
|
||||
}
|
||||
return sfx;
|
||||
}
|
||||
|
||||
static bool &bUsedGenericMaleTalkSfx = *(bool *)0x650B0C;
|
||||
static eAudioSamples &lastGenericMaleTalkSfx = *(eAudioSamples *)0x650B08;
|
||||
|
||||
uint32
|
||||
cAudioManager::GetGenericMaleTalkSfx(eSound sample)
|
||||
{
|
||||
eAudioSamples sfx;
|
||||
|
||||
if(!bUsedGenericMaleTalkSfx) {
|
||||
bUsedGenericMaleTalkSfx = 1;
|
||||
lastGenericMaleTalkSfx = NO_SAMPLE;
|
||||
}
|
||||
switch(sample) {
|
||||
case SOUND_PED_DEATH:
|
||||
cAudioManager::GetPhrase(&sfx, &lastGenericMaleTalkSfx,
|
||||
AUDIO_SAMPLE_PED_MALE_DEATH_1, 8u);
|
||||
break;
|
||||
case SOUND_PED_BULLET_HIT:
|
||||
case SOUND_PED_DEFEND:
|
||||
cAudioManager::GetPhrase(&sfx, &lastGenericMaleTalkSfx,
|
||||
AUDIO_SAMPLE_INJURED_PED_MALE_OUCH_1,
|
||||
15u);
|
||||
break;
|
||||
case SOUND_PED_BURNING:
|
||||
cAudioManager::GetPhrase(&sfx, &lastGenericMaleTalkSfx,
|
||||
AUDIO_SAMPLE_PED_MALE_BURNING_1, 8u);
|
||||
break;
|
||||
case SOUND_PED_FLEE_SPRINT:
|
||||
cAudioManager::GetPhrase(&sfx, &lastGenericMaleTalkSfx,
|
||||
AUDIO_SAMPLE_PED_MALE_FLEE_SPRINT_1,
|
||||
6u);
|
||||
break;
|
||||
default: return NO_SAMPLE;
|
||||
}
|
||||
return sfx;
|
||||
}
|
||||
|
||||
WRAPPER void cAudioManager::Service() { EAXJMP(0x57A2A0); }
|
||||
|
||||
STARTPATCHES
|
||||
InjectHook(0x56AD20, &cAudioManager::PlayerJustLeftCar, PATCH_JUMP);
|
||||
InjectHook(0x570DB0, &cAudioManager::GetPhrase, PATCH_JUMP);
|
||||
InjectHook(0x56AD20, &cAudioManager::PlayerJustLeftCar, PATCH_JUMP);
|
||||
InjectHook(0x570DB0, &cAudioManager::GetPhrase, PATCH_JUMP);
|
||||
InjectHook(0x570E00, &cAudioManager::GetPlayerTalkSfx, PATCH_JUMP);
|
||||
InjectHook(0x575460, &cAudioManager::GetGenericMaleTalkSfx, PATCH_JUMP);
|
||||
ENDPATCHES
|
||||
|
Reference in New Issue
Block a user