X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=menu.h;h=d8b686452f73015bb1d47e7844ed2eb55c5e38ab;hb=2a238d32da833812e837cf38e16a7685c98db5c3;hp=1b73beab3e35777b03c55cb3825d6b2517818d74;hpb=f7db507815e2822d971031c30f25e02b45e9c914;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/menu.h b/menu.h index 1b73bea..d8b6864 100644 --- a/menu.h +++ b/menu.h @@ -78,11 +78,8 @@ enum menu_page struct menu_btn_userdata { - union - { - int i; - void *ptr_generic; - }; + int i; + void *ptr_generic; }; VG_STATIC int menu_settings_if( struct menu_btn_userdata ud ) @@ -139,11 +136,11 @@ struct menu_button } VG_STATIC menu_buttons[] = { -{ - "text_quit", menu_vis, {.i=k_menu_page_main|k_menu_page_quit}, - .fn_press = menu_btn_quit, - .ld="text_reset", .lr="text_settings", .ll="text_map" -}, + { + "text_quit", menu_vis, {.i=k_menu_page_main|k_menu_page_quit}, + .fn_press = menu_btn_quit, + .ld="text_reset", .lr="text_settings", .ll="text_map" + }, { "text_quitty", menu_vis, {.i=k_menu_page_quit} }, @@ -491,7 +488,7 @@ VG_STATIC void menu_page_map(void) audio_play_oneshot( &audio_rewind[4], 1.0f ); audio_unlock(); - if( v < 0.0f ) + if( v > 0.0f ) { game_menu.selected_map --; @@ -585,14 +582,16 @@ VG_STATIC void menu_page_skater(void) } } -VG_STATIC void menu_slider( float *value, float min, float max, +VG_STATIC void menu_slider( float *value, int set_value, mdl_node *slider, mdl_node *pmin, mdl_node *pmax ) { - float h = input_menu_h.axis.value; - - if( fabsf(h) > 0.04f ) - *value += h * vg.frame_delta; - *value = vg_clampf( *value, min, max ); + if( set_value ) + { + float h = input_menu_h.axis.value; + if( fabsf(h) > 0.04f ) + *value += h * vg.frame_delta; + *value = vg_clampf( *value, 0.0f, 1.0f ); + } v3_lerp( pmin->co, pmax->co, *value, slider->co ); } @@ -601,20 +600,18 @@ VG_STATIC void menu_page_settings(void) { menu_run_directional(); - if( game_menu.loc == menu_get_loc( "fov_slider" ) ) - { - menu_slider( &cl_fov, 0.0f, 1.0f, - menu_pnode_fov_slider, menu_pnode_fov_min, - menu_pnode_fov_max ); + int fov_select = game_menu.loc == menu_get_loc( "fov_slider" ); + menu_slider( &cl_fov, fov_select, + menu_pnode_fov_slider, menu_pnode_fov_min, + menu_pnode_fov_max ); + if( fov_select ) menu_fov_target = vg_lerpf( 97.0f, 135.0f, cl_fov ) * 0.8f; - } - else if( game_menu.loc == menu_get_loc( "vol_slider" ) ) - { - menu_slider( &cl_volume, 0.0f, 1.0f, - menu_pnode_vol_slider, menu_pnode_vol_min, - menu_pnode_vol_max ); - } + + menu_slider( &vg_audio.volume_console, + (game_menu.loc == menu_get_loc( "vol_slider" )), + menu_pnode_vol_slider, menu_pnode_vol_min, + menu_pnode_vol_max ); if( menu_page_should_backout() ) { @@ -769,8 +766,8 @@ VG_STATIC void menu_render( camera *cam ) glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); glBlendEquation(GL_FUNC_ADD); - shader_fscolour_use(); - shader_fscolour_uColour( (v4f){ 0.1f, 0.1f, 0.3f, menu_opacity*0.5f } ); + shader_blitcolour_use(); + shader_blitcolour_uColour( (v4f){ 0.1f, 0.1f, 0.3f, menu_opacity*0.5f } ); render_fsquad(); glEnable( GL_DEPTH_TEST );