Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
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
2
class
SoundLookupTable
3
{
4
void
SoundLookupTable
()
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 =
g_Game
.ConfigGetChildrenCount(
path
);
21
22
for
(
int
i = 0; i < soundCount; i++)
23
{
24
string
soundClassName;
25
g_Game
.ConfigGetChildName(
path
, i, soundClassName);
26
string
soundClassPath =
path
+
" "
+ soundClassName +
" "
;
27
28
string
parameter;
29
g_Game
.ConfigGetText(soundClassPath +
m_parameterName
, parameter);
30
31
array<string>
soundSetNames =
new
array<string>
;
32
g_Game
.ConfigGetTextArray(soundClassPath +
"soundSets"
, soundSetNames);
33
34
//TODO create SoundObject for every entry, save in Game?
35
array<SoundObjectBuilder>
soundObjectBuilders =
new
array<SoundObjectBuilder>
;
36
for
(
int
j = 0; j < soundSetNames.Count(); j++)
37
{
38
AnimSoundObjectBuilderBank
bank =
AnimSoundObjectBuilderBank
.
GetInstance
();
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
79
class
StepSoundLookupTable
extends
SoundLookupTable
80
{
81
void
StepSoundLookupTable
()
82
{
83
InitTable
(
"CfgStepSoundTables"
,
"surface"
);
84
}
85
}
86
87
class
AttachmentSoundLookupTable
extends
SoundLookupTable
88
{
89
void
AttachmentSoundLookupTable
()
90
{
91
InitTable
(
"CfgAttachmentSoundTables"
,
"category"
);
92
}
93
}
94
95
class
PlayerVoiceLookupTable
extends
SoundLookupTable
96
{
97
ref
NoiseParams
m_NoiseParams
;
98
99
void
PlayerVoiceLookupTable
()
100
{
101
InitTable
(
"CfgVoiceSoundTables"
,
"category"
);
102
}
103
104
void
SetNoiseParam
(
NoiseParams
param)
105
{
106
m_NoiseParams
= param;
107
}
108
109
NoiseParams
GetNoiseParam
()
110
{
111
return
m_NoiseParams
;
112
}
113
}
114
115
116
class
ImpactSoundLookupTable
extends
SoundLookupTable
117
{
118
void
ImpactSoundLookupTable
()
119
{
120
InitTable
(
"CfgImpactSoundTables"
,
"surface"
);
121
}
122
}
123
124
class
ActionSoundLookupTable
extends
SoundLookupTable
125
{
126
void
ActionSoundLookupTable
()
127
{
128
InitTable
(
"CfgActionsSoundTables"
,
"category"
);
129
}
130
}
131
132
133
class
AnimSoundObjectBuilderBank
134
{
135
void
AnimSoundObjectBuilderBank
()
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
177
class
AnimSoundLookupTableBank
178
{
179
void
AnimSoundLookupTableBank
()
180
{
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
194
SoundLookupTable
GetStepTable
(
string
tableName)
195
{
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
208
SoundLookupTable
GetImpactTable
(
string
tableName)
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
222
SoundLookupTable
GetActionTable
(
string
tableName)
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
}
AnimSoundObjectBuilderBank
Definition
dayzanimeventmaps.c:134
AnimSoundObjectBuilderBank::GetBuilder
SoundObjectBuilder GetBuilder(string soundSetName)
Definition
dayzanimeventmaps.c:150
AnimSoundObjectBuilderBank::AnimSoundObjectBuilderBank
void AnimSoundObjectBuilderBank()
Definition
dayzanimeventmaps.c:135
AnimSoundObjectBuilderBank::m_pBuilders
autoptr map< int, ref SoundObjectBuilder > m_pBuilders
Definition
dayzanimeventmaps.c:173
AnimSoundObjectBuilderBank::m_instance
static ref AnimSoundObjectBuilderBank m_instance
Definition
dayzanimeventmaps.c:172
AnimSoundObjectBuilderBank::GetInstance
static AnimSoundObjectBuilderBank GetInstance()
Definition
dayzanimeventmaps.c:141
Math
Definition
enmath.c:7
SoundLookupTable
Definition
dayzanimeventmaps.c:3
SoundLookupTable::LoadTable
void LoadTable(string soundLookupTableName)
Definition
dayzanimeventmaps.c:15
SoundLookupTable::GetSoundBuilder
SoundObjectBuilder GetSoundBuilder(int parameterHash)
Definition
dayzanimeventmaps.c:53
SoundLookupTable::InitTable
void InitTable(string tableCategoryName, string parameterName)
Definition
dayzanimeventmaps.c:9
SoundLookupTable::m_tableCategoryName
string m_tableCategoryName
Definition
dayzanimeventmaps.c:73
SoundLookupTable::m_parameterName
string m_parameterName
Definition
dayzanimeventmaps.c:74
SoundLookupTable::AttachmentSoundLookupTable
void AttachmentSoundLookupTable()
Definition
dayzanimeventmaps.c:89
SoundLookupTable::m_soundBuilders
ref map< int, ref array< SoundObjectBuilder > > m_soundBuilders
Definition
dayzanimeventmaps.c:75
SoundLookupTable::ImpactSoundLookupTable
void ImpactSoundLookupTable()
Definition
dayzanimeventmaps.c:118
SoundLookupTable::SoundLookupTable
void SoundLookupTable()
Definition
dayzanimeventmaps.c:4
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
map
Definition
cachedequipmentstorage.c:4
map
map
Definition
controlsxboxnew.c:4
PlayerVoiceLookupTable
void PlayerVoiceLookupTable()
Definition
dayzanimeventmaps.c:99
GetImpactTable
SoundLookupTable GetImpactTable(string tableName)
Definition
dayzanimeventmaps.c:208
SetNoiseParam
void SetNoiseParam(NoiseParams param)
Definition
dayzanimeventmaps.c:104
m_pBuilders
autoptr map< int, ref SoundObjectBuilder > m_pBuilders
Definition
dayzanimeventmaps.c:218
AnimSoundLookupTableBank
class AnimSoundObjectBuilderBank AnimSoundLookupTableBank()
Definition
dayzanimeventmaps.c:179
GetInstance
static AnimSoundObjectBuilderBank GetInstance()
Definition
dayzanimeventmaps.c:186
GetStepTable
SoundLookupTable GetStepTable(string tableName)
Definition
dayzanimeventmaps.c:194
GetActionTable
SoundLookupTable GetActionTable(string tableName)
Definition
dayzanimeventmaps.c:222
m_instance
static ref AnimSoundObjectBuilderBank m_instance
Definition
dayzanimeventmaps.c:217
m_NoiseParams
class AttachmentSoundLookupTable extends SoundLookupTable m_NoiseParams
ActionSoundLookupTable
class ImpactSoundLookupTable extends SoundLookupTable ActionSoundLookupTable()
Definition
dayzanimeventmaps.c:126
m_pTables
autoptr map< int, ref SoundLookupTable > m_pTables
Definition
dayzanimeventmaps.c:237
StepSoundLookupTable
class SoundLookupTable StepSoundLookupTable()
Definition
dayzanimeventmaps.c:81
GetNoiseParam
NoiseParams GetNoiseParam()
Definition
dayzanimeventmaps.c:109
ImpactSoundLookupTable
void ImpactSoundLookupTable()
Definition
dayzanimeventmaps.c:127
g_Game
DayZGame g_Game
Definition
dayzgame.c:3942
Print
proto void Print(void var)
Prints content of variable to console/log.
Math::RandomInt
static proto int RandomInt(int min, int max)
Returns a random int number between and min [inclusive] and max [exclusive].
SoundObjectBuilder
class AbstractSoundScene SoundObjectBuilder(SoundParams soundParams)
SoundParams
class SoundObject SoundParams(string name)
string::Hash
proto native int Hash()
Returns hash of string.
NoiseParams
class NoiseSystem NoiseParams()
Definition
noise.c:15
path
string path
Definition
optionselectormultistate.c:142
Games
Dayz
scripts
3_game
dayzanimeventmaps.c
Generated by
1.17.0