From: hgn Date: Mon, 29 May 2023 03:03:04 +0000 (+0100) Subject: on your marks, get set, bake X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=219e917c414052ad3adbb4e9a652b55757a7b6a9;hp=7fb47c3eb672f4468da8b5b452c09d44e1389d5f;p=carveJwlIkooP6JGAAIwe30JlM.git on your marks, get set, bake --- diff --git a/gui.h b/gui.h index e4d0068..238d0fb 100644 --- a/gui.h +++ b/gui.h @@ -2,6 +2,8 @@ #define GUI_H #include "font.h" +#include "input.h" +#include "player.h" struct{ struct gui_helper{ @@ -15,12 +17,58 @@ struct{ f32 factive; font3d font; + + v3f trick_co; + enum guitrick_type{ + k_guitrick_type_none, + k_guitrick_type_ollie, + k_guitrick_type_trick, + k_guitrick_type_backflip, + k_guitrick_type_pump, + k_guitrick_type_isc + } + trick_type; } static gui; +VG_STATIC +void gui_helper_action( const char *bindstr, const char *text ){ + if( gui.helper_count >= vg_list_size(gui.helpers) ){ + vg_error( "Too many helpers\n" ); + return; + } + + struct gui_helper *helper = &gui.helpers[ gui.helper_count ++ ]; + helper->bindstr = bindstr; + helper->text = text; +} + VG_STATIC void gui_draw(void) { + if( v3_dist2(localplayer.rb.co,gui.trick_co) > 2.0f ){ + gui.trick_type = k_guitrick_type_none; + } + + if( gui.trick_type == k_guitrick_type_pump ){ + gui_helper_action(axis_display_string(k_sraxis_grab),"Crouch"); + } + else if( gui.trick_type == k_guitrick_type_backflip ){ + gui_helper_action(joystick_display_string(k_srjoystick_steer,1),"Flip"); + } + else if( gui.trick_type == k_guitrick_type_ollie ){ + gui_helper_action(button_display_string(k_srbind_jump),"Ollie"); + } + else if( gui.trick_type == k_guitrick_type_trick ){ + gui_helper_action(button_display_string(k_srbind_trick0),"Shuvit"); + gui_helper_action(button_display_string(k_srbind_trick1),"Kickflip"); + gui_helper_action(button_display_string(k_srbind_trick2),"Tre-Flip"); + } + else if( gui.trick_type == k_guitrick_type_isc ){ + gui_helper_action(button_display_string(k_srbind_camera),"Camera"); + gui_helper_action(button_display_string(k_srbind_use), "Skate/Walk"); + } + camera ortho; float fl = 0.0f, @@ -129,17 +177,6 @@ void gui_draw(void) gui.helper_count = 0; } -VG_STATIC -void gui_helper_action( const char *bindstr, const char *text ) -{ - if( gui.helper_count >= vg_list_size(gui.helpers) ) - vg_fatal_error( "Too many helpers\n" ); - - struct gui_helper *helper = &gui.helpers[ gui.helper_count ++ ]; - helper->bindstr = bindstr; - helper->text = text; -} - VG_STATIC int gui_location_print_ccmd( int argc, const char *argv[] ){ if( argc > 0 ){ @@ -157,10 +194,27 @@ int gui_location_print_ccmd( int argc, const char *argv[] ){ return 0; } +VG_STATIC int gui_showtrick_ccmd( int argc, const char *argv[] ){ + if( argc == 1 ){ + enum guitrick_type type = k_guitrick_type_none; + if( !strcmp( argv[0], "pump" ) ) type = k_guitrick_type_pump; + else if( !strcmp( argv[0], "flip" ) ) type = k_guitrick_type_backflip; + else if( !strcmp( argv[0], "ollie" ) ) type = k_guitrick_type_ollie; + else if( !strcmp( argv[0], "trick" ) ) type = k_guitrick_type_trick; + else if( !strcmp( argv[0], "misc" ) ) type = k_guitrick_type_isc; + else return 1; + gui.trick_type = type; + v3_copy( localplayer.rb.co, gui.trick_co ); + return 0; + } + return 1; +} + VG_STATIC void gui_init(void) { font3d_load( &gui.font, "models/rs_font.mdl", vg_mem.rtmemory ); vg_console_reg_cmd( "gui_location", gui_location_print_ccmd, NULL ); + vg_console_reg_cmd( "showtrick", gui_showtrick_ccmd, NULL ); } #endif /* GUI_H */ diff --git a/input.h b/input.h index a909d7b..ff0aa6f 100644 --- a/input.h +++ b/input.h @@ -114,7 +114,7 @@ static const char *button_display_string( enum sr_bind button ) }; const char *keyboard_table[ k_srbind_max ] = { - [k_srbind_jump] = KEYBOARD_GLYPH( "A" ), + [k_srbind_jump] = "\xa1", [k_srbind_push] = KEYBOARD_GLYPH( "W" ), [k_srbind_trick0] = "\x99", [k_srbind_trick1] = "\x9a", @@ -157,24 +157,28 @@ static const char *axis_display_string( enum sr_axis axis ) return keyboard_table[ axis ]; } -static const char *joystick_display_string( enum sr_joystick joystick ) +static const char *joystick_display_string( enum sr_joystick joystick, + u32 axis ) { - const char *controller_table[ k_srjoystick_max ] = { - [k_srjoystick_steer] = "\x88", - [k_srjoystick_grab] = "\x8e", - [k_srjoystick_look] = "\x8e" + const char *controller_table[ k_srjoystick_max ][3] = { + [k_srjoystick_steer] = {"\x88","\x89","\x8a"}, + [k_srjoystick_grab] = {"\x8c","\x8d","\x8e"}, + [k_srjoystick_look] = {"\x8c","\x8d","\x8e"} }; - const char *keyboard_table[ k_srjoystick_max ] = { - [k_srjoystick_steer] = KEYBOARD_GLYPH( "\x93" )KEYBOARD_GLYPH( "\x95" ), - [k_srjoystick_grab] = "\xa4", - [k_srjoystick_look] = "\xa4" + const char *keyboard_table[ k_srjoystick_max ][3] = { + [k_srjoystick_steer] = {KEYBOARD_GLYPH("A")KEYBOARD_GLYPH("D"), /*h*/ + KEYBOARD_GLYPH("W")KEYBOARD_GLYPH("S"), /*v*/ + + KEYBOARD_GLYPH("A")KEYBOARD_GLYPH("D") /*hv*/ + KEYBOARD_GLYPH("W")KEYBOARD_GLYPH("S"), }, + [k_srjoystick_grab] = {"\xa4","\xa4","\xa4"}, + [k_srjoystick_look] = {"\xa4","\xa4","\xa4"} }; if( vg_input.display_input_method == k_input_method_controller ) - return controller_table[ joystick ]; - else - return keyboard_table[ joystick ]; + return controller_table[ joystick ][axis]; + else return keyboard_table[ joystick ][axis]; } static int buttons_filter_fixed(void) diff --git a/maps_src/mp_spawn/main.mdl b/maps_src/mp_spawn/main.mdl index eea495e..e256775 100644 Binary files a/maps_src/mp_spawn/main.mdl and b/maps_src/mp_spawn/main.mdl differ diff --git a/skaterift.c b/skaterift.c index 50939ae..603e98a 100644 --- a/skaterift.c +++ b/skaterift.c @@ -360,6 +360,7 @@ VG_STATIC void render_scene_gate_subview(void) { render_fb_bind( gpipeline.fb_main, 1 ); world_instance *view_world = localplayer.viewable_world; + if( !view_world ) return; /* ??? */ int depth = 1; if( localplayer.gate_waiting ) depth = 0; diff --git a/world_load.c b/world_load.c index 2eca813..0c4e8eb 100644 --- a/world_load.c +++ b/world_load.c @@ -91,6 +91,7 @@ VG_STATIC void world_load_mdl( const char *path ) world_gen_routes_generate(); world_gen_compute_light_indices(); vg_async_call( async_world_postprocess_render, NULL, 0 ); + vg_async_stall(); mdl_close( meta ); world->status = k_world_status_loaded;