From 618d689dff9a22d9385abf36f5e364b38273b7cf Mon Sep 17 00:00:00 2001 From: erorcun Date: Sat, 6 Mar 2021 19:28:59 +0300 Subject: Pool fixes + peds not forming circle fix --- src/audio/AudioScriptObject.cpp | 8 ++++---- src/audio/AudioScriptObject.h | 8 ++++---- src/buildings/Building.cpp | 4 ++-- src/buildings/Building.h | 4 ++-- src/buildings/Treadable.cpp | 4 ++-- src/buildings/Treadable.h | 4 ++-- src/collision/ColModel.cpp | 4 ++-- src/collision/ColModel.h | 4 ++-- src/core/Streaming.cpp | 3 +-- src/core/Zones.cpp | 17 +++++++++++++++++ src/entities/Dummy.cpp | 4 ++-- src/entities/Dummy.h | 4 ++-- src/objects/Object.cpp | 30 ++++++++++++++++++++++++++---- src/objects/Object.h | 8 ++++---- src/objects/Stinger.cpp | 30 ++++++++++++++++++++++++------ src/peds/CopPed.cpp | 2 +- src/peds/Ped.cpp | 8 ++++---- src/peds/Ped.h | 8 ++++---- src/peds/Population.cpp | 29 +++++++++++++++-------------- src/rw/MemoryMgr.cpp | 8 ++++---- src/vehicles/Vehicle.cpp | 8 ++++---- src/vehicles/Vehicle.h | 8 ++++---- 22 files changed, 132 insertions(+), 75 deletions(-) diff --git a/src/audio/AudioScriptObject.cpp b/src/audio/AudioScriptObject.cpp index 7dbc1ad0..48c78c88 100644 --- a/src/audio/AudioScriptObject.cpp +++ b/src/audio/AudioScriptObject.cpp @@ -23,25 +23,25 @@ cAudioScriptObject::Reset() } void * -cAudioScriptObject::operator new(size_t sz) +cAudioScriptObject::operator new(size_t sz) throw() { return CPools::GetAudioScriptObjectPool()->New(); } void * -cAudioScriptObject::operator new(size_t sz, int handle) +cAudioScriptObject::operator new(size_t sz, int handle) throw() { return CPools::GetAudioScriptObjectPool()->New(handle); } void -cAudioScriptObject::operator delete(void *p, size_t sz) +cAudioScriptObject::operator delete(void *p, size_t sz) throw() { CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p); } void -cAudioScriptObject::operator delete(void *p, int handle) +cAudioScriptObject::operator delete(void *p, int handle) throw() { CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p); } diff --git a/src/audio/AudioScriptObject.h b/src/audio/AudioScriptObject.h index 8110b2bb..b9a7e61b 100644 --- a/src/audio/AudioScriptObject.h +++ b/src/audio/AudioScriptObject.h @@ -12,10 +12,10 @@ public: void Reset(); /// ok - static void* operator new(size_t); - static void* operator new(size_t, int); - static void operator delete(void*, size_t); - static void operator delete(void*, int); + static void* operator new(size_t) throw(); + static void* operator new(size_t, int) throw(); + static void operator delete(void*, size_t) throw(); + static void operator delete(void*, int) throw(); static void LoadAllAudioScriptObjects(uint8 *buf, uint32 size); static void SaveAllAudioScriptObjects(uint8 *buf, uint32 *size); diff --git a/src/buildings/Building.cpp b/src/buildings/Building.cpp index 8035cf25..92c787e5 100644 --- a/src/buildings/Building.cpp +++ b/src/buildings/Building.cpp @@ -4,8 +4,8 @@ #include "Streaming.h" #include "Pools.h" -void *CBuilding::operator new(size_t sz) { return CPools::GetBuildingPool()->New(); } -void CBuilding::operator delete(void *p, size_t sz) { CPools::GetBuildingPool()->Delete((CBuilding*)p); } +void *CBuilding::operator new(size_t sz) throw() { return CPools::GetBuildingPool()->New(); } +void CBuilding::operator delete(void *p, size_t sz) throw() { CPools::GetBuildingPool()->Delete((CBuilding*)p); } void CBuilding::ReplaceWithNewModel(int32 id) diff --git a/src/buildings/Building.h b/src/buildings/Building.h index 2c2dfb1f..f8ddfa46 100644 --- a/src/buildings/Building.h +++ b/src/buildings/Building.h @@ -9,8 +9,8 @@ public: m_type = ENTITY_TYPE_BUILDING; bUsesCollision = true; } - static void *operator new(size_t); - static void operator delete(void*, size_t); + static void *operator new(size_t) throw(); + static void operator delete(void*, size_t) throw(); void ReplaceWithNewModel(int32 id); diff --git a/src/buildings/Treadable.cpp b/src/buildings/Treadable.cpp index 00abbe13..d84603a6 100644 --- a/src/buildings/Treadable.cpp +++ b/src/buildings/Treadable.cpp @@ -4,5 +4,5 @@ #include "Treadable.h" #include "Pools.h" -void *CTreadable::operator new(size_t sz) { return CPools::GetTreadablePool()->New(); } -void CTreadable::operator delete(void *p, size_t sz) { CPools::GetTreadablePool()->Delete((CTreadable*)p); } +void *CTreadable::operator new(size_t sz) throw() { return CPools::GetTreadablePool()->New(); } +void CTreadable::operator delete(void *p, size_t sz) throw() { CPools::GetTreadablePool()->Delete((CTreadable*)p); } diff --git a/src/buildings/Treadable.h b/src/buildings/Treadable.h index c3ab755e..6a183c63 100644 --- a/src/buildings/Treadable.h +++ b/src/buildings/Treadable.h @@ -5,8 +5,8 @@ class CTreadable : public CBuilding { public: - static void *operator new(size_t); - static void operator delete(void*, size_t); + static void *operator new(size_t) throw(); + static void operator delete(void*, size_t) throw(); bool GetIsATreadable(void) { return true; } }; diff --git a/src/collision/ColModel.cpp b/src/collision/ColModel.cpp index 49847dbd..2224a804 100644 --- a/src/collision/ColModel.cpp +++ b/src/collision/ColModel.cpp @@ -27,7 +27,7 @@ CColModel::~CColModel(void) } void* -CColModel::operator new(size_t) +CColModel::operator new(size_t) throw() { CColModel* node = CPools::GetColModelPool()->New(); assert(node); @@ -35,7 +35,7 @@ CColModel::operator new(size_t) } void -CColModel::operator delete(void *p, size_t) +CColModel::operator delete(void *p, size_t) throw() { CPools::GetColModelPool()->Delete((CColModel*)p); } diff --git a/src/collision/ColModel.h b/src/collision/ColModel.h index cd5ae651..64f05f76 100644 --- a/src/collision/ColModel.h +++ b/src/collision/ColModel.h @@ -33,7 +33,7 @@ struct CColModel void SetLinkPtr(CLink*); void GetTrianglePoint(CVector &v, int i) const; - void *operator new(size_t); - void operator delete(void *p, size_t); + void *operator new(size_t) throw(); + void operator delete(void *p, size_t) throw(); CColModel& operator=(const CColModel& other); }; \ No newline at end of file diff --git a/src/core/Streaming.cpp b/src/core/Streaming.cpp index ee286278..6d980e18 100644 --- a/src/core/Streaming.cpp +++ b/src/core/Streaming.cpp @@ -1873,8 +1873,7 @@ CStreaming::RemoveCurrentZonesModels(void) if (ms_currentPedGrp != -1) for (i = 0; i < NUMMODELSPERPEDGROUP; i++) { ms_bIsPedFromPedGroupLoaded[i] = false; - if (CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != -1 && - CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != MI_MALE01) { + if (CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i] != -1) { SetModelIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]); SetModelTxdIsDeletable(CPopulation::ms_pPedGroups[ms_currentPedGrp].models[i]); } diff --git a/src/core/Zones.cpp b/src/core/Zones.cpp index 85564f03..26d3efb0 100644 --- a/src/core/Zones.cpp +++ b/src/core/Zones.cpp @@ -452,6 +452,7 @@ CTheZones::GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info) assert(d >= 0.0f && d <= 1.0f); n = 1.0f - d; } +#ifdef FIX_BUGS info->carDensity = day->carDensity * d + night->carDensity * n; for(i = 0; i < ARRAY_SIZE(info->carThreshold); i++) info->carThreshold[i] = day->carThreshold[i] * d + night->carThreshold[i] * n; @@ -465,6 +466,22 @@ CTheZones::GetZoneInfoForTimeOfDay(const CVector *pos, CZoneInfo *info) info->copPedThreshold = day->copPedThreshold * d + night->copPedThreshold * n; for(i = 0; i < ARRAY_SIZE(info->gangPedThreshold); i++) info->gangPedThreshold[i] = day->gangPedThreshold[i] * d + night->gangPedThreshold[i] * n; +#else + // This is a complete mess. + info->carDensity = day->carDensity * n + night->carDensity * d; + for(i = 0; i < ARRAY_SIZE(info->carThreshold); i++) + info->carThreshold[i] = night->carThreshold[i] * d + night->carThreshold[i] * n; + for(i = 0; i < ARRAY_SIZE(info->boatThreshold); i++) + info->boatThreshold[i] = night->boatThreshold[i] * d + night->boatThreshold[i] * n; + for(i = 0; i < ARRAY_SIZE(info->gangThreshold); i++) + info->gangThreshold[i] = night->gangThreshold[i] * d + night->gangThreshold[i] * n; + + info->copThreshold = night->copThreshold * d + night->copThreshold * n; + info->pedDensity = night->pedDensity * d + night->pedDensity * n; + info->copPedThreshold = night->copPedThreshold * d + night->copPedThreshold * n; + for(i = 0; i < ARRAY_SIZE(info->gangPedThreshold); i++) + info->gangPedThreshold[i] = night->gangPedThreshold[i] * d + night->gangPedThreshold[i] * n; +#endif } if(CClock::GetIsTimeInRange(5, 19)) info->pedGroup = day->pedGroup; diff --git a/src/entities/Dummy.cpp b/src/entities/Dummy.cpp index 9878b595..d62d2434 100644 --- a/src/entities/Dummy.cpp +++ b/src/entities/Dummy.cpp @@ -4,8 +4,8 @@ #include "World.h" #include "Dummy.h" -void *CDummy::operator new(size_t sz) { return CPools::GetDummyPool()->New(); } -void CDummy::operator delete(void *p, size_t sz) { CPools::GetDummyPool()->Delete((CDummy*)p); } +void *CDummy::operator new(size_t sz) throw() { return CPools::GetDummyPool()->New(); } +void CDummy::operator delete(void *p, size_t sz) throw() { CPools::GetDummyPool()->Delete((CDummy*)p); } void CDummy::Add(void) diff --git a/src/entities/Dummy.h b/src/entities/Dummy.h index 84b1ce1a..9b73eefc 100644 --- a/src/entities/Dummy.h +++ b/src/entities/Dummy.h @@ -12,8 +12,8 @@ public: void Add(void); void Remove(void); - static void *operator new(size_t); - static void operator delete(void*, size_t); + static void *operator new(size_t) throw(); + static void operator delete(void*, size_t) throw(); }; bool IsDummyPointerValid(CDummy* pDummy); diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index 0721725d..575c592c 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -25,10 +25,32 @@ int16 CObject::nNoTempObjects; //int16 CObject::nBodyCastHealth = 1000; float CObject::fDistToNearestTree; -void *CObject::operator new(size_t sz) { return CPools::GetObjectPool()->New(); } -void *CObject::operator new(size_t sz, int handle) { return CPools::GetObjectPool()->New(handle);}; -void CObject::operator delete(void *p, size_t sz) { CPools::GetObjectPool()->Delete((CObject*)p); } -void CObject::operator delete(void *p, int handle) { CPools::GetObjectPool()->Delete((CObject*)p); } +// Object pools tends to be full sometimes, let's free a temp. object in this case. +#ifdef FIX_BUGS +void *CObject::operator new(size_t sz) throw() { + CObject *obj = CPools::GetObjectPool()->New(); + if (!obj) { + CObjectPool *objectPool = CPools::GetObjectPool(); + for (int32 i = 0; i < objectPool->GetSize(); i++) { + CObject *existing = objectPool->GetSlot(i); + if (existing && existing->ObjectCreatedBy == TEMP_OBJECT) { + int32 handle = objectPool->GetIndex(existing); + CWorld::Remove(existing); + delete existing; + obj = objectPool->New(handle); + break; + } + } + } + return obj; +} +#else +void *CObject::operator new(size_t sz) throw() { return CPools::GetObjectPool()->New(); } +#endif +void *CObject::operator new(size_t sz, int handle) throw() { return CPools::GetObjectPool()->New(handle); }; + +void CObject::operator delete(void *p, size_t sz) throw() { CPools::GetObjectPool()->Delete((CObject*)p); } +void CObject::operator delete(void *p, int handle) throw() { CPools::GetObjectPool()->Delete((CObject*)p); } CObject::CObject(void) { diff --git a/src/objects/Object.h b/src/objects/Object.h index e34043a8..f59379bf 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -87,10 +87,10 @@ public: static int16 nNoTempObjects; static float fDistToNearestTree; - static void *operator new(size_t); - static void *operator new(size_t, int); - static void operator delete(void*, size_t); - static void operator delete(void*, int); + static void *operator new(size_t) throw(); + static void *operator new(size_t, int) throw(); + static void operator delete(void*, size_t) throw(); + static void operator delete(void*, int) throw(); CObject(void); CObject(int32, bool); diff --git a/src/objects/Stinger.cpp b/src/objects/Stinger.cpp index 41040d4a..29efea10 100644 --- a/src/objects/Stinger.cpp +++ b/src/objects/Stinger.cpp @@ -46,7 +46,14 @@ CStinger::Init(CPed *pPed) pOwner = pPed; for (i = 0; i < NUM_STINGER_SEGMENTS; i++) { - pSpikes[i] = new CStingerSegment; + pSpikes[i] = new CStingerSegment(); +#ifdef FIX_BUGS + if (!pSpikes[i]) { + // Abort!! Pool is full + Remove(); + return; + } +#endif pSpikes[i]->bUsesCollision = false; } bIsDeployed = true; @@ -77,8 +84,11 @@ CStinger::Remove() CStingerSegment *spikeSegment = pSpikes[i]; #ifdef FIX_BUGS - CWorld::Remove(spikeSegment); - delete spikeSegment; + if (spikeSegment) { + CWorld::Remove(spikeSegment); + delete spikeSegment; + pSpikes[i] = nil; + } #else if (spikeSegment->m_entryInfoList.first != nil) spikeSegment->bRemoveFromWorld = true; @@ -92,9 +102,15 @@ CStinger::Remove() void CStinger::Deploy(CPed *pPed) { + // So total number of stingers allowed at the same time is 2, each by different CCopPed. if (NumOfStingerSegments < NUM_STINGER_SEGMENTS*2 && !pPed->bInVehicle && pPed->IsPedInControl()) { if (!bIsDeployed && RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_THROW_UNDER) == nil) { Init(pPed); +#ifdef FIX_BUGS + // Above call won't set it to true no more when object pool is full + if (!bIsDeployed) + return; +#endif pPed->SetPedState(PED_DEPLOY_STINGER); CAnimManager::AddAnimation(pPed->GetClump(), ASSOCGRP_STD, ANIM_STD_THROW_UNDER); } @@ -167,6 +183,7 @@ CStinger::CheckForBurstTyres() } } +// Only called when bIsDeployed void CStinger::Process() { @@ -232,10 +249,11 @@ CStinger::Process() break; case STINGERSTATE_REMOVE: Remove(); - break; - } #ifdef FIX_BUGS - if (bIsDeployed) + return; +#else + break; #endif + } CheckForBurstTyres(); } \ No newline at end of file diff --git a/src/peds/CopPed.cpp b/src/peds/CopPed.cpp index f2f3ee27..1efd7733 100644 --- a/src/peds/CopPed.cpp +++ b/src/peds/CopPed.cpp @@ -93,7 +93,7 @@ CCopPed::CCopPed(eCopType copType, int32 modifier) : CPed(PEDTYPE_COP) m_nHassleTimer = 0; field_61C = 0; field_624 = 0; - m_pStinger = new CStinger; + m_pStinger = new CStinger(); SetWeaponLockOnTarget(nil); } diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index fe105645..d8c445bf 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -53,10 +53,10 @@ bool CPed::bFannyMagnetCheat; bool CPed::bPedCheat3; CVector2D CPed::ms_vec2DFleePosition; -void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); } -void *CPed::operator new(size_t sz, int handle) { return CPools::GetPedPool()->New(handle); } -void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } -void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((CPed*)p); } +void *CPed::operator new(size_t sz) throw() { return CPools::GetPedPool()->New(); } +void *CPed::operator new(size_t sz, int handle) throw() { return CPools::GetPedPool()->New(handle); } +void CPed::operator delete(void *p, size_t sz) throw() { CPools::GetPedPool()->Delete((CPed*)p); } +void CPed::operator delete(void *p, int handle) throw() { CPools::GetPedPool()->Delete((CPed*)p); } float gfTommyFatness = 1.0f; diff --git a/src/peds/Ped.h b/src/peds/Ped.h index c94cd320..c5c6cf49 100644 --- a/src/peds/Ped.h +++ b/src/peds/Ped.h @@ -650,10 +650,10 @@ public: CVector m_vecSpotToGuard; float m_radiusToGuard; - static void *operator new(size_t); - static void *operator new(size_t, int); - static void operator delete(void*, size_t); - static void operator delete(void*, int); + static void *operator new(size_t) throw(); + static void *operator new(size_t, int) throw(); + static void operator delete(void*, size_t) throw(); + static void operator delete(void*, int) throw(); CPed(uint32 pedType); ~CPed(void); diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index 13ae95d2..3d4746d2 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -1434,7 +1434,7 @@ CPopulation::PlaceGangMembersInFormation(ePedType pedType, int pedAmount, CVecto CPed *createdPeds[5]; if (!TheCamera.IsSphereVisible(coors, 3.0f) || MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) { - if (CPedPlacement::IsPositionClearForPed(coors, 3.0f, -1, 0)) { + if (CPedPlacement::IsPositionClearForPed(coors, 3.0f, -1, nil)) { bool leaderFoundGround; float leaderGroundZ = CWorld::FindGroundZFor3DCoord(coors.x, coors.y, coors.z, &leaderFoundGround) + 1.0f; if (leaderFoundGround) { @@ -1514,7 +1514,7 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c if (!TheCamera.IsSphereVisible(coors, circleR) || MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) { - if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, 0)) { + if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, nil)) { int pedIdx = 0; CVector leaderPos; #ifdef FIX_BUGS @@ -1558,9 +1558,9 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c } bool memberCanSeeLeader = createLeader ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false); - bool notTooCloseToLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f); + bool notTooHighFromLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) >= 1.0f); - if (!foundObstacle && memberCanSeeLeader && notTooCloseToLeader) { + if (!foundObstacle && memberCanSeeLeader && notTooHighFromLeader) { CPed* newPed = AddPed(pedType, gangModel, finalPos); if (newPed) { createdPeds[pedIdx++] = newPed; @@ -1573,6 +1573,9 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c newPed->bCanAttackPlayerWithCops = true; CVisibilityPlugins::SetClumpAlpha(newPed->GetClump(), 0); +#ifdef FIX_BUGS + createLeader = false; +#endif } // No. #ifndef FIX_BUGS @@ -1581,9 +1584,6 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c #endif } } -#ifdef FIX_BUGS - createLeader = false; -#endif } } if (pedIdx >= 3) { @@ -1623,7 +1623,7 @@ CPopulation::PlaceCouple(ePedType manType, int32 manModel, ePedType womanType, i return; if (!TheCamera.IsSphereVisible(coors, 1.5f) || MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) { - if (CPedPlacement::IsPositionClearForPed(coors, CModelInfo::GetModelInfo(manModel)->GetColModel()->boundingSphere.radius, -1, 0)) { + if (CPedPlacement::IsPositionClearForPed(coors, CModelInfo::GetModelInfo(manModel)->GetColModel()->boundingSphere.radius, -1, nil)) { bool manFoundGround; float manGroundZ = CWorld::FindGroundZFor3DCoord(coors.x, coors.y, coors.z, &manFoundGround) + 1.0f; if (manFoundGround) { @@ -1705,7 +1705,7 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group) if (!TheCamera.IsSphereVisible(coors, circleR) || MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) { - if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, 0)) { + if (CPedPlacement::IsPositionClearForPed(coors, circleR, -1, nil)) { int pedIdx = 0; CVector leaderPos; #ifdef FIX_BUGS @@ -1730,6 +1730,7 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group) int pedModel = ChooseCivilianOccupation(group); CPedModelInfo *pedModelInfo = (CPedModelInfo*)CModelInfo::GetModelInfo(pedModel); + if (pedModelInfo->GetRwObject()) { CEntity* obstacles[6] = { nil, nil, nil, nil, nil, nil }; CPedPlacement::IsPositionClearForPed(finalPos, CModelInfo::GetModelInfo(pedModel)->GetColModel()->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles); @@ -1751,9 +1752,9 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group) } bool memberCanSeeLeader = createLeader ? true : CWorld::GetIsLineOfSightClear(finalPos, leaderPos, true, false, false, false, false, false, false); - bool notTooCloseToLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) < 1.0f); + bool notTooHighFromLeader = createLeader ? true : !(Abs(finalPos.z - leaderPos.z) >= 1.0f); - if (!foundObstacle && memberCanSeeLeader && notTooCloseToLeader) { + if (!foundObstacle && memberCanSeeLeader && notTooHighFromLeader) { CPed *newPed = AddPed(pedModelInfo->m_pedType, pedModel, finalPos); if (newPed) { createdPeds[pedIdx++] = newPed; @@ -1764,6 +1765,9 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group) newPed->m_fRotationCur = angle; newPed->m_fearFlags = 0; CVisibilityPlugins::SetClumpAlpha(newPed->GetClump(), 0); +#ifdef FIX_BUGS + createLeader = false; +#endif } // No. #ifndef FIX_BUGS @@ -1772,9 +1776,6 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group) #endif } } -#ifdef FIX_BUGS - createLeader = false; -#endif } } if (pedIdx >= 3) { diff --git a/src/rw/MemoryMgr.cpp b/src/rw/MemoryMgr.cpp index 2379692c..b9cff043 100644 --- a/src/rw/MemoryMgr.cpp +++ b/src/rw/MemoryMgr.cpp @@ -28,10 +28,10 @@ RwMemoryFunctions memFuncs = { #ifdef USE_CUSTOM_ALLOCATOR // game seems to be using heap directly here, but this is nicer -void *operator new(size_t sz) { return MemoryMgrMalloc(sz); } -void *operator new[](size_t sz) { return MemoryMgrMalloc(sz); } -void operator delete(void *ptr) noexcept { MemoryMgrFree(ptr); } -void operator delete[](void *ptr) noexcept { MemoryMgrFree(ptr); } +void *operator new(size_t sz) throw() { return MemoryMgrMalloc(sz); } +void *operator new[](size_t sz) throw() { return MemoryMgrMalloc(sz); } +void operator delete(void *ptr) throw() { MemoryMgrFree(ptr); } +void operator delete[](void *ptr) throw() { MemoryMgrFree(ptr); } #endif void* diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 4e6c24ef..9d90c616 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -50,10 +50,10 @@ bool CVehicle::bDisableRemoteDetonationOnContact; bool CVehicle::m_bDisplayHandlingInfo; #endif -void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); } -void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehiclePool()->New(handle); } -void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); } -void CVehicle::operator delete(void *p, int handle) { CPools::GetVehiclePool()->Delete((CVehicle*)p); } +void *CVehicle::operator new(size_t sz) throw() { return CPools::GetVehiclePool()->New(); } +void *CVehicle::operator new(size_t sz, int handle) throw() { return CPools::GetVehiclePool()->New(handle); } +void CVehicle::operator delete(void *p, size_t sz) throw() { CPools::GetVehiclePool()->Delete((CVehicle*)p); } +void CVehicle::operator delete(void *p, int handle) throw() { CPools::GetVehiclePool()->Delete((CVehicle*)p); } #ifdef FIX_BUGS // I think they meant that diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h index 2fb2caf4..37b57944 100644 --- a/src/vehicles/Vehicle.h +++ b/src/vehicles/Vehicle.h @@ -278,10 +278,10 @@ public: float m_fSteerInput; uint8 m_vehType; - static void *operator new(size_t); - static void *operator new(size_t sz, int slot); - static void operator delete(void*, size_t); - static void operator delete(void*, int); + static void *operator new(size_t) throw(); + static void *operator new(size_t sz, int slot) throw(); + static void operator delete(void*, size_t) throw(); + static void operator delete(void*, int) throw(); CVehicle(void) {} // FAKE CVehicle(uint8 CreatedBy); -- cgit v1.2.3 From bd94c16e78739d2d58cec63186f1f0e4ee722169 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 22 May 2021 08:35:29 +0300 Subject: Fix C3dMarkers::PlaceMarker calls in Radar --- src/core/Radar.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp index 473f4dae..ec3335fa 100644 --- a/src/core/Radar.cpp +++ b/src/core/Radar.cpp @@ -478,7 +478,7 @@ void CRadar::Draw3dMarkers() if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) { CVector pos = entity->GetPosition(); pos.z += 1.2f * CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 2.5f; - C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 2.5f, CARBLIP_MARKER_COLOR_R, CARBLIP_MARKER_COLOR_G, CARBLIP_MARKER_COLOR_B, CARBLIP_MARKER_COLOR_A, 1024, 0.2f, 5); + C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 2.5f, CARBLIP_MARKER_COLOR_R, CARBLIP_MARKER_COLOR_G, CARBLIP_MARKER_COLOR_B, CARBLIP_MARKER_COLOR_A, 1024, 0.2f, 5); } break; } @@ -492,7 +492,7 @@ void CRadar::Draw3dMarkers() if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) { CVector pos = entity->GetPosition(); pos.z += 3.0f; - C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.5f, CHARBLIP_MARKER_COLOR_R, CHARBLIP_MARKER_COLOR_G, CHARBLIP_MARKER_COLOR_B, CHARBLIP_MARKER_COLOR_A, 1024, 0.2f, 5); + C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 1.5f, CHARBLIP_MARKER_COLOR_R, CHARBLIP_MARKER_COLOR_G, CHARBLIP_MARKER_COLOR_B, CHARBLIP_MARKER_COLOR_A, 1024, 0.2f, 5); } break; } @@ -502,7 +502,7 @@ void CRadar::Draw3dMarkers() if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) { CVector pos = entity->GetPosition(); pos.z += CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 1.0f + 1.0f; - C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.0f, OBJECTBLIP_MARKER_COLOR_R, OBJECTBLIP_MARKER_COLOR_G, OBJECTBLIP_MARKER_COLOR_B, OBJECTBLIP_MARKER_COLOR_A, 1024, 0.2f, 5); + C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 1.0f, OBJECTBLIP_MARKER_COLOR_R, OBJECTBLIP_MARKER_COLOR_G, OBJECTBLIP_MARKER_COLOR_B, OBJECTBLIP_MARKER_COLOR_A, 1024, 0.2f, 5); } break; } @@ -511,7 +511,7 @@ void CRadar::Draw3dMarkers() case BLIP_CONTACT_POINT: if (!CTheScripts::IsPlayerOnAMission()) { if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) - C3dMarkers::PlaceMarkerSet(i | (ms_RadarTrace[i].m_BlipIndex << 16), 4, ms_RadarTrace[i].m_vecPos, 2.0f, COORDBLIP_MARKER_COLOR_R, COORDBLIP_MARKER_COLOR_G, COORDBLIP_MARKER_COLOR_B, COORDBLIP_MARKER_COLOR_A, 2048, 0.2f, 0); + C3dMarkers::PlaceMarkerSet(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_CYLINDER, ms_RadarTrace[i].m_vecPos, 2.0f, COORDBLIP_MARKER_COLOR_R, COORDBLIP_MARKER_COLOR_G, COORDBLIP_MARKER_COLOR_B, COORDBLIP_MARKER_COLOR_A, 2048, 0.2f, 0); } break; } -- cgit v1.2.3 From 5bcdb933a78abb2b9b8d6648d17502240bd9fd29 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 22 May 2021 13:08:26 +0300 Subject: Use bool8 in audio code --- src/audio/AudioCollision.cpp | 29 +- src/audio/AudioLogic.cpp | 1454 ++++++++++++++++++++-------------------- src/audio/AudioManager.cpp | 124 ++-- src/audio/AudioManager.h | 116 ++-- src/audio/DMAudio.cpp | 26 +- src/audio/DMAudio.h | 22 +- src/audio/MusicManager.cpp | 274 ++++---- src/audio/MusicManager.h | 54 +- src/audio/PolRadio.cpp | 56 +- src/audio/sampman.h | 44 +- src/audio/sampman_miles.cpp | 282 ++++---- src/audio/sampman_null.cpp | 60 +- src/audio/sampman_oal.cpp | 216 +++--- src/control/Garages.cpp | 2 +- src/control/Replay.cpp | 4 +- src/control/Script.cpp | 2 +- src/control/Script4.cpp | 2 +- src/core/Frontend.cpp | 6 +- src/core/FrontendTriggers.h | 2 +- src/core/Frontend_PS2.cpp | 2 +- src/core/Game.cpp | 2 +- src/core/World.cpp | 4 +- src/objects/ParticleObject.cpp | 2 +- src/peds/Ped.cpp | 2 +- src/render/Weather.cpp | 2 +- src/vehicles/Vehicle.cpp | 2 +- src/weapons/Explosion.cpp | 2 +- 27 files changed, 1396 insertions(+), 1397 deletions(-) diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index 250cd18e..be1ee48b 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -158,7 +158,7 @@ cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollisio void cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter) { - bool distCalculated = false; + bool8 distCalculated = FALSE; if(col.m_fIntensity2 > 0.0016f) { uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col); if(emittingVol) { @@ -168,7 +168,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun m_sQueueSample.m_nCounter = counter; m_sQueueSample.m_vecPos = col.m_vecPosition; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 7; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; @@ -178,10 +178,10 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -311,7 +311,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col) if(counter >= 255) counter = 28; m_sQueueSample.m_vecPos = col.m_vecPosition; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 11; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = emittingVol; @@ -319,9 +319,9 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col) m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -332,13 +332,12 @@ void cAudioManager::ServiceCollisions() { int i, j; - bool abRepeatedCollision1[NUMAUDIOCOLLISIONS]; - bool abRepeatedCollision2[NUMAUDIOCOLLISIONS]; + bool8 abRepeatedCollision1[NUMAUDIOCOLLISIONS]; + bool8 abRepeatedCollision2[NUMAUDIOCOLLISIONS]; m_sQueueSample.m_nEntityIndex = m_nCollisionEntity; - for (int i = 0; i < NUMAUDIOCOLLISIONS; i++) - abRepeatedCollision1[i] = abRepeatedCollision2[i] = false; + for (int i = 0; i < NUMAUDIOCOLLISIONS; i++) abRepeatedCollision1[i] = abRepeatedCollision2[i] = FALSE; for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) { for (j = 0; j < NUMAUDIOCOLLISIONS; j++) { @@ -348,8 +347,8 @@ cAudioManager::ServiceCollisions() && (m_sCollisionManager.m_asCollisions1[index].m_bSurface1 == m_sCollisionManager.m_asCollisions2[j].m_bSurface1) && (m_sCollisionManager.m_asCollisions1[index].m_bSurface2 == m_sCollisionManager.m_asCollisions2[j].m_bSurface2) ) { - abRepeatedCollision1[index] = true; - abRepeatedCollision2[j] = true; + abRepeatedCollision1[index] = TRUE; + abRepeatedCollision2[j] = TRUE; m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume; SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j); break; diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 9296a154..a3493e38 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -123,62 +123,62 @@ cAudioManager::PostInitialiseGameSpecificSetup() { m_nFireAudioEntity = CreateEntity(AUDIOTYPE_FIRE, &gFireManager); if (m_nFireAudioEntity >= 0) - SetEntityStatus(m_nFireAudioEntity, true); + SetEntityStatus(m_nFireAudioEntity, TRUE); m_nCollisionEntity = CreateEntity(AUDIOTYPE_COLLISION, (void *)1); if (m_nCollisionEntity >= 0) - SetEntityStatus(m_nCollisionEntity, true); + SetEntityStatus(m_nCollisionEntity, TRUE); m_nFrontEndEntity = CreateEntity(AUDIOTYPE_FRONTEND, (void *)1); if (m_nFrontEndEntity >= 0) - SetEntityStatus(m_nFrontEndEntity, true); + SetEntityStatus(m_nFrontEndEntity, TRUE); m_nProjectileEntity = CreateEntity(AUDIOTYPE_PROJECTILE, (void *)1); if (m_nProjectileEntity >= 0) - SetEntityStatus(m_nProjectileEntity, true); + SetEntityStatus(m_nProjectileEntity, TRUE); m_nWaterCannonEntity = CreateEntity(AUDIOTYPE_WATERCANNON, (void *)1); if (m_nWaterCannonEntity >= 0) - SetEntityStatus(m_nWaterCannonEntity, true); + SetEntityStatus(m_nWaterCannonEntity, TRUE); m_nPoliceChannelEntity = CreateEntity(AUDIOTYPE_POLICERADIO, (void *)1); if (m_nPoliceChannelEntity >= 0) - SetEntityStatus(m_nPoliceChannelEntity, true); + SetEntityStatus(m_nPoliceChannelEntity, TRUE); #ifdef GTA_BRIDGE m_nBridgeEntity = CreateEntity(AUDIOTYPE_BRIDGE, (void*)1); if (m_nBridgeEntity >= 0) - SetEntityStatus(m_nBridgeEntity, true); + SetEntityStatus(m_nBridgeEntity, TRUE); #endif // GTA_BRIDGE m_nEscalatorEntity = CreateEntity(AUDIOTYPE_ESCALATOR, (void*)1); if (m_nEscalatorEntity >= 0) - SetEntityStatus(m_nEscalatorEntity, true); + SetEntityStatus(m_nEscalatorEntity, TRUE); m_nExtraSoundsEntity = CreateEntity(AUDIOTYPE_EXTRA_SOUNDS, (void*)1); if (m_nExtraSoundsEntity >= 0) - SetEntityStatus(m_nExtraSoundsEntity, true); + SetEntityStatus(m_nExtraSoundsEntity, TRUE); m_sMissionAudio.m_nSampleIndex[0] = NO_SAMPLE; m_sMissionAudio.m_nLoadingStatus[0] = LOADING_STATUS_NOT_LOADED; m_sMissionAudio.m_nPlayStatus[0] = PLAY_STATUS_STOPPED; - m_sMissionAudio.m_bIsPlaying[0] = false; - m_sMissionAudio.m_bIsPlayed[0] = false; - m_sMissionAudio.m_bPredefinedProperties[0] = true; + m_sMissionAudio.m_bIsPlaying[0] = FALSE; + m_sMissionAudio.m_bIsPlayed[0] = FALSE; + m_sMissionAudio.m_bPredefinedProperties[0] = TRUE; m_sMissionAudio.m_nMissionAudioCounter[0] = 0; - m_sMissionAudio.m_bIsMobile[0] = false; + m_sMissionAudio.m_bIsMobile[0] = FALSE; field_5538 = 127; m_sMissionAudio.m_nSampleIndex[1] = NO_SAMPLE; m_sMissionAudio.m_nLoadingStatus[1] = LOADING_STATUS_NOT_LOADED; m_sMissionAudio.m_nPlayStatus[1] = PLAY_STATUS_STOPPED; - m_sMissionAudio.m_bIsPlaying[1] = false; - m_sMissionAudio.m_bIsPlayed[1] = false; - m_sMissionAudio.m_bPredefinedProperties[1] = true; + m_sMissionAudio.m_bIsPlaying[1] = FALSE; + m_sMissionAudio.m_bIsPlayed[1] = FALSE; + m_sMissionAudio.m_bPredefinedProperties[1] = TRUE; m_sMissionAudio.m_nMissionAudioCounter[1] = 0; - m_sMissionAudio.m_bIsMobile[1] = false; + m_sMissionAudio.m_bIsMobile[1] = FALSE; field_5538 = 127; ResetAudioLogicTimers(CTimer::GetTimeInMilliseconds()); - m_bIsPlayerShutUp = false; + m_bIsPlayerShutUp = FALSE; m_nPlayerMood = PLAYER_MOOD_CALM; m_nPlayerMoodTimer = 0; } @@ -261,7 +261,7 @@ cAudioManager::ProcessReverb() const if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) { for (uint32 i = 0; i < numChannels; i++) { if (m_asActiveSamples[i].m_bReverbFlag) - SampleManager.SetChannelReverbFlag(i, true); + SampleManager.SetChannelReverbFlag(i, TRUE); } } } @@ -274,11 +274,11 @@ cAudioManager::GetDistanceSquared(const CVector &v) const } void -cAudioManager::CalculateDistance(bool &distCalculated, float dist) +cAudioManager::CalculateDistance(bool8 &distCalculated, float dist) { if (!distCalculated) { m_sQueueSample.m_fDistance = Sqrt(dist); - distCalculated = true; + distCalculated = TRUE; } } @@ -362,56 +362,56 @@ cAudioManager::ProcessEntity(int32 id) switch (m_asAudioEntities[id].m_nType) { case AUDIOTYPE_PHYSICAL: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; ProcessPhysical(id); } break; case AUDIOTYPE_EXPLOSION: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; ProcessExplosions(id); } break; case AUDIOTYPE_FIRE: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; ProcessFires(id); } break; case AUDIOTYPE_WEATHER: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; if(CGame::currArea == AREA_MAIN_MAP || CGame::currArea == AREA_EVERYWHERE) ProcessWeather(id); } break; /* case AUDIOTYPE_CRANE: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; ProcessCrane(); } break;*/ case AUDIOTYPE_SCRIPTOBJECT: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; ProcessScriptObject(id); } break; #ifdef GTA_BRIDGE case AUDIOTYPE_BRIDGE: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; ProcessBridge(); } break; #endif case AUDIOTYPE_FRONTEND: - m_sQueueSample.m_bReverbFlag = false; + m_sQueueSample.m_bReverbFlag = FALSE; ProcessFrontEnd(); break; case AUDIOTYPE_PROJECTILE: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; ProcessProjectiles(); } break; @@ -421,25 +421,25 @@ cAudioManager::ProcessEntity(int32 id) break; case AUDIOTYPE_FIREHYDRANT: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; ProcessFireHydrant(); } break; case AUDIOTYPE_WATERCANNON: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; ProcessWaterCannon(id); } break; case AUDIOTYPE_ESCALATOR: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; ProcessEscalators(); } break; case AUDIOTYPE_EXTRA_SOUNDS: if (!m_nUserPause) { - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; ProcessExtraSounds(); } break; @@ -719,25 +719,25 @@ const tVehicleSampleData aVehicleSettings[MAX_CARS] = { -bool bPlayerJustEnteredCar; - -const bool hornPatternsArray[8][44] = { - {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false, - false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false}, - {false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, - true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false}, - {false, false, true, true, true, true, true, true, true, true, true, true, false, false, false, false, true, true, true, true, true, false, - false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, false}, - {false, false, true, true, true, true, true, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true, - true, true, true, true, true, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false}, - {false, false, true, true, true, true, true, true, true, true, true, false, false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}, - {false, false, true, true, true, false, false, false, true, true, true, false, false, false, false, false, false, false, false, false, false, false, - false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false}, - {false, false, true, true, true, true, false, false, false, false, true, true, true, false, false, true, true, true, false, false, true, true, - true, true, true, true, false, false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, false, false}, - {false, false, true, true, true, true, false, false, true, true, true, true, true, false, false, false, true, true, true, true, true, true, - false, false, false, false, true, true, true, true, true, true, true, true, true, true, true, true, true, false, false, false, false, false}, +bool8 bPlayerJustEnteredCar; + +const bool8 hornPatternsArray[8][44] = { + {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, + FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, + TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, + FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, + TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, + FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, + FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, + TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE}, + {FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, + FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE}, }; void cAudioManager::ProcessVehicle(CVehicle* veh) @@ -756,7 +756,7 @@ void cAudioManager::ProcessVehicle(CVehicle* veh) || CGame::currArea == AREA_MALL || CGame::currArea == AREA_MAIN_MAP) { m_sQueueSample.m_vecPos = veh->GetPosition(); - params.m_bDistanceCalculated = false; + params.m_bDistanceCalculated = FALSE; params.m_pVehicle = veh; params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); params.m_pTransmission = veh->pHandling != nil ? &veh->pHandling->Transmission : nil; @@ -882,7 +882,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params) veh->m_bRainSamplesCounter = 68; m_sQueueSample.m_nSampleIndex = (m_anRandomTable[1] & 3) + SFX_CAR_RAIN_1; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 9; m_sQueueSample.m_nFrequency = m_anRandomTable[1] % 4000 + 28000; m_sQueueSample.m_nLoopCount = 1; @@ -891,15 +891,15 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = false; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bReverbFlag = FALSE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } } -bool +bool8 cAudioManager::ProcessReverseGear(cVehicleParams& params) { const int reverseGearIntensity = 30; @@ -909,10 +909,10 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params) uint8 emittingVolume; if (params.m_fDistance >= SQR(reverseGearIntensity)) - return false; + return FALSE; automobile = (CAutomobile*)params.m_pVehicle; if (automobile->m_modelIndex == MI_CADDY) - return true; + return TRUE; if (automobile->bEngineOn && (automobile->m_fGasPedal < 0.0f || automobile->m_nCurrentGear == 0)) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); if (automobile->m_nDriveWheelsOnGround != 0) { @@ -935,7 +935,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params) m_sQueueSample.m_nSampleIndex = SFX_REVERSE_GEAR; } m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nFrequency = (6000.0f * modificator) + 7000; m_sQueueSample.m_nLoopCount = 0; @@ -944,14 +944,14 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = reverseGearIntensity; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } - return true; + return TRUE; } void @@ -966,14 +966,14 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) int16 acceletateState; int16 brakeState; uint8 volume; - bool isPlayerVeh; - bool vehSlowdown; + bool8 isPlayerVeh; + bool8 vehSlowdown; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) return; if (FindPlayerVehicle() == params.m_pVehicle) - isPlayerVeh = true; + isPlayerVeh = TRUE; else #ifdef FIX_BUGS isPlayerVeh = CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle == params.m_pVehicle; @@ -999,7 +999,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_RC_REV; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; @@ -1008,10 +1008,10 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_RC_REV); m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -1030,11 +1030,11 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) if (acceletateState < brakeState) acceletateState = brakeState; if (acceletateState <= 0) { - vehSlowdown = true; + vehSlowdown = TRUE; volume = 127; freq = 18000; } else { - vehSlowdown = false; + vehSlowdown = FALSE; volume = Min(127, (127 * acceletateState / 255) * 3.0f * Abs(params.m_fVelocityChange)); freq = Min(22000, (8000 * acceletateState / 255 + 14000) * 3.0f * Abs(params.m_fVelocityChange)); } @@ -1064,7 +1064,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeDivider = 4; } m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; @@ -1073,9 +1073,9 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -1096,7 +1096,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params) static uint32 prevFreq = 22050; uint32 freq; - bool isPlayerVeh; + bool8 isPlayerVeh; int16 acceletateState; int16 brakeState; @@ -1104,7 +1104,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params) return; if (FindPlayerVehicle() == params.m_pVehicle) - isPlayerVeh = true; + isPlayerVeh = TRUE; else #ifdef FIX_BUGS isPlayerVeh = CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle == params.m_pVehicle; @@ -1127,7 +1127,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params) m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_CAR_RC_HELI; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; @@ -1136,17 +1136,17 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_RC_HELI); m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } if (isPlayerVeh) prevFreq = freq; } -bool +bool8 cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) { const float SOUND_INTENSITY = 95.0f; @@ -1159,10 +1159,10 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) uint8 wheelsOnGround; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return false; + return FALSE; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return false; + return FALSE; switch (params.m_VehicleType) { case VEHICLE_TYPE_CAR: wheelsOnGround = ((CAutomobile*)params.m_pVehicle)->m_nWheelsOnGround; @@ -1175,7 +1175,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) break; } if (params.m_pTransmission == nil || wheelsOnGround == 0) - return true; + return TRUE; velocity = Abs(params.m_fVelocityChange); if (velocity > 0.0f) { @@ -1185,7 +1185,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; if (params.m_pVehicle->m_nSurfaceTouched == SURFACE_WATER) { m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; @@ -1203,18 +1203,18 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } - return true; + return TRUE; } -bool +bool8 cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) { const float SOUND_INTENSITY = 30.0f; @@ -1227,7 +1227,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) uint8 wheelsOnGround; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return false; + return FALSE; switch (params.m_VehicleType) { case VEHICLE_TYPE_CAR: wheelsOnGround = ((CAutomobile*)params.m_pVehicle)->m_nWheelsOnGround; @@ -1240,7 +1240,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) break; } if (params.m_pTransmission == nil || wheelsOnGround == 0) - return true; + return TRUE; velocity = Abs(params.m_fVelocityChange); if (velocity > 0.0f) { @@ -1252,7 +1252,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_ROAD_NOISE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; multiplier = (m_sQueueSample.m_fDistance / SOUND_INTENSITY) * 0.5f; freq = SampleManager.GetSampleBaseFrequency(SFX_ROAD_NOISE); @@ -1263,15 +1263,15 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } - return true; + return TRUE; } void @@ -1296,11 +1296,11 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) float relativeChange; float modificator; float traction; - bool isMoped; - bool caddyBool; + bool8 isMoped; + bool8 caddyBool; - isMoped = false; - caddyBool = false; + isMoped = FALSE; + caddyBool = FALSE; traction = 0.0f; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) return; @@ -1322,12 +1322,12 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) switch (veh->m_modelIndex) { case MI_PIZZABOY: case MI_FAGGIO: - isMoped = true; + isMoped = TRUE; currentGear = transmission->nNumberOfGears; break; case MI_CADDY: currentGear = transmission->nNumberOfGears; - caddyBool = true; + caddyBool = TRUE; break; default: currentGear = veh->m_nCurrentGear; @@ -1354,7 +1354,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) } if (wheelsOnGround != 0) { - if (!veh->bIsHandbrakeOn || isMoped && caddyBool) { //mb bug, bcs it's can't be true together + if (!veh->bIsHandbrakeOn || isMoped && caddyBool) { //mb bug, bcs it's can't be TRUE together if (veh->GetStatus() == STATUS_SIMPLE || isMoped || caddyBool) { traction = 0.0f; } else { @@ -1478,7 +1478,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) m_sQueueSample.m_nFrequency = freq + 20 * m_sQueueSample.m_nBankIndex % 100; } m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_5 || m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_5) m_sQueueSample.m_nFrequency /= 2; @@ -1488,10 +1488,10 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 8; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -1517,7 +1517,7 @@ void cAudioManager::PlayerJustGotInCar() const { if (m_bIsInitialised) - bPlayerJustEnteredCar = true; + bPlayerJustEnteredCar = TRUE; } void @@ -1527,7 +1527,7 @@ cAudioManager::PlayerJustLeftCar(void) const } void -cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank, uint8 counter, bool notLooping) +cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank, uint8 counter, bool8 notLooping) { m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, 50.f, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { @@ -1538,7 +1538,7 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sampl #else m_sQueueSample.m_nBankIndex = SFX_BANK_0; #endif // GTA_PS2 - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nFrequency = freq; if (notLooping) { @@ -1552,9 +1552,9 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sampl m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -1569,7 +1569,7 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) m_sQueueSample.m_nCounter = 52; m_sQueueSample.m_nSampleIndex = SFX_CESNA_IDLE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nFrequency = 12500; m_sQueueSample.m_nLoopCount = 0; @@ -1579,9 +1579,9 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = 200.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } if(params.m_fDistance < SQR(90)) { @@ -1590,7 +1590,7 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_CESNA_REV; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nFrequency = 25000; m_sQueueSample.m_nLoopCount = 0; @@ -1600,9 +1600,9 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = 90.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -1639,32 +1639,32 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh float velocityChangeForAudio; float relativeVelocityChange; float time; - bool channelUsed; - bool lostTraction; - bool noGearBox; - bool stuckInSand; - bool processedAccelSampleStopped; - bool isMoped; + bool8 channelUsed; + bool8 lostTraction; + bool8 noGearBox; + bool8 stuckInSand; + bool8 processedAccelSampleStopped; + bool8 isMoped; static uint32 gearSoundStartTime = CTimer::GetTimeInMilliseconds(); static int32 nCruising = 0; static int16 LastAccel = 0; static uint8 CurrentPretendGear = 1; - static bool bLostTractionLastFrame = false; - static bool bHandbrakeOnLastFrame = false; - static bool bAccelSampleStopped = true; + static bool8 bLostTractionLastFrame = FALSE; + static bool8 bHandbrakeOnLastFrame = FALSE; + static bool8 bAccelSampleStopped = TRUE; - lostTraction = false; + lostTraction = FALSE; isMoped = params.m_pVehicle->m_modelIndex == MI_PIZZABOY || params.m_pVehicle->m_modelIndex == MI_FAGGIO; - processedAccelSampleStopped = false; + processedAccelSampleStopped = FALSE; if (bPlayerJustEnteredCar) { - bAccelSampleStopped = true; - bPlayerJustEnteredCar = false; + bAccelSampleStopped = TRUE; + bPlayerJustEnteredCar = FALSE; nCruising = 0; LastAccel = 0; - bLostTractionLastFrame = false; + bLostTractionLastFrame = FALSE; CurrentPretendGear = 1; - bHandbrakeOnLastFrame = false; + bHandbrakeOnLastFrame = FALSE; } if (CReplay::IsPlayingBack()) { accelerateState = (255.0f * clamp(params.m_pVehicle->m_fGasPedal, 0.0f, 1.0f)); @@ -1720,26 +1720,26 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh ++wheelInUseCounter; } if (wheelInUseCounter > 2) - lostTraction = true; + lostTraction = TRUE; } break; case 'F': if (params.m_VehicleType == VEHICLE_TYPE_BIKE) { if (wheelState[BIKEWHEEL_FRONT] != WHEEL_STATE_NORMAL) - lostTraction = true; + lostTraction = TRUE; } else { if ((wheelState[CARWHEEL_FRONT_LEFT] != WHEEL_STATE_NORMAL || wheelState[CARWHEEL_FRONT_RIGHT] != WHEEL_STATE_NORMAL) && (wheelState[CARWHEEL_REAR_LEFT] != WHEEL_STATE_NORMAL || wheelState[CARWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL)) - lostTraction = true; + lostTraction = TRUE; } break; case 'R': if (params.m_VehicleType == VEHICLE_TYPE_BIKE) { if (wheelState[BIKEWHEEL_REAR] != WHEEL_STATE_NORMAL) - lostTraction = true; + lostTraction = TRUE; } else { if (wheelState[CARWHEEL_REAR_LEFT] != WHEEL_STATE_NORMAL || wheelState[CARWHEEL_REAR_RIGHT] != WHEEL_STATE_NORMAL) - lostTraction = true; + lostTraction = TRUE; } break; default: @@ -1761,7 +1761,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh gearSoundLength = 0; engineSoundType = aVehicleSettings[params.m_nIndex].m_nBank; soundOffset = 3 * (engineSoundType - CAR_SFX_BANKS_OFFSET); - noGearBox = false; + noGearBox = FALSE; switch (engineSoundType) { case SFX_BANK_PONTIAC: gearSoundLength = 2526; @@ -1806,7 +1806,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh gearSoundLength = 2410; break; default: - noGearBox = true; + noGearBox = TRUE; break; } if (!channelUsed || nCruising || noGearBox) { @@ -1814,7 +1814,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh } else { gearSoundLength -= 1000; if (CTimer::GetTimeInMilliseconds() - gearSoundStartTime > gearSoundLength) { - channelUsed = false; + channelUsed = FALSE; gearSoundStartTime = CTimer::GetTimeInMilliseconds(); } } @@ -1838,7 +1838,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh if (params.m_fVelocityChange < -0.001f) { if (channelUsed) { SampleManager.StopChannel(m_nActiveSamples); - bAccelSampleStopped = true; + bAccelSampleStopped = TRUE; } if (wheelsOnGround == 0 || params.m_pVehicle->bIsHandbrakeOn || lostTraction) gasPedalAudio = *gasPedalAudioPtr; @@ -1850,7 +1850,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh } else if (LastAccel > 0) { if (channelUsed) { SampleManager.StopChannel(m_nActiveSamples); - bAccelSampleStopped = true; + bAccelSampleStopped = TRUE; } nCruising = 0; if (wheelsOnGround == 0 @@ -1871,7 +1871,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh vol /= 4; if (engineSoundType == SFX_BANK_TRUCK) freq /= 2; - AddPlayerCarSample(vol, freq, soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1, engineSoundType, 63, false); + AddPlayerCarSample(vol, freq, soundOffset + SFX_CAR_FINGER_OFF_ACCEL_1, engineSoundType, 63, FALSE); } } freq = (10000.f * gasPedalAudio) + 22050; @@ -1880,7 +1880,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh freq /= 2; if (params.m_pVehicle->bIsDrowning) vol /= 4; - AddPlayerCarSample(vol, freq, engineSoundType - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1, SFX_BANK_0, 52, true); + AddPlayerCarSample(vol, freq, engineSoundType - CAR_SFX_BANKS_OFFSET + SFX_CAR_IDLE_1, SFX_BANK_0, 52, TRUE); CurrentPretendGear = Max(1, currentGear); } @@ -1911,18 +1911,18 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh freq /= 2; if (channelUsed) { SampleManager.StopChannel(m_nActiveSamples); - bAccelSampleStopped = true; + bAccelSampleStopped = TRUE; } if (params.m_pVehicle->bIsDrowning) vol /= 4; - AddPlayerCarSample(vol, freq, engineSoundType - CAR_SFX_BANKS_OFFSET + SFX_CAR_REV_1, SFX_BANK_0, 2, true); + AddPlayerCarSample(vol, freq, engineSoundType - CAR_SFX_BANKS_OFFSET + SFX_CAR_REV_1, SFX_BANK_0, 2, TRUE); } else { TranslateEntity(&m_sQueueSample.m_vecPos, &pos); if (bAccelSampleStopped) { if (CurrentPretendGear != 1 || currentGear != 2) CurrentPretendGear = Max(1, currentGear - 1); - processedAccelSampleStopped = true; - bAccelSampleStopped = false; + processedAccelSampleStopped = TRUE; + bAccelSampleStopped = FALSE; } if (channelUsed) { SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 120); @@ -1933,12 +1933,12 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh freq /= 2; SampleManager.SetChannelFrequency(m_nActiveSamples, freq); if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != FALSE); SampleManager.StartChannel(m_nActiveSamples); } } else if (processedAccelSampleStopped) { gearSoundStartTime = CTimer::GetTimeInMilliseconds(); - params.m_pVehicle->bAudioChangingGear = true; + params.m_pVehicle->bAudioChangingGear = TRUE; if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0)) return; SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); @@ -1952,13 +1952,13 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh freq /= 2; SampleManager.SetChannelFrequency(m_nActiveSamples, freq); if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != FALSE); SampleManager.StartChannel(m_nActiveSamples); } } else if (CurrentPretendGear < params.m_pTransmission->nNumberOfGears - 1) { ++CurrentPretendGear; gearSoundStartTime = CTimer::GetTimeInMilliseconds(); - params.m_pVehicle->bAudioChangingGear = true; + params.m_pVehicle->bAudioChangingGear = TRUE; if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0)) return; SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); @@ -1972,7 +1972,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh freq /= 2; SampleManager.SetChannelFrequency(m_nActiveSamples, freq); if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != false); + SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != FALSE); SampleManager.StartChannel(m_nActiveSamples); } } else { @@ -1982,7 +1982,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh } } else { PlayCruising: - bAccelSampleStopped = true; + bAccelSampleStopped = TRUE; SampleManager.StopChannel(m_nActiveSamples); if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn && !lostTraction && currentGear >= params.m_pTransmission->nNumberOfGears - 1) { @@ -1995,7 +1995,7 @@ PlayCruising: freq = 27 * nCruising + freqModifier + 22050; if (engineSoundType == SFX_BANK_TRUCK) freq /= 2; - AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, true); + AddPlayerCarSample(120, freq, soundOffset + SFX_CAR_AFTER_ACCEL_1, engineSoundType, 64, TRUE); } else { nCruising = 0; } @@ -2007,7 +2007,7 @@ PlayCruising: return; } -bool +bool8 cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) { const float SOUND_INTENSITY = 40.0f; @@ -2026,7 +2026,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) float skidVal = 0.0f; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return false; + return FALSE; switch (params.m_VehicleType) { case VEHICLE_TYPE_CAR: automobile = (CAutomobile*)params.m_pVehicle; @@ -2044,10 +2044,10 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) break; default: debug("\n * AUDIOLOG: ProcessVehicleSkidding() Unsupported vehicle type %d * \n", params.m_VehicleType); - return true; + return TRUE; } if (wheelsOnGround == 0) - return true; + return TRUE; CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); for (int32 i = 0; i < numWheels; i++) { @@ -2089,7 +2089,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) m_sQueueSample.m_nFrequency = 13000.f * skidVal + 35000.f; m_sQueueSample.m_nVolume /= 4; if (m_sQueueSample.m_nVolume == 0) - return true; + return TRUE; break; case SURFACE_GRAVEL: case SURFACE_MUD_DRY: @@ -2109,7 +2109,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) } m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 8; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; @@ -2117,14 +2117,14 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } - return true; + return TRUE; } float @@ -2173,7 +2173,7 @@ cAudioManager::GetVehicleNonDriveWheelSkidValue(CVehicle *veh, tWheelState wheel return Max(relativeVelChange, Min(1.0f, Abs(veh->m_vecTurnSpeed.z) * 20.0f)); } -bool +bool8 cAudioManager::ProcessVehicleHorn(cVehicleParams& params) { const float SOUND_INTENSITY = 40.0f; @@ -2182,17 +2182,17 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) uint8 volume; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return false; + return FALSE; veh = params.m_pVehicle; if (veh->m_bSirenOrAlarm && UsesSirenSwitching(params)) - return true; + return TRUE; if (veh->m_modelIndex == MI_MRWHOOP) - return true; + return TRUE; if (veh->IsAlarmOn()) - return true; + return TRUE; if (veh->m_nCarHornTimer != 0) { if (veh->GetStatus() != STATUS_PLAYER) { @@ -2201,7 +2201,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) veh->m_nCarHornPattern = (m_FrameCounter + m_sQueueSample.m_nEntityIndex) & 7; if (!hornPatternsArray[veh->m_nCarHornPattern][44 - veh->m_nCarHornTimer]) - return true; + return TRUE; } CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); @@ -2211,7 +2211,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) m_sQueueSample.m_nCounter = 4; m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nHornSample; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nFrequency = aVehicleSettings[params.m_nIndex].m_nHornFrequency; m_sQueueSample.m_nLoopCount = 0; @@ -2224,31 +2224,31 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 5.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } - return true; + return TRUE; } -bool +bool8 cAudioManager::UsesSiren(cVehicleParams& params) const { return params.m_pVehicle->UsesSiren(); } -bool +bool8 cAudioManager::UsesSirenSwitching(cVehicleParams& params) const { if (params.m_nIndex == FIRETRUK || params.m_nIndex == MRWHOOP) - return false; + return FALSE; return UsesSiren(params); } -bool +bool8 cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) { const float SOUND_INTENSITY = 110.0f; @@ -2257,18 +2257,18 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) uint8 volume; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return false; + return FALSE; veh = params.m_pVehicle; if (!veh->m_bSirenOrAlarm && !veh->IsAlarmOn()) - return true; + return TRUE; if (veh->IsAlarmOn()) { if (CTimer::GetTimeInMilliseconds() > veh->m_nCarHornTimer) veh->m_nCarHornTimer = CTimer::GetTimeInMilliseconds() + 750; if (veh->m_nCarHornTimer < CTimer::GetTimeInMilliseconds() + 375) - return true; + return TRUE; } CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); @@ -2278,7 +2278,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) m_sQueueSample.m_nCounter = 5; if (UsesSiren(params)) { if (params.m_pVehicle->GetStatus() == STATUS_ABANDONED) - return true; + return TRUE; if (veh->m_nCarHornTimer != 0 && params.m_nIndex != FIRETRUK && params.m_nIndex != MRWHOOP) { m_sQueueSample.m_nSampleIndex = SFX_SIREN_FAST; if (params.m_nIndex == FBIRANCH) @@ -2298,7 +2298,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) m_sQueueSample.m_nFrequency = aVehicleSettings[params.m_nIndex].m_nHornFrequency; } m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = volume; @@ -2306,22 +2306,22 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 7.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } - return true; + return TRUE; } -bool +bool8 cAudioManager::UsesReverseWarning(int32 model) const { return model == LINERUN || model == FIRETRUK || model == BUS || model == COACH || model == PACKER || model == FLATBED; } -bool +bool8 cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params) { const float SOUND_INTENSITY = 50.0f; @@ -2330,7 +2330,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params) uint8 volume; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return false; + return FALSE; if (veh->bEngineOn && veh->m_fGasPedal < 0.0f) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); @@ -2340,7 +2340,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params) m_sQueueSample.m_nCounter = 12; m_sQueueSample.m_nSampleIndex = SFX_REVERSE_WARNING; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nFrequency = (100 * m_sQueueSample.m_nEntityIndex & 1023) + SampleManager.GetSampleBaseFrequency(SFX_REVERSE_WARNING); m_sQueueSample.m_nLoopCount = 0; @@ -2353,17 +2353,17 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } - return true; + return TRUE; } -bool +bool8 cAudioManager::ProcessVehicleDoors(cVehicleParams& params) { const float SOUND_INTENSITY = 40.0f; @@ -2374,7 +2374,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params) float velocity; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return false; + return FALSE; automobile = (CAutomobile *)params.m_pVehicle; CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); @@ -2391,7 +2391,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params) m_sQueueSample.m_nSampleIndex = m_anRandomTable[1] % 6 + SFX_COL_CAR_PANEL_1; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) + RandomDisplacement(1000); m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 10; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = emittingVol; @@ -2399,19 +2399,19 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_fSpeedMultiplier = 1.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; AddSampleToRequestedQueue(); } } } } } - return true; + return TRUE; } -bool +bool8 cAudioManager::ProcessAirBrakes(cVehicleParams& params) { const float SOUND_INTENSITY = 30.0f; @@ -2419,14 +2419,14 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params) uint8 volume; if (params.m_fDistance > SQR(SOUND_INTENSITY)) - return false; + return FALSE; automobile = (CAutomobile *)params.m_pVehicle; if (!automobile->bEngineOn) - return true; + return TRUE; if ((automobile->m_fVelocityChangeForAudio < 0.025f || params.m_fVelocityChange >= 0.025f) && (automobile->m_fVelocityChangeForAudio > -0.025f || params.m_fVelocityChange <= 0.025f)) - return true; + return TRUE; CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); volume = m_anRandomTable[0] % 10 + 70; @@ -2437,7 +2437,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_AIR_BRAKES); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 10; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = volume; @@ -2445,23 +2445,23 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } - return true; + return TRUE; } -bool +bool8 cAudioManager::HasAirBrakes(int32 model) const { return model == LINERUN || model == FIRETRUK || model == TRASH || model == BUS || model == BARRACKS || model == COACH || model == PACKER || model == FLATBED; } -bool +bool8 cAudioManager::ProcessEngineDamage(cVehicleParams& params) { const float SOUND_INTENSITY = 40.0f; @@ -2470,11 +2470,11 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params) uint8 emittingVolume; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return false; + return FALSE; if (params.m_pVehicle->m_modelIndex == MI_CADDY) - return true; + return TRUE; if (params.m_pVehicle->GetStatus() == STATUS_WRECKED) - return true; + return TRUE; health = params.m_pVehicle->m_fHealth; if (health < 390.0f) { if (health < 250.0f) { @@ -2495,24 +2495,24 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params) if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 28; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVolume; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } - return true; + return TRUE; } -bool +bool8 cAudioManager::ProcessCarBombTick(cVehicleParams& params) { const float SOUND_INTENSITY = 40.0f; @@ -2521,7 +2521,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params) uint8 bombType; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return false; + return FALSE; if (params.m_pVehicle->bEngineOn) { switch (params.m_VehicleType) { case VEHICLE_TYPE_CAR: @@ -2532,7 +2532,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params) break; default: debug("\n * AUDIOLOG: ProcessCarBombTick() Unsupported vehicle type %d * \n", params.m_VehicleType); - return true; + return TRUE; break; } if (bombType == CARBOMB_TIMEDACTIVE) { @@ -2542,7 +2542,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params) m_sQueueSample.m_nCounter = 35; m_sQueueSample.m_nSampleIndex = SFX_COUNTDOWN; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COUNTDOWN); m_sQueueSample.m_nLoopCount = 0; @@ -2551,15 +2551,15 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } } - return true; + return TRUE; } void @@ -2569,15 +2569,15 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) uint8 emittingVol; float relVol; float vol; - bool noReflections; - bool isHeli; + bool8 noReflections; + bool8 isHeli; float maxDist; static uint8 GunIndex = 53; for (int i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { - noReflections = false; - isHeli = false; - m_sQueueSample.m_bRequireReflection = false; + noReflections = FALSE; + isHeli = FALSE; + m_sQueueSample.m_bRequireReflection = FALSE; event = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; switch (event) { case SOUND_CAR_DOOR_CLOSE_BONNET: @@ -2620,7 +2620,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bRequireReflection = TRUE; break; } case SOUND_CAR_DOOR_OPEN_BONNET: @@ -2660,7 +2660,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bRequireReflection = TRUE; break; } case SOUND_CAR_WINDSHIELD_CRACK: { @@ -2735,7 +2735,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bRequireReflection = TRUE; break; } case SOUND_CAR_LIGHT_BREAK: { @@ -2780,7 +2780,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_nReleasingVolumeDivider = 7; - noReflections = true; + noReflections = TRUE; maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[0] % 15 + 55; break; @@ -2865,7 +2865,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; emittingVol = (37.0f * vol * 625.0f / 24.0f) + 90; maxDist = SQR(SOUND_INTENSITY); - noReflections = true; + noReflections = TRUE; break; } case SOUND_CAR_BOMB_TICK: { @@ -2878,7 +2878,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bRequireReflection = TRUE; emittingVol = 60; break; } @@ -2960,8 +2960,8 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = true; - isHeli = true; + m_sQueueSample.m_bRequireReflection = TRUE; + isHeli = TRUE; break; default: { @@ -3014,7 +3014,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bRequireReflection = TRUE; break; } } @@ -3046,7 +3046,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bRequireReflection = TRUE; emittingVol = 50; maxDist = SQR(SOUND_INTENSITY); break; @@ -3060,7 +3060,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) } /* case SOUND_PED_BODYCAST_HIT: pedParams.m_pPed = nil; - pedParams.m_bDistanceCalculated = false; + pedParams.m_bDistanceCalculated = FALSE; pedParams.m_fDistance = 0.0f; pedParams.m_bDistanceCalculated = params.m_bDistanceCalculated; pedParams.m_fDistance = params.m_fDistance; @@ -3087,7 +3087,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bRequireReflection = TRUE; emittingVol = m_anRandomTable[4] % 20 + 90; break; } @@ -3105,7 +3105,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[4] % 20 + 55; CrunchOffset %= 2; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bRequireReflection = TRUE; break; } case SOUND_CAR_PED_COLLISION: { @@ -3135,18 +3135,18 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) if (m_sQueueSample.m_nVolume != 0) { if (noReflections) { m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; } else { m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; } m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; if (isHeli) { if (0.2f * m_sQueueSample.m_fSoundIntensity > m_sQueueSample.m_fDistance) { - m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nOffset = 0; #ifdef THIS_IS_STUPID goto AddSample; @@ -3157,14 +3157,14 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nCounter = GunIndex++; if (GunIndex > 58) GunIndex = 53; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); continue; #endif } - isHeli = false; + isHeli = FALSE; } - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; #ifdef THIS_IS_STUPID AddSample: AddSampleToRequestedQueue(); @@ -3188,7 +3188,7 @@ AddSample: } #ifdef GTA_TRAIN -bool +bool8 cAudioManager::ProcessTrainNoise(cVehicleParams& params) { const float SOUND_INTENSITY = 300.0f; @@ -3198,7 +3198,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) float speedMultipler; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return false; + return FALSE; if (params.m_fVelocityChange > 0.0f) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); @@ -3211,7 +3211,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_nCounter = 32; m_sQueueSample.m_nSampleIndex = SFX_TRAIN_FAR; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_FAR); m_sQueueSample.m_nLoopCount = 0; @@ -3220,10 +3220,10 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -3234,7 +3234,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_nCounter = 33; m_sQueueSample.m_nSampleIndex = SFX_TRAIN_NEAR; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_NEAR) + 100 * m_sQueueSample.m_nEntityIndex % 987; m_sQueueSample.m_nLoopCount = 0; @@ -3243,24 +3243,24 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } } - return true; + return TRUE; } #endif -bool +bool8 cAudioManager::ProcessBoatEngine(cVehicleParams& params) { CBoat *boat; float padRelativeAccerate; - bool isV12 = false; + bool8 isV12 = FALSE; static int32 LastFreq = 2000; static int8 LastVol = 0; @@ -3269,7 +3269,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) if (params.m_fDistance < SQR(intensity)) { boat = (CBoat *)params.m_pVehicle; if(boat->GetStatus() == STATUS_WRECKED) - return true; + return TRUE; float freqModificator; float volModificator; @@ -3291,7 +3291,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) case MI_JETMAX: freqModificator = 6000.0f; volModificator = 60.0f; - isV12 = true; + isV12 = TRUE; BaseFreq = 9000; BaseVol = 20; break; @@ -3309,18 +3309,18 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) BaseFreq = 1782; break; default: - return true; + return TRUE; } - bool bIsPlayerVeh; + bool8 bIsPlayerVeh; if(FindPlayerVehicle() == params.m_pVehicle) { float padAccelerate = Max(Pads[0].GetAccelerate(), Pads[0].GetBrake()); padRelativeAccerate = padAccelerate / 255.0f; - bIsPlayerVeh = true; + bIsPlayerVeh = TRUE; } else { padRelativeAccerate = Max(params.m_pVehicle->m_fGasPedal, params.m_pVehicle->m_fBrakePedal); - bIsPlayerVeh = false; + bIsPlayerVeh = FALSE; } int Freq = BaseFreq + (padRelativeAccerate * freqModificator); @@ -3358,7 +3358,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) else m_sQueueSample.m_nSampleIndex = SFX_BOAT_CRUISER_LOOP; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = Vol; @@ -3366,10 +3366,10 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = intensity; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -3383,7 +3383,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; m_sQueueSample.m_nFrequency += (m_sQueueSample.m_nEntityIndex * 65536) % 1000; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = 80; @@ -3391,10 +3391,10 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = intensity; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -3402,12 +3402,12 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) LastFreq = Freq; LastVol = Vol; } - return true; + return TRUE; } - return false; + return FALSE; } -bool +bool8 cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params) { float velocityChange; @@ -3415,11 +3415,11 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params) float multiplier; if (params.m_fDistance > SQR(50)) - return false; + return FALSE; velocityChange = Abs(params.m_fVelocityChange); if (velocityChange <= 0.0005f && ((CBoat*)params.m_pVehicle)->bBoatInWater) - return true; + return TRUE; velocityChange = Min(0.75f, velocityChange); multiplier = (velocityChange - 0.0005f) / (1499.0f / 2000.0f); @@ -3430,7 +3430,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params) m_sQueueSample.m_nCounter = 38; m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nFrequency = (6050.f * multiplier) + 16000; m_sQueueSample.m_nLoopCount = 0; @@ -3439,14 +3439,14 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 6; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } - return true; + return TRUE; } void @@ -3466,12 +3466,12 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) float propellerSpeed; float freqModifier; //may be relate to angle with horison float cameraAngle; - bool distanceCalculatedOld; + bool8 distanceCalculatedOld; float distanceOld; CVector vecPosOld; float volumeModifier;//TODO find better name - bool hunterBool; + bool8 hunterBool; static uint32 freqFrontPrev = 14287; static uint32 freqPropellerPrev = 7143; @@ -3479,7 +3479,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) boat = nil; automobile = nil; - hunterBool = false; + hunterBool = FALSE; if (params.m_fDistance >= SQR(SOUND_INTENSITY)) return; @@ -3535,7 +3535,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); } - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; @@ -3543,10 +3543,10 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -3563,7 +3563,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) if (playerVeh == veh && (accelerateState > 0 || brakeState > 0) && freq < 1300)//unnesesary freqModifier alredy <= 1300 freq = 1300; if (veh->m_modelIndex == MI_HUNTER) - hunterBool = true; + hunterBool = TRUE; } @@ -3576,7 +3576,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nSampleIndex = SFX_HELI_APACHE_1; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = (volumeModifier + 1.0f) * 16000 + freq; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; @@ -3584,10 +3584,10 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 140.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } else if (boat != nil) { m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO1; @@ -3602,7 +3602,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nFrequency = clamp2(m_sQueueSample.m_nFrequency, freqFrontPrev, 197); freqFrontPrev = m_sQueueSample.m_nFrequency; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; @@ -3610,16 +3610,16 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 140.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } else { m_sQueueSample.m_nSampleIndex = SFX_CAR_HELI_MAI; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = (volumeModifier + 1) * 16000 + freq; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; @@ -3627,10 +3627,10 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 140.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -3664,7 +3664,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = (volumeModifier + 1) * 16000 + freq; } - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; @@ -3672,10 +3672,10 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 140.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } @@ -3698,7 +3698,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) } m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nCounter = 12; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; @@ -3706,10 +3706,10 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 30; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -3734,7 +3734,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_PRO4; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = 12; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = propellerSpeed * 100.0f; @@ -3742,10 +3742,10 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_SEAPLANE_PRO4); m_sQueueSample.m_fSpeedMultiplier = 5.0f; m_sQueueSample.m_fSoundIntensity = 20.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -3760,7 +3760,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) else if (params.m_VehicleType == VEHICLE_TYPE_HELI) m_sQueueSample.m_vecPos = CVector(0.0f, -10.0f, 0.0f); //this is from android, but for real it's not used - params.m_bDistanceCalculated = false; + params.m_bDistanceCalculated = FALSE; params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); if (params.m_fDistance < SQR(27.0f)) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); @@ -3769,7 +3769,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = hunterBool ? SFX_HELI_APACHE_3 : SFX_CAR_HELI_REA; m_sQueueSample.m_nBankIndex = 0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = (volumeModifier + 1.0f) * 16000; m_sQueueSample.m_nLoopCount = 0; @@ -3778,10 +3778,10 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 27.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -3799,7 +3799,7 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params) CAutomobile* automobile; CBike* bike; - bool wheelBurst; + bool8 wheelBurst; uint8 emittingVol; float modifier; @@ -3810,19 +3810,19 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params) switch (params.m_VehicleType) { case VEHICLE_TYPE_CAR: automobile = (CAutomobile*)params.m_pVehicle; - wheelBurst = false; + wheelBurst = FALSE; for (int i = 0; i < 4; i++) if (automobile->Damage.GetWheelStatus(i) == WHEEL_STATUS_BURST && automobile->m_aWheelTimer[i] > 0.0f) - wheelBurst = true; + wheelBurst = TRUE; if (!wheelBurst) return; break; case VEHICLE_TYPE_BIKE: bike = (CBike*)params.m_pVehicle; - wheelBurst = false; + wheelBurst = FALSE; for(int i = 0; i < 2; i++) if (bike->m_wheelStatus[i] == WHEEL_STATUS_BURST && bike->m_aWheelTimer[i] > 0.0f) - wheelBurst = true; + wheelBurst = TRUE; if (!wheelBurst) return; break; @@ -3837,7 +3837,7 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params) if (m_sQueueSample.m_nVolume) { m_sQueueSample.m_nCounter = 95; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_nSampleIndex = SFX_TYRE_BURST_L; m_sQueueSample.m_nFrequency = (5500.0f * modifier) + 8000; @@ -3847,10 +3847,10 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_TYRE_BURST_L); m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -3989,12 +3989,12 @@ cAudioManager::ProcessJumboDecel(CPlane *plane) } } -bool +bool8 cAudioManager::SetupJumboTaxiSound(uint8 vol) { const float SOUND_INTENSITY = 180.0f; if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) - return false; + return FALSE; uint8 emittingVol = (vol / 2) + ((vol / 2) * m_sQueueSample.m_fDistance / SOUND_INTENSITY); @@ -4006,7 +4006,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol) m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = GetJumboTaxiFreq(); m_sQueueSample.m_nLoopCount = 0; @@ -4015,22 +4015,22 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } - return true; + return TRUE; } -bool +bool8 cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq) { const float SOUND_INTENSITY = 170.0f; if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) - return false; + return FALSE; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); @@ -4038,7 +4038,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq) m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_WHINE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; @@ -4047,21 +4047,21 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } - return true; + return TRUE; } -bool +bool8 cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq) { const float SOUND_INTENSITY = 180.0f; if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) - return false; + return FALSE; uint8 emittingVol = vol - gJumboVolOffsetPercentage / 100; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); @@ -4069,7 +4069,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq) m_sQueueSample.m_nCounter = 3; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_ENGINE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; @@ -4078,20 +4078,20 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } - return true; + return TRUE; } -bool +bool8 cAudioManager::SetupJumboFlySound(uint8 emittingVol) { const float SOUND_INTENSITY = 440.0f; - if(m_sQueueSample.m_fDistance >= SOUND_INTENSITY) return false; + if(m_sQueueSample.m_fDistance >= SOUND_INTENSITY) return FALSE; int32 vol = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); m_sQueueSample.m_nVolume = vol; @@ -4099,7 +4099,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol) m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_DIST_FLY; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_DIST_FLY); m_sQueueSample.m_nLoopCount = 0; @@ -4108,21 +4108,21 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; // todo port fix to re3 + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; // todo port fix to re3 AddSampleToRequestedQueue(); } - return true; + return TRUE; } -bool +bool8 cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) { const float SOUND_INTENSITY = 240.0f; if (m_sQueueSample.m_fDistance >= SOUND_INTENSITY) - return false; + return FALSE; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); @@ -4130,7 +4130,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_nCounter = 5; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_RUMBLE); m_sQueueSample.m_nLoopCount = 0; @@ -4139,11 +4139,11 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 12; m_sQueueSample.m_nOffset = 0; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); m_sQueueSample.m_nCounter = 6; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_RUMBLE; @@ -4151,7 +4151,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_nOffset = MAX_VOLUME; AddSampleToRequestedQueue(); } - return true; + return TRUE; } int32 @@ -4172,7 +4172,7 @@ cAudioManager::ProcessPed(CPhysical *ped) m_sQueueSample.m_vecPos = ped->GetPosition(); - params.m_bDistanceCalculated = false; + params.m_bDistanceCalculated = FALSE; params.m_pPed = (CPed *)ped; params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); ProcessPedOneShots(params); @@ -4186,9 +4186,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) CPed *ped = params.m_pPed; - bool narrowSoundRange; + bool8 narrowSoundRange; int16 sound; - bool stereo; + bool8 stereo; CWeapon *weapon; float maxDist = 0.f; // uninitialized variable @@ -4197,9 +4197,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) weapon = params.m_pPed->GetWeapon(); for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { - stereo = false; - narrowSoundRange = false; - m_sQueueSample.m_bRequireReflection = false; + stereo = FALSE; + narrowSoundRange = FALSE; + m_sQueueSample.m_bRequireReflection = FALSE; sound = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; switch (sound) { case SOUND_STEP_START: @@ -4276,9 +4276,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; break; case SOUND_FALL_LAND: case SOUND_FALL_COLLAPSE: @@ -4304,9 +4304,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; break; case SOUND_FIGHT_37: m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1; @@ -4388,7 +4388,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) } m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound; - narrowSoundRange = true; + narrowSoundRange = TRUE; ++iSound; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; @@ -4399,9 +4399,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = m_anRandomTable[3] % 26 + 100; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; break; case SOUND_WEAPON_BAT_ATTACK: case SOUND_WEAPON_KNIFE_ATTACK: @@ -4434,7 +4434,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nSampleIndex = SFX_BAT_HIT_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 22000; - stereo = true; + stereo = TRUE; break; } } @@ -4445,7 +4445,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); } m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; @@ -4455,9 +4455,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopEnd = -1; emittingVol = m_anRandomTable[2] % 20 + 100; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; break; } case SOUND_WEAPON_CHAINSAW_IDLE: @@ -4480,8 +4480,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_CHAINSAW_IDLE); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_CHAINSAW_IDLE); m_sQueueSample.m_nEmittingVolume = 100; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; break; case SOUND_WEAPON_CHAINSAW_ATTACK: @@ -4504,8 +4504,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_CHAINSAW_ATTACK); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_CHAINSAW_ATTACK); m_sQueueSample.m_nEmittingVolume = 100; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; break; case SOUND_WEAPON_CHAINSAW_MADECONTACT: @@ -4530,8 +4530,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_CHAINSAW_ATTACK); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_CHAINSAW_ATTACK); m_sQueueSample.m_nEmittingVolume = 100; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; break; case SOUND_WEAPON_SHOT_FIRED: @@ -4544,7 +4544,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_LEFT); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 1; @@ -4556,16 +4556,16 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopEnd = -1; emittingVol = m_anRandomTable[0] % 20 + 80; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; + stereo = TRUE; break; case WEAPONTYPE_COLT45: m_sQueueSample.m_nSampleIndex = SFX_COLT45_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COLT45_LEFT); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -4577,16 +4577,16 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopEnd = -1; emittingVol = m_anRandomTable[1] % 10 + 90; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; + stereo = TRUE; break; case WEAPONTYPE_PYTHON: m_sQueueSample.m_nSampleIndex = SFX_PYTHON_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PYTHON_LEFT); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -4598,17 +4598,17 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopEnd = -1; emittingVol = 127; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; + stereo = TRUE; break; case WEAPONTYPE_SHOTGUN: case WEAPONTYPE_STUBBY_SHOTGUN: m_sQueueSample.m_nSampleIndex = SFX_SHOTGUN_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SHOTGUN_LEFT); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -4620,16 +4620,16 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopEnd = -1; emittingVol = m_anRandomTable[2] % 10 + 100; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; + stereo = TRUE; break; case WEAPONTYPE_SPAS12_SHOTGUN: m_sQueueSample.m_nSampleIndex = SFX_SPAS12_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SPAS12_LEFT); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -4641,16 +4641,16 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopEnd = -1; emittingVol = m_anRandomTable[2] % 10 + 100; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; + stereo = TRUE; break; case WEAPONTYPE_TEC9: m_sQueueSample.m_nSampleIndex = SFX_TEC_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 17000; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; @@ -4661,16 +4661,16 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = m_anRandomTable[3] % 15 + 70; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + stereo = TRUE; break; case WEAPONTYPE_UZI: case WEAPONTYPE_MINIGUN: m_sQueueSample.m_nSampleIndex = SFX_UZI_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_UZI_LEFT); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -4682,15 +4682,15 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = m_anRandomTable[3] % 15 + 70; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + stereo = TRUE; break; case WEAPONTYPE_SILENCED_INGRAM: m_sQueueSample.m_nSampleIndex = SFX_TEC_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 34000; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; @@ -4701,15 +4701,15 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = m_anRandomTable[3] % 15 + 70; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + stereo = TRUE; break; case WEAPONTYPE_MP5: m_sQueueSample.m_nSampleIndex = SFX_MP5_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_MP5_LEFT); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -4721,15 +4721,15 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = m_anRandomTable[3] % 15 + 70; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + stereo = TRUE; break; case WEAPONTYPE_M4: m_sQueueSample.m_nSampleIndex = SFX_RUGER_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 43150; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; @@ -4740,15 +4740,15 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = m_anRandomTable[3] % 15 + 90; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + stereo = TRUE; break; case WEAPONTYPE_RUGER: m_sQueueSample.m_nSampleIndex = SFX_RUGER_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_RUGER_LEFT); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -4760,16 +4760,16 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = m_anRandomTable[3] % 15 + 90; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + stereo = TRUE; break; case WEAPONTYPE_SNIPERRIFLE: case WEAPONTYPE_LASERSCOPE: m_sQueueSample.m_nSampleIndex = SFX_SNIPER_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; if (weapon->m_eWeaponType == WEAPONTYPE_SNIPERRIFLE) m_sQueueSample.m_nFrequency = 25472; else @@ -4784,10 +4784,10 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopEnd = -1; emittingVol = m_anRandomTable[4] % 10 + 110; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; + stereo = TRUE; break; case WEAPONTYPE_FLAMETHROWER: m_sQueueSample.m_nSampleIndex = SFX_FLAMETHROWER_LEFT; @@ -4803,17 +4803,17 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nEmittingVolume = 90; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 6; - stereo = true; + stereo = TRUE; break; case WEAPONTYPE_M60: case WEAPONTYPE_HELICANNON: m_sQueueSample.m_nSampleIndex = SFX_M60_LEFT; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_M60_LEFT); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -4825,9 +4825,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopEnd = -1; emittingVol = 127; m_sQueueSample.m_nEmittingVolume = 127; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - stereo = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + stereo = TRUE; break; default: continue; @@ -4872,7 +4872,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) } emittingVol = 75; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency += RandomDisplacement(300); m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nReleasingVolumeModificator = 5; @@ -4883,9 +4883,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = 75; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; break; case SOUND_WEAPON_AK47_BULLET_ECHO: { @@ -4917,7 +4917,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) } m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; switch (weaponType) { case WEAPONTYPE_TEC9: m_sQueueSample.m_nFrequency = 13000; @@ -4948,9 +4948,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopEnd = -1; emittingVol = m_anRandomTable[4] % 10 + 80; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; break; } case SOUND_WEAPON_FLAMETHROWER_FIRE: @@ -4968,14 +4968,14 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopEnd = -1; emittingVol = 70; m_sQueueSample.m_nEmittingVolume = 70; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; break; case SOUND_WEAPON_HIT_PED: m_sQueueSample.m_nSampleIndex = SFX_BULLET_PED; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BULLET_PED); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); m_sQueueSample.m_nReleasingVolumeModificator = 7; @@ -4987,8 +4987,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = m_anRandomTable[0] % 20 + 90; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; break; case SOUND_SPLASH: if (m_FrameCounter <= iSplashFrame) @@ -4997,7 +4997,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nSampleIndex = SFX_SPLASH_1; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = RandomDisplacement(1400) + 20000; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; @@ -5008,9 +5008,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = m_anRandomTable[2] % 30 + 70; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; break; case SOUND_MELEE_ATTACK_START: { @@ -5030,7 +5030,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) } m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound++; - narrowSoundRange = true; + narrowSoundRange = TRUE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -5045,9 +5045,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; break; } case SOUND_SKATING: @@ -5058,7 +5058,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nSampleIndex = (m_anRandomTable[3] & 1) + SFX_SKATE_1; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = iSound; - stereo = true; + stereo = TRUE; ++iSound; m_sQueueSample.m_nFrequency = m_anRandomTable[1] % 1000 + 17000; if (param2 == 0) @@ -5072,9 +5072,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopEnd = -1; emittingVol = (m_anRandomTable[2] % 20 + 70) * param1 / 127; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; break; } case SOUND_WEAPON_MINIGUN_ATTACK: @@ -5091,8 +5091,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_MINIGUN_FIRE_LEFT); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_MINIGUN_FIRE_LEFT); m_sQueueSample.m_nEmittingVolume = 127; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; break; case SOUND_WEAPON_MINIGUN_2: @@ -5109,8 +5109,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_MINIGUN_FIRE_RIGHT); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_MINIGUN_FIRE_RIGHT); m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; break; case SOUND_WEAPON_MINIGUN_3: @@ -5127,9 +5127,9 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopEnd = -1; emittingVol = 127; m_sQueueSample.m_nEmittingVolume = 127; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; break; case SOUND_SHIRT_WIND_FLAP: if (params.m_pPed->IsPlayer() && params.m_pPed->m_pMyVehicle) { @@ -5170,8 +5170,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; } } @@ -5189,13 +5189,13 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) if (m_sQueueSample.m_nVolume != 0) { if (stereo) { if (m_sQueueSample.m_fDistance < 0.2f * m_sQueueSample.m_fSoundIntensity) { - m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nOffset = 0; } else { - stereo = false; + stereo = FALSE; } } - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; AddSampleToRequestedQueue(); if (stereo) { m_sQueueSample.m_nOffset = 127; @@ -5216,7 +5216,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) } void -cAudioManager::SetPedTalkingStatus(CPed *ped, uint8 status) +cAudioManager::SetPedTalkingStatus(CPed *ped, bool8 status) { if (ped != nil) ped->m_canTalk = status; @@ -5244,12 +5244,12 @@ cAudioManager::SetupPedComments(cPedParams ¶ms, uint16 sound) if(ped != nil) { if(!ped->m_canTalk) return; - m_bGenericSfx = false; + m_bGenericSfx = FALSE; pedComment.m_nSampleIndex = GetPedCommentSfx(ped, sound); if(pedComment.m_nSampleIndex == NO_SAMPLE) return; soundIntensity = 40.0f; } else { - m_bGenericSfx = true; + m_bGenericSfx = TRUE; switch(sound) { case SOUND_PED_HELI_PLAYER_FOUND: soundIntensity = 400.0f; @@ -7825,7 +7825,7 @@ cAudioManager::GetGenericMaleTalkSfx(CPed *ped, int16 sound) { uint32 sfx; - m_bGenericSfx = true; + m_bGenericSfx = TRUE; switch(sound) { case SOUND_PED_DEATH: GetPhrase(sfx, ped->m_lastComment, SFX_GENERIC_MALE_DEATH_1, 41); break; case SOUND_PED_BULLET_HIT: @@ -7841,7 +7841,7 @@ uint32 cAudioManager::GetGenericFemaleTalkSfx(CPed *ped, int16 sound) { uint32 sfx; - m_bGenericSfx = true; + m_bGenericSfx = TRUE; switch(sound) { case SOUND_PED_DEATH: GetPhrase(sfx, ped->m_lastComment, SFX_GENERIC_FEMALE_DEATH_1, 22); break; case SOUND_PED_BULLET_HIT: @@ -7889,7 +7889,7 @@ cPedComments::Process() uint32 sampleIndex; uint8 actualUsedBank; tPedComment *comment; - bool prevUsed = false; + bool8 prevUsed = FALSE; static uint8 counter = 0; static int32 prevSamples[10]; @@ -7900,7 +7900,7 @@ cPedComments::Process() if(m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nSampleIndex == prevSamples[(counter + 1 + i) % ARRAY_SIZE(prevSamples)]) { m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_nProcess = -1; - prevUsed = true; + prevUsed = TRUE; break; } } @@ -7925,14 +7925,14 @@ cPedComments::Process() AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f; AudioManager.m_sQueueSample.m_fSoundIntensity = 40.0f; - AudioManager.m_sQueueSample.m_bReleasingSoundFlag = true; + AudioManager.m_sQueueSample.m_bReleasingSoundFlag = TRUE; AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos; - AudioManager.m_sQueueSample.m_bReverbFlag = true; - AudioManager.m_sQueueSample.m_bRequireReflection = true; - AudioManager.m_sQueueSample.m_bIs2D = false; + AudioManager.m_sQueueSample.m_bReverbFlag = TRUE; + AudioManager.m_sQueueSample.m_bRequireReflection = TRUE; + AudioManager.m_sQueueSample.m_bIs2D = FALSE; #ifdef FIX_BUGS if (sampleIndex >= SFX_PLAYER_ANGRY_BUSTED_1 && sampleIndex < TOTAL_AUDIO_SAMPLES) { // check if player sfx - AudioManager.m_sQueueSample.m_bIs2D = true; + AudioManager.m_sQueueSample.m_bIs2D = TRUE; AudioManager.m_sQueueSample.m_nOffset = 63; } #endif // FIX_BUGS @@ -7945,7 +7945,7 @@ cPedComments::Process() AudioManager.AddSampleToRequestedQueue(); #if defined(GTA_PC) && !defined(FIX_BUGS) m_nDelayTimer = CTimer::GetTimeInMilliseconds(); - m_bDelay = true; + m_bDelay = TRUE; #endif } } @@ -7973,7 +7973,7 @@ cPedComments::Process() m_nCommentsInBank[actualUsedBank] = 0; #if defined(GTA_PC) && !defined(FIX_BUGS) if(m_bDelay) - if(CTimer::GetTimeInMilliseconds() - m_nDelayTimer > 6000) m_bDelay = false; + if(CTimer::GetTimeInMilliseconds() - m_nDelayTimer > 6000) m_bDelay = FALSE; #endif } @@ -8003,7 +8003,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bRequireReflection = TRUE; break; case EXPLOSION_MOLOTOV: m_sQueueSample.m_fSoundIntensity = 150.0f; @@ -8011,7 +8011,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bRequireReflection = FALSE; break; case EXPLOSION_MINE: case EXPLOSION_HELI_BOMB: @@ -8020,7 +8020,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bRequireReflection = TRUE; break; default: m_sQueueSample.m_fSoundIntensity = 200.0f; @@ -8040,13 +8040,13 @@ cAudioManager::ProcessExplosions(int32 explosion) if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; AddSampleToRequestedQueue(); } } @@ -8107,19 +8107,19 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_nReleasingVolumeDivider = 10; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } if (gFireManager.m_aFires[i].m_bExtinguishedWithWater) { - gFireManager.m_aFires[i].m_bExtinguishedWithWater = false; + gFireManager.m_aFires[i].m_bExtinguishedWithWater = FALSE; emittingVol = 100.0f * gFireManager.m_aFires[i].m_fWaterExtinguishCountdown; m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { @@ -8131,14 +8131,14 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_nReleasingVolumeDivider = 10; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -8167,14 +8167,14 @@ cAudioManager::ProcessWaterCannon(int32) m_sQueueSample.m_nCounter = i; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_nReleasingVolumeDivider = 8; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nEmittingVolume = 50; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -8204,17 +8204,17 @@ cAudioManager::ProcessExtraSounds() m_sQueueSample.m_nSampleIndex = SFX_ARCADE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARCADE); - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 4; m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_ARCADE); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_ARCADE); - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bRequireReflection = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; AddSampleToRequestedQueue(); } @@ -8247,14 +8247,14 @@ cAudioManager::ProcessEscalators() m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_nCounter = i; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_BOAT_V12_LOOP); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_BOAT_V12_LOOP); - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -8299,8 +8299,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; emittingVolume = 60; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bRequireReflection = TRUE; break; case SCRIPT_SOUND_GARAGE_DOOR_CLUNK: m_sQueueSample.m_fSoundIntensity = 80.0f; @@ -8311,8 +8311,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 4; emittingVolume = 60; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bRequireReflection = TRUE; break; case SCRIPT_SOUND_SHOOTING_RANGE_TARGET_HIT: case SCRIPT_SOUND_BULLET_HIT_GROUND_1: @@ -8325,7 +8325,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 9; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; emittingVolume = m_anRandomTable[2] % 20 + 90; break; case SCRIPT_SOUND_WILLIE_CARD_SWIPE: @@ -8336,8 +8336,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency = 20159; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 1.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bRequireReflection = FALSE; break; case SCRIPT_SOUND_MALE_AMBULANCE_OUCH: { @@ -8361,8 +8361,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_HORN_JEEP); // BUG? m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bIs2D = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; break; case SCRIPT_SOUND_PAYPHONE_RINGING: m_sQueueSample.m_fSoundIntensity = 80.0f; @@ -8372,8 +8372,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PHONE_RING); m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bRequireReflection = FALSE; break; case SCRIPT_SOUND_GLASS_BREAK_L: m_sQueueSample.m_fSoundIntensity = 60.0f; @@ -8383,7 +8383,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_SMASH); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_GLASS_BREAK_S: m_sQueueSample.m_fSoundIntensity = 60.0f; @@ -8393,7 +8393,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_SMASH); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_GLASS_CRACK: m_sQueueSample.m_fSoundIntensity = 60.0f; @@ -8403,8 +8403,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_CRACK); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bRequireReflection = TRUE; break; case SCRIPT_SOUND_GLASS_LIGHT_BREAK: m_sQueueSample.m_fSoundIntensity = 55.0f; @@ -8413,7 +8413,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 19000; m_sQueueSample.m_nReleasingVolumeModificator = 9; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; emittingVolume = RandomDisplacement(11) + 25; break; case SCRIPT_SOUND_BOX_DESTROYED_1: @@ -8423,8 +8423,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bRequireReflection = TRUE; emittingVolume = m_anRandomTable[2] % 20 + 80; break; case SCRIPT_SOUND_BOX_DESTROYED_2: @@ -8434,8 +8434,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bRequireReflection = TRUE; emittingVolume = m_anRandomTable[2] % 20 + 80; break; case SCRIPT_SOUND_METAL_COLLISION: @@ -8446,8 +8446,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bRequireReflection = TRUE; emittingVolume = m_anRandomTable[2] % 30 + 70; break; case SCRIPT_SOUND_TIRE_COLLISION: @@ -8458,8 +8458,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bRequireReflection = TRUE; emittingVolume = m_anRandomTable[2] % 30 + 60; break; case SCRIPT_SOUND_HIT_BALL: @@ -8470,8 +8470,8 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bRequireReflection = TRUE; emittingVolume = m_anRandomTable[2] % 30 + 60; break; case SCRIPT_SOUND_GUNSHELL_DROP: @@ -8507,7 +8507,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 20.0f; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; emittingVolume = m_anRandomTable[2] % 20 + 30; break; case SCRIPT_SOUND_GUNSHELL_DROP_SOFT: @@ -8517,7 +8517,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_fSoundIntensity = 20.0f; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; emittingVolume = m_anRandomTable[2] % 20 + 30; break; default: @@ -8531,11 +8531,11 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nEmittingVolume = emittingVolume; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; AddSampleToRequestedQueue(); } } @@ -8557,7 +8557,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_POLICE_CELL_DOOR_SLIDING_LOOP: case SCRIPT_SOUND_GARAGE_DOOR_SLIDING_LOOP: @@ -8569,7 +8569,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_SNORING_LOOP: m_sQueueSample.m_fSoundIntensity = 6.0f; @@ -8580,7 +8580,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 6; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_SHOOTING_RANGE_TARGET_MOVING_LOOP: m_sQueueSample.m_fSoundIntensity = 40.0f; @@ -8591,7 +8591,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 4; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_NEW_BUILDING_BAR_1: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_BAR_1; @@ -8602,7 +8602,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_NEW_BUILDING_BAR_2: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_BAR_2; @@ -8613,7 +8613,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_NEW_BUILDING_BAR_3: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_BAR_3; @@ -8624,7 +8624,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_NEW_BUILDING_BAR_4: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_BAR_4; @@ -8635,7 +8635,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_NEW_BUILDING_MALIBU_1: if(MusicManager.m_nPlayingTrack == STREAMED_SOUND_MALIBU_AMBIENT) return; @@ -8648,7 +8648,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_NEW_BUILDING_MALIBU_2: if(MusicManager.m_nPlayingTrack == STREAMED_SOUND_MALIBU_AMBIENT) return; @@ -8661,7 +8661,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_NEW_BUILDING_MALIBU_3: if(MusicManager.m_nPlayingTrack == STREAMED_SOUND_MALIBU_AMBIENT) return; @@ -8674,7 +8674,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_NEW_BUILDING_STRIP_1: if(MusicManager.m_nPlayingTrack == STREAMED_SOUND_STRIPCLUB_AMBIENT) return; @@ -8687,7 +8687,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_NEW_BUILDING_STRIP_2: if(MusicManager.m_nPlayingTrack == STREAMED_SOUND_STRIPCLUB_AMBIENT) return; @@ -8700,7 +8700,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_NEW_BUILDING_STRIP_3: if(MusicManager.m_nPlayingTrack == STREAMED_SOUND_STRIPCLUB_AMBIENT) return; @@ -8713,7 +8713,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_NEW_BUILDING_CHURCH: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_CHURCH; @@ -8724,7 +8724,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nReleasingVolumeDivider = 15; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_NEW_WATERFALL: emittingVolume = 30; @@ -8735,7 +8735,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nReleasingVolumeModificator = 4; m_sQueueSample.m_nReleasingVolumeDivider = 9; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; break; default: return; } @@ -8746,14 +8746,14 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bReverbFlag = true; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_nEmittingVolume = emittingVolume; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -8791,14 +8791,14 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nOffset = (m_anRandomTable[2] & 15) + 55; - m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_bReverbFlag = false; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = FALSE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } if (CWeather::Rain > 0.0f && (!CCullZones::CamNoRain() || !CCullZones::PlayerNoRain())) { @@ -8809,15 +8809,15 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_nOffset = 63; - m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 30; - m_sQueueSample.m_bReverbFlag = false; + m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } x = 0.0f; @@ -8834,15 +8834,15 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nOffset = 63; - m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; - m_sQueueSample.m_bReverbFlag = false; + m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); CObject::fDistToNearestTree = 999999.9f; } @@ -8851,11 +8851,11 @@ cAudioManager::ProcessWeather(int32 id) void cAudioManager::ProcessFrontEnd() { - bool stereo; - bool processedPickup; - bool processedMission; - bool staticFreq; - bool center; + bool8 stereo; + bool8 processedPickup; + bool8 processedMission; + bool8 staticFreq; + bool8 center; int16 sample; static uint8 iSound = 0; @@ -8864,11 +8864,11 @@ cAudioManager::ProcessFrontEnd() static uint32 radioDial = SFX_RADIO_DIAL_1; for (uint32 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { - staticFreq = false; - processedPickup = false; - center = false; - processedMission = false; - stereo = false; + staticFreq = FALSE; + processedPickup = FALSE; + center = FALSE; + processedMission = FALSE; + stereo = FALSE; switch (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]) { case SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM: m_sQueueSample.m_nSampleIndex = SFX_ERROR_FIRE_RIFLE; @@ -8880,9 +8880,9 @@ cAudioManager::ProcessFrontEnd() case SOUND_GARAGE_BAD_VEHICLE: case SOUND_GARAGE_BOMB_ALREADY_SET: m_sQueueSample.m_nSampleIndex = SFX_WEAPON_LEFT; - stereo = true; - staticFreq = true; - center = true; + stereo = TRUE; + staticFreq = TRUE; + center = TRUE; break; case SOUND_GARAGE_OPENING: case SOUND_71: //case SOUND_41: @@ -8890,8 +8890,8 @@ cAudioManager::ProcessFrontEnd() case SOUND_GARAGE_VEHICLE_ACCEPTED: case SOUND_EVIDENCE_PICKUP: case SOUND_UNLOAD_GOLD: - stereo = true; - processedPickup = true; + stereo = TRUE; + processedPickup = TRUE; m_sQueueSample.m_nSampleIndex = SFX_MONEY_LEFT; break; case SOUND_GARAGE_BOMB1_SET: @@ -8899,60 +8899,60 @@ cAudioManager::ProcessFrontEnd() case SOUND_GARAGE_BOMB3_SET: case SOUND_PICKUP_WEAPON_BOUGHT: case SOUND_PICKUP_WEAPON: - center = true; - processedPickup = true; + center = TRUE; + processedPickup = TRUE; m_sQueueSample.m_nSampleIndex = SFX_WEAPON_LEFT; - stereo = true; + stereo = TRUE; break; case SOUND_PICKUP_HEALTH: case SOUND_81: //case SOUND_4B: case SOUND_PICKUP_ADRENALINE: case SOUND_PICKUP_ARMOUR: - stereo = true; - processedPickup = true; + stereo = TRUE; + processedPickup = TRUE; m_sQueueSample.m_nSampleIndex = SFX_MONEY_LEFT; break; case SOUND_80: - stereo = true; - processedPickup = true; + stereo = TRUE; + processedPickup = TRUE; m_sQueueSample.m_nSampleIndex = SFX_WEAPON_LEFT; - center = true; - staticFreq = true; + center = TRUE; + staticFreq = TRUE; break; case SOUND_PICKUP_BONUS: case SOUND_FRONTEND_MENU_STARTING: case SOUND_HUD: - stereo = true; + stereo = TRUE; m_sQueueSample.m_nSampleIndex = SFX_INFO_LEFT; - center = true; + center = TRUE; break; case SOUND_PICKUP_MONEY: - stereo = true; - processedPickup = true; + stereo = TRUE; + processedPickup = TRUE; m_sQueueSample.m_nSampleIndex = SFX_MONEY_LEFT; break; case SOUND_PICKUP_HIDDEN_PACKAGE: case SOUND_PICKUP_PACMAN_PILL: case SOUND_PICKUP_PACMAN_PACKAGE: case SOUND_PICKUP_FLOAT_PACKAGE: - center = true; - processedPickup = true; + center = TRUE; + processedPickup = TRUE; m_sQueueSample.m_nSampleIndex = SFX_PART_MISSION_COMPLETE_LEFT; - stereo = true; + stereo = TRUE; break; case SOUND_RACE_START_3: case SOUND_RACE_START_2: case SOUND_RACE_START_1: case SOUND_PART_MISSION_COMPLETE: - stereo = true; + stereo = TRUE; m_sQueueSample.m_nSampleIndex = SFX_PART_MISSION_COMPLETE_LEFT; - processedMission = true; - center = true; + processedMission = TRUE; + center = TRUE; break; case SOUND_RACE_START_GO: - stereo = true; + stereo = TRUE; m_sQueueSample.m_nSampleIndex = SFX_GO_LEFT; - center = true; + center = TRUE; break; case SOUND_CLOCK_TICK: m_sQueueSample.m_nSampleIndex = SFX_TIMER; @@ -8978,19 +8978,19 @@ cAudioManager::ProcessFrontEnd() radioDial = m_sQueueSample.m_nSampleIndex; break; case SOUND_FRONTEND_HIGHLIGHT_OPTION: - stereo = true; + stereo = TRUE; m_sQueueSample.m_nSampleIndex = SFX_FE_HIGHLIGHT_LEFT; break; case SOUND_FRONTEND_ENTER_OR_ADJUST: - stereo = true; + stereo = TRUE; m_sQueueSample.m_nSampleIndex = SFX_FE_SELECT_LEFT; break; case SOUND_FRONTEND_BACK: - stereo = true; + stereo = TRUE; m_sQueueSample.m_nSampleIndex = SFX_FE_BACK_LEFT; break; case SOUND_FRONTEND_FAIL: - stereo = true; + stereo = TRUE; m_sQueueSample.m_nSampleIndex = SFX_FE_ERROR_LEFT; break; case SOUND_FRONTEND_AUDIO_TEST: @@ -9029,10 +9029,10 @@ cAudioManager::ProcessFrontEnd() m_sQueueSample.m_nVolume = (CWeather::Wind - 1.0f) * m_sQueueSample.m_nVolume; m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nBankIndex = SFX_BANK_FRONT_END_MENU; m_sQueueSample.m_nReleasingVolumeModificator = 0; - m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; @@ -9055,8 +9055,8 @@ cAudioManager::ProcessFrontEnd() } m_sQueueSample.m_nOffset = 63; } - m_sQueueSample.m_bReverbFlag = false; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = FALSE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); if (stereo) { ++m_sQueueSample.m_nSampleIndex; @@ -9079,7 +9079,7 @@ cAudioManager::ProcessCrane() { CCrane *crane = (CCrane *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity; float distSquared; - bool distCalculated = false; + bool8 distCalculated = FALSE; static const int intensity = 80; if (crane) { @@ -9094,7 +9094,7 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_CRANE_MAGNET; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nFrequency = 6000; m_sQueueSample.m_nLoopCount = 0; @@ -9103,10 +9103,10 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = intensity; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } if (m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents) { @@ -9114,9 +9114,9 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_2; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COL_CAR_2); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = TRUE; AddSampleToRequestedQueue(); } } @@ -9170,14 +9170,14 @@ cAudioManager::ProcessProjectiles() m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = i; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -9195,7 +9195,7 @@ cAudioManager::ProcessGarages() uint32 sampleIndex; uint8 j; float distSquared; - bool distCalculated; + bool8 distCalculated; static uint8 iSound = 32; @@ -9206,7 +9206,7 @@ cAudioManager::ProcessGarages() if (entity == nil) continue; m_sQueueSample.m_vecPos = entity->GetPosition(); - distCalculated = false; + distCalculated = FALSE; distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); if (distSquared < SQR(SOUND_INTENSITY)) { state = CGarages::aGarages[i].m_eGarageState; @@ -9226,7 +9226,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex) / 2; m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nCounter = iSound++; if (iSound < 32) iSound = 32; @@ -9238,7 +9238,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_nCounter = i; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; } } else { m_sQueueSample.m_nSampleIndex = SFX_GARAGE_DOOR_LOOP; @@ -9247,19 +9247,19 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_nCounter = i; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; } m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nEmittingVolume = 90; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } break; @@ -9288,16 +9288,16 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_nEmittingVolume = 60; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReverbFlag = true; - m_sQueueSample.m_bIs2D = false; - m_sQueueSample.m_bReleasingSoundFlag = true; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nCounter = iSound++; if (iSound < 32) iSound = 32; - m_sQueueSample.m_bRequireReflection = true; + m_sQueueSample.m_bRequireReflection = TRUE; AddSampleToRequestedQueue(); } } @@ -9315,7 +9315,7 @@ cAudioManager::ProcessFireHydrant() const float SOUND_INTENSITY = 35; float distSquared; - bool distCalculated = false; + bool8 distCalculated = FALSE; m_sQueueSample.m_vecPos = ((CEntity *)m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)->GetPosition(); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); @@ -9329,13 +9329,13 @@ cAudioManager::ProcessFireHydrant() m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nEmittingVolume = 40; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_bRequireReflection = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_fSpeedMultiplier = 2.0f; AddSampleToRequestedQueue(); @@ -9350,7 +9350,7 @@ void cAudioManager::ProcessBridge() { float dist; - bool distCalculated = false; + bool8 distCalculated = FALSE; if (CBridge::pLiftRoad) { m_sQueueSample.m_vecPos = CBridge::pLiftRoad->GetPosition(); @@ -9385,7 +9385,7 @@ cAudioManager::ProcessBridgeWarning() m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_BRIDGE_OPEN_WARNING; m_sQueueSample.m_nBankIndex = SAMPLEBANK_EXTRAS; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BRIDGE_OPEN_WARNING); m_sQueueSample.m_nLoopCount = 0; @@ -9394,10 +9394,10 @@ cAudioManager::ProcessBridgeWarning() m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = 450.0f; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 8; - m_sQueueSample.m_bReverbFlag = false; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReverbFlag = FALSE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -9412,7 +9412,7 @@ cAudioManager::ProcessBridgeMotor() m_sQueueSample.m_nCounter = 1; m_sQueueSample.m_nSampleIndex = SFX_FISHING_BOAT_IDLE; // todo check sfx name m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = 5500; m_sQueueSample.m_nLoopCount = 0; @@ -9421,9 +9421,9 @@ cAudioManager::ProcessBridgeMotor() m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = bridgeIntensity; - m_sQueueSample.m_bReleasingSoundFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bReverbFlag = false; + m_sQueueSample.m_bReverbFlag = FALSE; AddSampleToRequestedQueue(); } } @@ -9447,7 +9447,7 @@ cAudioManager::ProcessBridgeOneShots() if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = false; + m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopCount = 1; @@ -9456,9 +9456,9 @@ cAudioManager::ProcessBridgeOneShots() m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = bridgeIntensity; - m_sQueueSample.m_bReleasingSoundFlag = true; - m_sQueueSample.m_bReverbFlag = false; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bReleasingSoundFlag = TRUE; + m_sQueueSample.m_bReverbFlag = FALSE; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } } @@ -9467,7 +9467,7 @@ cAudioManager::ProcessBridgeOneShots() #endif #pragma region MISSION_AUDIO -bool g_bMissionAudioLoadFailed[MISSION_AUDIO_SLOTS]; +bool8 g_bMissionAudioLoadFailed[MISSION_AUDIO_SLOTS]; struct MissionAudioData { const char *m_pName; @@ -9862,10 +9862,10 @@ FindMissionAudioSfx(const char *name) return NO_SAMPLE; } -bool +bool8 cAudioManager::MissionScriptAudioUsesPoliceChannel(int32 soundMission) const { - return false; + return FALSE; } void @@ -9877,12 +9877,12 @@ cAudioManager::PreloadMissionAudio(uint8 slot, Const char *name) m_sMissionAudio.m_nSampleIndex[slot] = missionAudioSfx; m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_NOT_LOADED; m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED; - m_sMissionAudio.m_bIsPlaying[slot] = false; + m_sMissionAudio.m_bIsPlaying[slot] = FALSE; m_sMissionAudio.m_nMissionAudioCounter[slot] = m_nTimeSpent * SampleManager.GetStreamedFileLength(missionAudioSfx) / 1000; m_sMissionAudio.m_nMissionAudioCounter[slot] *= 4; - m_sMissionAudio.m_bIsPlayed[slot] = false; - m_sMissionAudio.m_bPredefinedProperties[slot] = true; - g_bMissionAudioLoadFailed[slot] = false; + m_sMissionAudio.m_bIsPlayed[slot] = FALSE; + m_sMissionAudio.m_bPredefinedProperties[slot] = TRUE; + g_bMissionAudioLoadFailed[slot] = FALSE; } } } @@ -9900,7 +9900,7 @@ void cAudioManager::SetMissionAudioLocation(uint8 slot, float x, float y, float z) { if (m_bIsInitialised && slot < MISSION_AUDIO_SLOTS) { - m_sMissionAudio.m_bPredefinedProperties[slot] = false; + m_sMissionAudio.m_bPredefinedProperties[slot] = FALSE; m_sMissionAudio.m_vecPos[slot] = CVector(x, y, z); } } @@ -9910,25 +9910,25 @@ cAudioManager::PlayLoadedMissionAudio(uint8 slot) { if (m_bIsInitialised && slot < MISSION_AUDIO_SLOTS && m_sMissionAudio.m_nSampleIndex[slot] != NO_SAMPLE && m_sMissionAudio.m_nLoadingStatus[slot] == LOADING_STATUS_LOADED && m_sMissionAudio.m_nPlayStatus[slot] == PLAY_STATUS_STOPPED) - m_sMissionAudio.m_bIsPlayed[slot] = true; + m_sMissionAudio.m_bIsPlayed[slot] = TRUE; } -bool +bool8 cAudioManager::ShouldDuckMissionAudio(uint8 slot) const { if (IsMissionAudioSamplePlaying(slot)) return m_sMissionAudio.m_nSampleIndex[slot] != STREAMED_SOUND_MISSION_ROK2_01; - return false; + return FALSE; } -bool +bool8 cAudioManager::IsMissionAudioSamplePlaying(uint8 slot) const { if (m_bIsInitialised) { if (slot < MISSION_AUDIO_SLOTS) return m_sMissionAudio.m_nPlayStatus[slot] == PLAY_STATUS_PLAYING; else - return true; + return TRUE; } else { static int32 cPretendFrame[MISSION_AUDIO_SLOTS] = { 1, 1 }; @@ -9936,14 +9936,14 @@ cAudioManager::IsMissionAudioSamplePlaying(uint8 slot) const } } -bool +bool8 cAudioManager::IsMissionAudioSampleFinished(uint8 slot) { if (m_bIsInitialised) { if (slot < MISSION_AUDIO_SLOTS) return m_sMissionAudio.m_nPlayStatus[slot] == PLAY_STATUS_FINISHED; else - return true; + return TRUE; } static int32 cPretendFrame[MISSION_AUDIO_SLOTS] = { 1, 1 }; @@ -9958,11 +9958,11 @@ cAudioManager::ClearMissionAudio(uint8 slot) m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE; m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_NOT_LOADED; m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_STOPPED; - m_sMissionAudio.m_bIsPlaying[slot] = false; - m_sMissionAudio.m_bIsPlayed[slot] = false; - m_sMissionAudio.m_bPredefinedProperties[slot] = true; + m_sMissionAudio.m_bIsPlaying[slot] = FALSE; + m_sMissionAudio.m_bIsPlayed[slot] = FALSE; + m_sMissionAudio.m_bPredefinedProperties[slot] = TRUE; m_sMissionAudio.m_nMissionAudioCounter[slot] = 0; - m_sMissionAudio.m_bIsMobile[slot] = false; + m_sMissionAudio.m_bIsMobile[slot] = FALSE; SampleManager.StopStreamedFile(slot + 1); } } @@ -10014,14 +10014,14 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) SetMissionScriptPoliceAudio(m_sMissionAudio.m_nSampleIndex[slot]); } else { if (m_nUserPause) - SampleManager.PauseStream(1, slot + 1); + SampleManager.PauseStream(TRUE, slot + 1); if (m_sMissionAudio.m_bPredefinedProperties[slot]) { if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAL) - SampleManager.SetStreamedVolumeAndPan(80, 0, 1, slot + 1); + SampleManager.SetStreamedVolumeAndPan(80, 0, TRUE, slot + 1); else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_CAMERAR) - SampleManager.SetStreamedVolumeAndPan(80, 127, 1, slot + 1); + SampleManager.SetStreamedVolumeAndPan(80, 127, TRUE, slot + 1); else - SampleManager.SetStreamedVolumeAndPan(80, 63, 1, slot + 1); + SampleManager.SetStreamedVolumeAndPan(80, 63, TRUE, slot + 1); } else { distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]); if (distSquared >= SQR(80.0f)) { @@ -10036,14 +10036,14 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) TranslateEntity(&m_sMissionAudio.m_vecPos[slot], &vec); pan = ComputePan(80.f, &vec); } - SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1); + SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, TRUE, slot + 1); } SampleManager.StartPreloadedStreamedFile(slot + 1); } m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_PLAYING; nCheckPlayingDelay[slot] = 30; if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A) - m_sMissionAudio.m_bIsMobile[slot] = true; + m_sMissionAudio.m_bIsMobile[slot] = TRUE; break; case PLAY_STATUS_PLAYING: if (m_bTimerJustReset) { @@ -10065,10 +10065,10 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) } else if (m_sMissionAudio.m_bIsPlaying[slot]) { if (SampleManager.IsStreamPlaying(slot + 1) || m_nUserPause || m_nPreviousUserPause) { if (m_nUserPause) - SampleManager.PauseStream(1, slot + 1); + SampleManager.PauseStream(TRUE, slot + 1); else { - SampleManager.PauseStream(0, slot + 1); + SampleManager.PauseStream(FALSE, slot + 1); if (!m_sMissionAudio.m_bPredefinedProperties[slot]) { distSquared = GetDistanceSquared(m_sMissionAudio.m_vecPos[slot]); if (distSquared >= SQR(80.0f)) { @@ -10083,7 +10083,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) TranslateEntity(&m_sMissionAudio.m_vecPos[slot], &vec); pan = ComputePan(80.f, &vec); } - SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, 1, slot + 1); + SampleManager.SetStreamedVolumeAndPan(emittingVol, pan, TRUE, slot + 1); } } } else if (m_sMissionAudio.m_nSampleIndex[slot] == STREAMED_SOUND_MISSION_ROK2_01) { @@ -10091,7 +10091,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) } else { m_sMissionAudio.m_nPlayStatus[slot] = PLAY_STATUS_FINISHED; if (m_sMissionAudio.m_nSampleIndex[slot] >= STREAMED_SOUND_MISSION_MOB_01A && m_sMissionAudio.m_nSampleIndex[slot] <= STREAMED_SOUND_MISSION_MOB_99A) - m_sMissionAudio.m_bIsMobile[slot] = false; + m_sMissionAudio.m_bIsMobile[slot] = FALSE; m_sMissionAudio.m_nSampleIndex[slot] = NO_SAMPLE; SampleManager.StopStreamedFile(slot + 1); m_sMissionAudio.m_nMissionAudioCounter[slot] = 0; @@ -10104,7 +10104,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) break; nCheckPlayingDelay[slot] = 0; } - m_sMissionAudio.m_bIsPlaying[slot] = true; + m_sMissionAudio.m_bIsPlaying[slot] = TRUE; } break; default: @@ -10114,7 +10114,7 @@ cAudioManager::ProcessMissionAudioSlot(uint8 slot) case LOADING_STATUS_FAILED: if (++nFramesUntilFailedLoad[slot] >= 120) { nFramesForPretendPlaying[slot] = 0; - g_bMissionAudioLoadFailed[slot] = true; + g_bMissionAudioLoadFailed[slot] = TRUE; nFramesUntilFailedLoad[slot] = 0; m_sMissionAudio.m_nLoadingStatus[slot] = LOADING_STATUS_LOADED; } diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 2304b4c4..3be053d2 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -23,8 +23,8 @@ const int allChannels = channels + 2; cAudioManager::cAudioManager() { - m_bIsInitialised = false; - m_bReverb = true; + m_bIsInitialised = FALSE; + m_bReverb = TRUE; field_6 = 0; m_fSpeedOfSound = SPEED_OF_SOUND / TIME_SPENT; m_nTimeSpent = TIME_SPENT; @@ -36,16 +36,16 @@ cAudioManager::cAudioManager() ClearActiveSamples(); GenerateIntegerRandomNumberTable(); field_4 = 0; - m_bDynamicAcousticModelingStatus = true; + m_bDynamicAcousticModelingStatus = TRUE; for (int i = 0; i < NUM_AUDIOENTITIES; i++) { - m_asAudioEntities[i].m_bIsUsed = false; + m_asAudioEntities[i].m_bIsUsed = FALSE; m_anAudioEntityIndices[i] = NUM_AUDIOENTITIES; } m_nAudioEntitiesTotal = 0; m_FrameCounter = 0; - m_bFifthFrameFlag = false; - m_bTimerJustReset = false; + m_bFifthFrameFlag = FALSE; + m_bTimerJustReset = FALSE; m_nTimer = 0; } @@ -83,7 +83,7 @@ cAudioManager::Terminate() MusicManager.Terminate(); for (uint32 i = 0; i < NUM_AUDIOENTITIES; i++) { - m_asAudioEntities[i].m_bIsUsed = false; + m_asAudioEntities[i].m_bIsUsed = FALSE; m_anAudioEntityIndices[i] = ARRAY_SIZE(m_anAudioEntityIndices); } @@ -98,7 +98,7 @@ cAudioManager::Terminate() SampleManager.Terminate(); - m_bIsInitialised = false; + m_bIsInitialised = FALSE; PostTerminateGameSpecificShutdown(); } } @@ -110,7 +110,7 @@ cAudioManager::Service() if (m_bTimerJustReset) { ResetAudioLogicTimers(m_nTimer); MusicManager.ResetTimers(m_nTimer); - m_bTimerJustReset = false; + m_bTimerJustReset = FALSE; } if (m_bIsInitialised) { m_nPreviousUserPause = m_nUserPause; @@ -132,8 +132,8 @@ cAudioManager::CreateEntity(eAudioType type, void *entity) return AEHANDLE_ERROR_BADAUDIOTYPE; for (uint32 i = 0; i < ARRAY_SIZE(m_asAudioEntities); i++) { if (!m_asAudioEntities[i].m_bIsUsed) { - m_asAudioEntities[i].m_bIsUsed = true; - m_asAudioEntities[i].m_bStatus = false; + m_asAudioEntities[i].m_bIsUsed = TRUE; + m_asAudioEntities[i].m_bStatus = FALSE; m_asAudioEntities[i].m_nType = type; m_asAudioEntities[i].m_pEntity = entity; m_asAudioEntities[i].m_awAudioEvent[0] = SOUND_NO_SOUND; @@ -152,7 +152,7 @@ void cAudioManager::DestroyEntity(int32 id) { if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) { - m_asAudioEntities[id].m_bIsUsed = false; + m_asAudioEntities[id].m_bIsUsed = FALSE; for (int32 i = 0; i < m_nAudioEntitiesTotal; ++i) { if (id == m_anAudioEntityIndices[i]) { if (i < NUM_AUDIOENTITIES - 1) @@ -165,7 +165,7 @@ cAudioManager::DestroyEntity(int32 id) } void -cAudioManager::SetEntityStatus(int32 id, uint8 status) +cAudioManager::SetEntityStatus(int32 id, bool8 status) { if (m_bIsInitialised && id >= 0 && id < NUM_AUDIOENTITIES && m_asAudioEntities[id].m_bIsUsed) m_asAudioEntities[id].m_bStatus = status; @@ -193,7 +193,7 @@ cAudioManager::PlayOneShot(int32 index, uint16 sound, float vol) } } else { int32 i = 0; - while (true) { + while (TRUE) { if (i >= entity.m_AudioEvents) { if (entity.m_AudioEvents < ARRAY_SIZE(entity.m_awAudioEvent)) { entity.m_awAudioEvent[i] = sound; @@ -246,7 +246,7 @@ cAudioManager::SetEffectsFadeVol(uint8 volume) const } void -cAudioManager::SetMonoMode(uint8 mono) +cAudioManager::SetMonoMode(bool8 mono) { SampleManager.SetMonoMode(mono); } @@ -261,7 +261,7 @@ void cAudioManager::ResetTimers(uint32 time) { if (m_bIsInitialised) { - m_bTimerJustReset = true; + m_bTimerJustReset = TRUE; m_nTimer = time; ClearRequestedQueue(); if (m_nActiveSampleQueue) { @@ -280,7 +280,7 @@ cAudioManager::ResetTimers(uint32 time) SampleManager.SetEffectsFadeVolume(0); SampleManager.SetMusicFadeVolume(0); MusicManager.ResetMusicAfterReload(); - m_bIsPlayerShutUp = false; + m_bIsPlayerShutUp = FALSE; #ifdef AUDIO_OAL SampleManager.Service(); #endif @@ -391,13 +391,13 @@ cAudioManager::SetSpeakerConfig(int32 conf) const SampleManager.SetSpeakerConfig(conf); } -bool +bool8 cAudioManager::IsMP3RadioChannelAvailable() const { if (m_bIsInitialised) return SampleManager.IsMP3RadioChannelAvailable(); - return false; + return FALSE; } void @@ -417,25 +417,25 @@ cAudioManager::ReacquireDigitalHandle() const } void -cAudioManager::SetDynamicAcousticModelingStatus(uint8 status) +cAudioManager::SetDynamicAcousticModelingStatus(bool8 status) { - m_bDynamicAcousticModelingStatus = status!=0; + m_bDynamicAcousticModelingStatus = status; } -bool +bool8 cAudioManager::CheckForAnAudioFileOnCD() const { return SampleManager.CheckForAnAudioFileOnCD(); } -uint8 +char cAudioManager::GetCDAudioDriveLetter() const { if(m_bIsInitialised) return SampleManager.GetCDAudioDriveLetter(); - return 0; + return '\0'; } -bool +bool8 cAudioManager::IsAudioInitialised() const { return m_bIsInitialised; @@ -545,7 +545,7 @@ cAudioManager::RandomDisplacement(uint32 seed) const { int32 value; - static bool bPos = true; + static bool8 bPos = TRUE; static uint32 Adjustment = 0; if (!seed) @@ -576,7 +576,7 @@ cAudioManager::AddSampleToRequestedQueue() { int32 calculatedVolume; uint8 sampleIndex; - bool bReflections; + bool8 bReflections; if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) { calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (MAX_VOLUME - m_sQueueSample.m_nVolume); @@ -589,24 +589,24 @@ cAudioManager::AddSampleToRequestedQueue() ++m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; } m_sQueueSample.m_nCalculatedVolume = calculatedVolume; - m_sQueueSample.m_bLoopEnded = false; + m_sQueueSample.m_bLoopEnded = FALSE; if (m_sQueueSample.m_bIs2D || CCullZones::InRoomForAudio()) { - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bRequireReflection = FALSE; m_sQueueSample.m_nLoopsRemaining = 0; } if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount) { bReflections = m_sQueueSample.m_bRequireReflection; } else { - bReflections = false; + bReflections = FALSE; m_sQueueSample.m_nLoopsRemaining = 0; } - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bRequireReflection = FALSE; if ( m_bReverb && m_sQueueSample.m_bIs2D ) m_sQueueSample.field_4C = 30; if (!m_bDynamicAcousticModelingStatus) - m_sQueueSample.m_bReverbFlag = false; + m_sQueueSample.m_bReverbFlag = FALSE; m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample; @@ -773,7 +773,7 @@ cAudioManager::UpdateReflections() void cAudioManager::AddReleasingSounds() { - bool toProcess[44]; // why not 27? + bool8 toProcess[44]; // why not 27? int8 queue = m_nActiveSampleQueue == 0 ? 1 : 0; @@ -782,11 +782,11 @@ cAudioManager::AddReleasingSounds() if (sample.m_bLoopEnded) continue; - toProcess[i] = false; + toProcess[i] = FALSE; for (int32 j = 0; j < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; j++) { if (sample.m_nEntityIndex == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nEntityIndex && sample.m_nCounter == m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][j]].m_nCounter) { - toProcess[i] = true; + toProcess[i] = TRUE; break; } } @@ -811,7 +811,7 @@ cAudioManager::AddReleasingSounds() if (sample.m_nReleasingVolumeModificator < 20) ++sample.m_nReleasingVolumeModificator; } - sample.m_bReleasingSoundFlag = false; + sample.m_bReleasingSoundFlag = FALSE; } memcpy(&m_sQueueSample, &sample, sizeof(tSound)); AddSampleToRequestedQueue(); @@ -829,12 +829,12 @@ cAudioManager::ProcessActiveQueues() uint8 vol; uint8 offset; float x; - bool flag; - bool missionState; + bool8 flag; + bool8 missionState; for (int32 i = 0; i < m_nActiveSamples; i++) { - m_asSamples[m_nActiveSampleQueue][i].m_bIsProcessed = false; - m_asActiveSamples[i].m_bIsProcessed = false; + m_asSamples[m_nActiveSampleQueue][i].m_bIsProcessed = FALSE; + m_asActiveSamples[i].m_bIsProcessed = FALSE; } for (int32 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) { tSound& sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]]; @@ -847,19 +847,19 @@ cAudioManager::ProcessActiveQueues() if (m_FrameCounter & 1) { if (!(j & 1)) { - flag = false; + flag = FALSE; } else { - flag = true; + flag = TRUE; } } else if (j & 1) { - flag = false; + flag = FALSE; } else { - flag = true; + flag = TRUE; } if (flag && !SampleManager.GetChannelUsedFlag(j)) { - sample.m_bLoopEnded = true; - m_asActiveSamples[j].m_bLoopEnded = true; + sample.m_bLoopEnded = TRUE; + m_asActiveSamples[j].m_bLoopEnded = TRUE; m_asActiveSamples[j].m_nSampleIndex = NO_SAMPLE; m_asActiveSamples[j].m_nEntityIndex = AEHANDLE_NONE; continue; @@ -867,8 +867,8 @@ cAudioManager::ProcessActiveQueues() if (!sample.m_nReleasingVolumeDivider) sample.m_nReleasingVolumeDivider = 1; } - sample.m_bIsProcessed = true; - m_asActiveSamples[j].m_bIsProcessed = true; + sample.m_bIsProcessed = TRUE; + m_asActiveSamples[j].m_bIsProcessed = TRUE; sample.m_nVolumeChange = -1; if (!sample.m_bReleasingSoundFlag) { if (sample.m_bIs2D) { @@ -900,10 +900,10 @@ cAudioManager::ProcessActiveQueues() emittingVol = vol; } - missionState = false; + missionState = FALSE; for (int32 k = 0; k < ARRAY_SIZE(m_sMissionAudio.m_bIsMobile); k++) { if (m_sMissionAudio.m_bIsMobile[k]) { - missionState = true; + missionState = TRUE; break; } } @@ -924,8 +924,8 @@ cAudioManager::ProcessActiveQueues() SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag); break; //continue for i } - sample.m_bIsProcessed = false; - m_asActiveSamples[j].m_bIsProcessed = false; + sample.m_bIsProcessed = FALSE; + m_asActiveSamples[j].m_bIsProcessed = FALSE; //continue for j } } @@ -966,10 +966,10 @@ cAudioManager::ProcessActiveQueues() } if (SampleManager.InitialiseChannel(k, m_asActiveSamples[k].m_nSampleIndex, m_asActiveSamples[k].m_nBankIndex)) { SampleManager.SetChannelFrequency(k, m_asActiveSamples[k].m_nFrequency); - bool isMobile = false; + bool8 isMobile = FALSE; for (int32 l = 0; l < ARRAY_SIZE(m_sMissionAudio.m_bIsMobile); l++) { if (m_sMissionAudio.m_bIsMobile[l]) { - isMobile = true; + isMobile = TRUE; break; } } @@ -1000,8 +1000,8 @@ cAudioManager::ProcessActiveQueues() SampleManager.SetChannel3DDistances(k, m_asActiveSamples[k].m_fSoundIntensity, 0.25f * m_asActiveSamples[k].m_fSoundIntensity); SampleManager.StartChannel(k); } - m_asActiveSamples[k].m_bIsProcessed = true; - sample.m_bIsProcessed = true; + m_asActiveSamples[k].m_bIsProcessed = TRUE; + sample.m_bIsProcessed = TRUE; sample.m_nVolumeChange = -1; break; } @@ -1029,28 +1029,28 @@ cAudioManager::ClearActiveSamples() m_asActiveSamples[i].m_nCounter = 0; m_asActiveSamples[i].m_nSampleIndex = NO_SAMPLE; m_asActiveSamples[i].m_nBankIndex = INVALID_SFX_BANK; - m_asActiveSamples[i].m_bIs2D = false; + m_asActiveSamples[i].m_bIs2D = FALSE; m_asActiveSamples[i].m_nReleasingVolumeModificator = 5; m_asActiveSamples[i].m_nFrequency = 0; m_asActiveSamples[i].m_nVolume = 0; m_asActiveSamples[i].m_nEmittingVolume = 0; m_asActiveSamples[i].m_fDistance = 0.0f; - m_asActiveSamples[i].m_bIsProcessed = false; - m_asActiveSamples[i].m_bLoopEnded = false; + m_asActiveSamples[i].m_bIsProcessed = FALSE; + m_asActiveSamples[i].m_bLoopEnded = FALSE; m_asActiveSamples[i].m_nLoopCount = 1; m_asActiveSamples[i].m_nLoopStart = 0; m_asActiveSamples[i].m_nLoopEnd = -1; m_asActiveSamples[i].m_fSpeedMultiplier = 0.0f; m_asActiveSamples[i].m_fSoundIntensity = 200.0f; m_asActiveSamples[i].m_nOffset = 63; - m_asActiveSamples[i].m_bReleasingSoundFlag = false; + m_asActiveSamples[i].m_bReleasingSoundFlag = FALSE; m_asActiveSamples[i].m_nCalculatedVolume = 0; m_asActiveSamples[i].m_nReleasingVolumeDivider = 0; m_asActiveSamples[i].m_nVolumeChange = -1; m_asActiveSamples[i].m_vecPos = CVector(0.0f, 0.0f, 0.0f); - m_asActiveSamples[i].m_bReverbFlag = false; + m_asActiveSamples[i].m_bReverbFlag = FALSE; m_asActiveSamples[i].m_nLoopsRemaining = 0; - m_asActiveSamples[i].m_bRequireReflection = false; + m_asActiveSamples[i].m_bRequireReflection = FALSE; } } diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 98faa8fd..49535252 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -13,7 +13,7 @@ public: int32 m_nCounter; int32 m_nSampleIndex; uint8 m_nBankIndex; - bool m_bIs2D; + bool8 m_bIs2D; int32 m_nReleasingVolumeModificator; uint32 m_nFrequency; uint8 m_nVolume; @@ -24,16 +24,16 @@ public: uint8 m_nEmittingVolume; float m_fSpeedMultiplier; float m_fSoundIntensity; - bool m_bReleasingSoundFlag; + bool8 m_bReleasingSoundFlag; CVector m_vecPos; - bool m_bReverbFlag; + bool8 m_bReverbFlag; uint8 m_nLoopsRemaining; - bool m_bRequireReflection; // Used for oneshots + bool8 m_bRequireReflection; // Used for oneshots uint8 m_nOffset; uint8 field_4C; int32 m_nReleasingVolumeDivider; - bool m_bIsProcessed; - bool m_bLoopEnded; + bool8 m_bIsProcessed; + bool8 m_bLoopEnded; int32 m_nCalculatedVolume; int8 m_nVolumeChange; }; @@ -48,7 +48,7 @@ class tAudioEntity public: eAudioType m_nType; void *m_pEntity; - bool m_bIsUsed; + bool8 m_bIsUsed; uint8 m_bStatus; int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS]; float m_afVolume[NUM_AUDIOENTITY_EVENTS]; @@ -78,7 +78,7 @@ public: uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS]; uint8 m_nActiveBank; #ifdef GTA_PC - bool m_bDelay; + bool8 m_bDelay; uint32 m_nDelayTimer; #endif @@ -110,14 +110,14 @@ class cMissionAudio { public: CVector m_vecPos[MISSION_AUDIO_SLOTS]; - bool m_bPredefinedProperties[MISSION_AUDIO_SLOTS]; + bool8 m_bPredefinedProperties[MISSION_AUDIO_SLOTS]; int32 m_nSampleIndex[MISSION_AUDIO_SLOTS]; uint8 m_nLoadingStatus[MISSION_AUDIO_SLOTS]; uint8 m_nPlayStatus[MISSION_AUDIO_SLOTS]; - bool m_bIsPlaying[MISSION_AUDIO_SLOTS]; + bool8 m_bIsPlaying[MISSION_AUDIO_SLOTS]; int32 m_nMissionAudioCounter[MISSION_AUDIO_SLOTS]; - bool m_bIsPlayed[MISSION_AUDIO_SLOTS]; - bool m_bIsMobile[MISSION_AUDIO_SLOTS]; + bool8 m_bIsPlayed[MISSION_AUDIO_SLOTS]; + bool8 m_bIsMobile[MISSION_AUDIO_SLOTS]; }; VALIDATE_SIZE(cMissionAudio, 0x38); @@ -141,7 +141,7 @@ class CPed; class cPedParams { public: - bool m_bDistanceCalculated; + bool8 m_bDistanceCalculated; float m_fDistance; CPed *m_pPed; @@ -157,7 +157,7 @@ class cVehicleParams { public: int32 m_VehicleType; - bool m_bDistanceCalculated; + bool8 m_bDistanceCalculated; float m_fDistance; CVehicle *m_pVehicle; cTransmission *m_pTransmission; @@ -193,15 +193,15 @@ enum { class cAudioManager { public: - bool m_bIsInitialised; + bool8 m_bIsInitialised; uint8 m_bReverb; // unused - bool m_bFifthFrameFlag; + bool8 m_bFifthFrameFlag; uint8 m_nActiveSamples; uint8 field_4; // unused - bool m_bDynamicAcousticModelingStatus; + bool8 m_bDynamicAcousticModelingStatus; int8 field_6; float m_fSpeedOfSound; - bool m_bTimerJustReset; + bool8 m_bTimerJustReset; int32 m_nTimer; tSound m_sQueueSample; uint8 m_nActiveSampleQueue; @@ -217,11 +217,11 @@ public: cAudioScriptObjectManager m_sAudioScriptObjectManager; // miami - uint8 m_bIsPlayerShutUp; + bool8 m_bIsPlayerShutUp; uint8 m_nPlayerMood; uint32 m_nPlayerMoodTimer; uint8 field_rest[4]; - bool m_bGenericSfx; + bool8 m_bGenericSfx; cPedComments m_sPedComments; int32 m_nFireAudioEntity; @@ -253,19 +253,19 @@ public: float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; } // done int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; } int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; } - bool IsMissionAudioSamplePlaying(uint8 slot) const; // { return m_sMissionAudio.m_nPlayStatus == 1; } - bool ShouldDuckMissionAudio(uint8 slot) const; + bool8 IsMissionAudioSamplePlaying(uint8 slot) const; // { return m_sMissionAudio.m_nPlayStatus == 1; } + bool8 ShouldDuckMissionAudio(uint8 slot) const; // "Should" be in alphabetic order, except "getXTalkSfx" void AddDetailsToRequestedOrderList(uint8 sample); // done (inlined in vc) - void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank, uint8 counter, bool notLooping); // done + void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank, uint8 counter, bool8 notLooping); // done void AddReflectionsToRequestedQueue(); // done void AddReleasingSounds(); // done void AddSampleToRequestedQueue(); // done void AgeCrimes(); // done (inlined in vc) - void CalculateDistance(bool &condition, float dist); // done - bool CheckForAnAudioFileOnCD() const; // done + void CalculateDistance(bool8 &condition, float dist); // done + bool8 CheckForAnAudioFileOnCD() const; // done void ClearActiveSamples(); // done void ClearMissionAudio(uint8 slot); // done (inlined in vc) void ClearRequestedQueue(); // done (inlined in vc) @@ -379,7 +379,7 @@ public: void GenerateIntegerRandomNumberTable(); // done char *Get3DProviderName(uint8 id) const; // done - uint8 GetCDAudioDriveLetter() const; // done + char GetCDAudioDriveLetter() const; // done int8 GetCurrent3DProviderIndex() const; // done int8 AutoDetect3DProviders() const; // done float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used @@ -396,17 +396,17 @@ public: float velocityChange); // done float GetVehicleNonDriveWheelSkidValue(CVehicle *veh, tWheelState wheelState, cTransmission *transmission, float velocityChange); // done - bool HasAirBrakes(int32 model) const; // done + bool8 HasAirBrakes(int32 model) const; // done void Initialise(); // done void InitialisePoliceRadio(); // done void InitialisePoliceRadioZones(); // done void InterrogateAudioEntities(); // done (inlined) - bool IsAudioInitialised() const; // done - bool IsMissionAudioSampleFinished(uint8 slot); // done - bool IsMP3RadioChannelAvailable() const; // done + bool8 IsAudioInitialised() const; // done + bool8 IsMissionAudioSampleFinished(uint8 slot); // done + bool8 IsMP3RadioChannelAvailable() const; // done - bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; //done + bool8 MissionScriptAudioUsesPoliceChannel(int32 soundMission) const; //done void PlayLoadedMissionAudio(uint8 slot); // done void PlayOneShot(int32 index, uint16 sound, float vol); // done @@ -420,20 +420,20 @@ public: void PreTerminateGameSpecificShutdown(); // done /// processX - main logic of adding new sounds void ProcessActiveQueues(); // done - bool ProcessAirBrakes(cVehicleParams& params); // done - bool ProcessBoatEngine(cVehicleParams& params); - bool ProcessBoatMovingOverWater(cVehicleParams& params); //done + bool8 ProcessAirBrakes(cVehicleParams& params); // done + bool8 ProcessBoatEngine(cVehicleParams& params); + bool8 ProcessBoatMovingOverWater(cVehicleParams& params); //done #ifdef GTA_BRIDGE void ProcessBridge(); // done(bcs not exists in VC) void ProcessBridgeMotor(); // done(bcs not exists in VC) void ProcessBridgeOneShots(); // done(bcs not exists in VC) void ProcessBridgeWarning(); // done(bcs not exists in VC) #endif - bool ProcessCarBombTick(cVehicleParams& params); // done + bool8 ProcessCarBombTick(cVehicleParams& params); // done void ProcessCarHeli(cVehicleParams& params); // done void ProcessCesna(cVehicleParams& params); // done //void ProcessCrane(); // done(bcs not exists in VC) - bool ProcessEngineDamage(cVehicleParams& params); // done + bool8 ProcessEngineDamage(cVehicleParams& params); // done void ProcessEntity(int32 sound); // done void ProcessExplosions(int32 explosion); // done void ProcessFireHydrant(); // done @@ -462,25 +462,25 @@ public: void ProcessProjectiles(); // done void ProcessRainOnVehicle(cVehicleParams& params); // done void ProcessReverb() const; // done - bool ProcessReverseGear(cVehicleParams& params); // done + bool8 ProcessReverseGear(cVehicleParams& params); // done void ProcessScriptObject(int32 id); // done void ProcessSpecial(); // done #ifdef GTA_TRAIN - bool ProcessTrainNoise(cVehicleParams *params); //done(bcs not exists in VC) + bool8 ProcessTrainNoise(cVehicleParams *params); //done(bcs not exists in VC) #endif void ProcessVehicle(CVehicle *vehicle); // done - bool ProcessVehicleDoors(cVehicleParams ¶ms); // done + bool8 ProcessVehicleDoors(cVehicleParams ¶ms); // done void ProcessVehicleEngine(cVehicleParams ¶ms); // done void ProcessVehicleFlatTyre(cVehicleParams ¶ms); // done - bool ProcessVehicleHorn(cVehicleParams ¶ms); // done + bool8 ProcessVehicleHorn(cVehicleParams ¶ms); // done void ProcessVehicleOneShots(cVehicleParams ¶ms); // done - bool ProcessVehicleReverseWarning(cVehicleParams ¶ms); // done - bool ProcessVehicleRoadNoise(cVehicleParams ¶ms); // done - bool ProcessVehicleSirenOrAlarm(cVehicleParams ¶ms); // done - bool ProcessVehicleSkidding(cVehicleParams ¶ms); // done + bool8 ProcessVehicleReverseWarning(cVehicleParams ¶ms); // done + bool8 ProcessVehicleRoadNoise(cVehicleParams ¶ms); // done + bool8 ProcessVehicleSirenOrAlarm(cVehicleParams ¶ms); // done + bool8 ProcessVehicleSkidding(cVehicleParams ¶ms); // done void ProcessWaterCannon(int32); // done void ProcessWeather(int32 id); // done - bool ProcessWetRoadNoise(cVehicleParams& params); // done + bool8 ProcessWetRoadNoise(cVehicleParams& params); // done void ProcessEscalators(); // done void ProcessExtraSounds(); // done @@ -499,26 +499,26 @@ public: void ServicePoliceRadioChannel(uint8 wantedLevel); // done void ServiceSoundEffects(); // done int8 SetCurrent3DProvider(uint8 which); // done - void SetDynamicAcousticModelingStatus(uint8 status); // done + void SetDynamicAcousticModelingStatus(bool8 status); // done void SetEffectsFadeVol(uint8 volume) const; // done void SetEffectsMasterVolume(uint8 volume) const; // done void SetMP3BoostVolume(uint8 volume) const; // done - void SetEntityStatus(int32 id, uint8 status); // done + void SetEntityStatus(int32 id, bool8 status); // done uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision); // done void SetMissionAudioLocation(uint8 slot, float x, float y, float z); // done void SetMissionScriptPoliceAudio(int32 sfx) const; // inlined and optimized - void SetMonoMode(uint8 mono); // done + void SetMonoMode(bool8 mono); // done void SetMusicFadeVol(uint8 volume) const; // done void SetMusicMasterVolume(uint8 volume) const; // done void SetSpeakerConfig(int32 conf) const; // done void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter); // done void SetUpOneShotCollisionSound(const cAudioCollision &col); // done - bool SetupCrimeReport(); // done - bool SetupJumboEngineSound(uint8 vol, uint32 freq); // done - bool SetupJumboFlySound(uint8 emittingVol); // done - bool SetupJumboRumbleSound(uint8 emittingVol); // done - bool SetupJumboTaxiSound(uint8 vol); // done - bool SetupJumboWhineSound(uint8 emittingVol, uint32 freq); // done + bool8 SetupCrimeReport(); // done + bool8 SetupJumboEngineSound(uint8 vol, uint32 freq); // done + bool8 SetupJumboFlySound(uint8 emittingVol); // done + bool8 SetupJumboRumbleSound(uint8 emittingVol); // done + bool8 SetupJumboTaxiSound(uint8 vol); // done + bool8 SetupJumboWhineSound(uint8 emittingVol, uint32 freq); // done void SetupPedComments(cPedParams ¶ms, uint16 sound); // done void SetupSuspectLastSeenReport(); @@ -527,12 +527,12 @@ public: void UpdateGasPedalAudio(CVehicle *veh, int vehType); // done void UpdateReflections(); // done - bool UsesReverseWarning(int32 model) const; // done - bool UsesSiren(cVehicleParams ¶ms) const; // done - bool UsesSirenSwitching(cVehicleParams ¶ms) const; // done + bool8 UsesReverseWarning(int32 model) const; // done + bool8 UsesSiren(cVehicleParams ¶ms) const; // done + bool8 UsesSirenSwitching(cVehicleParams ¶ms) const; // done CVehicle *FindVehicleOfPlayer(); // done - void SetPedTalkingStatus(CPed *ped, uint8 status); // done + void SetPedTalkingStatus(CPed *ped, bool8 status); // done void SetPlayersMood(uint8 mood, uint32 time); // done float Sqrt(float v) const { return v <= 0.0f ? 0.0f : ::Sqrt(v); } diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index 7c99e89f..bc77361f 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -39,7 +39,7 @@ cDMAudio::DestroyEntity(int32 audioEntity) } void -cDMAudio::SetEntityStatus(int32 audioEntity, uint8 status) +cDMAudio::SetEntityStatus(int32 audioEntity, bool8 status) { AudioManager.SetEntityStatus(audioEntity, status); } @@ -57,7 +57,7 @@ cDMAudio::DestroyAllGameCreatedEntities(void) } void -cDMAudio::SetMonoMode(uint8 mono) +cDMAudio::SetMonoMode(bool8 mono) { AudioManager.SetMonoMode(mono); } @@ -142,7 +142,7 @@ cDMAudio::SetSpeakerConfig(int32 config) AudioManager.SetSpeakerConfig(config); } -bool +bool8 cDMAudio::IsMP3RadioChannelAvailable(void) { return AudioManager.IsMP3RadioChannelAvailable(); @@ -161,12 +161,12 @@ cDMAudio::ReacquireDigitalHandle(void) } void -cDMAudio::SetDynamicAcousticModelingStatus(uint8 status) +cDMAudio::SetDynamicAcousticModelingStatus(bool8 status) { AudioManager.SetDynamicAcousticModelingStatus(status); } -bool +bool8 cDMAudio::CheckForAnAudioFileOnCD(void) { return AudioManager.CheckForAnAudioFileOnCD(); @@ -178,7 +178,7 @@ cDMAudio::GetCDAudioDriveLetter(void) return AudioManager.GetCDAudioDriveLetter(); } -bool +bool8 cDMAudio::IsAudioInitialised(void) { return AudioManager.IsAudioInitialised(); @@ -196,7 +196,7 @@ cDMAudio::CreateLoopingScriptObject(cAudioScriptObject *scriptObject) int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject); if ( AEHANDLE_IS_OK(audioEntity) ) - AudioManager.SetEntityStatus(audioEntity, true); + AudioManager.SetEntityStatus(audioEntity, TRUE); return audioEntity; } @@ -214,7 +214,7 @@ cDMAudio::CreateOneShotScriptObject(cAudioScriptObject *scriptObject) if ( AEHANDLE_IS_OK(audioEntity) ) { - AudioManager.SetEntityStatus(audioEntity, true); + AudioManager.SetEntityStatus(audioEntity, TRUE); AudioManager.PlayOneShot(audioEntity, scriptObject->AudioId, 0.0f); } } @@ -244,7 +244,7 @@ cDMAudio::PlayRadioAnnouncement(uint32 announcement) } void -cDMAudio::PlayFrontEndTrack(uint32 track, uint8 frontendFlag) +cDMAudio::PlayFrontEndTrack(uint32 track, bool8 frontendFlag) { MusicManager.PlayFrontEndTrack(track, frontendFlag); } @@ -309,7 +309,7 @@ cDMAudio::PlayLoadedMissionAudio(uint8 slot) AudioManager.PlayLoadedMissionAudio(slot); } -bool +bool8 cDMAudio::IsMissionAudioSampleFinished(uint8 slot) { return AudioManager.IsMissionAudioSampleFinished(slot); @@ -340,7 +340,7 @@ cDMAudio::SetRadioChannel(uint32 radio, int32 pos) } void -cDMAudio::SetStartingTrackPositions(uint8 isStartGame) +cDMAudio::SetStartingTrackPositions(bool8 isStartGame) { MusicManager.SetStartingTrackPositions(isStartGame); } @@ -364,7 +364,7 @@ cDMAudio::GetRadioPosition(uint32 station) } void -cDMAudio::SetPedTalkingStatus(CPed *ped, uint8 status) +cDMAudio::SetPedTalkingStatus(CPed *ped, bool8 status) { return AudioManager.SetPedTalkingStatus(ped, status); } @@ -376,7 +376,7 @@ cDMAudio::SetPlayersMood(uint8 mood, uint32 time) } void -cDMAudio::ShutUpPlayerTalking(uint8 state) +cDMAudio::ShutUpPlayerTalking(bool8 state) { AudioManager.m_bIsPlayerShutUp = state; } \ No newline at end of file diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h index 2c10043f..5b684fd3 100644 --- a/src/audio/DMAudio.h +++ b/src/audio/DMAudio.h @@ -25,11 +25,11 @@ public: int32 CreateEntity(eAudioType type, void *UID); void DestroyEntity(int32 audioEntity); - void SetEntityStatus(int32 audioEntity, uint8 status); + void SetEntityStatus(int32 audioEntity, bool8 status); void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume); void DestroyAllGameCreatedEntities(void); - void SetMonoMode(uint8 mono); + void SetMonoMode(bool8 mono); void SetMP3BoostVolume(uint8 volume); void SetEffectsMasterVolume(uint8 volume); void SetMusicMasterVolume(uint8 volume); @@ -46,17 +46,17 @@ public: void SetSpeakerConfig(int32 config); - bool IsMP3RadioChannelAvailable(void); + bool8 IsMP3RadioChannelAvailable(void); void ReleaseDigitalHandle(void); void ReacquireDigitalHandle(void); - void SetDynamicAcousticModelingStatus(uint8 status); + void SetDynamicAcousticModelingStatus(bool8 status); - bool CheckForAnAudioFileOnCD(void); + bool8 CheckForAnAudioFileOnCD(void); char GetCDAudioDriveLetter(void); - bool IsAudioInitialised(void); + bool8 IsAudioInitialised(void); void ReportCrime(eCrimeType crime, CVector const &pos); @@ -70,7 +70,7 @@ public: void PlayFrontEndSound(uint16 frontend, uint32 volume); void PlayRadioAnnouncement(uint32 announcement); - void PlayFrontEndTrack(uint32 track, uint8 frontendFlag); + void PlayFrontEndTrack(uint32 track, bool8 frontendFlag); void StopFrontEndTrack(void); void ResetTimers(uint32 time); @@ -85,19 +85,19 @@ public: uint8 GetMissionAudioLoadingStatus(uint8 slot); void SetMissionAudioLocation(uint8 slot, float x, float y, float z); void PlayLoadedMissionAudio(uint8 slot); - bool IsMissionAudioSampleFinished(uint8 slot); + bool8 IsMissionAudioSampleFinished(uint8 slot); void ClearMissionAudio(uint8 slot); uint8 GetRadioInCar(void); void SetRadioInCar(uint32 radio); void SetRadioChannel(uint32 radio, int32 pos); - void SetStartingTrackPositions(uint8 isStartGame); + void SetStartingTrackPositions(bool8 isStartGame); float *GetListenTimeArray(); uint32 GetFavouriteRadioStation(); int32 GetRadioPosition(uint32 station); - void SetPedTalkingStatus(class CPed *ped, uint8 status); + void SetPedTalkingStatus(class CPed *ped, bool8 status); void SetPlayersMood(uint8 mood, uint32 time); - void ShutUpPlayerTalking(uint8 state); + void ShutUpPlayerTalking(bool8 state); }; extern cDMAudio DMAudio; diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 1a727b4f..e56bc013 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -28,7 +28,7 @@ static_assert(false, "R*'s radio implementation is quite buggy, RADIO_SCROLL_TO_ cMusicManager MusicManager; int32 gNumRetunePresses; int32 gRetuneCounter; -bool g_bAnnouncementReadPosAlready; +bool8 g_bAnnouncementReadPosAlready; uint8 RadioStaticCounter = 5; uint32 RadioStaticTimer; @@ -50,13 +50,13 @@ uint32 NewGameRadioTimers[10] = cMusicManager::cMusicManager() { - m_bIsInitialised = false; - m_bDisabled = false; + m_bIsInitialised = FALSE; + m_bDisabled = FALSE; m_nFrontendTrack = NO_TRACK; m_nPlayingTrack = NO_TRACK; m_nUpcomingMusicMode = MUSICMODE_DISABLED; m_nMusicMode = MUSICMODE_DISABLED; - m_bSetNextStation = false; + m_bSetNextStation = FALSE; for (int i = 0; i < NUM_RADIOS; i++) aListenTimeArray[i] = 0.0f; @@ -66,7 +66,7 @@ cMusicManager::cMusicManager() m_nCurrentVolume = 0; m_nMaxVolume = 0; m_nAnnouncement = NO_TRACK; - m_bAnnouncementInProgress = false; + m_bAnnouncementInProgress = FALSE; } void @@ -74,38 +74,38 @@ cMusicManager::ResetMusicAfterReload() { float afRadioTime[NUM_RADIOS]; - m_bRadioSetByScript = false; + m_bRadioSetByScript = FALSE; m_nRadioStationScript = WILDSTYLE; m_nRadioPosition = -1; m_nAnnouncement = NO_TRACK; - m_bAnnouncementInProgress = false; - m_bSetNextStation = false; + m_bAnnouncementInProgress = FALSE; + m_bSetNextStation = FALSE; RadioStaticTimer = 0; gNumRetunePresses = 0; gRetuneCounter = 0; m_nFrontendTrack = NO_TRACK; m_nPlayingTrack = NO_TRACK; - m_FrontendLoopFlag = false; - m_bTrackChangeStarted = false; + m_FrontendLoopFlag = FALSE; + m_bTrackChangeStarted = FALSE; m_nNextTrack = NO_TRACK; - m_nNextLoopFlag = false; - m_bVerifyNextTrackStartedToPlay = false; - m_bGameplayAllowsRadio = false; - m_bRadioStreamReady = false; + m_nNextLoopFlag = FALSE; + m_bVerifyNextTrackStartedToPlay = FALSE; + m_bGameplayAllowsRadio = FALSE; + m_bRadioStreamReady = FALSE; nFramesSinceCutsceneEnded = -1; - m_bUserResumedGame = false; - m_bMusicModeChangeStarted = false; - m_bEarlyFrontendTrack = false; + m_bUserResumedGame = FALSE; + m_bMusicModeChangeStarted = FALSE; + m_bEarlyFrontendTrack = FALSE; m_nVolumeLatency = 0; m_nCurrentVolume = 0; m_nMaxVolume = 0; - bool bRadioWasEverListened = false; + bool8 bRadioWasEverListened = FALSE; for (int i = 0; i < NUM_RADIOS; i++) { afRadioTime[i] = CStats::GetFavoriteRadioStationList(i); if (!bRadioWasEverListened && afRadioTime[i] != 0.0f) - bRadioWasEverListened = true; + bRadioWasEverListened = TRUE; } if (!bRadioWasEverListened) return; @@ -125,7 +125,7 @@ cMusicManager::ResetMusicAfterReload() } void -cMusicManager::SetStartingTrackPositions(uint8 isNewGameTimer) +cMusicManager::SetStartingTrackPositions(bool8 isNewGameTimer) { int pos; @@ -174,15 +174,15 @@ cMusicManager::SetStartingTrackPositions(uint8 isNewGameTimer) } } -bool +bool8 cMusicManager::Initialise() { if (!IsInitialised()) { - m_bIsInitialised = true; - SetStartingTrackPositions(false); - m_bResetTimers = false; + m_bIsInitialised = TRUE; + SetStartingTrackPositions(FALSE); + m_bResetTimers = FALSE; m_nResetTime = 0; - m_bRadioSetByScript = false; + m_bRadioSetByScript = FALSE; m_nRadioStationScript = WILDSTYLE; m_nRadioPosition = -1; m_nRadioInCar = NO_TRACK; @@ -192,18 +192,18 @@ cMusicManager::Initialise() m_nPlayingTrack = NO_TRACK; m_nUpcomingMusicMode = MUSICMODE_DISABLED; m_nMusicMode = MUSICMODE_DISABLED; - m_FrontendLoopFlag = false; - m_bTrackChangeStarted = false; + m_FrontendLoopFlag = FALSE; + m_bTrackChangeStarted = FALSE; m_nNextTrack = NO_TRACK; - m_nNextLoopFlag = false; - m_bVerifyNextTrackStartedToPlay = false; - m_bGameplayAllowsRadio = false; - m_bRadioStreamReady = false; + m_nNextLoopFlag = FALSE; + m_bVerifyNextTrackStartedToPlay = FALSE; + m_bGameplayAllowsRadio = FALSE; + m_bRadioStreamReady = FALSE; nFramesSinceCutsceneEnded = -1; - m_bUserResumedGame = false; - m_bMusicModeChangeStarted = false; + m_bUserResumedGame = FALSE; + m_bMusicModeChangeStarted = FALSE; m_nMusicModeToBeSet = MUSICMODE_DISABLED; - m_bEarlyFrontendTrack = false; + m_bEarlyFrontendTrack = FALSE; m_nVolumeLatency = 0; m_nCurrentVolume = 0; m_nMaxVolume = 0; @@ -220,7 +220,7 @@ cMusicManager::Terminate() SampleManager.StopStreamedFile(0); m_nPlayingTrack = NO_TRACK; } - m_bIsInitialised = false; + m_bIsInitialised = FALSE; } void @@ -230,29 +230,29 @@ cMusicManager::SetRadioChannelByScript(uint32 station, int32 pos) if (station == STREAMED_SOUND_RADIO_MP3_PLAYER) station = STREAMED_SOUND_CITY_AMBIENT; if (station <= STREAMED_SOUND_RADIO_POLICE) { - m_bRadioSetByScript = true; + m_bRadioSetByScript = TRUE; m_nRadioStationScript = station; m_nRadioPosition = pos == -1 ? -1 : pos % m_aTracks[station].m_nLength; } } } -bool +bool8 cMusicManager::PlayerInCar() { CVehicle *vehicle = AudioManager.FindVehicleOfPlayer(); if(!vehicle) - return false; + return FALSE; int32 State = FindPlayerPed()->m_nPedState; if(State == PED_DRAG_FROM_CAR || State == PED_EXIT_CAR || State == PED_ARRESTED) - return false; + return FALSE; if (vehicle->GetStatus() == STATUS_WRECKED) - return false; + return FALSE; - return true; + return TRUE; } uint32 @@ -325,16 +325,16 @@ cMusicManager::ChangeMusicMode(uint8 mode) while (SampleManager.IsStreamPlaying(0)) SampleManager.StopStreamedFile(0); m_nMusicMode = m_nUpcomingMusicMode; - m_bMusicModeChangeStarted = false; - m_bTrackChangeStarted = false; + m_bMusicModeChangeStarted = FALSE; + m_bTrackChangeStarted = FALSE; m_nNextTrack = NO_TRACK; - m_nNextLoopFlag = false; - m_bVerifyNextTrackStartedToPlay = false; + m_nNextLoopFlag = FALSE; + m_bVerifyNextTrackStartedToPlay = FALSE; m_nPlayingTrack = NO_TRACK; m_nFrontendTrack = NO_TRACK; - m_bAnnouncementInProgress = false; + m_bAnnouncementInProgress = FALSE; m_nAnnouncement = NO_TRACK; - g_bAnnouncementReadPosAlready = false; + g_bAnnouncementReadPosAlready = FALSE; break; case MUSICMODE_DISABLE: m_nUpcomingMusicMode = MUSICMODE_DISABLED; break; default: return; @@ -344,7 +344,7 @@ cMusicManager::ChangeMusicMode(uint8 mode) void cMusicManager::ResetTimers(int32 time) { - m_bResetTimers = true; + m_bResetTimers = TRUE; m_nResetTime = time; } @@ -352,11 +352,11 @@ void cMusicManager::Service() { if (m_bResetTimers) { - m_bResetTimers = false; + m_bResetTimers = FALSE; m_nLastTrackServiceTime = m_nResetTime; } - static bool bRadioStatsRecorded = false; + static bool8 bRadioStatsRecorded = FALSE; if (!m_bIsInitialised || m_bDisabled) return; @@ -369,39 +369,39 @@ cMusicManager::Service() { case MUSICMODE_FRONTEND: ServiceFrontEndMode(); break; case MUSICMODE_GAME: ServiceGameMode(); break; - case MUSICMODE_CUTSCENE: SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0); break; + case MUSICMODE_CUTSCENE: SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 0); break; } } else m_nMusicMode = MUSICMODE_DISABLED; } else { - m_bMusicModeChangeStarted = true; + m_bMusicModeChangeStarted = TRUE; if (!m_bUserResumedGame && !AudioManager.m_nUserPause && AudioManager.m_nPreviousUserPause) - m_bUserResumedGame = true; + m_bUserResumedGame = TRUE; if (AudioManager.m_FrameCounter % 4 == 0) { gNumRetunePresses = 0; gRetuneCounter = 0; - m_bSetNextStation = false; + m_bSetNextStation = FALSE; if (SampleManager.IsStreamPlaying(0)) { if (m_nPlayingTrack != NO_TRACK && !bRadioStatsRecorded) { RecordRadioStats(); m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0); m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); - bRadioStatsRecorded = true; + bRadioStatsRecorded = TRUE; } SampleManager.StopStreamedFile(0); } else { - bRadioStatsRecorded = false; + bRadioStatsRecorded = FALSE; m_nMusicMode = m_nMusicModeToBeSet; - m_bMusicModeChangeStarted = false; - m_bTrackChangeStarted = false; + m_bMusicModeChangeStarted = FALSE; + m_bTrackChangeStarted = FALSE; m_nNextTrack = NO_TRACK; - m_nNextLoopFlag = false; - m_bVerifyNextTrackStartedToPlay = false; + m_nNextLoopFlag = FALSE; + m_bVerifyNextTrackStartedToPlay = FALSE; m_nPlayingTrack = NO_TRACK; if (m_bEarlyFrontendTrack) - m_bEarlyFrontendTrack = false; + m_bEarlyFrontendTrack = FALSE; else m_nFrontendTrack = NO_TRACK; } @@ -412,15 +412,15 @@ cMusicManager::Service() void cMusicManager::ServiceFrontEndMode() { - static bool bRadioStatsRecorded = false; + static bool8 bRadioStatsRecorded = FALSE; if (m_bAnnouncementInProgress) { SampleManager.StopStreamedFile(0); if (SampleManager.IsStreamPlaying(0)) return; - g_bAnnouncementReadPosAlready = false; + g_bAnnouncementReadPosAlready = FALSE; m_nAnnouncement = NO_TRACK; - m_bAnnouncementInProgress = false; + m_bAnnouncementInProgress = FALSE; m_nNextTrack = NO_TRACK; m_nFrontendTrack = NO_TRACK; m_nPlayingTrack = NO_TRACK; @@ -439,7 +439,7 @@ cMusicManager::ServiceFrontEndMode() else { if (m_nCurrentVolume < m_nMaxVolume) m_nCurrentVolume = Min(m_nMaxVolume, m_nCurrentVolume + 6); - SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE, 0); } } else { if (m_nPlayingTrack == STREAMED_SOUND_RADIO_MP3_PLAYER) @@ -448,13 +448,13 @@ cMusicManager::ServiceFrontEndMode() ChangeMusicMode(MUSICMODE_GAME); } } else { - m_bTrackChangeStarted = true; + m_bTrackChangeStarted = TRUE; if (m_bVerifyNextTrackStartedToPlay || !SampleManager.IsStreamPlaying(0)) { - bRadioStatsRecorded = false; + bRadioStatsRecorded = FALSE; if (SampleManager.IsStreamPlaying(0) || m_nNextTrack == NO_TRACK) { m_nPlayingTrack = m_nNextTrack; - m_bVerifyNextTrackStartedToPlay = false; - m_bTrackChangeStarted = false; + m_bVerifyNextTrackStartedToPlay = FALSE; + m_bTrackChangeStarted = FALSE; } else { uint32 trackStartPos = (m_nNextTrack > STREAMED_SOUND_RADIO_POLICE) ? 0 : GetTrackStartPos(m_nNextTrack); if (m_nNextTrack != NO_TRACK) { @@ -463,10 +463,10 @@ cMusicManager::ServiceFrontEndMode() m_nVolumeLatency = 3; m_nCurrentVolume = 0; m_nMaxVolume = 100; - SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE, 0); if (m_nNextTrack < STREAMED_SOUND_CITY_AMBIENT) m_nLastTrackServiceTime = CTimer::GetTimeInMillisecondsPauseMode(); - m_bVerifyNextTrackStartedToPlay = true; + m_bVerifyNextTrackStartedToPlay = TRUE; } } } else { @@ -474,9 +474,9 @@ cMusicManager::ServiceFrontEndMode() m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0); m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); RecordRadioStats(); - bRadioStatsRecorded = true; + bRadioStatsRecorded = TRUE; } - SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE, 0); SampleManager.StopStreamedFile(0); } } @@ -488,7 +488,7 @@ cMusicManager::ServiceGameMode() CPed *ped = FindPlayerPed(); CVehicle *vehicle = AudioManager.FindVehicleOfPlayer(); m_bRadioStreamReady = m_bGameplayAllowsRadio; - m_bGameplayAllowsRadio = false; + m_bGameplayAllowsRadio = FALSE; switch (CGame::currArea) { @@ -499,14 +499,14 @@ cMusicManager::ServiceGameMode() case AREA_BLOOD: case AREA_OVALRING: case AREA_MALIBU_CLUB: - m_bGameplayAllowsRadio = false; + m_bGameplayAllowsRadio = FALSE; break; default: if (SampleManager.GetMusicVolume()) { if (PlayerInCar()) - m_bGameplayAllowsRadio = true; + m_bGameplayAllowsRadio = TRUE; } else - m_bGameplayAllowsRadio = false; + m_bGameplayAllowsRadio = FALSE; break; } @@ -514,7 +514,7 @@ cMusicManager::ServiceGameMode() nFramesSinceCutsceneEnded = -1; gNumRetunePresses = 0; gRetuneCounter = 0; - m_bSetNextStation = false; + m_bSetNextStation = FALSE; } else if (ped) { if(!ped->DyingOrDead() && vehicle) { #ifdef GTA_PC @@ -567,11 +567,11 @@ cMusicManager::ServiceGameMode() if (m_bUserResumedGame) { - m_bRadioStreamReady = false; - m_bUserResumedGame = false; + m_bRadioStreamReady = FALSE; + m_bUserResumedGame = FALSE; } if (m_nPlayingTrack == NO_TRACK && m_nFrontendTrack == NO_TRACK) - m_bRadioStreamReady = false; + m_bRadioStreamReady = FALSE; if (m_bGameplayAllowsRadio) { @@ -594,7 +594,7 @@ cMusicManager::ServiceGameMode() m_aTracks[m_nFrontendTrack].m_nPosition = m_nRadioPosition; m_aTracks[m_nFrontendTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); } - m_bRadioSetByScript = false; + m_bRadioSetByScript = FALSE; return; } @@ -605,7 +605,7 @@ cMusicManager::ServiceGameMode() if (m_nAnnouncement < NO_TRACK) { if ((m_bAnnouncementInProgress || m_nFrontendTrack == m_nPlayingTrack) && ServiceAnnouncement()) { if (m_bAnnouncementInProgress) { - m_bSetNextStation = false; + m_bSetNextStation = FALSE; gNumRetunePresses = 0; gRetuneCounter = 0; return; @@ -613,7 +613,7 @@ cMusicManager::ServiceGameMode() if(m_nAnnouncement == NO_TRACK) { m_nNextTrack = NO_TRACK; m_nFrontendTrack = GetCarTuning(); - m_bSetNextStation = false; + m_bSetNextStation = FALSE; gRetuneCounter = 0; gNumRetunePresses = 0; } @@ -635,7 +635,7 @@ cMusicManager::ServiceGameMode() if(gRetuneCounter > 1) gRetuneCounter--; else if(gRetuneCounter == 1) { - m_bSetNextStation = true; + m_bSetNextStation = TRUE; gRetuneCounter = 0; } } @@ -644,7 +644,7 @@ cMusicManager::ServiceGameMode() { if (--gRetuneCounter == 0) { - m_bSetNextStation = true; + m_bSetNextStation = TRUE; gRetuneCounter = 0; } } @@ -694,7 +694,7 @@ cMusicManager::ServiceGameMode() SetUpCorrectAmbienceTrack(); ServiceTrack(vehicle, ped); if (m_bSetNextStation) - m_bSetNextStation = false; + m_bSetNextStation = FALSE; return; } if (UsesPoliceRadio(vehicle)) @@ -713,13 +713,13 @@ cMusicManager::ServiceGameMode() gRetuneCounter = 0; gNumRetunePresses = 0; - m_bSetNextStation = false; - m_bRadioSetByScript = false; + m_bSetNextStation = FALSE; + m_bRadioSetByScript = FALSE; if (m_nFrontendTrack >= STREAMED_SOUND_CITY_AMBIENT && m_nFrontendTrack <= STREAMED_SOUND_AMBSIL_AMBIENT) SetUpCorrectAmbienceTrack(); ServiceTrack(vehicle, ped); if (m_bSetNextStation) - m_bSetNextStation = false; + m_bSetNextStation = FALSE; return; } @@ -728,9 +728,9 @@ cMusicManager::ServiceGameMode() SampleManager.StopStreamedFile(0); if (SampleManager.IsStreamPlaying(0)) return; - g_bAnnouncementReadPosAlready = false; + g_bAnnouncementReadPosAlready = FALSE; m_nAnnouncement = NO_TRACK; - m_bAnnouncementInProgress = false; + m_bAnnouncementInProgress = FALSE; m_nNextTrack = NO_TRACK; m_nFrontendTrack = NO_TRACK; m_nPlayingTrack = NO_TRACK; @@ -808,7 +808,7 @@ GetHeightScale() } void -cMusicManager::ComputeAmbienceVol(uint8 reset, uint8& outVolume) +cMusicManager::ComputeAmbienceVol(bool8 reset, uint8& outVolume) { static float fVol = 0.0f; @@ -868,7 +868,7 @@ cMusicManager::ComputeAmbienceVol(uint8 reset, uint8& outVolume) outVolume = (90.0f - fHeightScale) / 50.0f * fVol; } -bool +bool8 cMusicManager::ServiceAnnouncement() { if (m_bAnnouncementInProgress) { @@ -876,36 +876,36 @@ cMusicManager::ServiceAnnouncement() m_nPlayingTrack = m_nNextTrack; else if (m_nPlayingTrack != NO_TRACK) { m_nAnnouncement = NO_TRACK; - m_bAnnouncementInProgress = false; + m_bAnnouncementInProgress = FALSE; m_nPlayingTrack = NO_TRACK; } - return true; + return TRUE; } else if (SampleManager.IsStreamPlaying(0)) { if (m_nPlayingTrack != NO_TRACK && !g_bAnnouncementReadPosAlready) { RecordRadioStats(); m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0); - g_bAnnouncementReadPosAlready = true; + g_bAnnouncementReadPosAlready = TRUE; m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); } SampleManager.StopStreamedFile(0); } else { - g_bAnnouncementReadPosAlready = false; + g_bAnnouncementReadPosAlready = FALSE; m_nPlayingTrack = NO_TRACK; m_nNextTrack = m_nAnnouncement; SampleManager.SetStreamedFileLoopFlag(0, 0); SampleManager.StartStreamedFile(m_nNextTrack, 0, 0); - SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 0, 0); - m_bAnnouncementInProgress = true; + SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, FALSE, 0); + m_bAnnouncementInProgress = TRUE; } - return true; + return TRUE; } void cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) { - static bool bRadioStatsRecorded = false; - static bool bRadioStatsRecorded2 = false; + static bool8 bRadioStatsRecorded = FALSE; + static bool8 bRadioStatsRecorded2 = FALSE; uint8 volume; if (!m_bTrackChangeStarted) m_nNextTrack = m_nFrontendTrack; @@ -915,30 +915,30 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0); m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); RecordRadioStats(); - bRadioStatsRecorded = true; + bRadioStatsRecorded = TRUE; } - SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE, 0); SampleManager.StopStreamedFile(0); } return; } if (bRadioStatsRecorded) { - bRadioStatsRecorded = false; + bRadioStatsRecorded = FALSE; m_nPlayingTrack = NO_TRACK; } if (m_nNextTrack != m_nPlayingTrack) { - m_bTrackChangeStarted = true; - SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0); + m_bTrackChangeStarted = TRUE; + SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE, 0); if (!(AudioManager.m_FrameCounter & 1)) { if (m_bVerifyNextTrackStartedToPlay || !SampleManager.IsStreamPlaying(0)) { - bRadioStatsRecorded2 = false; + bRadioStatsRecorded2 = FALSE; if (SampleManager.IsStreamPlaying(0)) { m_nPlayingTrack = m_nNextTrack; - m_bVerifyNextTrackStartedToPlay = false; - m_bTrackChangeStarted = false; + m_bVerifyNextTrackStartedToPlay = FALSE; + m_bTrackChangeStarted = FALSE; if (veh) { #ifdef FIX_BUGS if (m_nPlayingTrack >= STREAMED_SOUND_CITY_AMBIENT && m_nPlayingTrack <= STREAMED_SOUND_AMBSIL_AMBIENT) @@ -962,16 +962,16 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) m_nVolumeLatency = 10; m_nCurrentVolume = 0; m_nMaxVolume = 100; - SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE, 0); } else { - ComputeAmbienceVol(true, volume); - SampleManager.SetStreamedVolumeAndPan(volume, 63, 1, 0); + ComputeAmbienceVol(TRUE, volume); + SampleManager.SetStreamedVolumeAndPan(volume, 63, TRUE, 0); } if (m_nNextTrack < STREAMED_SOUND_CITY_AMBIENT) m_nLastTrackServiceTime = CTimer::GetTimeInMillisecondsPauseMode(); - m_bVerifyNextTrackStartedToPlay = true; + m_bVerifyNextTrackStartedToPlay = TRUE; } } } else { @@ -981,7 +981,7 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) { m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0); m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); - bRadioStatsRecorded2 = true; + bRadioStatsRecorded2 = TRUE; RecordRadioStats(); if (m_nPlayingTrack >= STREAMED_SOUND_HAVANA_CITY_AMBIENT && m_nPlayingTrack <= STREAMED_SOUND_HAVANA_BEACH_AMBIENT) { @@ -989,7 +989,7 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_HURRICANE, 0.0); } } - SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE, 0); SampleManager.StopStreamedFile(0); } } @@ -998,8 +998,8 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) if (m_nPlayingTrack >= STREAMED_SOUND_CITY_AMBIENT && m_nPlayingTrack <= STREAMED_SOUND_AMBSIL_AMBIENT) { - ComputeAmbienceVol(false, volume); - SampleManager.SetStreamedVolumeAndPan(volume, 63, 1, 0); + ComputeAmbienceVol(FALSE, volume); + SampleManager.SetStreamedVolumeAndPan(volume, 63, TRUE, 0); return; } if (CTimer::GetIsSlowMotionActive()) @@ -1009,7 +1009,7 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) float DistToTargetSq = (TheCamera.pTargetEntity->GetPosition() - TheCamera.GetPosition()).MagnitudeSqr(); if (DistToTargetSq >= SQR(55.0f)) { - SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE, 0); } else if (DistToTargetSq >= SQR(10.0f)) { @@ -1026,17 +1026,17 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) } if (gRetuneCounter != 0) volume = 0; - SampleManager.SetStreamedVolumeAndPan(volume, pan, 0, 0); + SampleManager.SetStreamedVolumeAndPan(volume, pan, FALSE, 0); } else if (AudioManager.ShouldDuckMissionAudio(0) || AudioManager.ShouldDuckMissionAudio(1)) - SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE, 0); else if (gRetuneCounter != 0) - SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE, 0); else - SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE, 0); } } else if (AudioManager.ShouldDuckMissionAudio(0) || AudioManager.ShouldDuckMissionAudio(1)) { - SampleManager.SetStreamedVolumeAndPan(Min(m_nCurrentVolume, 25), 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(Min(m_nCurrentVolume, 25), 63, FALSE, 0); nFramesSinceCutsceneEnded = 0; } else { if (nFramesSinceCutsceneEnded == -1) @@ -1058,7 +1058,7 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) } if (gRetuneCounter != 0) volume = 0; - SampleManager.SetStreamedVolumeAndPan(volume, 63, 0, 0); + SampleManager.SetStreamedVolumeAndPan(volume, 63, FALSE, 0); } if (m_nVolumeLatency > 0) m_nVolumeLatency--; @@ -1074,7 +1074,7 @@ cMusicManager::PreloadCutSceneMusic(uint32 track) while (SampleManager.IsStreamPlaying(0)) SampleManager.StopStreamedFile(0); SampleManager.PreloadStreamedFile(track, 0); - SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0); + SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 0); m_nPlayingTrack = track; } } @@ -1096,14 +1096,14 @@ cMusicManager::StopCutSceneMusic(void) } void -cMusicManager::PlayFrontEndTrack(uint32 track, uint8 loopFlag) +cMusicManager::PlayFrontEndTrack(uint32 track, bool8 loopFlag) { if (IsInitialised() && !m_bDisabled && track < TOTAL_STREAMED_SOUNDS && (m_nUpcomingMusicMode == MUSICMODE_FRONTEND || m_nMusicMode == MUSICMODE_FRONTEND)) { m_nFrontendTrack = track; m_FrontendLoopFlag = loopFlag; if (m_nMusicMode != MUSICMODE_FRONTEND) - m_bEarlyFrontendTrack = true; + m_bEarlyFrontendTrack = TRUE; } } @@ -1201,7 +1201,7 @@ cMusicManager::GetFavouriteRadioStation() return favstation; } -bool +bool8 cMusicManager::CheckForMusicInterruptions() { return (m_nPlayingTrack == STREAMED_SOUND_MISSION_COMPLETED) || (m_nPlayingTrack == STREAMED_SOUND_CUTSCENE_FINALE); @@ -1361,7 +1361,7 @@ cMusicManager::DisplayRadioStationName() #endif } -bool +bool8 cMusicManager::UsesPoliceRadio(CVehicle *veh) { switch (veh->GetModelIndex()) @@ -1371,18 +1371,18 @@ cMusicManager::UsesPoliceRadio(CVehicle *veh) case MI_COASTG: case MI_RHINO: case MI_BARRACKS: - return true; + return TRUE; case MI_MRWHOOP: case MI_HUNTER: - return false; + return FALSE; } return veh->UsesSiren(); } -bool +bool8 cMusicManager::UsesTaxiRadio(CVehicle *veh) { - if (veh->GetModelIndex() != MI_KAUFMAN) return false; + if (veh->GetModelIndex() != MI_KAUFMAN) return FALSE; return CTheScripts::bPlayerHasMetDebbieHarry; } @@ -1391,10 +1391,10 @@ cMusicManager::ServiceAmbience() { } -bool +bool8 cMusicManager::ChangeRadioChannel() { - return true; + return TRUE; } // these two are empty diff --git a/src/audio/MusicManager.h b/src/audio/MusicManager.h index 27456d79..3d2b7cee 100644 --- a/src/audio/MusicManager.h +++ b/src/audio/MusicManager.h @@ -16,18 +16,18 @@ class CPed; class cMusicManager { public: - bool m_bIsInitialised; - bool m_bDisabled; - bool m_bSetNextStation; + bool8 m_bIsInitialised; + bool8 m_bDisabled; + bool8 m_bSetNextStation; uint8 m_nVolumeLatency; uint8 m_nCurrentVolume; uint8 m_nMaxVolume; uint32 m_nAnnouncement; - bool m_bAnnouncementInProgress; + bool8 m_bAnnouncementInProgress; tStreamedSample m_aTracks[TOTAL_STREAMED_SOUNDS]; - bool m_bResetTimers; + bool8 m_bResetTimers; uint32 m_nResetTime; - bool m_bRadioSetByScript; + bool8 m_bRadioSetByScript; uint8 m_nRadioStationScript; int32 m_nRadioPosition; uint32 m_nRadioInCar; @@ -35,40 +35,40 @@ public: uint32 m_nPlayingTrack; uint8 m_nUpcomingMusicMode; uint8 m_nMusicMode; - bool m_FrontendLoopFlag; - bool m_bTrackChangeStarted; + bool8 m_FrontendLoopFlag; + bool8 m_bTrackChangeStarted; uint32 m_nNextTrack; - bool m_nNextLoopFlag; - bool m_bVerifyNextTrackStartedToPlay; - bool m_bGameplayAllowsRadio; - bool m_bRadioStreamReady; + bool8 m_nNextLoopFlag; + bool8 m_bVerifyNextTrackStartedToPlay; + bool8 m_bGameplayAllowsRadio; + bool8 m_bRadioStreamReady; int8 nFramesSinceCutsceneEnded; - bool m_bUserResumedGame; - bool m_bMusicModeChangeStarted; + bool8 m_bUserResumedGame; + bool8 m_bMusicModeChangeStarted; uint8 m_nMusicModeToBeSet; - bool m_bEarlyFrontendTrack; + bool8 m_bEarlyFrontendTrack; float aListenTimeArray[NUM_RADIOS]; float m_nLastTrackServiceTime; public: cMusicManager(); - bool IsInitialised() { return m_bIsInitialised; } + bool8 IsInitialised() { return m_bIsInitialised; } uint8 GetMusicMode() { return m_nMusicMode; } uint32 GetCurrentTrack() { return m_nPlayingTrack; } void ResetMusicAfterReload(); - void SetStartingTrackPositions(uint8 isNewGameTimer); - bool Initialise(); + void SetStartingTrackPositions(bool8 isNewGameTimer); + bool8 Initialise(); void Terminate(); void ChangeMusicMode(uint8 mode); void StopFrontEndTrack(); - bool PlayerInCar(); + bool8 PlayerInCar(); void DisplayRadioStationName(); void PlayAnnouncement(uint32); - void PlayFrontEndTrack(uint32, uint8); + void PlayFrontEndTrack(uint32, bool8); void PreloadCutSceneMusic(uint32); void PlayPreloadedCutSceneMusic(void); void StopCutSceneMusic(void); @@ -83,16 +83,16 @@ public: void ServiceAmbience(); void ServiceTrack(CVehicle *veh, CPed *ped); - bool UsesPoliceRadio(CVehicle *veh); - bool UsesTaxiRadio(CVehicle *veh); + bool8 UsesPoliceRadio(CVehicle *veh); + bool8 UsesTaxiRadio(CVehicle *veh); uint32 GetTrackStartPos(uint32 track); - void ComputeAmbienceVol(uint8 reset, uint8& outVolume); - bool ServiceAnnouncement(); + void ComputeAmbienceVol(bool8 reset, uint8& outVolume); + bool8 ServiceAnnouncement(); uint32 GetCarTuning(); uint32 GetNextCarTuning(); - bool ChangeRadioChannel(); + bool8 ChangeRadioChannel(); void RecordRadioStats(); void SetUpCorrectAmbienceTrack(); float *GetListenTimeArray(); @@ -100,7 +100,7 @@ public: uint32 GetFavouriteRadioStation(); void SetMalibuClubTrackPos(uint8 pos); void SetStripClubTrackPos(uint8 pos); - bool CheckForMusicInterruptions(); + bool8 CheckForMusicInterruptions(); void Enable(); void Disable(); @@ -109,5 +109,5 @@ public: VALIDATE_SIZE(cMusicManager, 0x95C); extern cMusicManager MusicManager; -extern bool g_bAnnouncementReadPosAlready; // we have a symbol of this so it was declared in .h +extern bool8 g_bAnnouncementReadPosAlready; // we have a symbol of this so it was declared in .h float GetHeightScale(); diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp index 75ec2fd8..cf92bb95 100644 --- a/src/audio/PolRadio.cpp +++ b/src/audio/PolRadio.cpp @@ -68,8 +68,8 @@ cAudioManager::InitialisePoliceRadio() for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE; - SampleManager.SetChannelReverbFlag(policeChannel, false); - gSpecialSuspectLastSeenReport = false; + SampleManager.SetChannelReverbFlag(policeChannel, FALSE); + gSpecialSuspectLastSeenReport = FALSE; for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++) gMinTimeToNextReport[i] = m_FrameCounter; } @@ -105,7 +105,7 @@ cAudioManager::DoPoliceRadioCrackle() m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = true; + m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nReleasingVolumeModificator = 10; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_RADIO_CRACKLE); m_sQueueSample.m_nVolume = m_anRandomTable[2] % 20 + 15; @@ -113,11 +113,11 @@ cAudioManager::DoPoliceRadioCrackle() m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_POLICE_RADIO_CRACKLE); m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_POLICE_RADIO_CRACKLE); - m_sQueueSample.m_bReleasingSoundFlag = false; - m_sQueueSample.m_bReverbFlag = false; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_nOffset = 63; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_bRequireReflection = false; + m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } @@ -130,7 +130,7 @@ cAudioManager::ServicePoliceRadio() if(!m_bIsInitialised) return; if(m_nUserPause == 0) { - bool crimeReport = SetupCrimeReport(); + bool8 crimeReport = SetupCrimeReport(); #ifdef FIX_BUGS // Crash at 0x5fe6ef if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted) return; @@ -156,12 +156,12 @@ cAudioManager::ServicePoliceRadio() void cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) { - bool processed = false; + bool8 processed = FALSE; uint32 sample; int32 freq; static int cWait = 0; - static bool bChannelOpen = false; + static bool8 bChannelOpen = FALSE; static uint8 bMissionAudioPhysicalPlayingStatus = 0; static int32 PoliceChannelFreq = 22050; @@ -171,14 +171,14 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel); if (g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == 1 && SampleManager.IsStreamPlaying(1)) { - SampleManager.PauseStream(1, 1); + SampleManager.PauseStream(TRUE, 1); } } else { if (m_nPreviousUserPause && g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == 1) { - SampleManager.PauseStream(0, 1); + SampleManager.PauseStream(FALSE, 1); } - if (m_sPoliceRadioQueue.policeChannelTimer == 0) bChannelOpen = false; + if (m_sPoliceRadioQueue.policeChannelTimer == 0) bChannelOpen = FALSE; if (cWait) { --cWait; return; @@ -202,7 +202,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) } } else if (!SampleManager.GetChannelUsedFlag(policeChannel)) { SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1); - SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 1); + SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 1); SampleManager.StartPreloadedStreamedFile(1); g_nMissionAudioPlayingStatus = 1; bMissionAudioPhysicalPlayingStatus = 0; @@ -223,8 +223,8 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) if (gSpecialSuspectLastSeenReport) { gSpecialSuspectLastSeenReport = 0; } else if (sample == SFX_POLICE_RADIO_MESSAGE_NOISE_1) { - bChannelOpen = false; - processed = true; + bChannelOpen = FALSE; + processed = TRUE; } } if (sample == NO_SAMPLE) { @@ -234,7 +234,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) switch (sample) { case SFX_POLICE_RADIO_MESSAGE_NOISE_1: freq = m_anRandomTable[4] % 2000 + 10025; - bChannelOpen = bChannelOpen == false; + bChannelOpen = bChannelOpen == FALSE; break; default: freq = SampleManager.GetSampleBaseFrequency(sample); break; } @@ -251,7 +251,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) } } -bool +bool8 cAudioManager::SetupCrimeReport() { int16 audioZoneId; @@ -264,13 +264,13 @@ cAudioManager::SetupCrimeReport() float quarterY; int i; int32 sampleIndex; - bool processed = false; + bool8 processed = FALSE; - if (MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE) return false; + if (MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE) return FALSE; if (60 - m_sPoliceRadioQueue.policeChannelTimer <= 9) { AgeCrimes(); - return true; + return TRUE; } for (i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) { @@ -278,7 +278,7 @@ cAudioManager::SetupCrimeReport() break; } - if (i == ARRAY_SIZE(m_sPoliceRadioQueue.crimes)) return false; + if (i == ARRAY_SIZE(m_sPoliceRadioQueue.crimes)) return FALSE; audioZoneId = CTheZones::FindAudioZone(&m_sPoliceRadioQueue.crimes[i].position); if (audioZoneId >= 0 && audioZoneId < NUMAUDIOZONES) { zone = CTheZones::GetAudioZone(audioZoneId); @@ -317,10 +317,10 @@ cAudioManager::SetupCrimeReport() if (m_sPoliceRadioQueue.crimes[i].position.y > halfY + quarterY) { m_sPoliceRadioQueue.Add(SFX_NORTH); - processed = true; + processed = TRUE; } else if (m_sPoliceRadioQueue.crimes[i].position.y < halfY - quarterY) { m_sPoliceRadioQueue.Add(SFX_SOUTH); - processed = true; + processed = TRUE; } if (m_sPoliceRadioQueue.crimes[i].position.x > halfX + quarterX) @@ -339,7 +339,7 @@ cAudioManager::SetupCrimeReport() } m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE; AgeCrimes(); - return true; + return TRUE; } void @@ -688,7 +688,7 @@ cAudioManager::PlaySuspectLastSeen(float x, float y, float z) float quarterX; float quarterY; int32 sample; - bool processed = false; + bool8 processed = FALSE; CVector vec = CVector(x, y, z); if (!m_bIsInitialised) return; @@ -713,10 +713,10 @@ cAudioManager::PlaySuspectLastSeen(float x, float y, float z) if (vec.y > halfY + quarterY) { m_sPoliceRadioQueue.Add(SFX_NORTH); - processed = true; + processed = TRUE; } else if (vec.y < halfY - quarterY) { m_sPoliceRadioQueue.Add(SFX_SOUTH); - processed = true; + processed = TRUE; } if (vec.x > halfX + quarterX) @@ -728,7 +728,7 @@ cAudioManager::PlaySuspectLastSeen(float x, float y, float z) m_sPoliceRadioQueue.Add(sample); m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1); m_sPoliceRadioQueue.Add(NO_SAMPLE); - gSpecialSuspectLastSeenReport = true; + gSpecialSuspectLastSeenReport = TRUE; break; } } diff --git a/src/audio/sampman.h b/src/audio/sampman.h index 5d7d39af..50d1b17f 100644 --- a/src/audio/sampman.h +++ b/src/audio/sampman.h @@ -135,9 +135,9 @@ class cSampleManager uint8 m_nMP3BoostVolume; uint8 m_nEffectsFadeVolume; uint8 m_nMusicFadeVolume; - uint8 m_nMonoMode; + bool8 m_nMonoMode; char m_szCDRomRootPath[80]; - bool m_bInitialised; + bool8 m_bInitialised; uint8 m_nNumberOfProviders; char *m_aAudioProviders[MAXPROVIDERS]; tSample m_aSamples[TOTAL_AUDIO_SAMPLES]; @@ -167,16 +167,16 @@ public: int8 AutoDetect3DProviders(); - bool IsMP3RadioChannelAvailable(void); + bool8 IsMP3RadioChannelAvailable(void); void ReleaseDigitalHandle (void); void ReacquireDigitalHandle(void); - bool Initialise(void); - void Terminate (void); + bool8 Initialise(void); + void Terminate (void); - bool CheckForAnAudioFileOnCD(void); - char GetCDAudioDriveLetter (void); + bool8 CheckForAnAudioFileOnCD(void); + char GetCDAudioDriveLetter (void); void UpdateEffectsVolume(void); @@ -185,14 +185,14 @@ public: void SetMP3BoostVolume (uint8 nVolume); void SetEffectsFadeVolume (uint8 nVolume); void SetMusicFadeVolume (uint8 nVolume); - void SetMonoMode (uint8 nMode); + void SetMonoMode (bool8 nMode); - bool LoadSampleBank (uint8 nBank); - void UnloadSampleBank (uint8 nBank); - bool IsSampleBankLoaded(uint8 nBank); + bool8 LoadSampleBank (uint8 nBank); + void UnloadSampleBank (uint8 nBank); + bool8 IsSampleBankLoaded(uint8 nBank); - bool IsPedCommentLoaded(uint32 nComment); - bool LoadPedComment (uint32 nComment); + bool8 IsPedCommentLoaded(uint32 nComment); + bool8 LoadPedComment (uint32 nComment); int32 GetBankContainingSound(uint32 offset); int32 _GetPedCommentSlot(uint32 nComment); @@ -202,10 +202,10 @@ public: int32 GetSampleLoopEndOffset (uint32 nSample); uint32 GetSampleLength (uint32 nSample); - bool UpdateReverb(void); + bool8 UpdateReverb(void); - void SetChannelReverbFlag (uint32 nChannel, uint8 nReverbFlag); - bool InitialiseChannel (uint32 nChannel, uint32 nSfx, uint8 nBank); + void SetChannelReverbFlag (uint32 nChannel, bool8 nReverbFlag); + bool8 InitialiseChannel (uint32 nChannel, uint32 nSfx, uint8 nBank); void SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume); void SetChannel3DPosition (uint32 nChannel, float fX, float fY, float fZ); void SetChannel3DDistances (uint32 nChannel, float fMax, float fMin); @@ -214,23 +214,23 @@ public: void SetChannelFrequency (uint32 nChannel, uint32 nFreq); void SetChannelLoopPoints (uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd); void SetChannelLoopCount (uint32 nChannel, uint32 nLoopCount); - bool GetChannelUsedFlag (uint32 nChannel); + bool8 GetChannelUsedFlag (uint32 nChannel); void StartChannel (uint32 nChannel); void StopChannel (uint32 nChannel); void PreloadStreamedFile (uint32 nFile, uint8 nStream); - void PauseStream (uint8 nPauseFlag, uint8 nStream); + void PauseStream (bool8 nPauseFlag, uint8 nStream); void StartPreloadedStreamedFile (uint8 nStream); - bool StartStreamedFile (uint32 nFile, uint32 nPos, uint8 nStream); + bool8 StartStreamedFile (uint32 nFile, uint32 nPos, uint8 nStream); void StopStreamedFile (uint8 nStream); int32 GetStreamedFilePosition (uint8 nStream); - void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream); + void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, bool8 nEffectFlag, uint8 nStream); int32 GetStreamedFileLength (uint8 nStream); - bool IsStreamPlaying (uint8 nStream); + bool8 IsStreamPlaying (uint8 nStream); #ifdef AUDIO_OAL void Service(void); #endif - bool InitialiseSampleBanks(void); + bool8 InitialiseSampleBanks(void); uint8 GetMusicVolume() const { return m_nMusicVolume; } void SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nStream); diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index 3eee78ae..a6f04775 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -28,7 +28,7 @@ char SampleBankDataFilename[] = "AUDIO\\SFX.RAW"; FILE *fpSampleDescHandle; FILE *fpSampleDataHandle; -bool bSampleBankLoaded [MAX_SFX_BANKS]; +bool8 bSampleBankLoaded [MAX_SFX_BANKS]; int32 nSampleBankDiscStartOffset [MAX_SFX_BANKS]; int32 nSampleBankSize [MAX_SFX_BANKS]; int32 nSampleBankMemoryStartAddress[MAX_SFX_BANKS]; @@ -63,11 +63,11 @@ int8 nStreamVolume[MAX_STREAMS]; uint8 nStreamLoopedFlag[MAX_STREAMS]; uint32 _CurMP3Index; int32 _CurMP3Pos; -bool _bIsMp3Active; +bool8 _bIsMp3Active; /////////////////////////////////////////////////////////////// -bool _bSampmanInitialised = false; +bool8 _bSampmanInitialised = FALSE; // // Miscellaneous globals / defines @@ -94,7 +94,7 @@ S32 speaker_type=0; U32 _maxSamples; float _fPrevEaxRatioDestination; -bool _usingMilesFast2D; +bool8 _usingMilesFast2D; float _fEffectsLevel; @@ -166,17 +166,17 @@ release_existing() } _fPrevEaxRatioDestination = 0.0f; - _usingMilesFast2D = false; + _usingMilesFast2D = FALSE; _fEffectsLevel = 0.0f; } -static bool +static bool8 set_new_provider(S32 index) { DWORD result; if ( curprovider == index ) - return true; + return TRUE; //close the already opened provider curprovider = index; @@ -203,7 +203,7 @@ set_new_provider(S32 index) release_existing(); - return false; + return FALSE; } else { @@ -234,7 +234,7 @@ set_new_provider(S32 index) AIL_set_3D_room_type(opened_provider, ENVIRONMENT_CAVE); if ( !strcmp(providers[index].name, "Miles Fast 2D Positional Audio") ) - _usingMilesFast2D = true; + _usingMilesFast2D = TRUE; } AIL_3D_provider_attribute(opened_provider, "Maximum supported samples", &_maxSamples); @@ -252,11 +252,11 @@ set_new_provider(S32 index) AIL_set_3D_sample_effects_level(opened_samples[i], 0.0f); } - return true; + return TRUE; } } - return false; + return FALSE; } U32 RadioHandlers[9]; @@ -459,7 +459,7 @@ cSampleManager::AutoDetect3DProviders() return -1; } -static bool +static bool8 _ResolveLink(char const *path, char *out) { IShellLink* psl; @@ -495,7 +495,7 @@ _ResolveLink(char const *path, char *out) ppf->Release(); psl->Release(); #endif - return true; + return TRUE; } } } @@ -505,15 +505,15 @@ _ResolveLink(char const *path, char *out) psl->Release(); } - return false; + return FALSE; } static void _FindMP3s(void) { tMP3Entry *pList; - bool bShortcut; - bool bInitFirstEntry; + bool8 bShortcut; + bool8 bInitFirstEntry; HANDLE hFind; char path[MAX_PATH]; char filepath[MAX_PATH*2]; @@ -565,10 +565,10 @@ _FindMP3s(void) OutputDebugString(filepath); } - bShortcut = true; + bShortcut = TRUE; } else - bShortcut = false; + bShortcut = FALSE; } mp3Stream[0] = AIL_open_stream(DIG, filepath, 0); @@ -608,7 +608,7 @@ _FindMP3s(void) { _pMP3List->pLinkPath = NULL; } - bInitFirstEntry = false; + bInitFirstEntry = FALSE; } else { @@ -616,10 +616,10 @@ _FindMP3s(void) OutputDebugString(filepath); - bInitFirstEntry = true; + bInitFirstEntry = TRUE; } - while ( true ) + while ( TRUE ) { if ( !FindNextFile(hFind, &fd) ) break; @@ -643,11 +643,11 @@ _FindMP3s(void) OutputDebugString(filepath); } - bShortcut = true; + bShortcut = TRUE; } else { - bShortcut = false; + bShortcut = FALSE; if ( filepathlen > MAX_PATH ) { @@ -690,7 +690,7 @@ _FindMP3s(void) pList = _pMP3List; - bInitFirstEntry = false; + bInitFirstEntry = FALSE; } else { @@ -718,11 +718,11 @@ _FindMP3s(void) OutputDebugString(filepath); } - bShortcut = true; + bShortcut = TRUE; } else { - bShortcut = false; + bShortcut = FALSE; } } @@ -834,7 +834,7 @@ _GetMP3EntryByIndex(uint32 idx) return NULL; } -static inline bool +static inline bool8 _GetMP3PosFromStreamPos(uint32 *pPosition, tMP3Entry **pEntry) { _CurMP3Index = 0; @@ -847,7 +847,7 @@ _GetMP3PosFromStreamPos(uint32 *pPosition, tMP3Entry **pEntry) *pPosition -= (*pEntry)->nTrackStreamPos; _CurMP3Pos = *pPosition; - return true; + return TRUE; } _CurMP3Index++; @@ -858,10 +858,10 @@ _GetMP3PosFromStreamPos(uint32 *pPosition, tMP3Entry **pEntry) _CurMP3Pos = 0; _CurMP3Index = 0; - return false; + return FALSE; } -bool +bool8 cSampleManager::IsMP3RadioChannelAvailable(void) { return nNumMP3s != 0; @@ -890,13 +890,13 @@ cSampleManager::ReacquireDigitalHandle(void) } } -bool +bool8 cSampleManager::Initialise(void) { TRACE("start"); if ( _bSampmanInitialised ) - return true; + return TRUE; { for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ ) @@ -922,7 +922,7 @@ cSampleManager::Initialise(void) curprovider = -1; prevprovider = -1; - _usingMilesFast2D = false; + _usingMilesFast2D = FALSE; usingEAX=0; usingEAX3=0; @@ -947,7 +947,7 @@ cSampleManager::Initialise(void) for ( int32 i = 0; i < MAX_SFX_BANKS; i++ ) { - bSampleBankLoaded[i] = false; + bSampleBankLoaded[i] = FALSE; nSampleBankDiscStartOffset[i] = 0; nSampleBankSize[i] = 0; nSampleBankMemoryStartAddress[i] = 0; @@ -988,24 +988,24 @@ cSampleManager::Initialise(void) #ifdef AUDIO_CACHE TRACE("cache"); FILE *cacheFile = fcaseopen("audio\\sound.cache", "rb"); - bool CreateCache = false; + bool8 CreateCache = FALSE; if (cacheFile) { fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile); fclose(cacheFile); }else - CreateCache = true; + CreateCache = TRUE; #endif char filepath[MAX_PATH]; - bool bFileNotFound; + bool8 bFileNotFound; S32 tatalms; TRACE("cdrom"); { - m_bInitialised = false; + m_bInitialised = FALSE; - while (true) + while (TRUE) { // Find path of WAVs (originally in HDD) @@ -1046,7 +1046,7 @@ cSampleManager::Initialise(void) { OutputDebugString(AIL_last_error()); Terminate(); - return false; + return FALSE; } add_providers(); @@ -1076,9 +1076,9 @@ cSampleManager::Initialise(void) } else { - m_bInitialised = false; + m_bInitialised = FALSE; Terminate(); - return false; + return FALSE; } } @@ -1113,7 +1113,7 @@ cSampleManager::Initialise(void) AIL_close_stream(mp3Stream[0]); mp3Stream[0] = NULL; - bFileNotFound = false; + bFileNotFound = FALSE; #ifdef AUDIO_CACHE if (!CreateCache) break; @@ -1124,7 +1124,7 @@ cSampleManager::Initialise(void) } else { - bFileNotFound = true; + bFileNotFound = TRUE; break; } } @@ -1159,11 +1159,11 @@ cSampleManager::Initialise(void) mp3Stream[0] = NULL; nStreamLength[i] = tatalms; - bFileNotFound = false; + bFileNotFound = FALSE; } else { - bFileNotFound = true; + bFileNotFound = TRUE; break; } } @@ -1178,11 +1178,11 @@ cSampleManager::Initialise(void) if ( FrontEndMenuManager.m_bQuitGameNoCD ) { Terminate(); - return false; + return FALSE; } continue; #else - m_bInitialised = true; + m_bInitialised = TRUE; #endif } @@ -1201,14 +1201,14 @@ cSampleManager::Initialise(void) if ( !InitialiseSampleBanks() ) { Terminate(); - return false; + return FALSE; } nSampleBankMemoryStartAddress[SFX_BANK_0] = (int32)AIL_mem_alloc_lock(nSampleBankSize[SFX_BANK_0]); if ( !nSampleBankMemoryStartAddress[SFX_BANK_0] ) { Terminate(); - return false; + return FALSE; } nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (int32)AIL_mem_alloc_lock(PED_BLOCKSIZE*MAX_PEDSFX); @@ -1237,7 +1237,7 @@ cSampleManager::Initialise(void) TRACE("providerset"); { - _bSampmanInitialised = true; + _bSampmanInitialised = TRUE; U32 n = 0; @@ -1254,7 +1254,7 @@ cSampleManager::Initialise(void) if ( n == m_nNumberOfProviders ) { Terminate(); - return false; + return FALSE; } } @@ -1279,13 +1279,13 @@ cSampleManager::Initialise(void) time_t t = time(NULL); tm *localtm; - bool bUseRandomTable; + bool8 bUseRandomTable; if ( t == -1 ) - bUseRandomTable = true; + bUseRandomTable = TRUE; else { - bUseRandomTable = false; + bUseRandomTable = FALSE; localtm = localtime(&t); } @@ -1317,12 +1317,12 @@ cSampleManager::Initialise(void) else _CurMP3Pos = 0; - _bIsMp3Active = false; + _bIsMp3Active = FALSE; } TRACE("end"); - return true; + return TRUE; } void @@ -1371,10 +1371,10 @@ cSampleManager::Terminate(void) AIL_shutdown(); - _bSampmanInitialised = false; + _bSampmanInitialised = FALSE; } -bool +bool8 cSampleManager::CheckForAnAudioFileOnCD(void) { #if !defined(NO_CDCHECK) // TODO: check steam, probably GTAVC_STEAM_PATCH needs to be added @@ -1392,17 +1392,17 @@ cSampleManager::CheckForAnAudioFileOnCD(void) DMAudio.SetEffectsMasterVolume(FrontEndMenuManager.m_PrefsSfxVolume); DMAudio.Service(); - return true; + return TRUE; } DMAudio.SetMusicMasterVolume(0); DMAudio.SetEffectsMasterVolume(0); DMAudio.Service(); - return false; + return FALSE; #else - return true; + return TRUE; #endif // #if !defined(NO_CDCHECK) } @@ -1484,48 +1484,48 @@ cSampleManager::SetMusicFadeVolume(uint8 nVolume) } void -cSampleManager::SetMonoMode(uint8 nMode) +cSampleManager::SetMonoMode(bool8 nMode) { m_nMonoMode = nMode; } -bool +bool8 cSampleManager::LoadSampleBank(uint8 nBank) { if ( CTimer::GetIsCodePaused() ) - return false; + return FALSE; if ( MusicManager.IsInitialised() && MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE && nBank != SFX_BANK_0 ) { - return false; + return FALSE; } if ( fseek(fpSampleDataHandle, nSampleBankDiscStartOffset[nBank], SEEK_SET) != 0 ) - return false; + return FALSE; if ( fread((void *)nSampleBankMemoryStartAddress[nBank], 1, nSampleBankSize[nBank],fpSampleDataHandle) != nSampleBankSize[nBank] ) - return false; + return FALSE; - bSampleBankLoaded[nBank] = true; + bSampleBankLoaded[nBank] = TRUE; - return true; + return TRUE; } void cSampleManager::UnloadSampleBank(uint8 nBank) { - bSampleBankLoaded[nBank] = false; + bSampleBankLoaded[nBank] = FALSE; } -bool +bool8 cSampleManager::IsSampleBankLoaded(uint8 nBank) { return bSampleBankLoaded[nBank]; } -bool +bool8 cSampleManager::IsPedCommentLoaded(uint32 nComment) { int8 slot; @@ -1538,10 +1538,10 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment) slot += ARRAY_SIZE(nPedSlotSfx); #endif if ( nComment == nPedSlotSfx[slot] ) - return true; + return TRUE; } - return false; + return FALSE; } int32 @@ -1563,11 +1563,11 @@ cSampleManager::_GetPedCommentSlot(uint32 nComment) return -1; } -bool +bool8 cSampleManager::LoadPedComment(uint32 nComment) { if ( CTimer::GetIsCodePaused() ) - return false; + return FALSE; // no talking peds during cutsenes or the game end if ( MusicManager.IsInitialised() ) @@ -1576,7 +1576,7 @@ cSampleManager::LoadPedComment(uint32 nComment) { case MUSICMODE_CUTSCENE: { - return false; + return FALSE; break; } @@ -1584,10 +1584,10 @@ cSampleManager::LoadPedComment(uint32 nComment) } if ( fseek(fpSampleDataHandle, m_aSamples[nComment].nOffset, SEEK_SET) != 0 ) - return false; + return FALSE; if ( fread((void *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize ) - return false; + return FALSE; nPedSlotSfxAddr[nCurrentPedSlot] = nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot; nPedSlotSfx [nCurrentPedSlot] = nComment; @@ -1595,7 +1595,7 @@ cSampleManager::LoadPedComment(uint32 nComment) if ( ++nCurrentPedSlot >= MAX_PEDSFX ) nCurrentPedSlot = 0; - return true; + return TRUE; } int32 @@ -1634,14 +1634,14 @@ cSampleManager::GetSampleLength(uint32 nSample) return m_aSamples[nSample].nSize >> 1; } -bool +bool8 cSampleManager::UpdateReverb(void) { if ( !usingEAX ) - return false; + return FALSE; if ( AudioManager.GetFrameCounter() & 15 ) - return false; + return FALSE; float fRatio = 0.0f; @@ -1662,7 +1662,7 @@ cSampleManager::UpdateReverb(void) fRatio = clamp(fRatio, 0.0f, 0.6f); if ( fRatio == _fPrevEaxRatioDestination ) - return false; + return FALSE; if ( usingEAX3 ) { @@ -1684,26 +1684,26 @@ cSampleManager::UpdateReverb(void) _fPrevEaxRatioDestination = fRatio; - return true; + return TRUE; } void -cSampleManager::SetChannelReverbFlag(uint32 nChannel, uint8 nReverbFlag) +cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag) { - bool b2d = false; + bool8 b2d = FALSE; switch ( nChannel ) { case CHANNEL2D: { - b2d = true; + b2d = TRUE; break; } } if ( usingEAX ) { - if ( nReverbFlag != 0 ) + if ( nReverbFlag != FALSE ) { if ( !b2d ) AIL_set_3D_sample_effects_level(opened_samples[nChannel], _fEffectsLevel); @@ -1716,16 +1716,16 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, uint8 nReverbFlag) } } -bool +bool8 cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) { - bool b2d = false; + bool8 b2d = FALSE; switch ( nChannel ) { case CHANNEL2D: { - b2d = true; + b2d = TRUE; break; } } @@ -1735,14 +1735,14 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) if ( nSfx < SAMPLEBANK_MAX ) { if ( !IsSampleBankLoaded(nBank) ) - return false; + return FALSE; addr = nSampleBankMemoryStartAddress[nBank] + m_aSamples[nSfx].nOffset - m_aSamples[BankStartOffset[nBank]].nOffset; } else { if ( !IsPedCommentLoaded(nSfx) ) - return false; + return FALSE; int32 slot = _GetPedCommentSlot(nSfx); @@ -1754,10 +1754,10 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) if ( opened_2dsamples[nChannel - MAXCHANNELS] ) { AIL_set_sample_address(opened_2dsamples[nChannel - MAXCHANNELS], (void *)addr, m_aSamples[nSfx].nSize); - return true; + return TRUE; } else - return false; + return FALSE; } else { @@ -1773,10 +1773,10 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) if ( AIL_set_3D_sample_info(opened_samples[nChannel], &info) == 0 ) { OutputDebugString(AIL_last_error()); - return false; + return FALSE; } - return true; + return TRUE; } } @@ -1867,13 +1867,13 @@ cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan) void cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq) { - bool b2d = false; + bool8 b2d = FALSE; switch ( nChannel ) { case CHANNEL2D: { - b2d = true; + b2d = TRUE; break; } } @@ -1893,13 +1893,13 @@ cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq) void cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd) { - bool b2d = false; + bool8 b2d = FALSE; switch ( nChannel ) { case CHANNEL2D: { - b2d = true; + b2d = TRUE; break; } } @@ -1919,13 +1919,13 @@ cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 n void cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount) { - bool b2d = false; + bool8 b2d = FALSE; switch ( nChannel ) { case CHANNEL2D: { - b2d = true; + b2d = TRUE; break; } } @@ -1942,16 +1942,16 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount) } } -bool +bool8 cSampleManager::GetChannelUsedFlag(uint32 nChannel) { - bool b2d = false; + bool8 b2d = FALSE; switch ( nChannel ) { case CHANNEL2D: { - b2d = true; + b2d = TRUE; break; } } @@ -1961,14 +1961,14 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel) if ( opened_2dsamples[nChannel - MAXCHANNELS] ) return AIL_sample_status(opened_2dsamples[nChannel - MAXCHANNELS]) == SMP_PLAYING; else - return false; + return FALSE; } else { if ( opened_samples[nChannel] ) return AIL_3D_sample_status(opened_samples[nChannel]) == SMP_PLAYING; else - return false; + return FALSE; } } @@ -1976,13 +1976,13 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel) void cSampleManager::StartChannel(uint32 nChannel) { - bool b2d = false; + bool8 b2d = FALSE; switch ( nChannel ) { case CHANNEL2D: { - b2d = true; + b2d = TRUE; break; } } @@ -2002,13 +2002,13 @@ cSampleManager::StartChannel(uint32 nChannel) void cSampleManager::StopChannel(uint32 nChannel) { - bool b2d = false; + bool8 b2d = FALSE; switch ( nChannel ) { case CHANNEL2D: { - b2d = true; + b2d = TRUE; break; } } @@ -2060,12 +2060,12 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream) } void -cSampleManager::PauseStream(uint8 nPauseFlag, uint8 nStream) +cSampleManager::PauseStream(bool8 nPauseFlag, uint8 nStream) { if ( m_bInitialised ) { if ( mp3Stream[nStream] ) - AIL_pause_stream(mp3Stream[nStream], nPauseFlag != 0); + AIL_pause_stream(mp3Stream[nStream], nPauseFlag != FALSE); } } @@ -2079,7 +2079,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream) } } -bool +bool8 cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) { int i = 0; @@ -2087,7 +2087,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) char filename[MAX_PATH]; if ( !m_bInitialised || nFile >= TOTAL_STREAMED_SOUNDS ) - return false; + return FALSE; if ( mp3Stream[nStream] ) { @@ -2114,12 +2114,12 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) AIL_open_stream(DIG, filename, 0); if(mp3Stream[nStream]) { AIL_set_stream_loop_count(mp3Stream[nStream], nStreamLoopedFlag[nStream] ? 0 : 1); - nStreamLoopedFlag[nStream] = true; + nStreamLoopedFlag[nStream] = TRUE; AIL_set_stream_ms_position(mp3Stream[nStream], position); AIL_pause_stream(mp3Stream[nStream], 0); - return true; + return TRUE; } - return false; + return FALSE; } else { if ( e->pLinkPath != NULL ) @@ -2136,9 +2136,9 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) AIL_set_stream_ms_position(mp3Stream[nStream], position); AIL_pause_stream(mp3Stream[nStream], 0); - _bIsMp3Active = true; + _bIsMp3Active = TRUE; - return true; + return TRUE; } // fall through, start playing from another song } @@ -2163,14 +2163,14 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) if(mp3Stream[nStream]) { AIL_set_stream_loop_count( mp3Stream[nStream], nStreamLoopedFlag[nStream] ? 0 : 1); - nStreamLoopedFlag[nStream] = true; + nStreamLoopedFlag[nStream] = TRUE; AIL_set_stream_ms_position( mp3Stream[nStream], position); AIL_pause_stream(mp3Stream[nStream], 0); - return true; + return TRUE; } - return false; + return FALSE; } } if(mp3->pLinkPath != NULL) @@ -2188,9 +2188,9 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) AIL_set_stream_ms_position(mp3Stream[nStream], 0); AIL_pause_stream(mp3Stream[nStream], 0); #ifdef FIX_BUGS - _bIsMp3Active = true; + _bIsMp3Active = TRUE; #endif - return true; + return TRUE; } } @@ -2207,12 +2207,12 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) if ( mp3Stream[nStream] ) { AIL_set_stream_loop_count(mp3Stream[nStream], nStreamLoopedFlag[nStream] ? 0 : 1); - nStreamLoopedFlag[nStream] = true; + nStreamLoopedFlag[nStream] = TRUE; AIL_set_stream_ms_position(mp3Stream[nStream], position); AIL_pause_stream(mp3Stream[nStream], 0); - return true; + return TRUE; } - return false; + return FALSE; } void @@ -2228,7 +2228,7 @@ cSampleManager::StopStreamedFile(uint8 nStream) mp3Stream[nStream] = NULL; if ( nStream == 0 ) - _bIsMp3Active = false; + _bIsMp3Active = FALSE; } } } @@ -2266,7 +2266,7 @@ cSampleManager::GetStreamedFilePosition(uint8 nStream) } void -cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream) +cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, bool8 nEffectFlag, uint8 nStream) { uint8 vol = nVolume; float boostMult = 0.0f; @@ -2307,7 +2307,7 @@ cSampleManager::GetStreamedFileLength(uint8 nStream) return 0; } -bool +bool8 cSampleManager::IsStreamPlaying(uint8 nStream) { if ( m_bInitialised ) @@ -2315,23 +2315,23 @@ cSampleManager::IsStreamPlaying(uint8 nStream) if ( mp3Stream[nStream] ) { if ( AIL_stream_status(mp3Stream[nStream]) == SMP_PLAYING ) - return true; + return TRUE; else - return false; + return FALSE; } } - return false; + return FALSE; } -bool +bool8 cSampleManager::InitialiseSampleBanks(void) { int32 nBank = SFX_BANK_0; fpSampleDescHandle = fopen(SampleBankDescFilename, "rb"); if ( fpSampleDescHandle == NULL ) - return false; + return FALSE; fpSampleDataHandle = fopen(SampleBankDataFilename, "rb"); if ( fpSampleDataHandle == NULL ) @@ -2339,7 +2339,7 @@ cSampleManager::InitialiseSampleBanks(void) fclose(fpSampleDescHandle); fpSampleDescHandle = NULL; - return false; + return FALSE; } fseek(fpSampleDataHandle, 0, SEEK_END); @@ -2366,7 +2366,7 @@ cSampleManager::InitialiseSampleBanks(void) 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; + return TRUE; } diff --git a/src/audio/sampman_null.cpp b/src/audio/sampman_null.cpp index e9a9eaa1..3352ae02 100644 --- a/src/audio/sampman_null.cpp +++ b/src/audio/sampman_null.cpp @@ -4,7 +4,7 @@ #include "AudioManager.h" cSampleManager SampleManager; -bool _bSampmanInitialised = false; +bool8 _bSampmanInitialised = FALSE; uint32 BankStartOffset[MAX_SFX_BANKS]; uint32 nNumMP3s; @@ -60,7 +60,7 @@ int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider) return 0; } -bool +bool8 cSampleManager::IsMP3RadioChannelAvailable(void) { return nNumMP3s != 0; @@ -75,10 +75,10 @@ void cSampleManager::ReacquireDigitalHandle(void) { } -bool +bool8 cSampleManager::Initialise(void) { - return true; + return TRUE; } void @@ -87,9 +87,9 @@ cSampleManager::Terminate(void) } -bool cSampleManager::CheckForAnAudioFileOnCD(void) +bool8 cSampleManager::CheckForAnAudioFileOnCD(void) { - return true; + return TRUE; } char cSampleManager::GetCDAudioDriveLetter(void) @@ -129,15 +129,15 @@ cSampleManager::SetMusicFadeVolume(uint8 nVolume) } void -cSampleManager::SetMonoMode(uint8 nMode) +cSampleManager::SetMonoMode(bool8 nMode) { } -bool +bool8 cSampleManager::LoadSampleBank(uint8 nBank) { ASSERT( nBank < MAX_SFX_BANKS ); - return false; + return FALSE; } void @@ -146,20 +146,20 @@ cSampleManager::UnloadSampleBank(uint8 nBank) ASSERT( nBank < MAX_SFX_BANKS ); } -bool +bool8 cSampleManager::IsSampleBankLoaded(uint8 nBank) { ASSERT( nBank < MAX_SFX_BANKS ); - return false; + return FALSE; } -bool +bool8 cSampleManager::IsPedCommentLoaded(uint32 nComment) { ASSERT( nComment < TOTAL_AUDIO_SAMPLES ); - return false; + return FALSE; } @@ -169,11 +169,11 @@ cSampleManager::_GetPedCommentSlot(uint32 nComment) return -1; } -bool +bool8 cSampleManager::LoadPedComment(uint32 nComment) { ASSERT( nComment < TOTAL_AUDIO_SAMPLES ); - return false; + return FALSE; } int32 @@ -210,22 +210,22 @@ cSampleManager::GetSampleLength(uint32 nSample) return 0; } -bool cSampleManager::UpdateReverb(void) +bool8 cSampleManager::UpdateReverb(void) { - return false; + return FALSE; } void -cSampleManager::SetChannelReverbFlag(uint32 nChannel, uint8 nReverbFlag) +cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag) { ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); } -bool +bool8 cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) { ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); - return false; + return FALSE; } void @@ -281,12 +281,12 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount) ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); } -bool +bool8 cSampleManager::GetChannelUsedFlag(uint32 nChannel) { ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); - return false; + return FALSE; } void @@ -308,7 +308,7 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream) } void -cSampleManager::PauseStream(uint8 nPauseFlag, uint8 nStream) +cSampleManager::PauseStream(bool8 nPauseFlag, uint8 nStream) { ASSERT( nStream < MAX_STREAMS ); } @@ -319,12 +319,12 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream) ASSERT( nStream < MAX_STREAMS ); } -bool +bool8 cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) { ASSERT( nStream < MAX_STREAMS ); - return false; + return FALSE; } void @@ -342,7 +342,7 @@ cSampleManager::GetStreamedFilePosition(uint8 nStream) } void -cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream) +cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, bool8 nEffectFlag, uint8 nStream) { ASSERT( nStream < MAX_STREAMS ); } @@ -355,19 +355,19 @@ cSampleManager::GetStreamedFileLength(uint8 nStream) return 1; } -bool +bool8 cSampleManager::IsStreamPlaying(uint8 nStream) { ASSERT( nStream < MAX_STREAMS ); - return false; + return FALSE; } -bool +bool8 cSampleManager::InitialiseSampleBanks(void) { - return true; + return TRUE; } void diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 5a300cff..e74fac82 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -48,7 +48,7 @@ //TODO: max channels cSampleManager SampleManager; -bool _bSampmanInitialised = false; +bool8 _bSampmanInitialised = FALSE; uint32 BankStartOffset[MAX_SFX_BANKS]; @@ -84,7 +84,7 @@ OggOpusFile *fpSampleDataHandle; #else FILE *fpSampleDataHandle; #endif -bool bSampleBankLoaded [MAX_SFX_BANKS]; +bool8 bSampleBankLoaded [MAX_SFX_BANKS]; int32 nSampleBankDiscStartOffset [MAX_SFX_BANKS]; int32 nSampleBankSize [MAX_SFX_BANKS]; uintptr nSampleBankMemoryStartAddress[MAX_SFX_BANKS]; @@ -121,7 +121,7 @@ uint8 nStreamVolume[MAX_STREAMS]; uint8 nStreamLoopedFlag[MAX_STREAMS]; uint32 _CurMP3Index; int32 _CurMP3Pos; -bool _bIsMp3Active; +bool8 _bIsMp3Active; /////////////////////////////////////////////////////////////// // Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS EAXLISTENERPROPERTIES StartEAX3 = @@ -266,11 +266,11 @@ release_existing() DEV("release_existing()\n"); } -static bool +static bool8 set_new_provider(int index) { if ( curprovider == index ) - return true; + return TRUE; curprovider = index; @@ -302,7 +302,7 @@ set_new_provider(int index) { curprovider=-1; release_existing(); - return false; + return FALSE; } alListenerf (AL_GAIN, 1.0f); @@ -383,13 +383,13 @@ set_new_provider(int index) aChannel[i].SetReverbMix(ALEffectSlot, 0.0f); } - return true; + return TRUE; } - return false; + return FALSE; } -static bool +static bool8 IsThisTrackAt16KHz(uint32 track) { return track == STREAMED_SOUND_RADIO_KCHAT || track == STREAMED_SOUND_RADIO_VCPR || track == STREAMED_SOUND_RADIO_POLICE; @@ -482,13 +482,13 @@ cSampleManager::AutoDetect3DProviders() return -1; } -static bool +static bool8 _ResolveLink(char const *path, char *out) { #ifdef _WIN32 size_t len = strlen(path); if (len < 4 || strcmp(&path[len - 4], ".lnk") != 0) - return false; + return FALSE; IShellLink* psl; WIN32_FIND_DATA fd; @@ -523,7 +523,7 @@ _ResolveLink(char const *path, char *out) ppf->Release(); psl->Release(); #endif - return true; + return TRUE; } } } @@ -533,31 +533,31 @@ _ResolveLink(char const *path, char *out) psl->Release(); } - return false; + return FALSE; #else struct stat sb; if (lstat(path, &sb) == -1) { perror("lstat: "); - return false; + return FALSE; } if (S_ISLNK(sb.st_mode)) { char* linkname = (char*)alloca(sb.st_size + 1); if (linkname == NULL) { fprintf(stderr, "insufficient memory\n"); - return false; + return FALSE; } if (readlink(path, linkname, sb.st_size + 1) < 0) { perror("readlink: "); - return false; + return FALSE; } linkname[sb.st_size] = '\0'; strcpy(out, linkname); - return true; + return TRUE; } else { - return false; + return FALSE; } #endif } @@ -566,8 +566,8 @@ static void _FindMP3s(void) { tMP3Entry *pList; - bool bShortcut; - bool bInitFirstEntry; + bool8 bShortcut; + bool8 bInitFirstEntry; HANDLE hFind; char path[MAX_PATH]; char filepath[MAX_PATH*2]; @@ -610,9 +610,9 @@ _FindMP3s(void) { OutputDebugString("Resolving Link"); OutputDebugString(filepath); - bShortcut = true; + bShortcut = TRUE; } else - bShortcut = false; + bShortcut = FALSE; aStream[0] = new CStream(filepath, ALStreamSources[0], ALStreamBuffers[0]); @@ -652,7 +652,7 @@ _FindMP3s(void) _pMP3List->pLinkPath = NULL; } - bInitFirstEntry = false; + bInitFirstEntry = FALSE; } else { @@ -660,10 +660,10 @@ _FindMP3s(void) OutputDebugString(filepath); - bInitFirstEntry = true; + bInitFirstEntry = TRUE; } - while ( true ) + while ( TRUE ) { if ( !FindNextFile(hFind, &fd) ) break; @@ -681,9 +681,9 @@ _FindMP3s(void) { OutputDebugString("Resolving Link"); OutputDebugString(filepath); - bShortcut = true; + bShortcut = TRUE; } else { - bShortcut = false; + bShortcut = FALSE; if (filepathlen > MAX_PATH) { continue; } @@ -722,7 +722,7 @@ _FindMP3s(void) pList = _pMP3List; - bInitFirstEntry = false; + bInitFirstEntry = FALSE; } else { @@ -744,9 +744,9 @@ _FindMP3s(void) { OutputDebugString("Resolving Link"); OutputDebugString(filepath); - bShortcut = true; + bShortcut = TRUE; } else - bShortcut = false; + bShortcut = FALSE; aStream[0] = new CStream(filepath, ALStreamSources[0], ALStreamBuffers[0]); @@ -858,7 +858,7 @@ _GetMP3EntryByIndex(uint32 idx) return NULL; } -static inline bool +static inline bool8 _GetMP3PosFromStreamPos(uint32 *pPosition, tMP3Entry **pEntry) { _CurMP3Index = 0; @@ -871,7 +871,7 @@ _GetMP3PosFromStreamPos(uint32 *pPosition, tMP3Entry **pEntry) *pPosition -= (*pEntry)->nTrackStreamPos; _CurMP3Pos = *pPosition; - return true; + return TRUE; } _CurMP3Index++; @@ -882,10 +882,10 @@ _GetMP3PosFromStreamPos(uint32 *pPosition, tMP3Entry **pEntry) _CurMP3Pos = 0; _CurMP3Index = 0; - return false; + return FALSE; } -bool +bool8 cSampleManager::IsMP3RadioChannelAvailable(void) { return nNumMP3s != 0; @@ -911,11 +911,11 @@ void cSampleManager::ReacquireDigitalHandle(void) } } -bool +bool8 cSampleManager::Initialise(void) { if ( _bSampmanInitialised ) - return true; + return TRUE; EFXInit(); CStream::Initialise(); @@ -960,7 +960,7 @@ cSampleManager::Initialise(void) for ( int32 i = 0; i < MAX_SFX_BANKS; i++ ) { - bSampleBankLoaded[i] = false; + bSampleBankLoaded[i] = FALSE; nSampleBankDiscStartOffset[i] = 0; nSampleBankSize[i] = 0; nSampleBankMemoryStartAddress[i] = 0; @@ -1031,7 +1031,7 @@ cSampleManager::Initialise(void) if ( !InitialiseSampleBanks() ) { Terminate(); - return false; + return FALSE; } nSampleBankMemoryStartAddress[SFX_BANK_0] = (uintptr)malloc(nSampleBankSize[SFX_BANK_0]); @@ -1040,7 +1040,7 @@ cSampleManager::Initialise(void) if ( nSampleBankMemoryStartAddress[SFX_BANK_0] == 0 ) { Terminate(); - return false; + return FALSE; } nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX); @@ -1059,7 +1059,7 @@ cSampleManager::Initialise(void) } { - _bSampmanInitialised = true; + _bSampmanInitialised = TRUE; if ( defaultProvider >= 0 && defaultProvider < m_nNumberOfProviders ) { @@ -1068,7 +1068,7 @@ cSampleManager::Initialise(void) else { Terminate(); - return false; + return FALSE; } } @@ -1091,13 +1091,13 @@ cSampleManager::Initialise(void) time_t t = time(NULL); tm *localtm; - bool bUseRandomTable; + bool8 bUseRandomTable; if ( t == -1 ) - bUseRandomTable = true; + bUseRandomTable = TRUE; else { - bUseRandomTable = false; + bUseRandomTable = FALSE; localtm = localtime(&t); } @@ -1129,10 +1129,10 @@ cSampleManager::Initialise(void) else _CurMP3Pos = 0; - _bIsMp3Active = false; + _bIsMp3Active = FALSE; } - return true; + return TRUE; } void @@ -1166,12 +1166,12 @@ cSampleManager::Terminate(void) nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = 0; } - _bSampmanInitialised = false; + _bSampmanInitialised = FALSE; } -bool cSampleManager::CheckForAnAudioFileOnCD(void) +bool8 cSampleManager::CheckForAnAudioFileOnCD(void) { - return true; + return TRUE; } char cSampleManager::GetCDAudioDriveLetter(void) @@ -1228,24 +1228,24 @@ cSampleManager::SetMusicFadeVolume(uint8 nVolume) } void -cSampleManager::SetMonoMode(uint8 nMode) +cSampleManager::SetMonoMode(bool8 nMode) { m_nMonoMode = nMode; } -bool +bool8 cSampleManager::LoadSampleBank(uint8 nBank) { ASSERT( nBank < MAX_SFX_BANKS); if ( CTimer::GetIsCodePaused() ) - return false; + return FALSE; if ( MusicManager.IsInitialised() && MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE && nBank != SFX_BANK_0 ) { - return false; + return FALSE; } #ifdef OPUS_SFX @@ -1264,14 +1264,14 @@ cSampleManager::LoadSampleBank(uint8 nBank) } #else if ( fseek(fpSampleDataHandle, nSampleBankDiscStartOffset[nBank], SEEK_SET) != 0 ) - return false; + return FALSE; if ( fread((void *)nSampleBankMemoryStartAddress[nBank], 1, nSampleBankSize[nBank], fpSampleDataHandle) != nSampleBankSize[nBank] ) - return false; + return FALSE; #endif - bSampleBankLoaded[nBank] = true; + bSampleBankLoaded[nBank] = TRUE; - return true; + return TRUE; } void @@ -1279,10 +1279,10 @@ cSampleManager::UnloadSampleBank(uint8 nBank) { ASSERT( nBank < MAX_SFX_BANKS); - bSampleBankLoaded[nBank] = false; + bSampleBankLoaded[nBank] = FALSE; } -bool +bool8 cSampleManager::IsSampleBankLoaded(uint8 nBank) { ASSERT( nBank < MAX_SFX_BANKS); @@ -1290,7 +1290,7 @@ cSampleManager::IsSampleBankLoaded(uint8 nBank) return bSampleBankLoaded[nBank]; } -bool +bool8 cSampleManager::IsPedCommentLoaded(uint32 nComment) { ASSERT( nComment < TOTAL_AUDIO_SAMPLES ); @@ -1305,10 +1305,10 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment) slot += ARRAY_SIZE(nPedSlotSfx); #endif if ( nComment == nPedSlotSfx[slot] ) - return true; + return TRUE; } - return false; + return FALSE; } @@ -1331,13 +1331,13 @@ cSampleManager::_GetPedCommentSlot(uint32 nComment) return -1; } -bool +bool8 cSampleManager::LoadPedComment(uint32 nComment) { ASSERT( nComment < TOTAL_AUDIO_SAMPLES ); if ( CTimer::GetIsCodePaused() ) - return false; + return FALSE; // no talking peds during cutsenes or the game end if ( MusicManager.IsInitialised() ) @@ -1346,7 +1346,7 @@ cSampleManager::LoadPedComment(uint32 nComment) { case MUSICMODE_CUTSCENE: { - return false; + return FALSE; break; } @@ -1361,17 +1361,17 @@ cSampleManager::LoadPedComment(uint32 nComment) int size = op_read(fpSampleDataHandle, (opus_int16 *)(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE * nCurrentPedSlot + samplesRead), samplesSize, NULL); if (size <= 0) { - return false; + return FALSE; } samplesRead += size * 2; samplesSize -= size; } #else if ( fseek(fpSampleDataHandle, m_aSamples[nComment].nOffset, SEEK_SET) != 0 ) - return false; + return FALSE; if ( fread((void *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize ) - return false; + return FALSE; #endif nPedSlotSfx[nCurrentPedSlot] = nComment; @@ -1379,7 +1379,7 @@ cSampleManager::LoadPedComment(uint32 nComment) if ( ++nCurrentPedSlot >= MAX_PEDSFX ) nCurrentPedSlot = 0; - return true; + return TRUE; } int32 @@ -1422,13 +1422,13 @@ cSampleManager::GetSampleLength(uint32 nSample) return m_aSamples[nSample].nSize / sizeof(uint16); } -bool cSampleManager::UpdateReverb(void) +bool8 cSampleManager::UpdateReverb(void) { if ( !usingEAX && !_usingEFX ) - return false; + return FALSE; if ( AudioManager.GetFrameCounter() & 15 ) - return false; + return FALSE; float fRatio = 0.0f; @@ -1449,7 +1449,7 @@ bool cSampleManager::UpdateReverb(void) fRatio = clamp(fRatio, 0.0f, 0.6f); if ( fRatio == _fPrevEaxRatioDestination ) - return false; + return FALSE; #ifdef JUICY_OAL if ( usingEAX3 || _usingEFX ) @@ -1486,11 +1486,11 @@ bool cSampleManager::UpdateReverb(void) _fPrevEaxRatioDestination = fRatio; - return true; + return TRUE; } void -cSampleManager::SetChannelReverbFlag(uint32 nChannel, uint8 nReverbFlag) +cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag) { ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); @@ -1500,7 +1500,7 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, uint8 nReverbFlag) { alAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, ALEffect); - if ( nReverbFlag != 0 ) + if ( nReverbFlag != FALSE ) aChannel[nChannel].SetReverbMix(ALEffectSlot, _fEffectsLevel); else aChannel[nChannel].SetReverbMix(ALEffectSlot, 0.0f); @@ -1508,7 +1508,7 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, uint8 nReverbFlag) } } -bool +bool8 cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) { ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); @@ -1518,14 +1518,14 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) if ( nSfx < SAMPLEBANK_MAX ) { if ( !IsSampleBankLoaded(nBank) ) - return false; + return FALSE; addr = nSampleBankMemoryStartAddress[nBank] + m_aSamples[nSfx].nOffset - m_aSamples[BankStartOffset[nBank]].nOffset; } else { if ( !IsPedCommentLoaded(nSfx) ) - return false; + return FALSE; int32 slot = _GetPedCommentSlot(nSfx); addr = (nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE * slot); @@ -1543,10 +1543,10 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) aChannel[nChannel].SetSampleData ((void*)addr, m_aSamples[nSfx].nSize, m_aSamples[nSfx].nFrequency); aChannel[nChannel].SetLoopPoints (0, -1); aChannel[nChannel].SetPitch (1.0f); - return true; + return TRUE; } - return false; + return FALSE; } void @@ -1649,7 +1649,7 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount) aChannel[nChannel].SetLoopCount(nLoopCount); } -bool +bool8 cSampleManager::GetChannelUsedFlag(uint32 nChannel) { ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); @@ -1703,7 +1703,7 @@ cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream) } void -cSampleManager::PauseStream(uint8 nPauseFlag, uint8 nStream) +cSampleManager::PauseStream(bool8 nPauseFlag, uint8 nStream) { ASSERT( nStream < MAX_STREAMS ); @@ -1711,7 +1711,7 @@ cSampleManager::PauseStream(uint8 nPauseFlag, uint8 nStream) if ( stream ) { - stream->SetPause(nPauseFlag != 0); + stream->SetPause(nPauseFlag != FALSE); } } @@ -1731,7 +1731,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream) } } -bool +bool8 cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) { int i = 0; @@ -1739,7 +1739,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) char filename[MAX_PATH]; if ( nFile >= TOTAL_STREAMED_SOUNDS ) - return false; + return FALSE; if ( aStream[nStream] ) { @@ -1768,18 +1768,18 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) if (stream->Setup()) { stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1); - nStreamLoopedFlag[nStream] = true; + nStreamLoopedFlag[nStream] = TRUE; if (position != 0) stream->SetPosMS(position); stream->Start(); - return true; + return TRUE; } else { delete stream; aStream[nStream] = NULL; } - return false; + return FALSE; } else { @@ -1798,8 +1798,8 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) aStream[nStream]->Start(); - _bIsMp3Active = true; - return true; + _bIsMp3Active = TRUE; + return TRUE; } else { delete aStream[nStream]; aStream[nStream] = NULL; @@ -1827,18 +1827,18 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) if (stream->Setup()) { stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1); - nStreamLoopedFlag[nStream] = true; + nStreamLoopedFlag[nStream] = TRUE; if (position != 0) stream->SetPosMS(position); stream->Start(); - return true; + return TRUE; } else { delete stream; aStream[nStream] = NULL; } - return false; + return FALSE; } } if (mp3->pLinkPath != NULL) @@ -1853,9 +1853,9 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) if (aStream[nStream]->Setup()) { aStream[nStream]->Start(); #ifdef FIX_BUGS - _bIsMp3Active = true; + _bIsMp3Active = TRUE; #endif - return true; + return TRUE; } else { delete aStream[nStream]; aStream[nStream] = NULL; @@ -1876,18 +1876,18 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream) if ( stream->Setup() ) { stream->SetLoopCount(nStreamLoopedFlag[nStream] ? 0 : 1); - nStreamLoopedFlag[nStream] = true; + nStreamLoopedFlag[nStream] = TRUE; if (position != 0) stream->SetPosMS(position); stream->Start(); - return true; + return TRUE; } else { delete stream; aStream[nStream] = NULL; } - return false; + return FALSE; } void @@ -1903,7 +1903,7 @@ cSampleManager::StopStreamedFile(uint8 nStream) aStream[nStream] = NULL; if ( nStream == 0 ) - _bIsMp3Active = false; + _bIsMp3Active = FALSE; } } @@ -1937,7 +1937,7 @@ cSampleManager::GetStreamedFilePosition(uint8 nStream) } void -cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream) +cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, bool8 nEffectFlag, uint8 nStream) { ASSERT( nStream < MAX_STREAMS ); @@ -1980,7 +1980,7 @@ cSampleManager::GetStreamedFileLength(uint8 nStream) return nStreamLength[nStream]; } -bool +bool8 cSampleManager::IsStreamPlaying(uint8 nStream) { ASSERT( nStream < MAX_STREAMS ); @@ -1990,10 +1990,10 @@ cSampleManager::IsStreamPlaying(uint8 nStream) if ( stream ) { if ( stream->IsPlaying() ) - return true; + return TRUE; } - return false; + return FALSE; } void @@ -2014,14 +2014,14 @@ cSampleManager::Service(void) } } -bool +bool8 cSampleManager::InitialiseSampleBanks(void) { int32 nBank = SFX_BANK_0; fpSampleDescHandle = fcaseopen(SampleBankDescFilename, "rb"); if ( fpSampleDescHandle == NULL ) - return false; + return FALSE; #ifndef OPUS_SFX fpSampleDataHandle = fcaseopen(SampleBankDataFilename, "rb"); if ( fpSampleDataHandle == NULL ) @@ -2029,7 +2029,7 @@ cSampleManager::InitialiseSampleBanks(void) fclose(fpSampleDescHandle); fpSampleDescHandle = NULL; - return false; + return FALSE; } fseek(fpSampleDataHandle, 0, SEEK_END); @@ -2061,7 +2061,7 @@ cSampleManager::InitialiseSampleBanks(void) 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; + return TRUE; } void diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 7cf58d03..d4a42ea1 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -158,7 +158,7 @@ void CGarages::Init(void) } hGarages = DMAudio.CreateEntity(AUDIOTYPE_GARAGE, (void*)1); if (hGarages >= 0) - DMAudio.SetEntityStatus(hGarages, true); + DMAudio.SetEntityStatus(hGarages, TRUE); } void CGarages::Shutdown(void) diff --git a/src/control/Replay.cpp b/src/control/Replay.cpp index cd612d5d..7e8bee6b 100644 --- a/src/control/Replay.cpp +++ b/src/control/Replay.cpp @@ -1463,7 +1463,7 @@ void CReplay::RestoreStuffFromMem(void) ped->SetModelIndex(mi); ped->m_pVehicleAnim = nil; ped->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, ped); - DMAudio.SetEntityStatus(ped->m_audioEntityId, true); + DMAudio.SetEntityStatus(ped->m_audioEntityId, TRUE); CPopulation::UpdatePedCount((ePedType)ped->m_nPedType, false); for (int j = 0; j < TOTAL_WEAPON_SLOTS; j++) { int mi1 = CWeaponInfo::GetWeaponInfo(ped->m_weapons[j].m_eWeaponType)->m_nModelId; @@ -1529,7 +1529,7 @@ void CReplay::RestoreStuffFromMem(void) car->SetDoorDamage(CAR_DOOR_RR, DOOR_REAR_RIGHT, true); } vehicle->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, vehicle); - DMAudio.SetEntityStatus(vehicle->m_audioEntityId, true); + DMAudio.SetEntityStatus(vehicle->m_audioEntityId, TRUE); CCarCtrl::UpdateCarCount(vehicle, false); if ((mi == MI_AIRTRAIN || mi == MI_DEADDODO) && vehicle->m_rwObject){ CVehicleModelInfo* info = (CVehicleModelInfo*)CModelInfo::GetModelInfo(mi); diff --git a/src/control/Script.cpp b/src/control/Script.cpp index cb208912..4b70a678 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -1829,7 +1829,7 @@ void CMissionCleanup::Process() CWorld::Players[0].m_pPed->m_nDrunkCountdown = 0; CPad::GetPad(0)->SetDrunkInputDelay(0); CWorld::Players[0].m_bDriveByAllowed = true; - DMAudio.ShutUpPlayerTalking(0); + DMAudio.ShutUpPlayerTalking(FALSE); CVehicle::bDisableRemoteDetonation = false; CVehicle::bDisableRemoteDetonationOnContact = false; CGameLogic::ClearShortCut(); diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp index 878278c5..2e443110 100644 --- a/src/control/Script4.cpp +++ b/src/control/Script4.cpp @@ -1398,7 +1398,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command) { CollectParameters(&m_nIp, 1); DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND); - DMAudio.PlayFrontEndTrack(ScriptParams[0] + STREAMED_SOUND_MISSION_COMPLETED - 1, 0); + DMAudio.PlayFrontEndTrack(ScriptParams[0] + STREAMED_SOUND_MISSION_COMPLETED - 1, FALSE); return 0; } case COMMAND_CLEAR_AREA: diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index d6c2649f..798c1d8b 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -3968,7 +3968,7 @@ CMenuManager::PrintRadioSelector(void) if (radioChangeRequested) { if (CTimer::GetTimeInMillisecondsPauseMode() - lastRadioChange > 50) { DMAudio.SetRadioInCar(m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, TRUE); OutputDebugString("FRONTEND RADIO STATION CHANGED"); lastRadioChange = CTimer::GetTimeInMillisecondsPauseMode(); radioChangeRequested = false; @@ -4702,7 +4702,7 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u case MENUACTION_LOADRADIO: if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) { SwitchToNewScreen(MENUPAGE_SOUND_SETTINGS); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, TRUE); OutputDebugString("STARTED PLAYING FRONTEND AUDIO TRACK"); } break; @@ -4807,7 +4807,7 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume); DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume); DMAudio.SetRadioInCar(m_PrefsRadioStation); - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, TRUE); SaveSettings(); } else if (m_nCurrScreen == MENUPAGE_DISPLAY_SETTINGS) { m_PrefsBrightness = 256; diff --git a/src/core/FrontendTriggers.h b/src/core/FrontendTriggers.h index b2bde09c..bbafb4be 100644 --- a/src/core/FrontendTriggers.h +++ b/src/core/FrontendTriggers.h @@ -779,7 +779,7 @@ TriggerAudio_RadioStation(CMenuMultiChoicePicturedTriggered *widget) if ( CMenuManager::m_PrefsRadioStation != widget->GetMenuSelection() ) { CMenuManager::m_PrefsRadioStation = widget->GetMenuSelection(); - DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, 1); + DMAudio.PlayFrontEndTrack(CMenuManager::m_PrefsRadioStation, TRUE); DMAudio.SetRadioInCar(CMenuManager::m_PrefsRadioStation); } } diff --git a/src/core/Frontend_PS2.cpp b/src/core/Frontend_PS2.cpp index c0fcc652..c635c21f 100644 --- a/src/core/Frontend_PS2.cpp +++ b/src/core/Frontend_PS2.cpp @@ -2858,7 +2858,7 @@ CMenuManager::ProcessDPadCrossJustDown(void) { if ( !gMusicPlaying ) { - DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, 1); + DMAudio.PlayFrontEndTrack(m_PrefsRadioStation, TRUE); gMusicPlaying = true; } } diff --git a/src/core/Game.cpp b/src/core/Game.cpp index bffc620c..c5e5224d 100644 --- a/src/core/Game.cpp +++ b/src/core/Game.cpp @@ -577,7 +577,7 @@ bool CGame::Initialise(const char* datFile) #endif - DMAudio.SetStartingTrackPositions(true); + DMAudio.SetStartingTrackPositions(TRUE); DMAudio.ChangeMusicMode(MUSICMODE_GAME); return true; } diff --git a/src/core/World.cpp b/src/core/World.cpp index 1a693c5c..82f03541 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -65,7 +65,7 @@ CWorld::Initialise() void CWorld::Add(CEntity *ent) { - if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, true); + if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, TRUE); if(ent->bIsBIGBuilding) ms_bigBuildingsList[ent->m_level].InsertItem(ent); @@ -80,7 +80,7 @@ CWorld::Add(CEntity *ent) void CWorld::Remove(CEntity *ent) { - if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, false); + if(ent->IsVehicle() || ent->IsPed()) DMAudio.SetEntityStatus(((CPhysical *)ent)->m_audioEntityId, FALSE); if(ent->bIsBIGBuilding) ms_bigBuildingsList[ent->m_level].RemoveItem(ent); diff --git a/src/objects/ParticleObject.cpp b/src/objects/ParticleObject.cpp index 4d080d1f..d8aa3f60 100644 --- a/src/objects/ParticleObject.cpp +++ b/src/objects/ParticleObject.cpp @@ -33,7 +33,7 @@ CAudioHydrant::Add(CParticleObject *particleobject) if ( AEHANDLE_IS_FAILED(List[i].AudioEntity) ) return false; - DMAudio.SetEntityStatus(List[i].AudioEntity, true); + DMAudio.SetEntityStatus(List[i].AudioEntity, TRUE); List[i].pParticleObject = particleobject; diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index d8c445bf..8ad7027e 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -317,7 +317,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this) bCanGiveUpSunbathing = true; m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this); - DMAudio.SetEntityStatus(m_audioEntityId, true); + DMAudio.SetEntityStatus(m_audioEntityId, TRUE); m_fearFlags = CPedType::GetThreats(m_nPedType); m_threatEntity = nil; m_eventOrThreat = CVector2D(0.0f, 0.0f); diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp index ffbd7e8f..4b4c0138 100644 --- a/src/render/Weather.cpp +++ b/src/render/Weather.cpp @@ -137,7 +137,7 @@ void CWeather::Init(void) ForcedWeatherType = WEATHER_RANDOM; SoundHandle = DMAudio.CreateEntity(AUDIOTYPE_WEATHER, (void*)1); if (SoundHandle >= 0) - DMAudio.SetEntityStatus(SoundHandle, true); + DMAudio.SetEntityStatus(SoundHandle, TRUE); } void CWeather::Update(void) diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp index 9d90c616..c95d0659 100644 --- a/src/vehicles/Vehicle.cpp +++ b/src/vehicles/Vehicle.cpp @@ -151,7 +151,7 @@ CVehicle::CVehicle(uint8 CreatedBy) m_fMapObjectHeightAhead = m_fMapObjectHeightBehind = 0.0f; m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, this); if(m_audioEntityId >= 0) - DMAudio.SetEntityStatus(m_audioEntityId, true); + DMAudio.SetEntityStatus(m_audioEntityId, TRUE); //m_nRadioStation = CGeneral::GetRandomNumber() % NUM_RADIOS; switch(GetModelIndex()){ case MI_HUNTER: diff --git a/src/weapons/Explosion.cpp b/src/weapons/Explosion.cpp index 74137dc0..078f01fa 100644 --- a/src/weapons/Explosion.cpp +++ b/src/weapons/Explosion.cpp @@ -37,7 +37,7 @@ CExplosion::Initialise() ClearAllExplosions(); AudioHandle = DMAudio.CreateEntity(AUDIOTYPE_EXPLOSION, (void*)1); if (AudioHandle >= 0) - DMAudio.SetEntityStatus(AudioHandle, true); + DMAudio.SetEntityStatus(AudioHandle, TRUE); debug("CExplosion ready\n"); } -- cgit v1.2.3 From 42e655b4cc4975db9bdcbddccba4de117e74fecd Mon Sep 17 00:00:00 2001 From: majestic Date: Mon, 17 May 2021 15:18:46 -0700 Subject: some fixes for CPed --- src/peds/PedAI.cpp | 105 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 97 insertions(+), 8 deletions(-) diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp index c4d6df39..d1186723 100644 --- a/src/peds/PedAI.cpp +++ b/src/peds/PedAI.cpp @@ -4600,13 +4600,97 @@ CPed::ExitCar(void) CVector CPed::GetPositionToOpenCarDoor(CVehicle *veh, uint32 component) { - CVector vehDoorPos = GetPositionToOpenCarDoor(veh, component, 1.0f); + CVector doorPos; + CVector vehDoorOffset; + CVehicleModelInfo* vehModel = veh->GetModelInfo(); -/* - // Unused - vehDoorPosWithoutOffset = veh->GetMatrix() * localVehDoorPos; -*/ - return vehDoorPos; + if (veh->IsBike()) { + CBike* bike = (CBike*)veh; + + if (component == CAR_WINDSCREEN) { + doorPos = vehModel->GetFrontSeatPosn(); + return bike->GetMatrix() * (doorPos + + CVector(-vecPedBikeKickAnimOffset.x, vecPedBikeKickAnimOffset.y, -vecPedBikeKickAnimOffset.z)); + } else { + switch (bike->m_bikeAnimType) { + case ASSOCGRP_BIKE_VESPA: + vehDoorOffset = vecPedVespaBikeJumpRhsAnimOffset; + break; + case ASSOCGRP_BIKE_HARLEY: + vehDoorOffset = vecPedHarleyBikeJumpRhsAnimOffset; + break; + case ASSOCGRP_BIKE_DIRT: + vehDoorOffset = vecPedDirtBikeJumpRhsAnimOffset; + break; + default: + vehDoorOffset = vecPedStdBikeJumpRhsAnimOffset; + break; + } + } + + doorPos = vehModel->GetFrontSeatPosn(); + if (component == CAR_DOOR_LR || component == CAR_DOOR_RR) { + doorPos = vehModel->m_positions[CAR_POS_BACKSEAT]; + } + + if (component == CAR_DOOR_LR || component == CAR_DOOR_LF) { + vehDoorOffset.x *= -1.f; + } + + CVector correctedPos; + bike->GetCorrectedWorldDoorPosition(correctedPos, vehDoorOffset, doorPos); + return correctedPos; + } else { + float seatOffset; + if (veh->bIsVan && (component == CAR_DOOR_LR || component == CAR_DOOR_RR)) { + seatOffset = 0.0f; + vehDoorOffset = vecPedVanRearDoorAnimOffset; + } else { + seatOffset = veh->pHandling->fSeatOffsetDistance; + if (veh->bLowVehicle) { + vehDoorOffset = vecPedCarDoorLoAnimOffset; + } else { + vehDoorOffset = vecPedCarDoorAnimOffset; + } + } + + switch (component) { + case CAR_DOOR_RF: + doorPos = vehModel->GetFrontSeatPosn(); + doorPos.x += seatOffset; + vehDoorOffset.x = -vehDoorOffset.x; + break; + + case CAR_DOOR_RR: + doorPos = vehModel->m_positions[CAR_POS_BACKSEAT]; + doorPos.x += seatOffset; + vehDoorOffset.x = -vehDoorOffset.x; + break; + + case CAR_DOOR_LF: + doorPos = vehModel->GetFrontSeatPosn(); + doorPos.x += seatOffset; + doorPos.x = -doorPos.x; + break; + + case CAR_DOOR_LR: + doorPos = vehModel->m_positions[CAR_POS_BACKSEAT]; + doorPos.x += seatOffset; + doorPos.x = -doorPos.x; + break; + + default: + doorPos = vehModel->GetFrontSeatPosn(); + vehDoorOffset = CVector(0.0f, 0.0f, 0.0f); + break; + } + + CVector diffVec = doorPos - vehDoorOffset; + return Multiply3x3(veh->GetMatrix(), diffVec) + veh->GetPosition(); + + //unused + //doorPos = Multiply3x3(veh->GetMatrix(), doorPos) + veh->GetMatrix(); + } } void @@ -5058,7 +5142,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg) break; } } else { - draggedOutOffset = vecPedDraggedOutCarAnimOffset; + draggedOutOffset = CVector(vecPedDraggedOutCarAnimOffset.x, vecPedDraggedOutCarAnimOffset.y, 0.0f); } if (ped->m_vehDoor == CAR_DOOR_RF || ped->m_vehDoor == CAR_DOOR_RR) draggedOutOffset.x = -draggedOutOffset.x; @@ -5069,7 +5153,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg) ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); ped->SetPosition(posAfterBeingDragged); - if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsBike() && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehDoor, &vecPedDraggedOutCarAnimOffset)) { + if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsBike() && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehDoor, &draggedOutOffset)) { ped->PositionPedOutOfCollision(); } @@ -5684,7 +5768,12 @@ CPed::GetPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset) doorPos = vehModel->GetFrontSeatPosn(); if (component == CAR_WINDSCREEN) { +#ifdef FIX_BUGS + return bike->GetMatrix() * (doorPos + + CVector(-vecPedBikeKickAnimOffset.x, vecPedBikeKickAnimOffset.y, -vecPedBikeKickAnimOffset.z)); +#else return bike->GetMatrix() * (doorPos + vecPedBikeKickAnimOffset); +#endif } else { switch (bike->m_bikeAnimType) { case ASSOCGRP_BIKE_VESPA: -- cgit v1.2.3 From 59ed4d0029efec799f85b43570c15932e8f84825 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 22 May 2021 18:41:28 +0300 Subject: Fix MAX_DIGITAL_MIXER_CHANNELS --- src/audio/sampman.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/sampman.h b/src/audio/sampman.h index 50d1b17f..7c60080d 100644 --- a/src/audio/sampman.h +++ b/src/audio/sampman.h @@ -126,7 +126,7 @@ enum #define DIGITALBITS 16 #define DIGITALCHANNELS 2 -#define MAX_DIGITAL_MIXER_CHANNELS 32 +#define MAX_DIGITAL_MIXER_CHANNELS 34 class cSampleManager { -- cgit v1.2.3 From 02655313e9726a044dcecdeb143c261614d00f0f Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 23 May 2021 16:47:16 +0300 Subject: Increase the number of audio channels to PS2 count and some small audio fixes --- src/audio/AudioLogic.cpp | 76 +++++++++++++++++++++++---------------------- src/audio/AudioManager.cpp | 17 +++++----- src/audio/AudioManager.h | 8 ++--- src/audio/PolRadio.cpp | 27 +++++++--------- src/audio/audio_enums.h | 23 ++++++++++++++ src/audio/oal/channel.cpp | 18 +++++------ src/audio/sampman.h | 14 ++++++--- src/audio/sampman_miles.cpp | 20 ++++++------ src/audio/sampman_oal.cpp | 58 +++++++++++++++++----------------- src/core/config.h | 2 +- 10 files changed, 145 insertions(+), 118 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index a3493e38..15454bfe 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -43,9 +43,9 @@ #include "Script.h" #include "Wanted.h" -const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples); -const int policeChannel = channels + 1; -const int allChannels = channels + 2; +#ifndef GTA_PS2 +#define CHANNEL_PLAYER_VEHICLE_ENGINE m_nActiveSamples +#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 }; @@ -246,23 +246,25 @@ cAudioManager::ResetAudioLogicTimers(uint32 timer) } ClearMissionAudio(0); ClearMissionAudio(1); - SampleManager.StopChannel(policeChannel); + SampleManager.StopChannel(CHANNEL_POLICE_RADIO); } void cAudioManager::ProcessReverb() const { #ifdef FIX_BUGS - const uint32 numChannels = channels; + const uint32 numChannels = NUM_CHANNELS_GENERIC; #else - const uint32 numChannels = 28; + const uint32 numChannels = NUM_CHANNELS_GENERIC+1; #endif if (SampleManager.UpdateReverb() && m_bDynamicAcousticModelingStatus) { +#ifndef GTA_PS2 for (uint32 i = 0; i < numChannels; i++) { if (m_asActiveSamples[i].m_bReverbFlag) SampleManager.SetChannelReverbFlag(i, TRUE); } +#endif } } @@ -347,7 +349,7 @@ cAudioManager::ProcessSpecial() if (playerPed->m_audioEntityId >= 0 && m_asAudioEntities[playerPed->m_audioEntityId].m_bIsUsed) { if (playerPed->EnteringCar()) { if(!playerPed->bInVehicle && CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle == nil) - SampleManager.StopChannel(m_nActiveSamples); + SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); } } } @@ -1307,7 +1309,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) playerVeh = FindPlayerVehicle(); veh = params.m_pVehicle; if (playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) { - SampleManager.StopChannel(m_nActiveSamples); + SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); return; } if (!veh->bEngineOn) @@ -1673,7 +1675,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh accelerateState = Pads[0].GetAccelerate(); brakeState = Pads[0].GetBrake(); } - channelUsed = SampleManager.GetChannelUsedFlag(m_nActiveSamples); + channelUsed = SampleManager.GetChannelUsedFlag(CHANNEL_PLAYER_VEHICLE_ENGINE); if (isMoped) { CurrentPretendGear = params.m_pTransmission->nNumberOfGears; currentGear = CurrentPretendGear; @@ -1837,7 +1839,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh if (accelerateState <= 0) { if (params.m_fVelocityChange < -0.001f) { if (channelUsed) { - SampleManager.StopChannel(m_nActiveSamples); + SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); bAccelSampleStopped = TRUE; } if (wheelsOnGround == 0 || params.m_pVehicle->bIsHandbrakeOn || lostTraction) @@ -1849,7 +1851,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh *gasPedalAudioPtr = Max(0.0f, gasPedalAudio); } else if (LastAccel > 0) { if (channelUsed) { - SampleManager.StopChannel(m_nActiveSamples); + SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); bAccelSampleStopped = TRUE; } nCruising = 0; @@ -1910,7 +1912,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh if (engineSoundType == SFX_BANK_TRUCK) freq /= 2; if (channelUsed) { - SampleManager.StopChannel(m_nActiveSamples); + SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); bAccelSampleStopped = TRUE; } if (params.m_pVehicle->bIsDrowning) @@ -1925,55 +1927,55 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh bAccelSampleStopped = FALSE; } if (channelUsed) { - SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 120); - SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.0f, 12.5f); + SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120); + SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z); + SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 12.5f); freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050) ; if (engineSoundType == SFX_BANK_TRUCK) freq /= 2; - SampleManager.SetChannelFrequency(m_nActiveSamples, freq); + SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq); if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != FALSE); - SampleManager.StartChannel(m_nActiveSamples); + SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE); + SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); } } else if (processedAccelSampleStopped) { gearSoundStartTime = CTimer::GetTimeInMilliseconds(); params.m_pVehicle->bAudioChangingGear = TRUE; - if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0)) + if (!SampleManager.InitialiseChannel(CHANNEL_PLAYER_VEHICLE_ENGINE, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0)) return; - SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); - SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); + SampleManager.SetChannelLoopCount(CHANNEL_PLAYER_VEHICLE_ENGINE, 1); + SampleManager.SetChannelLoopPoints(CHANNEL_PLAYER_VEHICLE_ENGINE, 0, -1); - SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 120); - SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.0f, 12.5f); + SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120); + SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z); + SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 12.5f); freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050); if (engineSoundType == SFX_BANK_TRUCK) freq /= 2; - SampleManager.SetChannelFrequency(m_nActiveSamples, freq); + SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq); if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != FALSE); - SampleManager.StartChannel(m_nActiveSamples); + SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE); + SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); } } else if (CurrentPretendGear < params.m_pTransmission->nNumberOfGears - 1) { ++CurrentPretendGear; gearSoundStartTime = CTimer::GetTimeInMilliseconds(); params.m_pVehicle->bAudioChangingGear = TRUE; - if (!SampleManager.InitialiseChannel(m_nActiveSamples, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0)) + if (!SampleManager.InitialiseChannel(CHANNEL_PLAYER_VEHICLE_ENGINE, soundOffset + SFX_CAR_ACCEL_1, SFX_BANK_0)) return; - SampleManager.SetChannelLoopCount(m_nActiveSamples, 1); - SampleManager.SetChannelLoopPoints(m_nActiveSamples, 0, -1); + SampleManager.SetChannelLoopCount(CHANNEL_PLAYER_VEHICLE_ENGINE, 1); + SampleManager.SetChannelLoopPoints(CHANNEL_PLAYER_VEHICLE_ENGINE, 0, -1); - SampleManager.SetChannelEmittingVolume(m_nActiveSamples, 120); - SampleManager.SetChannel3DPosition(m_nActiveSamples, pos.x, pos.y, pos.z); - SampleManager.SetChannel3DDistances(m_nActiveSamples, 50.0f, 12.5f); + SampleManager.SetChannelEmittingVolume(CHANNEL_PLAYER_VEHICLE_ENGINE, 120); + SampleManager.SetChannel3DPosition(CHANNEL_PLAYER_VEHICLE_ENGINE, pos.x, pos.y, pos.z); + SampleManager.SetChannel3DDistances(CHANNEL_PLAYER_VEHICLE_ENGINE, 50.0f, 12.5f); freq = (GearFreqAdj[CurrentPretendGear] + freqModifier + 22050); if (engineSoundType == SFX_BANK_TRUCK) freq /= 2; - SampleManager.SetChannelFrequency(m_nActiveSamples, freq); + SampleManager.SetChannelFrequency(CHANNEL_PLAYER_VEHICLE_ENGINE, freq); if (!channelUsed) { - SampleManager.SetChannelReverbFlag(m_nActiveSamples, m_bDynamicAcousticModelingStatus != FALSE); - SampleManager.StartChannel(m_nActiveSamples); + SampleManager.SetChannelReverbFlag(CHANNEL_PLAYER_VEHICLE_ENGINE, m_bDynamicAcousticModelingStatus != FALSE); + SampleManager.StartChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); } } else { nCruising = 1; @@ -1983,7 +1985,7 @@ cAudioManager::ProcessPlayersVehicleEngine(cVehicleParams& params, CVehicle* veh } else { PlayCruising: bAccelSampleStopped = TRUE; - SampleManager.StopChannel(m_nActiveSamples); + SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); if (isMoped || accelerateState >= 150 && wheelsOnGround && brakeState <= 0 && !params.m_pVehicle->bIsHandbrakeOn && !lostTraction && currentGear >= params.m_pTransmission->nNumberOfGears - 1) { if (accelerateState >= 220 && params.m_fVelocityChange + 0.001f >= velocityChangeForAudio) { diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index 3be053d2..e56d28e1 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -14,10 +14,6 @@ cAudioManager AudioManager; -const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples); -const int policeChannel = channels + 1; -const int allChannels = channels + 2; - #define SPEED_OF_SOUND 343.f #define TIME_SPENT 40 @@ -28,7 +24,7 @@ cAudioManager::cAudioManager() field_6 = 0; m_fSpeedOfSound = SPEED_OF_SOUND / TIME_SPENT; m_nTimeSpent = TIME_SPENT; - m_nActiveSamples = NUM_SOUNDS_SAMPLES_SLOTS; + m_nActiveSamples = NUM_CHANNELS_GENERIC; m_nActiveSampleQueue = 1; ClearRequestedQueue(); m_nActiveSampleQueue = 0; @@ -276,7 +272,7 @@ cAudioManager::ResetTimers(uint32 time) ClearActiveSamples(); ClearMissionAudio(0); ClearMissionAudio(1); - SampleManager.StopChannel(policeChannel); + SampleManager.StopChannel(CHANNEL_POLICE_RADIO); SampleManager.SetEffectsFadeVolume(0); SampleManager.SetMusicFadeVolume(0); MusicManager.ResetMusicAfterReload(); @@ -446,7 +442,7 @@ cAudioManager::ServiceSoundEffects() { m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0; if (m_nUserPause && !m_nPreviousUserPause) { - for (int32 i = 0; i < allChannels; i++) + for (int32 i = 0; i < NUM_CHANNELS; i++) SampleManager.StopChannel(i); ClearRequestedQueue(); @@ -773,7 +769,12 @@ cAudioManager::UpdateReflections() void cAudioManager::AddReleasingSounds() { - bool8 toProcess[44]; // why not 27? + // in case someone would want to increase it +#ifdef FIX_BUGS + bool8 toProcess[NUM_CHANNELS_GENERIC]; +#else + bool8 toProcess[44]; +#endif int8 queue = m_nActiveSampleQueue == 0 ? 1 : 0; diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 49535252..d5b3ce15 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -205,10 +205,10 @@ public: int32 m_nTimer; tSound m_sQueueSample; uint8 m_nActiveSampleQueue; - tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS]; - uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS]; + tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_CHANNELS_GENERIC]; + uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_CHANNELS_GENERIC]; uint8 m_SampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS]; - tSound m_asActiveSamples[NUM_SOUNDS_SAMPLES_SLOTS]; + tSound m_asActiveSamples[NUM_CHANNELS_GENERIC]; tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES]; int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES]; int32 m_nAudioEntitiesTotal; @@ -544,7 +544,7 @@ public: #endif }; -#ifdef AUDIO_MSS +#if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS) static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error"); #endif diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp index cf92bb95..82f44dee 100644 --- a/src/audio/PolRadio.cpp +++ b/src/audio/PolRadio.cpp @@ -15,9 +15,6 @@ #include "sampman.h" #include "Wanted.h" -const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples); -const int policeChannel = channels + 1; - struct tPoliceRadioZone { char m_aName[8]; uint32 m_nSampleIndex; @@ -68,7 +65,7 @@ cAudioManager::InitialisePoliceRadio() for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE; - SampleManager.SetChannelReverbFlag(policeChannel, FALSE); + SampleManager.SetChannelReverbFlag(CHANNEL_POLICE_RADIO, FALSE); gSpecialSuspectLastSeenReport = FALSE; for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++) gMinTimeToNextReport[i] = m_FrameCounter; @@ -78,7 +75,7 @@ void cAudioManager::ResetPoliceRadio() { if (!m_bIsInitialised) return; - if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel); + if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO); InitialisePoliceRadio(); } @@ -168,7 +165,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) if (!m_bIsInitialised) return; if (m_nUserPause != 0) { - if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel); + if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO); if (g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == 1 && SampleManager.IsStreamPlaying(1)) { SampleManager.PauseStream(TRUE, 1); @@ -200,7 +197,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) } return; } - } else if (!SampleManager.GetChannelUsedFlag(policeChannel)) { + } else if (!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) { SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1); SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 1); SampleManager.StartPreloadedStreamedFile(1); @@ -211,7 +208,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) } if (bChannelOpen) DoPoliceRadioCrackle(); if ((g_nMissionAudioSfx == NO_SAMPLE || g_nMissionAudioPlayingStatus != 1) && - !SampleManager.GetChannelUsedFlag(policeChannel) && m_sPoliceRadioQueue.policeChannelTimer) { + !SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO) && m_sPoliceRadioQueue.policeChannelTimer) { if (m_sPoliceRadioQueue.policeChannelTimer) { sample = m_sPoliceRadioQueue.crimesSamples[m_sPoliceRadioQueue.policeChannelCounterSeconds]; m_sPoliceRadioQueue.policeChannelTimer--; @@ -230,7 +227,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) if (sample == NO_SAMPLE) { if (!processed) cWait = 30; } else { - SampleManager.InitialiseChannel(policeChannel, sample, 0); + SampleManager.InitialiseChannel(CHANNEL_POLICE_RADIO, sample, 0); switch (sample) { case SFX_POLICE_RADIO_MESSAGE_NOISE_1: freq = m_anRandomTable[4] % 2000 + 10025; @@ -239,12 +236,12 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) default: freq = SampleManager.GetSampleBaseFrequency(sample); break; } PoliceChannelFreq = freq; - SampleManager.SetChannelFrequency(policeChannel, freq); - SampleManager.SetChannelVolume(policeChannel, 100); - SampleManager.SetChannelPan(policeChannel, 63); - SampleManager.SetChannelLoopCount(policeChannel, 1); - SampleManager.SetChannelLoopPoints(policeChannel, 0, -1); - SampleManager.StartChannel(policeChannel); + SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, freq); + SampleManager.SetChannelVolume(CHANNEL_POLICE_RADIO, 100); + SampleManager.SetChannelPan(CHANNEL_POLICE_RADIO, 63); + SampleManager.SetChannelLoopCount(CHANNEL_POLICE_RADIO, 1); + SampleManager.SetChannelLoopPoints(CHANNEL_POLICE_RADIO, 0, -1); + SampleManager.StartChannel(CHANNEL_POLICE_RADIO); } if (processed) ResetPoliceRadio(); } diff --git a/src/audio/audio_enums.h b/src/audio/audio_enums.h index 990b2d73..5a14d312 100644 --- a/src/audio/audio_enums.h +++ b/src/audio/audio_enums.h @@ -1295,3 +1295,26 @@ enum eAudioType AUDIOTYPE_POLICERADIO, TOTAL_AUDIO_TYPES, }; + +#ifdef GTA_PS2 +enum +{ + NUM_CHANNELS_GENERIC = 42, + CHANNEL_POLICE_RADIO = NUM_CHANNELS_GENERIC, + CHANNEL_MISSION_AUDIO_1, + CHANNEL_MISSION_AUDIO_2, + CHANNEL_PLAYER_VEHICLE_ENGINE, + NUM_CHANNELS +}; +#else +enum +{ +#ifdef PS2_AUDIO_CHANNELS + NUM_CHANNELS_GENERIC = 42, +#else + NUM_CHANNELS_GENERIC = 27, +#endif + CHANNEL_POLICE_RADIO, + NUM_CHANNELS +}; +#endif diff --git a/src/audio/oal/channel.cpp b/src/audio/oal/channel.cpp index 1bb4c4a8..04e7e529 100644 --- a/src/audio/oal/channel.cpp +++ b/src/audio/oal/channel.cpp @@ -10,9 +10,9 @@ extern bool IsFXSupported(); -ALuint alSources[MAXCHANNELS+MAX2DCHANNELS]; -ALuint alFilters[MAXCHANNELS+MAX2DCHANNELS]; -ALuint alBuffers[MAXCHANNELS+MAX2DCHANNELS]; +ALuint alSources[NUM_CHANNELS]; +ALuint alFilters[NUM_CHANNELS]; +ALuint alBuffers[NUM_CHANNELS]; bool bChannelsCreated = false; int32 CChannel::channelsThatNeedService = 0; @@ -22,10 +22,10 @@ uint8 tempStereoBuffer[PED_BLOCKSIZE * 2]; void CChannel::InitChannels() { - alGenSources(MAXCHANNELS+MAX2DCHANNELS, alSources); - alGenBuffers(MAXCHANNELS+MAX2DCHANNELS, alBuffers); + alGenSources(NUM_CHANNELS, alSources); + alGenBuffers(NUM_CHANNELS, alBuffers); if (IsFXSupported()) - alGenFilters(MAXCHANNELS + MAX2DCHANNELS, alFilters); + alGenFilters(NUM_CHANNELS, alFilters); bChannelsCreated = true; } @@ -34,13 +34,13 @@ CChannel::DestroyChannels() { if (bChannelsCreated) { - alDeleteSources(MAXCHANNELS + MAX2DCHANNELS, alSources); + alDeleteSources(NUM_CHANNELS, alSources); memset(alSources, 0, sizeof(alSources)); - alDeleteBuffers(MAXCHANNELS + MAX2DCHANNELS, alBuffers); + alDeleteBuffers(NUM_CHANNELS, alBuffers); memset(alBuffers, 0, sizeof(alBuffers)); if (IsFXSupported()) { - alDeleteFilters(MAXCHANNELS + MAX2DCHANNELS, alFilters); + alDeleteFilters(NUM_CHANNELS, alFilters); memset(alFilters, 0, sizeof(alFilters)); } bChannelsCreated = false; diff --git a/src/audio/sampman.h b/src/audio/sampman.h index 7c60080d..d6fc5cc0 100644 --- a/src/audio/sampman.h +++ b/src/audio/sampman.h @@ -1,5 +1,6 @@ #pragma once #include "AudioSamples.h" +#include "audio_enums.h" #define MAX_VOLUME 127 #define MAX_FREQ DIGITALRATE @@ -115,10 +116,9 @@ enum #define MAXPROVIDERS 64 -#define MAXCHANNELS 28 -#define MAXCHANNELS_SURROUND 24 +#define MAXCHANNELS (NUM_CHANNELS_GENERIC+1) +#define MAXCHANNELS_SURROUND (MAXCHANNELS-4) #define MAX2DCHANNELS 1 -#define CHANNEL2D MAXCHANNELS #define MAX_STREAMS 3 @@ -126,7 +126,13 @@ enum #define DIGITALBITS 16 #define DIGITALCHANNELS 2 -#define MAX_DIGITAL_MIXER_CHANNELS 34 +#ifdef FIX_BUGS +#define MAX_DIGITAL_MIXER_CHANNELS (MAXCHANNELS+MAX_STREAMS*2+MAX2DCHANNELS) +#else +#define MAX_DIGITAL_MIXER_CHANNELS (MAXCHANNELS+MAX_STREAMS*2) +#endif + +static_assert( NUM_CHANNELS == MAXCHANNELS + MAX2DCHANNELS, "The number of channels doesn't match with an enum" ); class cSampleManager { diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index a6f04775..558be334 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -1694,7 +1694,7 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag) switch ( nChannel ) { - case CHANNEL2D: + case CHANNEL_POLICE_RADIO: { b2d = TRUE; break; @@ -1723,7 +1723,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) switch ( nChannel ) { - case CHANNEL2D: + case CHANNEL_POLICE_RADIO: { b2d = TRUE; break; @@ -1823,7 +1823,7 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume) switch ( nChannel ) { - case CHANNEL2D: + case CHANNEL_POLICE_RADIO: { nChannelVolume[nChannel] = vol; @@ -1850,7 +1850,7 @@ cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan) { switch ( nChannel ) { - case CHANNEL2D: + case CHANNEL_POLICE_RADIO: { #ifndef FIX_BUGS if ( opened_samples[nChannel - MAXCHANNELS] ) // BUG @@ -1871,7 +1871,7 @@ cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq) switch ( nChannel ) { - case CHANNEL2D: + case CHANNEL_POLICE_RADIO: { b2d = TRUE; break; @@ -1897,7 +1897,7 @@ cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 n switch ( nChannel ) { - case CHANNEL2D: + case CHANNEL_POLICE_RADIO: { b2d = TRUE; break; @@ -1923,7 +1923,7 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount) switch ( nChannel ) { - case CHANNEL2D: + case CHANNEL_POLICE_RADIO: { b2d = TRUE; break; @@ -1949,7 +1949,7 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel) switch ( nChannel ) { - case CHANNEL2D: + case CHANNEL_POLICE_RADIO: { b2d = TRUE; break; @@ -1980,7 +1980,7 @@ cSampleManager::StartChannel(uint32 nChannel) switch ( nChannel ) { - case CHANNEL2D: + case CHANNEL_POLICE_RADIO: { b2d = TRUE; break; @@ -2006,7 +2006,7 @@ cSampleManager::StopChannel(uint32 nChannel) switch ( nChannel ) { - case CHANNEL2D: + case CHANNEL_POLICE_RADIO: { b2d = TRUE; break; diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index e74fac82..a4c92482 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -94,8 +94,8 @@ int32 nPedSlotSfx [MAX_PEDSFX]; int32 nPedSlotSfxAddr[MAX_PEDSFX]; uint8 nCurrentPedSlot; -CChannel aChannel[MAXCHANNELS+MAX2DCHANNELS]; -uint8 nChannelVolume[MAXCHANNELS+MAX2DCHANNELS]; +CChannel aChannel[NUM_CHANNELS]; +uint8 nChannelVolume[NUM_CHANNELS]; uint32 nStreamLength[TOTAL_STREAMED_SOUNDS]; ALuint ALStreamSources[MAX_STREAMS][2]; @@ -213,9 +213,8 @@ add_providers() static void release_existing() { - for ( int32 i = 0; i < MAXCHANNELS; i++ ) + for ( int32 i = 0; i < NUM_CHANNELS; i++ ) aChannel[i].Term(); - aChannel[CHANNEL2D].Term(); if ( IsFXSupported() ) { @@ -284,7 +283,8 @@ set_new_provider(int index) _maxSamples = MAXCHANNELS; ALCint attr[] = {ALC_FREQUENCY,MAX_FREQ, - ALC_MONO_SOURCES, MAX_STREAMS * 2 + MAXCHANNELS, + ALC_MONO_SOURCES, MAX_DIGITAL_MIXER_CHANNELS - MAX2DCHANNELS, + ALC_STEREO_SOURCES, MAX2DCHANNELS, 0, }; @@ -370,8 +370,9 @@ set_new_provider(int index) CChannel::InitChannels(); for ( int32 i = 0; i < MAXCHANNELS; i++ ) - aChannel[i].Init(i); - aChannel[CHANNEL2D].Init(CHANNEL2D, true); + aChannel[i].Init(i); + for ( int32 i = 0; i < MAX2DCHANNELS; i++ ) + aChannel[MAXCHANNELS+i].Init(MAXCHANNELS+i, true); if ( IsFXSupported() ) { @@ -978,7 +979,7 @@ cSampleManager::Initialise(void) } { - for ( int32 i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++ ) + for ( int32 i = 0; i < NUM_CHANNELS; i++ ) nChannelVolume[i] = 0; } @@ -1184,7 +1185,7 @@ cSampleManager::UpdateEffectsVolume(void) { if ( _bSampmanInitialised ) { - for ( int32 i = 0; i < MAXCHANNELS+MAX2DCHANNELS; i++ ) + for ( int32 i = 0; i < NUM_CHANNELS; i++ ) { if ( GetChannelUsedFlag(i) ) { @@ -1492,7 +1493,7 @@ bool8 cSampleManager::UpdateReverb(void) void cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag) { - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel < NUM_CHANNELS ); if ( usingEAX || _usingEFX ) { @@ -1511,7 +1512,7 @@ cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag) bool8 cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) { - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel < NUM_CHANNELS ); uintptr addr; @@ -1552,8 +1553,7 @@ cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank) void cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume) { - ASSERT( nChannel != CHANNEL2D ); - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel < MAXCHANNELS ); uint32 vol = nVolume; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME; @@ -1574,8 +1574,7 @@ cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume) void cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ) { - ASSERT( nChannel != CHANNEL2D ); - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel < MAXCHANNELS ); aChannel[nChannel].SetPosition(-fX, fY, fZ); } @@ -1583,18 +1582,17 @@ cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float void cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin) { - ASSERT( nChannel != CHANNEL2D ); - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel < MAXCHANNELS ); aChannel[nChannel].SetDistances(fMax, fMin); } void cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume) { - ASSERT( nChannel == CHANNEL2D ); - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel >= MAXCHANNELS ); + ASSERT( nChannel < NUM_CHANNELS ); - if ( nChannel == CHANNEL2D ) + if ( nChannel == CHANNEL_POLICE_RADIO ) { uint32 vol = nVolume; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME; @@ -1616,10 +1614,10 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume) void cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan) { - ASSERT(nChannel == CHANNEL2D); - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel >= MAXCHANNELS ); + ASSERT( nChannel < NUM_CHANNELS ); - if ( nChannel == CHANNEL2D ) + if ( nChannel == CHANNEL_POLICE_RADIO ) { aChannel[nChannel].SetPan(nPan); } @@ -1628,7 +1626,7 @@ cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan) void cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq) { - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel < NUM_CHANNELS ); aChannel[nChannel].SetCurrentFreq(nFreq); } @@ -1636,7 +1634,7 @@ cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq) void cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd) { - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel < NUM_CHANNELS ); aChannel[nChannel].SetLoopPoints(nLoopStart / (DIGITALBITS / 8), nLoopEnd / (DIGITALBITS / 8)); } @@ -1644,7 +1642,7 @@ cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 n void cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount) { - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel < NUM_CHANNELS ); aChannel[nChannel].SetLoopCount(nLoopCount); } @@ -1652,7 +1650,7 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount) bool8 cSampleManager::GetChannelUsedFlag(uint32 nChannel) { - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel < NUM_CHANNELS ); return aChannel[nChannel].IsUsed(); } @@ -1660,7 +1658,7 @@ cSampleManager::GetChannelUsedFlag(uint32 nChannel) void cSampleManager::StartChannel(uint32 nChannel) { - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel < NUM_CHANNELS ); aChannel[nChannel].Start(); } @@ -1668,7 +1666,7 @@ cSampleManager::StartChannel(uint32 nChannel) void cSampleManager::StopChannel(uint32 nChannel) { - ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS ); + ASSERT( nChannel < NUM_CHANNELS ); aChannel[nChannel].Stop(); } @@ -2007,7 +2005,7 @@ cSampleManager::Service(void) stream->Update(); } int refCount = CChannel::channelsThatNeedService; - for ( int32 i = 0; refCount && i < MAXCHANNELS+MAX2DCHANNELS; i++ ) + for ( int32 i = 0; refCount && i < NUM_CHANNELS; i++ ) { if ( aChannel[i].Update() ) refCount--; diff --git a/src/core/config.h b/src/core/config.h index 6d30a65f..69e9c8fd 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -131,7 +131,6 @@ enum Config { NUM_PED_COMMENTS_SLOTS = 20, NUM_SOUNDS_SAMPLES_BANKS = 2, - NUM_SOUNDS_SAMPLES_SLOTS = 27, NUM_AUDIOENTITIES = 250, NUM_AUDIO_REFLECTIONS = 8, @@ -396,6 +395,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually // Audio #define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS #define AUDIO_CACHE // cache sound lengths to speed up the cold boot +#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 43 (PC has 28 originally) //#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds) //#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder #define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files -- cgit v1.2.3 From be019c61269e34d9c9a45bd83e854bb8f38e92ae Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sun, 23 May 2021 17:14:12 +0300 Subject: Undef PS2_AUDIO_CHANNELS for SQUEEZE_PERFORMANCE and VANILLA_DEFINES # Conflicts: # src/core/config.h --- src/core/config.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/config.h b/src/core/config.h index 69e9c8fd..f8e63d31 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -423,6 +423,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually #ifdef SQUEEZE_PERFORMANCE #undef PS2_ALPHA_TEST #undef NO_ISLAND_LOADING + #undef PS2_AUDIO_CHANNELS #endif // ------- @@ -511,6 +512,6 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually #undef IMPROVED_CAMERA #undef FREE_CAM #undef BIG_IMG - +#undef PS2_AUDIO_CHANNELS #undef RADIO_SCROLL_TO_PREV_STATION #endif -- cgit v1.2.3 From 93e99299250fbc5e459883b514b871f6009edfc6 Mon Sep 17 00:00:00 2001 From: aap Date: Sun, 23 May 2021 17:49:55 +0200 Subject: CEntity and C(Vu)Vector fixes and cleanup --- src/core/Camera.cpp | 9 ++------- src/core/Camera.h | 6 +----- src/core/References.cpp | 2 -- src/core/common.h | 6 ++++++ src/entities/Entity.cpp | 45 ++++++++++++++++++++++++--------------------- src/entities/Entity.h | 6 +++--- src/entities/Physical.cpp | 8 ++++---- src/math/VuVector.h | 2 ++ src/modelinfo/ModelInfo.h | 3 +++ src/peds/Population.cpp | 15 +++++++++------ src/render/Occlusion.cpp | 4 ++-- src/render/Shadows.cpp | 2 +- src/rw/VisibilityPlugins.h | 1 - 13 files changed, 57 insertions(+), 52 deletions(-) diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index 50ac2b5b..baf31f04 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -4101,16 +4101,11 @@ CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat bool CCamera::IsSphereVisible(const CVector ¢er, float radius) { - CMatrix mat = m_cameraMatrix; - return IsSphereVisible(center, radius, &mat); + return IsSphereVisible(center, radius, &m_cameraMatrix); } bool -#ifdef GTA_PS2 -CCamera::IsBoxVisible(CVuVector *box, const CMatrix *mat) -#else -CCamera::IsBoxVisible(CVector *box, const CMatrix *mat) -#endif +CCamera::IsBoxVisible(CVUVECTOR *box, const CMatrix *mat) { int i; int frustumTests[6] = { 0 }; diff --git a/src/core/Camera.h b/src/core/Camera.h index 538ff067..39ecb760 100644 --- a/src/core/Camera.h +++ b/src/core/Camera.h @@ -633,11 +633,7 @@ public: bool IsPointVisible(const CVector ¢er, const CMatrix *mat); bool IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat); bool IsSphereVisible(const CVector ¢er, float radius); -#ifdef GTA_PS2 - bool IsBoxVisible(CVuVector *box, const CMatrix *mat); -#else - bool IsBoxVisible(CVector *box, const CMatrix *mat); -#endif + bool IsBoxVisible(CVUVECTOR *box, const CMatrix *mat); }; VALIDATE_SIZE(CCamera, 0xE9D8); diff --git a/src/core/References.cpp b/src/core/References.cpp index dc83d96d..09913817 100644 --- a/src/core/References.cpp +++ b/src/core/References.cpp @@ -39,9 +39,7 @@ CEntity::RegisterReference(CEntity **pent) ref->pentity = pent; ref->next = m_pFirstReference; m_pFirstReference = ref; - return; } - return; } // Clean up the reference from *pent -> 'this' diff --git a/src/core/common.h b/src/core/common.h index d39531cc..38ba7ea8 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -214,6 +214,12 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w) #include "maths.h" #include "Vector.h" +#ifdef GTA_PS2 +#include "VuVector.h" +#define CVUVECTOR CVuVector +#else +#define CVUVECTOR CVector +#endif #include "Vector2D.h" #include "Matrix.h" #include "Rect.h" diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp index 4653c173..1545ce95 100644 --- a/src/entities/Entity.cpp +++ b/src/entities/Entity.cpp @@ -1,5 +1,6 @@ #include "common.h" +#include "VuVector.h" #include "General.h" #include "RwHelper.h" #include "ModelIndices.h" @@ -70,7 +71,7 @@ CEntity::CEntity(void) bDistanceFade = false; m_flagE1 = false; - m_flagE2 = false; + bDontCastShadowsOn = false; bOffscreen = false; bIsStaticWaitingForCollision = false; bDontStream = false; @@ -200,7 +201,7 @@ CEntity::GetBoundRect(void) { CRect rect; CVector v; - CColModel *col = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); + CColModel *col = CModelInfo::GetColModel(m_modelIndex); rect.ContainPoint(GetMatrix() * col->boundingBox.min); rect.ContainPoint(GetMatrix() * col->boundingBox.max); @@ -219,21 +220,27 @@ CEntity::GetBoundRect(void) CVector CEntity::GetBoundCentre(void) { - CVector v; - GetBoundCentre(v); - return v; + return GetMatrix() * CModelInfo::GetColModel(m_modelIndex)->boundingSphere.center; } +#ifdef GTA_PS2 +void +CEntity::GetBoundCentre(CVuVector &out) +{ + TransformPoint(out, GetMatrix(), CModelInfo::GetColModel(m_modelIndex)->boundingSphere.center); +} +#else void CEntity::GetBoundCentre(CVector &out) { - out = GetMatrix() * CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.center; + out = GetMatrix() * CModelInfo::GetColModel(m_modelIndex)->boundingSphere.center; } +#endif float CEntity::GetBoundRadius(void) { - return CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingSphere.radius; + return CModelInfo::GetColModel(m_modelIndex)->boundingSphere.radius; } void @@ -372,7 +379,7 @@ CEntity::PreRender(void) CVector pos = GetPosition(); CShadows::StoreShadowToBeRendered(SHADOWTYPE_DARK, gpShadowPedTex, &pos, - 0.4f, 0.0f, 0.0f, -0.4f, + 0.4f, 0.0f, 0.0f, 0.4f, CTimeCycle::GetShadowStrength(), CTimeCycle::GetShadowStrength(), CTimeCycle::GetShadowStrength(), @@ -418,9 +425,11 @@ CEntity::Render(void) } bool -CEntity::GetIsTouching(CVector const ¢er, float radius) +CEntity::GetIsTouching(CVUVECTOR const ¢er, float radius) { - return sq(GetBoundRadius()+radius) > (GetBoundCentre()-center).MagnitudeSqr(); + CVUVECTOR boundCenter; + GetBoundCentre(boundCenter); + return sq(GetBoundRadius()+radius) > (boundCenter-center).MagnitudeSqr(); } bool @@ -438,8 +447,7 @@ CEntity::IsVisibleComplex(void) bool CEntity::GetIsOnScreen(void) { - return TheCamera.IsSphereVisible(GetBoundCentre(), GetBoundRadius(), - &TheCamera.GetCameraMatrix()); + return TheCamera.IsSphereVisible(GetBoundCentre(), GetBoundRadius()); } bool @@ -455,7 +463,7 @@ CEntity::GetIsOnScreenComplex(void) return true; CRect rect = GetBoundRect(); - CColModel *colmodel = CModelInfo::GetModelInfo(m_modelIndex)->GetColModel(); + CColModel *colmodel = CModelInfo::GetColModel(m_modelIndex); float z = GetPosition().z; float minz = z + colmodel->boundingBox.min.z; float maxz = z + colmodel->boundingBox.max.z; @@ -610,7 +618,7 @@ CEntity::Remove(void) float CEntity::GetDistanceFromCentreOfMassToBaseOfModel(void) { - return -CModelInfo::GetModelInfo(m_modelIndex)->GetColModel()->boundingBox.min.z; + return -CModelInfo::GetColModel(m_modelIndex)->boundingBox.min.z; } void @@ -731,11 +739,6 @@ CEntity::PreRenderForGlassWindow(void) bIsVisible = false; } -/* -0x487A10 - SetAtomicAlphaCB -0x4879E0 - SetClumpAlphaCB -*/ - RpMaterial* SetAtomicAlphaCB(RpMaterial *material, void *data) { @@ -834,7 +837,7 @@ CEntity::SaveEntityFlags(uint8*& buf) if (bDistanceFade) tmp |= BIT(7); if (m_flagE1) tmp |= BIT(8); - if (m_flagE2) tmp |= BIT(9); + if (bDontCastShadowsOn) tmp |= BIT(9); if (bOffscreen) tmp |= BIT(10); if (bIsStaticWaitingForCollision) tmp |= BIT(11); if (bDontStream) tmp |= BIT(12); @@ -890,7 +893,7 @@ CEntity::LoadEntityFlags(uint8*& buf) bDistanceFade = !!(tmp & BIT(7)); m_flagE1 = !!(tmp & BIT(8)); - m_flagE2 = !!(tmp & BIT(9)); + bDontCastShadowsOn = !!(tmp & BIT(9)); bOffscreen = !!(tmp & BIT(10)); bIsStaticWaitingForCollision = !!(tmp & BIT(11)); bDontStream = !!(tmp & BIT(12)); diff --git a/src/entities/Entity.h b/src/entities/Entity.h index 2749e3f7..957ee3bf 100644 --- a/src/entities/Entity.h +++ b/src/entities/Entity.h @@ -84,7 +84,7 @@ public: // flagsE uint32 m_flagE1 : 1; - uint32 m_flagE2 : 1; + uint32 bDontCastShadowsOn : 1; // Dont cast shadows on this object uint32 bOffscreen : 1; // offscreen flag. This can only be trusted when it is set to true uint32 bIsStaticWaitingForCollision : 1; // this is used by script created entities - they are static until the collision is loaded below them uint32 bDontStream : 1; // tell the streaming not to stream me @@ -148,11 +148,11 @@ public: return (RpClump*)m_rwObject; } - void GetBoundCentre(CVector &out); + void GetBoundCentre(CVUVECTOR &out); CVector GetBoundCentre(void); float GetBoundRadius(void); float GetDistanceFromCentreOfMassToBaseOfModel(void); - bool GetIsTouching(CVector const ¢er, float r); + bool GetIsTouching(CVUVECTOR const ¢er, float r); bool GetIsOnScreen(void); bool GetIsOnScreenComplex(void); bool IsVisible(void); diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp index 03fbad03..86ef0669 100644 --- a/src/entities/Physical.cpp +++ b/src/entities/Physical.cpp @@ -226,7 +226,7 @@ CPhysical::RemoveAndAdd(void) CRect CPhysical::GetBoundRect(void) { - CVector center; + CVUVECTOR center; float radius; GetBoundCentre(center); radius = GetBoundRadius(); @@ -1259,7 +1259,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists) CPhysical *A, *B; CObject *Bobj; bool canshift; - CVector center; + CVUVECTOR center; float radius; int numCollisions; @@ -1418,7 +1418,7 @@ CPhysical::ProcessCollisionSectorList_SimpleCar(CPtrList *lists) { static CColPoint aColPoints[MAX_COLLISION_POINTS]; float radius; - CVector center; + CVUVECTOR center; int listtype; CPhysical *A, *B; int numCollisions; @@ -1585,7 +1585,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists) { static CColPoint aColPoints[MAX_COLLISION_POINTS]; float radius; - CVector center; + CVUVECTOR center; CPtrList *list; CPhysical *A, *B; CObject *Aobj, *Bobj; diff --git a/src/math/VuVector.h b/src/math/VuVector.h index 30d62cfc..41584095 100644 --- a/src/math/VuVector.h +++ b/src/math/VuVector.h @@ -22,6 +22,8 @@ public: x = 1.0f; } */ + + // TODO: operator- }; void TransformPoint(CVuVector &out, const CMatrix &mat, const CVuVector &in); diff --git a/src/modelinfo/ModelInfo.h b/src/modelinfo/ModelInfo.h index 30f4c015..f92a73ad 100644 --- a/src/modelinfo/ModelInfo.h +++ b/src/modelinfo/ModelInfo.h @@ -38,6 +38,9 @@ public: return ms_modelInfoPtrs[id]; } static CBaseModelInfo *GetModelInfo(const char *name, int minIndex, int maxIndex); + static CColModel *GetColModel(int id){ + return ms_modelInfoPtrs[id]->GetColModel(); + } static bool IsBoatModel(int32 id); static bool IsBikeModel(int32 id); diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp index 3d4746d2..6a41b0c1 100644 --- a/src/peds/Population.cpp +++ b/src/peds/Population.cpp @@ -979,27 +979,30 @@ CPopulation::TestSafeForRealObject(CDummyObject *dummy) { CPtrNode *ptrNode; CColModel *dummyCol = dummy->GetColModel(); - float colRadius = dummy->GetBoundRadius(); - CVector colCentre = dummy->GetBoundCentre(); - int minX = CWorld::GetSectorIndexX(dummy->GetPosition().x - colRadius); + float radius = dummyCol->boundingSphere.radius; + int minX = CWorld::GetSectorIndexX(dummy->GetPosition().x - radius); if (minX < 0) minX = 0; - int minY = CWorld::GetSectorIndexY(dummy->GetPosition().y - colRadius); + int minY = CWorld::GetSectorIndexY(dummy->GetPosition().y - radius); if (minY < 0) minY = 0; - int maxX = CWorld::GetSectorIndexX(dummy->GetPosition().x + colRadius); + int maxX = CWorld::GetSectorIndexX(dummy->GetPosition().x + radius); #ifdef FIX_BUGS if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X - 1; #else if (maxX >= NUMSECTORS_X) maxX = NUMSECTORS_X; #endif - int maxY = CWorld::GetSectorIndexY(dummy->GetPosition().y + colRadius); + int maxY = CWorld::GetSectorIndexY(dummy->GetPosition().y + radius); #ifdef FIX_BUGS if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y - 1; #else if (maxY >= NUMSECTORS_Y) maxY = NUMSECTORS_Y; #endif + float colRadius = dummy->GetBoundRadius(); + CVUVECTOR colCentre; + dummy->GetBoundCentre(colCentre); + static CColPoint aTempColPoints[MAX_COLLISION_POINTS]; for (int curY = minY; curY <= maxY; curY++) { diff --git a/src/render/Occlusion.cpp b/src/render/Occlusion.cpp index 3ea5678c..ec7101a6 100644 --- a/src/render/Occlusion.cpp +++ b/src/render/Occlusion.cpp @@ -513,8 +513,8 @@ bool CEntity::IsEntityOccluded(void) { } if (COcclusion::aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) { - CVector min = m_matrix * CModelInfo::GetModelInfo(GetModelIndex())->GetColModel()->boundingBox.min; - CVector max = m_matrix * CModelInfo::GetModelInfo(GetModelIndex())->GetColModel()->boundingBox.max; + CVector min = m_matrix * CModelInfo::GetColModel(m_modelIndex)->boundingBox.min; + CVector max = m_matrix * CModelInfo::GetColModel(m_modelIndex)->boundingBox.max; if (CalcScreenCoors(min, &coors) && !COcclusion::aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) continue; if (CalcScreenCoors(CVector(max.x, max.y, min.z), &coors) && !COcclusion::aActiveOccluders[i].IsPointWithinOcclusionArea(coors.x, coors.y, 0.0f)) continue; diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp index ae079821..dd87bff6 100644 --- a/src/render/Shadows.cpp +++ b/src/render/Shadows.cpp @@ -1406,7 +1406,7 @@ CShadows::CastShadowSectorList(CPtrList &PtrList, float fStartX, float fStartY, { pEntity->m_scanCode = CWorld::GetCurrentScanCode(); - if ( pEntity->bUsesCollision && !pEntity->m_flagE2 ) + if ( pEntity->bUsesCollision && !pEntity->bDontCastShadowsOn) { if ( IsAreaVisible(pEntity->m_area) ) { diff --git a/src/rw/VisibilityPlugins.h b/src/rw/VisibilityPlugins.h index 9cdbc0c7..d375044b 100644 --- a/src/rw/VisibilityPlugins.h +++ b/src/rw/VisibilityPlugins.h @@ -127,7 +127,6 @@ public: int32 offset, int32 len); static int32 ms_framePluginOffset; - // Not actually used struct ClumpExt { ClumpVisibilityCB visibilityCB; -- cgit v1.2.3 From f2c8522daa51f49bffa358914802b0220b6f4604 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 5 Jun 2021 13:00:45 +0300 Subject: Fix IsSphereVisible calls --- src/core/Camera.cpp | 2 +- src/peds/PedAI.cpp | 2 +- src/render/WaterLevel.cpp | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp index baf31f04..d94efb03 100644 --- a/src/core/Camera.cpp +++ b/src/core/Camera.cpp @@ -4101,7 +4101,7 @@ CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat bool CCamera::IsSphereVisible(const CVector ¢er, float radius) { - return IsSphereVisible(center, radius, &m_cameraMatrix); + return IsSphereVisible(center, radius, &GetCameraMatrix()); } bool diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp index d1186723..e204dad9 100644 --- a/src/peds/PedAI.cpp +++ b/src/peds/PedAI.cpp @@ -6401,7 +6401,7 @@ CPed::WarpPedToNearEntityOffScreen(CEntity *warpTo) if (Abs(zCorrectedPos.z - warpToPos.z) < 3.0f || Abs(zCorrectedPos.z - appropriatePos.z) < 3.0f) { appropriatePos.z = zCorrectedPos.z; - if (!TheCamera.IsSphereVisible(appropriatePos, 0.6f, &TheCamera.GetCameraMatrix()) + if (!TheCamera.IsSphereVisible(appropriatePos, 0.6f) && CWorld::GetIsLineOfSightClear(appropriatePos, warpToPos, true, true, false, true, false, false, false) && !CWorld::TestSphereAgainstWorld(appropriatePos, 0.6f, this, true, true, false, true, false, false)) { teleported = true; diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index 0d114db9..8af98d46 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -1014,7 +1014,7 @@ CWaterLevel::RenderWater() if ( fHugeSectorMaxRenderDistSqr > fHugeSectorDistToCamSqr ) { - if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) ) + if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE)) ) { #ifndef PC_WATER WavesCalculatedThisFrame = true; @@ -1088,7 +1088,7 @@ CWaterLevel::RenderWater() if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr ) { - if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) ) + if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE)) ) { RenderOneFlatExtraHugeWaterPoly( vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2, @@ -1107,7 +1107,7 @@ CWaterLevel::RenderWater() if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr ) { - if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) ) + if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE)) ) { RenderOneFlatExtraHugeWaterPoly( vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2, @@ -1136,7 +1136,7 @@ CWaterLevel::RenderWater() if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr ) { - if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) ) + if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.y, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE)) ) { RenderOneFlatExtraHugeWaterPoly( vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2, @@ -1155,7 +1155,7 @@ CWaterLevel::RenderWater() if ( fCamDistToSector < fHugeSectorMaxRenderDistSqr ) { - if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.x, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) ) + if ( TheCamera.IsSphereVisible(CVector(vecExtraHugeSectorCentre.x, vecExtraHugeSectorCentre.x, 0.0f), SectorRadius(EXTRAHUGE_SECTOR_SIZE)) ) { RenderOneFlatExtraHugeWaterPoly( vecExtraHugeSectorCentre.x - EXTRAHUGE_SECTOR_SIZE/2, @@ -1287,7 +1287,7 @@ CWaterLevel::RenderTransparentWater(void) if ( fHugeSectorMaxRenderDistSqr > fHugeSectorDistToCamSqr ) { - if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) ) + if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE))) ) { if ( fHugeSectorDistToCamSqr >= SQR(500.0f) ) { @@ -1311,7 +1311,7 @@ CWaterLevel::RenderTransparentWater(void) if ( fLargeSectorDistToCamSqr < fHugeSectorMaxRenderDistSqr ) { - if ( TheCamera.IsSphereVisible(CVector(vecLargeSectorCentre.x, vecLargeSectorCentre.y, 0.0f), SectorRadius(LARGE_SECTOR_SIZE), &TheCamera.GetCameraMatrix()) ) + if ( TheCamera.IsSphereVisible(CVector(vecLargeSectorCentre.x, vecLargeSectorCentre.y, 0.0f), SectorRadius(LARGE_SECTOR_SIZE)) ) { // Render four small(32x32) sectors, or one large(64x64). @@ -3197,7 +3197,7 @@ CWaterLevel::HandleBeachToysStuff(void) vecPos.x += (fCos - fSin) * fAngle; vecPos.y += (fSin + fCos) * fAngle; - if ( TheCamera.IsSphereVisible(vecPos, 1.0f, &TheCamera.GetCameraMatrix()) ) + if ( TheCamera.IsSphereVisible(vecPos, 1.0f) ) { float fWaterLevel; @@ -3241,7 +3241,7 @@ CWaterLevel::HandleBeachToysStuff(void) vecPos.x += (fCos - fSin) * fAngle; vecPos.y += (fSin + fCos) * fAngle; - if ( TheCamera.IsSphereVisible(vecPos, 2.0f, &TheCamera.GetCameraMatrix()) ) + if ( TheCamera.IsSphereVisible(vecPos, 2.0f) ) { float fWaterLevel; -- cgit v1.2.3 From 6e4a2947ea55fc19ba1ba7f10c08a2ed1d54d135 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 5 Jun 2021 13:03:14 +0300 Subject: Fix sin & cos calls --- src/control/CarCtrl.cpp | 4 ++-- src/control/Script2.cpp | 4 ++-- src/control/Script5.cpp | 8 ++++---- src/core/Cam.cpp | 18 +++++++++--------- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index 8db6fd95..21526d5e 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -1581,8 +1581,8 @@ void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float forward.Normalise(); float forwardAngle = CGeneral::GetATanOfXY(forward.x, forward.y); float angleDiff = angleBetweenVehicles - forwardAngle; - float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * sin(angleDiff)); - float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * cos(angleDiff)); + float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * Sin(angleDiff)); + float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * Cos(angleDiff)); float lengthToEvade = (2 * (lenProjection + widthProjection) + WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x) / distance; float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicles - *pAngleToWeaveLeft); diffToLeftAngle = ABS(diffToLeftAngle); diff --git a/src/control/Script2.cpp b/src/control/Script2.cpp index 656973ca..4e7a1c3e 100644 --- a/src/control/Script2.cpp +++ b/src/control/Script2.cpp @@ -431,8 +431,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command) float length = *(float*)&ScriptParams[5]; float x, y; if (angle != 0.0f){ - y = cos(angle) * length; - x = sin(angle) * length; + y = Cos(angle) * length; + x = Sin(angle) * length; }else{ y = length; x = 0.0f; diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp index 1371f2e6..9d14b1c4 100644 --- a/src/control/Script5.cpp +++ b/src/control/Script5.cpp @@ -1006,10 +1006,10 @@ void CRunningScript::PlayerInAngledAreaCheckCommand(int32 command, uint32* pIp) initAngle -= TWOPI; // it looks like the idea is to use a rectangle using the diagonal of the rectangle as // the side of new rectangle, with "length" being the length of second side - float rotatedSupX = supX + side2length * sin(initAngle); - float rotatedSupY = supY - side2length * cos(initAngle); - float rotatedInfX = infX + side2length * sin(initAngle); - float rotatedInfY = infY - side2length * cos(initAngle); + float rotatedSupX = supX + side2length * Sin(initAngle); + float rotatedSupY = supY - side2length * Cos(initAngle); + float rotatedInfX = infX + side2length * Sin(initAngle); + float rotatedInfY = infY - side2length * Cos(initAngle); float side1X = supX - infX; float side1Y = supY - infY; float side1Length = CVector2D(side1X, side1Y).Magnitude(); diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index fdfe2275..448da46e 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -4952,9 +4952,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, AlphaSpeed = 0.0; Distance = 1000.0; - Front.x = -(cos(Beta) * cos(Alpha)); - Front.y = -(sin(Beta) * cos(Alpha)); - Front.z = sin(Alpha); + Front.x = -(Cos(Beta) * Cos(Alpha)); + Front.y = -(Sin(Beta) * Cos(Alpha)); + Front.z = Sin(Alpha); m_aTargetHistoryPosOne = TargetCoors - nextDistance * Front; @@ -5228,9 +5228,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, lastBeta = Beta; - Front.x = -(cos(Beta) * cos(Alpha)); - Front.y = -(sin(Beta) * cos(Alpha)); - Front.z = sin(Alpha); + Front.x = -(Cos(Beta) * Cos(Alpha)); + Front.y = -(Sin(Beta) * Cos(Alpha)); + Front.z = Sin(Alpha); GetVectorsReadyForRW(); TheCamera.m_bCamDirectlyBehind = false; TheCamera.m_bCamDirectlyInFront = false; @@ -5240,9 +5240,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, m_cvecTargetCoorsForFudgeInter = TargetCoors; m_aTargetHistoryPosThree = m_aTargetHistoryPosOne; float nextAlpha = alphaWithSpeedAccounted + zoomModeAlphaOffset; - float nextFrontX = -(cos(Beta) * cos(nextAlpha)); - float nextFrontY = -(sin(Beta) * cos(nextAlpha)); - float nextFrontZ = sin(nextAlpha); + float nextFrontX = -(Cos(Beta) * Cos(nextAlpha)); + float nextFrontY = -(Sin(Beta) * Cos(nextAlpha)); + float nextFrontZ = Sin(nextAlpha); m_aTargetHistoryPosOne.x = TargetCoors.x - nextFrontX * nextDistance; m_aTargetHistoryPosOne.y = TargetCoors.y - nextFrontY * nextDistance; -- cgit v1.2.3 From fad64667a7b0199786a6c031248ad726fdc9d22d Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 5 Jun 2021 13:13:27 +0300 Subject: Fix some timer calls --- src/core/Cam.cpp | 2 +- src/core/main.cpp | 2 +- src/peds/Ped.cpp | 2 +- src/peds/PlayerPed.cpp | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index 448da46e..ad315029 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -5395,7 +5395,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, float alphaToFace = Atan2(hi.z, hi.Magnitude2D()) + DEGTORAD(15.0f); float neededAlphaTurn = alphaToFace - carGunUD; - float alphaTurnPerFrame = CTimer::GetTimeStep() * 0.02f; + float alphaTurnPerFrame = CTimer::GetTimeStepInSeconds(); if (neededAlphaTurn > alphaTurnPerFrame) { neededTurn = alphaTurnPerFrame; diff --git a/src/core/main.cpp b/src/core/main.cpp index 2221b691..90efdb62 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -1135,7 +1135,7 @@ DisplayGameDebugText() FramesPerSecondCounter += frameTime / 1000.f; // convert to seconds FramesPerSecond = FrameSamples / FramesPerSecondCounter; #else - FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f); + FramesPerSecondCounter += 1000.0f / CTimer::GetTimeStepNonClippedInMilliseconds(); FramesPerSecond = FramesPerSecondCounter / FrameSamples; #endif diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 8ad7027e..919359d4 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -2382,7 +2382,7 @@ CPed::ProcessControl(void) if (m_nPedState == PED_JUMP) { if (m_nWaitTimer <= 2000) { if (m_nWaitTimer < 1000) - m_nWaitTimer += CTimer::GetTimeStep() * 0.02f * 1000.0f; + m_nWaitTimer += CTimer::GetTimeStepInMilliseconds(); } else { m_nWaitTimer = 0; } diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 65180ee5..4ff4e575 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -869,7 +869,7 @@ CPlayerPed::PlayerControl1stPersonRunAround(CPad *padUsed) if (m_nPedState == PED_JUMP) { if (bIsInTheAir) { if (bUsesCollision && !bHitSteepSlope && (!bHitSomethingLastFrame || m_vecDamageNormal.z > 0.6f) - && m_fDistanceTravelled < CTimer::GetTimeStep() * 0.02 && m_vecMoveSpeed.MagnitudeSqr() < 0.01f) { + && m_fDistanceTravelled < CTimer::GetTimeStepInSeconds() && m_vecMoveSpeed.MagnitudeSqr() < 0.01f) { float angleSin = Sin(m_fRotationCur); // originally sin(DEGTORAD(RADTODEG(m_fRotationCur))) o_O float angleCos = Cos(m_fRotationCur); @@ -1483,7 +1483,7 @@ CPlayerPed::PlayerControlZelda(CPad *padUsed) if (m_nPedState == PED_JUMP) { if (bIsInTheAir) { if (bUsesCollision && !bHitSteepSlope && (!bHitSomethingLastFrame || m_vecDamageNormal.z > 0.6f) - && m_fDistanceTravelled < CTimer::GetTimeStep() * 0.02 && m_vecMoveSpeed.MagnitudeSqr() < 0.01f) { + && m_fDistanceTravelled < CTimer::GetTimeStepInSeconds() && m_vecMoveSpeed.MagnitudeSqr() < 0.01f) { float angleSin = Sin(m_fRotationCur); // originally sin(DEGTORAD(RADTODEG(m_fRotationCur))) o_O float angleCos = Cos(m_fRotationCur); -- cgit v1.2.3 From 793e1223de99ebc0c3106fe3840bea8addee4321 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 5 Jun 2021 13:19:39 +0300 Subject: fix --- src/render/WaterLevel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp index 8af98d46..16182137 100644 --- a/src/render/WaterLevel.cpp +++ b/src/render/WaterLevel.cpp @@ -1287,7 +1287,7 @@ CWaterLevel::RenderTransparentWater(void) if ( fHugeSectorMaxRenderDistSqr > fHugeSectorDistToCamSqr ) { - if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE))) ) + if ( TheCamera.IsSphereVisible(CVector(vecHugeSectorCentre.x, vecHugeSectorCentre.y, 0.0f), SectorRadius(HUGE_SECTOR_SIZE)) ) { if ( fHugeSectorDistToCamSqr >= SQR(500.0f) ) { -- cgit v1.2.3 From 23755fdfb434a123ddc9a5b6744c4431ea73489f Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 12 Jun 2021 14:58:49 +0300 Subject: Fix bullet trace sound offset --- src/audio/AudioLogic.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 15454bfe..a1f9d279 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -9038,24 +9038,25 @@ cAudioManager::ProcessFrontEnd() m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; m_sQueueSample.m_nLoopStart = 0; m_sQueueSample.m_nLoopEnd = -1; - m_sQueueSample.m_fDistance = 1.0f; - if (stereo) + if (stereo) { m_sQueueSample.m_nOffset = 0; - else { + m_sQueueSample.m_fDistance = 1.0f; + } else { sample = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i]; if (sample == SOUND_BULLETTRACE_1) { m_sQueueSample.m_nOffset = 20; m_sQueueSample.m_nVolume = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; m_sQueueSample.m_nReleasingVolumeModificator = 10; m_sQueueSample.m_fDistance = 100.0f; - } - if (sample == SOUND_BULLETTRACE_2) { + } else if (sample == SOUND_BULLETTRACE_2) { m_sQueueSample.m_nOffset = 107; m_sQueueSample.m_nVolume = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; m_sQueueSample.m_nReleasingVolumeModificator = 10; m_sQueueSample.m_fDistance = 100.0f; + } else { + m_sQueueSample.m_nOffset = 63; + m_sQueueSample.m_fDistance = 1.0f; } - m_sQueueSample.m_nOffset = 63; } m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_bRequireReflection = FALSE; -- cgit v1.2.3 From 642696380731b2145981258cdcbf5daa5db6770d Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 12 Jun 2021 19:37:55 +0300 Subject: Fix cAudioManager::ProcessCarHeli --- src/audio/AudioLogic.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index a1f9d279..88601f4d 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -3552,6 +3552,17 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) AddSampleToRequestedQueue(); } } + + CVector backPropellerPos; + if (automobile != nil) + automobile->GetComponentWorldPosition(CAR_BOOT, backPropellerPos); + else if (params.m_VehicleType == VEHICLE_TYPE_HELI) +#ifdef FIX_BUGS + backPropellerPos = +#endif + params.m_pVehicle->GetMatrix() * CVector(0.0f, -10.0f, 0.0f); + else + backPropellerPos = m_sQueueSample.m_vecPos; if (params.m_fDistance >= SQR(140.0f)) return; @@ -3756,12 +3767,8 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) vecPosOld = m_sQueueSample.m_vecPos; distanceCalculatedOld = params.m_bDistanceCalculated; distanceOld = params.m_fDistance; - - if (automobile != nil) - automobile->GetComponentWorldPosition(CAR_BOOT, m_sQueueSample.m_vecPos); - else if (params.m_VehicleType == VEHICLE_TYPE_HELI) - m_sQueueSample.m_vecPos = CVector(0.0f, -10.0f, 0.0f); //this is from android, but for real it's not used + m_sQueueSample.m_vecPos = backPropellerPos; params.m_bDistanceCalculated = FALSE; params.m_fDistance = GetDistanceSquared(m_sQueueSample.m_vecPos); if (params.m_fDistance < SQR(27.0f)) { @@ -3770,7 +3777,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) if (m_sQueueSample.m_nVolume) { m_sQueueSample.m_nCounter = 2; m_sQueueSample.m_nSampleIndex = hunterBool ? SFX_HELI_APACHE_3 : SFX_CAR_HELI_REA; - m_sQueueSample.m_nBankIndex = 0; + m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nFrequency = (volumeModifier + 1.0f) * 16000; -- cgit v1.2.3 From 1b5dbc4b411d58c04d867a4f330f06ca3e4ef1cf Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 12 Jun 2021 19:59:28 +0300 Subject: Add macros to set sample loop offsets --- src/audio/AudioCollision.cpp | 8 +- src/audio/AudioLogic.cpp | 275 +++++++++++++++---------------------------- src/audio/AudioManager.cpp | 2 + src/audio/AudioManager.h | 17 +++ src/audio/PolRadio.cpp | 3 +- 5 files changed, 115 insertions(+), 190 deletions(-) diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index be1ee48b..decb73e5 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -172,10 +172,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun m_sQueueSample.m_nReleasingVolumeModificator = 7; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = - SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = - SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -315,8 +312,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col) m_sQueueSample.m_nReleasingVolumeModificator = 11; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; m_sQueueSample.m_bReleasingSoundFlag = TRUE; diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 88601f4d..9c272f36 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -889,8 +889,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params) m_sQueueSample.m_nFrequency = m_anRandomTable[1] % 4000 + 28000; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -942,8 +941,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params) m_sQueueSample.m_nFrequency = (6000.0f * modificator) + 7000; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = reverseGearIntensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1006,8 +1004,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = volume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_RC_REV); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_RC_REV); + SET_LOOP_OFFSETS(SFX_RC_REV) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1071,8 +1068,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = volume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1134,8 +1130,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = 70; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_RC_HELI); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_RC_HELI); + SET_LOOP_OFFSETS(SFX_CAR_RC_HELI) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1201,8 +1196,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1261,8 +1255,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) m_sQueueSample.m_nFrequency = freq + freq * multiplier; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1486,8 +1479,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) m_sQueueSample.m_nFrequency /= 2; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1550,8 +1542,7 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sampl m_sQueueSample.m_nLoopCount = 1; } m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1577,8 +1568,7 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nReleasingVolumeDivider = 8; m_sQueueSample.m_nEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = 200.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -1598,8 +1588,7 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_nEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = 90.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2115,8 +2104,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 8; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2222,8 +2210,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) #else m_sQueueSample.m_nEmittingVolume = 80; #endif - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 5.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2304,8 +2291,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = volume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 7.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2351,8 +2337,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params) #else m_sQueueSample.m_nEmittingVolume = 60; #endif - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2397,8 +2382,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 10; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 1.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -2443,8 +2427,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 10; m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = volume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -2500,8 +2483,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params) m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -2549,8 +2531,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_COUNTDOWN); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3142,8 +3123,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; } - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bReverbFlag = TRUE; if (isHeli) { @@ -3218,8 +3198,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_FAR); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3241,8 +3220,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_TRAIN_NEAR) + 100 * m_sQueueSample.m_nEntityIndex % 987; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3364,8 +3342,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = Vol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = intensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3389,8 +3366,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = 80; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = intensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3437,8 +3413,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params) m_sQueueSample.m_nFrequency = (6050.f * multiplier) + 16000; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = vol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = 50.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3541,8 +3516,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3593,8 +3567,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3619,8 +3592,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3636,8 +3608,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3681,8 +3652,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3715,8 +3685,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3751,8 +3720,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = propellerSpeed * 100.0f; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_SEAPLANE_PRO4); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_SEAPLANE_PRO4); + SET_LOOP_OFFSETS(SFX_SEAPLANE_PRO4) m_sQueueSample.m_fSpeedMultiplier = 5.0f; m_sQueueSample.m_fSoundIntensity = 20.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3783,8 +3751,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) m_sQueueSample.m_nFrequency = (volumeModifier + 1.0f) * 16000; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = volumeModifier * 25.0f; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; m_sQueueSample.m_fSoundIntensity = 27.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -3852,8 +3819,7 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params) m_sQueueSample.m_nFrequency = (5500.0f * modifier) + 8000; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_TYRE_BURST_L); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_TYRE_BURST_L); + SET_LOOP_OFFSETS(SFX_TYRE_BURST_L) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4020,8 +3986,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol) m_sQueueSample.m_nFrequency = GetJumboTaxiFreq(); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4052,8 +4017,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4083,8 +4047,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq) m_sQueueSample.m_nFrequency = freq; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4113,8 +4076,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_DIST_FLY); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4144,8 +4106,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_RUMBLE); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4282,8 +4243,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = 20.0f; m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4310,8 +4270,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_fSoundIntensity = 30.0f; m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4404,9 +4363,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 30.0f; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 26 + 100; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4460,8 +4418,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 30.0f; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[2] % 20 + 100; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4486,8 +4443,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) maxDist = SQR(50); m_sQueueSample.m_nLoopCount = 0; emittingVol = 100; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_CHAINSAW_IDLE); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_CHAINSAW_IDLE); + SET_LOOP_OFFSETS(SFX_CAR_CHAINSAW_IDLE) m_sQueueSample.m_nEmittingVolume = 100; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4510,8 +4466,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 0; emittingVol = 100; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_CHAINSAW_ATTACK); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_CHAINSAW_ATTACK); + SET_LOOP_OFFSETS(SFX_CAR_CHAINSAW_ATTACK) m_sQueueSample.m_nEmittingVolume = 100; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4536,8 +4491,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 0; emittingVol = 100; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_CAR_CHAINSAW_ATTACK); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_CAR_CHAINSAW_ATTACK); + SET_LOOP_OFFSETS(SFX_CAR_CHAINSAW_ATTACK) m_sQueueSample.m_nEmittingVolume = 100; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4561,8 +4515,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[0] % 20 + 80; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4582,8 +4535,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[1] % 10 + 90; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4603,8 +4555,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = 127; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4625,8 +4576,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[2] % 10 + 100; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4646,8 +4596,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[2] % 10 + 100; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4666,9 +4615,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 15 + 70; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4687,9 +4635,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 15 + 70; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4706,9 +4653,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 15 + 70; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4726,9 +4672,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 15 + 70; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4745,9 +4690,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 15 + 90; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4765,9 +4709,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[3] % 15 + 90; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4789,8 +4732,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[4] % 10 + 110; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4809,8 +4751,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 60.0f; maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_nEmittingVolume = 90; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -4830,8 +4771,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = 127; m_sQueueSample.m_nEmittingVolume = 127; m_sQueueSample.m_bIs2D = FALSE; @@ -4889,8 +4829,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 30.0f; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_nEmittingVolume = 75; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -4953,8 +4892,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[4] % 10 + 80; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -4973,8 +4911,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 60.0f; maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = 70; m_sQueueSample.m_nEmittingVolume = 70; m_sQueueSample.m_bIs2D = FALSE; @@ -4992,9 +4929,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 30.0f; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[0] % 20 + 90; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -5013,9 +4949,8 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 40.0f; maxDist = SQR(40); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; + RESET_LOOP_OFFSETS emittingVol = m_anRandomTable[2] % 30 + 70; - m_sQueueSample.m_nLoopEnd = -1; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -5051,8 +4986,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = m_anRandomTable[2] % 20 + 70; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -5077,8 +5011,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 20.0f; maxDist = SQR(20); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = (m_anRandomTable[2] % 20 + 70) * param1 / 127; m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; @@ -5097,8 +5030,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = 127; maxDist = SQR(150); m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_MINIGUN_FIRE_LEFT); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_MINIGUN_FIRE_LEFT); + SET_LOOP_OFFSETS(SFX_MINIGUN_FIRE_LEFT) m_sQueueSample.m_nEmittingVolume = 127; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -5115,8 +5047,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) emittingVol = 127.0f * m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; maxDist = SQR(150); m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_MINIGUN_FIRE_RIGHT); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_MINIGUN_FIRE_RIGHT); + SET_LOOP_OFFSETS(SFX_MINIGUN_FIRE_RIGHT) m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -5132,8 +5063,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 150.0f; maxDist = SQR(150); m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS emittingVol = 127; m_sQueueSample.m_nEmittingVolume = 127; m_sQueueSample.m_bIs2D = FALSE; @@ -5176,8 +5106,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_fSoundIntensity = 15.0f; maxDist = SQR(15); m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_nEmittingVolume = emittingVol; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -7929,8 +7858,10 @@ cPedComments::Process() AudioManager.m_sQueueSample.m_nVolume = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_bVolume; AudioManager.m_sQueueSample.m_fDistance = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_fDistance; AudioManager.m_sQueueSample.m_nLoopCount = 1; +#ifndef GTA_PS2 AudioManager.m_sQueueSample.m_nLoopStart = 0; AudioManager.m_sQueueSample.m_nLoopEnd = -1; +#endif AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f; AudioManager.m_sQueueSample.m_fSoundIntensity = 40.0f; @@ -8053,8 +7984,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; AddSampleToRequestedQueue(); } @@ -8120,8 +8050,7 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); @@ -8144,8 +8073,7 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); @@ -8180,8 +8108,7 @@ cAudioManager::ProcessWaterCannon(int32) m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nEmittingVolume = 50; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); @@ -8219,8 +8146,7 @@ cAudioManager::ProcessExtraSounds() m_sQueueSample.m_nReleasingVolumeModificator = 4; m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_ARCADE); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_ARCADE); + SET_LOOP_OFFSETS(SFX_ARCADE) m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bRequireReflection = FALSE; @@ -8259,8 +8185,7 @@ cAudioManager::ProcessEscalators() m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = EMITTING_VOLUME; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_BOAT_V12_LOOP); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_BOAT_V12_LOOP); + SET_LOOP_OFFSETS(SFX_BOAT_V12_LOOP) m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -8542,8 +8467,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = TRUE; AddSampleToRequestedQueue(); } @@ -8760,8 +8684,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_nEmittingVolume = emittingVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } @@ -8804,8 +8727,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); @@ -8824,8 +8746,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nReleasingVolumeDivider = 30; m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); } @@ -8849,8 +8770,7 @@ cAudioManager::ProcessWeather(int32 id) m_sQueueSample.m_nReleasingVolumeDivider = 7; m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); CObject::fDistToNearestTree = 999999.9f; @@ -9043,8 +8963,7 @@ cAudioManager::ProcessFrontEnd() m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS if (stereo) { m_sQueueSample.m_nOffset = 0; m_sQueueSample.m_fDistance = 1.0f; @@ -9109,8 +9028,7 @@ cAudioManager::ProcessCrane() m_sQueueSample.m_nFrequency = 6000; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = 100; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; m_sQueueSample.m_fSoundIntensity = intensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -9183,8 +9101,7 @@ cAudioManager::ProcessProjectiles() m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = emittingVol; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -9264,8 +9181,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_nEmittingVolume = 90; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReverbFlag = TRUE; @@ -9302,8 +9218,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_nLoopCount = 1; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_nCounter = iSound++; if (iSound < 32) iSound = 32; @@ -9341,8 +9256,7 @@ cAudioManager::ProcessFireHydrant() m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -9400,8 +9314,7 @@ cAudioManager::ProcessBridgeWarning() m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BRIDGE_OPEN_WARNING); m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = 100; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = 450.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -9427,8 +9340,7 @@ cAudioManager::ProcessBridgeMotor() m_sQueueSample.m_nFrequency = 5500; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = bridgeIntensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; @@ -9462,8 +9374,7 @@ cAudioManager::ProcessBridgeOneShots() m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nLoopCount = 1; m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; - m_sQueueSample.m_nLoopStart = 0; - m_sQueueSample.m_nLoopEnd = -1; + RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_fSoundIntensity = bridgeIntensity; m_sQueueSample.m_bReleasingSoundFlag = TRUE; diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index e56d28e1..e2596964 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -1039,8 +1039,10 @@ cAudioManager::ClearActiveSamples() m_asActiveSamples[i].m_bIsProcessed = FALSE; m_asActiveSamples[i].m_bLoopEnded = FALSE; m_asActiveSamples[i].m_nLoopCount = 1; +#ifndef GTA_PS2 m_asActiveSamples[i].m_nLoopStart = 0; m_asActiveSamples[i].m_nLoopEnd = -1; +#endif m_asActiveSamples[i].m_fSpeedMultiplier = 0.0f; m_asActiveSamples[i].m_fSoundIntensity = 200.0f; m_asActiveSamples[i].m_nOffset = 63; diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index d5b3ce15..5494ca41 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -544,6 +544,23 @@ public: #endif }; +/* + Manual loop points are not on PS2 so let's have these macros to avoid massive ifndefs. + Setting these manually was pointless anyway since they never change from sdt values. + What were they thinking? +*/ +#ifndef GTA_PS2 +#define RESET_LOOP_OFFSETS \ + m_sQueueSample.m_nLoopStart = 0; \ + m_sQueueSample.m_nLoopEnd = -1; +#define SET_LOOP_OFFSETS(sample) \ + m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(sample); \ + m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(sample); +#else +#define RESET_LOOP_OFFSETS +#define SET_LOOP_OFFSETS(sample) +#endif + #if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS) static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error"); #endif diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp index 82f44dee..c72c80a9 100644 --- a/src/audio/PolRadio.cpp +++ b/src/audio/PolRadio.cpp @@ -108,8 +108,7 @@ cAudioManager::DoPoliceRadioCrackle() m_sQueueSample.m_nVolume = m_anRandomTable[2] % 20 + 15; m_sQueueSample.m_nLoopCount = 0; m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume; - m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_POLICE_RADIO_CRACKLE); - m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_POLICE_RADIO_CRACKLE); + SET_LOOP_OFFSETS(SFX_POLICE_RADIO_CRACKLE) m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_nOffset = 63; -- cgit v1.2.3 From 2b8ae07ec693d9c20bcbcd5337a9f905278eb422 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 12 Jun 2021 20:04:30 +0300 Subject: forgot --- src/audio/AudioManager.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 5494ca41..2e3aeb6d 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -19,8 +19,10 @@ public: uint8 m_nVolume; float m_fDistance; int32 m_nLoopCount; +#ifndef GTA_PS2 int32 m_nLoopStart; int32 m_nLoopEnd; +#endif uint8 m_nEmittingVolume; float m_fSpeedMultiplier; float m_fSoundIntensity; -- cgit v1.2.3 From 0f0cb40151714cb72688736f96058a4ed60568c8 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 12 Jun 2021 20:10:24 +0300 Subject: Fix use of enum in ped comment banks switch --- src/audio/AudioLogic.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 9c272f36..e4340bdc 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -7892,12 +7892,12 @@ cPedComments::Process() } // Switch bank - if (m_nActiveBank) { - actualUsedBank = SFX_BANK_PED_COMMENTS; - m_nActiveBank = SFX_BANK_0; + if (m_nActiveBank == 0) { + actualUsedBank = 0; + m_nActiveBank = 1; } else { - actualUsedBank = SFX_BANK_0; - m_nActiveBank = SFX_BANK_PED_COMMENTS; + actualUsedBank = 1; + m_nActiveBank = 0; } comment = m_asPedComments[actualUsedBank]; for (uint32 i = 0; i < m_nCommentsInBank[actualUsedBank]; i++) { -- cgit v1.2.3 From 4b8b0a6d74fe90c4d9832efcf3092e14f04b0281 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Sat, 12 Jun 2021 20:12:37 +0300 Subject: Small fix --- src/audio/PolRadio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/audio/PolRadio.cpp b/src/audio/PolRadio.cpp index c72c80a9..30756d94 100644 --- a/src/audio/PolRadio.cpp +++ b/src/audio/PolRadio.cpp @@ -226,7 +226,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel) if (sample == NO_SAMPLE) { if (!processed) cWait = 30; } else { - SampleManager.InitialiseChannel(CHANNEL_POLICE_RADIO, sample, 0); + SampleManager.InitialiseChannel(CHANNEL_POLICE_RADIO, sample, SFX_BANK_0); switch (sample) { case SFX_POLICE_RADIO_MESSAGE_NOISE_1: freq = m_anRandomTable[4] % 2000 + 10025; -- cgit v1.2.3 From fe65f20a30e7d048caa66f8be3db25b5314e4327 Mon Sep 17 00:00:00 2001 From: majestic Date: Tue, 22 Jun 2021 01:36:17 -0700 Subject: forgotten field in CBaseModelInfo::Shutdown --- src/modelinfo/BaseModelInfo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modelinfo/BaseModelInfo.cpp b/src/modelinfo/BaseModelInfo.cpp index 765469b4..709420fd 100644 --- a/src/modelinfo/BaseModelInfo.cpp +++ b/src/modelinfo/BaseModelInfo.cpp @@ -27,6 +27,7 @@ CBaseModelInfo::Shutdown(void) m_2dEffectsID = -1; m_num2dEffects = 0; m_txdSlot = -1; + m_objectId = -1; } void -- cgit v1.2.3 From 5156626582042343e237cf291ae41387a4252f9f Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 24 Jun 2021 02:59:42 +0300 Subject: Make sampman stream functions default to stream 0 + type fixes --- src/audio/MusicManager.cpp | 126 ++++++++++++++++++++++---------------------- src/audio/sampman.h | 20 +++---- src/audio/sampman_miles.cpp | 4 +- src/audio/sampman_null.cpp | 2 +- src/audio/sampman_oal.cpp | 4 +- 5 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index e56bc013..1494334b 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -216,8 +216,8 @@ cMusicManager::Terminate() { if (!IsInitialised()) return; - if (SampleManager.IsStreamPlaying(0)) { - SampleManager.StopStreamedFile(0); + if (SampleManager.IsStreamPlaying()) { + SampleManager.StopStreamedFile(); m_nPlayingTrack = NO_TRACK; } m_bIsInitialised = FALSE; @@ -314,16 +314,16 @@ cMusicManager::ChangeMusicMode(uint8 mode) case MUSICMODE_GAME: m_nUpcomingMusicMode = MUSICMODE_GAME; break; case MUSICMODE_CUTSCENE: m_nUpcomingMusicMode = MUSICMODE_CUTSCENE; - if (SampleManager.IsStreamPlaying(0)) { + if (SampleManager.IsStreamPlaying()) { if (m_nPlayingTrack != NO_TRACK) { RecordRadioStats(); - m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0); + m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(); m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); } } - SampleManager.StopStreamedFile(0); - while (SampleManager.IsStreamPlaying(0)) - SampleManager.StopStreamedFile(0); + SampleManager.StopStreamedFile(); + while (SampleManager.IsStreamPlaying()) + SampleManager.StopStreamedFile(); m_nMusicMode = m_nUpcomingMusicMode; m_bMusicModeChangeStarted = FALSE; m_bTrackChangeStarted = FALSE; @@ -369,7 +369,7 @@ cMusicManager::Service() { case MUSICMODE_FRONTEND: ServiceFrontEndMode(); break; case MUSICMODE_GAME: ServiceGameMode(); break; - case MUSICMODE_CUTSCENE: SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 0); break; + case MUSICMODE_CUTSCENE: SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE); break; } } else @@ -382,15 +382,15 @@ cMusicManager::Service() gNumRetunePresses = 0; gRetuneCounter = 0; m_bSetNextStation = FALSE; - if (SampleManager.IsStreamPlaying(0)) { + if (SampleManager.IsStreamPlaying()) { if (m_nPlayingTrack != NO_TRACK && !bRadioStatsRecorded) { RecordRadioStats(); - m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0); + m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(); m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); bRadioStatsRecorded = TRUE; } - SampleManager.StopStreamedFile(0); + SampleManager.StopStreamedFile(); } else { bRadioStatsRecorded = FALSE; m_nMusicMode = m_nMusicModeToBeSet; @@ -415,8 +415,8 @@ cMusicManager::ServiceFrontEndMode() static bool8 bRadioStatsRecorded = FALSE; if (m_bAnnouncementInProgress) { - SampleManager.StopStreamedFile(0); - if (SampleManager.IsStreamPlaying(0)) + SampleManager.StopStreamedFile(); + if (SampleManager.IsStreamPlaying()) return; g_bAnnouncementReadPosAlready = FALSE; m_nAnnouncement = NO_TRACK; @@ -434,36 +434,36 @@ cMusicManager::ServiceFrontEndMode() } if (m_nNextTrack == m_nPlayingTrack) { - if (SampleManager.IsStreamPlaying(0)) { + if (SampleManager.IsStreamPlaying()) { if (m_nVolumeLatency > 0) m_nVolumeLatency--; else { if (m_nCurrentVolume < m_nMaxVolume) m_nCurrentVolume = Min(m_nMaxVolume, m_nCurrentVolume + 6); - SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE, 0); + SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE); } } else { if (m_nPlayingTrack == STREAMED_SOUND_RADIO_MP3_PLAYER) - SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0, 0); + SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0); else if (m_nPlayingTrack == STREAMED_SOUND_MISSION_COMPLETED && AudioManager.m_nUserPause == 0) ChangeMusicMode(MUSICMODE_GAME); } } else { m_bTrackChangeStarted = TRUE; - if (m_bVerifyNextTrackStartedToPlay || !SampleManager.IsStreamPlaying(0)) { + if (m_bVerifyNextTrackStartedToPlay || !SampleManager.IsStreamPlaying()) { bRadioStatsRecorded = FALSE; - if (SampleManager.IsStreamPlaying(0) || m_nNextTrack == NO_TRACK) { + if (SampleManager.IsStreamPlaying() || m_nNextTrack == NO_TRACK) { m_nPlayingTrack = m_nNextTrack; m_bVerifyNextTrackStartedToPlay = FALSE; m_bTrackChangeStarted = FALSE; } else { uint32 trackStartPos = (m_nNextTrack > STREAMED_SOUND_RADIO_POLICE) ? 0 : GetTrackStartPos(m_nNextTrack); if (m_nNextTrack != NO_TRACK) { - SampleManager.SetStreamedFileLoopFlag(m_nNextLoopFlag, 0); - SampleManager.StartStreamedFile(m_nNextTrack, trackStartPos, 0); + SampleManager.SetStreamedFileLoopFlag(m_nNextLoopFlag); + SampleManager.StartStreamedFile(m_nNextTrack, trackStartPos); m_nVolumeLatency = 3; m_nCurrentVolume = 0; m_nMaxVolume = 100; - SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE, 0); + SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE); if (m_nNextTrack < STREAMED_SOUND_CITY_AMBIENT) m_nLastTrackServiceTime = CTimer::GetTimeInMillisecondsPauseMode(); m_bVerifyNextTrackStartedToPlay = TRUE; @@ -471,13 +471,13 @@ cMusicManager::ServiceFrontEndMode() } } else { if (m_nPlayingTrack != NO_TRACK && !bRadioStatsRecorded) { - m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0); + m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(); m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); RecordRadioStats(); bRadioStatsRecorded = TRUE; } - SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE, 0); - SampleManager.StopStreamedFile(0); + SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE); + SampleManager.StopStreamedFile(); } } } @@ -622,9 +622,9 @@ cMusicManager::ServiceGameMode() if (!m_bAnnouncementInProgress && m_nAnnouncement == NO_TRACK && m_nPlayingTrack == STREAMED_SOUND_RADIO_MP3_PLAYER - && !SampleManager.IsStreamPlaying(0)) + && !SampleManager.IsStreamPlaying()) { - SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0, 0); + SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0); } if (!m_bRadioSetByScript) @@ -725,8 +725,8 @@ cMusicManager::ServiceGameMode() if (m_bAnnouncementInProgress) { - SampleManager.StopStreamedFile(0); - if (SampleManager.IsStreamPlaying(0)) + SampleManager.StopStreamedFile(); + if (SampleManager.IsStreamPlaying()) return; g_bAnnouncementReadPosAlready = FALSE; m_nAnnouncement = NO_TRACK; @@ -872,7 +872,7 @@ bool8 cMusicManager::ServiceAnnouncement() { if (m_bAnnouncementInProgress) { - if (SampleManager.IsStreamPlaying(0)) + if (SampleManager.IsStreamPlaying()) m_nPlayingTrack = m_nNextTrack; else if (m_nPlayingTrack != NO_TRACK) { m_nAnnouncement = NO_TRACK; @@ -880,21 +880,21 @@ cMusicManager::ServiceAnnouncement() m_nPlayingTrack = NO_TRACK; } return TRUE; - } else if (SampleManager.IsStreamPlaying(0)) { + } else if (SampleManager.IsStreamPlaying()) { if (m_nPlayingTrack != NO_TRACK && !g_bAnnouncementReadPosAlready) { RecordRadioStats(); - m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0); + m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(); g_bAnnouncementReadPosAlready = TRUE; m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); } - SampleManager.StopStreamedFile(0); + SampleManager.StopStreamedFile(); } else { g_bAnnouncementReadPosAlready = FALSE; m_nPlayingTrack = NO_TRACK; m_nNextTrack = m_nAnnouncement; - SampleManager.SetStreamedFileLoopFlag(0, 0); - SampleManager.StartStreamedFile(m_nNextTrack, 0, 0); - SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, FALSE, 0); + SampleManager.SetStreamedFileLoopFlag(FALSE); + SampleManager.StartStreamedFile(m_nNextTrack, 0); + SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, FALSE); m_bAnnouncementInProgress = TRUE; } @@ -910,15 +910,15 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) if (!m_bTrackChangeStarted) m_nNextTrack = m_nFrontendTrack; if (gRetuneCounter != 0 || m_bSetNextStation) { - if (SampleManager.IsStreamPlaying(0)) { + if (SampleManager.IsStreamPlaying()) { if (m_nPlayingTrack != NO_TRACK && !bRadioStatsRecorded) { - m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0); + m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(); m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); RecordRadioStats(); bRadioStatsRecorded = TRUE; } - SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE, 0); - SampleManager.StopStreamedFile(0); + SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE); + SampleManager.StopStreamedFile(); } return; } @@ -931,11 +931,11 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) if (m_nNextTrack != m_nPlayingTrack) { m_bTrackChangeStarted = TRUE; - SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE, 0); + SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE); if (!(AudioManager.m_FrameCounter & 1)) { - if (m_bVerifyNextTrackStartedToPlay || !SampleManager.IsStreamPlaying(0)) { + if (m_bVerifyNextTrackStartedToPlay || !SampleManager.IsStreamPlaying()) { bRadioStatsRecorded2 = FALSE; - if (SampleManager.IsStreamPlaying(0)) { + if (SampleManager.IsStreamPlaying()) { m_nPlayingTrack = m_nNextTrack; m_bVerifyNextTrackStartedToPlay = FALSE; m_bTrackChangeStarted = FALSE; @@ -955,19 +955,19 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) } else { uint32 pos = GetTrackStartPos(m_nNextTrack); if (m_nNextTrack != NO_TRACK) { - SampleManager.SetStreamedFileLoopFlag(1, 0); - SampleManager.StartStreamedFile(m_nNextTrack, pos, 0); + SampleManager.SetStreamedFileLoopFlag(TRUE); + SampleManager.StartStreamedFile(m_nNextTrack, pos); if (m_nFrontendTrack < STREAMED_SOUND_CITY_AMBIENT || m_nFrontendTrack > STREAMED_SOUND_AMBSIL_AMBIENT) { m_nVolumeLatency = 10; m_nCurrentVolume = 0; m_nMaxVolume = 100; - SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE, 0); + SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE); } else { ComputeAmbienceVol(TRUE, volume); - SampleManager.SetStreamedVolumeAndPan(volume, 63, TRUE, 0); + SampleManager.SetStreamedVolumeAndPan(volume, 63, TRUE); } if (m_nNextTrack < STREAMED_SOUND_CITY_AMBIENT) m_nLastTrackServiceTime = CTimer::GetTimeInMillisecondsPauseMode(); @@ -979,7 +979,7 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) debug("m_nPlayingTrack == NO_TRACK, yet track playing - tidying up\n"); else if (!bRadioStatsRecorded2) { - m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(0); + m_aTracks[m_nPlayingTrack].m_nPosition = SampleManager.GetStreamedFilePosition(); m_aTracks[m_nPlayingTrack].m_nLastPosCheckTimer = CTimer::GetTimeInMillisecondsPauseMode(); bRadioStatsRecorded2 = TRUE; RecordRadioStats(); @@ -989,8 +989,8 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) AudioManager.PlayOneShot(AudioManager.m_nFrontEndEntity, SOUND_FRONTEND_HURRICANE, 0.0); } } - SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE, 0); - SampleManager.StopStreamedFile(0); + SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE); + SampleManager.StopStreamedFile(); } } return; @@ -999,7 +999,7 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) if (m_nPlayingTrack >= STREAMED_SOUND_CITY_AMBIENT && m_nPlayingTrack <= STREAMED_SOUND_AMBSIL_AMBIENT) { ComputeAmbienceVol(FALSE, volume); - SampleManager.SetStreamedVolumeAndPan(volume, 63, TRUE, 0); + SampleManager.SetStreamedVolumeAndPan(volume, 63, TRUE); return; } if (CTimer::GetIsSlowMotionActive()) @@ -1009,7 +1009,7 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) float DistToTargetSq = (TheCamera.pTargetEntity->GetPosition() - TheCamera.GetPosition()).MagnitudeSqr(); if (DistToTargetSq >= SQR(55.0f)) { - SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE, 0); + SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE); } else if (DistToTargetSq >= SQR(10.0f)) { @@ -1026,17 +1026,17 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) } if (gRetuneCounter != 0) volume = 0; - SampleManager.SetStreamedVolumeAndPan(volume, pan, FALSE, 0); + SampleManager.SetStreamedVolumeAndPan(volume, pan, FALSE); } else if (AudioManager.ShouldDuckMissionAudio(0) || AudioManager.ShouldDuckMissionAudio(1)) - SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE, 0); + SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE); else if (gRetuneCounter != 0) - SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE, 0); + SampleManager.SetStreamedVolumeAndPan(0, 63, FALSE); else - SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE, 0); + SampleManager.SetStreamedVolumeAndPan(m_nCurrentVolume, 63, FALSE); } } else if (AudioManager.ShouldDuckMissionAudio(0) || AudioManager.ShouldDuckMissionAudio(1)) { - SampleManager.SetStreamedVolumeAndPan(Min(m_nCurrentVolume, 25), 63, FALSE, 0); + SampleManager.SetStreamedVolumeAndPan(Min(m_nCurrentVolume, 25), 63, FALSE); nFramesSinceCutsceneEnded = 0; } else { if (nFramesSinceCutsceneEnded == -1) @@ -1058,7 +1058,7 @@ cMusicManager::ServiceTrack(CVehicle *veh, CPed *ped) } if (gRetuneCounter != 0) volume = 0; - SampleManager.SetStreamedVolumeAndPan(volume, 63, FALSE, 0); + SampleManager.SetStreamedVolumeAndPan(volume, 63, FALSE); } if (m_nVolumeLatency > 0) m_nVolumeLatency--; @@ -1071,10 +1071,10 @@ cMusicManager::PreloadCutSceneMusic(uint32 track) { if (IsInitialised() && !m_bDisabled && track < TOTAL_STREAMED_SOUNDS && m_nMusicMode == MUSICMODE_CUTSCENE) { AudioManager.ResetPoliceRadio(); - while (SampleManager.IsStreamPlaying(0)) - SampleManager.StopStreamedFile(0); - SampleManager.PreloadStreamedFile(track, 0); - SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 0); + while (SampleManager.IsStreamPlaying()) + SampleManager.StopStreamedFile(); + SampleManager.PreloadStreamedFile(track); + SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE); m_nPlayingTrack = track; } } @@ -1083,14 +1083,14 @@ void cMusicManager::PlayPreloadedCutSceneMusic(void) { if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_CUTSCENE) - SampleManager.StartPreloadedStreamedFile(0); + SampleManager.StartPreloadedStreamedFile(); } void cMusicManager::StopCutSceneMusic(void) { if (IsInitialised() && !m_bDisabled && m_nMusicMode == MUSICMODE_CUTSCENE) { - SampleManager.StopStreamedFile(0); + SampleManager.StopStreamedFile(); m_nPlayingTrack = NO_TRACK; } } diff --git a/src/audio/sampman.h b/src/audio/sampman.h index d6fc5cc0..8243f342 100644 --- a/src/audio/sampman.h +++ b/src/audio/sampman.h @@ -224,22 +224,22 @@ public: void StartChannel (uint32 nChannel); void StopChannel (uint32 nChannel); - void PreloadStreamedFile (uint32 nFile, uint8 nStream); - void PauseStream (bool8 nPauseFlag, uint8 nStream); - void StartPreloadedStreamedFile (uint8 nStream); - bool8 StartStreamedFile (uint32 nFile, uint32 nPos, uint8 nStream); - void StopStreamedFile (uint8 nStream); - int32 GetStreamedFilePosition (uint8 nStream); - void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, bool8 nEffectFlag, uint8 nStream); - int32 GetStreamedFileLength (uint8 nStream); - bool8 IsStreamPlaying (uint8 nStream); + void PreloadStreamedFile (uint32 nFile, uint8 nStream = 0); + void PauseStream (bool8 nPauseFlag, uint8 nStream = 0); + void StartPreloadedStreamedFile (uint8 nStream = 0); + bool8 StartStreamedFile (uint32 nFile, uint32 nPos, uint8 nStream = 0); + void StopStreamedFile (uint8 nStream = 0); + int32 GetStreamedFilePosition (uint8 nStream = 0); + void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, bool8 nEffectFlag, uint8 nStream = 0); + int32 GetStreamedFileLength (uint8 nStream = 0); + bool8 IsStreamPlaying (uint8 nStream = 0); + void SetStreamedFileLoopFlag (bool8 nLoopFlag, uint8 nStream = 0); #ifdef AUDIO_OAL void Service(void); #endif bool8 InitialiseSampleBanks(void); uint8 GetMusicVolume() const { return m_nMusicVolume; } - void SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nStream); }; extern cSampleManager SampleManager; diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index 558be334..8191cbf7 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -60,7 +60,7 @@ char _mp3DirectoryPath[MAX_PATH]; HSTREAM mp3Stream [MAX_STREAMS]; int8 nStreamPan [MAX_STREAMS]; int8 nStreamVolume[MAX_STREAMS]; -uint8 nStreamLoopedFlag[MAX_STREAMS]; +bool8 nStreamLoopedFlag[MAX_STREAMS]; uint32 _CurMP3Index; int32 _CurMP3Pos; bool8 _bIsMp3Active; @@ -2371,7 +2371,7 @@ cSampleManager::InitialiseSampleBanks(void) void -cSampleManager::SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nChannel) +cSampleManager::SetStreamedFileLoopFlag(bool8 nLoopFlag, uint8 nChannel) { if (m_bInitialised) nStreamLoopedFlag[nChannel] = nLoopFlag; diff --git a/src/audio/sampman_null.cpp b/src/audio/sampman_null.cpp index 3352ae02..a5ed2889 100644 --- a/src/audio/sampman_null.cpp +++ b/src/audio/sampman_null.cpp @@ -371,7 +371,7 @@ cSampleManager::InitialiseSampleBanks(void) } void -cSampleManager::SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nChannel) +cSampleManager::SetStreamedFileLoopFlag(bool8 nLoopFlag, uint8 nChannel) { } diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index a4c92482..4d44e27c 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -118,7 +118,7 @@ char _mp3DirectoryPath[MAX_PATH]; CStream *aStream[MAX_STREAMS]; uint8 nStreamPan [MAX_STREAMS]; uint8 nStreamVolume[MAX_STREAMS]; -uint8 nStreamLoopedFlag[MAX_STREAMS]; +bool8 nStreamLoopedFlag[MAX_STREAMS]; uint32 _CurMP3Index; int32 _CurMP3Pos; bool8 _bIsMp3Active; @@ -2063,7 +2063,7 @@ cSampleManager::InitialiseSampleBanks(void) } void -cSampleManager::SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nChannel) +cSampleManager::SetStreamedFileLoopFlag(bool8 nLoopFlag, uint8 nChannel) { nStreamLoopedFlag[nChannel] = nLoopFlag; } -- cgit v1.2.3 From b8cf8c53e7d7ff8133906684583536d9015ae803 Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Thu, 24 Jun 2021 14:15:18 +0300 Subject: Don't restart OAL device when switching EAX --- src/audio/oal/aldlist.cpp | 26 +--- src/audio/oal/aldlist.h | 15 ++- src/audio/sampman_oal.cpp | 302 +++++++++++++++++++++++----------------------- 3 files changed, 174 insertions(+), 169 deletions(-) diff --git a/src/audio/oal/aldlist.cpp b/src/audio/oal/aldlist.cpp index 881418c1..6024adf2 100644 --- a/src/audio/oal/aldlist.cpp +++ b/src/audio/oal/aldlist.cpp @@ -24,12 +24,6 @@ #include "aldlist.h" -#ifndef _WIN32 -#define _stricmp strcasecmp -#define _strnicmp strncasecmp -#define _strdup strdup -#endif - #ifdef AUDIO_OAL /* * Init call @@ -47,8 +41,8 @@ ALDeviceList::ALDeviceList() defaultDeviceIndex = 0; if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) { - devices = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER); - defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); + devices = (char *)alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); + defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); index = 0; // go through device list (each device terminated with a single NULL, list terminated with double NULL) @@ -62,17 +56,11 @@ ALDeviceList::ALDeviceList() if (context) { alcMakeContextCurrent(context); // if new actual device name isn't already in the list, then add it... - actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER); - bool bNewName = true; - for (unsigned int i = 0; i < GetNumDevices(); i++) { - if (strcmp(GetDeviceName(i), actualDeviceName) == 0) { - bNewName = false; - } - } - if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) { - ALDEVICEINFO ALDeviceInfo; + actualDeviceName = alcGetString(device, ALC_ALL_DEVICES_SPECIFIER); + if ((actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) { + ALDEVICEINFO &ALDeviceInfo = aDeviceInfo[nNumOfDevices++]; ALDeviceInfo.bSelected = true; - ALDeviceInfo.strDeviceName = _strdup(actualDeviceName); + ALDeviceInfo.SetName(actualDeviceName); alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion); alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion); @@ -105,8 +93,6 @@ ALDeviceList::ALDeviceList() // Get Source Count ALDeviceInfo.uiSourceCount = GetMaxNumSources(); - - aDeviceInfo[nNumOfDevices++] = ALDeviceInfo; } alcMakeContextCurrent(NULL); alcDestroyContext(context); diff --git a/src/audio/oal/aldlist.h b/src/audio/oal/aldlist.h index 417bd314..bebb6791 100644 --- a/src/audio/oal/aldlist.h +++ b/src/audio/oal/aldlist.h @@ -21,7 +21,7 @@ enum }; struct ALDEVICEINFO { - const char *strDeviceName; + char *strDeviceName; int iMajorVersion; int iMinorVersion; unsigned int uiSourceCount; @@ -33,6 +33,19 @@ struct ALDEVICEINFO { strDeviceName = NULL; Extensions = 0; } + + ~ALDEVICEINFO() + { + delete[] strDeviceName; + strDeviceName = NULL; + } + + void SetName(const char *name) + { + if(strDeviceName) delete[] strDeviceName; + strDeviceName = new char[strlen(name) + 1]; + strcpy(strDeviceName, name); + } }; typedef ALDEVICEINFO *LPALDEVICEINFO; diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 4d44e27c..440e0927 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -45,7 +45,6 @@ #endif //TODO: fix eax3 reverb -//TODO: max channels cSampleManager SampleManager; bool8 _bSampmanInitialised = FALSE; @@ -60,16 +59,18 @@ int usingEAX3=0; ALCdevice *ALDevice = NULL; ALCcontext *ALContext = NULL; unsigned int _maxSamples; -float _fPrevEaxRatioDestination; +float _fPrevEaxRatioDestination; +bool _effectsSupported = false; bool _usingEFX; float _fEffectsLevel; ALuint ALEffect = AL_EFFECT_NULL; ALuint ALEffectSlot = AL_EFFECTSLOT_NULL; struct -{ - char id[256]; +{ + const char *id; char name[256]; int sources; + bool bSupportsFx; }providers[MAXPROVIDERS]; int defaultProvider; @@ -135,7 +136,7 @@ EAXLISTENERPROPERTIES EAX3Params; bool IsFXSupported() { - return usingEAX || usingEAX3 || _usingEFX; + return _effectsSupported; // usingEAX || usingEAX3 || _usingEFX; } void EAX_SetAll(const EAXLISTENERPROPERTIES *allparameters) @@ -150,21 +151,22 @@ static void add_providers() { SampleManager.SetNum3DProvidersAvailable(0); - - ALDeviceList *pDeviceList = NULL; - pDeviceList = new ALDeviceList(); + + static ALDeviceList DeviceList; + ALDeviceList *pDeviceList = &DeviceList; if ((pDeviceList) && (pDeviceList->GetNumDevices())) { const int devNumber = Min(pDeviceList->GetNumDevices(), MAXPROVIDERS); int n = 0; - for (int i = 0; i < devNumber; i++) + //for (int i = 0; i < devNumber; i++) + int i = pDeviceList->GetDefaultDevice(); { if ( n < MAXPROVIDERS ) - { - strcpy(providers[n].id, pDeviceList->GetDeviceName(i)); - strncpy(providers[n].name, pDeviceList->GetDeviceName(i), sizeof(providers[n].name)); + { + providers[n].id = pDeviceList->GetDeviceName(i); + strcpy(providers[n].name, "OPENAL SOFT"); providers[n].sources = pDeviceList->GetMaxNumSources(i); SampleManager.Set3DProviderName(n, providers[n].name); n++; @@ -175,23 +177,24 @@ add_providers() || pDeviceList->IsExtensionSupported(i, ADEXT_EAX3) || pDeviceList->IsExtensionSupported(i, ADEXT_EAX4) || pDeviceList->IsExtensionSupported(i, ADEXT_EAX5) ) - { + { + providers[n - 1].bSupportsFx = true; if ( n < MAXPROVIDERS ) - { - strcpy(providers[n].id, pDeviceList->GetDeviceName(i)); - strncpy(providers[n].name, pDeviceList->GetDeviceName(i), sizeof(providers[n].name)); - strcat(providers[n].name, " EAX"); + { + providers[n].id = pDeviceList->GetDeviceName(i); + strcpy(providers[n].name, "OPENAL SOFT EAX"); providers[n].sources = pDeviceList->GetMaxNumSources(i); + providers[n].bSupportsFx = true; SampleManager.Set3DProviderName(n, providers[n].name); n++; } if ( n < MAXPROVIDERS ) - { - strcpy(providers[n].id, pDeviceList->GetDeviceName(i)); - strncpy(providers[n].name, pDeviceList->GetDeviceName(i), sizeof(providers[n].name)); - strcat(providers[n].name, " EAX3"); + { + providers[n].id = pDeviceList->GetDeviceName(i); + strcpy(providers[n].name, "OPENAL SOFT EAX3"); providers[n].sources = pDeviceList->GetMaxNumSources(i); + providers[n].bSupportsFx = true; SampleManager.Set3DProviderName(n, providers[n].name); n++; } @@ -201,67 +204,30 @@ add_providers() for(int j=n;jGetDefaultDevice(); - if ( defaultProvider > MAXPROVIDERS ) - defaultProvider = 0; + + // devices are gone now + //defaultProvider = pDeviceList->GetDefaultDevice(); + //if ( defaultProvider > MAXPROVIDERS ) + defaultProvider = 0; } - - delete pDeviceList; } static void release_existing() { - for ( int32 i = 0; i < NUM_CHANNELS; i++ ) - aChannel[i].Term(); - if ( IsFXSupported() ) { if ( alIsEffect(ALEffect) ) { alEffecti(ALEffect, AL_EFFECT_TYPE, AL_EFFECT_NULL); - alDeleteEffects(1, &ALEffect); - ALEffect = AL_EFFECT_NULL; } if (alIsAuxiliaryEffectSlot(ALEffectSlot)) { alAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, AL_EFFECT_NULL); - - alDeleteAuxiliaryEffectSlots(1, &ALEffectSlot); - ALEffectSlot = AL_EFFECTSLOT_NULL; } } - - for ( int32 i = 0; i < MAX_STREAMS; i++ ) - { - CStream *stream = aStream[i]; - if (stream) - stream->ProviderTerm(); - - alDeleteBuffers(NUM_STREAMBUFFERS, ALStreamBuffers[i]); - } - alDeleteSources(MAX_STREAMS*2, ALStreamSources[0]); - - CChannel::DestroyChannels(); - - if ( ALContext ) - { - alcMakeContextCurrent(NULL); - alcSuspendContext(ALContext); - alcDestroyContext(ALContext); - } - if ( ALDevice ) - alcCloseDevice(ALDevice); - - ALDevice = NULL; - ALContext = NULL; - - _fPrevEaxRatioDestination = 0.0f; - _usingEFX = false; - _fEffectsLevel = 0.0f; - + DEV("release_existing()\n"); } @@ -279,62 +245,6 @@ set_new_provider(int index) { DEV("set_new_provider()\n"); - //TODO: - _maxSamples = MAXCHANNELS; - - ALCint attr[] = {ALC_FREQUENCY,MAX_FREQ, - ALC_MONO_SOURCES, MAX_DIGITAL_MIXER_CHANNELS - MAX2DCHANNELS, - ALC_STEREO_SOURCES, MAX2DCHANNELS, - 0, - }; - - ALDevice = alcOpenDevice(providers[index].id); - ASSERT(ALDevice != NULL); - - ALContext = alcCreateContext(ALDevice, attr); - ASSERT(ALContext != NULL); - - alcMakeContextCurrent(ALContext); - - const char* ext=(const char*)alGetString(AL_EXTENSIONS); - ASSERT(strstr(ext,"AL_SOFT_loop_points")!=NULL); - if ( strstr(ext,"AL_SOFT_loop_points")==NULL ) - { - curprovider=-1; - release_existing(); - return FALSE; - } - - alListenerf (AL_GAIN, 1.0f); - alListener3f(AL_POSITION, 0.0f, 0.0f, 0.0f); - alListener3f(AL_VELOCITY, 0.0f, 0.0f, 0.0f); - ALfloat orientation[6] = { 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f }; - alListenerfv(AL_ORIENTATION, orientation); - - alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); - - if ( alcIsExtensionPresent(ALDevice, (ALCchar*)ALC_EXT_EFX_NAME) ) - { - alGenAuxiliaryEffectSlots(1, &ALEffectSlot); - alGenEffects(1, &ALEffect); - } - - alGenSources(MAX_STREAMS*2, ALStreamSources[0]); - for ( int32 i = 0; i < MAX_STREAMS; i++ ) - { - alGenBuffers(NUM_STREAMBUFFERS, ALStreamBuffers[i]); - alSourcei(ALStreamSources[i][0], AL_SOURCE_RELATIVE, AL_TRUE); - alSource3f(ALStreamSources[i][0], AL_POSITION, 0.0f, 0.0f, 0.0f); - alSourcef(ALStreamSources[i][0], AL_GAIN, 1.0f); - alSourcei(ALStreamSources[i][1], AL_SOURCE_RELATIVE, AL_TRUE); - alSource3f(ALStreamSources[i][1], AL_POSITION, 0.0f, 0.0f, 0.0f); - alSourcef(ALStreamSources[i][1], AL_GAIN, 1.0f); - - CStream *stream = aStream[i]; - if (stream) - stream->ProviderInit(); - } - usingEAX = 0; usingEAX3 = 0; _usingEFX = false; @@ -342,16 +252,16 @@ set_new_provider(int index) if ( !strcmp(&providers[index].name[strlen(providers[index].name) - strlen(" EAX3")], " EAX3") && alcIsExtensionPresent(ALDevice, (ALCchar*)ALC_EXT_EFX_NAME) ) { - EAX_SetAll(&FinishEAX3); usingEAX = 1; usingEAX3 = 1; + alAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, ALEffect); + EAX_SetAll(&FinishEAX3); DEV("EAX3\n"); } else if ( alcIsExtensionPresent(ALDevice, (ALCchar*)ALC_EXT_EFX_NAME) ) { - EAX_SetAll(&EAX30_ORIGINAL_PRESETS[EAX_ENVIRONMENT_CAVE]); if ( !strcmp(&providers[index].name[strlen(providers[index].name) - strlen(" EAX")], " EAX")) { @@ -363,23 +273,14 @@ set_new_provider(int index) _usingEFX = true; DEV("EFX\n"); } + alAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, ALEffect); + EAX_SetAll(&EAX30_ORIGINAL_PRESETS[EAX_ENVIRONMENT_CAVE]); } //SampleManager.SetSpeakerConfig(speaker_type); - CChannel::InitChannels(); - - for ( int32 i = 0; i < MAXCHANNELS; i++ ) - aChannel[i].Init(i); - for ( int32 i = 0; i < MAX2DCHANNELS; i++ ) - aChannel[MAXCHANNELS+i].Init(MAXCHANNELS+i, true); - if ( IsFXSupported() ) { - /**/ - alAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, ALEffect); - /**/ - for ( int32 i = 0; i < MAXCHANNELS; i++ ) aChannel[i].SetReverbMix(ALEffectSlot, 0.0f); } @@ -895,21 +796,12 @@ cSampleManager::IsMP3RadioChannelAvailable(void) void cSampleManager::ReleaseDigitalHandle(void) { - if ( ALDevice ) - { - prevprovider = curprovider; - release_existing(); - curprovider = -1; - } + // TODO? alcSuspendContext } void cSampleManager::ReacquireDigitalHandle(void) { - if ( ALDevice ) - { - if ( prevprovider != -1 ) - set_new_provider(prevprovider); - } + // TODO? alcProcessContext } bool8 @@ -926,7 +818,7 @@ cSampleManager::Initialise(void) { m_aSamples[i].nOffset = 0; m_aSamples[i].nSize = 0; - m_aSamples[i].nFrequency = MAX_FREQ; + m_aSamples[i].nFrequency = 22050; m_aSamples[i].nLoopStart = 0; m_aSamples[i].nLoopEnd = -1; } @@ -982,13 +874,84 @@ cSampleManager::Initialise(void) for ( int32 i = 0; i < NUM_CHANNELS; i++ ) nChannelVolume[i] = 0; } + + add_providers(); + + { + int index = 0; + _maxSamples = Min(MAXCHANNELS, providers[index].sources); + + ALCint attr[] = {ALC_FREQUENCY,MAX_FREQ, + ALC_MONO_SOURCES, MAX_DIGITAL_MIXER_CHANNELS - MAX2DCHANNELS, + ALC_STEREO_SOURCES, MAX2DCHANNELS, + 0, + }; + + ALDevice = alcOpenDevice(providers[index].id); + ASSERT(ALDevice != NULL); + + ALContext = alcCreateContext(ALDevice, attr); + ASSERT(ALContext != NULL); + + alcMakeContextCurrent(ALContext); + const char* ext=(const char*)alGetString(AL_EXTENSIONS); + ASSERT(strstr(ext,"AL_SOFT_loop_points")!=NULL); + if ( strstr(ext,"AL_SOFT_loop_points")==NULL ) + { + Terminate(); + return FALSE; + } + + alListenerf (AL_GAIN, 1.0f); + alListener3f(AL_POSITION, 0.0f, 0.0f, 0.0f); + alListener3f(AL_VELOCITY, 0.0f, 0.0f, 0.0f); + ALfloat orientation[6] = { 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f }; + alListenerfv(AL_ORIENTATION, orientation); + + alDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); + + if ( alcIsExtensionPresent(ALDevice, (ALCchar*)ALC_EXT_EFX_NAME) ) + { + _effectsSupported = providers[index].bSupportsFx; + alGenAuxiliaryEffectSlots(1, &ALEffectSlot); + alGenEffects(1, &ALEffect); + } + + alGenSources(MAX_STREAMS*2, ALStreamSources[0]); + for ( int32 i = 0; i < MAX_STREAMS; i++ ) + { + alGenBuffers(NUM_STREAMBUFFERS, ALStreamBuffers[i]); + alSourcei(ALStreamSources[i][0], AL_SOURCE_RELATIVE, AL_TRUE); + alSource3f(ALStreamSources[i][0], AL_POSITION, 0.0f, 0.0f, 0.0f); + alSourcef(ALStreamSources[i][0], AL_GAIN, 1.0f); + alSourcei(ALStreamSources[i][1], AL_SOURCE_RELATIVE, AL_TRUE); + alSource3f(ALStreamSources[i][1], AL_POSITION, 0.0f, 0.0f, 0.0f); + alSourcef(ALStreamSources[i][1], AL_GAIN, 1.0f); + } + + CChannel::InitChannels(); + + for ( int32 i = 0; i < MAXCHANNELS; i++ ) + aChannel[i].Init(i); + for ( int32 i = 0; i < MAX2DCHANNELS; i++ ) + aChannel[MAXCHANNELS+i].Init(MAXCHANNELS+i, true); + + if ( IsFXSupported() ) + { + /**/ + alAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, ALEffect); + /**/ + + for ( int32 i = 0; i < MAXCHANNELS; i++ ) + aChannel[i].SetReverbMix(ALEffectSlot, 0.0f); + } + } + { for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ ) nStreamLength[i] = 0; } - - add_providers(); #ifdef AUDIO_CACHE FILE *cacheFile = fcaseopen("audio\\sound.cache", "rb"); @@ -1149,8 +1112,51 @@ cSampleManager::Terminate(void) } } - release_existing(); + for ( int32 i = 0; i < NUM_CHANNELS; i++ ) + aChannel[i].Term(); + if ( IsFXSupported() ) + { + if ( alIsEffect(ALEffect) ) + { + alEffecti(ALEffect, AL_EFFECT_TYPE, AL_EFFECT_NULL); + alDeleteEffects(1, &ALEffect); + ALEffect = AL_EFFECT_NULL; + } + + if (alIsAuxiliaryEffectSlot(ALEffectSlot)) + { + alAuxiliaryEffectSloti(ALEffectSlot, AL_EFFECTSLOT_EFFECT, AL_EFFECT_NULL); + + alDeleteAuxiliaryEffectSlots(1, &ALEffectSlot); + ALEffectSlot = AL_EFFECTSLOT_NULL; + } + } + + for ( int32 i = 0; i < MAX_STREAMS; i++ ) + { + alDeleteBuffers(NUM_STREAMBUFFERS, ALStreamBuffers[i]); + } + alDeleteSources(MAX_STREAMS*2, ALStreamSources[0]); + + CChannel::DestroyChannels(); + + if ( ALContext ) + { + alcMakeContextCurrent(NULL); + alcSuspendContext(ALContext); + alcDestroyContext(ALContext); + } + if ( ALDevice ) + alcCloseDevice(ALDevice); + + ALDevice = NULL; + ALContext = NULL; + + _fPrevEaxRatioDestination = 0.0f; + _usingEFX = false; + _fEffectsLevel = 0.0f; + _DeleteMP3Entries(); CStream::Terminate(); -- cgit v1.2.3