From 58463d1535b409d2b4b28faf4bdfbf207fcde678 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Thu, 25 Dec 2008 22:44:19 +0000 Subject: [PATCH] Fixed bugs when generating angry images for monsters --- data/levels/level99.dat | 6 ++++ shared.c | 75 +++++++++++++++------------------------- website/img/ant3.png | Bin 1726 -> 2245 bytes 3 files changed, 33 insertions(+), 48 deletions(-) diff --git a/data/levels/level99.dat b/data/levels/level99.dat index 6f1bbd9..ab62c44 100644 --- a/data/levels/level99.dat +++ b/data/levels/level99.dat @@ -20,6 +20,12 @@ monsters 16 9 18 16 11 18 15 15 18 +17 2 18 +17 1 18 +17 17 18 +17 19 18 +17 21 18 +17 23 18 endmonsters exitdir 1 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, diff --git a/shared.c b/shared.c index 01e9851..722cb53 100644 --- a/shared.c +++ b/shared.c @@ -1869,9 +1869,14 @@ int loadimagesets(void) { for (i = 0; i < imageset[p].numimages; i++) { if (!isfruit(p) && !iseffect(p) && p != P_BLACKCLOUD) { + SDL_Color tempcol; + int x,y; + SDL_Rect redarea,temparea; +/* SDL_SetColorKey(imageset[p].img[i], SDL_SRCCOLORKEY, SDL_MapRGB(screen->format, 0, 0, 0)); +*/ origi = imageset[p].img[i]; @@ -1888,17 +1893,13 @@ int loadimagesets(void) { // create semi-transparent red square (white for bosses) if (isboss(p)) { - reds = SDL_CreateRGBSurface(SDL_SWSURFACE, - origi->w, - origi->h, + reds = SDL_CreateRGBSurface(SDL_SWSURFACE,2,2, origi->format->BitsPerPixel, origi->format->Rmask, origi->format->Gmask,origi->format->Bmask, 0); SDL_FillRect(reds, NULL, SDL_MapRGB(reds->format, 255, 255, 255)); SDL_SetAlpha(reds, SDL_SRCALPHA,100); } else { - reds = SDL_CreateRGBSurface(SDL_SWSURFACE, - origi->w, - origi->h, + reds = SDL_CreateRGBSurface(SDL_SWSURFACE,2,2, origi->format->BitsPerPixel, origi->format->Rmask, origi->format->Gmask,origi->format->Bmask, 0); SDL_FillRect(reds, NULL, SDL_MapRGB(reds->format, 255, 0, 0)); @@ -1906,58 +1907,36 @@ int loadimagesets(void) { } // take a copy of the original image - imageset[p].img[MAXFRAMES*2+i] = rotozoomSurfaceXY(origi, 0, 1,1,0); + temps = rotozoomSurfaceXY(origi, 0, 1,1,0); + redarea.x = 0; redarea.y = 0; + redarea.w = 1; redarea.h = 1; + temparea.w = 1; temparea.h = 1; + for (y = 0; y < temps->h; y++) { + for (x = 0; x < temps->w; x++) { - // paste the transparent one on top of it - SDL_BlitSurface(reds, NULL, imageset[p].img[MAXFRAMES*2+i], NULL); - SDL_FreeSurface(reds); + getpixelrgb(temps , x, y, &tempcol); + // if pixel isn't transparent... + if (tempcol.unused > 0 ) { + temparea.x = x; + temparea.y = y; + // make this pixel redder + SDL_BlitSurface(reds, &redarea, temps, &temparea); + } + + } + } - // Convert the reddened image to the screen format - temps = SDL_DisplayFormat(imageset[p].img[MAXFRAMES*2+i]); - SDL_FreeSurface(imageset[p].img[MAXFRAMES*2+i]); imageset[p].img[MAXFRAMES*2+i] = temps; - // Make the background red bits completely transparent - if (isboss(p)) { - SDL_SetColorKey(imageset[p].img[MAXFRAMES*2+i], - SDL_SRCCOLORKEY|SDL_RLEACCEL, SDL_MapRGB(imageset[p].img[MAXFRAMES*2+i]->format, 99, 97, 99)); - } else { - ///SDL_Color tempcol; - ///getpixelrgb(imageset[p].img[MAXFRAMES*2+i], 0, 0, &tempcol); -//printf("for spriteid %d, rgb is %d,%d,%d\n",p,tempcol.r,tempcol.g,tempcol.b); - SDL_SetColorKey(imageset[p].img[MAXFRAMES*2+i], - SDL_SRCCOLORKEY|SDL_RLEACCEL, SDL_MapRGB(imageset[p].img[MAXFRAMES*2+i]->format, 99, 0, 0)); - } + // free red image surface + SDL_FreeSurface(reds); /* flipped angry image */ imageset[p].img[MAXFRAMES*3+i] = rotozoomSurfaceXY(imageset[p].img[MAXFRAMES*2+i], 0, -1,1,0); SDL_SetColorKey(imageset[p].img[MAXFRAMES*3+i],SDL_RLEACCEL, 0); - /* flipped angry image */ - /* - reds = SDL_CreateRGBSurface(SDL_SWSURFACE, - origi->w, - origi->h, - origi->format->BitsPerPixel, origi->format->Rmask, - origi->format->Gmask,origi->format->Bmask, 0); - SDL_FillRect(reds, NULL, SDL_MapRGB(reds->format, 255, 0, 0)); - SDL_SetAlpha(reds, SDL_SRCALPHA,100); - - imageset[p].img[MAXFRAMES*3+i] = rotozoomSurfaceXY(origi, 0, -1,1,0); - - - SDL_BlitSurface(reds, NULL, imageset[p].img[MAXFRAMES*3+i], NULL); - SDL_FreeSurface(reds); - - temps = SDL_DisplayFormat(imageset[p].img[MAXFRAMES*3+i]); - SDL_FreeSurface(imageset[p].img[MAXFRAMES*3+i]); - imageset[p].img[MAXFRAMES*3+i] = temps; - - SDL_SetColorKey(imageset[p].img[MAXFRAMES*3+i], - SDL_SRCCOLORKEY, SDL_MapRGB(imageset[p].img[MAXFRAMES*3+i]->format, 101, 0, 0)); - */ } } } @@ -3541,7 +3520,7 @@ void getpixelrgb(SDL_Surface *where, int x, int y, SDL_Color *clr) { memcpy ( &col , pPosition , where->format->BytesPerPixel ) ; //convert color - SDL_GetRGB ( col , where->format , &clr->r , &clr->g , &clr->b ) ; + SDL_GetRGBA ( col , where->format , &clr->r , &clr->g , &clr->b, &clr->unused ) ; //*r = color.r; //*g = color.g; //*b = color.b; diff --git a/website/img/ant3.png b/website/img/ant3.png index aa6a5bb5cc8cb022e71029bf8df80bf05cb6d9d0..45233fc3dfafdf0ac8b0c324eb245a5883190bfe 100644 GIT binary patch delta 2179 zcmV-}2z>Xx4aE^5iBL{Q4GJ0x0000DNk~Le0000j0000V2nGNE0CT8BJdq(Z1}Gvx z(1BKwTPuGEDM>^@R9M5km|JWV*BQtEXJ&SH_I|b3yS`#!u+6=I6c85<@2$)2dQi zc*sLu^N{cm^&zdQK1Aw8RbTp&w(0|_l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