diff --git a/src/framerate.c b/src/framerate.c index 659f0c9b..d0d6a574 100644 --- a/src/framerate.c +++ b/src/framerate.c @@ -20,7 +20,7 @@ void fpscounter_reset(FPSCounter *fps) { fps->frametimes[i] = frametime; } - fps->fps = HRTIME_RESOLUTION / (float64x)frametime; + fps->fps = HRTIME_RESOLUTION / (long double)frametime; fps->frametime = frametime; fps->last_update_time = time_get(); } @@ -38,7 +38,7 @@ void fpscounter_update(FPSCounter *fps) { avg += fps->frametimes[i]; } - fps->fps = HRTIME_RESOLUTION / (avg / (float64x)log_size); + fps->fps = HRTIME_RESOLUTION / (avg / (long double)log_size); fps->frametime = avg / log_size; fps->last_update_time = time_get(); } diff --git a/src/projectile.c b/src/projectile.c index 48c4a97f..117a742a 100644 --- a/src/projectile.c +++ b/src/projectile.c @@ -207,7 +207,7 @@ cmplx projectile_graze_size(Projectile *p) { return 0; } -float32 projectile_timeout_factor(Projectile *p) { +float projectile_timeout_factor(Projectile *p) { return p->timeout ? (global.frames - p->birthtime) / p->timeout : 0; } @@ -909,7 +909,7 @@ SpriteParams projectile_sprite_params(Projectile *proj, SpriteParamsBuffer *spbu return sp; } -static void projectile_draw_sprite(Sprite *s, const Color *clr, float32 opacity, cmplx32 scale) { +static void projectile_draw_sprite(Sprite *s, const Color *clr, float opacity, cmplx32 scale) { if(opacity <= 0 || crealf(scale) == 0) { return; } @@ -955,11 +955,11 @@ static void pdraw_blast_func(Projectile *p, int t, ProjDrawRuleArgs args) { args[1].as_float[0], }; - float32 rot_angle = args[1].as_float[1]; - float32 secondary_scale = args[2].as_float[0]; + float rot_angle = args[1].as_float[1]; + float secondary_scale = args[2].as_float[0]; - float32 tf = projectile_timeout_factor(p); - float32 opacity = (1.0f - tf) * p->opacity; + float tf = projectile_timeout_factor(p); + float opacity = (1.0f - tf) * p->opacity; if(tf <= 0 || opacity <= 0) { return; @@ -983,11 +983,11 @@ static void pdraw_blast_func(Projectile *p, int t, ProjDrawRuleArgs args) { } ProjDrawRule pdraw_blast(void) { - float32 rot_angle = rng_f32_angle(); - float32 x = rng_f32(); - float32 y = rng_f32(); - float32 z = rng_f32(); - float32 secondary_scale = rng_f32_range(0.5, 1.5); + float rot_angle = rng_f32_angle(); + float x = rng_f32(); + float y = rng_f32(); + float z = rng_f32(); + float secondary_scale = rng_f32_range(0.5, 1.5); vec3 rot_axis = { x, y, z }; glm_vec3_normalize(rot_axis); @@ -1058,14 +1058,14 @@ void ScaleFade(Projectile *p, int t, ProjDrawRuleArgs args) { static void pdraw_scalefade_func(Projectile *p, int t, ProjDrawRuleArgs args) { cmplx32 scale0 = args[0].as_cmplx; cmplx32 scale1 = args[1].as_cmplx; - float32 opacity0 = args[2].as_float[0]; - float32 opacity1 = args[2].as_float[1]; - float32 opacity_exp = args[3].as_float[0]; + float opacity0 = args[2].as_float[0]; + float opacity1 = args[2].as_float[1]; + float opacity_exp = args[3].as_float[0]; - float32 timefactor = t / p->timeout; + float timefactor = t / p->timeout; cmplx32 scale = clerpf(scale0, scale1, timefactor); - float32 opacity = lerpf(opacity0, opacity1, timefactor); + float opacity = lerpf(opacity0, opacity1, timefactor); opacity = powf(opacity, opacity_exp); SpriteParamsBuffer spbuf; @@ -1076,7 +1076,7 @@ static void pdraw_scalefade_func(Projectile *p, int t, ProjDrawRuleArgs args) { r_draw_sprite(&sp); } -ProjDrawRule pdraw_timeout_scalefade_exp(cmplx32 scale0, cmplx32 scale1, float32 opacity0, float32 opacity1, float32 opacity_exp) { +ProjDrawRule pdraw_timeout_scalefade_exp(cmplx32 scale0, cmplx32 scale1, float opacity0, float opacity1, float opacity_exp) { if(cimagf(scale0) == 0) { scale0 = CMPLXF(crealf(scale0), crealf(scale0)); } @@ -1094,7 +1094,7 @@ ProjDrawRule pdraw_timeout_scalefade_exp(cmplx32 scale0, cmplx32 scale1, float32 }; } -ProjDrawRule pdraw_timeout_scalefade(cmplx32 scale0, cmplx32 scale1, float32 opacity0, float32 opacity1) { +ProjDrawRule pdraw_timeout_scalefade(cmplx32 scale0, cmplx32 scale1, float opacity0, float opacity1) { return pdraw_timeout_scalefade_exp(scale0, scale1, opacity0, opacity1, 1.0f); } @@ -1103,7 +1103,7 @@ ProjDrawRule pdraw_timeout_scale(cmplx32 scale0, cmplx32 scale1) { return pdraw_timeout_scalefade(scale0, scale1, 1, 1); } -ProjDrawRule pdraw_timeout_fade(float32 opacity0, float32 opacity1) { +ProjDrawRule pdraw_timeout_fade(float opacity0, float opacity1) { // TODO: specialized code path without scale component return pdraw_timeout_scalefade(1+I, 1+I, opacity0, opacity1); } @@ -1115,7 +1115,7 @@ static void pdraw_petal_func(Projectile *p, int t, ProjDrawRuleArgs args) { args[1].as_float[0], }; - float32 rot_angle = args[1].as_float[1]; + float rot_angle = args[1].as_float[1]; SpriteParamsBuffer spbuf; SpriteParams sp = projectile_sprite_params(p, &spbuf); @@ -1128,11 +1128,11 @@ static void pdraw_petal_func(Projectile *p, int t, ProjDrawRuleArgs args) { r_draw_sprite(&sp); } -ProjDrawRule pdraw_petal(float32 rot_angle, vec3 rot_axis) { +ProjDrawRule pdraw_petal(float rot_angle, vec3 rot_axis) { glm_vec3_normalize(rot_axis); - float32 x = rot_axis[0]; - float32 y = rot_axis[1]; - float32 z = rot_axis[2]; + float x = rot_axis[0]; + float y = rot_axis[1]; + float z = rot_axis[2]; return (ProjDrawRule) { .func = pdraw_petal_func, @@ -1142,10 +1142,10 @@ ProjDrawRule pdraw_petal(float32 rot_angle, vec3 rot_axis) { } ProjDrawRule pdraw_petal_random(void) { - float32 x = rng_f32(); - float32 y = rng_f32(); - float32 z = rng_f32(); - float32 rot_angle = rng_f32_angle(); + float x = rng_f32(); + float y = rng_f32(); + float z = rng_f32(); + float rot_angle = rng_f32_angle(); return pdraw_petal(rot_angle, (vec3) { x, y, z }); } diff --git a/src/projectile.h b/src/projectile.h index 08310256..e607f887 100644 --- a/src/projectile.h +++ b/src/projectile.h @@ -43,7 +43,7 @@ typedef int (*ProjRule)(Projectile *p, int t); typedef bool (*ProjPredicate)(Projectile *p); typedef union { - float32 as_float[2]; + float as_float[2]; cmplx32 as_cmplx; void *as_ptr; } ProjDrawRuleArgs[RULE_ARGC]; @@ -120,7 +120,7 @@ DEFINE_ENTITY_TYPE(Projectile, { uint clear_flags; cmplx32 scale; - float32 opacity; + float opacity; // XXX: this is in frames of course, but needs to be float // to avoid subtle truncation and integer division gotchas. @@ -162,7 +162,7 @@ typedef struct ProjArgs { drawlayer_t layer; cmplx32 scale; - float32 opacity; + float opacity; // XXX: this is in frames of course, but needs to be float // to avoid subtle truncation and integer division gotchas. @@ -248,11 +248,11 @@ void GrowFade(Projectile *p, int t, ProjDrawRuleArgs) DEPRECATED_DRAW_RULE; void ScaleFade(Projectile *p, int t, ProjDrawRuleArgs) DEPRECATED_DRAW_RULE; ProjDrawRule pdraw_basic(void); -ProjDrawRule pdraw_timeout_scalefade_exp(cmplx32 scale0, cmplx32 scale1, float32 opacity0, float32 opacity1, float32 opacity_exp); -ProjDrawRule pdraw_timeout_scalefade(cmplx32 scale0, cmplx32 scale1, float32 opacity0, float32 opacity1); +ProjDrawRule pdraw_timeout_scalefade_exp(cmplx32 scale0, cmplx32 scale1, float opacity0, float opacity1, float opacity_exp); +ProjDrawRule pdraw_timeout_scalefade(cmplx32 scale0, cmplx32 scale1, float opacity0, float opacity1); ProjDrawRule pdraw_timeout_scale(cmplx32 scale0, cmplx32 scale1); -ProjDrawRule pdraw_timeout_fade(float32 opacity0, float32 opacity1); -ProjDrawRule pdraw_petal(float32 rot_angle, vec3 rot_axis); +ProjDrawRule pdraw_timeout_fade(float opacity0, float opacity1); +ProjDrawRule pdraw_petal(float rot_angle, vec3 rot_axis); ProjDrawRule pdraw_petal_random(void); ProjDrawRule pdraw_blast(void); @@ -265,7 +265,7 @@ void projectiles_preload(void); void projectiles_free(void); cmplx projectile_graze_size(Projectile *p); -float32 projectile_timeout_factor(Projectile *p); +float projectile_timeout_factor(Projectile *p); int projectile_time(Projectile *p); SpriteParams projectile_sprite_params(Projectile *proj, SpriteParamsBuffer *spbuf); diff --git a/src/stagedraw.c b/src/stagedraw.c index 84f6c4f6..4f5c4135 100644 --- a/src/stagedraw.c +++ b/src/stagedraw.c @@ -1562,7 +1562,7 @@ void stage_draw_bottom_text(void) { static void fill_graph(int num_samples, float *samples, FPSCounter *fps) { for(int i = 0; i < num_samples; ++i) { - samples[i] = fps->frametimes[i] / (2.0 * (HRTIME_RESOLUTION / (float64x)FPS)); + samples[i] = fps->frametimes[i] / (2.0 * (HRTIME_RESOLUTION / (long double)FPS)); if(samples[i] > 1.0) { samples[i] = 1.0; diff --git a/src/util/compat.h b/src/util/compat.h index 79bddede..05abf198 100644 --- a/src/util/compat.h +++ b/src/util/compat.h @@ -152,17 +152,8 @@ typedef unsigned char uchar; #undef schar typedef signed char schar; -#undef float32 -typedef float float32; - -#undef float64 -typedef double float64; - -#undef float64x -typedef long double float64x; - #undef real -typedef float64 real; +typedef double real; #undef cmplx32 typedef _Complex float cmplx32; diff --git a/src/util/miscmath.c b/src/util/miscmath.c index e1e591a3..b80302fe 100644 --- a/src/util/miscmath.c +++ b/src/util/miscmath.c @@ -23,7 +23,7 @@ cmplx clerp(cmplx v0, cmplx v1, double f) { return f * (v1 - v0) + v0; } -cmplx32 clerpf(cmplx32 v0, cmplx32 v1, float32 f) { +cmplx32 clerpf(cmplx32 v0, cmplx32 v1, float f) { return f * (v1 - v0) + v0; } diff --git a/src/util/miscmath.h b/src/util/miscmath.h index 79b8d869..b41d38d3 100644 --- a/src/util/miscmath.h +++ b/src/util/miscmath.h @@ -19,7 +19,7 @@ double lerp(double v0, double v1, double f) attr_const; float lerpf(float v0, float v1, float f) attr_const; cmplx clerp(cmplx v0, cmplx v1, double f) attr_const; -cmplx32 clerpf(cmplx32 v0, cmplx32 v1, float32 f) attr_const; +cmplx32 clerpf(cmplx32 v0, cmplx32 v1, float f) attr_const; intmax_t imin(intmax_t, intmax_t) attr_const; intmax_t imax(intmax_t, intmax_t) attr_const; uintmax_t umin(uintmax_t, uintmax_t) attr_const;