2 #include "vg/vg_platform.h"
4 struct player_cam_controller
{
10 f32 camera_type_blend
;
12 v3f fpv_offset
, /* expressed relative to rigidbody */
15 fpv_viewpoint
, /* expressed relative to neck bone inverse final*/
23 #include "player_common.h"
24 #include "network_compression.h"
25 #include "player_effects.h"
26 #include "player_api.h"
27 #include "player_ragdoll.h"
28 #include "player_model.h"
29 #include "player_render.h"
31 struct player_subsystem_interface
{
32 void(*system_register
)(void);
34 void(*pre_update
)(void);
36 void(*post_update
)(void);
39 void(*pose
)( void *animator
, player_pose
*pose
);
40 void(*effects
)( void *animator
, m4x3f
*final_mtx
, struct player_board
*board
,
41 struct player_effects_data
*effect_data
);
42 void(*post_animate
)(void);
44 void(*network_animator_exchange
)( bitpack_ctx
*ctx
, void *data
);
45 void(*sfx_oneshot
)( u8 id
, v3f pos
, f32 volume
);
47 void(*sfx_comp
)(void *animator
);
48 void(*sfx_kill
)(void);
56 #define PLAYER_REWIND_FRAMES 60*4
57 #define RESET_MAX_TIME 45.0
59 extern i32 k_invert_y
;
62 /* transform definition */
66 bool have_glider
, glider_orphan
, drowned
;
70 * ---------------------------
73 struct player_cam_controller cam_control
;
76 float cam_velocity_influence
,
77 cam_velocity_coefficient
,
78 cam_velocity_constant
,
79 cam_velocity_coefficient_smooth
,
80 cam_velocity_constant_smooth
,
81 cam_velocity_influence_smooth
,
85 v3f cam_land_punch
, cam_land_punch_v
;
86 ent_gate
*gate_waiting
;
87 int deferred_frame_record
;
91 int rewinded_since_last_gate
;
95 * --------------------------------------------------
99 u8 system
, priority
, id
;
100 f32 subframe
, volume
;
103 sfx_buffer
[4], /* large timeframe 1/10s; for networking */
104 local_sfx_buffer
[2]; /* per framerate 1/30s; for replay */
105 u32 sfx_buffer_count
,
106 local_sfx_buffer_count
;
110 * --------------------------------------------------
113 struct player_ragdoll ragdoll
;
114 struct player_model fallback_model
;
115 struct player_board fallback_board
;
117 u16 board_view_slot
, playermodel_view_slot
;
120 player_pose holdout_pose
;
127 * -------------------------------------------------
130 enum player_subsystem subsystem
,
136 mdl_context skeleton_meta
;
137 struct skeleton skeleton
;
158 u8 skeleton_mirror
[32];
160 struct player_effects_data effect_data
;
163 extern struct player_subsystem_interface
*player_subsystems
[];
167 * ---------------------------------------------------------
170 void player_init(void);
171 void player__debugtext( int size
, const char *fmt
, ... );
172 void player__use_mesh( glmesh
*mesh
);
173 void player__use_model( u16 reg_id
);
175 void player__bind(void);
176 void player__pre_update(void);
177 void player__update(void);
178 void player__post_update(void);
180 void player__pass_gate( u32 id
);
181 void player__im_gui(void);
182 void player__setpos( v3f pos
);
183 void player__spawn( ent_spawn
*rp
);
184 void player__clean_refs(void);
185 void player__reset(void);
186 void player__kill(void);
187 void player__begin_holdout( v3f offset
);
189 int localplayer_cmd_respawn( int argc
, const char *argv
[] );
190 void player_apply_transport_to_cam( m4x3f transport
);
192 void player__clear_sfx_buffer(void);
193 void player__networked_sfx( u8 system
, u8 priority
, u8 id
,
194 v3f pos
, f32 volume
);
195 void net_sfx_exchange( bitpack_ctx
*ctx
, struct net_sfx
*sfx
);
196 void net_sfx_play( struct net_sfx
*sfx
);