misc & math
authorhgn <hgodden00@gmail.com>
Sat, 8 Jul 2023 02:02:02 +0000 (03:02 +0100)
committerhgn <hgodden00@gmail.com>
Sat, 8 Jul 2023 02:02:02 +0000 (03:02 +0100)
vg_console.h
vg_io.h
vg_m.h

index 6f3c2bad7128e2650073138a6b8ed97137298101..a38a64d6eafd3431839e9a8f892eebe71afe2591 100644 (file)
@@ -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 06aee757179ca82c525c8c9c3f49368603351a5e..5a37fb3c4ead2d15a4f7564a0bf384c0577e835e 100644 (file)
--- 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 950ebd792574240c5b3aa289b39fc695d5120056..c48f13e40ee510399008ae9cfb168b61258db45b 100644 (file)
--- 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);