+/*
+ * Applies gate transport to a player_interface
+ */
+static void player__pass_gate( u32 id ){
+ world_instance *world = world_current_instance();
+
+ /* update boundary hash (network animation) */
+ u16 index = mdl_entity_id_id(id) & ~NETMSG_BOUNDARY_MASK;
+ localplayer.boundary_hash ^= NETMSG_GATE_BOUNDARY_BIT;
+ localplayer.boundary_hash &= ~NETMSG_BOUNDARY_MASK;
+ localplayer.boundary_hash |= index;
+
+ ent_gate *gate = mdl_arritm( &world->ent_gate, mdl_entity_id_id(id) );
+ world_routes_fracture( world, gate, localplayer.rb.co, localplayer.rb.v );
+
+ localplayer.gate_waiting = gate;
+
+ struct player_cam_controller *cc = &localplayer.cam_control;
+ m4x3_mulv( gate->transport, cc->tpv_lpf, cc->tpv_lpf );
+ m3x3_mulv( gate->transport, cc->cam_velocity_smooth,
+ cc->cam_velocity_smooth );
+
+ m4x3_mulv( gate->transport, localplayer.cam.pos, localplayer.cam.pos );
+
+ if( gate->flags & k_ent_gate_nonlocal ){
+ /* FIXME: Code dupe with world_load.c */
+ ent_spawn *rp = world_find_spawn_by_name( world, "start" );
+ if( !rp ) rp = world_find_closest_spawn( world, (v3f){0.0f,0.0f,0.0f} );
+ /* TODO: fallback to searching for a safe location using raycasts */
+ assert(rp);
+ v3_copy( rp->transform.co, world->player_co );
+
+ world_static.active_instance = gate->target;
+ player__clean_refs();
+ }
+ else
+ world_routes_activate_entry_gate( world, gate );
+
+ v3f v0;
+ v3_angles_vector( localplayer.angles, v0 );
+ m3x3_mulv( gate->transport, v0, v0 );
+ v3_angles( v0, localplayer.angles );
+
+ audio_lock();
+ audio_oneshot( &audio_gate_pass, 1.0f, 0.0f );
+ audio_unlock();
+
+ replay_clear( &skaterift.replay );