DayZ 1.24
Loading...
Searching...
No Matches
InjurySoundHandlerBase Class Reference
Collaboration diagram for InjurySoundHandlerBase:
[legend]

Private Member Functions

eInjurySoundZones DetermineInjuryZone (eInjuryHandlerLevels level)
 
override void Update ()
 
void ProcessSound (eInjurySoundZones zone)
 
void PlaySound (eInjurySoundZones zone)
 

Private Attributes

const float SOUND_INTERVALS_LIGHT_MIN = 15
 
const float SOUND_INTERVALS_LIGHT_MAX = 30
 
const float SOUND_INTERVALS_MEDIUM_MIN = 10
 
const float SOUND_INTERVALS_MEDIUM_MAX = 25
 
const float SOUND_INTERVALS_HEAVY_MIN = 3
 
const float SOUND_INTERVALS_HEAVY_MAX = 12
 
ref HumanMovementState m_MovementState = new HumanMovementState
 
eInjurySoundZones m_InjurySoundZone
 
eInjuryHandlerLevels m_InjuryLevel
 
float m_SoundTime
 

Detailed Description

Definition at line 24 of file InjurySoundHandler.c.

Member Function Documentation

◆ DetermineInjuryZone()

eInjurySoundZones InjurySoundHandlerBase::DetermineInjuryZone ( eInjuryHandlerLevels level)
inlineprivate

Definition at line 36 of file InjurySoundHandler.c.

37 {
38 if (level == eInjuryHandlerLevels.PRISTINE)
39 return eInjurySoundZones.NONE;
40
41 m_Player.GetMovementState(m_MovementState);
42 int speed = m_MovementState.m_iMovement;
43 int stance = m_MovementState.m_iStanceIdx;
44
45 //int stance_lvl_down = DayZPlayerConstants.STANCEMASK_PRONE | DayZPlayerConstants.STANCEMASK_CROUCH;
46
47 if (speed == 0)
48 return eInjurySoundZones.NONE;
49
50 level--;// shift the level so that we play from higher damage
51
52 if (stance == DayZPlayerConstants.STANCEIDX_PRONE || stance == DayZPlayerConstants.STANCEIDX_CROUCH)
53 level--;
54
55 if (speed == DayZPlayerConstants.MOVEMENTIDX_WALK)
56 level--;
57 else if (speed == DayZPlayerConstants.MOVEMENTIDX_SPRINT)
58 level++;
60 return level;
61 }
DayZPlayer m_Player
Definition Hand_Events.c:42
eInjuryHandlerLevels
eInjurySoundZones
ref HumanMovementState m_MovementState
Definition EnMath.c:7
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
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(), m_MovementState, and m_Player.

◆ PlaySound()

void InjurySoundHandlerBase::PlaySound ( eInjurySoundZones zone)
inlineprivate

Definition at line 99 of file InjurySoundHandler.c.

100 {
102 }
bool PlaySoundEvent(EPlayerSoundEventID id, bool from_anim_system=false, bool is_from_server=false)

References m_Player, and DayZPlayer::PlaySoundEvent().

◆ ProcessSound()

void InjurySoundHandlerBase::ProcessSound ( eInjurySoundZones zone)
inlineprivate

Definition at line 75 of file InjurySoundHandler.c.

76 {
77 //Print("injury sound zone:"+ zone);
78 // process sound here
79 if (GetGame().GetTime() > m_SoundTime)
80 {
81 float offset_time;
82 if (zone == eInjurySoundZones.NONE)
83 {
84 offset_time = 3000;
85 m_SoundTime = GetGame().GetTime() + offset_time;
86 return;
87 }
88 if (zone == eInjurySoundZones.LIGHT)
90 else if (zone == eInjurySoundZones.MEDIUM)
92 else if (zone == eInjurySoundZones.HEAVY)
94 m_SoundTime = GetGame().GetTime() + offset_time;
96 }
97 }
void PlaySound()
float GetTime()
const float SOUND_INTERVALS_HEAVY_MIN
const float SOUND_INTERVALS_MEDIUM_MAX
const float SOUND_INTERVALS_MEDIUM_MIN
const float SOUND_INTERVALS_LIGHT_MAX
const float SOUND_INTERVALS_LIGHT_MIN
const float SOUND_INTERVALS_HEAVY_MAX
proto native CGame GetGame()
static float RandomFloatInclusive(float min, float max)
Returns a random float number between and min [inclusive] and max [inclusive].
Definition EnMath.c:106

References GetGame(), GetTime(), m_SoundTime, PlaySound(), Math::RandomFloatInclusive(), SOUND_INTERVALS_LIGHT_MAX, and SOUND_INTERVALS_LIGHT_MIN.

◆ Update()

override void InjurySoundHandlerBase::Update ( )
inlineprivate

Definition at line 64 of file InjurySoundHandler.c.

65 {
66 m_InjuryLevel = m_Player.m_HealthLevel;
67
68 if (m_InjuryLevel != eInjuryHandlerLevels.PRISTINE)
69 {
72 }
73 }
void ProcessSound()
eInjurySoundZones DetermineInjuryZone(eInjuryHandlerLevels level)
eInjuryHandlerLevels m_InjuryLevel

References m_Player, and ProcessSound().

Member Data Documentation

◆ m_InjuryLevel

eInjuryHandlerLevels InjurySoundHandlerBase::m_InjuryLevel
private

Definition at line 32 of file InjurySoundHandler.c.

◆ m_InjurySoundZone

eInjurySoundZones InjurySoundHandlerBase::m_InjurySoundZone
private

Definition at line 31 of file InjurySoundHandler.c.

◆ m_MovementState

ref HumanMovementState InjurySoundHandlerBase::m_MovementState = new HumanMovementState
private

Definition at line 30 of file InjurySoundHandler.c.

◆ m_SoundTime

float InjurySoundHandlerBase::m_SoundTime
private

Definition at line 33 of file InjurySoundHandler.c.

◆ SOUND_INTERVALS_HEAVY_MAX

const float InjurySoundHandlerBase::SOUND_INTERVALS_HEAVY_MAX = 12
private

Definition at line 28 of file InjurySoundHandler.c.

◆ SOUND_INTERVALS_HEAVY_MIN

const float InjurySoundHandlerBase::SOUND_INTERVALS_HEAVY_MIN = 3
private

Definition at line 28 of file InjurySoundHandler.c.

◆ SOUND_INTERVALS_LIGHT_MAX

const float InjurySoundHandlerBase::SOUND_INTERVALS_LIGHT_MAX = 30
private

Definition at line 26 of file InjurySoundHandler.c.

◆ SOUND_INTERVALS_LIGHT_MIN

const float InjurySoundHandlerBase::SOUND_INTERVALS_LIGHT_MIN = 15
private

Definition at line 26 of file InjurySoundHandler.c.

◆ SOUND_INTERVALS_MEDIUM_MAX

const float InjurySoundHandlerBase::SOUND_INTERVALS_MEDIUM_MAX = 25
private

Definition at line 27 of file InjurySoundHandler.c.

◆ SOUND_INTERVALS_MEDIUM_MIN

const float InjurySoundHandlerBase::SOUND_INTERVALS_MEDIUM_MIN = 10
private

Definition at line 27 of file InjurySoundHandler.c.


The documentation for this class was generated from the following file: