on your marks, get set, bake
authorhgn <hgodden00@gmail.com>
Mon, 29 May 2023 03:03:04 +0000 (04:03 +0100)
committerhgn <hgodden00@gmail.com>
Mon, 29 May 2023 03:03:04 +0000 (04:03 +0100)
gui.h
input.h
maps_src/mp_spawn/main.mdl
skaterift.c
world_load.c

diff --git a/gui.h b/gui.h
index e4d0068889de65ee8abc83aa2cc2a1bd7f93c185..238d0fba76507c0c501f88b0f570e321039e5393 100644 (file)
--- 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 a909d7b70e537a94c8830a3b94413e46ef7ceb98..ff0aa6f2d5dd4ade58b7cd091a290705565a4de2 100644 (file)
--- 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)
index eea495ecc315d96038eb5e4bcdc29f6f702c7ab6..e256775dc7c2101ace0d57be787399ea2fd8ab1f 100644 (file)
Binary files a/maps_src/mp_spawn/main.mdl and b/maps_src/mp_spawn/main.mdl differ
index 50939ae270019e8cbfcbd39f68e0478ae635ee96..603e98a8b6281c85ab4c91d5487fbd65aeacf387 100644 (file)
@@ -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;
index 2eca813ceeda80941dffed10b9f76dcbc5438773..0c4e8ebb9989ecfa983224a5a5860142d5c2d974 100644 (file)
@@ -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;