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

Go to the source code of this file.

Enumerations

enum  EInfectedSoundEventID {
  MINDSTATE_CALM_IDLE = 1 , MINDSTATE_CALM_MOVE , MINDSTATE_DISTURBED_IDLE , MINDSTATE_CHASE_MOVE ,
  MINDSTATE_ALERTED_IDLE , MINDSTATE_ALERTED_MOVE , ENUM_COUNT
}
 

Functions

void InfectedSoundEventHandler (ZombieBase pInfected)
 
static override int GetSoundEventType (int id)
 
override int GetCurrentStateEventID ()
 
override int GetCurrentStateEventType ()
 
void Stop ()
 
void SoftStop ()
 
bool IsPlaying ()
 
override bool PlayRequest (int id, bool sent_from_server=false)
 

Variables

enum EInfectedSoundEventID SOUND_EVENTS_MAX = EInfectedSoundEventID.ENUM_COUNT
 
static ref InfectedSoundEventBase m_AvailableStates [SOUND_EVENTS_MAX]
 
ref InfectedSoundEventBase m_CurrentState
 
ZombieBase m_Infected
 

Enumeration Type Documentation

◆ EInfectedSoundEventID

Enumerator
MINDSTATE_CALM_IDLE 
MINDSTATE_CALM_MOVE 
MINDSTATE_DISTURBED_IDLE 
MINDSTATE_CHASE_MOVE 
MINDSTATE_ALERTED_IDLE 
MINDSTATE_ALERTED_MOVE 
ENUM_COUNT 

Definition at line 1 of file InfectedSoundEventHandler.c.

2{
6 //MINDSTATE_CHASE_IDLE,
10 //--------------
12}
@ MINDSTATE_ALERTED_MOVE
@ MINDSTATE_DISTURBED_IDLE
@ MINDSTATE_CHASE_MOVE
@ MINDSTATE_ALERTED_IDLE
@ MINDSTATE_CALM_IDLE
@ MINDSTATE_CALM_MOVE

Function Documentation

◆ GetCurrentStateEventID()

override int GetCurrentStateEventID ( )

Definition at line 38 of file InfectedSoundEventHandler.c.

39 {
41 return m_CurrentState.GetSoundEventID();
42 return -1;
43 }
ref InfectedSoundEventBase m_CurrentState

References m_CurrentState.

Referenced by PlayRequest().

◆ GetCurrentStateEventType()

override int GetCurrentStateEventType ( )

Definition at line 45 of file InfectedSoundEventHandler.c.

46 {
48 return m_CurrentState.GetSoundEventType();
49 return -1;
50 }

References m_CurrentState.

◆ GetSoundEventType()

static override int GetSoundEventType ( int id)
static

Definition at line 33 of file InfectedSoundEventHandler.c.

34 {
35 return m_AvailableStates[id].GetSoundEventType();
36 }
static ref InfectedSoundEventBase m_AvailableStates[SOUND_EVENTS_MAX]

References m_AvailableStates.

◆ InfectedSoundEventHandler()

void InfectedSoundEventHandler ( ZombieBase pInfected)

Definition at line 21 of file InfectedSoundEventHandler.c.

22 {
26 m_AvailableStates[EInfectedSoundEventID.MINDSTATE_DISTURBED_IDLE] = new DisturbedIdleSoundEvent();
27 //m_AvailableStates[EInfectedSoundEventID.MINDSTATE_CHASE_IDLE] = new ChaseIdleSoundEvent();
30 m_AvailableStates[EInfectedSoundEventID.MINDSTATE_ALERTED_MOVE] = new AlertedMoveSoundEvent();
31 }
ZombieBase m_Infected
class MindStateSoundEventBase extends InfectedSoundEventBase CalmIdleSoundEvent()
Definition MindStates.c:13
void ChaseMoveSoundEvent()
Definition MindStates.c:54
class ChaseMoveSoundEvent extends MindStateSoundEventBase AlertedIdleSoundEvent()
Definition MindStates.c:53
class CalmMoveSoundEvent extends MindStateSoundEventBase DisturbedIdleSoundEvent()
Definition MindStates.c:33
void CalmMoveSoundEvent()
Definition MindStates.c:34

References AlertedIdleSoundEvent(), CalmIdleSoundEvent(), CalmMoveSoundEvent(), ChaseMoveSoundEvent(), DisturbedIdleSoundEvent(), m_AvailableStates, and m_Infected.

Referenced by DayZInfected::Init().

◆ IsPlaying()

bool IsPlaying ( )

Definition at line 64 of file InfectedSoundEventHandler.c.

65 {
66 if (m_CurrentState && m_CurrentState.IsSoundCallbackExist())
67 return true;
68
69 return false;
70 }

References m_CurrentState.

◆ PlayRequest()

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

same sound event - skip

Definition at line 72 of file InfectedSoundEventHandler.c.

73 {
75
76 if (!requested_state.CanPlay())
77 return false;
78
80 {
81 if (!m_CurrentState.IsSoundCallbackExist())
82 {
83 //Print("Missing callback - cleanup and continue");
84 delete m_CurrentState;
85 }
86
88 if (GetCurrentStateEventID() == id)
89 {
90 //Print("Same ID - skipping");
91 return false;
92 }
93 }
94
96 {
97 m_CurrentState.SoftStop();
98 m_CurrentState = InfectedSoundEventBase.Cast(requested_state.ClassName().ToType().Spawn());
100 m_CurrentState.Play();
101 return true;
102 }
103 else
104 {
105 m_CurrentState = InfectedSoundEventBase.Cast(requested_state.ClassName().ToType().Spawn());
107 m_CurrentState.Play();
108 return true;
109 }
110
111 return false;//should never get here
112 }
override int GetCurrentStateEventID()

References GetCurrentStateEventID(), m_AvailableStates, m_CurrentState, and m_Infected.

◆ SoftStop()

void SoftStop ( )

Definition at line 58 of file InfectedSoundEventHandler.c.

59 {
61 m_CurrentState.SoftStop();
62 }

References m_CurrentState.

◆ Stop()

void Stop ( )

Definition at line 52 of file InfectedSoundEventHandler.c.

53 {
55 m_CurrentState.Stop();
56 }

References m_CurrentState.

Variable Documentation

◆ m_AvailableStates

◆ m_CurrentState

◆ m_Infected

ZombieBase m_Infected

Definition at line 19 of file InfectedSoundEventHandler.c.

◆ SOUND_EVENTS_MAX