Dayz
Build 1.29.163047, Scripts Rev. 123548
Dayz Code Explorer by Zeroy
Toggle main menu visibility
Loading...
Searching...
No Matches
replacesoundeventhandler.c
Go to the documentation of this file.
1
enum
ESoundEventType
2
{
3
SOUND_COMMON
= 0
// "Sound"
4
SOUND_WEAPON,
// "SoundWeapon"
5
SOUND_ATTACHMENT
,
// "SoundAttachment"
6
SOUND_VOICE
// "SoundVoice"
7
}
8
9
enum
EReplaceSoundEventID
10
{
11
DIG_PRIMARY
= 1,
12
DIG_SECONDARY
,
13
CLEANHANDS_PRIMARY
,
14
CLEANHANDS_SECONDARY
,
15
EAT_DEFAULT
,
16
EAT_FRUIT
17
}
18
19
// Main purpose is to intercept animation system based sound event calls and replace them with different ones based on context
20
class
ReplaceSoundEventHandler
21
{
22
protected
static
ref
map<ESoundEventType, ref map<int, ref ReplaceSoundEventBase>
>
m_MainReplaceMap
=
new
map<ESoundEventType, ref map<int, ref ReplaceSoundEventBase>
>;
23
24
protected
PlayerBase
m_Player
;
25
protected
ref
Timer
m_UpdateTimer
;
26
27
void
ReplaceSoundEventHandler
(
PlayerBase
player)
28
{
29
m_Player
= player;
30
31
RegisterEvent
(
new
DigPrimarySoundEvent
());
32
RegisterEvent
(
new
DigSecondarySoundEvent
());
33
RegisterEvent
(
new
CleanHandsPrimarySoundEvent
());
34
RegisterEvent
(
new
CleanHandsSecondarySoundEvent
());
35
RegisterEvent
(
new
EatingVoiceOverrideDefault
());
36
RegisterEvent
(
new
EatingVoiceOverrideFruit
());
37
}
38
39
// Inserts sound replace event to array of event maps, creates new event map if first sound of an event type is being registered
40
protected
void
RegisterEvent
(
ReplaceSoundEventBase
soundEvent)
41
{
42
int
sType = soundEvent.
GetSoundEventType
();
43
44
if
(!
m_MainReplaceMap
.Contains(sType))
45
{
46
ref
map<int, ref ReplaceSoundEventBase>
replaceMap =
new
map<int, ref ReplaceSoundEventBase>
();
47
m_MainReplaceMap
.Set(sType, replaceMap);
48
}
49
50
m_MainReplaceMap
[sType].Insert(soundEvent.
GetSoundAnimEventClassID
(), soundEvent);
51
}
52
53
int
GetSoundEventID
(
int
anim_id,
ESoundEventType
soundType)
54
{
55
if
(!
m_MainReplaceMap
.Contains(soundType))
56
return
0;
57
58
ReplaceSoundEventBase
soundEvent =
m_MainReplaceMap
[soundType].Get(anim_id);
59
if
(!soundEvent)
60
return
0;
61
62
return
soundEvent.
GetSoundEventID
();
63
}
64
65
ReplaceSoundEventBase
GetSoundEventByID
(
int
id
,
ESoundEventType
soundType)
66
{
67
if
(!
m_MainReplaceMap
.Contains(soundType))
68
return
null;
69
70
foreach
(
int
animID,
ReplaceSoundEventBase
soundEvent :
m_MainReplaceMap
[soundType])
71
{
72
if
(soundEvent.GetSoundEventID() ==
id
)
73
return
soundEvent;
74
}
75
76
return
null;
77
}
78
79
bool
PlayReplaceSound
(
int
soundEventID,
ESoundEventType
soundType,
int
flags)
80
{
81
ReplaceSoundEventBase
soundEvent =
GetSoundEventByID
(soundEventID, soundType);
82
if
(!soundEvent)
83
return
false
;
84
85
ReplaceSoundEventBase
soundEventObj =
ReplaceSoundEventBase
.Cast(soundEvent.ClassName().ToType().Spawn());
86
soundEventObj.
Init
(
m_Player
);
87
88
return
soundEventObj.
Play
();
89
}
90
91
//DEPRECATED
93
protected
static
ref
array< ref map<int, ref ReplaceSoundEventBase>
>
m_SoundEventReplaceMaps
= {};
94
}
EatingVoiceOverrideDefault
void EatingVoiceOverrideDefault()
Definition
actioneatevents.c:13
EatingVoiceOverrideFruit
EatingVoiceOverrideDefault EatingVoiceOverrideBase EatingVoiceOverrideFruit()
Definition
actioneatevents.c:12
DigSecondarySoundEvent
class DigSoundEventBase extends ReplaceSoundEventBase DigSecondarySoundEvent
Definition
actionsurfaceevents.c:15
CleanHandsPrimarySoundEvent
void CleanHandsPrimarySoundEvent()
Definition
actionsurfaceevents.c:54
CleanHandsSecondarySoundEvent
class CleanHandsSoundEventBase extends ReplaceSoundEventBase CleanHandsSecondarySoundEvent
Definition
actionsurfaceevents.c:53
DigPrimarySoundEvent
void DigPrimarySoundEvent()
Definition
actionsurfaceevents.c:16
m_Player
map m_Player
PlayerBase
Definition
playerbaseclient.c:2
ReplaceSoundEventBase
Definition
actionsurfaceevents.c:24
ReplaceSoundEventBase::GetSoundEventID
EReplaceSoundEventID GetSoundEventID()
Definition
replacesoundeventbase.c:15
ReplaceSoundEventBase::Play
bool Play()
Definition
replacesoundeventbase.c:30
ReplaceSoundEventBase::GetSoundAnimEventClassID
int GetSoundAnimEventClassID()
Definition
replacesoundeventbase.c:20
ReplaceSoundEventBase::Init
void Init(PlayerBase player)
Definition
replacesoundeventbase.c:25
ReplaceSoundEventBase::GetSoundEventType
ESoundEventType GetSoundEventType()
Definition
replacesoundeventbase.c:10
Timer
Definition
dayzplayerimplement.c:39
array
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
Definition
isboxcollidinggeometryproxyclasses.c:28
map
Definition
cachedequipmentstorage.c:4
map
map
Definition
controlsxboxnew.c:4
RegisterEvent
proto native void RegisterEvent(string pName, int pId)
register events
m_UpdateTimer
ref Timer m_UpdateTimer
Definition
radialmenu.c:20
EAT_DEFAULT
enum ESoundEventType EAT_DEFAULT
CLEANHANDS_SECONDARY
enum ESoundEventType CLEANHANDS_SECONDARY
m_SoundEventReplaceMaps
static ref array< ref map< int, ref ReplaceSoundEventBase > > m_SoundEventReplaceMaps
leaving this here for compatibility's sake
Definition
replacesoundeventhandler.c:93
CLEANHANDS_PRIMARY
enum ESoundEventType CLEANHANDS_PRIMARY
ReplaceSoundEventHandler
void ReplaceSoundEventHandler(PlayerBase player)
Definition
replacesoundeventhandler.c:27
DIG_PRIMARY
enum ESoundEventType DIG_PRIMARY
DIG_SECONDARY
enum ESoundEventType DIG_SECONDARY
ESoundEventType
ESoundEventType
Definition
replacesoundeventhandler.c:2
SOUND_COMMON
@ SOUND_COMMON
Definition
replacesoundeventhandler.c:3
SOUND_ATTACHMENT
@ SOUND_ATTACHMENT
Definition
replacesoundeventhandler.c:5
SOUND_VOICE
@ SOUND_VOICE
Definition
replacesoundeventhandler.c:6
GetSoundEventByID
ReplaceSoundEventBase GetSoundEventByID(int id, ESoundEventType soundType)
Definition
replacesoundeventhandler.c:65
PlayReplaceSound
bool PlayReplaceSound(int soundEventID, ESoundEventType soundType, int flags)
Definition
replacesoundeventhandler.c:79
m_MainReplaceMap
enum ESoundEventType m_MainReplaceMap
GetSoundEventID
int GetSoundEventID()
Definition
soundevents.c:150
Games
Dayz
scripts
4_world
classes
soundevents
replacesoundevents
replacesoundeventhandler.c
Generated by
1.17.0