X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=ent_skateshop.c;h=19b868fe6b986e5f6e2570936d836ee05e63c259;hb=342fcbf6fda017bdd38d56ce0fa7c9e59e589f3b;hp=a3e12dca52986e6b39c14c12b97e75f759321348;hpb=63b5ac44f74599b21c4b9b18398c29b797337bea;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/ent_skateshop.c b/ent_skateshop.c index a3e12dc..19b868f 100644 --- a/ent_skateshop.c +++ b/ent_skateshop.c @@ -10,6 +10,7 @@ #include "gui.h" #include "menu.h" #include "pointcloud.h" +#include "highscores.h" /* * Checks string equality but does a hash check first @@ -102,12 +103,6 @@ VG_STATIC void skateshop_update_viewpage(void) } } -/* generic reciever */ -VG_STATIC void workshop_async_any_complete( void *data, u32 size ) -{ - skaterift_end_op(); -} - /* * op/subroutine: k_workshop_op_item_load * ----------------------------------------------------------------------------- @@ -457,7 +452,7 @@ VG_STATIC void world_scan_thread( void *_args ) vg_str file = folder; vg_strcat( &file, "/" ); vg_strcat( &file, entry->d_name ); - if( !vg_strgood( &file ) ) break; + if( !vg_strgood( &file ) ) continue; char *ext = vg_strch( &file, '.' ); if( !ext ) continue; @@ -604,7 +599,7 @@ VG_STATIC void global_skateshop_preupdate(void) if( !global_skateshop.active ) return; - world_instance *world = get_active_world(); + world_instance *world = world_current_instance(); ent_skateshop *shop = global_skateshop.ptr_ent; @@ -719,6 +714,10 @@ VG_STATIC void global_skateshop_preupdate(void) if( global_skateshop.world_registry_count ){ gui_helper_action( axis_display_string(k_sraxis_mbrowse_h), "browse" ); } + + if( skaterift.async_op == k_async_op_none ){ + gui_helper_action( button_display_string(k_srbind_maccept), "load" ); + } int change = 0; if( button_down( k_srbind_mleft ) ){ @@ -736,14 +735,20 @@ VG_STATIC void global_skateshop_preupdate(void) } } - if( change && (pointcloud.anim == k_pointcloud_anim_idle) ){ + if( change && (pointcloud.anim == k_pointcloud_anim_idle) && + pointcloud.visibility == 1.0f ){ pointcloud.anim = k_pointcloud_anim_hiding; pointcloud.anim_start = vg.time; } - if( button_down( k_srbind_maccept ) ){ + if( (skaterift.async_op == k_async_op_none ) && + button_down( k_srbind_maccept ) ) + { + struct registry_world *rw = &global_skateshop.world_registry[ + global_skateshop.selected_world_id ]; + vg_info( "Select world (%u)\n", global_skateshop.selected_world_id ); - global_skateshop_exit(); + skaterift_change_world( rw->foldername ); return; } } @@ -759,7 +764,7 @@ VG_STATIC void global_skateshop_preupdate(void) VG_STATIC void skateshop_render_boardshop(void) { - world_instance *world = get_active_world(); + world_instance *world = world_current_instance(); ent_skateshop *shop = global_skateshop.ptr_ent; u32 slot_count = vg_list_size(global_skateshop.shop_view_slots); @@ -832,7 +837,7 @@ fade_out:; float scale = 0.2f, thickness = 0.03f; - font3d_bind( &world_global.font, &main_camera ); + font3d_bind( &gui.font, &main_camera ); shader_model_font_uColour( (v4f){1.0f,1.0f,1.0f,1.0f} ); /* Selection counter @@ -846,7 +851,7 @@ fade_out:; m4x3_mul( mrack, mlocal, mmdl ); if( global_skateshop.registry_count == 0 ){ - font3d_simple_draw( &world_global.font, 0, + font3d_simple_draw( &gui.font, 0, "Nothing installed", &main_camera, mmdl ); } else{ @@ -857,7 +862,7 @@ fade_out:; i+=highscore_intl( buf+i, global_skateshop.registry_count, 3 ); buf[i++] = '\0'; - font3d_simple_draw( &world_global.font, 0, buf, &main_camera, mmdl ); + font3d_simple_draw( &gui.font, 0, buf, &main_camera, mmdl ); } struct cache_board *cache_ptr = skateshop_selected_cache_if_loaded(); @@ -871,25 +876,23 @@ fade_out:; * ----------------------------------------------------------------- */ m3x3_zero( mlocal ); m3x3_setdiagonalv3( mlocal, (v3f){ scale, scale, thickness } ); - mlocal[3][0] = -font3d_string_width( &world_global.font, 0, info->title ); + mlocal[3][0] = -font3d_string_width( &gui.font, 0, info->title ); mlocal[3][0] *= scale*0.5f; mlocal[3][1] = 0.1f; mlocal[3][2] = 0.0f; m4x3_mul( mtext, mlocal, mmdl ); - font3d_simple_draw( &world_global.font, 0, info->title, &main_camera, mmdl ); + font3d_simple_draw( &gui.font, 0, info->title, &main_camera, mmdl ); /* Author name * ----------------------------------------------------------------- */ scale *= 0.4f; m3x3_setdiagonalv3( mlocal, (v3f){ scale, scale, thickness } ); - mlocal[3][0] = -font3d_string_width( &world_global.font, 0, - info->author_name ); + mlocal[3][0] = -font3d_string_width( &gui.font, 0, info->author_name ); mlocal[3][0] *= scale*0.5f; mlocal[3][1] = 0.0f; mlocal[3][2] = 0.0f; m4x3_mul( mtext, mlocal, mmdl ); - font3d_simple_draw( &world_global.font, 0, - info->author_name, &main_camera, mmdl ); + font3d_simple_draw( &gui.font, 0, info->author_name, &main_camera, mmdl ); } VG_STATIC void skateshop_render_charshop(void) @@ -898,7 +901,7 @@ VG_STATIC void skateshop_render_charshop(void) VG_STATIC void skateshop_render_worldshop(void) { - world_instance *world = get_active_world(); + world_instance *world = world_current_instance(); ent_skateshop *shop = global_skateshop.ptr_ent; ent_marker *mark_display = mdl_arritm( &world->ent_marker, @@ -936,29 +939,33 @@ VG_STATIC void skateshop_render_worldshop(void) vg_strcat( &info, "No worlds installed" ); } + if( skaterift.async_op == k_async_op_world_loading || + skaterift.async_op == k_async_op_world_preloading ){ + vg_strcat( &info, "Loading..." ); + } + m4x3f mtext,mlocal,mtextmdl; mdl_transform_m4x3( &mark_info->transform, mtext ); - font3d_bind( &world_global.font, &main_camera ); + font3d_bind( &gui.font, &main_camera ); shader_model_font_uColour( (v4f){1.0f,1.0f,1.0f,1.0f} ); float scale = 0.2f, thickness = 0.015f, scale1 = 0.08f; m3x3_zero( mlocal ); m3x3_setdiagonalv3( mlocal, (v3f){ scale, scale, thickness } ); - mlocal[3][0] = -font3d_string_width( &world_global.font, 0, buftext ); + mlocal[3][0] = -font3d_string_width( &gui.font, 0, buftext ); mlocal[3][0] *= scale*0.5f; mlocal[3][1] = 0.1f; mlocal[3][2] = 0.0f; m4x3_mul( mtext, mlocal, mtextmdl ); - font3d_simple_draw( &world_global.font, 0, buftext, &main_camera, mtextmdl ); + font3d_simple_draw( &gui.font, 0, buftext, &main_camera, mtextmdl ); m3x3_setdiagonalv3( mlocal, (v3f){ scale1, scale1, thickness } ); - mlocal[3][0] = -font3d_string_width( &world_global.font, 0, bufsubtext ); + mlocal[3][0] = -font3d_string_width( &gui.font, 0, bufsubtext ); mlocal[3][0] *= scale1*0.5f; mlocal[3][1] = -scale1*0.3f; m4x3_mul( mtext, mlocal, mtextmdl ); - font3d_simple_draw( &world_global.font, 0, bufsubtext, - &main_camera, mtextmdl ); + font3d_simple_draw( &gui.font, 0, bufsubtext, &main_camera, mtextmdl ); /* pointcloud */ m4x3f mmdl;