diff options
Diffstat (limited to 'src/graphic.c')
-rw-r--r-- | src/graphic.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/graphic.c b/src/graphic.c index c0b1d24..89f418a 100644 --- a/src/graphic.c +++ b/src/graphic.c @@ -91,12 +91,9 @@ int paintTerrain(gameIni_t *gIni, gameRess_t *gRess, gameState_t *gState) { int i, modifier; int x,y,xmin,xmax,ymin,ymax,y2,xdst,ydst; Uint32 srcPixel, dstPixel, dstStencil; - Uint32 cc_nothing, cc_terrain, rmask, gmask, bmask, amask; + Uint32 cc_nothing, cc_terrain, cc_background, rmask, gmask, bmask, amask; SDL_Surface *tile; - cc_nothing=0xFF000000; /* Make it portable (big endian) */ - cc_terrain=0xFFFFAAAA; /* Make it portable (big endian) */ - res=SDL_PixelFormatEnumToMasks(SDL_PIXELFORMAT_ARGB8888, &bpp, &rmask, &gmask, &bmask, &amask); MPL_CHECK( res==SDL_TRUE, @@ -114,9 +111,12 @@ int paintTerrain(gameIni_t *gIni, gameRess_t *gRess, gameState_t *gState) { "paintTerrain(), SDL_CreateRGBSurface() failed" ); + cc_nothing=0xFF000000; /* Make it portable (big endian) */ + cc_terrain=0xFFFFAAAA; /* Make it portable (big endian) */ + cc_background = gIni->style.bgColor | amask; /* Fill the entire surfaces with default color */ - res =SDL_FillRect(gState->terrain, NULL, gIni->style.bgColor); + res =SDL_FillRect(gState->terrain, NULL, cc_background); res2=SDL_FillRect(gState->stencil, NULL, cc_nothing); MPL_CHECK( res==0 && res2==0, @@ -186,9 +186,9 @@ int paintTerrain(gameIni_t *gIni, gameRess_t *gRess, gameState_t *gState) { // If we are in NO_OVERRIDE mode and there is already a terrain on the current (source) pixel if ( !( (modifier & 8) == 8 && PIXEL32(gState->stencil, xdst, ydst) == cc_terrain ) ) { - // If we have REMOVE modifier, dstPixel will be rolled back to bgColor, else, it will be identical to the source pixel. We have to update stencil consistenly. + // If we have REMOVE modifier, dstPixel will be rolled back to cc_background, else, it will be identical to the source pixel. We have to update stencil consistenly. if ( (modifier & 2) == 2 ) { - dstPixel=gIni->style.bgColor; + dstPixel=cc_background; dstStencil=cc_nothing; } else { dstPixel=srcPixel; |