mirror of
https://github.com/GTAmodding/re3.git
synced 2024-12-24 17:35:41 +00:00
Audio fixes from Serg
This commit is contained in:
parent
d822417cfc
commit
fef3b5f978
2 changed files with 40 additions and 26 deletions
|
@ -9092,7 +9092,7 @@ cAudioManager::ServiceSoundEffects()
|
||||||
ServiceCollisions();
|
ServiceCollisions();
|
||||||
AddReleasingSounds();
|
AddReleasingSounds();
|
||||||
ProcessMissionAudio();
|
ProcessMissionAudio();
|
||||||
sub_57C2B0();
|
AdjustSamplesVolume();
|
||||||
ProcessActiveQueues();
|
ProcessActiveQueues();
|
||||||
for(int32 i = 0; i < m_nScriptObjectEntityTotal; ++i) {
|
for(int32 i = 0; i < m_nScriptObjectEntityTotal; ++i) {
|
||||||
object = (cAudioScriptObject *)m_asAudioEntities[m_anScriptObjectEntityIndices[i]]
|
object = (cAudioScriptObject *)m_asAudioEntities[m_anScriptObjectEntityIndices[i]]
|
||||||
|
@ -10242,27 +10242,31 @@ cAudioManager::UsesSirenSwitching(int32 model) const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WRAPPER
|
|
||||||
void
|
void
|
||||||
cAudioManager::sub_57C2B0()
|
cAudioManager::AdjustSamplesVolume()
|
||||||
{
|
{
|
||||||
EAXJMP(0x57C2B0);
|
for(int i = 0; i < m_bSampleRequestQueuesStatus[m_bActiveSampleQueue];
|
||||||
|
i++) {
|
||||||
|
tActiveSample *pSample =
|
||||||
|
&m_asSamples[i][(int32)m_abSampleQueueIndexTable[i] + 1];
|
||||||
|
|
||||||
|
if(!pSample->m_bBankIndex) // all non-speech sounds on PC
|
||||||
|
pSample->m_bEmittingVolume = ComputeEmittingVolume(
|
||||||
|
pSample->m_bEmittingVolume,
|
||||||
|
pSample->m_fSoundIntensity, pSample->m_fDistance);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32
|
int32
|
||||||
cAudioManager::sub_57C320(uint8 a1, float a2, float a3)
|
cAudioManager::ComputeEmittingVolume(uint8 emittingVolume, float intensity,
|
||||||
|
float dist)
|
||||||
{
|
{
|
||||||
float v4;
|
float quatIntensity = intensity / 4.0f;
|
||||||
float v5;
|
float diffIntensity = intensity - quatIntensity;
|
||||||
int32 v6;
|
if(dist > diffIntensity)
|
||||||
|
return (quatIntensity - (dist - diffIntensity)) *
|
||||||
v4 = 0.25f * a2;
|
(float)emittingVolume / quatIntensity;
|
||||||
v5 = a2 - v4;
|
return emittingVolume;
|
||||||
if(a3 <= v5)
|
|
||||||
v6 = a1;
|
|
||||||
else
|
|
||||||
v6 = ((v4 - (a3 - v5)) * (float)a1 / v4);
|
|
||||||
return v6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
STARTPATCHES
|
STARTPATCHES
|
||||||
|
@ -10487,7 +10491,11 @@ InjectHook(0x56AC80, &cAudioManager::UpdateGasPedalAudio, PATCH_JUMP);
|
||||||
InjectHook(0x56C600, &cAudioManager::UsesReverseWarning, PATCH_JUMP);
|
InjectHook(0x56C600, &cAudioManager::UsesReverseWarning, PATCH_JUMP);
|
||||||
InjectHook(0x56C3C0, &cAudioManager::UsesSiren, PATCH_JUMP);
|
InjectHook(0x56C3C0, &cAudioManager::UsesSiren, PATCH_JUMP);
|
||||||
InjectHook(0x56C3F0, &cAudioManager::UsesSirenSwitching, PATCH_JUMP);
|
InjectHook(0x56C3F0, &cAudioManager::UsesSirenSwitching, PATCH_JUMP);
|
||||||
InjectHook(0x57C320, &cAudioManager::sub_57C320, PATCH_JUMP);
|
|
||||||
|
InjectHook(0x57C2B0, &cAudioManager::AdjustSamplesVolume, PATCH_JUMP);
|
||||||
|
InjectHook(0x57C320, &cAudioManager::ComputeEmittingVolume, PATCH_JUMP);
|
||||||
|
|
||||||
|
|
||||||
InjectHook(0x5755C0, &cPedComments::Add, PATCH_JUMP);
|
InjectHook(0x5755C0, &cPedComments::Add, PATCH_JUMP);
|
||||||
InjectHook(0x575730, &cPedComments::Process, PATCH_JUMP);
|
InjectHook(0x575730, &cPedComments::Process, PATCH_JUMP);
|
||||||
InjectHook(0x5685E0, &cAudioCollisionManager::AddCollisionToRequestedQueue, PATCH_JUMP);
|
InjectHook(0x5685E0, &cAudioCollisionManager::AddCollisionToRequestedQueue, PATCH_JUMP);
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
struct tActiveSample {
|
class tActiveSample
|
||||||
|
{
|
||||||
|
public:
|
||||||
int32 m_nEntityIndex;
|
int32 m_nEntityIndex;
|
||||||
int32 m_counter;
|
int32 m_counter;
|
||||||
int32 m_nSampleIndex;
|
int32 m_nSampleIndex;
|
||||||
|
@ -53,7 +55,8 @@ struct tActiveSample {
|
||||||
|
|
||||||
static_assert(sizeof(tActiveSample) == 92, "tActiveSample: error");
|
static_assert(sizeof(tActiveSample) == 92, "tActiveSample: error");
|
||||||
|
|
||||||
enum eAudioType : int32 {
|
enum eAudioType : int32
|
||||||
|
{
|
||||||
AUDIOTYPE_PHYSICAL = 0,
|
AUDIOTYPE_PHYSICAL = 0,
|
||||||
AUDIOTYPE_EXPLOSION = 1,
|
AUDIOTYPE_EXPLOSION = 1,
|
||||||
AUDIOTYPE_FIRE = 2,
|
AUDIOTYPE_FIRE = 2,
|
||||||
|
@ -74,7 +77,9 @@ enum eAudioType : int32 {
|
||||||
class CPhysical;
|
class CPhysical;
|
||||||
class CAutomobile;
|
class CAutomobile;
|
||||||
|
|
||||||
struct tAudioEntity {
|
class tAudioEntity
|
||||||
|
{
|
||||||
|
public:
|
||||||
eAudioType m_nType;
|
eAudioType m_nType;
|
||||||
void *m_pEntity;
|
void *m_pEntity;
|
||||||
bool m_bIsUsed;
|
bool m_bIsUsed;
|
||||||
|
@ -90,7 +95,9 @@ struct tAudioEntity {
|
||||||
|
|
||||||
static_assert(sizeof(tAudioEntity) == 40, "tAudioEntity: error");
|
static_assert(sizeof(tAudioEntity) == 40, "tAudioEntity: error");
|
||||||
|
|
||||||
struct tPedComment {
|
class tPedComment
|
||||||
|
{
|
||||||
|
public:
|
||||||
int32 m_nSampleIndex;
|
int32 m_nSampleIndex;
|
||||||
int32 m_entityIndex;
|
int32 m_entityIndex;
|
||||||
CVector m_vecPos;
|
CVector m_vecPos;
|
||||||
|
@ -254,13 +261,10 @@ public:
|
||||||
uint8 field_13;
|
uint8 field_13;
|
||||||
uint8 field_14;
|
uint8 field_14;
|
||||||
uint8 field_15;
|
uint8 field_15;
|
||||||
// 100
|
|
||||||
int32 m_nTimer;
|
int32 m_nTimer;
|
||||||
tActiveSample m_sQueueSample;
|
tActiveSample m_sQueueSample;
|
||||||
// 224
|
|
||||||
bool m_bActiveSampleQueue;
|
bool m_bActiveSampleQueue;
|
||||||
uint8 gap_109[3];
|
uint8 gap_109[3];
|
||||||
// 264
|
|
||||||
tActiveSample m_asSamples[2][27];
|
tActiveSample m_asSamples[2][27];
|
||||||
uint8 m_abSampleQueueIndexTable[2][27];
|
uint8 m_abSampleQueueIndexTable[2][27];
|
||||||
uint8 m_bSampleRequestQueuesStatus[2];
|
uint8 m_bSampleRequestQueuesStatus[2];
|
||||||
|
@ -563,8 +567,10 @@ public:
|
||||||
bool UsesSiren(int32 model) const;
|
bool UsesSiren(int32 model) const;
|
||||||
bool UsesSirenSwitching(int32 model) const;
|
bool UsesSirenSwitching(int32 model) const;
|
||||||
|
|
||||||
void sub_57C2B0(); // todo (weird) and obtain name
|
// only used in pc
|
||||||
int32 sub_57C320(uint8 a1, float a2, float a3); /// ok (get name)
|
void AdjustSamplesVolume(); /// ok
|
||||||
|
int32 ComputeEmittingVolume(uint8 emittingVolume, float intensity,
|
||||||
|
float dist); /// ok
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
|
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
|
||||||
|
|
Loading…
Reference in a new issue