summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/AudioManager.cpp7
-rw-r--r--src/audio/AudioManager.h2
-rw-r--r--src/audio/MusicManager.cpp8
-rw-r--r--src/audio/MusicManager.h2
-rw-r--r--src/audio/sampman.cpp98
-rw-r--r--src/audio/sampman.h4
6 files changed, 44 insertions, 77 deletions
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 1d2835cf..8a9a81f9 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -1,4 +1,4 @@
-#include "common.h"
+#include "common.h"
#include "patcher.h"
#include "audio_enums.h"
@@ -6269,7 +6269,7 @@ cAudioManager::ProcessPedHeadphones(cPedParams *params)
emittingVol = 10;
veh = (CAutomobile *)ped->m_pMyVehicle;
if(veh && veh->IsCar()) {
- for(int32 i = 2; i < ARRAYSIZE(veh->Doors); i++) {
+ for(int32 i = 2; i < ARRAY_SIZE(veh->Doors); i++) {
if(!veh->IsDoorClosed((eDoors)i) ||
veh->IsDoorMissing((eDoors)i)) {
emittingVol = 42;
@@ -9132,6 +9132,9 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
CVehicle *veh = params->m_pVehicle;
if(veh->m_bSirenOrAlarm == 0 && veh->m_nAlarmState <= 0) return;
+#ifdef FIX_BUGS
+ if (params->m_pVehicle->m_status == STATUS_WRECKED) return;
+#endif
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(80, 110.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 31a07f9b..ad558061 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -118,7 +118,7 @@ enum eScriptSounds : int16 {
SCRIPT_SOUND_BULLET_HIT_GROUND_1 = 106,
SCRIPT_SOUND_BULLET_HIT_GROUND_2 = 107,
SCRIPT_SOUND_BULLET_HIT_GROUND_3 = 108,
- SCRIPT_SOUND_109 = 109,
+ SCRIPT_SOUND_BULLET_HIT_WATER = 109, //no sound
SCRIPT_SOUND_110 = 110,
SCRIPT_SOUND_111 = 111,
SCRIPT_SOUND_PAYPHONE_RINGING = 112,
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index d840c57b..d4b60d9b 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -15,10 +15,10 @@
#include "sampman.h"
#include "patcher.h"
-cMusicManager &MusicManager = *(cMusicManager *)0x8F3964;
-int32 &gNumRetunePresses = *(int32 *)0x650B80;
-int32 &gRetuneCounter = *(int32*)0x650B84;
-bool& bHasStarted = *(bool*)0x650B7C;
+cMusicManager MusicManager;
+int32 gNumRetunePresses;
+int32 gRetuneCounter;
+bool bHasStarted;
const int maxVolume = 127;
diff --git a/src/audio/MusicManager.h b/src/audio/MusicManager.h
index 5c255069..5d6f41cf 100644
--- a/src/audio/MusicManager.h
+++ b/src/audio/MusicManager.h
@@ -86,4 +86,4 @@ public:
static_assert(sizeof(cMusicManager) == 0x95C, "cMusicManager: error");
-extern cMusicManager &MusicManager;
+extern cMusicManager MusicManager;
diff --git a/src/audio/sampman.cpp b/src/audio/sampman.cpp
index 6edb6028..6dd744c3 100644
--- a/src/audio/sampman.cpp
+++ b/src/audio/sampman.cpp
@@ -17,9 +17,8 @@
#pragma comment( lib, "mss32.lib" )
-cSampleManager &SampleManager = *(cSampleManager *)0x7341E0;
-extern int32 (&BankStartOffset)[MAX_SAMPLEBANKS] = *(int32 (*)[MAX_SAMPLEBANKS])*(int *)0x6FAB70;
-
+cSampleManager SampleManager;
+int32 BankStartOffset[MAX_SAMPLEBANKS];
///////////////////////////////////////////////////////////////
char SampleBankDescFilename[] = "AUDIO\\SFX.SDT";
@@ -116,7 +115,7 @@ typedef struct provider_stuff
static int __cdecl comp(const provider_stuff*s1,const provider_stuff*s2)
{
- return(strcasecmp(s1->name, s2->name));
+ return( _stricmp(s1->name,s2->name) );
}
static void
@@ -435,21 +434,17 @@ _FindMP3s(void)
OutputDebugString("Resolving Link");
OutputDebugString(filepath);
- if ( f )
- fprintf(f, " - shortcut to \"%s\"", filepath);
+ if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath);
}
else
{
- if ( f )
- fprintf(f, " - couldn't resolve shortcut");
+ if ( f ) fprintf(f, " - couldn't resolve shortcut");
}
bShortcut = true;
}
else
- {
bShortcut = false;
- }
}
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
@@ -494,8 +489,7 @@ _FindMP3s(void)
_pMP3List->pLinkPath = NULL;
}
- if ( f )
- fprintf(f, " - OK\n");
+ if ( f ) fprintf(f, " - OK\n");
bInitFirstEntry = false;
}
@@ -505,8 +499,7 @@ _FindMP3s(void)
OutputDebugString(filepath);
- if ( f )
- fprintf(f, " - not an MP3 or supported MP3 type\n");
+ if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n");
bInitFirstEntry = true;
}
@@ -514,17 +507,7 @@ _FindMP3s(void)
while ( true )
{
if ( !FindNextFile(hFind, &fd) )
- {
- if ( f )
- {
- fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
- fclose(f);
- }
-
- FindClose(hFind);
-
- return;
- }
+ break;
if ( bInitFirstEntry )
{
@@ -533,8 +516,7 @@ _FindMP3s(void)
int32 filepathlen = strlen(filepath);
- if ( f )
- fprintf(f, "\"%s\"", fd.cFileName);
+ if ( f ) fprintf(f, "\"%s\"", fd.cFileName);
if ( filepathlen > 0 )
{
@@ -547,13 +529,11 @@ _FindMP3s(void)
OutputDebugString("Resolving Link");
OutputDebugString(filepath);
- if ( f )
- fprintf(f, " - shortcut to \"%s\"", filepath);
+ if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath);
}
else
{
- if ( f )
- fprintf(f, " - couldn't resolve shortcut");
+ if ( f ) fprintf(f, " - couldn't resolve shortcut");
}
bShortcut = true;
@@ -564,8 +544,7 @@ _FindMP3s(void)
if ( filepathlen > MAX_PATH )
{
- if ( f )
- fprintf(f, " - Filename and path too long - %s - IGNORED)\n", filepath);
+ if ( f ) fprintf(f, " - Filename and path too long - %s - IGNORED)\n", filepath);
continue;
}
@@ -585,15 +564,7 @@ _FindMP3s(void)
_pMP3List = new tMP3Entry;
if ( _pMP3List == NULL)
- {
- if ( f )
- {
- fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
- fclose(f);
- }
- FindClose(hFind);
- return;
- }
+ break;
nNumMP3s = 1;
@@ -614,8 +585,7 @@ _FindMP3s(void)
pList = _pMP3List;
- if ( f )
- fprintf(f, " - OK\n");
+ if ( f ) fprintf(f, " - OK\n");
bInitFirstEntry = false;
}
@@ -624,8 +594,7 @@ _FindMP3s(void)
strcat(filepath, " - NOT A VALID MP3");
OutputDebugString(filepath);
- if ( f )
- fprintf(f, " - not an MP3 or supported MP3 type\n");
+ if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n");
}
}
}
@@ -638,8 +607,7 @@ _FindMP3s(void)
if ( filepathlen > 0 )
{
- if ( f )
- fprintf(f, "\"%s\"", fd.cFileName);
+ if ( f ) fprintf(f, "\"%s\"", fd.cFileName);
if ( filepathlen > 4 )
{
@@ -650,13 +618,11 @@ _FindMP3s(void)
OutputDebugString("Resolving Link");
OutputDebugString(filepath);
- if ( f )
- fprintf(f, " - shortcut to \"%s\"", filepath);
+ if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath);
}
else
{
- if ( f )
- fprintf(f, " - couldn't resolve shortcut");
+ if ( f ) fprintf(f, " - couldn't resolve shortcut");
}
bShortcut = true;
@@ -679,16 +645,8 @@ _FindMP3s(void)
tMP3Entry *e = pList->pNext;
- if ( e == NULL)
- {
- if ( f )
- {
- fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
- fclose(f);
- }
- FindClose(hFind);
- return;
- }
+ if ( e == NULL )
+ break;
pList = pList->pNext;
@@ -710,20 +668,26 @@ _FindMP3s(void)
OutputDebugString(fd.cFileName);
- if ( f )
- fprintf(f, " - OK\n");
+ if ( f ) fprintf(f, " - OK\n");
}
else
{
strcat(filepath, " - NOT A VALID MP3");
OutputDebugString(filepath);
- if ( f )
- fprintf(f, " - not an MP3 or supported MP3 type\n");
+ if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n");
}
}
}
}
+
+ if ( f )
+ {
+ fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
+ fclose(f);
+ }
+
+ FindClose(hFind);
}
static void
@@ -2257,7 +2221,7 @@ cSampleManager::InitialiseSampleBanks(void)
for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ )
{
- if ( BankStartOffset[nBank] == BankStartOffset[0] + i )
+ if ( BankStartOffset[nBank] == BankStartOffset[SAMPLEBANK_MAIN] + i )
{
nSampleBankDiscStartOffset[nBank] = m_aSamples[i].nOffset;
nBank++;
diff --git a/src/audio/sampman.h b/src/audio/sampman.h
index 4b546911..4f3c3eeb 100644
--- a/src/audio/sampman.h
+++ b/src/audio/sampman.h
@@ -135,8 +135,8 @@ public:
bool InitialiseSampleBanks(void);
};
-extern cSampleManager &SampleManager;
-extern int32 (&BankStartOffset)[MAX_SAMPLEBANKS];
+extern cSampleManager SampleManager;
+extern int32 BankStartOffset[MAX_SAMPLEBANKS];
static char StreamedNameTable[][25]=
{