diff --git a/Nexus/Drawing.cpp b/Nexus/Drawing.cpp index 7d9ccd1..2f350b2 100644 --- a/Nexus/Drawing.cpp +++ b/Nexus/Drawing.cpp @@ -1634,7 +1634,7 @@ void DrawTintRectangle(int XPos, int YPos, int width, int height, byte tintID) height += YPos; YPos = 0; } - if (width <= 0 || height <= 0) + if (width < 0 || height < 0) return; byte *tintTable = NULL; @@ -1649,7 +1649,7 @@ void DrawTintRectangle(int XPos, int YPos, int width, int height, byte tintID) int yOffset = SCREEN_XSIZE - width; for (byte *pixelBufferPtr = &Engine.pixelBuffer[XPos + SCREEN_XSIZE * YPos];; pixelBufferPtr += yOffset) { height--; - if (!height) + if (height < 0) break; int w = width; while (w--) { diff --git a/Nexus/Palette.cpp b/Nexus/Palette.cpp index 6187f5a..2ba5f29 100644 --- a/Nexus/Palette.cpp +++ b/Nexus/Palette.cpp @@ -43,7 +43,7 @@ void SetFade(byte r, byte g, byte b, ushort a, int start, int end) a = 255; if (end < 256) ++end; - for (int i = start; i < end; ++i) { + for (int i = start; i <= end; ++i) { byte red = (ushort)(r * a + (0xFF - a) * palette8[i].r) >> 8; byte green = (ushort)(g * a + (0xFF - a) * palette8[i].g) >> 8; byte blue = (ushort)(b * a + (0xFF - a) * palette8[i].b) >> 8;