couple fix
authorhgn <hgodden00@gmail.com>
Mon, 31 Oct 2022 03:12:21 +0000 (03:12 +0000)
committerhgn <hgodden00@gmail.com>
Mon, 31 Oct 2022 03:12:21 +0000 (03:12 +0000)
menu.h
models_src/mp_demo.mdl [new file with mode: 0644]
models_src/mp_dev.mdl
textures_src/gradients.png
world.h

diff --git a/menu.h b/menu.h
index b407f4a6477d50147ce9ddee2b73b74c6055b751..d5eb90f058269df735649efe2e6cd162d5841a29 100644 (file)
--- a/menu.h
+++ b/menu.h
@@ -7,6 +7,7 @@
 #include "player.h"
 
 #include "shaders/menu.h"
+#include "vg/vg_steam_friends.h"
 
 VG_STATIC mdl_context menu_model;
 VG_STATIC glmesh      menu_glmesh;
@@ -104,6 +105,19 @@ VG_STATIC void menu_btn_skater( int event )
    menu_page = 0x2;
 }
 
+
+VG_STATIC void steam_on_game_overlay( CallbackMsg_t *msg )
+{
+   GameOverlayActivated_t *inf = (GameOverlayActivated_t *)msg->m_pubParam;
+   vg_info( "Steam game overlay activated; pausing\n" );
+
+   if( inf->m_bActive )
+   {
+      cl_menu = 1;
+      menu_page = 1;
+   }
+}
+
 VG_STATIC void menu_init(void)
 {
    vg_linear_clear( vg_mem.scratch );
@@ -130,6 +144,10 @@ VG_STATIC void menu_init(void)
    }
 
    shader_menu_register();
+
+#ifdef SR_NETWORKED
+   steam_register_callback( k_iGameOverlayActivated, steam_on_game_overlay );
+#endif
 }
 
 VG_STATIC void menu_run_directional(void)
diff --git a/models_src/mp_demo.mdl b/models_src/mp_demo.mdl
new file mode 100644 (file)
index 0000000..8412f8b
Binary files /dev/null and b/models_src/mp_demo.mdl differ
index 60ed5ff4f58e4b9df6b49e115b2a27199add66cb..e81a01341c43cde9a56c0c1a003ed229df367ec0 100644 (file)
Binary files a/models_src/mp_dev.mdl and b/models_src/mp_dev.mdl differ
index 9ccdf0011c4d4cf197d0c4257f816dc0ee6e3201..719ccfd362fcda9ed82bdd16e903d970c6e3587c 100644 (file)
Binary files a/textures_src/gradients.png and b/textures_src/gradients.png differ
diff --git a/world.h b/world.h
index 5f297d0c68e8d6a5bd0908bcc85e05f201875145..a92591e294963636653dba6f7c294304aeb297ac 100644 (file)
--- a/world.h
+++ b/world.h
@@ -563,36 +563,40 @@ VG_STATIC void world_update( v3f pos )
    world_routes_debug();
 #endif
    
-   int closest = 0;
-   float min_dist = INFINITY;
-
-   for( int i=0; i<world.route_count; i++ )
+   if( world.route_count > 0 )
    {
-      float d = v3_dist2( world.routes[i].scoreboard_transform[3], pos );
+      int closest = 0;
+      float min_dist = INFINITY;
 
-      if( d < min_dist )
+      for( int i=0; i<world.route_count; i++ )
       {
-         min_dist = d;
-         closest = i;
-      }
-   }
+         float d = v3_dist2( world.routes[i].scoreboard_transform[3], pos );
 
-   if( (world.active_route_board != closest) || network_scores_updated )
-   {
-      network_scores_updated = 0;
-      world.active_route_board = closest;
+         if( d < min_dist )
+         {
+            min_dist = d;
+            closest = i;
+         }
+      }
 
-      struct route *route = &world.routes[closest];
+      if( (world.active_route_board != closest) || network_scores_updated )
+      {
+         network_scores_updated = 0;
+         world.active_route_board = closest;
 
-      u32 id = route->track_id;
+         struct route *route = &world.routes[closest];
 
-      if( id != 0xffffffff )
-      {
-         struct netmsg_board *local_board = &scoreboard_client_data.boards[id];
+         u32 id = route->track_id;
 
-         for( int i=0; i<13; i++ )
+         if( id != 0xffffffff )
          {
-            sfd_encode( i, &local_board->data[27*i] );
+            struct netmsg_board *local_board = 
+               &scoreboard_client_data.boards[id];
+
+            for( int i=0; i<13; i++ )
+            {
+               sfd_encode( i, &local_board->data[27*i] );
+            }
          }
       }
    }