small clean
authorhgn <hgodden00@gmail.com>
Thu, 23 Feb 2023 03:05:57 +0000 (03:05 +0000)
committerhgn <hgodden00@gmail.com>
Thu, 23 Feb 2023 03:05:57 +0000 (03:05 +0000)
common.h
network.h
player.h
player_skate.c
rigidbody.h
steam.h

index 3d60978f2da5d64f23145acec6392f96a97041d0..0621e7caba99232342d78aec4bd628f8190bac2b 100644 (file)
--- a/common.h
+++ b/common.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021-2022 Mt.ZERO Software, Harry Godden - All Rights Reserved
+ * Copyright (C) 2021-2023 Mt.ZERO Software, Harry Godden - All Rights Reserved
  */
 
 #ifndef COMMON_H
@@ -36,89 +36,23 @@ struct ray_hit
    v3f pos, normal;
 };
 
-VG_STATIC int network_scores_updated = 0;
-
-VG_STATIC u32 utf8_byte0_byte_count( u8 char0 )
-{
-   for( u32 k=2; k<4; k++ )
-   {
-      if( !(char0 & (0x80 >> k)) )
-         return k;
-   }
-
-   return 0;
-}
-
-VG_STATIC void str_utf8_collapse( const char *str, char *buf, u32 length )
-{
-   u8 *ustr = (u8 *)str;
-   u32 utf32_code = 0x00000000;
-   u32 i=0, j=0, utf32_byte_ct=0;
-
-   for(;i < length-1;)
-   {
-      if( ustr[i] == 0x00 )
-         break;
-      
-      if( ustr[i] & 0x80 )
-      {
-         if( utf32_byte_ct )
-         {
-            utf32_byte_ct --;
-            utf32_code |= (ustr[i] & 0x3F) << (utf32_byte_ct*6);
-
-            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++ )
-               {
-                  buf[ j++ ] = (u8)match[k];
-               }
-            }
-         }
-         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
-      {
-         utf32_byte_ct = 0x00;
-         buf[j ++] = str[i];
-      }
-
-      i++;
-   }
-
-   buf[j] = 0x00;
-}
-
 VG_STATIC float 
-   k_runspeed              = 20.0f,    /* depr */
-   k_board_allowance       = 0.04f,
    k_friction_lat          = 12.0f,
    k_friction_resistance   = 0.01f,
+
    k_max_push_speed        = 16.0f,
    k_push_accel            = 10.0f,
    k_push_cycle_rate       = 8.0f,
+
    k_steer_ground          = 2.5f,
    k_steer_air             = 3.6f,
-   k_steer_air_lerp        = 0.3f,
-   k_pump_force            = 0.0f,
-   k_downforce             = 0.0f,
-   k_escape_velocity       = 1.0f,
-   k_walk_downforce        = 8.0f,
+
    k_jump_charge_speed     = (1.0f/1.0f),
    k_jump_force            = 5.0f,
+
    k_pitch_limit           = 1.5f,
    k_look_speed            = 2.0f,
 
-   k_spin_boost            = 4.20f,
-
    k_cog_spring            = 0.2f,
    k_cog_damp              = 0.02f,
    k_cog_mass_ratio        = 0.9f,
@@ -136,8 +70,8 @@ VG_STATIC float
    k_grind_aligment        = 10.0f,
    k_grind_dampener        = 5.0f,
 
-   k_board_spring          = 100.0f,
-   k_board_dampener        = 40.0f,
+   k_surface_spring        = 100.0f,
+   k_surface_dampener      = 40.0f,
    k_manul_spring          = 200.0f,
    k_manul_dampener        = 30.0f,
    k_board_interia         = 8.0f,
@@ -192,8 +126,8 @@ VG_STATIC void common_var_temp(void)
    VG_VAR_F32( k_grind_dampener );
    VG_VAR_F32( k_grind_spring );
    VG_VAR_F32( k_grind_aligment );
-   VG_VAR_F32( k_board_spring );
-   VG_VAR_F32( k_board_dampener );
+   VG_VAR_F32( k_surface_spring );
+   VG_VAR_F32( k_surface_dampener );
    VG_VAR_F32( k_board_interia );
    VG_VAR_F32( k_grind_decayxy );
    VG_VAR_F32( k_grind_axel_min_vel );
@@ -205,7 +139,6 @@ VG_STATIC void common_var_temp(void)
    VG_VAR_F32( k_airspeed );
    VG_VAR_F32( k_walk_friction );
    VG_VAR_F32( k_walk_air_accel );
-   VG_VAR_F32( k_runspeed );
    VG_VAR_F32( k_walk_accel );
 
    VG_VAR_I32( freecam );
@@ -222,10 +155,7 @@ VG_STATIC void common_var_temp(void)
 
    VG_VAR_F32( k_cog_spring );
    VG_VAR_F32( k_cog_damp );
-
    VG_VAR_F32( k_cog_mass_ratio );
-   VG_VAR_F32( k_escape_velocity );
-   VG_VAR_F32( k_downforce );
 
    VG_VAR_F32( k_spring_force );
    VG_VAR_F32( k_spring_dampener );
index 4d34e82bb75a881c47d071879440cda821a209da..fc454c75afbf7cf643aefe861def63250a2ed0a7 100644 (file)
--- a/network.h
+++ b/network.h
@@ -11,6 +11,8 @@
 #include "network_msg.h"
 #include "highscores.h"
 
+VG_STATIC int network_scores_updated = 0;
+
 /* 
  * Interface
  */
index 3dce2f01a8ffb6e57d802781f26c2c36e51c0ac8..8ecce407508b9c4b0adddbce198cb33055c902a5 100644 (file)
--- a/player.h
+++ b/player.h
@@ -400,68 +400,6 @@ VG_STATIC void reset_player_poll( int argc, char const *argv[] );
 
 VG_STATIC void player_init(void)                                         /* 1 */
 {
-#if 0
-   player.input_js1h = vg_create_named_input( "steer-h", k_input_type_axis );
-   player.input_js1v = vg_create_named_input( "steer-v", k_input_type_axis );
-   player.input_grab = vg_create_named_input( "grab", k_input_type_axis_norm );
-   player.input_js2h = vg_create_named_input( "grab-h", k_input_type_axis );
-   player.input_js2v = vg_create_named_input( "grab-v", k_input_type_axis );
-   player.input_jump = vg_create_named_input( "jump", k_input_type_button );
-   player.input_push = vg_create_named_input( "push", k_input_type_button );
-   player.input_walk = vg_create_named_input( "walk", k_input_type_button );
-
-   player.input_walkh = vg_create_named_input( "walk-h", 
-                                               k_input_type_axis );
-   player.input_walkv = vg_create_named_input( "walk-v", 
-                                               k_input_type_axis );
-
-
-   player.input_switch_mode = vg_create_named_input( "switch-mode",
-                                                     k_input_type_button );
-   player.input_reset = vg_create_named_input( "reset", k_input_type_button );
-
-   const char *default_cfg[] = 
-   {
-      "bind  steer-h gp-ls-h",
-      "bind -steer-h a",
-      "bind +steer-h d",
-
-      "bind  steer-v gp-ls-v",
-      "bind -steer-v w",
-      "bind +steer-v s",
-
-      "bind  grab gp-rt",
-      "bind +grab shift",
-      "bind  grab-h gp-rs-h",
-      "bind  grab-v gp-rs-v",
-
-      "bind jump space",
-      "bind jump gp-a",
-
-      "bind push gp-b",
-      "bind push w",
-
-      "bind walk shift",
-      "bind walk gp-ls",
-      
-      "bind  walk-h  gp-ls-h",
-      "bind  walk-v -gp-ls-v",
-      "bind +walk-h d",
-      "bind -walk-h a",
-      "bind +walk-v w",
-      "bind -walk-v s",
-
-      "bind reset gp-lb",
-      "bind reset r",
-
-      "bind switch-mode gp-y",
-      "bind switch-mode e",
-   };
-
-   for( int i=0; i<vg_list_size(default_cfg); i++ )
-      vg_execute_console_input(default_cfg[i]);
-#endif
-
    rb_init( &player.rb );
 
    VG_VAR_F32( k_walkspeed );
@@ -469,7 +407,6 @@ VG_STATIC void player_init(void)                                         /* 1 */
    VG_VAR_F32( k_airspeed );
    VG_VAR_F32( k_walk_friction );
    VG_VAR_F32( k_walk_air_accel );
-   VG_VAR_F32( k_runspeed );
    VG_VAR_F32( k_walk_accel );
 
    VG_VAR_I32( freecam );
index 542f105225453f9f56e964fb663e02131a6f237f..aae8280f5b30a006fe00172717bf01a7e8d8dce6 100644 (file)
@@ -1876,7 +1876,7 @@ VG_STATIC void player__skate_update( player_instance *player )
       {
          rb_effect_spring_target_vector( &player->rb, player->rb.to_world[0],
                                           axel,
-                                          k_board_spring, k_board_dampener,
+                                          k_surface_spring, k_surface_dampener,
                                           s->substep_delta );
 
          v3_add( normal, s->surface_picture, s->surface_picture );
index 746c684920e98add3572a8c9e1fba7d8590c6f13..0bba8f1b381fb6263e1bc99ce02d7cb8adeb4e91 100644 (file)
@@ -16,8 +16,6 @@
 VG_STATIC void rb_tangent_basis( v3f n, v3f tx, v3f ty );
 VG_STATIC bh_system bh_system_rigidbodies;
 
-
-
 #ifndef RIGIDBODY_H
 #define RIGIDBODY_H
 
diff --git a/steam.h b/steam.h
index 5d768b88c88ffd84b09581bd73b7026b4c6552b4..4f98dd9334be4f6a97fceafa76c21f05c6b5215f 100644 (file)
--- a/steam.h
+++ b/steam.h
@@ -180,6 +180,65 @@ VG_STATIC void steam_on_recieve_current_stats( CallbackMsg_t *msg )
 
 VG_STATIC ISteamInput *steam_hInput;
 
+VG_STATIC u32 utf8_byte0_byte_count( u8 char0 )
+{
+   for( u32 k=2; k<4; k++ )
+   {
+      if( !(char0 & (0x80 >> k)) )
+         return k;
+   }
+
+   return 0;
+}
+
+VG_STATIC void str_utf8_collapse( const char *str, char *buf, u32 length )
+{
+   u8 *ustr = (u8 *)str;
+   u32 utf32_code = 0x00000000;
+   u32 i=0, j=0, utf32_byte_ct=0;
+
+   for(;i < length-1;)
+   {
+      if( ustr[i] == 0x00 )
+         break;
+      
+      if( ustr[i] & 0x80 )
+      {
+         if( utf32_byte_ct )
+         {
+            utf32_byte_ct --;
+            utf32_code |= (ustr[i] & 0x3F) << (utf32_byte_ct*6);
+
+            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++ )
+               {
+                  buf[ j++ ] = (u8)match[k];
+               }
+            }
+         }
+         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
+      {
+         utf32_byte_ct = 0x00;
+         buf[j ++] = str[i];
+      }
+
+      i++;
+   }
+
+   buf[j] = 0x00;
+}
+
 VG_STATIC int steam_init(void)
 {
    const char *username = NULL;