Skip to content

Commit

Permalink
fix SetLimitedFade and DrawTintRect
Browse files Browse the repository at this point in the history
-SetLimitedFade was not able to use it's endindex correctly
-DrawTintRect / DrawTintRectangle had incorrect types for XPos and YPos, as well as prevented the final pixel line from being drawn.
  • Loading branch information
LittlePlanetCD committed May 28, 2024
1 parent 3691b65 commit 156c113
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions RSDKv3/Drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,7 @@ void DrawStageGFX()
// Hacky fix for Tails Object not working properly on non-Origins bytecode
if (forceUseScripts || GetGlobalVariableByName("NOTIFY_1P_VS_SELECT") != 0)
#endif
DrawObjectList(7); // Extra Origins draw list (who knows why it comes before 6)
DrawObjectList(7); // Extra Origins draw list (who knows why it comes before 6)
DrawObjectList(6);

#if !RETRO_USE_ORIGINAL_CODE
Expand Down Expand Up @@ -4810,7 +4810,7 @@ void SetFadeHQ(int R, int G, int B, int A)
// Not Avaliable in HW mode
}

void DrawTintRectangle(int XPos, int YPos, int width, int height)
void DrawTintRectangle(uint XPos, uint YPos, int width, int height)
{
if (renderType == RENDER_SW) {
if (width + XPos > GFX_LINESIZE)
Expand All @@ -4826,13 +4826,13 @@ void DrawTintRectangle(int XPos, int YPos, int width, int height)
height += YPos;
YPos = 0;
}
if (width <= 0 || height <= 0)
if (width < 0 || height < 0)
return;

int yOffset = GFX_LINESIZE - width;
for (ushort *frameBufferPtr = &Engine.frameBuffer[XPos + GFX_LINESIZE * YPos];; frameBufferPtr += yOffset) {
height--;
if (!height)
if (height < 0)
break;

int w = width;
Expand Down
2 changes: 1 addition & 1 deletion RSDKv3/Drawing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ void Draw3DSkyLayer(int layerID);
// Shape Drawing
void DrawRectangle(int XPos, int YPos, int width, int height, int R, int G, int B, int A);
void SetFadeHQ(int R, int G, int B, int A);
void DrawTintRectangle(int XPos, int YPos, int width, int height);
void DrawTintRectangle(uint XPos, uint YPos, int width, int height);
void DrawScaledTintMask(int direction, int XPos, int YPos, int pivotX, int pivotY, int scaleX, int scaleY, int width, int height, int sprX, int sprY,
int sheetID);

Expand Down
2 changes: 1 addition & 1 deletion RSDKv3/Palette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void SetLimitedFade(byte paletteID, byte R, byte G, byte B, ushort alpha, int st
return;

uint alpha2 = 0xFF - alpha;
for (int i = startIndex; i < endIndex; ++i) {
for (int i = startIndex; i <= endIndex; ++i) {
PACK_RGB888(activePalette[i], (byte)((ushort)(R * alpha + alpha2 * activePalette32[i].r) >> 8),
(byte)((ushort)(G * alpha + alpha2 * activePalette32[i].g) >> 8),
(byte)((ushort)(B * alpha + alpha2 * activePalette32[i].b) >> 8));
Expand Down

0 comments on commit 156c113

Please sign in to comment.