summaryrefslogtreecommitdiffstats
path: root/src/audio/sampman_oal.cpp
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2021-09-02 20:00:15 +0200
committerSergeanur <s.anureev@yandex.ua>2021-09-02 20:00:15 +0200
commit33abd1b4e7a7b19e2d09c796c481c3325c1e2902 (patch)
tree1188818ae1163b02565e091a4b83dad164266a35 /src/audio/sampman_oal.cpp
parentMerge branch 'miami' into lcs (diff)
parentFixes from master (diff)
downloadre3-lcs.tar
re3-lcs.tar.gz
re3-lcs.tar.bz2
re3-lcs.tar.lz
re3-lcs.tar.xz
re3-lcs.tar.zst
re3-lcs.zip
Diffstat (limited to 'src/audio/sampman_oal.cpp')
-rw-r--r--src/audio/sampman_oal.cpp44
1 files changed, 28 insertions, 16 deletions
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index 5b05269b..046cbb0c 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -92,7 +92,7 @@ OggOpusFile *fpSampleDataHandle;
#else
FILE *fpSampleDataHandle;
#endif
-bool8 bSampleBankLoaded [MAX_SFX_BANKS];
+int8 gBankLoaded [MAX_SFX_BANKS];
int32 nSampleBankDiscStartOffset [MAX_SFX_BANKS];
int32 nSampleBankSize [MAX_SFX_BANKS];
uintptr nSampleBankMemoryStartAddress[MAX_SFX_BANKS];
@@ -887,7 +887,7 @@ cSampleManager::Initialise(void)
for ( int32 i = 0; i < MAX_SFX_BANKS; i++ )
{
- bSampleBankLoaded[i] = FALSE;
+ gBankLoaded[i] = LOADING_STATUS_NOT_LOADED;
nSampleBankDiscStartOffset[i] = 0;
nSampleBankSize[i] = 0;
nSampleBankMemoryStartAddress[i] = 0;
@@ -1343,7 +1343,7 @@ cSampleManager::LoadSampleBank(uint8 nBank)
if ( fread((void *)nSampleBankMemoryStartAddress[nBank], 1, nSampleBankSize[nBank], fpSampleDataHandle) != nSampleBankSize[nBank] )
return FALSE;
#endif
- bSampleBankLoaded[nBank] = TRUE;
+ gBankLoaded[nBank] = LOADING_STATUS_LOADED;
return TRUE;
}
@@ -1353,18 +1353,18 @@ cSampleManager::UnloadSampleBank(uint8 nBank)
{
ASSERT( nBank < MAX_SFX_BANKS);
- bSampleBankLoaded[nBank] = FALSE;
+ gBankLoaded[nBank] = LOADING_STATUS_NOT_LOADED;
}
-bool8
+int8
cSampleManager::IsSampleBankLoaded(uint8 nBank)
{
ASSERT( nBank < MAX_SFX_BANKS);
- return bSampleBankLoaded[nBank];
+ return gBankLoaded[nBank];
}
-bool8
+uint8
cSampleManager::IsMissionAudioLoaded(uint8 nSlot, uint32 nSample)
{
ASSERT(nSlot != MISSION_AUDIO_POLRADIO_CRIME_OR_COLOR && nSlot != MISSION_AUDIO_POLRADIO_AREA_OR_CAR); // these are not used in LCS
@@ -1373,9 +1373,9 @@ cSampleManager::IsMissionAudioLoaded(uint8 nSlot, uint32 nSample)
{
case MISSION_AUDIO_SLOT_1:
case MISSION_AUDIO_SLOT_2:
- return nMissionSlotSfx[nSlot] == nSample;
+ return nMissionSlotSfx[nSlot] == nSample ? LOADING_STATUS_LOADED : LOADING_STATUS_NOT_LOADED;
case MISSION_AUDIO_PLAYER_COMMENT:
- return nSample == gPlayerTalkSfx;
+ return nSample == gPlayerTalkSfx ? LOADING_STATUS_LOADED : LOADING_STATUS_NOT_LOADED;
}
return FALSE;
}
@@ -1409,7 +1409,7 @@ cSampleManager::LoadMissionAudio(uint8 nSlot, uint32 nSample)
return TRUE;
}
-bool8
+uint8
cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
@@ -1424,10 +1424,10 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
uint8 slot = nCurrentPedSlot - i - 1;
#endif
if ( nComment == nPedSlotSfx[slot] )
- return TRUE;
+ return LOADING_STATUS_LOADED;
}
- return FALSE;
+ return LOADING_STATUS_NOT_LOADED;
}
@@ -1659,11 +1659,23 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
}
}
- if ( !IsPedCommentLoaded(nSfx) )
+ int32 i;
+ for ( i = 0; i < _TODOCONST(3); i++ )
+ {
+ int32 slot = nCurrentPedSlot - i - 1;
+#ifdef FIX_BUGS
+ if (slot < 0)
+ slot += ARRAY_SIZE(nPedSlotSfx);
+#endif
+ if ( nSfx == nPedSlotSfx[slot] )
+ {
+ addr = (nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE * slot);
+ break;
+ }
+ }
+
+ if (i == _TODOCONST(3))
return FALSE;
-
- int32 slot = _GetPedCommentSlot(nSfx);
- addr = (nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE * slot);
}
MissionAudioFound: