Implement some GetXTalkSfx methods

This commit is contained in:
Filip Gawin 2019-06-27 18:45:16 +02:00
parent 6c0f81f12a
commit 72ab729623
5 changed files with 610 additions and 221 deletions

View File

@ -1,8 +1,12 @@
#include "AudioManager.h"
#include "DMAudio.h"
#include "Ped.h"
#include "PlayerPed.h"
#include "World.h"
#include "common.h"
#include "patcher.h"
#include "AudioManager.h"
cAudioManager &AudioManager = *(cAudioManager*)0x880FC0;
cAudioManager &AudioManager = *(cAudioManager *)0x880FC0;
void
cAudioManager::PlayerJustLeftCar(void)
@ -11,26 +15,25 @@ cAudioManager::PlayerJustLeftCar(void)
}
void
cAudioManager::GetPhrase(eAudioSamples *phrase, eAudioSamples *prevPhrase,
eAudioSamples sample, uint32 maxOffset)
cAudioManager::GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample,
uint32 maxOffset)
{
*phrase = eAudioSamples(
sample +
(uint32)m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] %
maxOffset);
if(*phrase == *prevPhrase &&
++*(uint32 *)phrase >= (uint32)sample + maxOffset)
*phrase = sample + m_anRandomTable[m_sQueueSample.m_nEntityIndex & 3] %
maxOffset;
// check if the same sfx like last time, if yes, then try use next one,
// if exceeded range, then choose first available sample
if(*phrase == *prevPhrase && ++*phrase >= sample + maxOffset)
*phrase = sample;
*prevPhrase = *phrase;
}
static bool &bUsedPlayerTalkSfx = *(bool *)0x6508f4;
static eAudioSamples &lastPlayerTalkSfx = *(eAudioSamples *)0x6508f0;
uint32
cAudioManager::GetPlayerTalkSfx(eSound sound)
cAudioManager::GetPlayerTalkSfx(int16 sound)
{
eAudioSamples sfx;
uint32 sfx;
static bool &bUsedPlayerTalkSfx = *(bool *)0x6508f4;
static uint32 &lastPlayerTalkSfx = *(uint32 *)0x6508f0;
if(!bUsedPlayerTalkSfx) {
bUsedPlayerTalkSfx = true;
@ -38,19 +41,18 @@ cAudioManager::GetPlayerTalkSfx(eSound sound)
}
switch(sound) {
case SOUND_PED_DAMAGE:
cAudioManager::GetPhrase(&sfx, &lastPlayerTalkSfx,
AUDIO_SAMPLE_PED_DAMAGE_REACTION_1,
11u);
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);
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);
GetPhrase(&sfx, &lastPlayerTalkSfx,
AUDIO_SAMPLE_PED_FALL_REACTION_1, 6u);
break;
default: sfx = NO_SAMPLE; break;
@ -58,13 +60,537 @@ cAudioManager::GetPlayerTalkSfx(eSound sound)
return sfx;
}
static bool &bUsedGenericMaleTalkSfx = *(bool *)0x650B0C;
static eAudioSamples &lastGenericMaleTalkSfx = *(eAudioSamples *)0x650B08;
uint32
cAudioManager::GetCopTalkSfx(int16 sample)
{
uint32 sfx;
PedState pedState;
static bool &bUsedCopTalkSfx = *(bool *)0x6508FC;
static uint32 &lastCopTalkSfx = *(uint32 *)0x6508F8;
if(!bUsedCopTalkSfx) {
bUsedCopTalkSfx = 1;
lastCopTalkSfx = NO_SAMPLE;
}
if(sample == SOUND_PED_ARREST_COP) {
GetPhrase(&sfx, &lastCopTalkSfx,
AUDIO_SAMPLE_POLICE_COP_1_ARREST_1, 6u);
} else {
if(sample != SOUND_PED_PURSUIT_COP) {
return cAudioManager::GetGenericMaleTalkSfx(sample);
}
pedState = FindPlayerPed()->m_nPedState;
if(pedState == PED_ARRESTED || pedState == PED_DEAD ||
pedState == PED_DIE)
return NO_SAMPLE;
GetPhrase(&sfx, &lastCopTalkSfx,
AUDIO_SAMPLE_POLICE_COP_1_PURSUIT_1, 7u);
}
return 13 * (m_sQueueSample.m_nEntityIndex % 5) + sfx;
}
uint32
cAudioManager::GetGenericMaleTalkSfx(eSound sample)
cAudioManager::GetSwatTalkSfx(int16 sample)
{
eAudioSamples sfx;
uint32 sfx;
PedState pedState;
static bool &bUsedSwatTalkSfx = *(bool *)0x650904;
static uint32 &lastSwatTalkSfx = *(uint32 *)0x650900;
if(!bUsedSwatTalkSfx) {
bUsedSwatTalkSfx = 1;
lastSwatTalkSfx = NO_SAMPLE;
}
if(sample == SOUND_PED_ARREST_SWAT) {
GetPhrase(&sfx, &lastSwatTalkSfx,
AUDIO_SAMPLE_POLICE_SWAT_1_PURSUIT_ARREST_1, 6u);
} else {
if(sample != SOUND_PED_PURSUIT_SWAT) {
return cAudioManager::GetGenericMaleTalkSfx(sample);
}
pedState = FindPlayerPed()->m_nPedState;
if(pedState == PED_ARRESTED || pedState == PED_DEAD ||
pedState == PED_DIE)
return NO_SAMPLE;
GetPhrase(&sfx, &lastSwatTalkSfx,
AUDIO_SAMPLE_POLICE_SWAT_1_PURSUIT_ARREST_1, 6u);
}
return 6 * (m_sQueueSample.m_nEntityIndex % 3) + sfx;
}
uint32
cAudioManager::GetFBITalkSfx(int16 sample)
{
uint32 sfx;
PedState pedState;
static bool &bUsedFBITalkSfx = *(bool *)0x65090C;
static uint32 &lastFBITalkSfx = *(uint32 *)0x650908;
if(!bUsedFBITalkSfx) {
bUsedFBITalkSfx = 1;
lastFBITalkSfx = NO_SAMPLE;
}
if(sample == SOUND_PED_ARREST_FBI) {
GetPhrase(&sfx, &lastFBITalkSfx,
AUDIO_SAMPLE_POLICE_FBI_1_PURSUIT_ARREST_1, 6u);
} else {
if(sample != SOUND_PED_PURSUIT_FBI) {
return cAudioManager::GetGenericMaleTalkSfx(sample);
}
pedState = FindPlayerPed()->m_nPedState;
if(pedState == PED_ARRESTED || pedState == PED_DEAD ||
pedState == PED_DIE)
return NO_SAMPLE;
GetPhrase(&sfx, &lastFBITalkSfx,
AUDIO_SAMPLE_POLICE_FBI_1_PURSUIT_ARREST_1, 6u);
}
return 6 * (m_sQueueSample.m_nEntityIndex % 3) + sfx;
}
uint32
cAudioManager::GetArmyTalkSfx(int16 sample)
{
uint32 sfx;
PedState pedState;
static bool &bUsedArmyTalkSfx = *(bool *)0x650914;
static uint32 &lastArmyTalkSfx = *(uint32 *)0x650910;
if(!bUsedArmyTalkSfx) {
bUsedArmyTalkSfx = 1;
lastArmyTalkSfx = NO_SAMPLE;
}
if(sample != SOUND_PED_PURSUIT_ARMY) {
return cAudioManager::GetGenericMaleTalkSfx(sample);
}
pedState = FindPlayerPed()->m_nPedState;
if(pedState == PED_ARRESTED || pedState == PED_DEAD ||
pedState == PED_DIE)
return NO_SAMPLE;
GetPhrase(&sfx, &lastArmyTalkSfx, AUDIO_SAMPLE_POLICE_ARMY_1_PURSUIT_1,
15u);
return 15 * (m_sQueueSample.m_nEntityIndex % 1) + sfx;
}
uint32
cAudioManager::GetMedicTalkSfx(int16 sample)
{
uint32 sfx;
static bool &bUsedMedicTalkSfx = *(bool *)0x65091C;
static uint32 &lastMedicTalkSfx = *(uint32 *)0x650918;
if(!bUsedMedicTalkSfx) {
bUsedMedicTalkSfx = true;
lastMedicTalkSfx = NO_SAMPLE;
}
switch(sample) {
case SOUND_PED_HANDS_COWER:
GetPhrase(&sfx, &lastMedicTalkSfx,
AUDIO_SAMPLE_PED_MEDIC_1_HANDS_COWER_1, 5u);
break;
case SOUND_PED_CAR_JACKED:
GetPhrase(&sfx, &lastMedicTalkSfx,
AUDIO_SAMPLE_PED_MEDIC_1_CAR_JACKED_1, 5u);
break;
case SOUND_PED_HEALING:
GetPhrase(&sfx, &lastMedicTalkSfx,
AUDIO_SAMPLE_PED_MEDIC_1_HEALING_1, 12u);
break;
case SOUND_PED_LEAVE_VEHICLE:
GetPhrase(&sfx, &lastMedicTalkSfx,
AUDIO_SAMPLE_PED_MEDIC_1_LEAVE_VEHICLE_1, 9u);
break;
case SOUND_PED_FLEE_RUN:
GetPhrase(&sfx, &lastMedicTalkSfx,
AUDIO_SAMPLE_PED_MEDIC_1_FLEE_RUN_1, 6u);
break;
default: return cAudioManager::GetGenericMaleTalkSfx(sample);
}
return 37 * (m_sQueueSample.m_nEntityIndex & 1) + sfx;
}
uint32
cAudioManager::GetFiremanTalkSfx(int16 sample)
{
return cAudioManager::GetGenericMaleTalkSfx(sample);
}
uint32
cAudioManager::GetNormalMaleTalkSfx(int16 sample)
{
uint32 sfx;
static bool &bUsedNormalMaleTalkSfx = *(bool *)0x650B04;
static uint32 &lastNormalMaleTalkSfx = *(uint32 *)0x650B00;
if(!bUsedNormalMaleTalkSfx) {
bUsedNormalMaleTalkSfx = 1;
lastNormalMaleTalkSfx = NO_SAMPLE;
}
switch(sample) {
case SOUND_PED_HANDS_COWER:
GetPhrase(&sfx, &lastNormalMaleTalkSfx,
AUDIO_SAMPLE_PED_NORMAL_MALE_HANDS_COWER_1, 7u);
break;
case SOUND_PED_CAR_JACKED:
GetPhrase(&sfx, &lastNormalMaleTalkSfx,
AUDIO_SAMPLE_PED_NORMAL_MALE_CAR_JACKED_1, 7u);
break;
case SOUND_PED_EVADE:
GetPhrase(&sfx, &lastNormalMaleTalkSfx,
AUDIO_SAMPLE_PED_NORMAL_MALE_EVADE_1, 9u);
break;
case SOUND_PED_FLEE_RUN:
GetPhrase(&sfx, &lastNormalMaleTalkSfx,
AUDIO_SAMPLE_PED_NORMAL_MALE_FLEE_RUN_1, 5u);
break;
case SOUND_PED_CAR_COLLISION:
GetPhrase(&sfx, &lastNormalMaleTalkSfx,
AUDIO_SAMPLE_PED_NORMAL_MALE_CAR_COLLISION_1, 12u);
break;
case SOUND_PED_CHAT_SEXY:
GetPhrase(&sfx, &lastNormalMaleTalkSfx,
AUDIO_SAMPLE_PED_NORMAL_MALE_CHAT_SEXY_1, 8u);
break;
case SOUND_PED_CHAT_EVENT:
GetPhrase(&sfx, &lastNormalMaleTalkSfx,
AUDIO_SAMPLE_PED_NORMAL_MALE_CHAT_EVENT_1, 0xAu);
break;
case SOUND_PED_CHAT:
GetPhrase(&sfx, &lastNormalMaleTalkSfx,
AUDIO_SAMPLE_PED_NORMAL_MALE_CHAT_1, 25u);
break;
default: return cAudioManager::GetGenericMaleTalkSfx(sample);
}
return sfx;
}
uint32
cAudioManager::GetTaxiDriverTalkSfx(int16 sample)
{
uint32 sfx;
static bool &bUsedTaxiDriverTalkSfx = *(bool *)0x650AF4;
static uint32 &lastTaxiDriverTalkSfx = *(uint32 *)0x650AF0;
if(!bUsedTaxiDriverTalkSfx) {
bUsedTaxiDriverTalkSfx = 1;
lastTaxiDriverTalkSfx = NO_SAMPLE;
}
if(sample == SOUND_PED_CAR_JACKED) {
GetPhrase(&sfx, &lastTaxiDriverTalkSfx,
AUDIO_SAMPLE_PED_TAXI_DRIVER_1_CAR_JACKED_1, 7u);
} else {
if(sample != SOUND_PED_CAR_COLLISION)
return cAudioManager::GetGenericMaleTalkSfx(sample);
GetPhrase(&sfx, &lastTaxiDriverTalkSfx,
AUDIO_SAMPLE_PED_TAXI_DRIVER_1_CAR_COLLISION_1, 6u);
}
return 13 * (m_sQueueSample.m_nEntityIndex & 1) + sfx;
}
uint32
cAudioManager::GetPimpTalkSfx(int16 sample)
{
uint32 sfx;
static bool &bUsedPimpTalkSfx = *(bool *)0x650AFC;
static uint32 &lastPimpTalkSfx = *(uint32 *)0x650AF8;
if(!bUsedPimpTalkSfx) {
bUsedPimpTalkSfx = 1;
lastPimpTalkSfx = NO_SAMPLE;
}
switch(sample) {
case SOUND_PED_HANDS_UP:
GetPhrase(&sfx, &lastPimpTalkSfx,
AUDIO_SAMPLE_PED_PIMP_HANDS_UP_1, 7u);
break;
case SOUND_PED_CAR_JACKED:
GetPhrase(&sfx, &lastPimpTalkSfx,
AUDIO_SAMPLE_PED_PIMP_CAR_JACKED_1, 4u);
break;
case SOUND_PED_DEFEND:
GetPhrase(&sfx, &lastPimpTalkSfx,
AUDIO_SAMPLE_PED_PIMP_DEFEND_1, 9u);
break;
case SOUND_PED_EVADE:
GetPhrase(&sfx, &lastPimpTalkSfx, AUDIO_SAMPLE_PED_PIMP_EVADE_1,
6u);
break;
case SOUND_PED_CAR_COLLISION:
GetPhrase(&sfx, &lastPimpTalkSfx,
AUDIO_SAMPLE_PED_PIMP_CAR_COLLISION_1, 5u);
break;
case SOUND_PED_CHAT_EVENT:
GetPhrase(&sfx, &lastPimpTalkSfx,
AUDIO_SAMPLE_PED_PIMP_CHAT_EVENT_1, 2u);
break;
case SOUND_PED_CHAT:
GetPhrase(&sfx, &lastPimpTalkSfx, AUDIO_SAMPLE_PED_PIMP_CHAT_1,
17u);
break;
default: return cAudioManager::GetGenericMaleTalkSfx(sample);
}
return sfx;
}
uint32
cAudioManager::GetMafiaTalkSfx(int16 sample)
{
uint32 sfx;
static bool &bUsedMafiaTalkSfx = *(bool *)0x650934;
static uint32 &lastMafiaTalkSfx = *(uint32 *)0x650930;
if(!bUsedMafiaTalkSfx) {
bUsedMafiaTalkSfx = 1;
lastMafiaTalkSfx = NO_SAMPLE;
}
switch(sample) {
case SOUND_PED_CAR_JACKING:
GetPhrase(&sfx, &lastMafiaTalkSfx,
AUDIO_SAMPLE_PED_MAFIA_1_CAR_JACKING_1, 2u);
break;
case SOUND_PED_CAR_JACKED:
GetPhrase(&sfx, &lastMafiaTalkSfx,
AUDIO_SAMPLE_PED_MAFIA_1_CAR_JACKED_1, 2u);
break;
case SOUND_PED_ATTACK:
GetPhrase(&sfx, &lastMafiaTalkSfx,
AUDIO_SAMPLE_PED_MAFIA_1_ATTACK_1, 5u);
break;
case SOUND_PED_EVADE:
GetPhrase(&sfx, &lastMafiaTalkSfx,
AUDIO_SAMPLE_PED_MAFIA_1_EVADE_1, 5u);
break;
case SOUND_PED_CAR_COLLISION:
GetPhrase(&sfx, &lastMafiaTalkSfx,
AUDIO_SAMPLE_PED_MAFIA_1_CAR_COLLISION_1, 6u);
break;
case SOUND_PED_CHAT_SEXY:
GetPhrase(&sfx, &lastMafiaTalkSfx,
AUDIO_SAMPLE_PED_MAFIA_1_CHAT_SEXY_1, 3u);
break;
case SOUND_PED_CHAT:
GetPhrase(&sfx, &lastMafiaTalkSfx,
AUDIO_SAMPLE_PED_MAFIA_1_CHAT_1, 7u);
break;
default: return cAudioManager::GetGenericMaleTalkSfx(sample);
}
return 30 * (m_sQueueSample.m_nEntityIndex % 3) + sfx;
}
uint32
cAudioManager::GetTriadTalkSfx(int16 sample)
{
uint32 sfx;
static bool &bUsedTriadTalkSfx = *(bool *)0x65093C;
static uint32 &lastTriadTalkSfx = *(uint32 *)0x650938;
if(!bUsedTriadTalkSfx) {
bUsedTriadTalkSfx = 1;
lastTriadTalkSfx = NO_SAMPLE;
}
switch(sample) {
case SOUND_PED_HANDS_UP:
GetPhrase(&sfx, &lastTriadTalkSfx,
AUDIO_SAMPLE_PED_TRIAD_1_HANDS_UP_1, 3u);
break;
case SOUND_PED_CAR_JACKING:
GetPhrase(&sfx, &lastTriadTalkSfx,
AUDIO_SAMPLE_PED_TRIAD_1_CAR_JACKING_1, 2u);
break;
case SOUND_PED_CAR_JACKED:
GetPhrase(&sfx, &lastTriadTalkSfx,
AUDIO_SAMPLE_PED_TRIAD_1_CAR_JACKED_1, 2u);
break;
case SOUND_PED_ATTACK:
GetPhrase(&sfx, &lastTriadTalkSfx,
AUDIO_SAMPLE_PED_TRIAD_1_ATTACK_1, 5u);
break;
case SOUND_PED_EVADE:
GetPhrase(&sfx, &lastTriadTalkSfx,
AUDIO_SAMPLE_PED_TRIAD_1_EVADE_1, 4u);
break;
case SOUND_PED_CAR_COLLISION:
GetPhrase(&sfx, &lastTriadTalkSfx,
AUDIO_SAMPLE_PED_TRIAD_1_CAR_COLLISION_1, 7u);
break;
case SOUND_PED_CHAT_SEXY:
GetPhrase(&sfx, &lastTriadTalkSfx,
AUDIO_SAMPLE_PED_TRIAD_1_CHAT_SEXY_1, 3u);
break;
case SOUND_PED_CHAT:
GetPhrase(&sfx, &lastTriadTalkSfx,
AUDIO_SAMPLE_PED_TRIAD_1_CHAT_1, 8u);
break;
default: return cAudioManager::GetGenericMaleTalkSfx(sample);
}
return sfx;
}
uint32
cAudioManager::GetDiabloTalkSfx(int16 sample)
{
uint32 sfx;
static bool &bUsedDiabloTalkSfx = *(bool *)0x650944;
static uint32 &lastDiabloTalkSfx = *(uint32 *)0x650940;
if(!bUsedDiabloTalkSfx) {
bUsedDiabloTalkSfx = 1;
lastDiabloTalkSfx = NO_SAMPLE;
}
switch(sample) {
case SOUND_PED_HANDS_UP:
GetPhrase(&sfx, &lastDiabloTalkSfx,
AUDIO_SAMPLE_PED_DIABLO_1_HANDS_UP_1, 4u);
break;
case SOUND_PED_HANDS_COWER:
sample = SOUND_PED_FLEE_SPRINT;
return cAudioManager::GetGenericMaleTalkSfx(sample);
break;
case SOUND_PED_CAR_JACKING:
GetPhrase(&sfx, &lastDiabloTalkSfx,
AUDIO_SAMPLE_PED_DIABLO_1_CAR_JACKING_1, 2u);
break;
case SOUND_PED_CAR_JACKED:
GetPhrase(&sfx, &lastDiabloTalkSfx,
AUDIO_SAMPLE_PED_DIABLO_1_CAR_JACKED_1, 2u);
break;
case SOUND_PED_ATTACK:
GetPhrase(&sfx, &lastDiabloTalkSfx,
AUDIO_SAMPLE_PED_DIABLO_1_ATTACK_1, 4u);
break;
case SOUND_PED_EVADE:
GetPhrase(&sfx, &lastDiabloTalkSfx,
AUDIO_SAMPLE_PED_DIABLO_1_EVADE_1, 4u);
break;
case SOUND_PED_CAR_COLLISION:
GetPhrase(&sfx, &lastDiabloTalkSfx,
AUDIO_SAMPLE_PED_DIABLO_1_CAR_COLLISION_1, 5u);
break;
case SOUND_PED_CHAT_SEXY:
GetPhrase(&sfx, &lastDiabloTalkSfx,
AUDIO_SAMPLE_PED_DIABLO_1_CHAT_SEXY_1, 4u);
break;
case SOUND_PED_CHAT:
GetPhrase(&sfx, &lastDiabloTalkSfx,
AUDIO_SAMPLE_PED_DIABLO_1_CHAT_1, 5u);
break;
default: return cAudioManager::GetGenericMaleTalkSfx(sample);
}
return 30 * (m_sQueueSample.m_nEntityIndex & 1) + sfx;
}
uint32
cAudioManager::GetYakuzaTalkSfx(int16 sample)
{
uint32 sfx;
static bool &bUsedYakuzaTalkSfx = *(bool *)0x65094C;
static uint32 &lastYakuzaTalkSfx = *(uint32 *)0x650948;
if(!bUsedYakuzaTalkSfx) {
bUsedYakuzaTalkSfx = 1;
lastYakuzaTalkSfx = NO_SAMPLE;
}
switch(sample) {
case SOUND_PED_CAR_JACKING:
GetPhrase(&sfx, &lastYakuzaTalkSfx,
AUDIO_SAMPLE_PED_YAKUZA_1_CAR_JACKING_1, 2u);
break;
case SOUND_PED_CAR_JACKED:
GetPhrase(&sfx, &lastYakuzaTalkSfx,
AUDIO_SAMPLE_PED_YAKUZA_1_CAR_JACKED_1, 2u);
break;
case SOUND_PED_ATTACK:
GetPhrase(&sfx, &lastYakuzaTalkSfx,
AUDIO_SAMPLE_PED_YAKUZA_1_ATTACK_1, 5u);
break;
case SOUND_PED_EVADE:
GetPhrase(&sfx, &lastYakuzaTalkSfx,
AUDIO_SAMPLE_PED_YAKUZA_1_EVADE_1, 4u);
break;
case SOUND_PED_CAR_COLLISION:
GetPhrase(&sfx, &lastYakuzaTalkSfx,
AUDIO_SAMPLE_PED_YAKUZA_1_CAR_COLLISION_1, 6u);
break;
case SOUND_PED_CHAT:
GetPhrase(&sfx, &lastYakuzaTalkSfx,
AUDIO_SAMPLE_PED_YAKUZA_1_CHAT_1, 5u);
break;
default: return cAudioManager::GetGenericMaleTalkSfx(sample);
}
return 24 * (m_sQueueSample.m_nEntityIndex & 1) + sfx;
}
uint32
cAudioManager::GetYardieTalkSfx(int16 sample)
{
uint32 sfx;
static bool &bUsedYardieTalkSfx = *(bool *)0x650954;
static uint32 &lastYardieTalkSfx = *(uint32 *)0x650950;
if(!bUsedYardieTalkSfx) {
bUsedYardieTalkSfx = 1;
lastYardieTalkSfx = NO_SAMPLE;
}
switch(sample) {
case SOUND_PED_HANDS_UP:
sfx = AUDIO_SAMPLE_PED_YARDIE_1_HANDS_UP_1;
break;
case SOUND_PED_CAR_JACKING:
GetPhrase(&sfx, &lastYardieTalkSfx,
AUDIO_SAMPLE_PED_YARDIE_1_CAR_JACKING_1, 2u);
break;
case SOUND_PED_CAR_JACKED:
sfx = AUDIO_SAMPLE_PED_YARDIE_1_CAR_JACKED_1;
break;
case SOUND_PED_ATTACK:
GetPhrase(&sfx, &lastYardieTalkSfx,
AUDIO_SAMPLE_PED_YARDIE_1_ATTACK_1, 6u);
break;
case SOUND_PED_EVADE:
GetPhrase(&sfx, &lastYardieTalkSfx,
AUDIO_SAMPLE_PED_YARDIE_1_EVADE_1, 5u);
break;
case SOUND_PED_CAR_COLLISION:
GetPhrase(&sfx, &lastYardieTalkSfx,
AUDIO_SAMPLE_PED_YARDIE_1_CAR_COLLISION_1, 6u);
break;
case SOUND_PED_CHAT_SEXY:
GetPhrase(&sfx, &lastYardieTalkSfx,
AUDIO_SAMPLE_PED_YARDIE_1_CHAT_SEXY_1, 2u);
break;
case SOUND_PED_CHAT:
GetPhrase(&sfx, &lastYardieTalkSfx,
AUDIO_SAMPLE_PED_YARDIE_1_CHAT_1, 8u);
break;
default: return cAudioManager::GetGenericMaleTalkSfx(sample);
}
return 31 * (m_sQueueSample.m_nEntityIndex & 1) + sfx;
}
uint32
cAudioManager::GetGenericMaleTalkSfx(int16 sample)
{
uint32 sfx;
static bool &bUsedGenericMaleTalkSfx = *(bool *)0x650B0C;
static uint32 &lastGenericMaleTalkSfx = *(uint32 *)0x650B08;
if(!bUsedGenericMaleTalkSfx) {
bUsedGenericMaleTalkSfx = 1;
@ -72,34 +598,50 @@ cAudioManager::GetGenericMaleTalkSfx(eSound sample)
}
switch(sample) {
case SOUND_PED_DEATH:
cAudioManager::GetPhrase(&sfx, &lastGenericMaleTalkSfx,
AUDIO_SAMPLE_PED_MALE_DEATH_1, 8u);
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);
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);
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);
GetPhrase(&sfx, &lastGenericMaleTalkSfx,
AUDIO_SAMPLE_PED_MALE_FLEE_SPRINT_1, 6u);
break;
default: return NO_SAMPLE;
}
return sfx;
}
WRAPPER void cAudioManager::Service() { EAXJMP(0x57A2A0); }
WRAPPER void
cAudioManager::Service()
{
EAXJMP(0x57A2A0);
}
STARTPATCHES
InjectHook(0x56AD20, &cAudioManager::PlayerJustLeftCar, PATCH_JUMP);
InjectHook(0x570DB0, &cAudioManager::GetPhrase, PATCH_JUMP);
InjectHook(0x570E00, &cAudioManager::GetPlayerTalkSfx, PATCH_JUMP);
InjectHook(0x570EA0, &cAudioManager::GetCopTalkSfx, PATCH_JUMP);
InjectHook(0x570F80, &cAudioManager::GetSwatTalkSfx, PATCH_JUMP);
InjectHook(0x571040, &cAudioManager::GetFBITalkSfx, PATCH_JUMP);
InjectHook(0x571110, &cAudioManager::GetArmyTalkSfx, PATCH_JUMP);
InjectHook(0x5711C0, &cAudioManager::GetMedicTalkSfx, PATCH_JUMP);
InjectHook(0x5712B0, &cAudioManager::GetFiremanTalkSfx, PATCH_JUMP);
InjectHook(0x575340, &cAudioManager::GetNormalMaleTalkSfx, PATCH_JUMP);
InjectHook(0x575190, &cAudioManager::GetTaxiDriverTalkSfx, PATCH_JUMP);
InjectHook(0x575240, &cAudioManager::GetPimpTalkSfx, PATCH_JUMP);
InjectHook(0x571510, &cAudioManager::GetMafiaTalkSfx, PATCH_JUMP);
InjectHook(0x571650, &cAudioManager::GetTriadTalkSfx, PATCH_JUMP);
InjectHook(0x571770, &cAudioManager::GetDiabloTalkSfx, PATCH_JUMP);
InjectHook(0x5718D0, &cAudioManager::GetYakuzaTalkSfx, PATCH_JUMP);
InjectHook(0x5719E0, &cAudioManager::GetYardieTalkSfx, PATCH_JUMP);
InjectHook(0x575460, &cAudioManager::GetGenericMaleTalkSfx, PATCH_JUMP);
ENDPATCHES

View File

@ -1,6 +1,7 @@
#pragma once
#include "AudioSamples.h"
#include "DMAudio.h"
#include "common.h"
class tActiveSample
@ -72,12 +73,12 @@ enum eAudioType : int32 {
class tAudioEntity
{
public:
public:
eAudioType m_nType;
void *m_pEntity;
char m_bIsUsed;
char m_bStatus;
__int16 m_awAudioEvent[4];
int16 m_awAudioEvent[4];
char gap_18[2];
float m_afVolume[4];
char field_24;
@ -146,7 +147,9 @@ public:
static_assert(sizeof(cAudioCollisionManager) == 0x354,
"cAudioCollisionManager: error");
struct cMissionAudio {
class cMissionAudio
{
public:
CVector m_vecPos;
char field_12;
char gap_13[3];
@ -215,13 +218,28 @@ public:
void PlayerJustLeftCar(void);
void Service();
void GetPhrase(eAudioSamples *phrase, eAudioSamples *prevPhrase,
eAudioSamples sample, uint32 maxOffset);
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample,
uint32 maxOffset);
uint32 GetPlayerTalkSfx(eSound sound);
uint32 GetGenericMaleTalkSfx(eSound sound);
uint32 GetPlayerTalkSfx(int16 sound);
uint32 GetCopTalkSfx(int16 sound);
uint32 GetSwatTalkSfx(int16 sound);
uint32 GetFBITalkSfx(int16 sound);
uint32 GetArmyTalkSfx(int16 sound);
uint32 GetMedicTalkSfx(int16 sound);
uint32 GetFiremanTalkSfx(int16 sound);
uint32 GetNormalMaleTalkSfx(int16 sound);
uint32 GetTaxiDriverTalkSfx(int16 sound);
uint32 GetPimpTalkSfx(int16 sound);
uint32 GetMafiaTalkSfx(int16 sound);
uint32 GetTriadTalkSfx(int16 sound);
uint32 GetDiabloTalkSfx(int16 sound);
uint32 GetYakuzaTalkSfx(int16 sound);
uint32 GetYardieTalkSfx(int16 sound);
uint32 GetGenericMaleTalkSfx(int16 sound);
};
static_assert(sizeof(cAudioManager) == 0x4B14, "cAudioManager: error");
extern cAudioManager &AudioManager;
extern cAudioManager &Players;

View File

@ -3038,174 +3038,3 @@ enum eAudioSamples : uint32 {
TOTAL_AUDIO_SAMPLES = 3032,
NO_SAMPLE = 3033,
};
enum eSound {
SOUND_CAR_DOOR_CLOSE_BONNET = 0,
SOUND_CAR_DOOR_CLOSE_BUMPER = 1,
SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 0x2,
SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT = 0x3,
SOUND_CAR_DOOR_CLOSE_BACK_LEFT = 0x4,
SOUND_CAR_DOOR_CLOSE_BACK_RIGHT = 0x5,
SOUND_CAR_DOOR_OPEN_BONNET = 0x6,
SOUND_CAR_DOOR_OPEN_BUMPER = 0x7,
SOUND_CAR_DOOR_OPEN_FRONT_LEFT = 0x8,
SOUND_CAR_DOOR_OPEN_FRONT_RIGHT = 0x9,
SOUND_CAR_DOOR_OPEN_BACK_LEFT = 0xA,
SOUND_CAR_DOOR_OPEN_BACK_RIGHT = 0xB,
SOUND_CAR_WINDSHIELD_CRACK = 0xC,
SOUND_CAR_JUMP = 0xD,
SOUND_E = 0xE,
SOUND_F = 0xF,
SOUND_CAR_ENGINE_START = 0x10,
SOUND_CAR_LIGHT_BREAK = 0x11,
SOUND_CAR_HYDRALIC_1 = 0x12,
SOUND_CAR_HYDRALIC_2 = 0x13,
SOUND_CAR_HYDRALIC_3 = 0x14,
SOUND_CAR_JERK = 0x15,
SOUND_CAR_SPLASH = 0x16,
SOUND_17 = 0x17,
SOUND_18 = 0x18,
SOUND_19 = 0x19,
SOUND_CAR_TANK_TURRET_ROTATE = 0x1A,
SOUND_CAR_BOMB_TICK = 0x1B,
SOUND_PLANE_ON_GROUND = 0x1C,
SOUND_STEP_START = 0x1D,
SOUND_STEP_END = 0x1E,
SOUND_FALL_LAND = 0x1F,
SOUND_FALL_COLLAPSE = 0x20,
SOUND_21 = 0x21,
SOUND_22 = 0x22,
SOUND_23 = 0x23,
SOUND_24 = 0x24,
SOUND_25 = 0x25,
SOUND_26 = 0x26,
SOUND_WEAPON_PUNCH_ATTACK = 0x27,
SOUND_28 = 0x28,
SOUND_29 = 0x29,
SOUND_2A = 0x2A,
SOUND_2B = 0x2B,
SOUND_2C = 0x2C,
SOUND_2D = 0x2D,
SOUND_WEAPON_BAT_ATTACK = 0x2E,
SOUND_WEAPON_SHOT_FIRED = 0x2F,
SOUND_WEAPON_RELOAD = 0x30,
SOUND_31 = 0x31,
SOUND_32 = 0x32,
SOUND_33 = 0x33,
SOUND_WEAPON_FLAMETHROWER_FIRE = 0x34,
SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM = 0x35,
SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM = 0x36,
SOUND_WEAPON_HIT_PED = 0x37,
SOUND_WEAPON_HIT_VEHICLE = 0x38,
SOUND_GARAGE_NO_MONEY = 0x39,
SOUND_GARAGE_BAD_VEHICLE = 0x3A,
SOUND_GARAGE_OPENING = 0x3B,
SOUND_3C = 0x3C,
SOUND_GARAGE_BOMB1_SET = 0x3D,
SOUND_GARAGE_BOMB2_SET = 0x3E,
SOUND_GARAGE_BOMB3_SET = 0x3F,
SOUND_40 = 0x40,
SOUND_41 = 0x41,
SOUND_GARAGE_VEHICLE_DECLINED = 0x42,
SOUND_GARAGE_VEHICLE_ACCEPTED = 0x43,
SOUND_GARAGE_DOOR_CLOSED = 0x44,
SOUND_GARAGE_DOOR_OPENED = 0x45,
SOUND_CRANE_PICKUP = 0x46,
SOUND_PICKUP_WEAPON_BOUGHT = 0x47,
SOUND_PICKUP_WEAPON = 0x48,
SOUND_PICKUP_HEALTH = 0x49,
SOUND_4A = 0x4A,
SOUND_4B = 0x4B,
SOUND_PICKUP_ADRENALINE = 0x4C,
SOUND_PICKUP_ARMOUR = 0x4D,
SOUND_PICKUP_BONUS = 0x4E,
SOUND_PICKUP_MONEY = 0x4F,
SOUND_PICKUP_HIDDEN_PACKAGE = 0x50,
SOUND_PICKUP_PACMAN_PILL = 0x51,
SOUND_PICKUP_PACMAN_PACKAGE = 0x52,
SOUND_PICKUP_FLOAT_PACKAGE = 0x53,
SOUND_BOMB_TIMED_ACTIVATED = 0x54,
SOUND_55 = 0x55,
SOUND_BOMB_ONIGNITION_ACTIVATED = 0x56,
SOUND_BOMB_TICK = 0x57,
SOUND_RAMPAGE_START = 0x58,
SOUND_RAMPAGE_ONGOING = 0x59,
SOUND_RAMPAGE_PASSED = 0x5A,
SOUND_RAMPAGE_FAILED = 0x5B,
SOUND_RAMPAGE_KILL = 0x5C,
SOUND_RAMPAGE_CAR_BLOWN = 0x5D,
SOUND_EVIDENCE_PICKUP = 0x5E,
SOUND_UNLOAD_GOLD = 0x5F,
SOUND_PAGER = 0x60,
SOUND_PED_DEATH = 0x61,
SOUND_PED_DAMAGE = 0x62,
SOUND_PED_HIT = 0x63,
SOUND_PED_LAND = 0x64,
SOUND_PED_BULLET_HIT = 0x65,
SOUND_PED_BOMBER = 0x66,
SOUND_PED_BURNING = 0x67,
SOUND_PED_ARREST_FBI = 0x68,
SOUND_PED_ARREST_SWAT = 0x69,
SOUND_PED_ARREST_COP = 0x6A,
SOUND_PED_HELI_PLAYER_FOUND = 0x6B,
SOUND_PED_HANDS_UP = 0x6C,
SOUND_PED_HANDS_COWER = 0x6D,
SOUND_PED_FLEE_SPRINT = 0x6E,
SOUND_PED_CAR_JACKING = 0x6F,
SOUND_PED_MUGGING = 0x70,
SOUND_PED_CAR_JACKED = 0x71,
SOUND_PED_ROBBED = 0x72,
SOUND_PED_TAXI_WAIT = 0x73,
SOUND_PED_ATTACK = 0x74,
SOUND_PED_DEFEND = 0x75,
SOUND_PED_PURSUIT_ARMY = 0x76,
SOUND_PED_PURSUIT_FBI = 0x77,
SOUND_PED_PURSUIT_SWAT = 0x78,
SOUND_PED_PURSUIT_COP = 0x79,
SOUND_PED_HEALING = 0x7A,
SOUND_PED_7B = 0x7B,
SOUND_PED_LEAVE_VEHICLE = 0x7C,
SOUND_PED_EVADE = 0x7D,
SOUND_PED_FLEE_RUN = 0x7E,
SOUND_PED_CAR_COLLISION = 0x7F,
SOUND_PED_SOLICIT = 0x80,
SOUND_PED_EXTINGUISHING_FIRE = 0x81,
SOUND_PED_WAIT_DOUBLEBACK = 0x82,
SOUND_PED_CHAT_SEXY = 0x83,
SOUND_PED_CHAT_EVENT = 0x84,
SOUND_PED_CHAT = 0x85,
SOUND_PED_BODYCAST_HIT = 0x86,
SOUND_PED_TAXI_CALL = 0x87,
SOUND_INJURED_PED_MALE_OUCH = 0x88,
SOUND_INJURED_PED_FEMALE = 0x89,
SOUND_8A = 0x8A,
SOUND_RACE_START_3 = 0x8B,
SOUND_RACE_START_2 = 0x8C,
SOUND_RACE_START_1 = 0x8D,
SOUND_RACE_START_GO = 0x8E,
SOUND_SPLASH = 0x8F,
SOUND_WATER_FALL = 0x90,
SOUND_SPLATTER = 0x91,
SOUND_CAR_PED_COLLISION = 0x92,
SOUND_CLOCK_TICK = 0x93,
SOUND_PART_MISSION_COMPLETE = 0x94,
SOUND_FRONTEND_MENU_STARTING = 0x95,
SOUND_FRONTEND_MENU_COMPLETED = 0x96,
SOUND_FRONTEND_MENU_DENIED = 0x97,
SOUND_FRONTEND_MENU_SUCCESS = 0x98,
SOUND_FRONTEND_EXIT = 0x99,
SOUND_9A = 0x9A,
SOUND_9B = 0x9B,
SOUND_FRONTEND_AUDIO_TEST = 0x9C,
SOUND_FRONTEND_FAIL = 0x9D,
SOUND_FRONTEND_NO_RADIO = 0x9E,
SOUND_FRONTEND_RADIO_CHANGE = 0x9F,
SOUND_A0 = 0xA0,
SOUND_AMMUNATION_WELCOME_1 = 0xA1,
SOUND_AMMUNATION_WELCOME_2 = 0xA2,
SOUND_AMMUNATION_WELCOME_3 = 0xA3,
SOUND_LIGHTNING = 0xA4,
SOUND_A5 = 0xA5,
SOUND_TOTAL_SOUNDS = 166,
SOUND_TOTAL_PED_SOUNDS = 167,
};

View File

@ -1,6 +1,6 @@
#pragma once
enum eSound
enum eSound : int16
{
SOUND_CAR_DOOR_CLOSE_BONNET = 0,
SOUND_CAR_DOOR_CLOSE_BUMPER = 1,
@ -101,7 +101,7 @@ enum eSound
SOUND_PAGER = 96,
SOUND_PED_DEATH = 97,
SOUND_PED_DAMAGE = 98,
SOUND_PED_63 = 99,
SOUND_PED_HIT = 99,
SOUND_PED_LAND = 100,
SOUND_PED_BULLET_HIT = 101,
SOUND_PED_BOMBER = 102,

View File

@ -85,15 +85,15 @@ enum PedState
PED_PASSENGER,
PED_TAXI_PASSENGER,
PED_OPEN_DOOR,
PED_DIE,
PED_DEAD,
PED_DIE = 48,
PED_DEAD = 49,
PED_CARJACK,
PED_DRAG_FROM_CAR,
PED_ENTER_CAR,
PED_STEAL_CAR,
PED_EXIT_CAR,
PED_HANDS_UP,
PED_ARRESTED,
PED_ARRESTED = 56,
};
enum {