From 794ef29638a836258b8e11e955fd44151e789276 Mon Sep 17 00:00:00 2001 From: Info Teddy Date: Tue, 21 Jan 2020 20:02:21 -0800 Subject: [PATCH] Fix bug with displaying translucent pixels incorrectly For a long time, VVVVVV has had an issue where if you used custom graphics with translucent pixels (i.e. pixels whose opacity was neither 0% nor 100%, but somewhere between 0% and 100%), those pixels would end up looking very ugly. They seemed to be overlaid on top of some weird blue color, instead of actually being translucent. This bug only occurred when in-game and not in towermode. So, most of the time, basically. The translucent pixels only displayed properly inside the Tower, both minitowers, and the editor (when not playtesting). I traced this down to the use of the magic number 0xDEADBEEF in Graphics::drawmap() and Graphics::drawfinalmap(). Looks like someone had fun finding a color. Was it you, simoroth? Anyway, I've changed it so it simply uses 0 instead. Note that this magic number needs to be changed for BOTH FillRect() and OverlaySurfaceKeyed(), or else the game's background will be some random solid color instead of actually being drawn properly. --- desktop_version/src/Graphics.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index e9d1c84a..542b8f64 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -2342,7 +2342,7 @@ void Graphics::drawmap( mapclass& map ) ///TODO forground once; if (!foregrounddrawn) { - FillRect(foregroundBuffer, 0xDEADBEEF); + FillRect(foregroundBuffer, 0x00000000); if(map.tileset==0) { for (j = 0; j < 29+map.extrarow; j++) @@ -2375,7 +2375,7 @@ void Graphics::drawmap( mapclass& map ) } foregrounddrawn = true; } - OverlaySurfaceKeyed(foregroundBuffer, backBuffer, 0xDEADBEEF); + OverlaySurfaceKeyed(foregroundBuffer, backBuffer, 0x00000000); //SDL_BlitSurface(foregroundBuffer, NULL, backBuffer, NULL); } @@ -2398,7 +2398,7 @@ void Graphics::drawfinalmap(mapclass & map) } if (!foregrounddrawn) { - FillRect(foregroundBuffer, 0xDEADBEEF); + FillRect(foregroundBuffer, 0x00000000); if(map.tileset==0){ for (int j = 0; j < 29+map.extrarow; j++) { for (int i = 0; i < 40; i++) { @@ -2417,7 +2417,7 @@ void Graphics::drawfinalmap(mapclass & map) foregrounddrawn=true; } - OverlaySurfaceKeyed(foregroundBuffer, backBuffer, 0xDEADBEEF); + OverlaySurfaceKeyed(foregroundBuffer, backBuffer, 0x00000000); } void Graphics::drawtowermap( mapclass& map )