group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
PlayerSimState.hpp
Go to the documentation of this file.
1
15
16#pragma once
17
18#include "PlayerVisState.hpp" // for PlayerStateRef + transitively PlayerStateEnums
19
20#include <glm/vec2.hpp>
21#include <glm/vec3.hpp>
22
29{
30 // ── Jump state ─────────────────────────────────────────────────────────
31 bool canDoubleJump{true};
32 bool jumpedThisTick{false};
33 bool jumpHeldLastTick{false};
34 float jumpCooldown{0.0f};
35
36 // ── Coyote time ────────────────────────────────────────────────────────
37 float coyoteTimer{0.0f};
39 float groundedDuration{0.0f};
42
43 // ── Jump lurch ─────────────────────────────────────────────────────────
44 bool jumpLurchEnabled{false};
45 float jumpLurchTimer{0.0f};
46 glm::vec2 moveInputsOnJump{0.0f};
47
48 // ── Sliding ────────────────────────────────────────────────────────────
49 float slideTimer{0.0f};
51 float slideBoostCooldown{0.0f};
53 bool canEnterSlide{true};
54
55 // ── Wallrunning ────────────────────────────────────────────────────────
56 glm::vec3 wallNormal{0.0f};
57 glm::vec3 wallForward{0.0f};
58 float wallRunTimer{0.0f};
59 float wallRunSpeedTimer{0.0f};
60 float exitWallTimer{0.0f};
61 bool wasWallRunning{false};
62
63 // Wall blacklist: stores the last wall's normal + height to prevent regrab.
64 glm::vec3 wallBlacklistNormal{0.0f};
65 float wallBlacklistHeight{-1e10f};
67
76 bool wallJumpLocked{false};
77
78 // ── Climbing ───────────────────────────────────────────────────────────
79 glm::vec3 climbWallNormal{0.0f};
80 float climbTimer{0.0f};
81 float exitClimbTimer{0.0f};
82 bool wasClimbing{false};
83
84 // Climb blacklist.
85 glm::vec3 climbBlacklistNormal{0.0f};
86 float climbBlacklistHeight{-1e10f};
88
89 // ── Ledge grabbing ─────────────────────────────────────────────────────
90 glm::vec3 ledgePoint{0.0f};
91 glm::vec3 ledgeNormal{0.0f};
92 float ledgeHoldTimer{0.0f};
93 bool exitingLedge{false};
94 float exitLedgeTimer{0.0f};
95
96 // ── Grappling hook (Widowmaker-style: direct pull, look-biased launch) ─
99 float grapplePullTimer{0.0f};
100 glm::vec3 grapplePullDir{0.0f};
102};
103
117
Visible / replicated half of the player locomotion state.
Read-only counterpart of PlayerStateRef, for const consumers.
Definition PlayerSimState.hpp:120
const PlayerSimState & sim
Definition PlayerSimState.hpp:122
const PlayerVisState & vis
Definition PlayerSimState.hpp:121
Server-only locomotion bookkeeping.
Definition PlayerSimState.hpp:29
float exitWallTimer
Remaining exit-wall grace time (s).
Definition PlayerSimState.hpp:60
float wallRunTimer
Time on current wall (s).
Definition PlayerSimState.hpp:58
bool canEnterSlide
Cleared when in air, set on landing.
Definition PlayerSimState.hpp:53
bool wasGroundedLastTick
Definition PlayerSimState.hpp:38
bool jumpHeldLastTick
Was jump key held on the previous tick (edge detection).
Definition PlayerSimState.hpp:33
bool canDoubleJump
Reset on land / wallrun / climb.
Definition PlayerSimState.hpp:31
bool jumpLurchEnabled
True during the lurch grace window after jumping.
Definition PlayerSimState.hpp:44
float wallBlacklistHeight
Definition PlayerSimState.hpp:65
int slideFatigueDecayAccum
Tick accumulator for fatigue recovery.
Definition PlayerSimState.hpp:52
float jumpCooldown
Minimum time before double jump is available (s).
Definition PlayerSimState.hpp:34
int slideFatigueCounter
Diminishing returns on consecutive slidehops.
Definition PlayerSimState.hpp:50
float climbBlacklistHeight
Definition PlayerSimState.hpp:86
float exitLedgeTimer
Definition PlayerSimState.hpp:94
float climbTimer
Time on current climb (s).
Definition PlayerSimState.hpp:80
glm::vec3 wallNormal
Normal of the wall being run on.
Definition PlayerSimState.hpp:56
float slideTimer
How long the current slide has lasted (s).
Definition PlayerSimState.hpp:49
bool wallBlacklistActive
Definition PlayerSimState.hpp:66
bool jumpedThisTick
Set during the tick a jump occurs (for lurch setup).
Definition PlayerSimState.hpp:32
bool climbBlacklistActive
Definition PlayerSimState.hpp:87
float jumpLurchTimer
Time elapsed since the jump that enabled lurch (s).
Definition PlayerSimState.hpp:45
float groundedDuration
Time continuously grounded (s); resets on leaving ground.
Definition PlayerSimState.hpp:39
float ledgeHoldTimer
Time spent holding the ledge (s).
Definition PlayerSimState.hpp:92
glm::vec3 climbBlacklistNormal
Definition PlayerSimState.hpp:85
float grapplePullTimer
Time spent being pulled (s).
Definition PlayerSimState.hpp:99
bool exitingLedge
Definition PlayerSimState.hpp:93
glm::vec3 wallBlacklistNormal
Definition PlayerSimState.hpp:64
glm::vec3 climbWallNormal
Normal of the wall being climbed.
Definition PlayerSimState.hpp:79
bool wallJumpLocked
Wall-jump autobhop lock.
Definition PlayerSimState.hpp:76
glm::vec3 grapplePullDir
Cached pull direction (toward anchor at fire time).
Definition PlayerSimState.hpp:100
bool grappleInputLastTick
Edge detection on the grapple key.
Definition PlayerSimState.hpp:101
float slideBoostCooldown
Remaining cooldown before next slide boost (s).
Definition PlayerSimState.hpp:51
glm::vec3 ledgeNormal
Wall normal at the ledge.
Definition PlayerSimState.hpp:91
glm::vec2 moveInputsOnJump
WASD direction when jump started (for direction-change detection).
Definition PlayerSimState.hpp:46
glm::vec3 ledgePoint
World-space position of the grabbed ledge.
Definition PlayerSimState.hpp:90
bool wasWallRunning
Set briefly after leaving wallrun (coyote wall jump).
Definition PlayerSimState.hpp:61
float exitClimbTimer
Definition PlayerSimState.hpp:81
float wallRunSpeedTimer
Timer for the speed-loss delay.
Definition PlayerSimState.hpp:59
glm::vec3 wallForward
Direction of travel along the wall.
Definition PlayerSimState.hpp:57
bool wasClimbing
Definition PlayerSimState.hpp:82
float coyoteTimer
Remaining grace time after leaving ground/wall (s).
Definition PlayerSimState.hpp:37
bool grappleCooldownActive
True during cooldown between uses.
Definition PlayerSimState.hpp:97
float grappleCooldownTimer
Remaining cooldown time (s).
Definition PlayerSimState.hpp:98
Combined-reference helper for code that needs both halves.
Definition PlayerSimState.hpp:113
PlayerSimState & sim
Definition PlayerSimState.hpp:115
PlayerVisState & vis
Definition PlayerSimState.hpp:114
Replicated subset of player locomotion state.
Definition PlayerVisState.hpp:39