X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=ent_skateshop.c;h=8a03ff1e6ab46b7772ff1905ecedbdaf9675b419;hb=7ccbfdd0b7717b5a906a4d4309324782d1fe73e8;hp=bfec73f9edaf24fe6082b90af3182f7fb2875478;hpb=6b036c10d38e7d691eb0bc06c29235b450c3ff10;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/ent_skateshop.c b/ent_skateshop.c index bfec73f..8a03ff1 100644 --- a/ent_skateshop.c +++ b/ent_skateshop.c @@ -220,13 +220,8 @@ static void ent_skateshop_preupdate( ent_skateshop *shop, int active ){ if( shop->type == k_skateshop_type_boardshop ){ if( !vg_loader_availible() ) return; - gui_helper_action( axis_display_string( k_sraxis_mbrowse_h ), "browse" ); - gui_helper_action( button_display_string( k_srbind_mback ), "exit" ); - u16 cache_id = skateshop_selected_cache_id(); - if( cache_id ){ - gui_helper_action( button_display_string( k_srbind_maccept ), "pick" ); - } + global_skateshop.helper_pick->greyed = !cache_id; /* * Controls @@ -264,6 +259,7 @@ static void ent_skateshop_preupdate( ent_skateshop *shop, int active ){ network_send_item( k_netmsg_playeritem_board ); world_entity_unfocus(); + gui_helper_clear(); skaterift_autosave(1); return; } @@ -271,10 +267,6 @@ static void ent_skateshop_preupdate( ent_skateshop *shop, int active ){ else if( shop->type == k_skateshop_type_charshop ){ if( !vg_loader_availible() ) return; - gui_helper_action( axis_display_string( k_sraxis_mbrowse_h ), "browse" ); - gui_helper_action( button_display_string( k_srbind_mback ), "exit" ); - gui_helper_action( button_display_string( k_srbind_maccept ), "pick" ); - int changed = 0; if( button_down( k_srbind_mleft ) ){ @@ -309,22 +301,21 @@ static void ent_skateshop_preupdate( ent_skateshop *shop, int active ){ if( button_down( k_srbind_maccept ) ){ network_send_item( k_netmsg_playeritem_player ); world_entity_unfocus(); + gui_helper_clear(); } } else if( shop->type == k_skateshop_type_worldshop ){ int browseable = 0, loadable = 0; - if( addon_count(k_addon_type_world) && vg_loader_availible() ){ - gui_helper_action( axis_display_string(k_sraxis_mbrowse_h), "browse" ); + if( addon_count(k_addon_type_world) && vg_loader_availible() ) browseable = 1; - } - if( vg_loader_availible() && global_skateshop.selected_world_id > 0 ){ - gui_helper_action( button_display_string(k_srbind_maccept), - "open rift" ); + if( vg_loader_availible() && global_skateshop.selected_world_id > 0 ) loadable = 1; - } + + global_skateshop.helper_browse->greyed = !browseable; + global_skateshop.helper_pick->greyed = !loadable; int change = 0; @@ -393,6 +384,7 @@ static void ent_skateshop_preupdate( ent_skateshop *shop, int active ){ network_send_item( k_netmsg_playeritem_player ); world_entity_unfocus(); + gui_helper_clear(); return; } } @@ -668,6 +660,23 @@ static void skateshop_render( ent_skateshop *shop ){ vg_fatal_error( "Unknown store (%u)\n", shop->type ); } +static void ent_skateshop_helpers_pickable( const char *acceptance ){ + vg_str text; + + if( gui_new_helper( input_button_list[k_srbind_mback], &text )) + vg_strcat( &text, "exit" ); + + if( (global_skateshop.helper_pick = gui_new_helper( + input_button_list[k_srbind_maccept], &text))){ + vg_strcat( &text, acceptance ); + } + + if( (global_skateshop.helper_browse = gui_new_helper( + input_axis_list[k_sraxis_mbrowse_h], &text ))){ + vg_strcat( &text, "browse" ); + } +} + /* * Entity logic: entrance event */ @@ -685,25 +694,18 @@ static void ent_skateshop_call( world_instance *world, ent_call *call ){ vg_info( "Entering skateshop\n" ); world_entity_focus( call->id ); -#if 0 - localplayer.immobile = 1; - menu.disable_open = 1; - skaterift.activity = k_skaterift_skateshop; - - v3_zero( localplayer.rb.v ); - v3_zero( localplayer.rb.w ); - localplayer._walk.move_speed = 0.0f; - global_skateshop.ptr_ent = shop; -#endif + gui_helper_clear(); if( shop->type == k_skateshop_type_boardshop ){ skateshop_update_viewpage(); skateshop_op_board_scan(); + ent_skateshop_helpers_pickable( "pick" ); } else if( shop->type == k_skateshop_type_charshop ){ - + ent_skateshop_helpers_pickable( "pick" ); } else if( shop->type == k_skateshop_type_worldshop ){ + ent_skateshop_helpers_pickable( "open rift" ); pointcloud_animate( k_pointcloud_anim_opening ); skateshop_op_world_scan(); }