diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 9a5431d3..c47fa02e 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -709,6 +709,15 @@ void Graphics::drawsprite(int x, int y, int t, Uint32 c) BlitSurfaceColoured(sprites[t], NULL, backBuffer, &rect, ct); } +#ifndef NO_CUSTOM_LEVELS +bool Graphics::shouldrecoloroneway(const int tilenum) +{ + return (tilenum >= 14 && tilenum <= 17 + && (!FILESYSTEM_assetsmounted + || ed.onewaycol_override)); +} +#endif + void Graphics::drawtile( int x, int y, int t ) { if (!INBOUNDS_VEC(t, tiles)) @@ -720,7 +729,7 @@ void Graphics::drawtile( int x, int y, int t ) SDL_Rect rect = { Sint16(x), Sint16(y), tiles_rect.w, tiles_rect.h }; #if !defined(NO_CUSTOM_LEVELS) - if (t >= 14 && t <= 17 && (!FILESYSTEM_assetsmounted || ed.onewaycol_override)) + if (shouldrecoloroneway(t)) { colourTransform thect = {ed.getonewaycol()}; BlitSurfaceTinted(tiles[t], NULL, backBuffer, &rect, thect); @@ -744,7 +753,7 @@ void Graphics::drawtile2( int x, int y, int t ) SDL_Rect rect = { Sint16(x), Sint16(y), tiles_rect.w, tiles_rect.h }; #if !defined(NO_CUSTOM_LEVELS) - if (t >= 14 && t <= 17 && (!FILESYSTEM_assetsmounted || ed.onewaycol_override)) + if (shouldrecoloroneway(t)) { colourTransform thect = {ed.getonewaycol()}; BlitSurfaceTinted(tiles2[t], NULL, backBuffer, &rect, thect); @@ -3144,7 +3153,7 @@ void Graphics::drawforetile(int x, int y, int t) setRect(rect, x,y,tiles_rect.w, tiles_rect.h); #if !defined(NO_CUSTOM_LEVELS) - if (t >= 14 && t <= 17 && (!FILESYSTEM_assetsmounted || ed.onewaycol_override)) + if (shouldrecoloroneway(t)) { colourTransform thect = {ed.getonewaycol()}; BlitSurfaceTinted(tiles[t], NULL, foregroundBuffer, &rect, thect); @@ -3168,7 +3177,7 @@ void Graphics::drawforetile2(int x, int y, int t) setRect(rect, x,y,tiles_rect.w, tiles_rect.h); #if !defined(NO_CUSTOM_LEVELS) - if (t >= 14 && t <= 17 && (!FILESYSTEM_assetsmounted || ed.onewaycol_override)) + if (shouldrecoloroneway(t)) { colourTransform thect = {ed.getonewaycol()}; BlitSurfaceTinted(tiles2[t], NULL, foregroundBuffer, &rect, thect); diff --git a/desktop_version/src/Graphics.h b/desktop_version/src/Graphics.h index b17fb8ae..67aef918 100644 --- a/desktop_version/src/Graphics.h +++ b/desktop_version/src/Graphics.h @@ -161,6 +161,9 @@ public: void drawbackground(int t); void updatebackground(int t); +#ifndef NO_CUSTOM_LEVELS + bool shouldrecoloroneway(const int tilenum); +#endif void drawtile3( int x, int y, int t, int off, int height_subtract = 0 ); void drawtile2( int x, int y, int t ); void drawtile( int x, int y, int t );