5 #include "player_common.h"
6 #include "network_compression.h"
7 #include "player_effects.h"
10 k_player_subsystem_walk
= 0,
11 k_player_subsystem_skate
= 1,
12 k_player_subsystem_dead
= 2,
13 k_player_subsystem_drive
= 3,
14 k_player_subsystem_basic_info
= 4,
15 k_player_subsystem_max
,
16 k_player_subsystem_invalid
= 255
19 struct player_cam_controller
{
21 k_cam_firstperson
= 1,
25 f32 camera_type_blend
;
27 v3f fpv_offset
, /* expressed relative to rigidbody */
30 fpv_viewpoint
, /* expressed relative to neck bone inverse final*/
38 struct player_subsystem_interface
{
39 void(*system_register
)(void);
41 void(*pre_update
)(void);
43 void(*post_update
)(void);
46 void(*pose
)( void *animator
, player_pose
*pose
);
47 void(*effects
)( void *animator
, m4x3f
*final_mtx
, struct player_board
*board
,
48 struct player_effects_data
*effect_data
);
49 void(*post_animate
)(void);
50 void(*network_animator_exchange
)( bitpack_ctx
*ctx
, void *data
);
51 void(*sfx_oneshot
)( u8 id
, v3f pos
, f32 volume
);
53 void(*sfx_comp
)(void *animator
);
54 void(*sfx_kill
)(void);
62 #include "player_ragdoll.h"
63 #include "player_render.h"
64 #include "player_model.h"
66 /* subsystem headers */
67 #include "player_walk.h"
68 #include "player_skate.h"
69 #include "player_dead.h"
70 #include "player_drive.h"
71 #include "player_basic_info.h"
73 #include "player_replay.h"
75 #define PLAYER_REWIND_FRAMES 60*4
76 #define RESET_MAX_TIME 45.0
78 static i32 k_cinema_fixed
= 0;
79 static f32 k_cinema
= 0.0f
;
80 static i32 k_invert_y
= 0;
83 /* transform definition */
89 * ---------------------------
92 struct player_cam_controller cam_control
;
95 float cam_velocity_influence
,
96 cam_velocity_coefficient
,
97 cam_velocity_constant
,
98 cam_velocity_coefficient_smooth
,
99 cam_velocity_constant_smooth
,
100 cam_velocity_influence_smooth
;
102 v3f cam_land_punch
, cam_land_punch_v
;
103 ent_gate
*gate_waiting
;
104 int deferred_frame_record
;
108 int rewinded_since_last_gate
;
112 * --------------------------------------------------
116 u8 system
, priority
, id
;
117 f32 subframe
, volume
;
121 u32 sfx_buffer_count
;
125 * --------------------------------------------------
128 struct player_ragdoll ragdoll
;
129 struct player_model fallback_model
;
130 struct player_board fallback_board
;
132 u16 board_view_slot
, playermodel_view_slot
;
135 player_pose holdout_pose
;
142 * -------------------------------------------------
145 enum player_subsystem subsystem
; /* .. prev */
150 mdl_context skeleton_meta
;
151 struct skeleton skeleton
;
172 u8 skeleton_mirror
[32];
174 struct player_effects_data effect_data
;
176 static localplayer
= {
182 .to_world
= M4X3_IDENTITY
,
183 .to_local
= M4X3_IDENTITY
187 struct player_subsystem_interface
static *player_subsystems
[] = {
188 [k_player_subsystem_walk
] = &player_subsystem_walk
,
189 [k_player_subsystem_dead
] = &player_subsystem_dead
,
190 [k_player_subsystem_drive
] = &player_subsystem_drive
,
191 [k_player_subsystem_skate
] = &player_subsystem_skate
,
192 [k_player_subsystem_basic_info
]=&player_subsystem_basic_info
197 * ---------------------------------------------------------
200 static void player__debugtext( int size
, const char *fmt
, ... );
201 static void player__use_mesh( glmesh
*mesh
);
202 static void player__use_texture( vg_tex2d
*tex
);
203 static void player__use_model( u16 reg_id
);
205 static void player__bind(void);
206 static void player__pre_update(void);
207 static void player__update(void);
208 static void player__post_update(void);
210 static void player__pass_gate( u32 id
);
211 static void player__im_gui(void);
212 static void player__setpos( v3f pos
);
213 static void player__spawn( ent_spawn
*rp
);
214 static void player__clean_refs(void);
215 static void player__reset(void);
216 static void player__kill(void);
217 static void player__begin_holdout( v3f offset
);
219 static int localplayer_cmd_respawn( int argc
, const char *argv
[] );
220 static void player_apply_transport_to_cam( m4x3f transport
);
222 static void player__clear_sfx_buffer(void);
223 static void player__networked_sfx( u8 system
, u8 priority
, u8 id
,
224 v3f pos
, f32 volume
);
225 static void net_sfx_exchange( bitpack_ctx
*ctx
, struct net_sfx
*sfx
);
226 static void net_sfx_play( struct net_sfx
*sfx
);
228 #endif /* PLAYER_H */