X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;ds=sidebyside;f=player.h;h=0e9be562e97b99ff8a5ec30ae3bbab32ad118b60;hb=cedb92d590f4578a246a09a96c0fa0eda109d3c7;hp=97c799ee61ca7d151999b14ca0aa5a9c38b4621d;hpb=ba5f879f85b9cab1e2b37241399d79709fe4f584;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player.h b/player.h index 97c799e..0e9be56 100644 --- a/player.h +++ b/player.h @@ -46,6 +46,7 @@ static struct gplayer /* TODO: eugh */ m3x3f gate_vr_frame, gate_vr_pstep_frame; + int on_board_frame, in_air_frame; v3f a, v_last, m, bob, vl; @@ -108,6 +109,11 @@ player = * Player API */ +static float *player_get_pos(void) +{ + return player.rb.co; +} + /* * Free camera movement @@ -811,6 +817,19 @@ static void player_do_motion(void) world_routes_activate_gate( i ); player.rb_gate_frame = player.rb; + player.in_air_frame = player.in_air; + player.on_board_frame = player.on_board; + + if( !player.on_board ) + { + v3f fwd_dir = {cosf(player.angles[0]), + 0.0f, + sinf(player.angles[0])}; + m3x3_mulv( gate->transport, fwd_dir, fwd_dir ); + + player.angles[0] = atan2f( fwd_dir[2], fwd_dir[0] ); + + } m3x3_copy( player.vr, player.gate_vr_frame ); m3x3_copy( player.vr_pstep, player.gate_vr_pstep_frame ); @@ -1214,6 +1233,41 @@ static void player_audio(void) /* Tunnel / occlusion */ audio_sample_occlusion( player.camera[3] ); + + int sprite_avail = -1; + for( int i=0; i0.0f) { player.rb = player.rb_gate_frame; + player.on_board = player.on_board_frame; + player.in_air = player.in_air_frame; m3x3_copy( player.gate_vr_frame, player.vr ); m3x3_copy( player.gate_vr_pstep_frame, player.vr_pstep ); player.is_dead = 0; player.in_air = 1; + + + if( !player.on_board ) + { + player.angles[0] = atan2f( -player.rb.forward[2], + -player.rb.forward[0] ); + } + m3x3_identity( player.vr ); player.mdl.shoes[0] = 1;