5 #include "player_common.h"
6 #include "network_compression.h"
9 k_player_subsystem_walk
= 0,
10 k_player_subsystem_skate
= 1,
11 k_player_subsystem_dead
= 2,
12 k_player_subsystem_drive
= 3,
13 k_player_subsystem_max
,
14 k_player_subsystem_invalid
= 255
17 struct player_cam_controller
{
19 k_cam_firstperson
= 1,
23 f32 camera_type_blend
;
25 v3f fpv_offset
, /* expressed relative to rigidbody */
28 fpv_viewpoint
, /* expressed relative to neck bone inverse final*/
36 struct player_subsystem_interface
{
37 void(*system_register
)(void);
39 void(*pre_update
)(void);
41 void(*post_update
)(void);
44 void(*pose
)( void *animator
, player_pose
*pose
);
45 void(*post_animate
)(void);
46 void(*network_animator_exchange
)( bitpack_ctx
*ctx
, void *data
);
47 void(*sfx_oneshot
)( u8 id
, v3f pos
, f32 volume
);
55 #include "player_ragdoll.h"
56 #include "player_render.h"
57 #include "player_model.h"
58 #include "player_walk.h"
59 #include "player_skate.h"
60 #include "player_dead.h"
61 #include "player_drive.h"
62 #include "player_replay.h"
64 #define PLAYER_REWIND_FRAMES 60*4
65 #define RESET_MAX_TIME 45.0
67 static i32 k_cinema_fixed
= 0;
68 static f32 k_cinema
= 0.0f
;
69 static i32 k_invert_y
= 0;
72 /* transform definition */
78 m3x3f basis
, invbasis
, basis_gate
;
79 world_instance
*viewable_world
;
84 * ---------------------------
87 struct player_cam_controller cam_control
;
90 float cam_velocity_influence
,
91 cam_velocity_coefficient
,
92 cam_velocity_constant
,
93 cam_velocity_coefficient_smooth
,
94 cam_velocity_constant_smooth
,
95 cam_velocity_influence_smooth
;
97 v3f cam_land_punch
, cam_land_punch_v
;
98 ent_gate
*gate_waiting
;
103 * --------------------------------------------------
107 u8 system
, priority
, id
;
108 f32 subframe
, volume
;
112 u32 sfx_buffer_count
;
116 * --------------------------------------------------
119 struct player_ragdoll ragdoll
;
120 struct player_model fallback_model
;
122 u16 board_view_slot
, playermodel_view_slot
;
125 player_pose holdout_pose
;
132 * -------------------------------------------------
135 enum player_subsystem subsystem
; /* .. prev */
140 mdl_context skeleton_meta
;
141 struct skeleton skeleton
;
158 static localplayer
= {
164 .to_world
= M4X3_IDENTITY
,
165 .to_local
= M4X3_IDENTITY
169 struct player_subsystem_interface
static *player_subsystems
[] = {
170 [k_player_subsystem_walk
] = &player_subsystem_walk
,
171 [k_player_subsystem_dead
] = &player_subsystem_dead
,
172 [k_player_subsystem_drive
] = &player_subsystem_drive
,
173 [k_player_subsystem_skate
] = &player_subsystem_skate
178 * ---------------------------------------------------------
181 static void player__debugtext( int size
, const char *fmt
, ... );
182 static void player__use_mesh( glmesh
*mesh
);
183 static void player__use_texture( vg_tex2d
*tex
);
184 static void player__use_model( u16 reg_id
);
186 static void player__bind(void);
187 static void player__pre_update(void);
188 static void player__update(void);
189 static void player__post_update(void);
191 static void player__pass_gate( u32 id
);
192 static void player__im_gui(void);
193 static void player__setpos( v3f pos
);
194 static void player__spawn( ent_spawn
*rp
);
195 static void player__reset(void);
196 static void player__kill(void);
197 static void player__begin_holdout( v3f offset
);
199 static int localplayer_cmd_respawn( int argc
, const char *argv
[] );
200 static void player_apply_transport_to_cam( m4x3f transport
);
202 static void player__clear_sfx_buffer(void);
203 static void player__networked_sfx( u8 system
, u8 priority
, u8 id
,
204 v3f pos
, f32 volume
);
205 static void net_sfx_exchange( bitpack_ctx
*ctx
, struct net_sfx
*sfx
);
206 static void net_sfx_play( struct net_sfx
*sfx
);
208 #endif /* PLAYER_H */