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
);
59 #include "player_ragdoll.h"
60 #include "player_render.h"
61 #include "player_model.h"
63 /* subsystem headers */
64 #include "player_walk.h"
65 #include "player_skate.h"
66 #include "player_dead.h"
67 #include "player_drive.h"
68 #include "player_basic_info.h"
70 #include "player_replay.h"
72 #define PLAYER_REWIND_FRAMES 60*4
73 #define RESET_MAX_TIME 45.0
75 static i32 k_cinema_fixed
= 0;
76 static f32 k_cinema
= 0.0f
;
77 static i32 k_invert_y
= 0;
80 /* transform definition */
86 * ---------------------------
89 struct player_cam_controller cam_control
;
92 float cam_velocity_influence
,
93 cam_velocity_coefficient
,
94 cam_velocity_constant
,
95 cam_velocity_coefficient_smooth
,
96 cam_velocity_constant_smooth
,
97 cam_velocity_influence_smooth
;
99 v3f cam_land_punch
, cam_land_punch_v
;
100 ent_gate
*gate_waiting
;
103 int rewinded_since_last_gate
;
107 * --------------------------------------------------
111 u8 system
, priority
, id
;
112 f32 subframe
, volume
;
116 u32 sfx_buffer_count
;
120 * --------------------------------------------------
123 struct player_ragdoll ragdoll
;
124 struct player_model fallback_model
;
125 struct player_board fallback_board
;
127 u16 board_view_slot
, playermodel_view_slot
;
130 player_pose holdout_pose
;
137 * -------------------------------------------------
140 enum player_subsystem subsystem
; /* .. prev */
145 mdl_context skeleton_meta
;
146 struct skeleton skeleton
;
164 struct player_effects_data effect_data
;
166 static localplayer
= {
172 .to_world
= M4X3_IDENTITY
,
173 .to_local
= M4X3_IDENTITY
177 struct player_subsystem_interface
static *player_subsystems
[] = {
178 [k_player_subsystem_walk
] = &player_subsystem_walk
,
179 [k_player_subsystem_dead
] = &player_subsystem_dead
,
180 [k_player_subsystem_drive
] = &player_subsystem_drive
,
181 [k_player_subsystem_skate
] = &player_subsystem_skate
,
182 [k_player_subsystem_basic_info
]=&player_subsystem_basic_info
187 * ---------------------------------------------------------
190 static void player__debugtext( int size
, const char *fmt
, ... );
191 static void player__use_mesh( glmesh
*mesh
);
192 static void player__use_texture( vg_tex2d
*tex
);
193 static void player__use_model( u16 reg_id
);
195 static void player__bind(void);
196 static void player__pre_update(void);
197 static void player__update(void);
198 static void player__post_update(void);
200 static void player__pass_gate( u32 id
);
201 static void player__im_gui(void);
202 static void player__setpos( v3f pos
);
203 static void player__spawn( ent_spawn
*rp
);
204 static void player__clean_refs(void);
205 static void player__reset(void);
206 static void player__kill(void);
207 static void player__begin_holdout( v3f offset
);
209 static int localplayer_cmd_respawn( int argc
, const char *argv
[] );
210 static void player_apply_transport_to_cam( m4x3f transport
);
212 static void player__clear_sfx_buffer(void);
213 static void player__networked_sfx( u8 system
, u8 priority
, u8 id
,
214 v3f pos
, f32 volume
);
215 static void net_sfx_exchange( bitpack_ctx
*ctx
, struct net_sfx
*sfx
);
216 static void net_sfx_play( struct net_sfx
*sfx
);
218 #endif /* PLAYER_H */