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

Private Member Functions

void DayZPlayerImplementJumpClimb (DayZPlayerImplement pPlayer)
 
bool WasSuccessful ()
 Only valid immediately after 'JumpOrClimb' is called.
 
void JumpOrClimb ()
 Can't change to bool return.
 
void CheckAndFinishJump (int pLandType=0)
 
bool Climb (SHumanCommandClimbResult pClimbRes)
 
void Jump ()
 
int GetClimbType (float pHeight)
 

Private Attributes

bool m_bIsJumpInProgress = false
 
DayZPlayerImplement m_Player
 
bool m_bWasClimb
 

Detailed Description

Definition at line 1 of file DayZPlayerImplementJumpClimb.c.

Constructor & Destructor Documentation

◆ DayZPlayerImplementJumpClimb()

void DayZPlayerImplementJumpClimb::DayZPlayerImplementJumpClimb ( DayZPlayerImplement pPlayer)
inlineprivate

Definition at line 3 of file DayZPlayerImplementJumpClimb.c.

References m_Player.

Member Function Documentation

◆ CheckAndFinishJump()

void DayZPlayerImplementJumpClimb::CheckAndFinishJump ( int pLandType = 0)
inlineprivate

Definition at line 59 of file DayZPlayerImplementJumpClimb.c.

60 {
62 {
63 m_bIsJumpInProgress = false;
64 m_Player.OnJumpEnd(pLandType);
65 }
66 }

References m_bIsJumpInProgress, and m_Player.

◆ Climb()

bool DayZPlayerImplementJumpClimb::Climb ( SHumanCommandClimbResult pClimbRes)
inlineprivate

Definition at line 68 of file DayZPlayerImplementJumpClimb.c.

69 {
70 int climbType = GetClimbType(pClimbRes.m_fClimbHeight);
71 if (climbType != -1)
72 {
73 m_Player.StartCommand_Climb(pClimbRes, climbType);
74 m_Player.StopHandEvent();
75
76 m_bWasClimb = true;
77 }
78
79 return climbType != -1;
80 }

References GetClimbType(), m_bWasClimb, and m_Player.

Referenced by JumpOrClimb().

◆ GetClimbType()

int DayZPlayerImplementJumpClimb::GetClimbType ( float pHeight)
inlineprivate

Definition at line 92 of file DayZPlayerImplementJumpClimb.c.

93 {
94 int climbType = -1;
95 if (pHeight < 1.1)
96 climbType = 0;
97 else if (pHeight >= 1.1 && pHeight < 1.7)
98 climbType = 1;
99 else if (pHeight >= 1.7 && pHeight < 2.75)
100 climbType = 2;
101
102 return climbType;
103 }

Referenced by Climb(), and JumpOrClimb().

◆ Jump()

void DayZPlayerImplementJumpClimb::Jump ( )
inlineprivate

Definition at line 82 of file DayZPlayerImplementJumpClimb.c.

83 {
85 m_Player.SetFallYDiff(m_Player.GetPosition()[1]);
86
87 m_Player.OnJumpStart();
88 m_Player.StartCommand_Fall(2.6);
89 m_Player.StopHandEvent();
90 }

References m_bIsJumpInProgress, and m_Player.

Referenced by JumpOrClimb().

◆ JumpOrClimb()

void DayZPlayerImplementJumpClimb::JumpOrClimb ( )
inlineprivate

Can't change to bool return.

Reset states

Early exit if the player is being heavy damaged so the stagger animation can't be skipped

Definition at line 15 of file DayZPlayerImplementJumpClimb.c.

16 {
18 m_bWasClimb = false;
19
21 if (m_Player.IsInFullbodyDamageAnimation())
22 return;
23
24 SHumanCommandClimbSettings hcls = m_Player.GetDayZPlayerType().CommandClimbSettingsW();
25
26 if (m_Player.m_MovementState.m_iMovement != DayZPlayerConstants.MOVEMENTIDX_IDLE)
27 hcls.m_fFwMaxDistance = 2.5;
28 else
29 hcls.m_fFwMaxDistance = 1.2;
30
32
34 if (climbRes.m_bIsClimb || climbRes.m_bIsClimbOver)
35 {
36 int climbType = GetClimbType(climbRes.m_fClimbHeight);
37
38 if (!m_Player.CanClimb(climbType, climbRes))
39 return;
40
41 if (Climb(climbRes))
42 {
43 if (climbType == 1)
44 m_Player.DepleteStamina(EStaminaModifiers.VAULT);
45 else if (climbType == 2)
46 m_Player.DepleteStamina(EStaminaModifiers.CLIMB);
47
48 return;
49 }
50 }
51
52 if (m_Player.CanJump())
53 {
54 Jump();
55 m_Player.DepleteStamina(EStaminaModifiers.JUMP);
56 }
57 }
EStaminaModifiers
bool Climb(SHumanCommandClimbResult pClimbRes)
command itself
Definition human.c:761
proto static native bool DoClimbTest(Human pHuman, SHumanCommandClimbResult pResult, int pDebugDrawLevel)
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
class SHumanCommandSwimSettings SHumanCommandClimbSettings()

References Climb(), HumanCommandClimb::DoClimbTest(), GetClimbType(), Jump(), m_bWasClimb, m_Player, and SHumanCommandClimbSettings().

◆ WasSuccessful()

bool DayZPlayerImplementJumpClimb::WasSuccessful ( )
inlineprivate

Only valid immediately after 'JumpOrClimb' is called.

Definition at line 9 of file DayZPlayerImplementJumpClimb.c.

10 {
12 }

References m_bIsJumpInProgress, and m_bWasClimb.

Member Data Documentation

◆ m_bIsJumpInProgress

bool DayZPlayerImplementJumpClimb::m_bIsJumpInProgress = false
private

Definition at line 106 of file DayZPlayerImplementJumpClimb.c.

Referenced by CheckAndFinishJump(), Jump(), and WasSuccessful().

◆ m_bWasClimb

bool DayZPlayerImplementJumpClimb::m_bWasClimb
private

Definition at line 110 of file DayZPlayerImplementJumpClimb.c.

Referenced by Climb(), JumpOrClimb(), and WasSuccessful().

◆ m_Player

DayZPlayerImplement DayZPlayerImplementJumpClimb::m_Player
private

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