1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 20:20:02 +00:00

fix enum edditing effects for oal target and small improvements

This commit is contained in:
Roman Masanin 2020-09-21 03:21:17 +03:00
parent 0f119ed371
commit 579d96534d
3 changed files with 28 additions and 27 deletions

View file

@ -290,10 +290,11 @@ void
cAudioManager::CalculateDistance(bool &distCalculated, float dist) cAudioManager::CalculateDistance(bool &distCalculated, float dist)
{ {
if (!distCalculated) { if (!distCalculated) {
if (dist <= 0.0) if (dist > 0.0f)
m_sQueueSample.m_fDistance = 0.0;
else
m_sQueueSample.m_fDistance = Sqrt(dist); m_sQueueSample.m_fDistance = Sqrt(dist);
else
m_sQueueSample.m_fDistance = 0.0f;
distCalculated = true; distCalculated = true;
} }
} }
@ -1297,7 +1298,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams* params)
} }
void void
cAudioManager::UpdateGasPedalAudio(CVehicle* veh, eVehicleType vehType) cAudioManager::UpdateGasPedalAudio(CVehicle* veh, int vehType)
{ {
float gasPedal = Abs(veh->m_fGasPedal); float gasPedal = Abs(veh->m_fGasPedal);
float* gasPealAudioPtr; float* gasPealAudioPtr;

View file

@ -360,7 +360,7 @@ public:
void ProcessVehicle(CVehicle *vehicle); void ProcessVehicle(CVehicle *vehicle);
bool ProcessVehicleDoors(cVehicleParams *params); bool ProcessVehicleDoors(cVehicleParams *params);
void ProcessVehicleEngine(cVehicleParams *params); void ProcessVehicleEngine(cVehicleParams *params);
void UpdateGasPedalAudio(CVehicle* veh, eVehicleType vehType); void UpdateGasPedalAudio(CVehicle* veh, int vehType);
void ProcessVehicleHorn(cVehicleParams *params); void ProcessVehicleHorn(cVehicleParams *params);
void ProcessVehicleOneShots(cVehicleParams *params); void ProcessVehicleOneShots(cVehicleParams *params);
bool ProcessVehicleReverseWarning(cVehicleParams *params); bool ProcessVehicleReverseWarning(cVehicleParams *params);

View file

@ -43,7 +43,7 @@
cSampleManager SampleManager; cSampleManager SampleManager;
bool _bSampmanInitialised = false; bool _bSampmanInitialised = false;
uint32 BankStartOffset[MAX_SAMPLEBANKS]; uint32 BankStartOffset[MAX_SFX_BANKS];
int prevprovider=-1; int prevprovider=-1;
int curprovider=-1; int curprovider=-1;
@ -77,10 +77,10 @@ OggOpusFile *fpSampleDataHandle;
#else #else
FILE *fpSampleDataHandle; FILE *fpSampleDataHandle;
#endif #endif
bool bSampleBankLoaded [MAX_SAMPLEBANKS]; bool bSampleBankLoaded [MAX_SFX_BANKS];
int32 nSampleBankDiscStartOffset [MAX_SAMPLEBANKS]; int32 nSampleBankDiscStartOffset [MAX_SFX_BANKS];
int32 nSampleBankSize [MAX_SAMPLEBANKS]; int32 nSampleBankSize [MAX_SFX_BANKS];
uintptr nSampleBankMemoryStartAddress[MAX_SAMPLEBANKS]; uintptr nSampleBankMemoryStartAddress[MAX_SFX_BANKS];
int32 _nSampleDataEndOffset; int32 _nSampleDataEndOffset;
int32 nPedSlotSfx [MAX_PEDSFX]; int32 nPedSlotSfx [MAX_PEDSFX];
@ -574,7 +574,7 @@ cSampleManager::Initialise(void)
fpSampleDescHandle = NULL; fpSampleDescHandle = NULL;
fpSampleDataHandle = NULL; fpSampleDataHandle = NULL;
for ( int32 i = 0; i < MAX_SAMPLEBANKS; i++ ) for ( int32 i = 0; i < MAX_SFX_BANKS; i++ )
{ {
bSampleBankLoaded[i] = false; bSampleBankLoaded[i] = false;
nSampleBankDiscStartOffset[i] = 0; nSampleBankDiscStartOffset[i] = 0;
@ -628,8 +628,8 @@ cSampleManager::Initialise(void)
return false; return false;
} }
nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX); nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX);
ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != 0); ASSERT(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] != 0);
} }
@ -705,10 +705,10 @@ cSampleManager::Terminate(void)
nSampleBankMemoryStartAddress[SFX_BANK_0] = 0; nSampleBankMemoryStartAddress[SFX_BANK_0] = 0;
} }
if ( nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != 0 ) if ( nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] != 0 )
{ {
free((void *)nSampleBankMemoryStartAddress[SAMPLEBANK_PED]); free((void *)nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS]);
nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = 0; nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = 0;
} }
_bSampmanInitialised = false; _bSampmanInitialised = false;
@ -790,7 +790,7 @@ cSampleManager::SetMonoMode(uint8 nMode)
bool bool
cSampleManager::LoadSampleBank(uint8 nBank) cSampleManager::LoadSampleBank(uint8 nBank)
{ {
ASSERT( nBank < MAX_SAMPLEBANKS ); ASSERT( nBank < MAX_SFX_BANKS);
if ( CTimer::GetIsCodePaused() ) if ( CTimer::GetIsCodePaused() )
return false; return false;
@ -831,7 +831,7 @@ cSampleManager::LoadSampleBank(uint8 nBank)
void void
cSampleManager::UnloadSampleBank(uint8 nBank) cSampleManager::UnloadSampleBank(uint8 nBank)
{ {
ASSERT( nBank < MAX_SAMPLEBANKS ); ASSERT( nBank < MAX_SFX_BANKS);
bSampleBankLoaded[nBank] = false; bSampleBankLoaded[nBank] = false;
} }
@ -839,7 +839,7 @@ cSampleManager::UnloadSampleBank(uint8 nBank)
bool bool
cSampleManager::IsSampleBankLoaded(uint8 nBank) cSampleManager::IsSampleBankLoaded(uint8 nBank)
{ {
ASSERT( nBank < MAX_SAMPLEBANKS ); ASSERT( nBank < MAX_SFX_BANKS);
return bSampleBankLoaded[nBank]; return bSampleBankLoaded[nBank];
} }
@ -932,7 +932,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
if ( fseek(fpSampleDataHandle, m_aSamples[nComment].nOffset, SEEK_SET) != 0 ) if ( fseek(fpSampleDataHandle, m_aSamples[nComment].nOffset, SEEK_SET) != 0 )
return false; return false;
if ( fread((void *)(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize ) if ( fread((void *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize )
return false; return false;
#endif #endif
@ -940,7 +940,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
alBufferData(pedBuffers[nCurrentPedSlot], alBufferData(pedBuffers[nCurrentPedSlot],
AL_FORMAT_MONO16, AL_FORMAT_MONO16,
(void *)(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE*nCurrentPedSlot), (void *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot),
m_aSamples[nComment].nSize, m_aSamples[nComment].nSize,
m_aSamples[nComment].nFrequency); m_aSamples[nComment].nFrequency);
@ -953,13 +953,13 @@ cSampleManager::LoadPedComment(uint32 nComment)
int32 int32
cSampleManager::GetBankContainingSound(uint32 offset) cSampleManager::GetBankContainingSound(uint32 offset)
{ {
if ( offset >= BankStartOffset[SAMPLEBANK_PED] ) if ( offset >= BankStartOffset[SFX_BANK_PED_COMMENTS] )
return SAMPLEBANK_PED; return SFX_BANK_PED_COMMENTS;
if ( offset >= BankStartOffset[SFX_BANK_0] ) if ( offset >= BankStartOffset[SFX_BANK_0] )
return SFX_BANK_0; return SFX_BANK_0;
return SAMPLEBANK_INVALID; return INVALID_SFX_BANK;
} }
int32 int32
@ -1492,7 +1492,7 @@ cSampleManager::InitialiseSampleBanks(void)
for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ ) for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ )
{ {
#ifdef FIX_BUGS #ifdef FIX_BUGS
if (nBank >= MAX_SAMPLEBANKS) break; if (nBank >= MAX_SFX_BANKS) break;
#endif #endif
if ( BankStartOffset[nBank] == BankStartOffset[SFX_BANK_0] + i ) if ( BankStartOffset[nBank] == BankStartOffset[SFX_BANK_0] + i )
{ {
@ -1501,8 +1501,8 @@ cSampleManager::InitialiseSampleBanks(void)
} }
} }
nSampleBankSize[SFX_BANK_0] = nSampleBankDiscStartOffset[SAMPLEBANK_PED] - nSampleBankDiscStartOffset[SFX_BANK_0]; nSampleBankSize[SFX_BANK_0] = nSampleBankDiscStartOffset[SFX_BANK_PED_COMMENTS] - nSampleBankDiscStartOffset[SFX_BANK_0];
nSampleBankSize[SAMPLEBANK_PED] = _nSampleDataEndOffset - nSampleBankDiscStartOffset[SAMPLEBANK_PED]; nSampleBankSize[SFX_BANK_PED_COMMENTS] = _nSampleDataEndOffset - nSampleBankDiscStartOffset[SFX_BANK_PED_COMMENTS];
return true; return true;
} }