From 66561ea2fb7f76c408c08e21132e58914329faba Mon Sep 17 00:00:00 2001 From: aura Date: Fri, 27 Feb 2026 10:08:07 +0100 Subject: more movement --- src/game/player.h | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'src/game/player.h') diff --git a/src/game/player.h b/src/game/player.h index 7dfd009..27b423d 100644 --- a/src/game/player.h +++ b/src/game/player.h @@ -2,32 +2,51 @@ #include "object.h" #include "camera.h" +enum PlayerFlags_t { + PFL_NONE = 0, + PFL_ONGROUND = 1 << 0, + PFL_INVULNERABLE = 1 << 1, + PFL_NOCLIP = 1 << 2, + PFL_DUCK = 1 << 3, +}; + +enum PlayerMoveType_t { + PMT_NONE = 0, + PMT_WALK = 1, + PMT_FLY = 2, + PMT_LADDER = 3, + PMT_NOCLIP = 4 +}; + struct PLAYER_INPUT { PLAYER_CAMERA cam; struct PLAYER* pobj; // for nulls U8 fwd_held{}, bk_held{}, left_held{}, right_held{}; + U8 jump{}; VEC2 move; }; struct PLAYER : OBJECT { static const U32 CLASSID = OBJCLASS_PLAYER; - U32 health; - F32 fov{72.f}; - F32 eyeoffset{40.f}; + OBJVAR( U32, health ); + OBJVARV( F32, fov, 72.f ); + OBJVARV( F32, eyeoffset, 40.f ); + + OBJVAR( I32, flags ); PLAYER_INPUT input; - VEC3 mins; - VEC3 maxs; - F32 gravity{1.f}; - F32 maxspeed{70.f}; - F32 walkspeed{70.f}; + OBJVARV( F32, gravity, 1.f ); + F32 maxspeed{250.f}; + F32 walkspeed{250.f}; F32 stepsize{16.f}; + OBJVARV( U8, movetype, PMT_WALK ); - VEC3 velocity; + OBJECT* ground_ent; + F32 surf_friction{}; }; extern PLAYER* player_create( VEC3 origin, F32 yaw ); -- cgit v1.2.3