DayZ 1.24
Loading...
Searching...
No Matches
DayZPlayerCfgSounds.c File Reference

Go to the source code of this file.

Classes

class  DayZPlayerTypeStepSoundLookupTable
 
class  DayZPlayerTypeVoiceSoundLookupTable
 

Functions

class DayZPlayerTypeStepSoundLookupTableImpl extends DayZPlayerTypeStepSoundLookupTable DayZPlayerTypeAttachmentSoundLookupTableImpl ()
 
void DayZPlayerTypeStepSoundLookupTableImpl ()
 
override SoundObjectBuilder GetSoundBuilder (int eventId, int pMovement, int pSurfaceHash, AnimBootsType pBoots)
 
static DayZPlayerTypeStepSoundLookupTableImpl GetInstance ()
 
override SoundObjectBuilder GetSoundBuilder (int eventId, string slotName, int attachmentHash)
 
class DayZPlayerTypeVoiceSoundLookupTableImpl extends DayZPlayerTypeVoiceSoundLookupTable DayZPlayerTypeSoundTableImpl ()
 
void DayZPlayerTypeVoiceSoundLookupTableImpl ()
 
override SoundObjectBuilder GetSoundBuilder (int eventId, int parameterHash)
 
override NoiseParams GetNoiseParams (int eventId)
 
override AnimSoundEvent GetSoundEvent (int event_id)
 
void DayZPlayerTypeRegisterSounds (DayZPlayerType pType)
 

Variables

static ref DayZPlayerTypeStepSoundLookupTableImpl m_instance
 
autoptr map< int, ref StepSoundLookupTablem_pSoundTableInstances
 
autoptr map< int, StepSoundLookupTablem_pSoundTables
 
ref array< ref AnimSoundEventm_animSoundEvents
 

Function Documentation

◆ DayZPlayerTypeAttachmentSoundLookupTableImpl()

Definition at line 1 of file DayZPlayerCfgSounds.c.

106 {
109
110 string attachCfgPath = "CfgVehicles SurvivorBase AnimEvents Attachments ";
111 int attachCount = GetGame().ConfigGetChildrenCount(attachCfgPath);
112 for (int i = 0; i < attachCount; i++)
113 {
114 string defName;
115 GetGame().ConfigGetChildName(attachCfgPath, i, defName);
116 string defPath = attachCfgPath + defName + " ";
117
118 string slotName;
119 GetGame().ConfigGetText(defPath + "slot", slotName);
120
121 int id = GetGame().ConfigGetInt(defPath + "id");
122
123 string tableName;
124 GetGame().ConfigGetText(defPath + "soundLookupTable", tableName);
125
126 AttachmentSoundLookupTable table = m_pSoundTableInstances.Get(tableName.Hash());
127 if (table == NULL)
128 {
129 table = new AttachmentSoundLookupTable();
130 table.LoadTable(tableName);
131 m_pSoundTableInstances.Insert(tableName.Hash(), table);
132 }
133
134 m_pSoundTables.Insert((slotName + id).Hash(), table);
135 }
136 }
PlayerSpawnPreset slotName
autoptr map< int, StepSoundLookupTable > m_pSoundTables
autoptr map< int, ref StepSoundLookupTable > m_pSoundTableInstances
proto native CGame GetGame()

Referenced by DayZPlayerTypeRegisterSounds().

◆ DayZPlayerTypeRegisterSounds()

void DayZPlayerTypeRegisterSounds ( DayZPlayerType pType)
private

register events

load and register step sound lookup table

Definition at line 320 of file DayZPlayerCfgSounds.c.

321{
322 GetGame().ProfilerStart("DayZPlayerTypeRegisterSounds");
324 pType.RegisterStepEvent("Step", 0.2);
325
326 pType.RegisterSoundEvent("Sound", -1);
327 pType.RegisterSoundEvent("SoundWeapon", 0.2);
328 pType.RegisterSoundEvent("SoundVoice", -1);
329 if (!GetGame().IsDedicatedServer()) //attachments don't generate noise, so we can ignore them on server
330 pType.RegisterSoundEvent("SoundAttachment", 0.2);
331
332
334 pType.RegisterVoiceSoundLookupTable(voiceTable2);
335
336 if (!GetGame().IsDedicatedServer()) //sounds are unnecessary on server
337 {
338 pType.RegisterParticleEvent("Particle", -1);
341 pType.RegisterStepSoundLookupTable(stepTable);
342
344 pType.RegisterAttachmentSoundLookupTable(attachTable);
345
346
348 pType.RegisterSoundTable(soundTable);
349
350 //DayZPlayerTypeSoundVoiceTableImpl voiceTable = new DayZPlayerTypeSoundVoiceTableImpl();
351 //pType.RegisterSoundVoiceTable(voiceTable);
352 }
353 GetGame().ProfilerStop("DayZPlayerTypeRegisterSounds");
354}
void DayZPlayerTypeStepSoundLookupTableImpl()
class DayZPlayerTypeStepSoundLookupTableImpl extends DayZPlayerTypeStepSoundLookupTable DayZPlayerTypeAttachmentSoundLookupTableImpl()
class DayZPlayerTypeVoiceSoundLookupTableImpl extends DayZPlayerTypeVoiceSoundLookupTable DayZPlayerTypeSoundTableImpl()
void DayZPlayerTypeVoiceSoundLookupTableImpl()

References DayZPlayerTypeAttachmentSoundLookupTableImpl(), DayZPlayerTypeSoundTableImpl(), DayZPlayerTypeStepSoundLookupTableImpl(), DayZPlayerTypeVoiceSoundLookupTableImpl(), and GetGame().

Referenced by DayZPlayerTypeUtils::DayZPlayerTypeCreate().

◆ DayZPlayerTypeSoundTableImpl()

Definition at line 165 of file DayZPlayerCfgSounds.c.

248 {
250
251 string soundsCfgPath = "CfgVehicles SurvivorBase AnimEvents Sounds ";
252
253 int soundCount = GetGame().ConfigGetChildrenCount(soundsCfgPath);
254 for (int i = 0; i < soundCount; i++)
255 {
256 string soundName;
257 GetGame().ConfigGetChildName(soundsCfgPath, i, soundName);
258 string soundPath = soundsCfgPath + soundName + " ";
260 if (soundEvent.IsValid())
262 }
263 }
ref array< ref AnimSoundEvent > m_animSoundEvents

Referenced by DayZPlayerTypeRegisterSounds().

◆ DayZPlayerTypeStepSoundLookupTableImpl()

void DayZPlayerTypeAttachmentSoundLookupTableImpl::DayZPlayerTypeStepSoundLookupTableImpl ( )

Definition at line 106 of file DayZPlayerCfgSounds.c.

106 {
109
110 string attachCfgPath = "CfgVehicles SurvivorBase AnimEvents Attachments ";
111 int attachCount = GetGame().ConfigGetChildrenCount(attachCfgPath);
112 for (int i = 0; i < attachCount; i++)
113 {
114 string defName;
115 GetGame().ConfigGetChildName(attachCfgPath, i, defName);
116 string defPath = attachCfgPath + defName + " ";
117
118 string slotName;
119 GetGame().ConfigGetText(defPath + "slot", slotName);
120
121 int id = GetGame().ConfigGetInt(defPath + "id");
122
123 string tableName;
124 GetGame().ConfigGetText(defPath + "soundLookupTable", tableName);
125
126 AttachmentSoundLookupTable table = m_pSoundTableInstances.Get(tableName.Hash());
127 if (table == NULL)
128 {
129 table = new AttachmentSoundLookupTable();
130 table.LoadTable(tableName);
131 m_pSoundTableInstances.Insert(tableName.Hash(), table);
132 }
133

References GetGame(), m_pSoundTableInstances, m_pSoundTables, and slotName.

Referenced by DayZPlayerTypeRegisterSounds().

◆ DayZPlayerTypeVoiceSoundLookupTableImpl()

void DayZPlayerTypeSoundTableImpl::DayZPlayerTypeVoiceSoundLookupTableImpl ( )

Definition at line 248 of file DayZPlayerCfgSounds.c.

248 {
250
251 string soundsCfgPath = "CfgVehicles SurvivorBase AnimEvents Sounds ";
252
253 int soundCount = GetGame().ConfigGetChildrenCount(soundsCfgPath);
254 for (int i = 0; i < soundCount; i++)
255 {
256 string soundName;
257 GetGame().ConfigGetChildName(soundsCfgPath, i, soundName);
258 string soundPath = soundsCfgPath + soundName + " ";
260 if (soundEvent.IsValid())
262 }
263 }
264
266 {
267 for (int i = 0; i < m_animSoundEvents.Count(); i++)
268 {
270 if (soundEvent.m_iID == event_id)
271 return soundEvent;
272 }
273
274 return NULL;
275 }
276
278 {
279 if (m_instance == NULL)
281
282 return m_instance;
283 }
284
287}
288
override AnimSoundEvent GetSoundEvent(int event_id)
static DayZPlayerTypeStepSoundLookupTableImpl GetInstance()
static ref DayZPlayerTypeStepSoundLookupTableImpl m_instance

References GetGame(), and m_animSoundEvents.

Referenced by DayZPlayerTypeRegisterSounds().

◆ GetInstance()

static DayZPlayerTypeSoundTableImpl GetInstance ( )
static

Definition at line 192 of file DayZPlayerCfgSounds.c.

198 {

◆ GetNoiseParams()

override NoiseParams DayZPlayerTypeSoundTableImpl::GetNoiseParams ( int eventId)

Definition at line 303 of file DayZPlayerCfgSounds.c.

◆ GetSoundBuilder() [1/3]

override SoundObjectBuilder DayZPlayerTypeSoundTableImpl::GetSoundBuilder ( int eventId,
int parameterHash )

Definition at line 290 of file DayZPlayerCfgSounds.c.

291 {
293 {
295
296 string soundsCfgPath = "CfgVehicles SurvivorBase AnimEvents SoundVoice ";
297
298 int soundCount = GetGame().ConfigGetChildrenCount(soundsCfgPath);
299 for(int i = 0; i < soundCount; i++)
300 {
301 string soundName;

◆ GetSoundBuilder() [2/3]

override SoundObjectBuilder DayZPlayerTypeAttachmentSoundLookupTableImpl::GetSoundBuilder ( int eventId,
int pMovement,
int pSurfaceHash,
AnimBootsType pBoots )

Definition at line 135 of file DayZPlayerCfgSounds.c.

139 {
141 if (table == NULL)
142 return NULL;
143
145 if (soundBuilder == NULL)
146 return NULL;
147
148 return soundBuilder;
149 }
150
152 {
153 if (m_instance == NULL)
155
156 return m_instance;
157 }
158
162}
163
164
166{
168 {
169 // this produces 2 maps:
170 // 1) map where the key is 'ID' of anim event and the value is sound lookup table
171 // 2) map of unique lookup table instances where the table name hash is a key, and a lookup table is the value
174
175 string cfgPath = "CfgVehicles SurvivorBase AnimEvents SoundVoice ";
176 int childCount = GetGame().ConfigGetChildrenCount(cfgPath);
177 //Print("childCount:" + childCount);
178 for (int i = 0; i < childCount; i++)
179 {
180 string defName;
181 GetGame().ConfigGetChildName(cfgPath, i, defName);
182 string defPath = cfgPath + defName + " ";
183
184 int id = GetGame().ConfigGetInt(defPath + "id");
185
186 string tableName;
187 GetGame().ConfigGetText(defPath + "soundLookupTable", tableName);
188
190 if (table == NULL)
void PlayerVoiceLookupTable()

◆ GetSoundBuilder() [3/3]

override SoundObjectBuilder GetSoundBuilder ( int eventId,
string slotName,
int attachmentHash )

Definition at line 138 of file DayZPlayerCfgSounds.c.

139 {
141 if (table == NULL)
142 return NULL;
143
145 if (soundBuilder == NULL)
146 return NULL;
147
148 return soundBuilder;
149 }

References m_pSoundTables, and slotName.

◆ GetSoundEvent()

override AnimSoundEvent GetSoundEvent ( int event_id)
private

Definition at line 265 of file DayZPlayerCfgSounds.c.

266 {
267 for (int i = 0; i < m_animSoundEvents.Count(); i++)
268 {
270 if (soundEvent.m_iID == event_id)
271 return soundEvent;
272 }
273
274 return NULL;
275 }

References m_animSoundEvents.

Variable Documentation

◆ m_animSoundEvents

ref array<ref AnimSoundEvent> m_animSoundEvents
private

◆ m_instance

static ref DayZPlayerTypeSoundTableImpl m_instance
staticprivate

Definition at line 200 of file DayZPlayerCfgSounds.c.

◆ m_pSoundTableInstances

◆ m_pSoundTables