summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audio/AudioLogic.cpp26
-rw-r--r--src/audio/AudioManager.h6
-rw-r--r--src/audio/sampman.h6
-rw-r--r--src/audio/sampman_miles.cpp45
-rw-r--r--src/audio/sampman_null.cpp12
-rw-r--r--src/audio/sampman_oal.cpp44
6 files changed, 81 insertions, 58 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index b902690f..90c3fb04 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -5441,7 +5441,7 @@ cAudioManager::SetupPedComments(cPedParams &params, uint16 sound)
else
Vol = PED_COMMENT_VOLUME_BEHIND_WALL;
m_sQueueSample.m_nVolume = ComputeVolume(Vol, maxDist, m_sQueueSample.m_fDistance);
- pedComment.m_nProcess = 10;
+ pedComment.m_nLoadingTimeout = 10;
if (m_sQueueSample.m_nVolume > 0) {
pedComment.m_nEntityIndex = m_sQueueSample.m_nEntityIndex;
pedComment.m_vecPos = m_sQueueSample.m_vecPos;
@@ -8229,7 +8229,7 @@ cAudioManager::DebugPlayPedComment(int32 sound)
tPedComment pedComment;
pedComment.m_nSampleIndex = sound;
- pedComment.m_nProcess = 10;
+ pedComment.m_nLoadingTimeout = 10;
pedComment.m_nEntityIndex = 0;
pedComment.m_fDistance = 0.0f;
pedComment.m_nVolume = 99;
@@ -8302,11 +8302,11 @@ cPedComments::Process()
for(int i = 0; i < ARRAY_SIZE(prevSamples); i++) {
if(m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nSampleIndex ==
prevSamples[(counter + 1 + i) % ARRAY_SIZE(prevSamples)]) {
- m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nProcess = -1;
+ m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nLoadingTimeout = -1;
goto PedCommentAlreadyAdded;
}
}
- bool8 IsLoadedResult;
+ uint8 IsLoadedResult;
sampleIndex = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nSampleIndex;
if (sampleIndex >= PLAYER_COMMENTS_START && sampleIndex <= PLAYER_COMMENTS_END) {
IsLoadedResult = SampleManager.IsMissionAudioLoaded(MISSION_AUDIO_PLAYER_COMMENT, sampleIndex);
@@ -8315,8 +8315,8 @@ cPedComments::Process()
IsLoadedResult = SampleManager.IsPedCommentLoaded(sampleIndex);
bIsPlayerComment = FALSE;
}
- switch(IsLoadedResult) { // yes, this was a switch
- case FALSE:
+ switch(IsLoadedResult) {
+ case LOADING_STATUS_NOT_LOADED:
#if defined(GTA_PC) && !defined(FIX_BUGS)
if(!m_bDelay)
#endif
@@ -8325,7 +8325,7 @@ cPedComments::Process()
else
SampleManager.LoadPedComment(sampleIndex);
break;
- case TRUE:
+ case LOADING_STATUS_LOADED:
AudioManager.m_sQueueSample.m_nEntityIndex = m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nEntityIndex;
AudioManager.m_sQueueSample.m_nCounter = 0;
AudioManager.m_sQueueSample.m_nSampleIndex = sampleIndex;
@@ -8376,7 +8376,7 @@ cPedComments::Process()
if (CTimer::GetIsSlowMotionActive())
AudioManager.m_sQueueSample.m_nFrequency >>= 1;
#endif
- m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nProcess = -1;
+ m_aPedCommentQueue[m_nActiveQueue][m_aPedCommentOrderList[m_nActiveQueue][0]].m_nLoadingTimeout = -1;
prevSamples[counter++] = sampleIndex;
if(counter == 10) counter = 0;
AudioManager.AddSampleToRequestedQueue();
@@ -8385,8 +8385,8 @@ cPedComments::Process()
m_bDelay = TRUE;
#endif
break;
- default:
- break;
+ case LOADING_STATUS_LOADING: break;
+ default: break;
}
}
@@ -8400,8 +8400,8 @@ PedCommentAlreadyAdded:
m_nActiveQueue = 0;
}
for (uint8 i = 0; i < m_nPedCommentCount[queue]; i++) {
- if (m_aPedCommentQueue[queue][m_aPedCommentOrderList[queue][i]].m_nProcess > 0) {
- m_aPedCommentQueue[queue][m_aPedCommentOrderList[queue][i]].m_nProcess--;
+ if (m_aPedCommentQueue[queue][m_aPedCommentOrderList[queue][i]].m_nLoadingTimeout > 0) {
+ m_aPedCommentQueue[queue][m_aPedCommentOrderList[queue][i]].m_nLoadingTimeout--;
Add(&m_aPedCommentQueue[queue][m_aPedCommentOrderList[queue][i]]);
}
}
@@ -11862,7 +11862,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot)
m_nMissionAudioLoadingStatus[slot] = LOADING_STATUS_LOADED;
nFramesUntilFailedLoad[slot] = 0;
break;
- case LOADING_STATUS_FAILED:
+ case LOADING_STATUS_LOADING:
if (++nFramesUntilFailedLoad[slot] >= 120) {
nFramesForPretendPlaying[slot] = 0;
g_bMissionAudioLoadFailed[slot] = TRUE;
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 23231ece..71c99ff3 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -89,7 +89,7 @@ public:
CVector m_vecPos;
float m_fDistance;
uint8 m_nVolume;
- int8 m_nProcess;
+ int8 m_nLoadingTimeout; // how many iterations we gonna wait until dropping the sample if it's still not loaded (only useful on PS2)
#if defined(EXTERNAL_3D_SOUND) && defined(FIX_BUGS)
uint8 m_nEmittingVolume;
#endif
@@ -113,7 +113,7 @@ public:
{
for (int i = 0; i < NUM_PED_COMMENTS_SLOTS; i++)
for (int j = 0; j < NUM_SOUND_QUEUES; j++) {
- m_aPedCommentQueue[j][i].m_nProcess = -1;
+ m_aPedCommentQueue[j][i].m_nLoadingTimeout = -1;
m_aPedCommentOrderList[j][i] = NUM_PED_COMMENTS_SLOTS;
}
@@ -223,7 +223,7 @@ enum {
#endif
enum PLAY_STATUS { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING, PLAY_STATUS_FINISHED };
-enum LOADING_STATUS { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED, LOADING_STATUS_FAILED };
+enum LOADING_STATUS { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED, LOADING_STATUS_LOADING };
class cAudioManager
{
diff --git a/src/audio/sampman.h b/src/audio/sampman.h
index cc020471..e7fe3e7f 100644
--- a/src/audio/sampman.h
+++ b/src/audio/sampman.h
@@ -206,12 +206,12 @@ public:
bool8 LoadSampleBank (uint8 nBank);
void UnloadSampleBank (uint8 nBank);
- bool8 IsSampleBankLoaded(uint8 nBank);
+ int8 IsSampleBankLoaded(uint8 nBank);
- bool8 IsMissionAudioLoaded(uint8 nSlot, uint32 nSample);
+ uint8 IsMissionAudioLoaded(uint8 nSlot, uint32 nSample);
bool8 LoadMissionAudio (uint8 nSlot, uint32 nSample);
- bool8 IsPedCommentLoaded(uint32 nComment);
+ uint8 IsPedCommentLoaded(uint32 nComment);
bool8 LoadPedComment (uint32 nComment);
int32 GetBankContainingSound(uint32 offset);
diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp
index e6aa08a1..2f4cb227 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];
@@ -1039,7 +1039,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;
@@ -1659,7 +1659,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;
}
@@ -1667,16 +1667,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::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
@@ -1685,9 +1685,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;
}
@@ -1721,7 +1721,7 @@ cSampleManager::LoadMissionAudio(uint8 nSlot, uint32 nSample)
return TRUE;
}
-bool8
+uint8
cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
int8 slot;
@@ -1734,10 +1734,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
@@ -1964,12 +1964,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 = nPedSlotSfxAddr[slot];
+ break;
+ }
+ }
+
+ if (i == _TODOCONST(3))
return FALSE;
-
- int32 slot = _GetPedCommentSlot(nSfx);
-
- addr = nPedSlotSfxAddr[slot];
}
MissionAudioFound:
diff --git a/src/audio/sampman_null.cpp b/src/audio/sampman_null.cpp
index f66488b8..2e6c628d 100644
--- a/src/audio/sampman_null.cpp
+++ b/src/audio/sampman_null.cpp
@@ -148,20 +148,20 @@ cSampleManager::UnloadSampleBank(uint8 nBank)
ASSERT( nBank < MAX_SFX_BANKS );
}
-bool8
+int8
cSampleManager::IsSampleBankLoaded(uint8 nBank)
{
ASSERT( nBank < MAX_SFX_BANKS );
- return FALSE;
+ return LOADING_STATUS_NOT_LOADED;
}
-bool8
+uint8
cSampleManager::IsMissionAudioLoaded(uint8 nSlot, uint32 nSample)
{
ASSERT(nSlot < MISSION_AUDIO_COUNT);
- return FALSE;
+ return LOADING_STATUS_NOT_LOADED;
}
bool8
@@ -172,12 +172,12 @@ cSampleManager::LoadMissionAudio(uint8 nSlot, uint32 nSample)
return FALSE;
}
-bool8
+uint8
cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
- return FALSE;
+ return LOADING_STATUS_NOT_LOADED;
}
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: