actually render trails
[carveJwlIkooP6JGAAIwe30JlM.git] / player_replay.h
index 9890be0b80dfbe87403de6e73018a0f5a6ca4736..42d9bf71d768f731964e6195615647acf6e4ecfc 100644 (file)
@@ -23,7 +23,9 @@ enum replay_framedata{
    k_replay_framedata_animator,
    k_replay_framedata_gamestate,
    k_replay_framedata_internal_gamestate,
-   k_replay_framedata_sfx
+   k_replay_framedata_sfx,
+   k_replay_framedata_glider,
+   k_replay_framedata_rows
 };
 
 struct replay_frame {
@@ -35,36 +37,42 @@ struct replay_frame {
 
    enum player_subsystem system;
    u16 total_size;
-   u16 data_table[4][2];
+   u16 data_table[k_replay_framedata_rows][2];
 };
 
 struct replay_gamestate {
-   rigidbody rb;
+   rigidbody rb, glider_rb; /* TODO: these don't need to be saved with their 
+                                     full matrices */
    v3f angles;
-
    struct player_cam_controller cam_control;
 };
 
+/* we save this per-anim-frame. if there glider is existing in any state */
+struct replay_glider_data {
+   bool have_glider, glider_orphan;
+   f32 t;
+   v3f co; 
+   v4f q;
+};
+
 struct replay_sfx {
    u32 none;
 };
 
-VG_STATIC replay_frame *replay_newframe( replay_buffer *replay, 
-                                         u16 animator_size,
-                                         u16 gamestate_size,
-                                         u16 sfx_count );
-VG_STATIC void replay_seek( replay_buffer *replay, f64 t );
+static int replay_seek( replay_buffer *replay, f64 t );
 
-VG_STATIC replay_frame *replay_find_recent_stateframe( replay_buffer *replay );
-VG_STATIC void replay_get_camera( replay_buffer *replay, camera *cam );
-VG_STATIC void replay_get_frame_camera( replay_frame *frame, camera *cam );
-VG_STATIC f32 replay_subframe_time( replay_buffer *replay );
-VG_STATIC void replay_clear( replay_buffer *replay );
-VG_STATIC void *
+static replay_frame *replay_find_recent_stateframe( replay_buffer *replay );
+static void replay_get_camera( replay_buffer *replay, camera *cam );
+static void replay_get_frame_camera( replay_frame *frame, camera *cam );
+static f32 replay_subframe_time( replay_buffer *replay );
+static void replay_clear( replay_buffer *replay );
+static void *
 replay_frame_data( replay_frame *frame, enum replay_framedata type );
 
-VG_STATIC void skaterift_replay_pre_update(void);
-VG_STATIC void skaterift_replay_imgui(void);
-VG_STATIC void skaterift_replay_debug_info(void);
+static void skaterift_replay_pre_update(void);
+static void skaterift_replay_imgui(void);
+static void skaterift_replay_debug_info(void);
+static void skaterift_record_frame( replay_buffer *replay, 
+                                    int force_gamestate );
 
 #endif /* PLAYER_REPLAY_H */