5 #include "player_api.h"
8 #define PLAYER_JUMP_EPSILON 0.1 /* 100ms jump allowance */
13 struct player_walk_state
{
20 float drop_in_start_angle
,
25 k_walk_activity_ground
,
26 k_walk_activity_sleep
,
27 k_walk_activity_lockedmove
,
29 k_walk_activity_sit_up
35 k_walk_outro_jump_to_air
,
40 double outro_start_time
;
53 enum mdl_surface_prop surface
;
54 struct skeleton_anim
*anim_walk
, *anim_run
, *anim_idle
, *anim_jump
,
55 *anim_jump_to_air
, *anim_drop_in
, *anim_intro
,
58 struct player_walk_animator
{
65 f32 walk_timer
, yaw
, pitch
;
68 enum walk_outro outro_type
;
82 k_walk_air_accel
= 7.0f
,
83 k_walk_friction
= 10.0f
,
84 k_walk_step_height
= 0.2f
,
86 k_sit_yaw_limit
= VG_PIf
/1.7f
,
87 k_sit_pitch_limit
= VG_PIf
/4.0f
;
89 static void player__walk_register(void){
90 VG_VAR_F32( k_walkspeed
, flags
=VG_VAR_CHEAT
);
91 VG_VAR_F32( k_stopspeed
, flags
=VG_VAR_CHEAT
);
92 VG_VAR_F32( k_airspeed
, flags
=VG_VAR_CHEAT
);
93 VG_VAR_F32( k_walk_friction
, flags
=VG_VAR_CHEAT
);
94 VG_VAR_F32( k_walk_air_accel
, flags
=VG_VAR_CHEAT
);
95 VG_VAR_F32( k_walk_accel
, flags
=VG_VAR_CHEAT
);
98 static void player__walk_pre_update (void);
99 static void player__walk_update (void);
100 static void player__walk_post_update (void);
101 static void player__walk_animate (void);
102 static void player__walk_pose (void *animator
, player_pose
*pose
);
103 static void player__walk_post_animate(void);
104 static void player__walk_im_gui (void);
105 static void player__walk_bind (void);
106 static void player__walk_transition (void);
107 static void player__walk_reset (ent_spawn
*rp
);
108 static void player__walk_restore (void);
109 static void player__walk_animator_exchange( bitpack_ctx
*ctx
, void *data
);
111 struct player_subsystem_interface
static player_subsystem_walk
= {
112 .system_register
= player__walk_register
,
113 .bind
= player__walk_bind
,
114 .reset
= player__walk_reset
,
115 .pre_update
= player__walk_pre_update
,
116 .update
= player__walk_update
,
117 .post_update
= player__walk_post_update
,
118 .im_gui
= player__walk_im_gui
,
119 .animate
= player__walk_animate
,
120 .post_animate
= player__walk_post_animate
,
121 .pose
= player__walk_pose
,
122 .network_animator_exchange
= player__walk_animator_exchange
,
124 .animator_data
= &player_walk
.animator
,
125 .animator_size
= sizeof(player_walk
.animator
),
129 #endif /* PLAYER_WALK_H */