From d4592cd6b3caa18a11880a538b2efc77bbaaeab6 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 29 Jun 2020 15:27:23 -0700 Subject: [PATCH] Add special case to color gray Warp Zone entities gray The only reason why gray Warp Zone entities were green originally was because there is a giant concatenated list of tileset+tilecol combinations, and by using tileset 3 tilecol 6 you're using the entry of tileset 4 tilecol 0, which is the green Ship tileset. So without interfering with the green Ship tileset's entry, I've decided that the best thing to do is to just add special cases. The enemy color was easy enough to fix. The platform color was also easy to fix. However, there exist no existing textures for gray conveyors, so at that point I decided to just tint the existing green one gray, and then I did the same for platforms. --- desktop_version/src/Entity.cpp | 13 +++++++++++++ desktop_version/src/Graphics.cpp | 20 +++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/desktop_version/src/Entity.cpp b/desktop_version/src/Entity.cpp index b426d39e..e85a544e 100644 --- a/desktop_version/src/Entity.cpp +++ b/desktop_version/src/Entity.cpp @@ -1163,6 +1163,15 @@ void entityclass::createentity( float xp, float yp, int t, float vx /*= 0*/, flo //Rule 4 is a horizontal line, 5 is vertical //Rule 6 is a crew member +#if !defined(NO_CUSTOM_LEVELS) + // Special case for gray Warp Zone tileset! + int room = game.roomx-100 + (game.roomy-100) * ed.maxwidth; + bool custom_gray = room >= 0 && room < 400 + && ed.level[room].tileset == 3 && ed.level[room].tilecol == 6; +#else + bool custom_gray = false; +#endif + entclass entity; entity.xp = xp; entity.yp = yp; @@ -2004,6 +2013,10 @@ void entityclass::createentity( float xp, float yp, int t, float vx /*= 0*/, flo } } + if(custom_gray){ + entity.colour = 18; + } + break; } diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 55e852c7..7f0708a3 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -1566,6 +1566,15 @@ void Graphics::drawentities() SDL_Rect drawRect; +#if !defined(NO_CUSTOM_LEVELS) + // Special case for gray Warp Zone tileset! + int room = game.roomx-100 + (game.roomy-100) * ed.maxwidth; + bool custom_gray = room >= 0 && room < 400 + && ed.level[room].tileset == 3 && ed.level[room].tilecol == 6; +#else + bool custom_gray = false; +#endif + std::vector *tilesvec; if (map.custommode && !map.finalmode) { @@ -1698,7 +1707,16 @@ void Graphics::drawentities() drawRect.x += tpoint.x; drawRect.y += tpoint.y; drawRect.x += 8 * ii; - BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect); + if (custom_gray) + { + colourTransform temp_ct; + temp_ct.colour = 0xFFFFFFFF; + BlitSurfaceTinted((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect, temp_ct); + } + else + { + BlitSurfaceStandard((*tilesvec)[obj.entities[i].drawframe],NULL, backBuffer, &drawRect); + } } break; }