summaryrefslogtreecommitdiffstats
path: root/src/audio/AudioManager.cpp
blob: 5a290d28d0d078fe2fe076924dc372e9cd172bb5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "common.h"
#include "patcher.h"
#include "AudioManager.h"

cAudioManager &AudioManager = *(cAudioManager*)0x880FC0;

void
cAudioManager::PlayerJustLeftCar(void)
{
	// UNUSED: This is a perfectly empty function.
}

void
cAudioManager::GetPhrase(uint32 *phrase, uint32 *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;
	*prevPhrase = *phrase;
}

WRAPPER void cAudioManager::Service() { EAXJMP(0x57A2A0); }

STARTPATCHES
	InjectHook(0x56AD20, &cAudioManager::PlayerJustLeftCar, PATCH_JUMP);
	InjectHook(0x570DB0, &cAudioManager::GetPhrase, PATCH_JUMP);
ENDPATCHES