1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 01:59:43 +01:00

Fix regression with per-pixel collision colors

In previous versions, the game mistakenly checked the wrong color
channel of sprites, checking the red channel instead of the alpha
channel. I abuse this in some of my levels. Then I broke it when
refactoring masks so the game now no longer checks the red channel but
seems to check the blue channel instead. So re-fix this to the previous
bug, and preserve the previous bug with a comment explaining why.
This commit is contained in:
Misa 2021-10-06 23:18:58 -07:00
parent 2f25ab77b1
commit 449526bb4f

View file

@ -1656,7 +1656,11 @@ bool Graphics::Hitest(SDL_Surface* surface1, point p1, SDL_Surface* surface2, po
{
Uint32 pixel1 = ReadPixel(surface1 , x - p1.x, y - p1.y);
Uint32 pixel2 = ReadPixel(surface2 , x - p2.x, y - p2.y);
if ((pixel1 & 0x000000FF) && (pixel2 & 0x000000FF))
/* INTENTIONAL BUG! In previous versions, the game mistakenly
* checked the red channel, not the alpha channel.
* We preserve it here because some people abuse this. */
if ((pixel1 & surface1->format->Rmask)
&& (pixel2 & surface2->format->Rmask))
{
return true;
}