DayZ 1.24
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
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
41
42 bool IsDummy()
43 {
44 return m_IsDummyType;
45 }
46
51
52 // !can this event play during hold breath
54 {
55 return false;
56 }
57
59 {
61 }
62
64 {
66 OnEnd();
67 }
68
73
78
80 {
81 if (IsDummy())
82 return IsDummyFinished();
83 else
84 return !IsSoundCallbackExist();
85 }
86
88 {
89 return GetGame().GetTime() > (m_DummyStartTime + m_DummySoundLength);
90 }
91
92
93 void OnTick(float delta_time)
94 {
96 {
98 //---------- Playback event -------------
99 if (delta_time > 0 && m_ProcessPlaybackEvent) //delta_time 0 is for remotes
100 {
101
103 //this is not 100% precise as the playback position is not obtained from the sound system
106 //---------- Playback event -------------
107 }
108 }
109 }
110
112 {
113 player.GetMovementState(m_Hms);
114
115 if (player.IsHoldingBreath() && !HasHoldBreathException())
116 return false;
117 if (player.m_IsDrowning || (player.IsSwimming() && m_Hms.m_iMovement != 0))
118 return false;
119 return true;
120 }
121
123 {
124 InitEx(player, 0);
125 }
126
128 {
130 m_Param = param;
131 if (param & EPlayerSoundEventParam.HIGHEST_PRIORITY)
133 }
134
135 void OnEnd()
136 {
138 SendEvent(1);
139 }
140
141 void SendEvent(float time)
142 {
143 if (m_PlayTime < 0 || !m_SoundSetCallback) //negative m_PlayTime value indicates the event has already been sent for playback01 = 1
144 return;
145
146 m_Player.OnVoiceEventPlayback(this, m_SoundSetCallback, time);
147 if (time >= 1)
148 m_PlayTime = -float.MAX;
149 }
150
152 {
153
154 }
155
156 override void OnPlay(PlayerBase player)
157 {
158 super.OnPlay(player);
159 //Print("start playing -------------------->" + m_Type);
160 player.OnVoiceEvent(this);
161 //m_Player.OnVoiceEventDuration(m_SoundSetCallback, 0);
162 }
163
164 override bool Play()
165 {
166 if (!super.Play())
167 return false;
168
169 if (!IsDummy())
170 {
172
174 {
176 events.Event_OnSoundWaveEnded.Insert(OnEnd);
177 events.Event_OnSoundWaveStopped.Insert(OnInterupt);
178 return true;
179 }
180 else
181 return false;
182 }
183 else
184 {
185 m_DummyStartTime = GetGame().GetTime();
186 return true;
187 }
188 return false;
189
190 }
191}
eBleedingSourceType m_Type
override Widget Init()
Definition DayZGame.c:120
DayZPlayer m_Player
Definition Hand_Events.c:42
override bool CanPlay()
Definition MindStates.c:14
void OnTick(PlayerBase player, float deltaT)
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 PlayerSoundEventBase()
bool IsDummyFinished()
void OnInterupt()
int GetSoundVoiceAnimEventClassID()
static proto native void SendEvent(StatsEventData data)
universal analytics event
EAnimPlayState Play()
AbstractWave m_SoundSetCallback
Definition SoundEvents.c:80
bool IsSoundCallbackExist()
int m_SoundVoiceAnimEventClassID
Definition SoundEvents.c:83
int m_Param
Definition SoundEvents.c:87
proto Managed GetUserData()
proto void SetPosition(vector position, vector velocity="0 0 0")
proto float GetLength()
WARNING: Blocking! Waits for header to load.
AbstractWave ProcessVoiceEvent(string pEventType, string pUserString, int pUserInt)
Definition EnMath.c:7
override void OnEnd()
Definition JumpEvents.c:22
override bool HasPriorityOverCurrent(PlayerBase player, EPlayerSoundEventID other_state_id, EPlayerSoundEventType type_other)
override bool HasHoldBreathException()
override void OnPlay(PlayerBase player)
Definition JumpEvents.c:15
const float MAX
Definition EnConvert.c:99
proto native CGame GetGame()
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.