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
,
41 double outro_start_time
;
54 enum mdl_surface_prop surface
;
55 struct skeleton_anim
*anim_walk
, *anim_run
, *anim_idle
, *anim_jump
,
56 *anim_jump_to_air
, *anim_drop_in
, *anim_intro
,
59 struct player_walk_animator
{
66 f32 walk_timer
, yaw
, pitch
;
69 enum walk_outro outro_type
;
83 k_walk_air_accel
= 7.0f
,
84 k_walk_friction
= 10.0f
,
85 k_walk_step_height
= 0.2f
,
87 k_sit_yaw_limit
= VG_PIf
/1.7f
,
88 k_sit_pitch_limit
= VG_PIf
/4.0f
;
90 static void player__walk_register(void){
91 VG_VAR_F32( k_walkspeed
, flags
=VG_VAR_CHEAT
);
92 VG_VAR_F32( k_stopspeed
, flags
=VG_VAR_CHEAT
);
93 VG_VAR_F32( k_airspeed
, flags
=VG_VAR_CHEAT
);
94 VG_VAR_F32( k_walk_friction
, flags
=VG_VAR_CHEAT
);
95 VG_VAR_F32( k_walk_air_accel
, flags
=VG_VAR_CHEAT
);
96 VG_VAR_F32( k_walk_accel
, flags
=VG_VAR_CHEAT
);
99 static void player__walk_pre_update (void);
100 static void player__walk_update (void);
101 static void player__walk_post_update (void);
102 static void player__walk_animate (void);
103 static void player__walk_pose (void *animator
, player_pose
*pose
);
104 static void player__walk_post_animate(void);
105 static void player__walk_im_gui (void);
106 static void player__walk_bind (void);
107 static void player__walk_transition (void);
108 static void player__walk_reset (ent_spawn
*rp
);
109 static void player__walk_restore (void);
110 static void player__walk_animator_exchange( bitpack_ctx
*ctx
, void *data
);
112 struct player_subsystem_interface
static player_subsystem_walk
= {
113 .system_register
= player__walk_register
,
114 .bind
= player__walk_bind
,
115 .reset
= player__walk_reset
,
116 .pre_update
= player__walk_pre_update
,
117 .update
= player__walk_update
,
118 .post_update
= player__walk_post_update
,
119 .im_gui
= player__walk_im_gui
,
120 .animate
= player__walk_animate
,
121 .post_animate
= player__walk_post_animate
,
122 .pose
= player__walk_pose
,
123 .network_animator_exchange
= player__walk_animator_exchange
,
125 .animator_data
= &player_walk
.animator
,
126 .animator_size
= sizeof(player_walk
.animator
),
130 #endif /* PLAYER_WALK_H */