logic
[carveJwlIkooP6JGAAIwe30JlM.git] / common.h
index 49d2c990deca70ee59eb6b20fa09cc46861e4b73..be210a5d49ff89046aafe263a7475857b163d9a8 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,91 +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_radius          = 0.3f,
-   k_board_length          = 0.45f,
-   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,
@@ -131,15 +63,30 @@ VG_STATIC float
    k_mmdecay               = 12.0f,
    k_spring_angular        = 1.0f,
 
-   k_spring_force          = 15.0f,
+   k_spring_force          = 300.0f,
    k_spring_dampener       = 5.0f,
 
-   k_grind_spring          = 100.0f,
-   k_grind_dampener        = 1.0f,
-   k_board_spring          = 2.0f,
-   k_board_dampener        = 0.2f,
-   k_board_interia         = 8.0f;
+   k_grind_spring          = 50.0f,
+   k_grind_aligment        = 10.0f,
+   k_grind_dampener        = 5.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,
+
+   k_grind_decayxy         = 30.0f,
+   k_grind_axel_min_vel    = 3.0f,
+   k_grind_axel_max_angle  = 0.95f, /* cosine(|a|) */
+   k_grind_axel_max_vangle = 0.4f,
+   k_grind_max_friction    = 3.0f,
+   k_grind_max_edge_angle  = 0.97f,
 
+   k_board_length          = 0.45f,
+   k_board_width           = 0.13f,
+   k_board_end_radius      = 0.1f,
+   k_board_radius          = 0.14f;    /* 0.07 */
 
 VG_STATIC float
    k_walkspeed             = 10.0f,
@@ -155,6 +102,9 @@ VG_STATIC float
    k_cam_spring            = 20.0f,
    k_cam_damp              = 6.7f;
 
+VG_STATIC float
+   k_day_length            = 30.0f; /* minutes */
+
 VG_STATIC float k_ragdoll_floatyiness = 20.0f,
                 k_ragdoll_floatydrag  = 1.0f,
                 k_ragdoll_limit_scale = 1.0f;
@@ -164,50 +114,60 @@ VG_STATIC int   k_ragdoll_div = 1,
                 k_ragdoll_debug_collider = 1,
                 k_ragdoll_debug_constraints = 0;
 
+VG_STATIC int   k_debug_light_indices = 0,
+                k_debug_light_complexity = 0,
+                k_light_preview = 0;
 
 VG_STATIC int freecam = 0;
+VG_STATIC int debug_logic_bricks = 0;
 VG_STATIC int walk_grid_iterations = 1;
 VG_STATIC float fc_speed = 10.0f;
 VG_STATIC int cl_thirdperson = 0;
 
 VG_STATIC void common_var_temp(void)
 {
+   VG_VAR_F32( k_day_length );
+
    VG_VAR_F32( k_cam_punch );
    VG_VAR_F32( k_cam_damp );
    VG_VAR_F32( k_cam_spring );
 
    VG_VAR_F32( k_grind_dampener );
    VG_VAR_F32( k_grind_spring );
-   VG_VAR_F32( k_board_spring );
-   VG_VAR_F32( k_board_dampener );
+   VG_VAR_F32( k_grind_aligment );
+   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 );
+   VG_VAR_F32( k_grind_axel_max_angle );
+   VG_VAR_F32( k_grind_max_friction );
 
    VG_VAR_F32( k_walkspeed );
    VG_VAR_F32( k_stopspeed );
    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 );
+   VG_VAR_F32_PERSISTENT( debug_logic_bricks );
    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 );
    VG_VAR_I32( k_ragdoll_debug_constraints );
+   VG_VAR_I32( k_debug_light_indices );
+   VG_VAR_I32( k_debug_light_complexity );
+   VG_VAR_I32( k_light_preview );
 
    VG_VAR_F32( k_friction_lat );
 
    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 );