diff options
Diffstat (limited to 'src/audio/sampman_miles.cpp')
-rw-r--r-- | src/audio/sampman_miles.cpp | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index 8178d0ca..a4309b69 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -29,7 +29,7 @@ char SampleBankDataFilename[] = "AUDIO\\SFX.RAW"; FILE *fpSampleDescHandle; FILE *fpSampleDataHandle; -bool8 bSampleBankLoaded [MAX_SFX_BANKS]; +int8 gBankLoaded [MAX_SFX_BANKS]; int32 nSampleBankDiscStartOffset [MAX_SFX_BANKS]; int32 nSampleBankSize [MAX_SFX_BANKS]; int32 nSampleBankMemoryStartAddress[MAX_SFX_BANKS]; @@ -908,7 +908,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; @@ -1509,7 +1509,7 @@ cSampleManager::LoadSampleBank(uint8 nBank) if ( fread((void *)nSampleBankMemoryStartAddress[nBank], 1, nSampleBankSize[nBank],fpSampleDataHandle) != nSampleBankSize[nBank] ) return FALSE; - bSampleBankLoaded[nBank] = TRUE; + gBankLoaded[nBank] = LOADING_STATUS_LOADED; return TRUE; } @@ -1517,16 +1517,16 @@ cSampleManager::LoadSampleBank(uint8 nBank) void cSampleManager::UnloadSampleBank(uint8 nBank) { - bSampleBankLoaded[nBank] = FALSE; + gBankLoaded[nBank] = LOADING_STATUS_NOT_LOADED; } -bool8 +int8 cSampleManager::IsSampleBankLoaded(uint8 nBank) { - return bSampleBankLoaded[nBank]; + return gBankLoaded[nBank]; } -bool8 +uint8 cSampleManager::IsPedCommentLoaded(uint32 nComment) { int8 slot; @@ -1539,10 +1539,10 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment) slot += ARRAY_SIZE(nPedSlotSfx); #endif if ( nComment == nPedSlotSfx[slot] ) - return TRUE; + return LOADING_STATUS_LOADED; } - return FALSE; + return LOADING_STATUS_NOT_LOADED; } int32 @@ -1787,12 +1787,23 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) } else { - 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 = nPedSlotSfxAddr[slot]; + break; + } + } + + if (i == _TODOCONST(3)) return FALSE; - - int32 slot = _GetPedCommentSlot(nSfx); - - addr = nPedSlotSfxAddr[slot]; } #ifdef EXTERNAL_3D_SOUND |