5 k_player_subsystem_walk
= 0,
6 k_player_subsystem_skate
= 1,
7 k_player_subsystem_dead
= 2,
8 k_player_subsystem_drive
= 3
11 #include "player_ragdoll.h"
12 #include "player_render.h"
13 #include "player_model.h"
14 #include "player_common.h"
15 #include "player_walk.h"
16 #include "player_skate.h"
17 #include "player_dead.h"
18 #include "player_drive.h"
19 #include "player_replay.h"
21 #define PLAYER_REWIND_FRAMES 60*4
22 #define RESET_MAX_TIME 45.0
24 static i32 k_cinema_fixed
= 0;
25 static f32 k_cinema
= 0.0f
;
26 static i32 k_invert_y
= 0;
28 struct player_instance
{
29 /* transform definition */
30 rigidbody rb
, rb_gate_storage
;
31 v3f angles
, angles_storage
;
34 m3x3f basis
, invbasis
, basis_gate
;
35 world_instance
*viewable_world
;
39 * ---------------------------
44 k_cam_firstperson
= 1,
48 float camera_type_blend
;
50 v3f fpv_offset
, /* expressed relative to rigidbody */
53 fpv_viewpoint
, /* expressed relative to neck bone inverse final */
61 v3f cam_override_angles
;
62 float cam_override_fov
;
63 float cam_override_strength
;
66 float cam_velocity_influence
,
67 cam_velocity_coefficient
,
68 cam_velocity_constant
,
69 cam_velocity_coefficient_smooth
,
70 cam_velocity_constant_smooth
,
71 cam_velocity_influence_smooth
;
73 v3f cam_land_punch
, cam_land_punch_v
;
75 ent_gate
*gate_waiting
;
81 * --------------------------------------------------
84 struct player_avatar
*playeravatar
;
85 struct player_ragdoll ragdoll
;
86 struct player_model fallback_model
;
88 u16 board_view_slot
, playermodel_view_slot
;
90 player_pose holdout_pose
;
93 struct board_pose board_pose
;
97 * ----------------------------------------------------
99 int rewinding
, rewind_sound_wait
;
108 ent_gate
*rewind_gate
;
110 float rewind_total_length
, rewind_predicted_time
,
112 double rewind_start
, rewind_time
;
116 * -------------------------------------------------
118 replay_buffer replay
;
122 * -------------------------------------------------
125 enum player_subsystem
129 struct player_skate _skate
;
130 struct player_walk _walk
;
131 struct player_dead _dead
;
132 struct player_drive _drive
;
138 * ---------------------------------------------------------
142 void (*_player_system_register
[])(void) =
144 player__walk_register
,
145 player__skate_register
,
151 void (*_player_bind
[])( player_instance
*player
) =
160 void (*_player_reset
[])( player_instance
*player
, ent_spawn
*rp
) =
169 void (*_player_pre_update
[])( player_instance
*player
) =
171 player__walk_pre_update
,
172 player__skate_pre_update
,
174 player__drive_pre_update
178 void( *_player_update
[])( player_instance
*player
) =
181 player__skate_update
,
187 void( *_player_post_update
[])( player_instance
*player
) =
189 player__walk_post_update
,
190 player__skate_post_update
,
192 player__drive_post_update
196 void( *_player_im_gui
[])( player_instance
*player
) =
199 player__skate_im_gui
,
205 void( *_player_animate
[])( player_instance
*player
, player_animation
*dest
) =
207 player__walk_animate
,
208 player__skate_animate
,
209 player__dead_animate
,
210 player__drive_animate
214 void( *_player_post_animate
[])( player_instance
*player
) =
216 player__walk_post_animate
,
217 player__skate_post_animate
,
218 player__dead_post_animate
,
219 player__drive_post_animate
223 __attribute__((deprecated
))
225 void( *_player_restore
[] )( player_instance
*player
) =
227 player__walk_restore
,
228 player__skate_restore
,
234 void( *_player_store_state
[] )( player_instance
*player
) =
243 void( *_player_load_state_lerp
[] )( player_instance
*player
,
244 void *A
, void *B
, f32 t
) =
252 PLAYER_API
void player__debugtext( int size
, const char *fmt
, ... );
253 PLAYER_API
void player__create( player_instance
*inst
);
254 PLAYER_API
void player__use_avatar( player_instance
*player
,
255 struct player_avatar
*av
);
256 PLAYER_API
void player__use_mesh( player_instance
*player
, glmesh
*mesh
);
257 PLAYER_API
void player__use_texture( player_instance
*player
, vg_tex2d
*tex
);
258 PLAYER_API
void player__use_model( player_instance
*player
, u16 reg_id
);
260 PLAYER_API
void player__bind( player_instance
*player
);
261 PLAYER_API
void player__pre_update( player_instance
*player
);
262 PLAYER_API
void player__update( player_instance
*player
);
263 PLAYER_API
void player__post_update( player_instance
*player
);
265 PLAYER_API
void player__pass_gate( player_instance
*player
, ent_gate
*gate
);
266 PLAYER_API
void player__im_gui( player_instance
*player
);
267 PLAYER_API
void player__setpos( player_instance
*player
, v3f pos
);
268 PLAYER_API
void player__spawn( player_instance
*player
, ent_spawn
*rp
);
269 PLAYER_API
void player__kill( player_instance
*player
);
271 VG_STATIC
int localplayer_cmd_respawn( int argc
, const char *argv
[] );
272 VG_STATIC
void player_apply_transport_to_cam( m4x3f transport
);
274 #endif /* PLAYER_H */