4 #include "player_ragdoll.h"
5 #include "player_render.h"
6 #include "player_model.h"
7 #include "player_common.h"
8 #include "player_walk.h"
9 #include "player_skate.h"
10 #include "player_dead.h"
11 #include "player_drive.h"
13 #define PLAYER_REWIND_FRAMES 60*4
14 #define RESET_MAX_TIME 45.0
16 static i32 k_cinema_fixed
= 0;
17 static f32 k_cinema
= 0.0f
;
18 static i32 k_invert_y
= 0;
20 struct player_instance
{
21 /* transform definition */
22 rigidbody rb
, rb_gate_storage
;
23 v3f angles
, angles_storage
;
26 m3x3f basis
, invbasis
, basis_gate
;
27 world_instance
*viewable_world
;
31 * ---------------------------
36 k_cam_firstperson
= 1,
40 float camera_type_blend
;
42 v3f fpv_offset
, /* expressed relative to rigidbody */
45 fpv_viewpoint
, /* expressed relative to neck bone inverse final */
53 v3f cam_override_angles
;
54 float cam_override_fov
;
55 float cam_override_strength
;
58 float cam_velocity_influence
,
59 cam_velocity_coefficient
,
60 cam_velocity_constant
,
61 cam_velocity_coefficient_smooth
,
62 cam_velocity_constant_smooth
,
63 cam_velocity_influence_smooth
;
65 v3f cam_land_punch
, cam_land_punch_v
;
67 ent_gate
*gate_waiting
;
73 * --------------------------------------------------
76 struct player_avatar
*playeravatar
;
77 struct player_ragdoll ragdoll
;
78 struct player_model fallback_model
;
80 u16 board_view_slot
, playermodel_view_slot
;
82 player_pose holdout_pose
;
85 struct board_pose board_pose
;
89 * ----------------------------------------------------
91 int rewinding
, rewind_sound_wait
;
100 ent_gate
*rewind_gate
;
102 float rewind_total_length
, rewind_predicted_time
,
104 double rewind_start
, rewind_time
;
108 * -------------------------------------------------
111 enum player_subsystem
{
112 k_player_subsystem_walk
= 0,
113 k_player_subsystem_skate
= 1,
114 k_player_subsystem_dead
= 2,
115 k_player_subsystem_drive
= 3
120 struct player_skate _skate
;
121 struct player_walk _walk
;
122 struct player_dead _dead
;
123 struct player_drive _drive
;
129 * ---------------------------------------------------------
133 void (*_player_system_register
[])(void) =
135 player__walk_register
,
136 player__skate_register
,
142 void (*_player_bind
[])( player_instance
*player
) =
151 void (*_player_reset
[])( player_instance
*player
, ent_spawn
*rp
) =
160 void (*_player_pre_update
[])( player_instance
*player
) =
162 player__walk_pre_update
,
163 player__skate_pre_update
,
165 player__drive_pre_update
169 void( *_player_update
[])( player_instance
*player
) =
172 player__skate_update
,
178 void( *_player_post_update
[])( player_instance
*player
) =
180 player__walk_post_update
,
181 player__skate_post_update
,
183 player__drive_post_update
187 void( *_player_im_gui
[])( player_instance
*player
) =
190 player__skate_im_gui
,
196 void( *_player_animate
[])( player_instance
*player
, player_animation
*dest
) =
198 player__walk_animate
,
199 player__skate_animate
,
200 player__dead_animate
,
201 player__drive_animate
205 void( *_player_post_animate
[])( player_instance
*player
) =
207 player__walk_post_animate
,
208 player__skate_post_animate
,
209 player__dead_post_animate
,
210 player__drive_post_animate
214 void( *_player_restore
[] )( player_instance
*player
) =
216 player__walk_restore
,
217 player__skate_restore
,
222 PLAYER_API
void player__debugtext( int size
, const char *fmt
, ... );
223 PLAYER_API
void player__create( player_instance
*inst
);
224 PLAYER_API
void player__use_avatar( player_instance
*player
,
225 struct player_avatar
*av
);
226 PLAYER_API
void player__use_mesh( player_instance
*player
, glmesh
*mesh
);
227 PLAYER_API
void player__use_texture( player_instance
*player
, vg_tex2d
*tex
);
228 PLAYER_API
void player__use_model( player_instance
*player
, u16 reg_id
);
230 PLAYER_API
void player__bind( player_instance
*player
);
231 PLAYER_API
void player__pre_update( player_instance
*player
);
232 PLAYER_API
void player__update( player_instance
*player
);
233 PLAYER_API
void player__post_update( player_instance
*player
);
235 PLAYER_API
void player__pass_gate( player_instance
*player
, ent_gate
*gate
);
236 PLAYER_API
void player__im_gui( player_instance
*player
);
237 PLAYER_API
void player__setpos( player_instance
*player
, v3f pos
);
238 PLAYER_API
void player__spawn( player_instance
*player
, ent_spawn
*rp
);
239 PLAYER_API
void player__kill( player_instance
*player
);
241 VG_STATIC
int localplayer_cmd_respawn( int argc
, const char *argv
[] );
242 VG_STATIC
void player_apply_transport_to_cam( m4x3f transport
);
244 #endif /* PLAYER_H */