X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_load.c;h=448624e971247a04d343370c65e1367fbaa74a93;hb=464b46038fbbf1439d088e64bdce8965e44a91cd;hp=4f5f8f4628fe242a7da595018420f1191690f24d;hpb=badfa88dd109bbae5628f58504402f4707569f73;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_load.c b/world_load.c index 4f5f8f4..448624e 100644 --- a/world_load.c +++ b/world_load.c @@ -58,6 +58,7 @@ VG_STATIC void world_load_mdl( const char *path ) mdl_load_array( meta, &world->ent_marker, "ent_marker", heap ); mdl_load_array( meta, &world->ent_skateshop, "ent_skateshop", heap ); mdl_load_array( meta, &world->ent_swspreview,"ent_swspreview", heap ); + mdl_load_array( meta, &world->ent_ccmd, "ent_ccmd", heap ); mdl_array_ptr infos; mdl_load_array( meta, &infos, "ent_worldinfo", vg_mem.scratch ); @@ -90,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; @@ -109,19 +111,20 @@ static void async_skaterift_world_loaded( void *payload, u32 size ) /* * Does a complete world switch using the remaining free slots */ -static void skaterift_world_changer_thread( void *data ) -{ - if( world_loader.location == k_world_load_type_workshop ){ - vg_fatal_error( "Unimplemented\n" ); - } - +static void skaterift_world_changer_thread( void *data ){ char path_buf[4096]; vg_str path; vg_strnull( &path, path_buf, 4096 ); - vg_strcat( &path, "maps/" ); + + if( world_loader.reg ){ + addon_get_content_folder( world_loader.reg, &path ); + } + else { + vg_strcat( &path, "maps/" ); + vg_strcat( &path, world_loader.override_name ); + } vg_str folder = path; - vg_strcat( &folder, world_loader.name ); if( !vg_strgood( &folder ) ) { vg_error( "Load target too long\n" ); vg_async_call( workshop_async_any_complete, NULL, 0 ); @@ -216,9 +219,14 @@ static void skaterift_change_world_preupdate(void) } /* places all loaded worlds into unloading state */ -static void skaterift_change_world( const char *world_name ) -{ - vg_info( "switching to %s\n", world_name ); +static void skaterift_change_world_start(void){ + if( world_loader.reg ){ + vg_info( "switching to %s ("PRINTF_U64"\n", + world_loader.reg->foldername, world_loader.reg->workshop_id ); + } + else{ + vg_info( "switching to %s(local)\n", world_loader.override_name ); + } if( world_static.active_world != 0 ){ vg_error( "Cannot change worlds while in non-root world\n" ); @@ -226,10 +234,7 @@ static void skaterift_change_world( const char *world_name ) else{ skaterift_begin_op( k_async_op_world_preloading ); - vg_linear_clear( vg_mem.scratch ); - vg_strncpy( world_name, world_loader.name, - vg_list_size(world_loader.name), k_strncpy_overflow_fatal ); - + vg_linear_clear( vg_mem.scratch ); /* ?? */ vg_info( "unloading old worlds\n" ); world_unlink_nonlocal( &world_static.worlds[0] ); @@ -247,8 +252,13 @@ static void skaterift_change_world( const char *world_name ) /* console command for the above function */ static int skaterift_change_world_command( int argc, const char *argv[] ) { - if( argc == 1 ) - skaterift_change_world( argv[0] ); + if( argc == 1 ){ + world_loader.reg = NULL; + vg_strncpy( argv[0], world_loader.override_name, + vg_list_size( world_loader.override_name ), + k_strncpy_always_add_null ); + skaterift_change_world_start(); + } return 0; }