diff --git a/src/compatibility.cpp b/src/compatibility.cpp index b93cb68f23..e091a7f1eb 100644 --- a/src/compatibility.cpp +++ b/src/compatibility.cpp @@ -185,7 +185,7 @@ void ParseCompatibility() } while (!sc.Compare("{")); flags.CompatFlags = 0; flags.BCompatFlags = 0; - flags.ExtCommandIndex = -1; + flags.ExtCommandIndex = ~0u; while (sc.GetString()) { if ((i = sc.MatchString(&Options[0].Name, sizeof(*Options))) >= 0) @@ -195,7 +195,7 @@ void ParseCompatibility() } else if (sc.Compare("clearlineflags")) { - if (flags.ExtCommandIndex == -1) flags.ExtCommandIndex = CompatParams.Size(); + if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size(); CompatParams.Push(CP_CLEARFLAGS); sc.MustGetNumber(); CompatParams.Push(sc.Number); @@ -204,7 +204,7 @@ void ParseCompatibility() } else if (sc.Compare("setlineflags")) { - if (flags.ExtCommandIndex == -1) flags.ExtCommandIndex = CompatParams.Size(); + if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size(); CompatParams.Push(CP_SETFLAGS); sc.MustGetNumber(); CompatParams.Push(sc.Number); @@ -213,7 +213,7 @@ void ParseCompatibility() } else if (sc.Compare("setlinespecial")) { - if (flags.ExtCommandIndex == -1) flags.ExtCommandIndex = CompatParams.Size(); + if (flags.ExtCommandIndex == ~0u) flags.ExtCommandIndex = CompatParams.Size(); CompatParams.Push(CP_SETSPECIAL); sc.MustGetNumber(); CompatParams.Push(sc.Number); @@ -232,7 +232,7 @@ void ParseCompatibility() break; } } - if (flags.ExtCommandIndex != -1) + if (flags.ExtCommandIndex != ~0u) { CompatParams.Push(CP_END); } diff --git a/src/dobject.cpp b/src/dobject.cpp index 073be864f8..3bd815bd60 100644 --- a/src/dobject.cpp +++ b/src/dobject.cpp @@ -190,7 +190,7 @@ const char *FMetaTable::GetMetaString (DWORD id) const CCMD (dumpactors) { - char * filters[32] = + const char *const filters[32] = { "0:All", "1:Doom", "2:Heretic", "3:DoomHeretic", "4:Hexen", "5:DoomHexen", "6:Raven", "7:IdRaven", "8:Strife", "9:DoomStrife", "10:HereticStrife", "11:DoomHereticStrife", "12:HexenStrife", diff --git a/src/m_misc.cpp b/src/m_misc.cpp index 1f8b9f3e6c..324095d5c8 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -167,7 +167,7 @@ void M_FindResponseFile (void) int argc = 0; FILE *handle; int size; - long argsize; + long argsize = 0; int index; // Any more response files after the limit will be removed from the diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index e982ea0d0e..cbbd8797f7 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2688,7 +2688,7 @@ void A_FaceTarget (AActor *self, angle_t max_turn) // 0 means no limit. Also, if we turn in a single step anyways, no need to go through the algorithms. // It also means that there is no need to check for going past the target. - if (max_turn && (max_turn < abs(self->angle - target_angle))) + if (max_turn && (max_turn < (angle_t)abs(self->angle - target_angle))) { if (self->angle > target_angle) { diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 16c70ef186..39a56eced5 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -1566,7 +1566,7 @@ bool P_SeekerMissile (AActor *actor, angle_t thresh, angle_t turnMax, bool preci } else { - angle_t pitch; + angle_t pitch = 0; if (!(actor->flags3 & (MF3_FLOORHUGGER|MF3_CEILINGHUGGER))) { // Need to seek vertically double dist = MAX(1.0, FVector2(target->x - actor->x, target->y - actor->y).Length()); diff --git a/src/r_segs.cpp b/src/r_segs.cpp index 5bb3a09fcf..eed5d78a83 100644 --- a/src/r_segs.cpp +++ b/src/r_segs.cpp @@ -1781,6 +1781,7 @@ int OWallMost (short *mostbuf, fixed_t z) s3 = MulScale16 (globaldclip, WallSZ1); s4 = MulScale16 (globaldclip, WallSZ2); bad = (zs3)<<2)+((z>s4)<<3); +#if 1 if ((bad&3) == 3) { memset (&mostbuf[WallSX1], 0, (WallSX2 - WallSX1)*sizeof(mostbuf[0])); @@ -1792,10 +1793,10 @@ int OWallMost (short *mostbuf, fixed_t z) clearbufshort (&mostbuf[WallSX1], WallSX2 - WallSX1, viewheight); return bad; } - +#endif ix1 = WallSX1; iy1 = WallSZ1; ix2 = WallSX2; iy2 = WallSZ2; - +#if 1 if (bad & 3) { int t = DivScale30 (z-s1, s2-s1); @@ -1842,7 +1843,38 @@ int OWallMost (short *mostbuf, fixed_t z) fixed_t yinc = (Scale (z, InvZtoScale, iy2) - y) / (ix2 - ix1); qinterpolatedown16short (&mostbuf[ix1], ix2-ix1, y + centeryfrac, yinc); } +#else + double max = viewheight; + double zz = z / 65536.0; +#if 0 + double z1 = zz * InvZtoScale / WallSZ1; + double z2 = zz * InvZtoScale / WallSZ2 - z1; + z2 /= (WallSX2 - WallSX1); + z1 += centeryfrac / 65536.0; + for (int x = WallSX1; x < WallSX2; ++x) + { + mostbuf[x] = xs_RoundToInt(clamp(z1, 0.0, max)); + z1 += z2; + } +#else + double top, bot, i; + + i = WallSX1 - centerx; + top = WallUoverZorg + WallUoverZstep * i; + bot = WallInvZorg + WallInvZstep * i; + double cy = centeryfrac / 65536.0; + + for (int x = WallSX1; x < WallSX2; x++) + { + double frac = top / bot; + double scale = frac * WallDepthScale + WallDepthOrg; + mostbuf[x] = xs_RoundToInt(clamp(zz / scale + cy, 0.0, max)); + top += WallUoverZstep; + bot += WallInvZstep; + } +#endif +#endif if (mostbuf[ix1] < 0) mostbuf[ix1] = 0; else if (mostbuf[ix1] > viewheight) mostbuf[ix1] = (short)viewheight; if (mostbuf[ix2] < 0) mostbuf[ix2] = 0; @@ -2046,13 +2078,10 @@ void PrepWall (fixed_t *swall, fixed_t *lwall, fixed_t walxrepeat) { // swall = scale, lwall = texturecolumn double top, bot, i; double xrepeat = walxrepeat; - double topinc, botinc; i = WallSX1 - centerx; top = WallUoverZorg + WallUoverZstep * i; bot = WallInvZorg + WallInvZstep * i; - topinc = WallUoverZstep * 4.f; - botinc = WallInvZstep * 4.f; for (int x = WallSX1; x < WallSX2; x++) { @@ -2069,14 +2098,11 @@ void PrepLWall (fixed_t *lwall, fixed_t walxrepeat) { // lwall = texturecolumn double top, bot, i; double xrepeat = walxrepeat; - double topinc, botinc; double topstep; i = WallSX1 - centerx; top = WallUoverZorg + WallUoverZstep * i; bot = WallInvZorg + WallInvZstep * i; - topinc = WallUoverZstep * 4.f; - botinc = WallInvZstep * 4.f; top *= xrepeat; topstep = WallUoverZstep * xrepeat; diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index a31665803d..30efe22d9c 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -1533,7 +1533,7 @@ static void SetCustomLoopPts(FMOD::Sound *sound) FMOD_MODE mode; if (FMOD_OK == (sound->getMode(&mode))) { - sound->setMode(mode & ~(FMOD_LOOP_OFF | FMOD_LOOP_NORMAL) | FMOD_LOOP_BIDI); + sound->setMode((mode & ~(FMOD_LOOP_OFF | FMOD_LOOP_NORMAL)) | FMOD_LOOP_BIDI); } } } diff --git a/src/sound/music_mus_midiout.cpp b/src/sound/music_mus_midiout.cpp index 68558bdadb..b89d9fd67d 100644 --- a/src/sound/music_mus_midiout.cpp +++ b/src/sound/music_mus_midiout.cpp @@ -125,7 +125,7 @@ MUSSong2::MUSSong2 (FILE *file, BYTE *musiccache, int len, EMIDIDevice type) // Read the remainder of the song. len = int(len - start); - if (len < sizeof(MusHeader)) + if (len < (int)sizeof(MusHeader)) { // It's too short. return; } diff --git a/src/win32/win32video.cpp b/src/win32/win32video.cpp index a610fd4090..672e81df35 100644 --- a/src/win32/win32video.cpp +++ b/src/win32/win32video.cpp @@ -38,6 +38,7 @@ #define DIRECTDRAW_VERSION 0x0300 #define DIRECT3D_VERSION 0x0900 +#define _WIN32_WINNT 0x0501 #define WIN32_LEAN_AND_MEAN #include #include @@ -51,6 +52,7 @@ #include #include #include +#include #define USE_WINDOWS_DWORD #include "doomtype.h"