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
33 void(*system_register
)(void);
35 void(*pre_update
)(void);
37 void(*post_update
)(void);
38 void(*im_gui
)( ui_context
*ctx
);
40 void(*pose
)( void *animator
, player_pose
*pose
);
41 void(*effects
)( void *animator
, m4x3f
*final_mtx
, struct player_board
*board
,
42 struct player_effects_data
*effect_data
);
43 void(*post_animate
)(void);
45 void(*network_animator_exchange
)( bitpack_ctx
*ctx
, void *data
);
46 void(*sfx_oneshot
)( u8 id
, v3f pos
, f32 volume
);
48 void(*sfx_comp
)(void *animator
);
49 void(*sfx_kill
)(void);
57 #define PLAYER_REWIND_FRAMES 60*4
58 #define RESET_MAX_TIME 45.0
60 extern i32 k_invert_y
;
63 /* transform definition */
67 bool have_glider
, glider_orphan
, drowned
;
71 * ---------------------------
74 struct player_cam_controller cam_control
;
77 float cam_velocity_influence
,
78 cam_velocity_coefficient
,
79 cam_velocity_constant
,
80 cam_velocity_coefficient_smooth
,
81 cam_velocity_constant_smooth
,
82 cam_velocity_influence_smooth
,
86 v3f cam_land_punch
, cam_land_punch_v
;
87 ent_gate
*gate_waiting
;
88 int deferred_frame_record
;
92 int rewinded_since_last_gate
;
96 * --------------------------------------------------
100 u8 system
, priority
, id
;
101 f32 subframe
, volume
;
104 sfx_buffer
[4], /* large timeframe 1/10s; for networking */
105 local_sfx_buffer
[2]; /* per framerate 1/30s; for replay */
106 u32 sfx_buffer_count
,
107 local_sfx_buffer_count
;
111 * --------------------------------------------------
114 struct player_ragdoll ragdoll
;
115 struct player_model fallback_model
;
116 struct player_board fallback_board
;
118 u16 board_view_slot
, playermodel_view_slot
;
121 player_pose holdout_pose
;
128 * -------------------------------------------------
131 enum player_subsystem subsystem
,
137 mdl_context skeleton_meta
;
138 struct skeleton skeleton
;
159 u8 skeleton_mirror
[32];
161 struct player_effects_data effect_data
;
164 extern struct player_subsystem_interface
*player_subsystems
[];
168 * ---------------------------------------------------------
171 void player_init(void);
172 void player__debugtext( ui_context
*ctx
, int size
, const char *fmt
, ... );
173 void player__use_mesh( glmesh
*mesh
);
174 void player__use_model( u16 reg_id
);
176 void player__bind(void);
177 void player__pre_update(void);
178 void player__update(void);
179 void player__post_update(void);
181 void player__pass_gate( u32 id
);
182 void player__im_gui( ui_context
*ctx
);
183 void player__setpos( v3f pos
);
184 void player__spawn( ent_spawn
*rp
);
185 void player__clean_refs(void);
186 void player__reset(void);
187 void player__kill(void);
188 void player__begin_holdout( v3f offset
);
190 int localplayer_cmd_respawn( int argc
, const char *argv
[] );
191 void player_apply_transport_to_cam( m4x3f transport
);
193 void player__clear_sfx_buffer(void);
194 void player__networked_sfx( u8 system
, u8 priority
, u8 id
,
195 v3f pos
, f32 volume
);
196 void net_sfx_exchange( bitpack_ctx
*ctx
, struct net_sfx
*sfx
);
197 void net_sfx_play( struct net_sfx
*sfx
);