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

Go to the source code of this file.

Enumerations

enum  EPlayerSoundEventID {
  HOLD_BREATH = 1 , EXHAUSTED_BREATH , RELEASE_BREATH , STAMINA_DOWN_LIGHT ,
  STAMINA_DOWN_HEAVY , STAMINA_UP_LIGHT , STAMINA_UP_HEAVY , STAMINA_UP_END ,
  STAMINA_NORMAL_DUMMY , TAKING_DMG_LIGHT , TAKING_DMG_HEAVY , SYMPTOM_COUGH ,
  SYMPTOM_LAUGHTER , SYMPTOM_SNEEZE , JUMP , MELEE_ATTACK_LIGHT ,
  INJURED_LIGHT , INJURED_MEDIUM , INJURED_HIGH , FREEZING ,
  HOT , SYMPTOM_FATIGUE , STAMINA_LOW_FILTER_UPPER , STAMINA_LOW_FILTER_MID ,
  STAMINA_LOW_FILTER_LOWER , DROWNING_BREATH , DROWNING_PAIN , PICKUP_HEAVY ,
  THIRST , ENUM_COUNT
}
 

Functions

void PlayerSoundEventHandler (PlayerBase player)
 
void RegisterState (PlayerSoundEventBase state)
 
void OnTick (float delta_time)
 
int ConvertAnimIDtoEventID (int anim_id)
 
static override EPlayerSoundEventType GetSoundEventType (int id)
 
override int GetCurrentStateEventID ()
 
override int GetCurrentStateEventType ()
 
override bool PlayRequestEx (EPlayerSoundEventID id, bool sent_from_server=false, int param=0)
 
override bool PlayRequest (EPlayerSoundEventID id, bool sent_from_server=false)
 

Variables

enum EPlayerSoundEventID m_Player
 
const int SOUND_EVENTS_MAX = EPlayerSoundEventID.ENUM_COUNT
 
static ref PlayerSoundEventBase m_AvailableStates [SOUND_EVENTS_MAX]
 
static ref map< int, intm_ConfigIDToScriptIDmapping = new ref map<int, int>
 
ref PlayerSoundEventBase m_CurrentState
 
ref Timer m_UpdateTimer
 

Enumeration Type Documentation

◆ EPlayerSoundEventID

Enumerator
HOLD_BREATH 
EXHAUSTED_BREATH 
RELEASE_BREATH 
STAMINA_DOWN_LIGHT 
STAMINA_DOWN_HEAVY 
STAMINA_UP_LIGHT 
STAMINA_UP_HEAVY 
STAMINA_UP_END 
STAMINA_NORMAL_DUMMY 
TAKING_DMG_LIGHT 
TAKING_DMG_HEAVY 
SYMPTOM_COUGH 
SYMPTOM_LAUGHTER 
SYMPTOM_SNEEZE 
JUMP 
MELEE_ATTACK_LIGHT 
INJURED_LIGHT 
INJURED_MEDIUM 
INJURED_HIGH 
FREEZING 
HOT 
SYMPTOM_FATIGUE 
STAMINA_LOW_FILTER_UPPER 
STAMINA_LOW_FILTER_MID 
STAMINA_LOW_FILTER_LOWER 
DROWNING_BREATH 
DROWNING_PAIN 
PICKUP_HEAVY 
THIRST 
ENUM_COUNT 

Definition at line 1 of file PlayerSoundEventHandler.c.

2{
3 HOLD_BREATH = 1,
17 JUMP,
24 HOT,
32 THIRST,
33 //--------------
34 // Count bellow, put enums above
35 //--------------
37}
@ EXHAUSTED_BREATH
@ STAMINA_UP_LIGHT
@ MELEE_ATTACK_LIGHT
@ STAMINA_LOW_FILTER_LOWER
@ STAMINA_NORMAL_DUMMY
@ STAMINA_LOW_FILTER_UPPER
@ STAMINA_DOWN_LIGHT
@ STAMINA_DOWN_HEAVY
@ STAMINA_LOW_FILTER_MID
@ STAMINA_UP_HEAVY

Function Documentation

◆ ConvertAnimIDtoEventID()

int ConvertAnimIDtoEventID ( int anim_id)

Definition at line 112 of file PlayerSoundEventHandler.c.

113 {
115 }
static ref map< int, int > m_ConfigIDToScriptIDmapping

References m_ConfigIDToScriptIDmapping.

◆ GetCurrentStateEventID()

override int GetCurrentStateEventID ( )

Definition at line 122 of file PlayerSoundEventHandler.c.

123 {
124 if (m_CurrentState)
125 return m_CurrentState.GetSoundEventID();
126 return -1;
127 }
ref PlayerSoundEventBase m_CurrentState

References m_CurrentState.

◆ GetCurrentStateEventType()

override int GetCurrentStateEventType ( )

Definition at line 129 of file PlayerSoundEventHandler.c.

130 {
131 if (m_CurrentState)
132 return m_CurrentState.GetSoundEventType();
133 return -1;
134 }

References m_CurrentState.

◆ GetSoundEventType()

static override EPlayerSoundEventType GetSoundEventType ( int id)
static

Definition at line 117 of file PlayerSoundEventHandler.c.

118 {
119 return m_AvailableStates[id].GetSoundEventType();
120 }
static ref PlayerSoundEventBase m_AvailableStates[SOUND_EVENTS_MAX]

References m_AvailableStates.

◆ OnTick()

void OnTick ( float delta_time)

Definition at line 101 of file PlayerSoundEventHandler.c.

102 {
103 if (m_CurrentState)
104 {
105 if (m_CurrentState.IsFinished())
107 else
109 }
110 }

References m_CurrentState.

◆ PlayerSoundEventHandler()

void PlayerSoundEventHandler ( PlayerBase player)

Definition at line 49 of file PlayerSoundEventHandler.c.

50 {
52
53 if (!m_UpdateTimer && !m_Player.IsControlledPlayer())
54 {
55 m_UpdateTimer = new Timer();
56 m_UpdateTimer.Run(1, this, "OnTick", null, true);//ticking for remotes, the controlled player is ticking on command handler at higher intervals
57 }
58
61 RegisterState(new FatigueSoundEvent());
69 RegisterState(new DamageHeavySoundEvent());
75 RegisterState(new MeleeAttackHeavyEvent());
81 RegisterState(new HotSoundEvent());
84 RegisterState(new StaminaLowFilterLower());
86 RegisterState(new DrowningEvent2());
89
90
91 }
class DamageSoundEvents extends PlayerSoundEventBase DamageLightSoundEvent()
class DrowningSoundEventBase extends PlayerSoundEventBase DrowningEvent1()
class HeatComfortEventsBase extends PlayerSoundEventBase FreezingSoundEvent()
class ExhaustedBreathSoundEvent extends HoldBreathSoundEventBase ReleaseBreathSoundEvent()
void ExhaustedBreathSoundEvent()
class HoldBreathSoundEventBase extends PlayerSoundEventBase HoldBreathSoundEvent()
class InjuryMediumSoundEvent extends InjurySoundEvents InjuryHeavySoundEvent()
class InjurySoundEvents extends PlayerSoundEventBase InjuryLightSoundEvent()
void InjuryMediumSoundEvent()
class JumpEventsBase extends PlayerSoundEventBase JumpSoundEvent()
Definition JumpEvents.c:33
class MeleeAttackSoundEvents extends PlayerSoundEventBase MeleeAttackLightEvent()
Definition MeleeAttack.c:31
class PickupHeavySoundEvent extends PlayerSoundEventBase ThirstSoundEvent()
Definition MiscEvents.c:14
void PickupHeavySoundEvent()
Definition MiscEvents.c:15
void RegisterState(PlayerSoundEventBase state)
enum EPlayerSoundEventID m_Player
ref Timer m_UpdateTimer
class StaminaDownHeavy extends StaminaSoundEventBase StaminaUpHeavy()
class StaminaUpLight extends StaminaSoundEventBase StaminaUpEnd()
void StaminaDownHeavy()
class StaminaSoundEventBase extends PlayerSoundEventBase StaminaDownLight()
void StaminaNormalDummy()
void StaminaUpLight()
void StaminaLowFilterUpper()
class StaminaLowFilterUpper extends StaminaLowFilterBase StaminaLowFilterMid()
class SymptomSoundEventBase extends PlayerSoundEventBase CoughSoundEvent()
void LaugherSoundEvent()
class LaugherSoundEvent extends SymptomSoundEventBase SneezeSoundEvent()

References CoughSoundEvent(), DamageLightSoundEvent(), DrowningEvent1(), ExhaustedBreathSoundEvent(), FreezingSoundEvent(), HoldBreathSoundEvent(), InjuryHeavySoundEvent(), InjuryLightSoundEvent(), InjuryMediumSoundEvent(), JumpSoundEvent(), LaugherSoundEvent(), m_Player, m_UpdateTimer, MeleeAttackLightEvent(), PickupHeavySoundEvent(), RegisterState(), ReleaseBreathSoundEvent(), SneezeSoundEvent(), StaminaDownHeavy(), StaminaDownLight(), StaminaLowFilterMid(), StaminaLowFilterUpper(), StaminaNormalDummy(), StaminaUpEnd(), StaminaUpHeavy(), StaminaUpLight(), and ThirstSoundEvent().

Referenced by ManBase::OnPlayerLoaded().

◆ PlayRequest()

override bool PlayRequest ( EPlayerSoundEventID id,
bool sent_from_server = false )

Definition at line 173 of file PlayerSoundEventHandler.c.

174 {
176 }
override bool PlayRequestEx(EPlayerSoundEventID id, bool sent_from_server=false, int param=0)

References PlayRequestEx().

◆ PlayRequestEx()

override bool PlayRequestEx ( EPlayerSoundEventID id,
bool sent_from_server = false,
int param = 0 )

Definition at line 136 of file PlayerSoundEventHandler.c.

137 {
139 Error("EPlayerSoundEventID out of bounds");
140
142 if (sent_from_server && (param & EPlayerSoundEventParam.SKIP_CONTROLLED_PLAYER) && m_Player.GetInstanceType() == DayZPlayerInstanceType.INSTANCETYPE_CLIENT)
143 return false;
144
145 if (!requested_state.CanPlay(m_Player))
146 return false;
147
148 if (m_CurrentState)
149 {
150 if (param & EPlayerSoundEventParam.HIGHEST_PRIORITY)
151 m_CurrentState.Stop();
152 else
153 {
154 int current_type = m_CurrentState.GetSoundEventType();
155 //int requested_type = requested_state.GetSoundEventType();
156
157 if ((requested_state.GetPriorityOverTypes() & current_type) == 0)
158 return false;
159 if (!requested_state.HasPriorityOverCurrent(m_Player, id, current_type))
160 return false;
161
162 m_CurrentState.Stop();
163 }
164 }
165 m_CurrentState = PlayerSoundEventBase.Cast(requested_state.ClassName().ToType().Spawn());
167 if (m_CurrentState.Play())
168 m_CurrentState.OnPlay(m_Player);
169 return true;
170 }
const int SOUND_EVENTS_MAX
DayZPlayerInstanceType
defined in C++
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90

References Error(), m_AvailableStates, m_CurrentState, m_Player, and SOUND_EVENTS_MAX.

Referenced by PlayRequest().

◆ RegisterState()

void RegisterState ( PlayerSoundEventBase state)

Definition at line 93 of file PlayerSoundEventHandler.c.

94 {
95 int index = state.GetSoundEventID();
97 m_ConfigIDToScriptIDmapping.Insert(state.GetSoundVoiceAnimEventClassID(), index);
98 }

References m_AvailableStates, and m_ConfigIDToScriptIDmapping.

Referenced by PlayerSoundEventHandler().

Variable Documentation

◆ m_AvailableStates

ref PlayerSoundEventBase m_AvailableStates[SOUND_EVENTS_MAX]
static

Definition at line 43 of file PlayerSoundEventHandler.c.

◆ m_ConfigIDToScriptIDmapping

ref map<int, int> m_ConfigIDToScriptIDmapping = new ref map<int, int>
static

Definition at line 44 of file PlayerSoundEventHandler.c.

Referenced by ConvertAnimIDtoEventID(), and RegisterState().

◆ m_CurrentState

ref PlayerSoundEventBase m_CurrentState

Definition at line 45 of file PlayerSoundEventHandler.c.

◆ m_Player

◆ m_UpdateTimer

ref Timer m_UpdateTimer

Definition at line 46 of file PlayerSoundEventHandler.c.

◆ SOUND_EVENTS_MAX

Definition at line 42 of file PlayerSoundEventHandler.c.