Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
dayzanimeventmaps.c
Go to the documentation of this file.
1//individual sound table consisting of map of parameter hashes as keys and soundbuilder array as values
3{
5 {
6 m_soundBuilders = new map<int, ref array<SoundObjectBuilder>>();
7 }
8
9 void InitTable(string tableCategoryName, string parameterName)
10 {
11 m_tableCategoryName = tableCategoryName;
12 m_parameterName = parameterName;
13 }
14
15 void LoadTable(string soundLookupTableName)
16 {
17 string path = "CfgSoundTables " + m_tableCategoryName + " " + soundLookupTableName;
18
19 //load all classes names
20 int soundCount = GetGame().ConfigGetChildrenCount(path);
21
22 for(int i = 0; i < soundCount; i++)
23 {
24 string soundClassName;
25 GetGame().ConfigGetChildName(path, i, soundClassName);
26 string soundClassPath = path + " " + soundClassName + " ";
27
28 string parameter;
29 GetGame().ConfigGetText(soundClassPath + m_parameterName, parameter);
30
31 array<string> soundSetNames = new array<string>;
32 GetGame().ConfigGetTextArray(soundClassPath + "soundSets", soundSetNames);
33
34 //TODO create SoundObject for every entry, save in Game?
36 for(int j = 0; j < soundSetNames.Count(); j++)
37 {
39 SoundObjectBuilder soundObjectBuilder = bank.GetBuilder(soundSetNames.Get(j));
40
41 if(soundObjectBuilder != NULL)
42 soundObjectBuilders.Insert(soundObjectBuilder);
43 }
44
45 if(soundObjectBuilders.Count() > 0)
46 {
47 //Print("SoundLookupTable::LoadTable: path: " + path + " param:" + parameter + " param#:" + parameter.Hash() + " objBuildersCount: " + soundObjectBuilders.Count());
48 m_soundBuilders.Insert(parameter.Hash(), soundObjectBuilders);
49 }
50 }
51 }
52
53 SoundObjectBuilder GetSoundBuilder(int parameterHash)
54 {
55 array<SoundObjectBuilder> soundObjects = m_soundBuilders.Get(parameterHash);
56
57 if(soundObjects == NULL || soundObjects.Count() == 0)
58 {
59 return NULL;
60 }
61 else if (soundObjects.Count() == 1)
62 {
63 return soundObjects.Get(0);
64 }
65 else
66 {
67 int index = Math.RandomInt(0, soundObjects.Count());
68 return soundObjects.Get(index);
69 }
70 }
71
72
73 private string m_tableCategoryName;
74 private string m_parameterName;
75 private ref map<int, ref array<SoundObjectBuilder>> m_soundBuilders;
76}
77
78
80{
82 {
83 InitTable("CfgStepSoundTables", "surface");
84 }
85}
86
87class AttachmentSoundLookupTable extends SoundLookupTable
88{
89 void AttachmentSoundLookupTable()
90 {
91 InitTable("CfgAttachmentSoundTables", "category");
92 }
94
96{
98
100 {
101 InitTable("CfgVoiceSoundTables", "category");
102 }
103
105 {
106 m_NoiseParams = param;
107 }
108
110 {
111 return m_NoiseParams;
112 }
113}
114
115
117{
119 {
120 InitTable("CfgImpactSoundTables", "surface");
121 }
122}
123
125{
128 InitTable("CfgActionsSoundTables", "category");
129 }
130}
132
134{
136 {
137 m_pBuilders = new map<int, ref SoundObjectBuilder>();
138 }
139
140
141 static AnimSoundObjectBuilderBank GetInstance()
142 {
143 if(m_instance == NULL)
144 m_instance = new AnimSoundObjectBuilderBank();
145
146 return m_instance;
147 }
148
149
150 SoundObjectBuilder GetBuilder(string soundSetName)
151 {
152 int soundSetNameHash = soundSetName.Hash();
153
154 SoundObjectBuilder builder = m_pBuilders.Get(soundSetNameHash);
155 if(builder == NULL)
156 {
157 SoundParams params = new SoundParams(soundSetName);
158 if(params.IsValid())
159 {
160 builder = new SoundObjectBuilder(params);
161 m_pBuilders.Insert(soundSetNameHash, builder);
162 }
163 else
164 {
165 Print("AnimSoundObjectBuilderBank: Invalid sound set \"" + soundSetName + "\".");
166 return NULL;
167 }
168 }
169 return builder;
170 }
171
172 private static ref AnimSoundObjectBuilderBank m_instance;
173 private autoptr map<int, ref SoundObjectBuilder> m_pBuilders;
174}
175
176
178{
181 m_pTables = new map<int, ref SoundLookupTable>();
182 }
183
184
185 static AnimSoundLookupTableBank GetInstance()
186 {
187 if(m_instance == NULL)
188 m_instance = new AnimSoundLookupTableBank();
189
190 return m_instance;
191 }
192
193
196 int tableNameHash = tableName.Hash();
197
198 SoundLookupTable table = m_pTables.Get(tableNameHash);
199 if(table == NULL)
200 {
201 table = new StepSoundLookupTable();
202 table.LoadTable(tableName);
203 m_pTables.Insert(tableNameHash, table);
204 }
205 return table;
206 }
207
209 {
210 int tableNameHash = tableName.Hash();
211
212 SoundLookupTable table = m_pTables.Get(tableNameHash);
213 if(table == NULL)
214 {
215 table = new ImpactSoundLookupTable();
216 table.LoadTable(tableName);
217 m_pTables.Insert(tableNameHash, table);
218 }
219 return table;
220 }
221
223 {
224 int tableNameHash = tableName.Hash();
225
226 SoundLookupTable table = m_pTables.Get(tableNameHash);
227 if(table == NULL)
228 {
229 table = new ActionSoundLookupTable();
230 table.LoadTable(tableName);
231 m_pTables.Insert(tableNameHash, table);
232 }
233 return table;
234 }
235
236 private static ref AnimSoundLookupTableBank m_instance;
237 private autoptr map<int, ref SoundLookupTable> m_pTables;
238}
Definition enmath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
void PlayerVoiceLookupTable()
SoundLookupTable GetImpactTable(string tableName)
void InitTable(string tableCategoryName, string parameterName)
void SetNoiseParam(NoiseParams param)
class AnimSoundObjectBuilderBank AnimSoundLookupTableBank()
SoundLookupTable GetStepTable(string tableName)
SoundLookupTable GetActionTable(string tableName)
class AttachmentSoundLookupTable extends SoundLookupTable m_NoiseParams
class ImpactSoundLookupTable extends SoundLookupTable ActionSoundLookupTable()
class SoundLookupTable StepSoundLookupTable()
NoiseParams GetNoiseParam()
void ImpactSoundLookupTable()
proto native CGame GetGame()
proto void Print(void var)
Prints content of variable to console/log.
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
class SoundObject SoundParams(string name)
class NoiseSystem NoiseParams()
Definition noise.c:15