the pain is gone
[carveJwlIkooP6JGAAIwe30JlM.git] / ent_skateshop.c
index adccac50c0521ada3f09c45da2c8b48dab30235f..6cf47dc69cd1fb5192d23a291b65a3c301d545bc 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "world.h"
 #include "player.h"
+#include "gui.h"
 
 #define MAX_LOCAL_BOARDS 64
 #define BILL_TIN_BOARDS  1
@@ -322,6 +323,7 @@ next_file: tinydir_next( &dir );
 
 VG_STATIC void global_skateshop_exit(void)
 {
+   vg_info( "exit skateshop\n" );
    localplayer.immobile = 0;
    global_skateshop.active = 0;
 }
@@ -436,29 +438,38 @@ VG_STATIC void global_skateshop_preupdate(void)
       return;
    }
 
-   float h = localplayer.input_js1h->axis.value;
-
    if( global_skateshop.interface_loc <= k_skateshop_loc_page__viewing ){
-      if( fabsf(h) > 0.25f ){
-         if( h < 0.0f ){
-            if( global_skateshop.selected_registry_id > 0 )
-               global_skateshop.selected_registry_id --;
+
+      gui_helper_action( axis_display_string( k_sraxis_mbrowse_h ), "browse" );
+      gui_helper_action( button_display_string( k_srbind_maccept ), "pick" );
+      gui_helper_action( button_display_string( k_srbind_mback ), "exit" );
+      
+      int moved = 0;
+
+      if( button_down( k_srbind_mleft ) ){
+         if( global_skateshop.selected_registry_id > 0 ){
+            global_skateshop.selected_registry_id --;
+            moved = 1;
          }
-         else{
-            if( global_skateshop.selected_registry_id < 
-                     global_skateshop.registry_count-1 )
-            {
-               global_skateshop.selected_registry_id ++;
-            }
+      }
+
+      if( button_down( k_srbind_mright ) ){
+         if( global_skateshop.selected_registry_id < 
+                  global_skateshop.registry_count-1 )
+         {
+            global_skateshop.selected_registry_id ++;
+            moved = 1;
          }
+      }
 
+      if( moved ){
          vg_info( "Select registry: %u\n", 
                   global_skateshop.selected_registry_id );
          global_skateshop.interaction_cooldown = 0.125f;
          return;
       }
 
-      if( vg_input_button_down( &input_menu_back ) ){
+      if( button_down( k_srbind_mback ) ){
          global_skateshop_exit();
          return;
       }