chaos pt 2
[carveJwlIkooP6JGAAIwe30JlM.git] / player.c
index 348bb744d540b8ec4d0c3814a72c864a86c5b208..3084828d38cb7a804cc205c15446d7a1525b3c9e 100644 (file)
--- a/player.c
+++ b/player.c
@@ -15,7 +15,7 @@
 
 static int localplayer_cmd_respawn( int argc, const char *argv[] ){
    ent_spawn *rp = NULL, *r;
-   world_instance *world = localplayer.viewable_world;
+   world_instance *world = world_current_instance();
 
    if( argc == 1 ){
       rp = world_find_spawn_by_name( world, argv[0] );
@@ -132,16 +132,13 @@ static void player__pass_gate( u32 id ){
    m4x3_mulv( gate->transport, cc->tpv_lpf, cc->tpv_lpf );
    m3x3_mulv( gate->transport, cc->cam_velocity_smooth, 
                                cc->cam_velocity_smooth );
-   m3x3_copy( localplayer.basis, localplayer.basis_gate );
-
-   v4f q;
-   m3x3_q( gate->transport, q );
-   q_mul( q, localplayer.qbasis, localplayer.qbasis );
-   q_normalize( localplayer.qbasis );
-   q_m3x3( localplayer.qbasis, localplayer.basis );
-   m3x3_transpose( localplayer.basis, localplayer.invbasis );
 
    m4x3_mulv( gate->transport, localplayer.cam.pos, localplayer.cam.pos );
+   
+   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 );
@@ -209,7 +206,6 @@ static void player__im_gui(void){
 
    player__debugtext( 2, "player" );
    player__debugtext( 1, "angles: " PRINTF_v3f( localplayer.cam.angles ) );
-   player__debugtext( 1, "basis:  " PRINTF_v4f( localplayer.qbasis ) );
 
    if( player_subsystems[ localplayer.subsystem ]->im_gui )
       player_subsystems[ localplayer.subsystem ]->im_gui();
@@ -235,23 +231,17 @@ static void player__reset(void){
 
    rb_update_transform( &localplayer.rb );
 
-   q_identity( localplayer.qbasis );
-   m3x3_identity( localplayer.basis );
-   m3x3_identity( localplayer.invbasis );
-
    localplayer.subsystem = k_player_subsystem_walk;
    player__walk_reset();
 
    localplayer.immobile = 0;
    localplayer.gate_waiting = NULL;
-   localplayer.viewable_world = world_current_instance();
 
    world_static.challenge_target = NULL;
    world_static.challenge_timer = 0.0f;
    world_static.focused_entity = 0;
    world_static.active_trigger_volume_count = 0;
    world_static.last_use = 0.0;
-   global_miniworld.active_id = 0;
    world_entity_unfocus();
 
    localplayer.boundary_hash ^= NETMSG_BOUNDARY_BIT;
@@ -262,6 +252,8 @@ static void player__reset(void){
          world_routes_clear( instance );
       }
    }
+
+   v3_copy( localplayer.rb.co, localplayer.cam_control.tpv_lpf );
 }
 
 static void player__spawn( ent_spawn *rp ){