#include "input.h"
#include "world.h"
#include "audio.h"
+#include "player_replay.h"
VG_STATIC int localplayer_cmd_respawn( int argc, const char *argv[] )
{
PLAYER_API
void player__pre_update( player_instance *player ){
- if( button_down( k_srbind_reset ) && !player->immobile ){
- if( player->subsystem == k_player_subsystem_dead ){
- localplayer_cmd_respawn( 0, NULL );
- }
- else{
- /* cant do that */
- audio_lock();
- audio_oneshot( &audio_rewind[4], 1.0f, 0.0f );
- audio_unlock();
- }
- }
-
if( button_down( k_srbind_camera ) && !player->immobile ){
if( player->cam_control.camera_mode == k_cam_firstperson )
player->cam_control.camera_mode = k_cam_thirdperson;
m4x3_mulv( gate->transport, player->cam.pos, player->cam.pos );
- if( gate->type == k_gate_type_nonlocel )
- world_static.active_world = gate->target;
-
- world_volumes.inside = 0;
+ if( gate->flags & k_ent_gate_nonlocal )
+ world_set_active_instance( gate->target );
audio_lock();
audio_oneshot( &audio_gate_pass, 1.0f, 0.0f );
audio_unlock();
+
+ replay_clear( &skaterift.replay );
}
VG_STATIC void player_apply_transport_to_cam( m4x3f transport )
{
- /* FIXME: Applies to main_camera directly! */
+ /* FIXME: Applies to skaterift.cam directly! */
/* Pre-emptively edit the camera matrices so that the motion vectors
* are correct */
m4x4f transport_4;
m4x3_invert_affine( transport, transport_i );
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 );
+ m4x4_mul( skaterift.cam.mtx.pv, transport_4, skaterift.cam.mtx.pv );
+ m4x4_mul( skaterift.cam.mtx.v, transport_4, skaterift.cam.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 );
+ m4x4_mul( world_gates.cam.mtx.pv, transport_4, world_gates.cam.mtx.pv );
+ m4x4_mul( world_gates.cam.mtx.v, transport_4, world_gates.cam.mtx.v );
}
__attribute__ ((deprecated))
g_player_debugger[0] = box[0];
g_player_debugger[1] = 0;
g_player_debugger[2] = 300;
- g_player_debugger[3] = 16;
-
+ g_player_debugger[3] = 32;
+
+ player__debugtext( 2, "instance #%u", world_static.active_instance );
+
+ char buf_hub[96],
+ buf_client[96];
+ if( world_static.addon_client )
+ addon_alias_uid( &world_static.addon_client->alias, buf_client );
+ else
+ strcpy( buf_client, "none" );
+
+ if( world_static.addon_hub )
+ addon_alias_uid( &world_static.addon_hub->alias, buf_hub );
+ else
+ strcpy( buf_hub, "none" );
+
+ player__debugtext( 1, "hub uid: %s", buf_hub );
+ player__debugtext( 1, "client uid: %s", buf_client );
+ player__debugtext( 2, "director" );
+ player__debugtext( 1, "activity: %s",
+ (const char *[]){ [k_skaterift_menu] = "menu",
+ [k_skaterift_replay] = "replay",
+ [k_skaterift_ent_focus] = "ent_focus",
+ [k_skaterift_default] = "default",
+ [k_skaterift_respawning]= "respawning",
+ } [skaterift.activity] );
+ player__debugtext( 1, "time_rate: %.4f", skaterift.time_rate );
+
+ player__debugtext( 2, "player_instance[%p]", player );
player__debugtext( 1, "angles: " PRINTF_v3f( player->cam.angles ) );
player__debugtext( 1, "basis: " PRINTF_v4f( player->qbasis ) );
if( _player_im_gui[ player->subsystem ] )
_player_im_gui[ player->subsystem ]( player );
- replay_debug_info( player );
+ skaterift_replay_debug_info();
}
-VG_STATIC void global_skateshop_exit(void);
PLAYER_API void player__setpos( player_instance *player, v3f pos ){
v3_copy( pos, player->rb.co );
}
PLAYER_API void player__spawn( player_instance *player, ent_spawn *rp ){
+ replay_clear( &skaterift.replay );
player__setpos( player, rp->transform.co );
v3_zero( player->rb.w );
q_identity( player->rb.q );
player->immobile = 0;
player->gate_waiting = NULL;
world_static.last_use = 0.0;
-
- global_skateshop_exit();
+ world_static.focused_entity = 0;
+ world_static.challenge_target = NULL;
+ world_static.challenge_timer = 0.0f;
+ world_entity_unfocus();
+
+ for( u32 i=0; i<vg_list_size(world_static.instances); i++ ){
+ world_instance *instance = &world_static.instances[i];
+ if( instance->status == k_world_status_loaded ){
+ world_routes_clear( instance );
+ }
+ }
if( _player_reset[ player->subsystem ] )
_player_reset[ player->subsystem ]( player, rp );
}
+PLAYER_API void player__begin_holdout( player_instance *player ){
+ memcpy( &player->holdout_pose, &player->pose, sizeof(player->pose) );
+ player->holdout_time = 1.0f;
+}
+
/* implementation */
#include "player_common.c"
#include "player_walk.c"