-#include "audio.h"
-#include "common.h"
-#include "world.h"
-#include "skeleton.h"
-#include "bvh.h"
-
-static float
- k_walkspeed = 7.0f, /* no longer used */
- k_runspeed = 14.0f,
- k_board_radius = 0.3f,
- k_board_length = 0.45f,
- k_board_allowance = 0.04f,
- k_friction_lat = 8.8f,
- 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_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 = 5.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;
+#include "player_ragdoll.h"
+#include "player_render.h"
+#include "player_model.h"
+#include "player_common.h"
+#include "player_walk.h"
+#include "player_skate.h"
+#include "player_dead.h"
+#include "player_drive.h"
+
+#define PLAYER_REWIND_FRAMES 60*4
+#define RESET_MAX_TIME 45.0
+
+static i32 k_cinema_fixed = 0;
+static f32 k_cinema = 0.0f;
+static i32 k_invert_y = 0;
+
+struct player_instance{
+ /* transform definition */
+ rigidbody rb, rb_gate_storage;
+ v3f angles, angles_storage;
+
+ v4f qbasis;
+ m3x3f basis, invbasis, basis_gate;
+ world_instance *viewable_world;
+
+ /*
+ * Camera management
+ * ---------------------------
+ */
+ camera cam;
+
+ enum camera_mode{
+ k_cam_firstperson = 1,
+ k_cam_thirdperson = 0