X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player.c;h=3084828d38cb7a804cc205c15446d7a1525b3c9e;hb=d171c9ad5de05c9ac8563fcf9f23760b93fb50f8;hp=5bd43325c4945ac8b47df3fe2080c9518c95ce89;hpb=b35ac7383d4aba1d0b8a74be7bf1695996ff57f4;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player.c b/player.c index 5bd4332..3084828 100644 --- a/player.c +++ b/player.c @@ -11,10 +11,11 @@ #include "network.h" #include "network_common.h" #include "world_routes.h" +#include "ent_miniworld.h" 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] ); @@ -131,19 +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 ); - - if( gate->flags & k_ent_gate_nonlocal ) - world_set_active_instance( gate->target ); + + 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 ); @@ -211,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(); @@ -219,36 +213,37 @@ static void player__im_gui(void){ skaterift_replay_debug_info(); } - static void player__setpos( v3f pos ){ v3_copy( pos, localplayer.rb.co ); v3_zero( localplayer.rb.v ); rb_update_transform( &localplayer.rb ); } -static void player__spawn( ent_spawn *rp ){ +static void player__reset(void){ replay_clear( &skaterift.replay ); - player__setpos( rp->transform.co ); + + v3_zero( localplayer.rb.v ); v3_zero( localplayer.rb.w ); - q_identity( localplayer.rb.q ); - rb_update_transform( &localplayer.rb ); + + f32 l = v4_length( localplayer.rb.q ); + if( (l < 0.9f) || (l > 1.1f) ) + q_identity( localplayer.rb.q ); - q_identity( localplayer.qbasis ); - m3x3_identity( localplayer.basis ); - m3x3_identity( localplayer.invbasis ); + rb_update_transform( &localplayer.rb ); localplayer.subsystem = k_player_subsystem_walk; + player__walk_reset(); + localplayer.immobile = 0; localplayer.gate_waiting = NULL; - world_static.last_use = 0.0; - world_static.focused_entity = 0; + 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; world_entity_unfocus(); - if( player_subsystems[ localplayer.subsystem ]->reset ) - player_subsystems[ localplayer.subsystem ]->reset( rp ); - localplayer.boundary_hash ^= NETMSG_BOUNDARY_BIT; for( u32 i=0; itransform.co ); + player__reset(); }