-#define PLAYER_REWIND_FRAMES 60*4
-
-#include "audio.h"
-#include "common.h"
-#include "world.h"
-#include "skeleton.h"
-#include "bvh.h"
-
-static float
- k_walkspeed = 20.0f, /* no longer used */
- k_runspeed = 20.0f,
- k_board_radius = 0.3f,
- k_board_length = 0.45f,
- k_board_allowance = 0.04f,
- //k_friction_lat = 8.8f,
- k_friction_lat = 12.0f,
- k_friction_resistance = 0.01f,
- k_max_push_speed = 16.0f,
- k_push_accel = 10.0f,
- k_push_cycle_rate = 8.0f,
- k_steer_ground = 2.5f,
- k_steer_air = 3.6f,
- k_steer_air_lerp = 0.3f,
- k_pump_force = 0.0f,
- k_downforce = 5.0f,
- k_walk_downforce = 8.0f,
- k_jump_charge_speed = (1.0f/1.0f),
- k_jump_force = 5.0f,
- k_pitch_limit = 1.5f,
- k_look_speed = 2.0f,
- k_walk_accel = 150.0f,
- k_walk_friction = 8.0f;
-
-static int freecam = 0;
-static int walk_grid_iterations = 1;
-static float fc_speed = 10.0f;
-
-/*
- * -----------------------------------------------------------------------------
- * Memory
- * -----------------------------------------------------------------------------
- */
-
-static struct gplayer
-{
- /* Physics */
- rigidbody collide_front, collide_back;
-
- struct player_phys
- {
- rigidbody rb, rb_gate_frame;
- float iY, siY; /* Yaw inertia */
-
- v3f a, v_last, m, bob, vl;
-
- /* Utility */
- float vswitch, slip, slip_last,
- reverse;
-
- float grab, jump, pushing, push_time;
- double start_push;
- int in_air, on_board, jump_charge, jump_dir;
-
- m3x3f vr,vr_pstep;
- }
- phys,
- phys_gate_frame;
-
- m4x3f visual_transform,
- inv_visual_transform;
-
- int is_dead, death_tick_allowance, rewinding;
-
- v3f land_target;
- v3f land_target_log[22];
- u32 land_target_colours[22];
- int land_log_count;
-
- v3f handl_target, handr_target,
- handl, handr;
-
- /* Camera */
- float air_blend;
-
- v3f camera_pos, smooth_localcam;
- v2f angles;
-
- struct rewind_frame
- {
- v3f pos;
- v2f ang;
- }
- *rewind_buffer;
- u32 rewind_incrementer,
- rewind_length;
-
- float rewind_time;
-
- /* animation */
- double jump_time;
- float fslide,
- fdirz, fdirx,
- fstand,
- ffly,
- fpush,
- fairdir,
- fsetup,
- walk_timer,
- fjump,
- fonboard,
- frun;
-
- float walk;
- int step_phase;
-
- /* player model */
- struct player_model
- {
- glmesh mesh;
- struct skeleton sk;
- struct skeleton_anim *anim_stand,
- *anim_highg,
- *anim_slide,
- *anim_air,
- *anim_push, *anim_push_reverse,
- *anim_ollie, *anim_ollie_reverse,
- *anim_grabs, *anim_stop,
- *anim_walk, *anim_run, *anim_idle,
- *anim_jump;
-
- u32 id_hip,
- id_ik_hand_l,
- id_ik_hand_r,
- id_ik_elbow_l,
- id_ik_elbow_r,
- id_head;
-
- v3f cam_pos;
-
- struct ragdoll_part
- {
- u32 bone_id;
- v3f offset;
-
- u32 use_limits;
- v3f limits[2];
-
- rigidbody rb;
- u32 parent;
- }
- *ragdoll;
- u32 ragdoll_count;
-
- int shoes[2];
- }
- mdl;
-}
-player =
-{
- .collide_front = { .type = k_rb_shape_sphere, .inf.sphere.radius = 0.3f },
- .collide_back = { .type = k_rb_shape_sphere, .inf.sphere.radius = 0.3f }
-};
-
-/*
- * API
- */
-static float *player_get_pos(void);
-static void player_kill(void);
-static float *player_cam_pos(void);
-static void player_save_frame(void);
-static void player_restore_frame(void);
-static void player_save_rewind_frame(void);
-
-/*
- * Submodules
- */
-#include "player_physics.h"