Axe Graphics::ct and Graphics::setcolreal

`ct` was used to be a variable that a color was temporarily stored in
before being passed to a draw function. But this is unnecessary and you
might as well just have a temporary of the color directly. I guess this
was the practice used because temporaries were apparently really bad in
Flash.

setcolreal() was added in 2.3 to do basically the same thing (set it
directly from entities' realcol attributes). But it's no longer needed.

Correspondingly, Graphics::setcol has been renamed to Graphics::getcol
and now returns an SDL_Color, and Graphics::huetilesetcol has been
renamed to Graphics::huetilegetcol for the same reason.

Some functions (notably Graphics::drawimagecol and
Graphics::drawhuetile) were relying on the `ct` to be implicitly set and
weren't ever having it passed in directly. They have been corrected
accordingly.
This commit is contained in:
Misa
2023-01-01 20:16:08 -08:00
parent 351a022ebd
commit 8dc088896f
5 changed files with 104 additions and 179 deletions

View File

@@ -617,41 +617,34 @@ void entclass::updatecolour(void)
case 9: // Really Big Sprite! (2x2)
case 10: // 2x1 Sprite
case 13: // Special for epilogue: huge hero!
graphics.setcol(colour);
realcol = graphics.ct;
realcol = graphics.getcol(colour);
break;
case 3: // Big chunky pixels!
realcol = graphics.bigchunkygetcol(colour);
break;
case 4: // Small pickups
graphics.huetilesetcol(colour);
realcol = graphics.ct;
realcol = graphics.huetilegetcol(colour);
break;
case 11: // The fucking elephant
if (game.noflashingmode)
{
graphics.setcol(22);
realcol = graphics.getcol(22);
}
else
{
graphics.setcol(colour);
realcol = graphics.getcol(colour);
}
realcol = graphics.ct;
break;
case 12: // Regular sprites that don't wrap
// if we're outside the screen, we need to draw indicators
if ((xp < -20 && vx > 0) || (xp > 340 && vx < 0))
{
graphics.setcol(23);
realcol = graphics.getcol(23);
}
else
{
graphics.setcol(colour);
realcol = graphics.getcol(colour);
}
realcol = graphics.ct;
break;
default:
break;
}
}