stepping
authorhgn <hgodden00@gmail.com>
Fri, 31 Mar 2023 16:37:26 +0000 (17:37 +0100)
committerhgn <hgodden00@gmail.com>
Fri, 31 Mar 2023 16:37:26 +0000 (17:37 +0100)
17 files changed:
player.h
player_walk.c
shaders/model_character_view.h
shaders/model_skinned.vs
shaders/model_sky.h
shaders/scene_depth.h
shaders/scene_position.h
shaders/scene_route.h
shaders/scene_scoretext.h
shaders/scene_standard.h
shaders/scene_standard_alphatest.h
shaders/scene_terrain.h
shaders/scene_vertex_blend.h
shaders/scene_water.h
shaders/scene_water_fast.h
steam.h
world_gen.h

index 65f8241768d5df6998c7697ef1f015406dc7fed1..8a0b17d28552f3992c99874bd746d4987f59da95 100644 (file)
--- a/player.h
+++ b/player.h
@@ -414,7 +414,6 @@ VG_STATIC void player_init(void)                                         /* 1 */
    VG_VAR_I32( cl_thirdperson );
    VG_VAR_F32_PERSISTENT( fc_speed );
 
-   /* TODO: NOT PERSISTENT */
    VG_VAR_F32( k_ragdoll_limit_scale );
    VG_VAR_I32( k_ragdoll_div );
    VG_VAR_I32( k_ragdoll_debug_collider );
index e39c8196b1159e24ffb59dc7814fa6ca8ecfedb1..959ed4be31cef7b4271439a57804475bfe3299e5 100644 (file)
@@ -361,6 +361,8 @@ VG_STATIC void player__walk_update( player_instance *player )
    struct player_walk *w = &player->_walk;
    v3_copy( player->rb.co, w->state.prev_pos );
 
+   enum walk_activity prev_state = w->state.activity;
+
    if( w->state.activity == k_walk_activity_immobile )
       return;
 
@@ -392,11 +394,11 @@ VG_STATIC void player__walk_update( player_instance *player )
       v2_normalize_clamp( walk );
 
    w->move_speed = v2_length( walk );
+   world_instance *world = get_active_world();
 
    /* 
     * Collision detection
     */
-   world_instance *world = get_active_world();
 
    len = rb_capsule__scene( mtx, &w->collider, NULL, 
                             &world->rb_geo.inf.scene, manifold );
@@ -410,13 +412,11 @@ VG_STATIC void player__walk_update( player_instance *player )
 
    w->surface = k_surface_prop_concrete;
 
-   for( int i=0; i<len; i++ )
-   {
+   for( int i=0; i<len; i++ ){
       struct contact *ct = &manifold[i];
       rb_debug_contact( ct );
 
-      if( player_walk_normal_standable( player, ct->n ) )
-      {
+      if( player_walk_normal_standable( player, ct->n ) ){
          if( w->state.activity != k_walk_activity_lockedmove )
             w->state.activity = k_walk_activity_ground;
 
@@ -455,8 +455,11 @@ VG_STATIC void player__walk_update( player_instance *player )
 
       /* jump */
       if( player->input_jump->button.value ){
+         float d = v3_dot( player->basis[1], player->rb.v );
+         v3_muladds( player->rb.v, player->basis[1], -d, player->rb.v );
          v3_muladds( player->rb.v, player->basis[1], 5.0f, player->rb.v );
          w->state.activity = k_walk_activity_air;
+         prev_state = k_walk_activity_air;
          accel_speed = k_walk_air_accel;
          nominal_speed = k_airspeed;
       }
@@ -492,47 +495,44 @@ VG_STATIC void player__walk_update( player_instance *player )
       }
    }
 
-   /* 
-    * Depenetrate
-    */
-   v3f dt;
-   rb_depenetrate( manifold, len, dt );
-   v3_add( dt, player->rb.co, player->rb.co );
-
-   /* TODO: Stepping......
-    *
-    *        ideas; walkgrid style steps
-    */
-#if 0
-   if( w->state.activity == k_walk_activity_ground )
-   {
-      /* step */
+   /* stepping */
+   if( w->state.activity == k_walk_activity_ground||
+       prev_state == k_walk_activity_ground ){
       float max_dist = 0.4f;
 
       v3f pa, pb;
       v3_copy( player->rb.co, pa );
-      pa[1] += w->collider.radius + max_dist;
-
-      v3_muladds( pa, (v3f){0.0f,1.0f,0.0f}, -max_dist * 2.0f, pb );
+      v3_muladds( pa, player->basis[1],  w->collider.radius + max_dist, pa );
+      v3_muladds( pa, player->basis[1], -max_dist * 2.0f, pb );
       vg_line( pa, pb, 0xff000000 );
 
       v3f n;
       float t;
-      if( spherecast_world( pa, pb, w->collider.radius, &t, n ) != -1 )
-      {
-         if( player_walk_normal_standable( n ) )
-         {
+      if( spherecast_world( world, pa, pb, w->collider.radius, &t, n ) != -1 ){
+         if( player_walk_normal_standable( player, n ) ){
             v3_lerp( pa, pb, t, player->rb.co );
-            player->rb.co[1] -= w->collider.radius;
+            v3_muladds( player->rb.co, player->basis[1], 
+                        -w->collider.radius - k_penetration_slop,
+                        player->rb.co );
+            w->state.activity = k_walk_activity_ground;
+
+            float d = -v3_dot(n,player->rb.v),
+                  g = -k_gravity * k_rb_delta;
+            v3_muladds( player->rb.v, n, d, player->rb.v );
+            v3_muladds( player->rb.v, player->basis[1], g, player->rb.v );
          }
       }
    }
-#endif
 
+   /* 
+    * Depenetrate
+    */
+   v3f dt;
+   rb_depenetrate( manifold, len, dt );
+   v3_add( dt, player->rb.co, player->rb.co );
 
    /* integrate */
-   if( w->state.activity == k_walk_activity_air )
-   {
+   if( w->state.activity == k_walk_activity_air ){
       v3_muladds( player->rb.v, player->basis[1], -k_gravity*k_rb_delta, 
                   player->rb.v );
    }
@@ -558,13 +558,11 @@ VG_STATIC void player__walk_update( player_instance *player )
 
    float movedist = v3_length( movedelta );
 
-   if( movedist > 0.3f )
-   {
+   if( movedist > 0.3f ){
       float t, sr = w->collider.radius-0.04f;
       v3f n;
 
-      if( spherecast_world( world, lwr_prev, lwr_now, sr, &t, n ) != -1 )
-      {
+      if( spherecast_world( world, lwr_prev, lwr_now, sr, &t, n ) != -1 ){
          v3_lerp( lwr_prev, lwr_now, vg_maxf(0.01f,t), player->rb.co );
          player->rb.co[1] -= w->collider.radius;
          rb_update_transform( &player->rb );
index d7e69019a6c96a57def725c40cfa99eb26243dcc..bae097d5a097ba0826ebe46fb9728b6fb8587ac9 100644 (file)
@@ -65,7 +65,7 @@ static struct vg_shader _shader_model_character_view = {
 "   aCo = a_co;\n"
 "   aWorldCo = world_pos;\n"
 "\n"
-"   // TODO:\n"
+"   // TODO: motion vectors\n"
 "   aMotionVec0 = vec3(1.0);\n"
 "   aMotionVec1 = vec3(1.0);\n"
 "}\n"
@@ -212,9 +212,8 @@ static struct vg_shader _shader_model_character_view = {
 "\n"
 "float world_water_depth( vec3 pos )\n"
 "{\n"
-"   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
+"   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 78255e159c3f6bc31d347724495a1db29ea2e4c5..c0775eb50ef5a032148e86e5385160971d674376 100644 (file)
@@ -36,7 +36,7 @@ void main()
    aCo = a_co;
    aWorldCo = world_pos;
 
-   // TODO:
+   // TODO: motion vectors
    aMotionVec0 = vec3(1.0);
    aMotionVec1 = vec3(1.0);
 }
index d5498311ce6d72782567ca594e8462d978b82620..b5b58e5fd24f50675a358ed563b99bbbdb0ff615 100644 (file)
@@ -206,9 +206,8 @@ static struct vg_shader _shader_model_sky = {
 "\n"
 "float world_water_depth( vec3 pos )\n"
 "{\n"
-"   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
+"   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 8e836e40a6aa617da6ed143d14507a81e19ed4a9..f1c5af34368ff017a54d28f43935d47d905a7724 100644 (file)
@@ -205,9 +205,8 @@ static struct vg_shader _shader_scene_depth = {
 "\n"
 "float world_water_depth( vec3 pos )\n"
 "{\n"
-"   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
+"   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 8f902a15395cb62481fa970c7ca9a709b0716213..029b8aae59fcc122f0e9846b9075f7acbac29610 100644 (file)
@@ -205,9 +205,8 @@ static struct vg_shader _shader_scene_position = {
 "\n"
 "float world_water_depth( vec3 pos )\n"
 "{\n"
-"   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
+"   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 4fe92e0c369ffe43980147c75a7104cf7b374e10..a381ee0ee71fbae9333955eea22bd5dcbd5b4de7 100644 (file)
@@ -206,9 +206,8 @@ static struct vg_shader _shader_scene_route = {
 "\n"
 "float world_water_depth( vec3 pos )\n"
 "{\n"
-"   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
+"   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 8b04293ba1cfd7a397a5092b5ad2355918697636..16792a67f1ed531e68f6b67a07e48d336cb1b0ab 100644 (file)
@@ -226,9 +226,8 @@ static struct vg_shader _shader_scene_scoretext = {
 "\n"
 "float world_water_depth( vec3 pos )\n"
 "{\n"
-"   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
+"   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 994f7f30d3dd8c959cd0b30afd861fa7b828252b..e6d6e6f67c2ffbceca693801c413af7c431ee536 100644 (file)
@@ -206,9 +206,8 @@ static struct vg_shader _shader_scene_standard = {
 "\n"
 "float world_water_depth( vec3 pos )\n"
 "{\n"
-"   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
+"   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index d2d6e084fd8d13eb8328f65af9869273b963dae7..f14bd6c7793e7b3d33edb44614819185b61a4017 100644 (file)
@@ -206,9 +206,8 @@ static struct vg_shader _shader_scene_standard_alphatest = {
 "\n"
 "float world_water_depth( vec3 pos )\n"
 "{\n"
-"   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
+"   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 6befad3a3b6426ccc517dfcbae74e30fe79145e0..00e9399683f21884280e053f30e80cd6f3426603 100644 (file)
@@ -207,9 +207,8 @@ static struct vg_shader _shader_scene_terrain = {
 "\n"
 "float world_water_depth( vec3 pos )\n"
 "{\n"
-"   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
+"   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index 6bfb88217c6a944a5d3a2d1bb91e33463aecfacb..17c6f91694eae9f3be8cf5b06a7c268d6ba09a78 100644 (file)
@@ -205,9 +205,8 @@ static struct vg_shader _shader_scene_vertex_blend = {
 "\n"
 "float world_water_depth( vec3 pos )\n"
 "{\n"
-"   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
+"   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
index f36b34ef1246b4394f59aa0b4f3e5e0eb67d388b..a62842adb3fab234de5d81b4ddddfc1f4698ed51 100644 (file)
@@ -213,9 +213,8 @@ static struct vg_shader _shader_scene_water = {
 "\n"
 "float world_water_depth( vec3 pos )\n"
 "{\n"
-"   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
+"   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
@@ -462,7 +461,7 @@ static struct vg_shader _shader_scene_water = {
 "   vec2 ssuv = gl_FragCoord.xy*uInvRes;\n"
 "   \n"
 "   // Surface colour composite\n"
-"   float depthvalue = clamp( -world_water_depth(aWorldCo)*(1.0/25.0), 0.0,1.0 );\n"
+"   float depthvalue = clamp( -world_water_depth(aCo)*(1.0/25.0), 0.0,1.0 );\n"
 "\n"
 "   vec2 world_coord = aCo.xz * 0.008;\n"
 "   vec4 time_offsets = vec4( uTime ) * vec4( 0.008, 0.006, 0.003, 0.03 );\n"
index 5d3b534a25ddeb1c79cf313826e5cd34cf96d100..b4510c7e31292b0dcaf62556bd1b64c3bdb05778 100644 (file)
@@ -210,9 +210,8 @@ static struct vg_shader _shader_scene_water_fast = {
 "\n"
 "float world_water_depth( vec3 pos )\n"
 "{\n"
-"   vec2 depth_coord = (pos.xz - g_depth_bounds.xy) * g_depth_bounds.zw; \n"
 "   float ref_depth = g_water_plane.y*g_water_plane.w;\n"
-"   return texture( g_world_depth, depth_coord ).g-ref_depth;\n"
+"   return world_depth_sample( pos ) - ref_depth;\n"
 "}\n"
 "\n"
 "float shadow_sample( vec3 vdir )\n"
diff --git a/steam.h b/steam.h
index 4f98dd9334be4f6a97fceafa76c21f05c6b5215f..f6eadcd1ba81390c1c2aec756482b1f5440ce2f4 100644 (file)
--- a/steam.h
+++ b/steam.h
@@ -54,46 +54,37 @@ VG_STATIC const char *steam_achievement_names[] =
 
 VG_STATIC void steam_store_achievements(void)
 {
-   if( steam_ready && steam_stats_ready )
-   {
+   if( steam_ready && steam_stats_ready ){
       SteamAPI_ISteamUserStats_StoreStats( hSteamUserStats );
    }
 }
 
 VG_STATIC void steam_set_achievement( const char *name )
 {
-   if( steam_ready && steam_stats_ready )
-   {
-      if( SteamAPI_ISteamUserStats_SetAchievement( hSteamUserStats, name ) )
-      {
+   if( steam_ready && steam_stats_ready ){
+      if( SteamAPI_ISteamUserStats_SetAchievement( hSteamUserStats, name ) ){
          vg_success( "Achievement set! '%s'\n", name );
       }
-      else
-      {
+      else{
          vg_warn( "Failed to set achievement: %s\n", name );
       }
    }
-   else
-   {
+   else{
       vg_warn( "Failed to set achievement (steam not ready): %s\n", name );
    }
 }
 
 VG_STATIC void steam_clear_achievement( const char *name )
 {
-   if( steam_ready && steam_stats_ready )
-   {
-      if( SteamAPI_ISteamUserStats_ClearAchievement( hSteamUserStats, name ) )
-      {
+   if( steam_ready && steam_stats_ready ){
+      if( SteamAPI_ISteamUserStats_ClearAchievement( hSteamUserStats, name ) ){
          vg_info( "Achievement cleared: '%s'\n", name );
       }
-      else
-      {
+      else{
          vg_warn( "Failed to clear achievement: %s\n", name );
       }
    }
-   else
-   {
+   else{
       vg_warn( "Failed to clear achievement (steam not ready): %s\n", name );
    }
 }
@@ -103,10 +94,8 @@ VG_STATIC int steam_list_achievements( int argc, char const *argv[] )
 {
    vg_info( "Achievements: \n" );
 
-   if( steam_ready && steam_stats_ready )
-   {
-      for( int i=0; i<vg_list_size(steam_achievement_names); i++ )
-      {
+   if( steam_ready && steam_stats_ready ){
+      for( int i=0; i<vg_list_size(steam_achievement_names); i++ ){
          int set = 0;
          const char *name = steam_achievement_names[i];
 
@@ -115,14 +104,12 @@ VG_STATIC int steam_list_achievements( int argc, char const *argv[] )
          {
             vg_info( "  %s %s\n", (set? "[YES]": "[   ]"), name );
          }
-         else
-         {
+         else{
             vg_warn( "  Error while fetching achievement status '%s'\n", name );
          }
       }
    }
-   else
-   {
+   else{
       vg_warn( "  Steam is not initialized, no results\n" );
    }
 
@@ -131,17 +118,14 @@ VG_STATIC int steam_list_achievements( int argc, char const *argv[] )
 
 VG_STATIC int steam_clear_all_achievements( int argc, char const *argv[] )
 {
-   if( steam_ready && steam_stats_ready )
-   {
-      for( int i=0; i<vg_list_size(steam_achievement_names); i++ )
-      {
+   if( steam_ready && steam_stats_ready ){
+      for( int i=0; i<vg_list_size(steam_achievement_names); i++ ){
          steam_clear_achievement( steam_achievement_names[i] );
       }
       
       steam_store_achievements();
    }
-   else
-   {
+   else{
       vg_warn( "steam is not initialized, cannot clear\n" );
    }
 
@@ -166,14 +150,12 @@ VG_STATIC void steam_on_recieve_current_stats( CallbackMsg_t *msg )
 {
    UserStatsReceived_t *rec = (UserStatsReceived_t *)msg->m_pubParam;
 
-   if( rec->m_eResult == k_EResultOK )
-   {
+   if( rec->m_eResult == k_EResultOK ){
       vg_info( "Recieved stats for: %lu (user: %lu)\n", rec->m_nGameID,
                                                         rec->m_steamIDUser );
       steam_stats_ready = 1;
    }
-   else
-   {
+   else{
       vg_error( "Error recieveing stats for user (%u)\n", rec->m_eResult );
    }
 }
@@ -182,8 +164,7 @@ VG_STATIC ISteamInput *steam_hInput;
 
 VG_STATIC u32 utf8_byte0_byte_count( u8 char0 )
 {
-   for( u32 k=2; k<4; k++ )
-   {
+   for( u32 k=2; k<4; k++ ){
       if( !(char0 & (0x80 >> k)) )
          return k;
    }
@@ -197,38 +178,31 @@ VG_STATIC void str_utf8_collapse( const char *str, char *buf, u32 length )
    u32 utf32_code = 0x00000000;
    u32 i=0, j=0, utf32_byte_ct=0;
 
-   for(;i < length-1;)
-   {
+   for(;i < length-1;){
       if( ustr[i] == 0x00 )
          break;
       
-      if( ustr[i] & 0x80 )
-      {
-         if( utf32_byte_ct )
-         {
+      if( ustr[i] & 0x80 ){
+         if( utf32_byte_ct ){
             utf32_byte_ct --;
             utf32_code |= (ustr[i] & 0x3F) << (utf32_byte_ct*6);
 
-            if( !utf32_byte_ct )
-            {
+            if( !utf32_byte_ct ){
                const char *match;
                size_t chars = anyascii( utf32_code, &match );
 
-               for( u32 k=0; k<VG_MIN(chars, length-1-j); k++ )
-               {
+               for( u32 k=0; k<VG_MIN(chars, length-1-j); k++ ){
                   buf[ j++ ] = (u8)match[k];
                }
             }
          }
-         else
-         {
+         else{
             utf32_byte_ct = utf8_byte0_byte_count( ustr[i] )-1;
             utf32_code = ustr[i] & (0x3F >> utf32_byte_ct);
             utf32_code <<= utf32_byte_ct*6;
          }
       }
-      else
-      {
+      else{
          utf32_byte_ct = 0x00;
          buf[j ++] = str[i];
       }
@@ -246,8 +220,7 @@ VG_STATIC int steam_init(void)
 #ifdef SR_NETWORKED
    vg_info( "Initializing steamworks\n" );
 
-   if( !SteamAPI_Init() )
-   {
+   if( !SteamAPI_Init() ){
       printf("\n");
       vg_error( "Steamworks failed to initialize\n" );
       return 1;
@@ -317,33 +290,28 @@ VG_STATIC int steam_init(void)
 
 VG_STATIC void steam_update(void)
 {
-   if( steam_ready )
-   {
+   if( steam_ready ){
       steamworks_event_loop( hSteamClientPipe );
 
       /* TODO
        * We can probably request this from SDL too
        */
-      if( steam_hInput )
-      {
+      if( steam_hInput ){
          SteamAPI_ISteamInput_RunFrame( steam_hInput, 0 );
 
          InputHandle_t joy0 = SteamAPI_ISteamInput_GetControllerForGamepadIndex( 
                                  steam_hInput, 0 );
 
          vg_input.controller_should_use_trackpad_look = 0;
-         if( joy0 != 0 )
-         {
+         if( joy0 != 0 ){
             ESteamInputType type = SteamAPI_ISteamInput_GetInputTypeForHandle(
                                  steam_hInput, joy0 );
 
-            if( type == k_ESteamInputType_SteamController )
-            {
+            if( type == k_ESteamInputType_SteamController ){
                vg_input.controller_should_use_trackpad_look = 1;
                menu_display_controller = k_menu_controller_type_steam;
             }
-            else if( type == k_ESteamInputType_SteamDeckController )
-            {
+            else if( type == k_ESteamInputType_SteamDeckController ){
                menu_display_controller = k_menu_controller_type_steam_deck;
             }
             else if( type == k_ESteamInputType_PS3Controller ||
@@ -357,8 +325,7 @@ VG_STATIC void steam_update(void)
             {
                menu_display_controller = k_menu_controller_type_xbox;
             }
-            else
-            {
+            else{
                /* currently unsupported controller */
                menu_display_controller = k_menu_controller_type_xbox;
             }
@@ -371,8 +338,7 @@ VG_STATIC void steam_update(void)
 
 VG_STATIC void steam_end(void)
 {
-   if( steam_ready )
-   {
+   if( steam_ready ){
       vg_info( "Shutting down\n..." );
       SteamAPI_Shutdown();
    }
index 5120bd758fe6e2ff09c7ec6ce5051fdba5b756fc..63cb1ef98f1e91c38799f1f9d2e78a7a65e81b69 100644 (file)
@@ -128,14 +128,6 @@ VG_STATIC void world_apply_procedural_foliage( world_instance *world,
 
 
 #if 0
-VG_STATIC void world_pct_spawn( world_instance *world, mdl_node *pnode )
-{
-   struct respawn_point *rp = &world->spawns[ world->spawn_count ++ ];
-
-   v3_copy( pnode->co, rp->co );
-   v4_copy( pnode->q, rp->q );
-   rp->name = mdl_pstr( world->meta, pnode->pstr_name );
-}
 
 VG_STATIC void world_pct_audio( world_instance *world, mdl_node *pnode )
 {
@@ -160,20 +152,6 @@ VG_STATIC void world_pct_audio( world_instance *world, mdl_node *pnode )
    world->audio_things_count ++;
 }
 
-VG_STATIC void world_pct_world_light( world_instance *world, mdl_node *pnode )
-{
-   struct world_light *light = &world->lights[ world->light_count ++ ];
-   light->node = pnode;
-   light->inf  = mdl_get_entdata( world->meta, pnode );
-
-   q_m3x3( pnode->q,   light->inverse_world );
-   v3_copy( pnode->co, light->inverse_world[3] );
-   m4x3_invert_affine( light->inverse_world, light->inverse_world );
-
-   light->angle_sin_cos[0] = sinf( light->inf->angle * 0.5f );
-   light->angle_sin_cos[1] = cosf( light->inf->angle * 0.5f );
-}
-
 VG_STATIC void world_pct_nonlocal_gate( world_instance *world, mdl_node *pnode )
 {
    struct nonlocal_gate *gate = &world->nonlocal_gates[ 
@@ -186,38 +164,6 @@ VG_STATIC void world_pct_nonlocal_gate( world_instance *world, mdl_node *pnode )
    v2_copy( inf->dims, gate->gate.dims );
 }
 
-VG_STATIC void world_entities_process( world_instance *world )
-{
-   struct entity_instruction
-   {
-      enum classtype ct;
-      void (*process)( world_instance *world, mdl_node *pnode );
-   }
-   entity_instructions[] = 
-   {
-      { k_classtype_spawn,    world_pct_spawn },
-      { k_classtype_water,    world_pct_water },
-      { k_classtype_audio,    world_pct_audio },
-      { k_classtype_world_light, world_pct_world_light },
-      { k_classtype_nonlocal_gate, world_pct_nonlocal_gate }
-   };
-
-   for( int i=0; i<world->meta->info.node_count; i++ )
-   {
-      mdl_node *pnode = mdl_node_from_id( world->meta, i );
-
-      for( int j=0; j<vg_list_size(entity_instructions); j++ )
-      {
-         struct entity_instruction *instr = &entity_instructions[j];
-
-         if( pnode->classtype == instr->ct )
-         {
-            instr->process( world, pnode );
-            break;
-         }
-      }
-   }
-}
 VG_STATIC void world_link_nonlocal_gates( int index_a, int index_b )
 {
    vg_info( "Linking non-local gates\n" );
@@ -273,48 +219,6 @@ VG_STATIC void world_link_nonlocal_gates( int index_a, int index_b )
 }
 #endif
 
-#if 0
-VG_STATIC float colour_luminance( v3f v )
-{
-   return v3_dot( v, (v3f){0.2126f, 0.7152f, 0.0722f} );
-}
-
-VG_STATIC float calc_light_influence( world_instance *world, v3f position, 
-                                      int light )
-{
-   struct world_light *world_light = &world->lights[ light ];
-   struct classtype_world_light *inf = world_light->inf;
-
-   v3f light_delta;
-   v3_sub( world_light->node->co, position, light_delta );
-   v3_muls( light_delta, 10.0f, light_delta );
-
-   float quadratic = v3_dot( light_delta, light_delta ),
-         attenuation = 1.0f/( 1.0f + quadratic );
-
-   float quadratic_light = attenuation * colour_luminance( inf->colour );
-
-   if( (inf->type == k_light_type_point) ||
-       (inf->type == k_light_type_point_nighttime_only) )
-   {
-      return quadratic_light;
-   }
-   else if( (inf->type == k_light_type_spot) ||
-            (inf->type == k_light_type_spot_nighttime_only) )
-   {
-      v3f dir;
-      q_mulv( world_light->node->q, (v3f){0.0f,1.0f,0.0f}, dir );
-
-      float spot_theta = vg_maxf( 0.0f, v3_dot( light_delta, dir ) ),
-            falloff    = spot_theta >= 0.0f? 1.0f: 0.0f;
-
-      return quadratic_light * falloff;
-   }
-   else
-      return 0.0f;
-}
-#endif
-
 VG_STATIC void world_generate( world_instance *world )
 {
    /*