Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
playersoundeventbase.c
Go to the documentation of this file.
2{
3 GENERAL = 0x00000001,
4 MELEE = 0x00000002,
5 STAMINA = 0x00000004,
6 DAMAGE = 0x00000008,
7 DUMMY = 0x00000010,
8 INJURY = 0x00000020,
9 DROWNING = 0x00000040,
10 //HEAT_COMFORT = 0x00000080,
11}
12
13enum EPlayerSoundEventParam
14{
16 HIGHEST_PRIORITY = 0x00000002,
17 /*
18 STAMINA = 0x00000004,
19 DAMAGE = 0x00000008,
20 DUMMY = 0x00000010,
21 INJURY = 0x00000020,
22 HEAT_COMFORT = 0x00000040,
23 */
24
25 // ONLY COUNT BELLOW
27
28}
29
31{
38
39 ref HumanMovementState m_Hms = new HumanMovementState();
41
42 bool IsDummy()
43 {
44 return m_IsDummyType;
45 }
46
51
52 // !can this event play during hold breath
53 bool HasHoldBreathException()
54 {
55 return false;
56 }
57
59 {
61 }
62
64 {
66 OnEnd();
67 }
68
73
74 bool HasPriorityOverCurrent(PlayerBase player, EPlayerSoundEventID other_state_id, EPlayerSoundEventType type_other)
75 {
76 return true;
77 }
78
80 {
81 if(IsDummy())
82 {
83 return IsDummyFinished();
84 }
85 else
86 {
87 return !IsSoundCallbackExist();
88 }
89 }
90
92 {
94 }
95
96
97 void OnTick(float delta_time)
98 {
100 {
101 m_SoundSetCallback.SetPosition(m_Player.GetPosition());
102 //---------- Playback event -------------
103 if( delta_time > 0 && m_ProcessPlaybackEvent )//delta_time 0 is for remotes
104 {
105
106 m_PlayTime += delta_time;
107 //this is not 100% precise as the playback position is not obtained from the sound system
108 float playback01 = Math.Clamp(m_PlayTime / m_SoundSetCallback.GetLength(),0,1);
109 SendEvent(playback01);
110 //---------- Playback event -------------
111 }
112 }
113 }
114
115 bool CanPlay(PlayerBase player)
116 {
117 player.GetMovementState(m_Hms);
118
119 if (player.IsHoldingBreath() && !HasHoldBreathException())
120 {
121 return false;
122 }
123 if (player.m_IsDrowning || (player.IsSwimming() && m_Hms.m_iMovement != 0))
124 {
125 return false;
126 }
127 return true;
128 }
129
130 void Init(PlayerBase player)
131 {
132 InitEx(player,0);
133 }
134
135 void InitEx(PlayerBase player, int param)
136 {
137 m_Player = player;
138 m_Param = param;
139 if (param & EPlayerSoundEventParam.HIGHEST_PRIORITY)
140 {
142 }
143 }
144
145 void OnEnd()
146 {
148 SendEvent(1);
149 }
150
151 void SendEvent(float time)
152 {
153 if(m_PlayTime < 0 || !m_SoundSetCallback)//negative m_PlayTime value indicates the event has already been sent for playback01 = 1
154 return;
155
156 m_Player.OnVoiceEventPlayback(this, m_SoundSetCallback, time);
157 if(time >= 1)
158 m_PlayTime = -float.MAX;
159 }
160
162 {
163
164 }
165
166 override void OnPlay(PlayerBase player)
167 {
168 super.OnPlay(player);
169 //Print("start playing -------------------->" + m_Type);
170 player.OnVoiceEvent(this);
171 //m_Player.OnVoiceEventDuration(m_SoundSetCallback, 0);
172 }
173
174 override bool Play()
175 {
176 if(!super.Play())
177 return false;
178
179 if( !IsDummy() )
180 {
182
184 {
185 AbstractWaveEvents events = AbstractWaveEvents.Cast(m_SoundSetCallback.GetUserData());
186 events.Event_OnSoundWaveEnded.Insert( OnEnd );
187 events.Event_OnSoundWaveStopped.Insert( OnInterupt );
188 return true;
189 }
190 else
191 return false;
192 }
193 else
194 {
196 return true;
197 }
198 return false;
199
200 }
201}
eBleedingSourceType m_Type
proto int GetTime()
returns mission time in milliseconds
AbstractWave ProcessVoiceEvent(string pEventType, string pUserString, int pUserInt)
Definition enmath.c:7
override Widget Init()
Definition dayzgame.c:127
proto native CGame GetGame()
proto void Play()
void OnPlay()
Definition sound.c:206
DayZPlayer m_Player
Definition hand_events.c:42
override bool CanPlay()
Definition mindstates.c:16
EPlayerSoundEventType GetPriorityOverTypes()
enum EPlayerSoundEventType HIGHEST_PRIORITY
enum EPlayerSoundEventType SKIP_CONTROLLED_PLAYER
void ~PlayerSoundEventBase()
EPlayerSoundEventType
float m_PlayTime
bool m_IsDummyType
ref HumanMovementState m_Hms
float m_DummySoundLength
float m_DummyStartTime
EPlayerSoundEventType m_HasPriorityOverTypes
bool IsDummy()
bool m_ProcessPlaybackEvent
void InitEx(PlayerBase player, int param)
bool IsFinished()
enum EPlayerSoundEventType ENUM_COUNT
void SendEvent(float time)
void PlayerSoundEventBase()
bool IsDummyFinished()
void OnInterupt()
int GetSoundVoiceAnimEventClassID()
AbstractWave m_SoundSetCallback
Definition soundevents.c:86
bool IsSoundCallbackExist()
int m_SoundVoiceAnimEventClassID
Definition soundevents.c:89
int m_Param
Definition soundevents.c:93