X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_load.c;h=e17483f5658ae994df5b5c457b34e01e323d2ca3;hb=074fa69f479724f9800849430bad5caf730b01ef;hp=25d5b048af77274107d03d9b1e7e082a7cdf14fc;hpb=c77e15a8dc7b976371a473bc8794cb55601d82f6;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_load.c b/world_load.c index 25d5b04..e17483f 100644 --- a/world_load.c +++ b/world_load.c @@ -8,11 +8,12 @@ #include "addon.h" #include "save.h" #include "vg/vg_msg.h" +#include "network.h" /* * load the .mdl file located in path as a world instance */ -VG_STATIC void world_instance_load_mdl( u32 instance_id, const char *path ){ +static void world_instance_load_mdl( u32 instance_id, const char *path ){ vg_rand_seed( 9001 ); world_instance *world = &world_static.instances[ instance_id ]; @@ -60,9 +61,10 @@ VG_STATIC void world_instance_load_mdl( u32 instance_id, const char *path ){ 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_load_array( meta, &world->ent_objective, "ent_objective", heap ); mdl_load_array( meta, &world->ent_challenge, "ent_challenge", heap ); - mdl_load_array( meta, &world->ent_unlock, "ent_unlock", heap ); mdl_load_array( meta, &world->ent_relay, "ent_relay", heap ); + mdl_load_array( meta, &world->ent_cubemap, "ent_cubemap", heap ); mdl_array_ptr infos; mdl_load_array( meta, &infos, "ent_worldinfo", vg_mem.scratch ); @@ -98,7 +100,6 @@ VG_STATIC void world_instance_load_mdl( u32 instance_id, const char *path ){ vg_async_stall(); } - struct world_load_complete_data{ savedata_file save; u32 instance_start, instance_count; @@ -265,6 +266,11 @@ static void skaterift_change_world_start( addon_reg *reg ){ if( world_static.active_instance != 0 ) vg_error( "Cannot change worlds while in non-root world\n" ); else{ + if( world_static.addon_client == reg ){ + vg_warn( "World is already loaded\n" ); + return; + } + char buf[76]; addon_alias_uid( ®->alias, buf ); vg_info( "switching to: %s\n", buf ); @@ -286,11 +292,14 @@ static void skaterift_change_world_start( addon_reg *reg ){ } world_static.addon_client = reg; + network_send_item( k_netmsg_playeritem_world1 ); } } /* console command for the above function */ static int skaterift_change_world_command( int argc, const char *argv[] ){ + if( !vg_loader_availible() ) return 0; + if( argc == 1 ){ addon_alias q; q.type = k_addon_type_world; @@ -372,6 +381,13 @@ static void world_free( world_instance *world ) vg_linear_header(world->heap) ); } + for( u32 i=0; ient_cubemap); i++ ){ + ent_cubemap *cm = mdl_arritm(&world->ent_cubemap,i); + glDeleteTextures( 1, &cm->texture_id ); + glDeleteFramebuffers( 1, &cm->framebuffer_id ); + glDeleteRenderbuffers( 1, &cm->renderbuffer_id ); + } + world->status = k_world_status_unloaded; } @@ -379,7 +395,7 @@ static void world_free( world_instance *world ) * reset the world structure without deallocating persistent buffers * TODO: Make this a memset(0), and have persistent items live in a static loc */ -VG_STATIC void world_init_blank( world_instance *world ) +static void world_init_blank( world_instance *world ) { memset( &world->meta, 0, sizeof(mdl_context) );