fov slider input maps menu stuff
authorhgn <hgodden00@gmail.com>
Tue, 8 Nov 2022 12:25:31 +0000 (12:25 +0000)
committerhgn <hgodden00@gmail.com>
Tue, 8 Nov 2022 12:25:31 +0000 (12:25 +0000)
14 files changed:
blender_export.py
build.c
common.h
maps_src/mp_gridmap.mdl [new file with mode: 0644]
maps_src/mp_mtzero.mdl [new file with mode: 0644]
menu.h
model.h
models_src/mp_demo.mdl [deleted file]
models_src/mp_dev.mdl [deleted file]
models_src/rs_menu.mdl
player.h
skaterift.c
steam.h
textures_src/menu.qoi

index b6ca3e7208c71d054a869d3b65eeae01902907af..7b0751e1fee2d63fef019248239dfec1088f2cc9 100644 (file)
@@ -1943,6 +1943,9 @@ def write_model(collection_name):
 #{
    global g_encoder
    print( F"Model graph | Create mode '{collection_name}'" )
+   folder = bpy.path.abspath(bpy.context.scene.cv_data.export_dir)
+   path = F"{folder}{collection_name}.mdl"
+   print( path )
    
    collection = bpy.data.collections[collection_name]
 
@@ -1958,8 +1961,6 @@ def write_model(collection_name):
 
    # Write 
    #
-   # TODO HOLY
-   path = F"/home/harry/Documents/carve/models_src/{collection_name}.mdl"
    encoder_write_to_file( path )
 
    print( F"Completed {collection_name}.mdl" )
diff --git a/build.c b/build.c
index 84de2fda775e739e06fbc0a2a3ca90820f439eb3..41e34c0a251a390679b77ad26bc7e66b97f9afff 100644 (file)
--- a/build.c
+++ b/build.c
@@ -38,6 +38,7 @@ void build_game( enum compiler compiler )
 
    vg_build_symbolic_link( "textures_src", "textures" );
    vg_build_symbolic_link( "models_src", "models" );
+   vg_build_symbolic_link( "maps_src", "maps" );
    vg_build_symbolic_link( "sound_src", "sound" );
    vg_build_syscall( "mkdir -p %s/cfg", vg_compiler.build_dir );
 
index fa6df751c03eea9c5cdec0cdb9d0943dffd6d83b..e9df311a030462474d0c27d2d09bc9c967b9bedc 100644 (file)
--- a/common.h
+++ b/common.h
 
 #define RESET_MAX_TIME 45.0
 
+enum menu_controller_type
+{
+   k_menu_controller_type_keyboard,
+   k_menu_controller_type_xbox,
+   k_menu_controller_type_playstation,
+   k_menu_controller_type_steam,
+   k_menu_controller_type_steam_deck
+};
+
+VG_STATIC enum menu_controller_type menu_display_controller;
+VG_STATIC float g_fov_option = 0.86f;
+
 typedef struct ray_hit ray_hit;
 struct ray_hit
 {
diff --git a/maps_src/mp_gridmap.mdl b/maps_src/mp_gridmap.mdl
new file mode 100644 (file)
index 0000000..2284ed0
Binary files /dev/null and b/maps_src/mp_gridmap.mdl differ
diff --git a/maps_src/mp_mtzero.mdl b/maps_src/mp_mtzero.mdl
new file mode 100644 (file)
index 0000000..0d4d2d2
Binary files /dev/null and b/maps_src/mp_mtzero.mdl differ
diff --git a/menu.h b/menu.h
index d7c422d38d2beaf66959a3a5e9f65122d2a620a7..2945449fff77fdadad516a5d5281009dee813354 100644 (file)
--- a/menu.h
+++ b/menu.h
@@ -9,6 +9,9 @@
 #include "shaders/menu.h"
 #include "vg/vg_steam_friends.h"
 
+#define CUTE_FILES_IMPLEMENTATION
+#include "vg/dep/randygaul/cute_files.h"
+
 VG_STATIC mdl_context menu_model;
 VG_STATIC glmesh      menu_glmesh;
 VG_STATIC m4x3f       menu_mdl_mtx;
@@ -17,10 +20,6 @@ VG_STATIC float       menu_input_cooldown = 0.0f;
 VG_STATIC float       menu_fov_target = 97.0f;
 VG_STATIC v2f         menu_extra_angles;
 
-VG_STATIC int         menu_loc = 0xb,
-                      menu_loc_last = 1;
-VG_STATIC u32         menu_page     = 0;
-
 VG_STATIC int         cl_menu         = 0,
                       cl_menu_go_away = 0;
 
@@ -37,50 +36,151 @@ VG_STATIC struct input_binding input_menu_h,
                                input_menu_toggle,
                                input_menu_toggle_kbm;
 
-VG_STATIC void menu_btn_paused( int event );
 VG_STATIC void menu_btn_quit( int event );
 VG_STATIC void menu_btn_skater( int event );
-VG_STATIC void menu_btn_map( int event );
-VG_STATIC void menu_btn_map_a( int event );
-VG_STATIC void menu_btn_map_b( int event );
-VG_STATIC void menu_btn_map_c( int event );
 VG_STATIC void menu_btn_fuckoff( int event );
 VG_STATIC void menu_btn_reset( int event );
+VG_STATIC void menu_btn_map( int event );
+VG_STATIC void menu_btn_settings( int event );
+
+VG_STATIC mdl_node *menu_pnode_fov_slider,
+                   *menu_pnode_fov_min,
+                   *menu_pnode_fov_max;
+
+struct
+{
+   /* state */
+   int loc;
+   u32 page;
+
+   /* map browser */
+   struct menu_map_file
+   {
+      char name[ 64 ];
+   }
+   maps_list[ 16 ];
+
+   int selected_map,
+       map_count;
+}
+VG_STATIC game_menu;
+
+enum menu_page
+{
+   k_menu_page_main     = 0x1,
+   k_menu_page_skater   = 0x2,
+   k_menu_page_quit     = 0x4,
+   k_menu_page_settings = 0x8,
+   k_menu_page_map      = 0x10
+};
+
+VG_STATIC int menu_vis( int group_mask )
+{
+   if( group_mask & game_menu.page )
+      return 1;
+   else
+      return 0;
+}
+
+VG_STATIC int menu_controller( int ctr )
+{
+   if( (game_menu.page & (k_menu_page_main|k_menu_page_settings)) 
+         && (ctr == menu_display_controller) )
+      return 1;
+   return 0;
+}
+
+VG_STATIC int menu_controller_inf( int ctr )
+{
+   if( (game_menu.page & k_menu_page_settings) && (ctr == menu_display_controller) )
+      return 1;
+   return 0;
+}
 
 struct menu_button
 {
    const char *name;
-   u32 areas;
 
-   void (*fn_press)(int event);
-   int links[4];
-   mdl_node *pnode;
+   int (*fn_visibility)( int user );
+   int   user;
 
+   void (*fn_press)( int event );
+
+   const char *ll,
+              *lu,
+              *lr,
+              *ld;
+
+   mdl_node *pnode;
    float falpha, fsize;
 }
 VG_STATIC menu_buttons[] = 
 {
-/*0*/{"text_paused",     1, menu_btn_paused },
-/*1*/{"text_quit",       9, menu_btn_quit,    {3,-1,4,0xb}},
-/*2*/{"text_skater",     3, menu_btn_skater,  {3,0xb,4,-1}},
-/*3*/{"text_map",        5, NULL, {-1,-1,2,-1}},
-/*4*/{"text_about_game", 1, NULL, {2,-1,-1,-1}},
-/*5*/{"skater_left",     2, NULL, {-1,-1,-1,-1}},
-/*6*/{"skater_right",    2, NULL, {-1,-1,-1,-1}},
-/*7*/{"g_map",           5, NULL },
-/*8*/{"g_controls",      1, NULL },
-/*9*/{"text_quitty",     8, NULL },
-/*a*/{"text_yes",        8, menu_btn_fuckoff,{-1,-1,-1,-1} },
-/*b*/{"text_reset",      1, menu_btn_reset,{3,1,4,2} },
+{ 
+   "text_quit", menu_vis, 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, k_menu_page_quit
+   },
+   {
+      "text_yes", menu_vis, k_menu_page_quit,
+         .fn_press = menu_btn_fuckoff
+   },
+{
+   "text_reset", menu_vis, k_menu_page_main,
+   .fn_press = menu_btn_reset,
+      .lu="text_quit", .ld="text_skater", .ll="text_map", .lr="text_settings"
+},
+{  
+   "text_skater", menu_vis, k_menu_page_main|k_menu_page_skater, 
+   .fn_press = menu_btn_skater,
+      .lu="text_reset", .ll="text_map", .lr="text_settings"
+},
+{
+   "text_map", menu_vis, k_menu_page_main,
+   .fn_press = menu_btn_map,
+      .lr="text_skater"
+},
+{
+   "text_settings", menu_vis, k_menu_page_main|k_menu_page_settings,
+   .fn_press = menu_btn_settings,
+      .ll="text_skater"
+},
+{
+   "skater_left", menu_vis, k_menu_page_skater
+},
+{
+   "skater_right", menu_vis, k_menu_page_skater
+},
+
+{ "fov_slider",      menu_vis, k_menu_page_settings },
+{ "fov_info",        menu_vis, k_menu_page_settings },
+
+{ "ctr_xbox",        menu_controller_inf, k_menu_controller_type_xbox, },
+{ "ctr_xbox_text",   menu_controller_inf, k_menu_controller_type_xbox },
+{ "ctr_steam",       menu_controller_inf, k_menu_controller_type_steam },
+{ "ctr_steam_text",  menu_controller_inf, k_menu_controller_type_steam },
+{ "ctr_deck",        menu_controller_inf, k_menu_controller_type_steam_deck },
+{ "ctr_deck_text",   menu_controller_inf, k_menu_controller_type_steam_deck },
+{ "ctr_ps",          menu_controller_inf, k_menu_controller_type_playstation },
+{ "ctr_ps_text",     menu_controller_inf, k_menu_controller_type_playstation },
+{ "ctr_kbm",         menu_controller_inf, k_menu_controller_type_keyboard },
+{ "ctr_kbm_text",    menu_controller_inf, k_menu_controller_type_keyboard },
+{
+   "text_paused", menu_vis, k_menu_page_main 
+},
 };
 
-VG_STATIC void menu_btn_map_a( int event ){}
-VG_STATIC void menu_btn_map_b( int event ){}
-VG_STATIC void menu_btn_map_c( int event ){}
-
-VG_STATIC void menu_btn_paused( int event )
+VG_STATIC int menu_get_loc( const char *loc )
 {
+   for( int i=0; i<vg_list_size(menu_buttons); i++ )
+      if( !strcmp( menu_buttons[i].name, loc ) )
+         return i;
 
+   assert(0);
+   return 0;
 }
 
 VG_STATIC void menu_btn_reset( int event )
@@ -89,7 +189,7 @@ VG_STATIC void menu_btn_reset( int event )
    world_routes_clear();
 
    cl_menu_go_away = 1;
-   menu_page = 0;
+   game_menu.page = 0;
 }
 
 VG_STATIC void menu_btn_fuckoff( int event )
@@ -99,21 +199,88 @@ VG_STATIC void menu_btn_fuckoff( int event )
 
 VG_STATIC void menu_btn_quit( int event )
 {
-   menu_page = 0x8;
-   menu_loc = 0xa;
+   game_menu.page = k_menu_page_quit;
+   game_menu.loc = menu_get_loc( "text_yes" );
 }
 
-VG_STATIC void menu_btn_map( int event )
+VG_STATIC void menu_btn_settings( int event )
 {
-   menu_page = 0x4;
-   menu_loc = 7;
+   game_menu.page = k_menu_page_settings;
+   game_menu.loc = menu_get_loc( "fov_slider" );
 }
 
 VG_STATIC void menu_btn_skater( int event )
 {
-   menu_page = 0x2;
+   game_menu.page = k_menu_page_skater;
 }
 
+VG_STATIC void menu_btn_map( int event )
+{
+   game_menu.page = k_menu_page_map;
+   game_menu.map_count = 0;
+   game_menu.selected_map = 0;
+
+   cf_dir_t dir;
+   cf_dir_open( &dir, "maps" );
+
+   while( dir.has_next )
+   {
+      cf_file_t file;
+      cf_read_file( &dir, &file );
+      
+      if( file.is_reg )
+      {
+         struct menu_map_file *mf = &game_menu.maps_list[ game_menu.map_count ];
+         
+         vg_strncpy( file.name, mf->name, 
+                                vg_list_size(game_menu.maps_list[0].name)-1 );
+
+         game_menu.map_count ++;
+         if( game_menu.map_count == vg_list_size(game_menu.maps_list) )
+            break;
+      }
+
+      cf_dir_next( &dir );
+   }
+
+   cf_dir_close(&dir);
+}
+
+VG_STATIC void menu_crap_ui(void)
+{
+   if( cl_menu && (game_menu.page == k_menu_page_map) )
+   {
+      ui_rect box;
+      box[0] = vg.window_x/2 - 150;
+      box[1] = vg.window_y/2 - 300;
+      box[2] = 300;
+      box[3] = 600;
+
+      ui_fill_rect( box, 0xa0000000 );
+
+      if( game_menu.map_count == 0 )
+      {
+         ui_text( (ui_rect){ vg.window_x/2, box[1]+8, 0,0 }, "No maps found", 1,
+                  k_text_align_center );
+      }
+      else
+      {
+         ui_rect_pad( box, 4 );
+         box[3] = 16;
+
+         for( int i=0; i<game_menu.map_count; i++ )
+         {
+            struct menu_map_file *mf = &game_menu.maps_list[ i ];
+
+            ui_fill_rect( box, game_menu.selected_map == i? 0xa0ffffff:
+                                                            0xa0808080 );
+            ui_text( (ui_rect){ vg.window_x/2, box[1]+2, 0,0 },
+                                 mf->name, 1, k_text_align_center );
+            box[1] += 16+4;
+         }
+      }
+   }
+}
 
 VG_STATIC void steam_on_game_overlay( CallbackMsg_t *msg )
 {
@@ -123,7 +290,8 @@ VG_STATIC void steam_on_game_overlay( CallbackMsg_t *msg )
    if( inf->m_bActive )
    {
       cl_menu = 1;
-      menu_page = 1;
+      game_menu.page = k_menu_page_main;
+      game_menu.loc = menu_get_loc( "text_skater" );
    }
 }
 
@@ -137,13 +305,13 @@ VG_STATIC void menu_init(void)
    vg_create_unnamed_input( &input_menu_toggle_kbm, k_input_type_button );
 
    vg_apply_bind_str( &input_menu_h, "", "gp-ls-h" );
-   vg_apply_bind_str( &input_menu_h, "+", "d" );
-   vg_apply_bind_str( &input_menu_h, "-", "a" );
+   vg_apply_bind_str( &input_menu_h, "+", "right" );
+   vg_apply_bind_str( &input_menu_h, "-", "left" );
    vg_apply_bind_str( &input_menu_v, "", "-gp-ls-v" );
-   vg_apply_bind_str( &input_menu_v, "+", "w" );
-   vg_apply_bind_str( &input_menu_v, "-", "s" );
+   vg_apply_bind_str( &input_menu_v, "+", "up" );
+   vg_apply_bind_str( &input_menu_v, "-", "down" );
    vg_apply_bind_str( &input_menu_press, "", "gp-a" );
-   vg_apply_bind_str( &input_menu_press, "", "e" );
+   vg_apply_bind_str( &input_menu_press, "", "\2enter" );
    vg_apply_bind_str( &input_menu_back, "", "gp-b" );
    vg_apply_bind_str( &input_menu_back, "", "\2escape" );
    vg_apply_bind_str( &input_menu_toggle_kbm, "", "\2escape" );
@@ -154,6 +322,7 @@ VG_STATIC void menu_init(void)
    mdl_open( &menu_model, "models/rs_menu.mdl" );
    mdl_load_metadata( &menu_model, vg_mem.rtmemory );
    mdl_load_mesh_data( &menu_model, vg_mem.scratch );
+   mdl_invert_uv_coordinates( &menu_model );
    mdl_close( &menu_model );
 
    vg_acquire_thread_sync();
@@ -172,6 +341,10 @@ VG_STATIC void menu_init(void)
          vg_fatal_exit_loop( "Menu programming error" );
    }
 
+   menu_pnode_fov_max = mdl_node_from_name( &menu_model, "fov_slider_max" );
+   menu_pnode_fov_min = mdl_node_from_name( &menu_model, "fov_slider_min" );
+   menu_pnode_fov_slider = mdl_node_from_name( &menu_model, "fov_slider" );
+
    shader_menu_register();
 
 #ifdef SR_NETWORKED
@@ -181,7 +354,7 @@ VG_STATIC void menu_init(void)
 
 VG_STATIC void menu_run_directional(void)
 {
-   struct menu_button *btn = &menu_buttons[ menu_loc ];
+   struct menu_button *btn = &menu_buttons[ game_menu.loc ];
 
    if( vg_input_button_down( &input_menu_press ) )
    {
@@ -203,25 +376,22 @@ VG_STATIC void menu_run_directional(void)
 
       if( v2_length2( dir ) > 0.8f*0.8f )
       {
-         int idir = 0;
+         const char *link = NULL;
 
          if( fabsf(dir[0]) > fabsf(dir[1]) )
          {
-            if( dir[0] > 0.0f ) idir = 2;
-            else idir = 0;
+            if( dir[0] > 0.0f ) link = btn->lr;
+            else link = btn->ll;
          }
          else
          {
-            if( dir[1] > 0.0f ) idir = 3;
-            else idir = 1;
+            if( dir[1] > 0.0f ) link = btn->ld;
+            else link = btn->lu;
          }
 
-         int link = btn->links[idir];
-
-         if( link != -1 )
+         if( link )
          {
-            menu_loc_last = menu_loc;
-            menu_loc = link;
+            game_menu.loc = menu_get_loc( link );
             menu_input_cooldown = 0.25f;
          }
       }
@@ -236,7 +406,8 @@ VG_STATIC int menu_page_should_backout(void)
 VG_STATIC void menu_close(void)
 {
    cl_menu_go_away = 1;
-   menu_page = 0;
+   game_menu.page = 0;
+   game_menu.loc = menu_get_loc( "text_skater" );
 }
 
 VG_STATIC void menu_page_main(void)
@@ -255,20 +426,60 @@ VG_STATIC void menu_page_map(void)
 {
    if( menu_page_should_backout() )
    {
-      menu_page = 1;
-      menu_loc = 3;
+      game_menu.page = k_menu_page_main;
+      game_menu.loc = menu_get_loc( "text_map" );
+   }
+
+   if( game_menu.map_count > 0 )
+   {
+      float v = input_menu_v.axis.value;
+      if( (fabsf(v) > 0.7f) && (menu_input_cooldown <= 0.0f) )
+      {
+         audio_lock();
+         audio_play_oneshot( &audio_rewind[4], 1.0f );
+         audio_unlock();
+
+         if( v < 0.0f )
+         {
+            game_menu.selected_map --;
+
+            if( game_menu.selected_map < 0 )
+               game_menu.selected_map = game_menu.map_count-1;
+
+            menu_input_cooldown = 0.25f;
+         }
+         else
+         {
+            game_menu.selected_map ++;
+
+            if( game_menu.selected_map >= game_menu.map_count )
+               game_menu.selected_map = 0;
+
+            menu_input_cooldown = 0.25f;
+         }
+      }
+
+      if( vg_input_button_down( &input_menu_press ) )
+      {
+         /* load map */
+         char temp[256];
+         strcpy( temp, "maps/" );
+         strcat( temp, game_menu.maps_list[game_menu.selected_map].name );
+
+         world_change_world( 1, (const char *[]){ temp } );
+         menu_close();
+      }
    }
 
    menu_fov_target = 80.0f;
-   menu_run_directional();
 }
 
 VG_STATIC void menu_page_quit(void)
 {
    if( menu_page_should_backout() )
    {
-      menu_page = 1;
-      menu_loc = 1;
+      game_menu.page = k_menu_page_main;
+      game_menu.loc = menu_get_loc( "text_quit" );
    }
 
    menu_fov_target = 90.0f;
@@ -282,8 +493,8 @@ VG_STATIC void menu_page_skater(void)
 
    if( menu_page_should_backout() )
    {
-      menu_page = 1;
-      menu_loc = 2;
+      game_menu.page = k_menu_page_main;
+      game_menu.loc = menu_get_loc( "text_skater" );
       return;
    }
 
@@ -299,8 +510,10 @@ VG_STATIC void menu_page_skater(void)
          if( cl_playermdl_id < 0 )
             cl_playermdl_id = 2;
 
-         menu_buttons[5].fsize = 0.4f;
-         menu_buttons[5].falpha = 1.0f;
+         int li = menu_get_loc( "skater_left" );
+
+         menu_buttons[li].fsize = 0.4f;
+         menu_buttons[li].falpha = 1.0f;
 
          menu_input_cooldown = 0.25f;
       }
@@ -310,14 +523,36 @@ VG_STATIC void menu_page_skater(void)
          if( cl_playermdl_id > 2 )
             cl_playermdl_id = 0;
          
-         menu_buttons[6].fsize = 0.4f;
-         menu_buttons[6].falpha = 1.0f;
+         int ri = menu_get_loc( "skater_left" );
+
+         menu_buttons[ri].fsize = 0.4f;
+         menu_buttons[ri].falpha = 1.0f;
 
          menu_input_cooldown = 0.25f;
       }
    }
 }
 
+VG_STATIC void menu_page_settings(void)
+{
+   float h = input_menu_h.axis.value;
+   if( fabsf(h) > 0.04f )
+      g_fov_option += h * vg.frame_delta;
+   g_fov_option = vg_clampf( g_fov_option, 0.0f, 1.0f );
+
+   v3_lerp( menu_pnode_fov_min->co, menu_pnode_fov_max->co, g_fov_option,
+            menu_pnode_fov_slider->co );
+
+   menu_fov_target = vg_lerpf( 97.0f, 135.0f, g_fov_option ) * 0.8f;
+
+   if( menu_page_should_backout() )
+   {
+      game_menu.page = k_menu_page_main;
+      game_menu.loc = menu_get_loc( "text_settings" );
+      return;
+   }
+}
+
 VG_STATIC void menu_update(void)
 {
    vg_input_update( 1, &input_menu_h );
@@ -337,8 +572,7 @@ VG_STATIC void menu_update(void)
       {
          if( toggle_gp )
          {
-            cl_menu_go_away = 1;
-            menu_page = 0;
+            menu_close();
          }
       }
       else
@@ -347,23 +581,25 @@ VG_STATIC void menu_update(void)
             wait_for_a_sec = 1;
 
          cl_menu = 1;
-         menu_page = 1;
+         game_menu.page = 1;
       }
    }
 
-   if( !wait_for_a_sec )
+   if( !wait_for_a_sec && cl_menu )
    {
-      if( menu_page == 1 )
+      if( game_menu.page == k_menu_page_main )
          menu_page_main();
-      else if( menu_page == 2 )
+      else if( game_menu.page == k_menu_page_skater )
          menu_page_skater();
-      else if( menu_page == 4 )
-         menu_page_map();
-      else if( menu_page == 8 )
+      else if( game_menu.page == k_menu_page_quit )
          menu_page_quit();
+      else if( game_menu.page == k_menu_page_settings )
+         menu_page_settings();
+      else if( game_menu.page == k_menu_page_map )
+         menu_page_map();
    }
 
-   struct menu_button *btn = &menu_buttons[ menu_loc ];
+   struct menu_button *btn = &menu_buttons[ game_menu.loc ];
 
    v3f pos;
    v2f angles;
@@ -479,9 +715,9 @@ VG_STATIC void menu_render( m4x4f projection )
    for( int i=0; i<vg_list_size(menu_buttons); i++ )
    {
       struct menu_button *btn = &menu_buttons[i];
-      float talpha = i==menu_loc? 1.0f: 0.0f,
-            tsize0 = btn->areas & menu_page? 1.0f: 0.0f,
-            tsize1 = i==menu_loc? 0.07f: 0.0f,
+      float talpha = i==game_menu.loc? 1.0f: 0.0f,
+            tsize0 = btn->fn_visibility( btn->user )? 1.0f: 0.0f,
+            tsize1 = i==game_menu.loc? 0.07f: 0.0f,
             tsize  = tsize0+tsize1;
 
       btn->falpha = vg_lerpf( btn->falpha, talpha, vg.frame_delta * 14.0f );
diff --git a/model.h b/model.h
index ca7c0b1d5f73d95c1a913fd5857fa552b9eb368e..99aa2f112d44346bbb546793803eef2c7edff0dc 100644 (file)
--- a/model.h
+++ b/model.h
@@ -674,5 +674,13 @@ VG_STATIC void mdl_link_materials( mdl_context *root, mdl_context *child )
    }
 }
 
+VG_STATIC void mdl_invert_uv_coordinates( mdl_context *mdl )
+{
+   for( int i=0; i<mdl->info.vertex_count; i++ )
+   {
+      mdl_vert *vert = &mdl->vertex_buffer[i];
+      vert->uv[1] = 1.0f-vert->uv[1];
+   }
+}
 
 #endif
diff --git a/models_src/mp_demo.mdl b/models_src/mp_demo.mdl
deleted file mode 100644 (file)
index 8412f8b..0000000
Binary files a/models_src/mp_demo.mdl and /dev/null differ
diff --git a/models_src/mp_dev.mdl b/models_src/mp_dev.mdl
deleted file mode 100644 (file)
index 47f0db7..0000000
Binary files a/models_src/mp_dev.mdl and /dev/null differ
index 069b224f98920206077a6a859389f2f9ab697641..8559fb3e8e145d7ce87e05abc3b92e8ea682a6ab 100644 (file)
Binary files a/models_src/rs_menu.mdl and b/models_src/rs_menu.mdl differ
index f426b7daad07462dc915b518c36da249b0ff5fbc..0abb22e41963d8da8c5e8e579e93c0417aaba6ef 100644 (file)
--- a/player.h
+++ b/player.h
@@ -370,12 +370,17 @@ VG_STATIC void player_save_rewind_frame(void)
    }
 }
 
+
+/* disaster */
+VG_STATIC int         menu_enabled(void);
+#include "menu.h"
+
 /*
  * Free camera movement
  */
 VG_STATIC void player_mouseview(void)
 {
-   if( ui_want_mouse() )
+   if( menu_enabled() )
       return;
 
    v2_muladds( player.angles, vg.mouse_delta, 0.0025f, player.angles );
@@ -413,10 +418,6 @@ VG_STATIC void player_mouseview(void)
    player.angles[1] = vg_clampf( player.angles[1], -VG_PIf*0.5f, VG_PIf*0.5f );
 }
 
-/* disaster */
-VG_STATIC int         menu_enabled(void);
-#include "menu.h"
-
 /* Deal with input etc */
 VG_STATIC void player_update_pre(void)
 {
index 21a7981793ba6ccd6149de3a5aaaccb483ecdf0d..97f6553d7cb438a20d6a8680eb8f1033f63840a1 100644 (file)
@@ -61,6 +61,14 @@ VG_STATIC void vg_preload(void)
       .persistent = 1
    });
 
+   vg_convar_push( (struct vg_convar){
+      .name = "cl_fov",
+      .data = &g_fov_option,
+      .data_type = k_convar_dtype_f32,
+      .opt_f32 = { .clamp = 0 },
+      .persistent = 1
+   });
+
 vg_info(" Copyright  .        . .       -----, ,----- ,---.   .---.  \n" );
 vg_info(" 2021-2022  |\\      /| |           /  |      |    | |    /| \n" );
 vg_info("            | \\    / | +--        /   +----- +---'  |   / | \n" );
@@ -94,7 +102,7 @@ VG_STATIC void vg_load(void)
    world_audio_init();
 
    /* 'systems' are completely loaded now */
-   strcpy( world.world_name, "models/mp_dev.mdl" );
+   strcpy( world.world_name, "maps/mp_mtzero.mdl" );
    world_load();
    vg_console_load_autos();
 }
@@ -153,11 +161,12 @@ VG_STATIC void render_main_game(void)
    m4x4f world_4x4;
    m4x3_expand( camera_mtx_inverse, world_4x4 );
 
-   static float fov = 97.0f;
+   static float fov = 60.0f;
+
+   float fov_target = vg_lerpf( 90.0f, 110.0f, g_fov_option );
 
-   float fov_target = 108.0f;
    if( player.phys.on_board )
-      fov_target = 118.0f;
+      fov_target = vg_lerpf( 97.0f, 135.0f, g_fov_option );
 
    if( cl_menu )
       fov_target = menu_fov_target;
@@ -259,6 +268,8 @@ VG_STATIC void vg_render(void)
 
 VG_STATIC void vg_ui(void)
 {
+   menu_crap_ui();
+
 #if 0
    if( lightedit )
    {
diff --git a/steam.h b/steam.h
index a417622c5a17e246a0fe4e456924dd38dbab448a..47de1089a42aad244497970394fe9be1c7a3478f 100644 (file)
--- a/steam.h
+++ b/steam.h
@@ -177,6 +177,8 @@ VG_STATIC void steam_on_recieve_current_stats( CallbackMsg_t *msg )
    }
 }
 
+VG_STATIC ISteamInput *steam_hInput;
+
 VG_STATIC int steam_init(void)
 {
    const char *username = NULL;
@@ -240,28 +242,9 @@ VG_STATIC int steam_init(void)
                .function = steam_set_achievemnt_test
        });
 
-   vg_info( "Checking controller type\n" );
-
-   ISteamInput *hInput = SteamAPI_SteamInput();
-   SteamAPI_ISteamInput_Init( hInput, 0 );
-   SteamAPI_ISteamInput_RunFrame( hInput, 0 );
-   InputHandle_t joy0 = SteamAPI_ISteamInput_GetControllerForGamepadIndex( 
-                           hInput, 0 );
-
-   if( joy0 != 0 )
-   {
-      ESteamInputType type = SteamAPI_ISteamInput_GetInputTypeForHandle(
-                           hInput, joy0 );
-
-      if( type == k_ESteamInputType_SteamController )
-         vg.gamepad_use_trackpad_look = 1;
-
-      vg_info( "Type: %d\n", type );
-   }
-   else
-   {
-      vg_warn( "none found\n" );
-   }
+   steam_hInput = SteamAPI_SteamInput();
+   SteamAPI_ISteamInput_Init( steam_hInput, 0 );
+   SteamAPI_ISteamInput_RunFrame( steam_hInput, 0 );
    
 #endif
 
@@ -275,7 +258,52 @@ VG_STATIC int steam_init(void)
 VG_STATIC void steam_update(void)
 {
    if( steam_ready )
+   {
       steamworks_event_loop( hSteamClientPipe );
+
+      if( steam_hInput )
+      {
+         SteamAPI_ISteamInput_RunFrame( steam_hInput, 0 );
+
+         InputHandle_t joy0 = SteamAPI_ISteamInput_GetControllerForGamepadIndex( 
+                                 steam_hInput, 0 );
+
+         vg.gamepad_use_trackpad_look = 0;
+         if( joy0 != 0 )
+         {
+            ESteamInputType type = SteamAPI_ISteamInput_GetInputTypeForHandle(
+                                 steam_hInput, joy0 );
+
+            if( type == k_ESteamInputType_SteamController )
+            {
+               vg.gamepad_use_trackpad_look = 1;
+               menu_display_controller = k_menu_controller_type_steam;
+            }
+            else if( type == k_ESteamInputType_SteamDeckController )
+            {
+               menu_display_controller = k_menu_controller_type_steam_deck;
+            }
+            else if( type == k_ESteamInputType_PS3Controller ||
+                     type == k_ESteamInputType_PS4Controller ||
+                     type == k_ESteamInputType_PS5Controller )
+            {
+               menu_display_controller = k_menu_controller_type_playstation;
+            }
+            else if( type == k_ESteamInputType_XBox360Controller ||
+                     type == k_ESteamInputType_XBoxOneController )
+            {
+               menu_display_controller = k_menu_controller_type_xbox;
+            }
+            else
+            {
+               /* currently unsupported controller */
+               menu_display_controller = k_menu_controller_type_xbox;
+            }
+         }
+         else
+            menu_display_controller = k_menu_controller_type_keyboard;
+      }
+   }
 }
 
 VG_STATIC void steam_end(void *nothing)
index 6de494b12da26efff0620cc77d1117b6c892d26e..26e22f05b3ac7c303044037a39c2e23f97b4a490 100644 (file)
Binary files a/textures_src/menu.qoi and b/textures_src/menu.qoi differ