5 #include "player_api.h"
7 typedef struct jump_info jump_info
;
10 struct player_skate_state
{
13 k_skate_activity_air_to_grind
,
14 k_skate_activity_ground
,
15 k_skate_activity_undefined
,
16 k_skate_activity_grind_any
,
17 k_skate_activity_grind_boardslide
,
18 k_skate_activity_grind_metallic
,
19 k_skate_activity_grind_back50
,
20 k_skate_activity_grind_front50
,
21 k_skate_activity_grind_5050
29 f32 reverse
, slip
, delayed_slip_dir
;
37 v3f trick_vel
, /* measured in units of TAU/s */
38 trick_euler
; /* measured in units of TAU */
39 v3f trick_residualv
, /* spring */
45 k_trick_type_kickflip
,
61 int charging_jump
, jump_dir
;
71 /* initial launch conditions */
78 v4f smoothed_rotation
;
82 struct player_skate_animator
{
121 f32 push_time
, jump_time
;
129 * --------------------------------------------------------------*/
130 struct skeleton_anim
*anim_stand
, *anim_highg
, *anim_slide
,
131 *anim_air
, *anim_grind
, *anim_grind_jump
,
132 *anim_push
, *anim_push_reverse
,
133 *anim_ollie
, *anim_ollie_reverse
,
134 *anim_grabs
, *anim_stop
;
136 /* vectors representing the direction of the axels in localspace */
139 audio_channel
*aud_main
, *aud_slide
, *aud_air
;
140 enum mdl_surface_prop surface
, audio_surface
;
142 int wheel_contacts
[2];
143 float sample_change_cooldown
;
146 k_skate_sample_concrete
,
148 k_skate_sample_concrete_scrape_metal
,
149 k_skate_sample_concrete_scrape_wood
,
150 k_skate_sample_metal_scrape_generic
156 * ----------------------------------------------------
159 float substep
, substep_delta
;
173 enum prediction_type
{
184 u32 possible_jump_count
;
191 float grind_strength
;
201 enum player_skate_soundeffect
{
202 k_player_skate_soundeffect_jump
,
203 k_player_skate_soundeffect_tap
,
204 k_player_skate_soundeffect_land_good
,
205 k_player_skate_soundeffect_land_bad
,
206 k_player_skate_soundeffect_grind_metal
,
207 k_player_skate_soundeffect_grind_wood
,
211 k_friction_lat
= 12.0f
,
212 k_friction_resistance
= 0.01f
,
214 k_max_push_speed
= 16.0f
,
215 k_push_accel
= 10.0f
,
216 k_push_cycle_rate
= 8.0f
,
218 k_steer_ground
= 2.5f
,
221 k_jump_charge_speed
= (1.0f
/0.4f
),
226 k_cog_mass_ratio
= 0.9f
,
228 k_mmthrow_steer
= 1.0f
,
229 k_mmthrow_scale
= 6.0f
,
230 k_mmcollect_lat
= 2.0f
,
231 k_mmcollect_vert
= 0.0f
,
233 k_spring_angular
= 1.0f
,
235 k_spring_force
= 300.0f
,
236 k_spring_dampener
= 5.0f
,
238 k_grind_spring
= 50.0f
,
239 k_grind_aligment
= 10.0f
,
240 k_grind_dampener
= 5.0f
,
242 k_surface_spring
= 100.0f
,
243 k_surface_dampener
= 40.0f
,
244 k_manul_spring
= 200.0f
,
245 k_manul_dampener
= 30.0f
,
246 k_board_interia
= 8.0f
,
248 k_grind_decayxy
= 30.0f
,
249 k_grind_axel_min_vel
= 1.0f
,
250 k_grind_axel_max_angle
= 0.95f
, /* cosine(|a|) */
251 k_grind_axel_max_vangle
= 0.4f
,
252 k_grind_max_friction
= 3.0f
,
253 k_grind_max_edge_angle
= 0.97f
,
255 k_board_length
= 0.45f
,
256 k_board_width
= 0.13f
,
257 k_board_end_radius
= 0.1f
,
258 k_board_radius
= 0.14f
, /* 0.07 */
260 k_grind_balance
= -40.0f
;
262 static void player__skate_register(void){
263 VG_VAR_F32( k_grind_dampener
, flags
=VG_VAR_CHEAT
);
264 VG_VAR_F32( k_grind_spring
, flags
=VG_VAR_CHEAT
);
265 VG_VAR_F32( k_grind_aligment
, flags
=VG_VAR_CHEAT
);
266 VG_VAR_F32( k_surface_spring
, flags
=VG_VAR_CHEAT
);
267 VG_VAR_F32( k_surface_dampener
, flags
=VG_VAR_CHEAT
);
268 VG_VAR_F32( k_board_interia
, flags
=VG_VAR_CHEAT
);
269 VG_VAR_F32( k_grind_decayxy
, flags
=VG_VAR_CHEAT
);
270 VG_VAR_F32( k_grind_axel_min_vel
, flags
=VG_VAR_CHEAT
);
271 VG_VAR_F32( k_grind_axel_max_angle
, flags
=VG_VAR_CHEAT
);
272 VG_VAR_F32( k_grind_max_friction
, flags
=VG_VAR_CHEAT
);
273 VG_VAR_F32( k_grind_balance
, flags
=VG_VAR_CHEAT
);
274 VG_VAR_F32( k_friction_lat
, flags
=VG_VAR_CHEAT
);
276 VG_VAR_F32( k_cog_spring
, flags
=VG_VAR_CHEAT
);
277 VG_VAR_F32( k_cog_damp
, flags
=VG_VAR_CHEAT
);
278 VG_VAR_F32( k_cog_mass_ratio
, flags
=VG_VAR_CHEAT
);
280 VG_VAR_F32( k_spring_force
, flags
=VG_VAR_CHEAT
);
281 VG_VAR_F32( k_spring_dampener
, flags
=VG_VAR_CHEAT
);
282 VG_VAR_F32( k_spring_angular
, flags
=VG_VAR_CHEAT
);
284 VG_VAR_F32( k_mmthrow_scale
, flags
=VG_VAR_CHEAT
);
285 VG_VAR_F32( k_mmcollect_lat
, flags
=VG_VAR_CHEAT
);
286 VG_VAR_F32( k_mmcollect_vert
, flags
=VG_VAR_CHEAT
);
287 VG_VAR_F32( k_mmdecay
, flags
=VG_VAR_CHEAT
);
288 VG_VAR_F32( k_mmthrow_steer
, flags
=VG_VAR_CHEAT
);
291 static void player__skate_bind (void);
292 static void player__skate_pre_update (void);
293 static void player__skate_update (void);
294 static void player__skate_post_update (void);
295 static void player__skate_im_gui (void);
296 static void player__skate_animate (void);
297 static void player__skate_pose (void *animator
, player_pose
*pose
);
298 static void player__skate_effects( void *_animator
, m4x3f
*final_mtx
,
299 struct player_board
*board
,
300 struct player_effects_data
*effect_data
);
301 static void player__skate_post_animate (void);
302 static void player__skate_animator_exchange( bitpack_ctx
*ctx
, void *data
);
303 static void player__skate_sfx_oneshot ( u8 id
, v3f pos
, f32 volume
);
305 static void player__skate_clear_mechanics(void);
306 static void player__skate_reset_animator(void);
307 static void player__approximate_best_trajectory(void);
309 struct player_subsystem_interface
static player_subsystem_skate
= {
310 .system_register
= player__skate_register
,
311 .bind
= player__skate_bind
,
312 .pre_update
= player__skate_pre_update
,
313 .update
= player__skate_update
,
314 .post_update
= player__skate_post_update
,
315 .im_gui
= player__skate_im_gui
,
316 .animate
= player__skate_animate
,
317 .pose
= player__skate_pose
,
318 .effects
= player__skate_effects
,
319 .post_animate
= player__skate_post_animate
,
320 .network_animator_exchange
= player__skate_animator_exchange
,
321 .sfx_oneshot
= player__skate_sfx_oneshot
,
323 .animator_data
= &player_skate
.animator
,
324 .animator_size
= sizeof(player_skate
.animator
),
328 #endif /* PLAYER_SKATE_H */