File size: 7,032 Bytes
24b81cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
/*enum AnimSurfaces
{
	cp_concrete1,
	cp_concrete2,

	cp_dirt,

	cp_broadleaf_dense1,
	cp_broadleaf_dense2,
	cp_broadleaf_sparse1,
	cp_broadleaf_sparse2,

	cp_conifer_common1,
	cp_conifer_common2,
	cp_conifer_moss1,
	cp_conifer_moss2,

	cp_grass,
	cp_grass_tall,

	cp_gravel,
	cp_rock,

	asphalt_ext,
	asphalt_int,

	asphalt_destroyed_ext,
	asphalt_destroyed_int,

	concrete_ext,
	concrete_int,

	stone_ext,
	stone_int,

	gravel_large_ext,
	gravel_large_int,

	gravel_small_ext,
	gravel_small_int,

	sand_ext,
	sand_int,

	dirt_ext,
	dirt_int,

	rubble_large_ext,
	rubble_large_int,

	rubble_small_ext,
	rubble_small_int,

	trash_ext,
	trash_int,

	grass_dry_ext,
	grass_dry_int,

	metal_thick_ext,
	metal_thick_int,

	metal_thin_ext,
	metal_thin_int,

	metal_thin_mesh_ext,
	metal_thin_mesh_int,

	asphalt_felt_ext,
	asphalt_felt_int,

	ceramic_tiles_ext,
	ceramic_tiles_int,

	lino_ext,
	lino_int,

	textile_carpet_ext,
	textile_carpet_int,

	wood_parquet_ext,
	wood_parquet_int,

	wood_planks_ext,
	wood_planks_int,

	concrete_stairs_ext,
	concrete_stairs_int,

	metal_stairs_ext,
	metal_stairs_int,

	wood_planks_stairs_ext,
	wood_planks_stairs_int
}*/

enum AnimBootsType
{
	None,
	Sneakers,
	Boots
}

enum AnimUpperBodyType
{
	None 				= 4107064,//string hash, because we can't make compile time constant
	NylonJacket			= 1228024514,
	TShirt				= 1690896446,
	WoolShirt			= 1060939383,
	HeavyJacket			= 1544363355,
	LeatherJacket		= 2008520095,
	Coat				= 3549415,
	ChemlonDress		= -1491825621,
	Ghillie				= 602194810,
	Chainmail			= -563873622,
}

enum AnimBackType
{
	None 				= -1,
	Small 				= 161213437,
	Military 			= 1935514591,
	Outdoor				= 574855932,
	Ghillie				= 602194810
}

enum AnimRangedWeaponType
{
	None 		= 5727960,
	Rifle 		= 219116654,
	Shotgun 	= 1836650908
}

class AnimSoundEvent
{
	int m_iID;
	ref SoundObjectBuilder 			m_SoundObjectBuilder;
	ref SoundParams 				m_SoundParams;
	autoptr NoiseParams 			m_NoiseParams;
	bool 							m_IsValid = false;
	SoundLookupTable 				m_Table;
	
	
	void AnimSoundEvent(string soundPath)
	{
		m_iID = GetGame().ConfigGetInt(soundPath + "id");

		#ifndef SERVER

		string soundSetName;
		if (GetGame().ConfigGetText(soundPath + "soundSet", soundSetName))
		{
			m_SoundParams = new SoundParams(soundSetName);
			if (m_SoundParams.IsValid())
			{
				m_SoundObjectBuilder = new SoundObjectBuilder(m_SoundParams);
				m_IsValid = true;
			}
		}
		
		string tableName;
		if (GetGame().ConfigGetText(soundPath + "soundLookupTable", tableName))
		{
			m_Table = AnimSoundLookupTableBank.GetInstance().GetActionTable(tableName);
			if (m_Table)
			{
				m_IsValid = true;
				//Print("Found lookup table '"+tableName +"' for anim event-----------------------------------------> " + m_iID);
			}
		}
		#endif

		
		
		
		if ( GetGame().IsServer() )
		{
			string noiseName;
			if (GetGame().ConfigGetText(soundPath + "noise", noiseName))
			{
				m_NoiseParams = new NoiseParams();
				m_NoiseParams.Load(noiseName);
				m_IsValid = true;
			}
			else
			{
				//Print("AnimSoundEvent: \"" + soundPath + "\" doesn't have defined \"noise\"");
			}
		}
	}
	
	bool IsValid()
	{
		return m_IsValid;
	}
	
	SoundObjectBuilder GetSoundBuilder()
	{
		return m_SoundObjectBuilder;
	}
	
	SoundObjectBuilder GetSoundBuilderEx(int paramHash = 0)
	{
		if (m_Table && paramHash)
		{
			return m_Table.GetSoundBuilder(paramHash);
		}
		return m_SoundObjectBuilder;
	}

	SoundObject GetSoundObject(vector position)
	{
		GetSoundBuilderEx().AddEnvSoundVariables(position);
		return GetSoundBuilderEx().BuildSoundObject();
	}
}

class AnimSoundVoiceEvent
{
	int m_iID;
	ref SoundObjectBuilder m_SoundObjectBuilder;
	ref SoundParams m_SoundParams;
	autoptr NoiseParams m_NoiseParams;
	bool m_IsValid = false;

	void AnimSoundVoiceEvent(string soundPath)
	{
		m_iID = GetGame().ConfigGetInt(soundPath + "id");

		if ( !GetGame().IsDedicatedServer() )
		{
			string soundSetName;
			GetGame().ConfigGetText(soundPath + "soundSet", soundSetName);
			m_SoundParams = new SoundParams(soundSetName);
			if ( m_SoundParams.IsValid() )
			{
				m_SoundObjectBuilder = new SoundObjectBuilder(m_SoundParams);
				m_IsValid = true;
			}
		}
		
		if ( GetGame().IsServer() )
		{
			string noiseName;
			if (GetGame().ConfigGetText(soundPath + "noise", noiseName))
			{
				m_NoiseParams = new NoiseParams();
				m_NoiseParams.Load(noiseName);
				m_IsValid = true;
			}
			else
			{
				//Print("AnimSoundVoiceEvent: \"" + soundPath + "\" doesn't have defined \"noise\"");
			}
		}
	}
	
	bool IsValid()
	{
		return m_IsValid;
	}
	
	SoundObjectBuilder GetSoundBuilder()
	{
		return m_SoundObjectBuilder;
	}

	SoundObject GetSoundObject(vector position)
	{
		m_SoundObjectBuilder.AddEnvSoundVariables(position);
		return m_SoundObjectBuilder.BuildSoundObject();
	}
}

class AnimStepEvent
{
	int m_iID;
	string m_sSoundLookupTableName;
	StepSoundLookupTable m_soundLookupTable;
	autoptr NoiseParams m_NoiseParams;

	void AnimStepEvent(string stepPath)
	{
		m_iID = GetGame().ConfigGetInt(stepPath + "id");

		if ( !GetGame().IsDedicatedServer() )
		{
			GetGame().ConfigGetText(stepPath + "soundLookupTable", m_sSoundLookupTableName);
			m_soundLookupTable = StepSoundLookupTable.Cast( AnimSoundLookupTableBank.GetInstance().GetStepTable(m_sSoundLookupTableName) );
		}
		
		if ( GetGame().IsServer() )
		{
			string noiseName;
			if (GetGame().ConfigGetText(stepPath + "noise",noiseName))
			{
				m_NoiseParams = new NoiseParams();
				m_NoiseParams.Load(noiseName);
			}
		}
	}
	
	SoundObjectBuilder GetSoundBuilder(int surfaceHash)
	{
		return m_soundLookupTable.GetSoundBuilder(surfaceHash);
	}
}

class AnimDamageEvent
{
	int m_iID;
	autoptr AnimDamageParams m_DamageParams;

	void AnimDamageEvent(string damagePath)
	{
		m_iID = GetGame().ConfigGetInt(damagePath + "id");
		
		string damageName;
		GetGame().ConfigGetText(damagePath + "damage", damageName);
		m_DamageParams = new AnimDamageParams(damageName);
	}
}

class AnimDamageParams
{
	string m_sName;
	string m_sBoneName;
	string m_sAmmoName;	
	float m_fRadius;
	float m_fDuration;
	bool m_bInvertTeams;

	static const string DAMAGE_CFG_CLASS = "CfgDamages ";
	void AnimDamageParams(string damageName)
	{
		m_sName = damageName;
		string damagePath = DAMAGE_CFG_CLASS + damageName + " ";

		GetGame().ConfigGetText(damagePath + "bone", m_sBoneName);
		GetGame().ConfigGetText(damagePath + "ammo", m_sAmmoName);
		m_fRadius = GetGame().ConfigGetFloat(damagePath + "radius");
		m_fDuration = GetGame().ConfigGetFloat(damagePath + "duration");
		
		m_bInvertTeams = false;
		string str_invert_teams_cfg;
		GetGame().ConfigGetText(damagePath + "invertTeams", str_invert_teams_cfg);
		str_invert_teams_cfg.ToLower();
		if (str_invert_teams_cfg == "true")
		{
			m_bInvertTeams = true;
		}
	}
}

class AnimEffectParams
{
	string m_sName;

	static const string EFFECT_CFG_CLASS = "CfgEffects ";
	void AnimEffectParams(string effectName)
	{
		m_sName = effectName;
		string effectPath = EFFECT_CFG_CLASS + effectName + " ";
		//TODO load params
	}
}