From 3120c99eeb70b266fbf1a68dec1287609a69406a Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Thu, 5 Dec 2019 12:38:50 -0500 Subject: [PATCH] Fix compiling for MSVC --- src/hardware/r_opengl/r_opengl.c | 16 ++++++++-------- src/m_menu.c | 8 ++++---- src/p_mobj.c | 2 +- src/r_patch.c | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index c009d3459..ec99eb307 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1404,7 +1404,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, typedef struct vbo_vertex_s { - float x, y, z; + double x, y, z; float u, v; unsigned char r, g, b, a; } vbo_vertex_t; @@ -1448,17 +1448,17 @@ static INT32 lasttex = -1; static void SkyVertex(vbo_vertex_t *vbo, int r, int c) { - const float radians = (M_PIl / 180.0f); - const float scale = 10000.0f; + const double radians = (M_PIl / 180.0f); + const double scale = 10000.0f; const float maxSideAngle = 60.0f; float topAngle = (c / (float)columns * 360.0f); float sideAngle = (maxSideAngle * (rows - r) / rows); - float height = sin(sideAngle * radians); - float realRadius = scale * cos(sideAngle * radians); - float x = realRadius * cos(topAngle * radians); - float y = (!yflip) ? scale * height : -scale * height; - float z = realRadius * sin(topAngle * radians); + double height = sin(sideAngle * radians); + double realRadius = scale * cos(sideAngle * radians); + double x = realRadius * cos(topAngle * radians); + double y = (!yflip) ? scale * height : -scale * height; + double z = realRadius * sin(topAngle * radians); float timesRepeat = (4 * (256.0f / texw)); if (fpclassify(timesRepeat) == FP_ZERO) timesRepeat = 1.0f; diff --git a/src/m_menu.c b/src/m_menu.c index edba61f30..2a8a34426 100644 --- a/src/m_menu.c +++ b/src/m_menu.c @@ -5361,7 +5361,7 @@ static void M_DrawNightsAttackBackground(void) M_DrawNightsAttackMountains(); // back top foreground patch - x = -(ntsatkdrawtimer%backtopwidth); + x = 0-(ntsatkdrawtimer%backtopwidth); V_DrawScaledPatch(x, y, V_SNAPTOTOP|V_SNAPTOLEFT, backtopfg); for (i = 0; i < 3; i++) { @@ -5372,7 +5372,7 @@ static void M_DrawNightsAttackBackground(void) } // front top foreground patch - x = -((ntsatkdrawtimer*2)%fronttopwidth); + x = 0-((ntsatkdrawtimer*2)%fronttopwidth); V_DrawScaledPatch(x, y, V_SNAPTOTOP|V_SNAPTOLEFT, fronttopfg); for (i = 0; i < 3; i++) { @@ -5383,7 +5383,7 @@ static void M_DrawNightsAttackBackground(void) } // back bottom foreground patch - x = -(ntsatkdrawtimer%backbottomwidth); + x = 0-(ntsatkdrawtimer%backbottomwidth); y = BASEVIDHEIGHT - backbottomheight; V_DrawScaledPatch(x, y, V_SNAPTOBOTTOM|V_SNAPTOLEFT, backbottomfg); for (i = 0; i < 3; i++) @@ -5395,7 +5395,7 @@ static void M_DrawNightsAttackBackground(void) } // front bottom foreground patch - x = -((ntsatkdrawtimer*2)%frontbottomwidth); + x = 0-((ntsatkdrawtimer*2)%frontbottomwidth); y = BASEVIDHEIGHT - frontbottomheight; V_DrawScaledPatch(x, y, V_SNAPTOBOTTOM|V_SNAPTOLEFT, frontbottomfg); for (i = 0; i < 3; i++) diff --git a/src/p_mobj.c b/src/p_mobj.c index 0ec3d7cc1..42c5234df 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -4652,7 +4652,7 @@ static void P_Boss3Thinker(mobj_t *mobj) { UINT8 i, numtospawn = 24; angle_t ang = 0, interval = FixedAngle((360 << FRACBITS) / numtospawn); - mobj_t *shock, *sfirst = NULL, *sprev = NULL; + mobj_t *shock = NULL, *sfirst = NULL, *sprev = NULL; mobj->movecount = mobj->health+1; mobj->movefactor = -512*FRACUNIT; diff --git a/src/r_patch.c b/src/r_patch.c index 639f682fd..9dcf59024 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -786,8 +786,8 @@ static void R_ParseSpriteInfoFrame(spriteinfo_t *info) { char *sprinfoToken; size_t sprinfoTokenLength; - char *frameChar; - UINT8 frameFrame; + char *frameChar = NULL; + UINT8 frameFrame = -1; #ifdef ROTSPRITE INT16 frameXPivot = 0; INT16 frameYPivot = 0;