+ f32 l = v4_length( localplayer.rb.q );
+ if( (l < 0.9f) || (l > 1.1f) )
+ q_identity( localplayer.rb.q );
+
+ rb_update_transform( &localplayer.rb );
+
+ localplayer.subsystem = k_player_subsystem_walk;
+ player__walk_reset();
+
+ localplayer.immobile = 0;
+ localplayer.gate_waiting = NULL;
+
+ v3_copy( localplayer.rb.co, localplayer.cam_control.tpv_lpf );
+ player__clean_refs();
+}
+
+static void player__spawn( ent_spawn *rp ){
+ player__setpos( rp->transform.co );
+ player__reset();
+}
+
+
+static void player__kill(void){
+}
+
+static void player__begin_holdout( v3f offset ){
+ memcpy( &localplayer.holdout_pose, &localplayer.pose,
+ sizeof(localplayer.pose) );
+ v3_copy( offset, localplayer.holdout_pose.root_co );
+ localplayer.holdout_time = 1.0f;
+}
+
+static void net_sfx_exchange( bitpack_ctx *ctx, struct net_sfx *sfx ){
+ bitpack_bytes( ctx, 1, &sfx->system );
+ bitpack_bytes( ctx, 1, &sfx->priority );
+ bitpack_bytes( ctx, 1, &sfx->id );
+ bitpack_qf32( ctx, 8, 0.0f, 1.0f, &sfx->subframe );
+ bitpack_qf32( ctx, 8, 0.0f, 1.0f, &sfx->volume );
+ bitpack_qv3f( ctx, 16, -1024.0f, 1024.0f, sfx->location );
+}
+
+static void net_sfx_play( struct net_sfx *sfx ){
+ if( sfx->system < k_player_subsystem_max ){
+ struct player_subsystem_interface *sys = player_subsystems[sfx->system];
+ if( sys->sfx_oneshot ){
+ sys->sfx_oneshot( sfx->id, sfx->location, sfx->volume );
+ }
+ }
+};
+
+static void player__networked_sfx( u8 system, u8 priority, u8 id,
+ v3f pos, f32 volume ){
+ struct net_sfx null, *sfx = &null;
+
+ if( localplayer.sfx_buffer_count < vg_list_size(localplayer.sfx_buffer) )
+ sfx = &localplayer.sfx_buffer[ localplayer.sfx_buffer_count ++ ];
+ else {
+ for( u32 i=0; i<vg_list_size(localplayer.sfx_buffer); i++ ){
+ struct net_sfx *a = &localplayer.sfx_buffer[i];
+ if( a->priority < priority ){
+ sfx = a;
+ break;
+ }
+ }
+ }
+
+ sfx->id = id;
+ sfx->priority = priority;
+ sfx->volume = volume;
+ v3_copy( pos, sfx->location );
+ sfx->system = system;
+
+ f32 t = (vg.time_real - network_client.last_frame) / NETWORK_FRAMERATE;
+ sfx->subframe = vg_clampf( t, 0.0f, 1.0f );
+
+ net_sfx_play( sfx );
+}
+
+static void player__clear_sfx_buffer(void){
+ localplayer.sfx_buffer_count = 0;