void vg_audio_fadeout_flagged_audio( u32 flag, f32 length )
{
- vg_audio_lock();
+ vg_audio_assert_lock();
for( u32 id=1; id<=AUDIO_CHANNELS; id ++ )
{
audio_channel *channel = get_audio_channel( id );
vg_audio_crossfade( id, NULL, 1.0f );
}
}
- vg_audio_unlock();
}
bool vg_audio_flagged_stopped( u32 flag )
return NULL;
}
-void vg_execute_console_input( const char *cmd, bool silent )
+void vg_execute_console_input( const char *cmd, bool silent, bool cheat_override )
{
char temp[512];
char const *args[8];
if( arg_count >= 2 )
{
#ifdef VG_ENGINE
- if( cv->flags & VG_VAR_CHEAT )
+ if( (cv->flags & VG_VAR_CHEAT) && !cheat_override )
{
bool cheats = vg_console.cheats;
if( !cheats && !silent )
}
vg_console.history_pos = -1;
- vg_execute_console_input( vg_console.input, 0 );
+ vg_execute_console_input( vg_console.input, 0, 0 );
_ui_textbox_move_cursor( ctx, &ctx->textbox.cursor_user, &ctx->textbox.cursor_pos, -10000, 1 );
vg_console.input[0] = '\0';
console_update_suggestions( ctx );
{
line[ strcspn( line, "\r\n#" ) ] = 0x00;
if( line[0] != 0x00 )
- vg_execute_console_input( line, silent );
+ vg_execute_console_input( line, silent, 0 );
}
fclose( fp );
#endif
void vg_console_init(void);
-void vg_execute_console_input( const char *cmd, bool silent );
+void vg_execute_console_input( const char *cmd, bool silent, bool cheat_override );
vg_console_reg_var( "vg_quality", &vg.quality_profile, k_var_dtype_i32, VG_VAR_PERSISTENT );
vg_console_reg_var( "vg_screen_mode", &vg.screen_mode, k_var_dtype_i32, VG_VAR_PERSISTENT );
+ rb_register_cvar();
+
vg_audio_register();
vg_console_load_autos();
k_joint_impulse = 1.0f,
k_joint_bias = 0.08f; /* positional joints */
-static void rb_register_cvar(void)
+f32 k_gravity = 9.6f;
+
+void rb_register_cvar(void)
{
VG_VAR_F32( k_limit_bias, flags=VG_VAR_CHEAT );
VG_VAR_F32( k_joint_bias, flags=VG_VAR_CHEAT );
VG_VAR_F32( k_joint_correction, flags=VG_VAR_CHEAT );
VG_VAR_F32( k_joint_impulse, flags=VG_VAR_CHEAT );
+ VG_VAR_F32( k_gravity, flags=VG_VAR_CHEAT );
}
-void rb_setbody_capsule( rigidbody *rb, f32 r, f32 h,
- f32 density, f32 inertia_scale ){
+void rb_setbody_capsule( rigidbody *rb, f32 r, f32 h, f32 density, f32 inertia_scale )
+{
f32 vol = vg_capsule_volume( r, h ),
mass = vol*density;
"or more components: %f %f %f\n", rb->v[0],rb->v[1],rb->v[2] );
}
- v3f gravity = { 0.0f, -9.8f, 0.0f };
+ v3f gravity = { 0.0f, -k_gravity, 0.0f };
v3_muladds( rb->v, gravity, vg.time_fixed_delta, rb->v );
/* intergrate velocity */
#define k_penetration_slop 0.01f
#define k_rb_inertia_scale 4.0f
#define k_phys_baumgarte 0.2f
-#define k_gravity 9.6f
+//#define k_gravity 9.6f
#define k_rb_density 8.0f
+extern f32 k_gravity;
+
enum rb_shape {
k_rb_shape_none = 0,
k_rb_shape_box = 1,
m4x3f to_world, to_local;
};
+void rb_register_cvar(void);
+
/*
* Initialize rigidbody inverse mass and inertia tensor with some common shapes
*/
-void rb_setbody_capsule( rigidbody *rb, f32 r, f32 h,
- f32 density, f32 inertia_scale );
+void rb_setbody_capsule( rigidbody *rb, f32 r, f32 h, f32 density, f32 inertia_scale );
void rb_setbody_box( rigidbody *rb, boxf box, f32 density, f32 inertia_scale );
void rb_setbody_sphere( rigidbody *rb, f32 r, f32 density, f32 inertia_scale );
* Effectors
*/
void rb_effect_simple_bouyency( rigidbody *ra, v4f plane, f32 amt, f32 drag );
-void rb_effect_spring_target_vector( rigidbody *rba, v3f ra, v3f rt,
- f32 spring, f32 dampening, f32 timestep );
+void rb_effect_spring_target_vector( rigidbody *rba, v3f ra, v3f rt, f32 spring, f32 dampening, f32 timestep );