DayZ 1.24
Loading...
Searching...
No Matches
PlayerSoundEventBase.c File Reference

Go to the source code of this file.

Enumerations

enum  EPlayerSoundEventType {
  GENERAL = 0x00000001 , MELEE = 0x00000002 , STAMINA = 0x00000004 , DAMAGE = 0x00000008 ,
  DUMMY = 0x00000010 , INJURY = 0x00000020 , DROWNING = 0x00000040
}
 

Functions

bool IsDummy ()
 
EPlayerSoundEventType GetPriorityOverTypes ()
 
bool HasHoldBreathException ()
 
void PlayerSoundEventBase ()
 
void ~PlayerSoundEventBase ()
 
int GetSoundVoiceAnimEventClassID ()
 
bool HasPriorityOverCurrent (PlayerBase player, EPlayerSoundEventID other_state_id, EPlayerSoundEventType type_other)
 
bool IsFinished ()
 
bool IsDummyFinished ()
 
void OnTick (float delta_time)
 
bool CanPlay (PlayerBase player)
 
void Init (PlayerBase player)
 
void InitEx (PlayerBase player, int param)
 
void OnEnd ()
 
void SendEvent (float time)
 
void OnInterupt ()
 
override void OnPlay (PlayerBase player)
 
override bool Play ()
 

Variables

enum EPlayerSoundEventType SKIP_CONTROLLED_PLAYER = 0x00000001
 
enum EPlayerSoundEventType HIGHEST_PRIORITY = 0x00000002
 
enum EPlayerSoundEventType ENUM_COUNT = 0x00000002
 
enum EPlayerSoundEventType m_Player = 0x00000002
 
float m_DummySoundLength
 
float m_DummyStartTime
 
bool m_IsDummyType
 
bool m_ProcessPlaybackEvent
 
float m_PlayTime
 
ref HumanMovementState m_Hms = new HumanMovementState()
 
EPlayerSoundEventType m_HasPriorityOverTypes
 

Enumeration Type Documentation

◆ EPlayerSoundEventType

Enumerator
GENERAL 
MELEE 
STAMINA 
DAMAGE 
DUMMY 
INJURY 
DROWNING 

Definition at line 1 of file PlayerSoundEventBase.c.

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}

Function Documentation

◆ CanPlay()

bool CanPlay ( PlayerBase player)

Definition at line 111 of file PlayerSoundEventBase.c.

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 }
ref HumanMovementState m_Hms
bool HasHoldBreathException()

References PlayerSoundEventBase::HasHoldBreathException(), and m_Hms.

◆ GetPriorityOverTypes()

EPlayerSoundEventType GetPriorityOverTypes ( )

Definition at line 47 of file PlayerSoundEventBase.c.

48 {
50 }
EPlayerSoundEventType m_HasPriorityOverTypes

References m_HasPriorityOverTypes.

◆ GetSoundVoiceAnimEventClassID()

int GetSoundVoiceAnimEventClassID ( )

Definition at line 69 of file PlayerSoundEventBase.c.

70 {
72 }
int m_SoundVoiceAnimEventClassID
Definition SoundEvents.c:83

References m_SoundVoiceAnimEventClassID.

◆ HasHoldBreathException()

bool HasHoldBreathException ( )

Definition at line 53 of file PlayerSoundEventBase.c.

54 {
55 return false;
56 }

◆ HasPriorityOverCurrent()

bool HasPriorityOverCurrent ( PlayerBase player,
EPlayerSoundEventID other_state_id,
EPlayerSoundEventType type_other )

Definition at line 74 of file PlayerSoundEventBase.c.

75 {
76 return true;
77 }

◆ Init()

void Init ( PlayerBase player)

Definition at line 122 of file PlayerSoundEventBase.c.

123 {
124 InitEx(player, 0);
125 }
void InitEx(PlayerBase player, int param)

References InitEx().

◆ InitEx()

void InitEx ( PlayerBase player,
int param )

Definition at line 127 of file PlayerSoundEventBase.c.

128 {
130 m_Param = param;
131 if (param & EPlayerSoundEventParam.HIGHEST_PRIORITY)
133 }
enum EPlayerSoundEventType m_Player
int m_Param
Definition SoundEvents.c:87

References m_HasPriorityOverTypes, m_Param, and m_Player.

Referenced by Init().

◆ IsDummy()

bool IsDummy ( )

Definition at line 42 of file PlayerSoundEventBase.c.

43 {
44 return m_IsDummyType;
45 }
bool m_IsDummyType

References m_IsDummyType.

Referenced by IsFinished(), and Play().

◆ IsDummyFinished()

bool IsDummyFinished ( )

Definition at line 87 of file PlayerSoundEventBase.c.

88 {
89 return GetGame().GetTime() > (m_DummyStartTime + m_DummySoundLength);
90 }
float m_DummySoundLength
float m_DummyStartTime
proto native CGame GetGame()

References GetGame(), m_DummySoundLength, and m_DummyStartTime.

Referenced by IsFinished().

◆ IsFinished()

bool IsFinished ( )

Definition at line 79 of file PlayerSoundEventBase.c.

80 {
81 if (IsDummy())
82 return IsDummyFinished();
83 else
84 return !IsSoundCallbackExist();
85 }
bool IsDummy()
bool IsDummyFinished()
bool IsSoundCallbackExist()

References IsDummy(), IsDummyFinished(), and IsSoundCallbackExist().

◆ OnEnd()

void OnEnd ( )

Definition at line 135 of file PlayerSoundEventBase.c.

136 {
138 SendEvent(1);
139 }
bool m_ProcessPlaybackEvent
void SendEvent(float time)

References m_ProcessPlaybackEvent, and SendEvent().

◆ OnInterupt()

void OnInterupt ( )

Definition at line 151 of file PlayerSoundEventBase.c.

152 {
153
154 }

Referenced by Play().

◆ OnPlay()

override void OnPlay ( PlayerBase player)

!! beware of the ifdef above , most likely you want to put your code above it, otherwise it might not get executed !!!

Definition at line 156 of file PlayerSoundEventBase.c.

157 {
158 super.OnPlay(player);
159 //Print("start playing -------------------->" + m_Type);
160 player.OnVoiceEvent(this);
161 //m_Player.OnVoiceEventDuration(m_SoundSetCallback, 0);
162 }

◆ OnTick()

void OnTick ( float delta_time)

Definition at line 93 of file PlayerSoundEventBase.c.

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 }
float m_PlayTime
AbstractWave m_SoundSetCallback
Definition SoundEvents.c:80
proto void SetPosition(vector position, vector velocity="0 0 0")
proto float GetLength()
WARNING: Blocking! Waits for header to load.
Definition EnMath.c:7
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'.

References Math::Clamp(), AbstractWave::GetLength(), m_Player, m_PlayTime, m_ProcessPlaybackEvent, m_SoundSetCallback, SendEvent(), and AbstractWave::SetPosition().

◆ Play()

override bool Play ( )

Definition at line 164 of file PlayerSoundEventBase.c.

165 {
166 if (!super.Play())
167 return false;
168
169 if (!IsDummy())
170 {
171 m_SoundSetCallback = m_Player.ProcessVoiceEvent("", "", m_SoundVoiceAnimEventClassID);
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 }
void OnEnd()
void OnInterupt()
proto Managed GetUserData()

References GetGame(), AbstractWave::GetUserData(), IsDummy(), m_DummyStartTime, m_Player, m_SoundSetCallback, m_SoundVoiceAnimEventClassID, PlayerSoundEventBase::OnEnd(), OnInterupt(), and DayZPlayer::ProcessVoiceEvent().

◆ PlayerSoundEventBase()

void PlayerSoundEventBase ( )

Definition at line 58 of file PlayerSoundEventBase.c.

59 {
61 }
eBleedingSourceType m_Type
EPlayerSoundEventType

References m_Type.

◆ SendEvent()

void SendEvent ( float time)

Definition at line 141 of file PlayerSoundEventBase.c.

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 }
const float MAX
Definition EnConvert.c:99

References m_Player, m_PlayTime, m_SoundSetCallback, and float::MAX.

◆ ~PlayerSoundEventBase()

Definition at line 63 of file PlayerSoundEventBase.c.

64 {
66 OnEnd();
67 }

References m_SoundSetCallback, and PlayerSoundEventBase::OnEnd().

Variable Documentation

◆ ENUM_COUNT

enum EPlayerSoundEventType ENUM_COUNT = 0x00000002

◆ HIGHEST_PRIORITY

enum EPlayerSoundEventType HIGHEST_PRIORITY = 0x00000002

◆ m_DummySoundLength

float m_DummySoundLength

◆ m_DummyStartTime

float m_DummyStartTime

Definition at line 34 of file PlayerSoundEventBase.c.

Referenced by IsDummyFinished(), and Play().

◆ m_HasPriorityOverTypes

◆ m_Hms

Definition at line 39 of file PlayerSoundEventBase.c.

Referenced by CanPlay().

◆ m_IsDummyType

bool m_IsDummyType

Definition at line 35 of file PlayerSoundEventBase.c.

Referenced by IsDummy(), and StaminaSoundEventBase::StaminaNormalDummy().

◆ m_Player

enum EPlayerSoundEventType m_Player = 0x00000002

◆ m_PlayTime

float m_PlayTime

Definition at line 37 of file PlayerSoundEventBase.c.

Referenced by OnTick(), and SendEvent().

◆ m_ProcessPlaybackEvent

bool m_ProcessPlaybackEvent

Definition at line 36 of file PlayerSoundEventBase.c.

Referenced by OnEnd(), OnTick(), and StaminaNormalDummy().

◆ SKIP_CONTROLLED_PLAYER

enum EPlayerSoundEventType SKIP_CONTROLLED_PLAYER = 0x00000001