From f58517971497a022946795d36d2f9597e7bc9d9c Mon Sep 17 00:00:00 2001 From: hgn Date: Sat, 8 Jul 2023 03:02:02 +0100 Subject: [PATCH] misc & math --- vg_console.h | 8 +++++++- vg_io.h | 16 ++++++++++++++++ vg_m.h | 9 +++++++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/vg_console.h b/vg_console.h index 6f3c2ba..a38a64d 100644 --- a/vg_console.h +++ b/vg_console.h @@ -199,7 +199,13 @@ VG_STATIC void _vg_console_init(void){ vg_console_reg_cmd( "crash", _test_break, NULL ); vg_console_reg_cmd( "exec", _vg_console_exec, NULL ); vg_console_reg_cmd( "defaults", _ccmd_vg_console_defaults, NULL ); - vg_console_reg_var( "cheats", &vg_console.cheats, k_var_dtype_i32, 0 ); + vg_console_reg_var( "cheats", &vg_console.cheats, k_var_dtype_i32, +#ifdef VG_DEVWINDOW + VG_VAR_PERSISTENT +#else + 0 +#endif + ); } VG_STATIC void vg_console_load_autos(void){ diff --git a/vg_io.h b/vg_io.h index 06aee75..5a37fb3 100644 --- a/vg_io.h +++ b/vg_io.h @@ -135,6 +135,15 @@ static void vg_dir_close( vg_dir *dir ){ #define VG_FILE_IO_CHUNK_SIZE 1024*256 +#ifdef __GNUC__ + #ifndef __clang__ + #pragma GCC push_options + #pragma GCC optimize ("O3") + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wdeprecated-declarations" + #endif +#endif + VG_STATIC void vg_file_print_invalid( FILE *fp ) { if( feof( fp )) { @@ -246,4 +255,11 @@ VG_STATIC const char *vg_path_filename( const char *path ) return base; } +#ifdef __GNUC__ + #ifndef __clang__ + #pragma GCC pop_options + #pragma GCC diagnostic pop + #endif +#endif + #endif /* VG_IO_H */ diff --git a/vg_m.h b/vg_m.h index 950ebd7..c48f13e 100644 --- a/vg_m.h +++ b/vg_m.h @@ -399,11 +399,16 @@ static inline void v3_normalize( v3f a ) v3_muls( a, 1.f / v3_length( a ), a ); } -static inline f32 vg_lerpf( f32 a, f32 b, f32 t ) -{ +static inline f32 vg_lerpf( f32 a, f32 b, f32 t ){ return a + t*(b-a); } +static inline void vg_slewf( f32 *a, f32 b, f32 speed ){ + f32 d = vg_signf( b-*a ), + c = *a + d*speed; + *a = vg_minf( b*d, c*d ) * d; +} + static inline f64 vg_lerp( f64 a, f64 b, f64 t ) { return a + t*(b-a); -- 2.25.1