From b605c8e6546556bad6dab712ae965b3db3a4ccf8 Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 19 Feb 2025 11:10:27 +0100 Subject: [PATCH] few instances of int float conversions i forgor --- src/hardware/hw_clip.c | 2 +- src/hardware/hw_draw.c | 21 ++++++++++----------- src/hardware/hw_main.h | 30 +++++++++++++++--------------- 3 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/hardware/hw_clip.c b/src/hardware/hw_clip.c index e9b1bce98..7d0179dfc 100644 --- a/src/hardware/hw_clip.c +++ b/src/hardware/hw_clip.c @@ -333,7 +333,7 @@ angle_t gld_FrustumAngle(angle_t tiltangle) // ok, this is a gross hack that barely works... // but at least it doesn't overestimate too much... - clipfov = atan(1 / projMatrix[0]) * 360 / M_PIl; + clipfov = atan(1 / projMatrix[0]) * 360.0f / M_PIl; floatangle = 2.0f + (45.0f + (tilt / 1.9f)) * clipfov / 90.0f; if (floatangle >= 180.0) return 0xffffffff; diff --git a/src/hardware/hw_draw.c b/src/hardware/hw_draw.c index dc363dd1a..c24fbdb56 100644 --- a/src/hardware/hw_draw.c +++ b/src/hardware/hw_draw.c @@ -268,8 +268,8 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t cy = 1.0f - (cy / (vid.height / 2.0f)); // fwidth and fheight are similar - fwidth /= fvw / 2; - fheight /= fvh / 2; + fwidth /= fvw / 2.0f; + fheight /= fvh / 2.0f; // set the polygon vertices to the right positions v[0].x = v[3].x = cx; @@ -442,8 +442,8 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal cy = 1.0f - (cy / (vid.height / 2.0f)); // fwidth and fheight are similar - fwidth /= fvw / 2; - fheight /= fvh / 2; + fwidth /= fvw / 2.0f; + fheight /= fvh / 2.0f; // set the polygon vertices to the right positions v[0].x = v[3].x = cx; @@ -882,8 +882,8 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color) fx = -1.0f + fx / (vid.width / 2.0f); fy = 1.0f - fy / (vid.height / 2.0f); - fw = fw / (fvw / 2); - fh = fh / (fvh / 2); + fw = fw / (fvw / 2.0f); + fh = fh / (fvh / 2.0f); v[0].x = v[3].x = fx; v[2].x = v[1].x = fx + fw; @@ -995,8 +995,8 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32 fx = -1.0f + fx / (vid.width / 2.0f); fy = 1.0f - fy / (vid.height / 2.0f); - fw = fw / (fvw / 2); - fh = fh / (fvh / 2); + fw = fw / (fvw / 2.0f); + fh = fh / (fvh / 2.0f); v[0].x = v[3].x = fx; v[2].x = v[1].x = fx + fw; @@ -1084,7 +1084,6 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) fy += (FLOATBASEVIDHEIGHT * dupy)/2; if (color & V_HORZSCREEN) fx += (FLOATBASEVIDWIDTH * dupx)/2; - } if (fx >= vid.width || fy >= vid.height) @@ -1109,8 +1108,8 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color) fx = -1.0f + fx / (vid.width / 2.0f); fy = 1.0f - fy / (vid.height / 2.0f); - fw = fw / (fvw / 2); - fh = fh / (fvh / 2); + fw = fw / (fvw / 2.0f); + fh = fh / (fvh / 2.0f); v[0].x = v[3].x = fx; v[2].x = v[1].x = fx + fw; diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 8b1751a8e..8ccb1b2a1 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -58,11 +58,11 @@ extern sector_t *gl_backsector; enum { - HWR_STENCIL_NORMAL, - HWR_STENCIL_BEGIN, - HWR_STENCIL_REVERSE, - HWR_STENCIL_DEPTH, - HWR_STENCIL_SKY + HWR_STENCIL_NORMAL, + HWR_STENCIL_BEGIN, + HWR_STENCIL_REVERSE, + HWR_STENCIL_DEPTH, + HWR_STENCIL_SKY }; // Performance stats @@ -128,7 +128,7 @@ FBITFIELD HWR_TranstableToAlpha(INT32 transtablenum, FSurfaceInfo *pSurf); // Get amount of memory used by gpu textures in bytes; FUNCINLINE static ATTRINLINE INT32 HWR_GetTextureUsed(void) { - return GL_GetTextureUsed(); + return GL_GetTextureUsed(); } // hw_main.c: Post-rendering @@ -136,32 +136,32 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum); FUNCINLINE static ATTRINLINE void HWR_StartScreenWipe(void) { - GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START); + GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START); } FUNCINLINE static ATTRINLINE void HWR_EndScreenWipe(void) { - GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END); + GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END); } FUNCINLINE static ATTRINLINE void HWR_DrawIntermissionBG(void) { - GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0); + GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0); } FUNCINLINE static ATTRINLINE void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize) { - GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize); + GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize); } FUNCINLINE static ATTRINLINE void HWR_MakeScreenFinalTexture(void) { - GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2); + GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2); } FUNCINLINE static ATTRINLINE void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader) { - GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader); + GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader); } // hw_main.c: Segs @@ -215,17 +215,17 @@ extern consvar_t cv_glflashpal; FUNCINLINE static ATTRINLINE boolean HWR_UseShader(void) { - return (cv_glshaders.value && gl_shadersavailable); + return (cv_glshaders.value && gl_shadersavailable); } FUNCINLINE static ATTRINLINE boolean HWR_ShouldUsePaletteRendering(void) { - return (cv_glpaletterendering.value && (pLocalPalette != NULL) && HWR_UseShader()); + return (cv_glpaletterendering.value && (pLocalPalette != NULL) && HWR_UseShader()); } FUNCINLINE static ATTRINLINE boolean HWR_PalRenderFlashpal(void) { - return (HWR_ShouldUsePaletteRendering() && cv_glflashpal.value); + return (HWR_ShouldUsePaletteRendering() && cv_glflashpal.value); } #endif