Merge pull request #706 from theR4K/miami

Miami
This commit is contained in:
Sergeanur 2020-09-21 19:55:51 +03:00 committed by GitHub
commit bde17bb395
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 1068 additions and 730 deletions

3
.gitignore vendored
View file

@ -351,4 +351,5 @@ MigrationBackup/
vendor/glew-2.1.0/
vendor/glfw-3.3.2.bin.WIN32/
vendor/glfw-3.3.2.bin.WIN64/
vendor/glfw-3.3.2.bin.WIN64/
/vendor/glfw-3.3.2

View file

@ -165,7 +165,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun
if(m_sQueueSample.m_nVolume) {
m_sQueueSample.m_nCounter = counter;
m_sQueueSample.m_vecPos = col.m_vecPosition;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 7;
m_sQueueSample.m_nLoopCount = 0;
@ -306,7 +306,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
m_sQueueSample.m_nCounter = counter++;
if(counter >= 255) counter = 28;
m_sQueueSample.m_vecPos = col.m_vecPosition;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = false;
m_sQueueSample.m_nReleasingVolumeModificator = 11;
m_sQueueSample.m_nLoopCount = 1;

File diff suppressed because it is too large Load diff

View file

@ -86,7 +86,7 @@ cAudioManager::Terminate()
m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
PreTerminateGameSpecificShutdown();
for (uint32 i = 0; i < MAX_SAMPLEBANKS; i++) {
for (uint32 i = 0; i < MAX_SFX_BANKS; i++) {
if (SampleManager.IsSampleBankLoaded(i))
SampleManager.UnloadSampleBank(i);
}
@ -934,7 +934,7 @@ cAudioManager::ClearActiveSamples()
m_asActiveSamples[i].m_nEntityIndex = AEHANDLE_NONE;
m_asActiveSamples[i].m_nCounter = 0;
m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE;
m_asActiveSamples[i].m_nBankIndex = SAMPLEBANK_INVALID;
m_asActiveSamples[i].m_nBankIndex = INVALID_SFX_BANK;
m_asActiveSamples[i].m_bIs2D = false;
m_asActiveSamples[i].m_nReleasingVolumeModificator = 5;
m_asActiveSamples[i].m_nFrequency = 0;

View file

@ -3,6 +3,7 @@
#include "audio_enums.h"
#include "AudioCollision.h"
#include "PoliceRadio.h"
#include "VehicleModelInfo.h"
class tSound
{
@ -143,6 +144,7 @@ public:
class cVehicleParams
{
public:
eVehicleType m_VehicleType;
bool m_bDistanceCalculated;
float m_fDistance;
CVehicle *m_pVehicle;
@ -345,7 +347,7 @@ public:
void ProcessPedOneShots(cPedParams *params);
void ProcessPhysical(int32 id);
void ProcessPlane(cVehicleParams *params);
void ProcessPlayersVehicleEngine(cVehicleParams *params, CAutomobile *automobile);
void ProcessPlayersVehicleEngine(cVehicleParams *params, CVehicle* veh);
void ProcessProjectiles();
void ProcessRainOnVehicle(cVehicleParams *params);
void ProcessReverb() const;
@ -358,6 +360,7 @@ public:
void ProcessVehicle(CVehicle *vehicle);
bool ProcessVehicleDoors(cVehicleParams *params);
void ProcessVehicleEngine(cVehicleParams *params);
void UpdateGasPedalAudio(CVehicle* veh, int vehType);
void ProcessVehicleHorn(cVehicleParams *params);
void ProcessVehicleOneShots(cVehicleParams *params);
bool ProcessVehicleReverseWarning(cVehicleParams *params);
@ -410,7 +413,6 @@ public:
void Terminate();
void TranslateEntity(Const CVector *v1, CVector *v2) const;
void UpdateGasPedalAudio(CAutomobile *automobile);
void UpdateReflections();
bool UsesReverseWarning(int32 model) const;
bool UsesSiren(int32 model) const;

View file

@ -103,7 +103,7 @@ cAudioManager::DoPoliceRadioCrackle()
m_sQueueSample.m_nEntityIndex = m_nPoliceChannelEntity;
m_sQueueSample.m_nCounter = 0;
m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE;
m_sQueueSample.m_nBankIndex = SAMPLEBANK_MAIN;
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
m_sQueueSample.m_bIs2D = true;
m_sQueueSample.m_nReleasingVolumeModificator = 10;
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_RADIO_CRACKLE);

View file

@ -16,85 +16,101 @@ struct tSample {
#ifdef GTA_PS2
#define PS2BANK(e) e
#else
#define PS2BANK(e) e = SAMPLEBANK_MAIN
#define PS2BANK(e) e = SFX_BANK_0
#endif // GTA_PS2
enum
{
SAMPLEBANK_MAIN,
SFX_BANK_0,
#ifdef GTA_PS2
SFX_BANK_GENERIC_EXTRA,
SFX_BANK_PED_COMMENTS,
SFX_BANK_FRONT_END_MENU,
#else
SFX_BANK_GENERIC_EXTRA = SFX_BANK_0,
SFX_BANK_FRONT_END_MENU = SFX_BANK_0,
CAR_SAMPLEBANKS_OFFSET,
SAMPLEBANK_CAR_PACARD = CAR_SAMPLEBANKS_OFFSET,
SAMPLEBANK_CAR_PATHFINDER,
SAMPLEBANK_CAR_PORSCHE,
SAMPLEBANK_CAR_SPIDER,
SAMPLEBANK_CAR_MERC,
SAMPLEBANK_CAR_MACKTRUCK,
SAMPLEBANK_CAR_HOTROD,
SAMPLEBANK_CAR_COBRA,
SAMPLEBANK_CAR_NONE,
SFX_BANK_PED_COMMENTS,
MAX_SFX_BANKS,
INVALID_SFX_BANK,
#endif
PS2BANK(SAMPLEBANK_FRONTEND),
CAR_SFX_BANKS_OFFSET,
SFX_BANK_PONTIAC = CAR_SFX_BANKS_OFFSET,
SFX_BANK_PORSCHE,
SFX_BANK_SPIDER,
SFX_BANK_MERC,
SFX_BANK_TRUCK,
SFX_BANK_HOTROD,
SFX_BANK_COBRA,
SFX_BANK_PONTIAC_SLOW,
SFX_BANK_CADILLAC,
SFX_BANK_PATHFINDER,
SFX_BANK_PACARD,
SFX_BANK_GOLF_CART,
SFX_BANK_CAR_CHAINSAW,
SFX_BANK_RC,
SFX_BANK_RC_HELI,
SFX_BANK_CAR_UNUSED_4,
PS2BANK(SAMPLEBANK_TRAIN),
// bikes
SFX_BANK_VTWIN,
SFX_BANK_MOPED,
SFX_BANK_HONDA250,
SFX_BANK_SPORTS_BIKE,
SFX_BANK_BIKE_UNUSED_1,
SFX_BANK_BIKE_UNUSED_2,
SFX_BANK_BIKE_UNUSED_3,
SFX_BANK_BIKE_UNUSED_4,
SFX_BANK_BIKE_UNUSED_5,
SFX_BANK_BIKE_UNUSED_6,
PS2BANK(SAMPLEBANK_BUILDING_CLUB_1),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_2),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_3),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_4),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_5),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_6),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_7),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_8),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_9),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_10),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_11),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_12),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_RAGGA),
PS2BANK(SAMPLEBANK_BUILDING_STRIP_CLUB_1),
PS2BANK(SAMPLEBANK_BUILDING_STRIP_CLUB_2),
PS2BANK(SAMPLEBANK_BUILDING_WORKSHOP),
PS2BANK(SAMPLEBANK_BUILDING_PIANO_BAR),
PS2BANK(SAMPLEBANK_BUILDING_SAWMILL),
PS2BANK(SAMPLEBANK_BUILDING_DOG_FOOD_FACTORY),
PS2BANK(SAMPLEBANK_BUILDING_LAUNDERETTE),
PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_CHINATOWN),
PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_ITALY),
PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_1),
PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_2),
PS2BANK(SAMPLEBANK_BUILDING_AIRPORT),
PS2BANK(SAMPLEBANK_BUILDING_SHOP),
PS2BANK(SAMPLEBANK_BUILDING_CINEMA),
PS2BANK(SAMPLEBANK_BUILDING_DOCKS),
PS2BANK(SAMPLEBANK_BUILDING_HOME),
PS2BANK(SAMPLEBANK_BUILDING_PORN_1),
PS2BANK(SAMPLEBANK_BUILDING_PORN_2),
PS2BANK(SAMPLEBANK_BUILDING_PORN_3),
PS2BANK(SAMPLEBANK_BUILDING_POLICE_BALL),
PS2BANK(SAMPLEBANK_BUILDING_BANK_ALARM),
PS2BANK(SAMPLEBANK_BUILDING_RAVE_INDUSTRIAL),
PS2BANK(SAMPLEBANK_BUILDING_RAVE_COMMERCIAL),
PS2BANK(SAMPLEBANK_BUILDING_RAVE_SUBURBAN),
PS2BANK(SAMPLEBANK_BUILDING_RAVE_COMMERCIAL_2),
// heli
SFX_BANK_HELI_APACHE,
SFX_BANK_HELI_UNUSED_1,
SFX_BANK_HELI_UNUSED_2,
SFX_BANK_HELI_UNUSED_3,
SFX_BANK_HELI_UNUSED_4,
PS2BANK(SAMPLEBANK_BUILDING_39),
PS2BANK(SAMPLEBANK_BUILDING_40),
PS2BANK(SAMPLEBANK_BUILDING_41),
PS2BANK(SAMPLEBANK_BUILDING_42),
PS2BANK(SAMPLEBANK_BUILDING_43),
PS2BANK(SAMPLEBANK_BUILDING_44),
PS2BANK(SAMPLEBANK_BUILDING_45),
PS2BANK(SAMPLEBANK_BUILDING_46),
PS2BANK(SAMPLEBANK_BUILDING_47),
PS2BANK(SAMPLEBANK_EXTRAS),
SAMPLEBANK_PED,
MAX_SAMPLEBANKS,
SAMPLEBANK_INVALID
// plane
SFX_BANK_PLANE_SEAPLANE,
SFX_BANK_PLANE_UNUSED_1,
SFX_BANK_PLANE_UNUSED_2,
SFX_BANK_PLANE_UNUSED_3,
SFX_BANK_PLANE_UNUSED_4,
PS2BANK(SFX_BANK_BUILDING_BANK_ALARM),
PS2BANK(SFX_BANK_BUILDING_SNORING),
PS2BANK(SFX_BANK_BUILDING_BAR_1),
PS2BANK(SFX_BANK_BUILDING_BAR_2),
PS2BANK(SFX_BANK_BUILDING_BAR_3),
PS2BANK(SFX_BANK_BUILDING_BAR_4),
PS2BANK(SFX_BANK_BUILDING_MALIBU_1),
PS2BANK(SFX_BANK_BUILDING_MALIBU_2),
PS2BANK(SFX_BANK_BUILDING_MALIBU_3),
PS2BANK(SFX_BANK_BUILDING_STRIP_1),
PS2BANK(SFX_BANK_BUILDING_STRIP_2),
PS2BANK(SFX_BANK_BUILDING_STRIP_3),
PS2BANK(SFX_BANK_BUILDING_CHURCH),
PS2BANK(SFX_BANK_BUILDING_FAN_1),
PS2BANK(SFX_BANK_BUILDING_FAN_2),
PS2BANK(SFX_BANK_BUILDING_INSECT_1),
PS2BANK(SFX_BANK_BUILDING_INSECT_2),
PS2BANK(SFX_BANK_BUILDING_18),
PS2BANK(SFX_BANK_BUILDING_19),
PS2BANK(SFX_BANK_BUILDING_20),
PS2BANK(SFX_BANK_BUILDING_21),
PS2BANK(SFX_BANK_FOOTSTEPS_GRASS),
PS2BANK(SFX_BANK_FOOTSTEPS_GRAVEL),
PS2BANK(SFX_BANK_FOOTSTEPS_WOOD),
PS2BANK(SFX_BANK_FOOTSTEPS_METAL),
PS2BANK(SFX_BANK_FOOTSTEPS_WATER),
PS2BANK(SFX_BANK_FOOTSTEPS_SAND),
#ifdef GTA_PS2
MAX_SFX_BANKS,
INVALID_SFX_BANK
#endif
};
#define MAX_PEDSFX 7
#define PED_BLOCKSIZE 79000
@ -226,7 +242,7 @@ public:
};
extern cSampleManager SampleManager;
extern uint32 BankStartOffset[MAX_SAMPLEBANKS];
extern uint32 BankStartOffset[MAX_SFX_BANKS];
#ifdef AUDIO_OPUS
static char StreamedNameTable[][25] = {

View file

@ -21,7 +21,7 @@
#pragma comment( lib, "mss32.lib" )
cSampleManager SampleManager;
uint32 BankStartOffset[MAX_SAMPLEBANKS];
uint32 BankStartOffset[MAX_SFX_BANKS];
///////////////////////////////////////////////////////////////
char SampleBankDescFilename[] = "AUDIO\\SFX.SDT";
@ -29,10 +29,10 @@ char SampleBankDataFilename[] = "AUDIO\\SFX.RAW";
FILE *fpSampleDescHandle;
FILE *fpSampleDataHandle;
bool bSampleBankLoaded [MAX_SAMPLEBANKS];
int32 nSampleBankDiscStartOffset [MAX_SAMPLEBANKS];
int32 nSampleBankSize [MAX_SAMPLEBANKS];
int32 nSampleBankMemoryStartAddress[MAX_SAMPLEBANKS];
bool bSampleBankLoaded [MAX_SFX_BANKS];
int32 nSampleBankDiscStartOffset [MAX_SFX_BANKS];
int32 nSampleBankSize [MAX_SFX_BANKS];
int32 nSampleBankMemoryStartAddress[MAX_SFX_BANKS];
int32 _nSampleDataEndOffset;
int32 nPedSlotSfx [MAX_PEDSFX];
@ -1007,7 +1007,7 @@ cSampleManager::Initialise(void)
_nSampleDataEndOffset = 0;
for ( int32 i = 0; i < MAX_SAMPLEBANKS; i++ )
for ( int32 i = 0; i < MAX_SFX_BANKS; i++ )
{
bSampleBankLoaded[i] = false;
nSampleBankDiscStartOffset[i] = 0;
@ -1059,14 +1059,14 @@ cSampleManager::Initialise(void)
return false;
}
nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] = (int32)AIL_mem_alloc_lock(nSampleBankSize[SAMPLEBANK_MAIN]);
if ( !nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] )
nSampleBankMemoryStartAddress[SFX_BANK_0] = (int32)AIL_mem_alloc_lock(nSampleBankSize[SFX_BANK_0]);
if ( !nSampleBankMemoryStartAddress[SFX_BANK_0] )
{
Terminate();
return false;
}
nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = (int32)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX);
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (int32)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX);
}
@ -1287,7 +1287,7 @@ cSampleManager::Initialise(void)
TRACE("bank");
LoadSampleBank(SAMPLEBANK_MAIN);
LoadSampleBank(SFX_BANK_0);
// mp3
TRACE("mp3");
@ -1382,16 +1382,16 @@ cSampleManager::Terminate(void)
_DeleteMP3Entries();
if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != 0 )
if ( nSampleBankMemoryStartAddress[SFX_BANK_0] != 0 )
{
AIL_mem_free_lock((void *)nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN]);
nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] = 0;
AIL_mem_free_lock((void *)nSampleBankMemoryStartAddress[SFX_BANK_0]);
nSampleBankMemoryStartAddress[SFX_BANK_0] = 0;
}
if ( nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != 0 )
if ( nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] != 0 )
{
AIL_mem_free_lock((void *)nSampleBankMemoryStartAddress[SAMPLEBANK_PED]);
nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = 0;
AIL_mem_free_lock((void *)nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS]);
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = 0;
}
if ( DIG )
@ -1546,7 +1546,7 @@ cSampleManager::LoadSampleBank(uint8 nBank)
if ( MusicManager.IsInitialised()
&& MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
&& nBank != SAMPLEBANK_MAIN )
&& nBank != SFX_BANK_0 )
{
return false;
}
@ -1643,10 +1643,10 @@ cSampleManager::LoadPedComment(uint32 nComment)
if ( fseek(fpSampleDataHandle, m_aSamples[nComment].nOffset, SEEK_SET) != 0 )
return false;
if ( fread((void *)(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize )
if ( fread((void *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize )
return false;
nPedSlotSfxAddr[nCurrentPedSlot] = nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE*nCurrentPedSlot;
nPedSlotSfxAddr[nCurrentPedSlot] = nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot;
nPedSlotSfx [nCurrentPedSlot] = nComment;
if ( ++nCurrentPedSlot >= MAX_PEDSFX )
@ -1658,13 +1658,13 @@ cSampleManager::LoadPedComment(uint32 nComment)
int32
cSampleManager::GetBankContainingSound(uint32 offset)
{
if ( offset >= BankStartOffset[SAMPLEBANK_PED] )
return SAMPLEBANK_PED;
if ( offset >= BankStartOffset[SFX_BANK_PED_COMMENTS] )
return SFX_BANK_PED_COMMENTS;
if ( offset >= BankStartOffset[SAMPLEBANK_MAIN] )
return SAMPLEBANK_MAIN;
if ( offset >= BankStartOffset[SFX_BANK_0] )
return SFX_BANK_0;
return SAMPLEBANK_INVALID;
return INVALID_SFX_BANK;
}
int32
@ -2410,7 +2410,7 @@ cSampleManager::IsStreamPlaying(uint8 nStream)
bool
cSampleManager::InitialiseSampleBanks(void)
{
int32 nBank = SAMPLEBANK_MAIN;
int32 nBank = SFX_BANK_0;
fpSampleDescHandle = fopen(SampleBankDescFilename, "rb");
if ( fpSampleDescHandle == NULL )
@ -2437,17 +2437,17 @@ cSampleManager::InitialiseSampleBanks(void)
for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ )
{
#ifdef FIX_BUGS
if (nBank >= MAX_SAMPLEBANKS) break;
if (nBank >= MAX_SFX_BANKS) break;
#endif
if ( BankStartOffset[nBank] == BankStartOffset[SAMPLEBANK_MAIN] + i )
if ( BankStartOffset[nBank] == BankStartOffset[SFX_BANK_0] + i )
{
nSampleBankDiscStartOffset[nBank] = m_aSamples[i].nOffset;
nBank++;
}
}
nSampleBankSize[SAMPLEBANK_MAIN] = nSampleBankDiscStartOffset[SAMPLEBANK_PED] - nSampleBankDiscStartOffset[SAMPLEBANK_MAIN];
nSampleBankSize[SAMPLEBANK_PED] = _nSampleDataEndOffset - nSampleBankDiscStartOffset[SAMPLEBANK_PED];
nSampleBankSize[SFX_BANK_0] = nSampleBankDiscStartOffset[SFX_BANK_PED_COMMENTS] - nSampleBankDiscStartOffset[SFX_BANK_0];
nSampleBankSize[SFX_BANK_PED_COMMENTS] = _nSampleDataEndOffset - nSampleBankDiscStartOffset[SFX_BANK_PED_COMMENTS];
return true;
}

View file

@ -43,7 +43,7 @@
cSampleManager SampleManager;
bool _bSampmanInitialised = false;
uint32 BankStartOffset[MAX_SAMPLEBANKS];
uint32 BankStartOffset[MAX_SFX_BANKS];
int prevprovider=-1;
int curprovider=-1;
@ -77,10 +77,10 @@ OggOpusFile *fpSampleDataHandle;
#else
FILE *fpSampleDataHandle;
#endif
bool bSampleBankLoaded [MAX_SAMPLEBANKS];
int32 nSampleBankDiscStartOffset [MAX_SAMPLEBANKS];
int32 nSampleBankSize [MAX_SAMPLEBANKS];
uintptr nSampleBankMemoryStartAddress[MAX_SAMPLEBANKS];
bool bSampleBankLoaded [MAX_SFX_BANKS];
int32 nSampleBankDiscStartOffset [MAX_SFX_BANKS];
int32 nSampleBankSize [MAX_SFX_BANKS];
uintptr nSampleBankMemoryStartAddress[MAX_SFX_BANKS];
int32 _nSampleDataEndOffset;
int32 nPedSlotSfx [MAX_PEDSFX];
@ -574,7 +574,7 @@ cSampleManager::Initialise(void)
fpSampleDescHandle = NULL;
fpSampleDataHandle = NULL;
for ( int32 i = 0; i < MAX_SAMPLEBANKS; i++ )
for ( int32 i = 0; i < MAX_SFX_BANKS; i++ )
{
bSampleBankLoaded[i] = false;
nSampleBankDiscStartOffset[i] = 0;
@ -619,17 +619,17 @@ cSampleManager::Initialise(void)
return false;
}
nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] = (uintptr)malloc(nSampleBankSize[SAMPLEBANK_MAIN]);
ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != 0);
nSampleBankMemoryStartAddress[SFX_BANK_0] = (uintptr)malloc(nSampleBankSize[SFX_BANK_0]);
ASSERT(nSampleBankMemoryStartAddress[SFX_BANK_0] != 0);
if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] == 0 )
if ( nSampleBankMemoryStartAddress[SFX_BANK_0] == 0 )
{
Terminate();
return false;
}
nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX);
ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != 0);
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX);
ASSERT(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] != 0);
}
@ -677,7 +677,7 @@ cSampleManager::Initialise(void)
#endif
}
LoadSampleBank(SAMPLEBANK_MAIN);
LoadSampleBank(SFX_BANK_0);
return true;
}
@ -699,16 +699,16 @@ cSampleManager::Terminate(void)
CStream::Terminate();
if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != 0 )
if ( nSampleBankMemoryStartAddress[SFX_BANK_0] != 0 )
{
free((void *)nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN]);
nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] = 0;
free((void *)nSampleBankMemoryStartAddress[SFX_BANK_0]);
nSampleBankMemoryStartAddress[SFX_BANK_0] = 0;
}
if ( nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != 0 )
if ( nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] != 0 )
{
free((void *)nSampleBankMemoryStartAddress[SAMPLEBANK_PED]);
nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = 0;
free((void *)nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS]);
nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = 0;
}
_bSampmanInitialised = false;
@ -790,14 +790,14 @@ cSampleManager::SetMonoMode(uint8 nMode)
bool
cSampleManager::LoadSampleBank(uint8 nBank)
{
ASSERT( nBank < MAX_SAMPLEBANKS );
ASSERT( nBank < MAX_SFX_BANKS);
if ( CTimer::GetIsCodePaused() )
return false;
if ( MusicManager.IsInitialised()
&& MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
&& nBank != SAMPLEBANK_MAIN )
&& nBank != SFX_BANK_0 )
{
return false;
}
@ -831,7 +831,7 @@ cSampleManager::LoadSampleBank(uint8 nBank)
void
cSampleManager::UnloadSampleBank(uint8 nBank)
{
ASSERT( nBank < MAX_SAMPLEBANKS );
ASSERT( nBank < MAX_SFX_BANKS);
bSampleBankLoaded[nBank] = false;
}
@ -839,7 +839,7 @@ cSampleManager::UnloadSampleBank(uint8 nBank)
bool
cSampleManager::IsSampleBankLoaded(uint8 nBank)
{
ASSERT( nBank < MAX_SAMPLEBANKS );
ASSERT( nBank < MAX_SFX_BANKS);
return bSampleBankLoaded[nBank];
}
@ -932,7 +932,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
if ( fseek(fpSampleDataHandle, m_aSamples[nComment].nOffset, SEEK_SET) != 0 )
return false;
if ( fread((void *)(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize )
if ( fread((void *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize )
return false;
#endif
@ -940,7 +940,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
alBufferData(pedBuffers[nCurrentPedSlot],
AL_FORMAT_MONO16,
(void *)(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE*nCurrentPedSlot),
(void *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot),
m_aSamples[nComment].nSize,
m_aSamples[nComment].nFrequency);
@ -953,13 +953,13 @@ cSampleManager::LoadPedComment(uint32 nComment)
int32
cSampleManager::GetBankContainingSound(uint32 offset)
{
if ( offset >= BankStartOffset[SAMPLEBANK_PED] )
return SAMPLEBANK_PED;
if ( offset >= BankStartOffset[SFX_BANK_PED_COMMENTS] )
return SFX_BANK_PED_COMMENTS;
if ( offset >= BankStartOffset[SAMPLEBANK_MAIN] )
return SAMPLEBANK_MAIN;
if ( offset >= BankStartOffset[SFX_BANK_0] )
return SFX_BANK_0;
return SAMPLEBANK_INVALID;
return INVALID_SFX_BANK;
}
int32
@ -1460,7 +1460,7 @@ cSampleManager::Service(void)
bool
cSampleManager::InitialiseSampleBanks(void)
{
int32 nBank = SAMPLEBANK_MAIN;
int32 nBank = SFX_BANK_0;
fpSampleDescHandle = fopen(SampleBankDescFilename, "rb");
if ( fpSampleDescHandle == NULL )
@ -1492,17 +1492,17 @@ cSampleManager::InitialiseSampleBanks(void)
for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ )
{
#ifdef FIX_BUGS
if (nBank >= MAX_SAMPLEBANKS) break;
if (nBank >= MAX_SFX_BANKS) break;
#endif
if ( BankStartOffset[nBank] == BankStartOffset[SAMPLEBANK_MAIN] + i )
if ( BankStartOffset[nBank] == BankStartOffset[SFX_BANK_0] + i )
{
nSampleBankDiscStartOffset[nBank] = m_aSamples[i].nOffset;
nBank++;
}
}
nSampleBankSize[SAMPLEBANK_MAIN] = nSampleBankDiscStartOffset[SAMPLEBANK_PED] - nSampleBankDiscStartOffset[SAMPLEBANK_MAIN];
nSampleBankSize[SAMPLEBANK_PED] = _nSampleDataEndOffset - nSampleBankDiscStartOffset[SAMPLEBANK_PED];
nSampleBankSize[SFX_BANK_0] = nSampleBankDiscStartOffset[SFX_BANK_PED_COMMENTS] - nSampleBankDiscStartOffset[SFX_BANK_0];
nSampleBankSize[SFX_BANK_PED_COMMENTS] = _nSampleDataEndOffset - nSampleBankDiscStartOffset[SFX_BANK_PED_COMMENTS];
return true;
}

View file

@ -1121,15 +1121,19 @@ CMenuManager::DrawStandardMenus(bool drawCurrScreen)
rightText = TheText.Get("FEA_ADP");
else {
char* provider = DMAudio.Get3DProviderName(m_nPrefsAudio3DProviderIndex);
if (!strcmp(strupr(provider), "DIRECTSOUND3D HARDWARE SUPPORT")) {
strcpy(provider, "DSOUND3D HARDWARE SUPPORT");
if (provider != NULL) {
if (!strcmp(strupr(provider), "DIRECTSOUND3D HARDWARE SUPPORT")) {
strcpy(provider, "DSOUND3D HARDWARE SUPPORT");
}
else if (!strcmp(strupr(provider), "DIRECTSOUND3D SOFTWARE EMULATION")) {
strcpy(provider, "DSOUND3D SOFTWARE EMULATION");
}
AsciiToUnicode(provider, unicodeTemp);
rightText = unicodeTemp;
}
else if (!strcmp(strupr(provider), "DIRECTSOUND3D SOFTWARE EMULATION")) {
strcpy(provider, "DSOUND3D SOFTWARE EMULATION");
else {
rightText = TheText.Get("not defined");
}
AsciiToUnicode(provider, unicodeTemp);
rightText = unicodeTemp;
}
break;
case MENUACTION_SPEAKERCONF: {

View file

@ -24,7 +24,7 @@ enum {
ATOMIC_FLAG_NOCULL = 0x800,
};
enum eVehicleType {
enum eVehicleType : uint8{
VEHICLE_TYPE_CAR,
VEHICLE_TYPE_BOAT,
VEHICLE_TYPE_TRAIN,

View file

@ -129,7 +129,7 @@ CBike::CBike(int32 id, uint8 CreatedBy)
m_fTireTemperature = 1.0f;
m_fBrakeDestabilization = 0.0f;
field_490 = 0;
m_fVelocityChangeForAudio = 0;
for(i = 0; i < 2; i++){
m_aWheelRotation[i] = 0.0f;

View file

@ -77,7 +77,7 @@ public:
int16 m_doingBurnout;
float m_fTireTemperature;
float m_fBrakeDestabilization;
uint32 field_490;
float m_fVelocityChangeForAudio;
float m_fFireBlowUpTimer;
CPhysical *m_aGroundPhysical[4];
CVector m_aGroundOffset[4];