/*
- * 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
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,
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,
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 );
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( 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 );
#include "network_msg.h"
#include "highscores.h"
+VG_STATIC int network_scores_updated = 0;
+
/*
* Interface
*/
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 );
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 );
{
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 );
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
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;