X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=player.c;h=115ecf2e361b3f420d3ff8a50329e76a9b6f294b;hb=34a8df54eb962f3ad2e036355041f5bc5cabe5a0;hp=b705d7fe75d92929918d679f7162c819479b7fdd;hpb=56f320d8ce6e8997370ec8e02fe50ca2d07b67f0;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/player.c b/player.c index b705d7f..115ecf2 100644 --- a/player.c +++ b/player.c @@ -176,6 +176,11 @@ VG_STATIC void player_apply_transport_to_cam( m4x3f transport ) m4x3_expand( transport_i, transport_4 ); m4x4_mul( main_camera.mtx.pv, transport_4, main_camera.mtx.pv ); m4x4_mul( main_camera.mtx.v, transport_4, main_camera.mtx.v ); + + /* we want the regular transform here no the inversion */ + m4x3_expand( transport, transport_4 ); + m4x4_mul( gate_camera.mtx.pv, transport_4, gate_camera.mtx.pv ); + m4x4_mul( gate_camera.mtx.v, transport_4, gate_camera.mtx.v ); } __attribute__ ((deprecated)) @@ -197,22 +202,25 @@ VG_STATIC void gate_rotate_angles( teleport_gate *gate, v3f angles, v3f d ) * Applies gate transport to a player_interface */ PLAYER_API -void player__pass_gate( player_instance *player, teleport_gate *gate ) +void player__pass_gate( player_instance *player, struct gate_hit *hit ) { - player->gate_waiting = gate; + player->gate_waiting = hit->gate; - m4x3_mulv( gate->transport, player->tpv_lpf, player->tpv_lpf ); - m3x3_mulv( gate->transport, player->cam_velocity_smooth, - player->cam_velocity_smooth ); + m4x3_mulv( hit->gate->transport, player->tpv_lpf, player->tpv_lpf ); + m3x3_mulv( hit->gate->transport, player->cam_velocity_smooth, + player->cam_velocity_smooth ); m3x3_copy( player->basis, player->basis_gate ); v4f q; - m3x3_q( gate->transport, q ); + m3x3_q( hit->gate->transport, q ); q_mul( q, player->qbasis, player->qbasis ); q_normalize( player->qbasis ); q_m3x3( player->qbasis, player->basis ); m3x3_transpose( player->basis, player->invbasis ); + + if( hit->nonlocal ) + world_global.active_world = hit->nonlocal->target_map_index; } VG_STATIC void player__pre_render( player_instance *player ) @@ -316,6 +324,7 @@ PLAYER_API void player__spawn( player_instance *player, m3x3_identity( player->invbasis ); player->subsystem = k_player_subsystem_walk; + player->viewable_world = get_active_world(); if( _player_reset[ player->subsystem ] ) _player_reset[ player->subsystem ]( player, rp );