Skip to content

Commit

Permalink
fix PaletteFade and DrawTintRect
Browse files Browse the repository at this point in the history
  • Loading branch information
LittlePlanetCD committed May 28, 2024
1 parent cdfe25c commit 1bb1450
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Nexus/Drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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--) {
Expand Down
2 changes: 1 addition & 1 deletion Nexus/Palette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1bb1450

Please sign in to comment.