DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
DayZPlayerCfgSounds.c
См. документацию.
2{
4 {
7
8 string stepsCfgPath = "CfgVehicles SurvivorBase AnimEvents Steps ";
9 int stepsCount = GetGame().ConfigGetChildrenCount(stepsCfgPath);
10 for(int i = 0; i < stepsCount; i++)
11 {
12 string stepName;
13 GetGame().ConfigGetChildName(stepsCfgPath, i, stepName);
14 string stepPath = stepsCfgPath + stepName + " ";
15 int id = GetGame().ConfigGetInt(stepPath + "id");
16
17 string tableName;
18 GetGame().ConfigGetText(stepPath + "soundLookupTable", tableName);
19
20
21 StepSoundLookupTable table = m_pSoundTableInstances.Get(tableName.Hash());
22 if(table == NULL)
23 {
24 table = new StepSoundLookupTable();
25 table.LoadTable(tableName);
26 m_pSoundTableInstances.Insert(tableName.Hash(), table);
27 }
28 m_pSoundTables.Insert(id, table);
29 }
30 }
31
32 override SoundObjectBuilder GetSoundBuilder(int eventId, int pMovement, int pSurfaceHash, AnimBootsType pBoots)
33 {
34 SoundLookupTable table = m_pSoundTables.Get(eventId);
35 if(table == NULL)
36 return NULL;
37
38 SoundObjectBuilder soundBuilder = table.GetSoundBuilder(pSurfaceHash);
39 if(soundBuilder == NULL)
40 return NULL;
41
42 if (pMovement == DayZPlayerConstants.MOVEMENTIDX_WALK)
43 {
44 soundBuilder.AddVariable("walk", 1);
45 soundBuilder.AddVariable("run", 0);
46 soundBuilder.AddVariable("sprint", 0);
47 }
48 else if (pMovement == DayZPlayerConstants.MOVEMENTIDX_RUN)
49 {
50 soundBuilder.AddVariable("walk", 0);
51 soundBuilder.AddVariable("run", 1);
52 soundBuilder.AddVariable("sprint", 0);
53 }
54 else if (pMovement == DayZPlayerConstants.MOVEMENTIDX_SPRINT)
55 {
56 soundBuilder.AddVariable("walk", 0);
57 soundBuilder.AddVariable("run", 0);
58 soundBuilder.AddVariable("sprint", 1);
59 }
60 else
61 {
62 soundBuilder.AddVariable("walk", 0);
63 soundBuilder.AddVariable("run", 0);
64 soundBuilder.AddVariable("sprint", 0);
65 }
66
67 if (pBoots == AnimBootsType.None)
68 {
69 soundBuilder.AddVariable("bare", 1);
70 soundBuilder.AddVariable("sneakers", 0);
71 soundBuilder.AddVariable("boots", 0);
72 }
73 else if (pBoots == AnimBootsType.Sneakers)
74 {
75 soundBuilder.AddVariable("bare", 0);
76 soundBuilder.AddVariable("sneakers", 1);
77 soundBuilder.AddVariable("boots", 0);
78 }
79 else if (pBoots == AnimBootsType.Boots)
80 {
81 soundBuilder.AddVariable("bare", 0);
82 soundBuilder.AddVariable("sneakers", 0);
83 soundBuilder.AddVariable("boots", 1);
84 }
85
86 return soundBuilder;
87 }
88
96
99 private autoptr map<int, StepSoundLookupTable> m_pSoundTables;//pointers to tables above
100}
101
102
104{
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);
136 }
137
138 override SoundObjectBuilder GetSoundBuilder(int eventId, string slotName, int attachmentHash)
139 {
140 SoundLookupTable table = m_pSoundTables.Get((slotName + eventId).Hash());
141 if(table == NULL)
142 return NULL;
143
144 SoundObjectBuilder soundBuilder = table.GetSoundBuilder(attachmentHash);
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
165
166
168{
170 {
171 // this produces 2 maps:
172 // 1) map where the key is 'ID' of anim event and the value is sound lookup table
173 // 2) map of unique lookup table instances where the table name hash is a key, and a lookup table is the value
176
177 string cfgPath = "CfgVehicles SurvivorBase AnimEvents SoundVoice ";
178 int childCount = GetGame().ConfigGetChildrenCount(cfgPath);
179 //Print("childCount:" + childCount);
180 for(int i = 0; i < childCount; i++)
181 {
182 string defName;
183 GetGame().ConfigGetChildName(cfgPath, i, defName);
184 string defPath = cfgPath + defName + " ";
185
186 int id = GetGame().ConfigGetInt(defPath + "id");
187
188 string tableName;
189 GetGame().ConfigGetText(defPath + "soundLookupTable", tableName);
190
191 PlayerVoiceLookupTable table = m_pSoundTableInstances.Get(tableName.Hash());
192 if(table == NULL)
193 {
194 table = new PlayerVoiceLookupTable();
195 table.LoadTable(tableName);
196 m_pSoundTableInstances.Insert(tableName.Hash(), table);
197
198 string noiseName;
199 if(GetGame().ConfigGetText(defPath + "noise", noiseName))
202 np.Load(noiseName);
203 table.SetNoiseParam(np);
204 }
205 }
206
207 m_pSoundTables.Insert(id, table);
208 }
209 }
210
211 override SoundObjectBuilder GetSoundBuilder(int eventId, int parameterHash)
212 {
213 PlayerVoiceLookupTable table = m_pSoundTables.Get(eventId);
214 if(table == NULL)
215 return NULL;
216
217 SoundObjectBuilder soundBuilder = table.GetSoundBuilder(parameterHash);
218 if(soundBuilder == NULL)
219 return NULL;
220
221 return soundBuilder;
222 }
223
224 override NoiseParams GetNoiseParams(int eventId)
225 {
226 PlayerVoiceLookupTable table = m_pSoundTables.Get(eventId);
227 if(table == NULL)
228 return NULL;
229
230 return table.GetNoiseParam();
231 }
232
240
244}
245
246
247
248class DayZPlayerTypeSoundTableImpl extends DayZPlayerTypeAnimTable
249{
250 private static ref DayZPlayerTypeSoundTableImpl m_instance;
252
254 {
256
257 string soundsCfgPath = "CfgVehicles SurvivorBase AnimEvents Sounds ";
258
259 int soundCount = GetGame().ConfigGetChildrenCount(soundsCfgPath);
260 for(int i = 0; i < soundCount; i++)
261 {
262 string soundName;
263 GetGame().ConfigGetChildName(soundsCfgPath, i, soundName);
264 string soundPath = soundsCfgPath + soundName + " ";
265 AnimSoundEvent soundEvent = new AnimSoundEvent(soundPath);
266 if(soundEvent.IsValid())
267 m_AnimSoundEvents.Set(soundEvent.m_iID, soundEvent);
268 }
269 }
270
271 override AnimSoundEvent GetSoundEvent(int event_id)
272 {
273 return m_AnimSoundEvents.Get(event_id);
274 }
275
277 {
278 if(m_instance == null)
280
281 return m_instance;
282 }
283
286}
287
288/*
289class DayZPlayerTypeSoundVoiceTableImpl extends DayZPlayerTypeAnimTable
290{
291 void DayZPlayerTypeSoundVoiceTableImpl()
292 {
293 m_animSoundEvents = new map<int, ref AnimSoundEvent>;
294
295 string soundsCfgPath = "CfgVehicles SurvivorBase AnimEvents SoundVoice ";
296
297 int soundCount = GetGame().ConfigGetChildrenCount(soundsCfgPath);
298 for(int i = 0; i < soundCount; i++)
299 {
300 string soundName;
301 GetGame().ConfigGetChildName(soundsCfgPath, i, soundName);
302 string soundPath = soundsCfgPath + soundName + " ";
303 AnimSoundEvent soundEvent = new AnimSoundEvent(soundPath);
304 if(soundEvent.IsValid())
305 m_animSoundEvents.Insert(soundEvent.m_iID, soundEvent);
306 }
307 }
308
309 override AnimSoundEvent GetSoundEvent(int event_id)
310 {
311 AnimSoundEvent soundEvent = m_animSoundEvents.Get(event_id);
312 return soundEvent;
313 }
314
315 ref map<int, ref AnimSoundEvent> m_animSoundEvents;
316}
317*/
318
320{
321 GetGame().ProfilerStart("DayZPlayerTypeRegisterSounds");
323 pType.RegisterStepEvent("Step", 0.2);
324
325 pType.RegisterSoundEvent("Sound", -1);
326 pType.RegisterSoundEvent("SoundWeapon", 0.2);
327 pType.RegisterSoundEvent("SoundVoice", -1);
328 if(!GetGame().IsDedicatedServer())//attachments don't generate noise, so we can ignore them on server
329 pType.RegisterSoundEvent("SoundAttachment", 0.2);
330
331
332 DayZPlayerTypeVoiceSoundLookupTableImpl voiceTable2 = DayZPlayerTypeVoiceSoundLookupTableImpl.GetInstance();
333 pType.RegisterVoiceSoundLookupTable(voiceTable2);
334
335 if(!GetGame().IsDedicatedServer())//sounds are unnecessary on server
336 {
337 pType.RegisterParticleEvent("Particle", -1);
340 pType.RegisterStepSoundLookupTable(stepTable);
341
343 pType.RegisterAttachmentSoundLookupTable(attachTable);
344
345
346
348 pType.RegisterSoundTable(soundTable);
349
350 //DayZPlayerTypeSoundVoiceTableImpl voiceTable = new DayZPlayerTypeSoundVoiceTableImpl();
351 //pType.RegisterSoundVoiceTable(voiceTable);
352 }
353 GetGame().ProfilerStop("DayZPlayerTypeRegisterSounds");
354}
PlayerSpawnPreset slotName
map
Определения ControlsXboxNew.c:4
void PlayerVoiceLookupTable()
Определения DayZAnimEventMaps.c:99
static AnimSoundObjectBuilderBank GetInstance()
Определения DayZAnimEventMaps.c:186
static ref AnimSoundObjectBuilderBank m_instance
Определения DayZAnimEventMaps.c:217
class SoundLookupTable StepSoundLookupTable()
Определения DayZAnimEventMaps.c:81
AnimBootsType
Определения DayZAnimEvents.c:98
void DayZPlayerTypeSoundTableImpl()
Определения DayZPlayerCfgSounds.c:253
void DayZPlayerTypeStepSoundLookupTableImpl()
Определения DayZPlayerCfgSounds.c:106
class DayZPlayerTypeStepSoundLookupTableImpl extends DayZPlayerTypeStepSoundLookupTable DayZPlayerTypeAttachmentSoundLookupTableImpl()
Определения DayZPlayerCfgSounds.c:105
autoptr map< int, StepSoundLookupTable > m_pSoundTables
Определения DayZPlayerCfgSounds.c:202
ref array< ref AnimSoundEvent > m_animSoundEvents
DEPRECATED.
Определения DayZPlayerCfgSounds.c:285
autoptr map< int, ref StepSoundLookupTable > m_pSoundTableInstances
Определения DayZPlayerCfgSounds.c:201
void DayZPlayerTypeRegisterSounds(DayZPlayerType pType)
Определения DayZPlayerCfgSounds.c:319
ref map< int, ref AnimSoundEvent > m_AnimSoundEvents
Определения DayZPlayerCfgSounds.c:251
class NoiseSystem NoiseParams()
Определения Noise.c:15
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native void ProfilerStop(string name)
Use for profiling code from start to stop, they must match have same name, look wiki pages for more i...
proto native int ConfigGetInt(string path)
Get int value from config on path.
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
proto native void ProfilerStart(string name)
Use for profiling code from start to stop, they must match have same name, look wiki pages for more i...
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
SoundObjectBuilder GetSoundBuilder(int eventId, string slotName, int attachmentHash)
Определения dayzplayer.c:172
autoptr map< int, ref StepSoundLookupTable > m_pSoundTableInstances
Определения DayZPlayerCfgSounds.c:98
void DayZPlayerTypeStepSoundLookupTableImpl()
Определения DayZPlayerCfgSounds.c:3
static DayZPlayerTypeStepSoundLookupTableImpl GetInstance()
Определения DayZPlayerCfgSounds.c:89
static ref DayZPlayerTypeStepSoundLookupTableImpl m_instance
Определения DayZPlayerCfgSounds.c:97
autoptr map< int, StepSoundLookupTable > m_pSoundTables
Определения DayZPlayerCfgSounds.c:99
override SoundObjectBuilder GetSoundBuilder(int eventId, int pMovement, int pSurfaceHash, AnimBootsType pBoots)
Определения DayZPlayerCfgSounds.c:32
void DayZPlayerTypeVoiceSoundLookupTableImpl()
Определения DayZPlayerCfgSounds.c:169
autoptr map< int, ref PlayerVoiceLookupTable > m_pSoundTableInstances
Определения DayZPlayerCfgSounds.c:242
override SoundObjectBuilder GetSoundBuilder(int eventId, int parameterHash)
Определения DayZPlayerCfgSounds.c:211
static ref DayZPlayerTypeVoiceSoundLookupTableImpl m_instance
Определения DayZPlayerCfgSounds.c:241
static DayZPlayerTypeVoiceSoundLookupTableImpl GetInstance()
Определения DayZPlayerCfgSounds.c:233
override NoiseParams GetNoiseParams(int eventId)
Определения DayZPlayerCfgSounds.c:224
autoptr map< int, PlayerVoiceLookupTable > m_pSoundTables
Определения DayZPlayerCfgSounds.c:243
SoundObjectBuilder GetSoundBuilder(int parameterHash)
Определения DayZAnimEventMaps.c:53
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
void DayZPlayerType()
Определения dayzplayer.c:512
DayZPlayerConstants
defined in C++
Определения dayzplayer.c:602
class DayZPlayerTypeAttachmentSoundLookupTable GetSoundEvent(int event_id)
Определения dayzplayer.c:180
proto native CGame GetGame()
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
proto native int Hash()
Returns hash of string.