Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
Fixes from master
  • Loading branch information
Sergeanur committed Sep 2, 2021
1 parent a04a84e commit a16fcd8d6a79e433c1c6e73d540f1bbe27e14164

File 6 of 6 in a16fcd8

@@ -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];
@@ -812,7 +812,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;
@@ -1250,7 +1250,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;
}
@@ -1260,24 +1260,24 @@ 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];
}

#ifdef FIX_BUGS
bool8
uint8
cSampleManager::IsMissionAudioLoaded(uint8 nSlot, uint32 nSample)
{
ASSERT(nSlot == MISSION_AUDIO_PLAYER_COMMENT); // only MISSION_AUDIO_PLAYER_COMMENT is supported on PC

return nSample == gPlayerTalkSfx;
return nSample == gPlayerTalkSfx ? LOADING_STATUS_LOADED : LOADING_STATUS_NOT_LOADED;
}

bool8
@@ -1298,7 +1298,7 @@ cSampleManager::LoadMissionAudio(uint8 nSlot, uint32 nSample)
}
#endif

bool8
uint8
cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
@@ -1313,10 +1313,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;
}


@@ -1543,11 +1543,23 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
#endif
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 = (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);
}

if ( GetChannelUsedFlag(nChannel) )

0 comments on commit a16fcd8

Please sign in to comment.