rewind full
[carveJwlIkooP6JGAAIwe30JlM.git] / player_replay.h
1 #ifndef PLAYER_REPLAY_H
2 #define PLAYER_REPLAY_H
3
4 #include "skaterift.h"
5 #include "player.h"
6 #include "player_render.h"
7
8 typedef struct replay_buffer replay_buffer;
9 typedef struct replay_frame replay_frame;
10 typedef struct replay_gamestate replay_gamestate;
11 typedef struct replay_sfx replay_sfx;
12
13 struct replay_buffer {
14 void *data;
15 u32 size; /* bytes */
16
17 replay_frame *head, *tail, *cursor_frame,
18 *statehead;
19 f64 cursor;
20 };
21
22 struct replay_frame {
23 player_animation anim;
24 struct board_pose board_pose;
25
26 v3f cam_pos, cam_angles;
27 f32 cam_fov;
28
29 f64 time;
30 replay_frame *l, *r;
31
32 u32 subsystem_gamestate_size,
33 sfx_count;
34 };
35
36 struct replay_gamestate {
37 enum player_subsystem system;
38 rigidbody rb;
39 v3f angles;
40
41 struct player_cam_controller cam_control;
42
43 #if 0
44 union {
45 struct player_skate_state skate;
46 struct player_walk_state walk;
47 struct player_ragdoll ragdoll;
48 };
49 #endif
50 };
51
52 struct replay_sfx {
53 u32 none;
54 };
55
56 VG_STATIC replay_frame *replay_newframe( replay_buffer *replay,
57 u32 gamestate_count, u32 sfx_count );
58 VG_STATIC void replay_seek( replay_buffer *replay, f64 t );
59
60 replay_gamestate *replay_frame_gamestate( replay_frame *frame );
61 void *replay_gamestate_subsystem_data( replay_gamestate *gs );
62 replay_sfx *replay_frame_sfx( replay_frame *frame, u32 index );
63 VG_STATIC replay_frame *replay_find_recent_stateframe( replay_buffer *replay );
64 VG_STATIC void replay_get_camera( replay_buffer *replay, camera *cam );
65 VG_STATIC void replay_get_frame_camera( replay_frame *frame, camera *cam );
66 VG_STATIC f32 replay_subframe_time( replay_buffer *replay );
67 VG_STATIC void replay_clear( replay_buffer *replay );
68
69 VG_STATIC void skaterift_replay_pre_update(void);
70 VG_STATIC void skaterift_replay_imgui(void);
71 VG_STATIC void skaterift_replay_debug_info(void);
72
73 #endif /* PLAYER_REPLAY_H */