+
+void player__kill(void)
+{
+}
+
+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;
+}
+
+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 );
+}
+
+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 struct net_sfx *find_lower_priority_sfx( struct net_sfx *buffer, u32 len,
+ u32 *count, u8 priority ){
+ struct net_sfx *p_sfx = NULL;
+ if( *count < len ){
+ p_sfx = &buffer[ *count ];
+ *count = *count+1;
+ }
+ else {
+ for( u32 i=0; i<len; i++ ){
+ struct net_sfx *a = &buffer[i];
+ if( a->priority < priority ){
+ p_sfx = a;
+ break;
+ }
+ }
+ }
+
+ return p_sfx;
+}
+
+void player__networked_sfx( u8 system, u8 priority, u8 id,
+ v3f pos, f32 volume )
+{
+ struct net_sfx sfx,
+ *p_net = find_lower_priority_sfx(
+ localplayer.sfx_buffer, 4,
+ &localplayer.sfx_buffer_count, priority ),
+ *p_replay = find_lower_priority_sfx(
+ localplayer.local_sfx_buffer, 2,
+ &localplayer.local_sfx_buffer_count, priority );
+
+ sfx.id = id;
+ sfx.priority = priority;
+ sfx.volume = volume;
+ v3_copy( pos, sfx.location );
+ sfx.system = system;
+
+ /* we only care about subframe in networked sfx. local replays run at a
+ * high enough framerate. */
+ f32 t = (vg.time_real - network_client.last_frame) / NETWORK_FRAMERATE;
+ sfx.subframe = vg_clampf( t, 0.0f, 1.0f );
+
+ if( p_net ) *p_net = sfx;
+ if( p_replay ) *p_replay = sfx;
+
+ net_sfx_play( &sfx );
+}