summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/audio/AudioCollision.cpp16
-rw-r--r--src/audio/AudioCollision.h4
-rw-r--r--src/audio/AudioManager.cpp48
-rw-r--r--src/audio/AudioManager.h25
4 files changed, 65 insertions, 28 deletions
diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp
index 99c87a6a..fecd079e 100644
--- a/src/audio/AudioCollision.cpp
+++ b/src/audio/AudioCollision.cpp
@@ -10,6 +10,22 @@
const int CollisionSoundIntensity = 60;
+cAudioCollisionManager::cAudioCollisionManager()
+{
+ m_sQueue.m_pEntity1 = nil;
+ m_sQueue.m_pEntity2 = nil;
+ m_sQueue.m_bSurface1 = SURFACE_DEFAULT;
+ m_sQueue.m_bSurface2 = SURFACE_DEFAULT;
+ m_sQueue.m_fIntensity2 = 0.0f;
+ m_sQueue.m_fIntensity1 = 0.0f;
+ m_sQueue.m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
+
+ for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
+ m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
+
+ m_bCollisionsInQueue = 0;
+}
+
void
cAudioCollisionManager::AddCollisionToRequestedQueue()
{
diff --git a/src/audio/AudioCollision.h b/src/audio/AudioCollision.h
index 956da3e3..a21bbfdc 100644
--- a/src/audio/AudioCollision.h
+++ b/src/audio/AudioCollision.h
@@ -29,8 +29,8 @@ public:
uint8 m_bCollisionsInQueue;
cAudioCollision m_sQueue;
- // reversed all methods
- void AddCollisionToRequestedQueue(); /// ok
+ cAudioCollisionManager();
+ void AddCollisionToRequestedQueue();
};
static_assert(sizeof(cAudioCollisionManager) == 852, "cAudioCollisionManager: error"); \ No newline at end of file
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 3ac194fe..1d2835cf 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -39,7 +39,7 @@
#include "ZoneCull.h"
#include "sampman.h"
-cAudioManager &AudioManager = *(cAudioManager *)0x880FC0;
+cAudioManager AudioManager;
uint32 gPornNextTime; // = *(uint32*)0x6508A0;
uint32 gSawMillNextTime; // = *(uint32*)0x6508A4;
uint32 gShopNextTime; // = *(uint32*)0x6508A8;
@@ -192,6 +192,19 @@ enum PLAY_STATUS : uint8 {
enum LOADING_STATUS : uint8 { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED = 1 };
+cPedComments::cPedComments()
+{
+ for (int i = 0; i < NUM_PED_COMMENTS_SLOTS; i++)
+ for (int j = 0; j < NUM_PED_COMMENTS_BANKS; j++) {
+ m_asPedComments[j][i].m_nProcess = -1;
+ m_nIndexMap[j][i] = NUM_PED_COMMENTS_SLOTS;
+ }
+
+ for (int i = 0; i < NUM_PED_COMMENTS_BANKS; i++)
+ m_nCommentsInBank[i] = 0;
+ m_nActiveBank = 0;
+}
+
void
cPedComments::Add(tPedComment *com)
{
@@ -322,9 +335,9 @@ cPedComments::Process()
cAudioManager::cAudioManager()
{
- m_bIsInitialised = 0;
+ m_bIsInitialised = false;
field_1 = 1;
- m_fSpeedOfSound = 6.8600001f;
+ m_fSpeedOfSound = 6.86f;
m_bTimeSpent = 50;
m_bActiveSamples = NUM_SOUNDS_SAMPLES_SLOTS;
m_bActiveSampleQueue = 1;
@@ -350,7 +363,6 @@ cAudioManager::cAudioManager()
cAudioManager::~cAudioManager()
{
if(m_bIsInitialised) Terminate();
- m_nScriptObjectEntityTotal = 0;
}
void
@@ -711,7 +723,7 @@ cAudioManager::DestroyAllGameCreatedEntities()
}
}
}
- m_nScriptObjectEntityTotal = 0;
+ m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
}
}
@@ -2714,8 +2726,8 @@ cAudioManager::GenerateIntegerRandomNumberTable()
char *
cAudioManager::Get3DProviderName(uint8 id) const
{
- if(!m_bIsInitialised) return 0;
- if(id >= SampleManager.GetNum3DProvidersAvailable()) return 0;
+ if(!m_bIsInitialised) return nil;
+ if(id >= SampleManager.GetNum3DProvidersAvailable()) return nil;
return SampleManager.Get3DProviderName(id);
}
@@ -3028,12 +3040,12 @@ cAudioManager::PlayOneShot(int32 index, int16 sound, float vol)
if(entity.m_bIsUsed) {
if(sound < SOUND_TOTAL_SOUNDS) {
if(entity.m_nType == AUDIOTYPE_SCRIPTOBJECT) {
- if(m_nScriptObjectEntityTotal <
- ARRAY_SIZE(m_anScriptObjectEntityIndices)) {
+ if(m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal <
+ ARRAY_SIZE(m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices)) {
entity.m_awAudioEvent[0] = sound;
entity.m_AudioEvents = 1;
- m_anScriptObjectEntityIndices
- [m_nScriptObjectEntityTotal++] = index;
+ m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices
+ [m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal++] = index;
}
} else {
int32 i = 0;
@@ -9588,15 +9600,15 @@ cAudioManager::ServiceSoundEffects()
ProcessMissionAudio();
AdjustSamplesVolume();
ProcessActiveQueues();
- for(int32 i = 0; i < m_nScriptObjectEntityTotal; ++i) {
+ for(int32 i = 0; i < m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal; ++i) {
cAudioScriptObject *object =
- (cAudioScriptObject *)m_asAudioEntities[m_anScriptObjectEntityIndices[i]]
+ (cAudioScriptObject *)m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]]
.m_pEntity;
delete object;
- m_asAudioEntities[m_anScriptObjectEntityIndices[i]].m_pEntity = nil;
- DestroyEntity(m_anScriptObjectEntityIndices[i]);
+ m_asAudioEntities[m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]].m_pEntity = nil;
+ DestroyEntity(m_sAudioScriptObjectManager.m_anScriptObjectEntityIndices[i]);
}
- m_nScriptObjectEntityTotal = 0;
+ m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
}
int8
@@ -9965,7 +9977,7 @@ cAudioManager::Terminate()
}
m_nAudioEntitiesTotal = 0;
- m_nScriptObjectEntityTotal = 0;
+ m_sAudioScriptObjectManager.m_nScriptObjectEntityTotal = 0;
PreTerminateGameSpecificShutdown();
for(uint32 i = 0; i < DIGITALCHANNELS; i++) {
@@ -9974,7 +9986,7 @@ cAudioManager::Terminate()
SampleManager.Terminate();
- m_bIsInitialised = 0;
+ m_bIsInitialised = false;
PostTerminateGameSpecificShutdown();
}
}
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 07c669ed..31a07f9b 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -197,7 +197,7 @@ public:
bool m_bIsUsed;
uint8 m_bStatus;
int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS];
- uint8 gap_18[2];
+ //uint8 gap_18[2];
float m_afVolume[NUM_AUDIOENTITY_EVENTS];
uint8 m_AudioEvents;
uint8 field_25[3];
@@ -216,7 +216,6 @@ public:
float m_fDistance;
uint8 m_bVolume;
int8 m_nProcess;
- uint8 gap_26[2]; // unused
// no methods
};
@@ -230,9 +229,8 @@ public:
uint8 m_nIndexMap[NUM_PED_COMMENTS_BANKS][NUM_PED_COMMENTS_SLOTS];
uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS];
uint8 m_nActiveBank;
- uint8 gap_1163[1]; // unused
- // reversed all methods
+ cPedComments();
void Add(tPedComment *com);
void Process();
};
@@ -246,7 +244,7 @@ class cMissionAudio
public:
CVector m_vecPos;
bool m_bPredefinedProperties;
- uint8 gap_13[3]; // unused
+ //uint8 gap_13[3];
int m_nSampleIndex;
uint8 m_bLoadingStatus;
uint8 m_bPlayStatus;
@@ -262,6 +260,18 @@ public:
static_assert(sizeof(cMissionAudio) == 32, "cMissionAudio: error");
+// name made up
+class cAudioScriptObjectManager
+{
+public:
+ int32 m_anScriptObjectEntityIndices[NUM_SCRIPT_MAX_ENTITIES];
+ int32 m_nScriptObjectEntityTotal;
+
+ cAudioScriptObjectManager() { m_nScriptObjectEntityTotal = 0; }
+ ~cAudioScriptObjectManager() { m_nScriptObjectEntityTotal = 0; }
+};
+
+
class cVehicleParams;
class CPlane;
class CVehicle;
@@ -315,8 +325,7 @@ public:
int32 m_nAudioEntitiesTotal;
CVector m_avecReflectionsPos[NUM_AUDIO_REFLECTIONS];
float m_afReflectionsDistances[NUM_AUDIO_REFLECTIONS];
- int32 m_anScriptObjectEntityIndices[NUM_SCRIPT_MAX_ENTITIES];
- int32 m_nScriptObjectEntityTotal;
+ cAudioScriptObjectManager m_sAudioScriptObjectManager;
cPedComments m_sPedComments;
int32 m_nFireAudioEntity;
int32 m_nWaterCannonEntity;
@@ -611,4 +620,4 @@ public:
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
-extern cAudioManager &AudioManager;
+extern cAudioManager AudioManager;