X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=menu.h;h=6df04dbf6da80e364b53f5fa6b94d7645d9be710;hb=e311bbe2fa903a7e2a922f202f389b799193195d;hp=5218485c8574ca036b4906b6685369d37fd0ddc4;hpb=7ccbfdd0b7717b5a906a4d4309324782d1fe73e8;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/menu.h b/menu.h index 5218485..6df04db 100644 --- a/menu.h +++ b/menu.h @@ -11,6 +11,7 @@ #include "workshop.h" #include "respawn.h" #include "gui.h" +#include "ent_miniworld.h" #define MENU_STACK_SIZE 8 @@ -140,9 +141,9 @@ static void menu_init(void){ vg_linear_clear( vg_mem.scratch ); - mdl_load_array( &menu.model, &menu.items, "ent_menuitem", alloc ); - mdl_load_array( &menu.model, &menu.markers, "ent_marker", alloc ); - mdl_load_array( &menu.model, &menu.cameras, "ent_camera", alloc ); + MDL_LOAD_ARRAY( &menu.model, &menu.items, ent_menuitem, alloc ); + MDL_LOAD_ARRAY( &menu.model, &menu.markers, ent_marker, alloc ); + MDL_LOAD_ARRAY( &menu.model, &menu.cameras, ent_camera, alloc ); vg_linear_clear( vg_mem.scratch ); @@ -153,7 +154,7 @@ static void menu_init(void){ void *data = vg_linear_alloc( vg_mem.scratch, tex0->file.pack_size ); mdl_fread_pack_file( &menu.model, &tex0->file, data ); - mdl_async_load_glmesh( &menu.model, &menu.mesh ); + mdl_async_load_glmesh( &menu.model, &menu.mesh, NULL ); vg_tex2d_load_qoi_async( data, tex0->file.pack_size, VG_TEX2D_LINEAR|VG_TEX2D_CLAMP, &menu.texture ); @@ -245,24 +246,18 @@ static void menu_trigger_item( ent_menuitem *item ){ vg.window_should_close = 1; } - /* DEPRECATED? */ - else if( MDL_CONST_PSTREQ( &menu.model, q, "reset_nearest" ) ){ - localplayer_cmd_respawn( 0, NULL ); - menu_close(); - } - /* DEPRECATED? */ - else if( MDL_CONST_PSTREQ( &menu.model, q, "reset_home" ) ){ - world_set_active_instance( 0 ); - localplayer.viewable_world = world_current_instance(); - localplayer_cmd_respawn( 1, (const char *[]){"start"} ); - menu_close(); - } + else if( MDL_CONST_PSTREQ( &menu.model, q, "map" ) ){ - else if( MDL_CONST_PSTREQ( &menu.model, q, "reset" ) ){ menu_close(); respawn_begin_chooser(); } - + else if( MDL_CONST_PSTREQ( &menu.model, q, "hub" ) ){ + if( world_static.active_instance == k_world_purpose_client ){ + srinput.state = k_input_state_resume; + menu_close(); + ent_miniworld_goback(); + } + } else if( MDL_CONST_PSTREQ( &menu.model, q, "credits" ) ){ menu.credits_open = 1; } @@ -614,11 +609,6 @@ static void menu_render(void){ ui_split( panel, k_ui_axis_h, 28, 0, title, panel ); ui_text( title, "Mt.Zero Software", 1, k_ui_align_middle_center, 0 ); - ui_split( panel, k_ui_axis_h, 8, 0, title, panel ); - ui_split( panel, k_ui_axis_h, 28, 0, title, panel ); - ui_text( title, "A game by Harry Godden", 1, - k_ui_align_middle_center, 0 ); - ui_split( panel, k_ui_axis_h, 8, 0, title, panel ); ui_split( panel, k_ui_axis_h, 28*2, 0, title, panel ); ui_text( title, "Free Software", 2, k_ui_align_middle_center, 0 ); @@ -648,7 +638,7 @@ static void menu_render(void){ v3f v0; mdl_transform_vector( &menu.cam->transform, (v3f){0.0f,-1.0f,0.0f}, v0 ); - player_vector_angles( target.angles, v0, 1.0f, 0.0f ); + v3_angles( v0, target.angles ); camera_lerp( &menu.view, &target, rate, &menu.view );