- Fixed graphical glitch with angry doom cloud

- Fixed bug where two doom clouds could appear
This commit is contained in:
Rob Pearce 2009-03-26 23:38:16 +00:00
parent a48135926e
commit ace244678b
2 changed files with 35 additions and 18 deletions

19
rc.c
View File

@ -1217,9 +1217,22 @@ void tick(void) {
} }
} else if (gtime == nexthurryup + 15) { // 15 secs after hurryup } else if (gtime == nexthurryup + 15) { // 15 secs after hurryup
if (!levelcomplete) { if (!levelcomplete) {
sprite_t *bc; sprite_t *bc,*s2;
bc = addsprite(P_BLACKCLOUD, 320,240,"cloud"); int found;
makeinvuln(bc);
// does cloud already exist? (could happen if someone
// picked up the whistle powerup)
for (s2 = sprite; s2 ; s2 = s2->next) {
if (s2->id == P_BLACKCLOUD) {
found = B_TRUE;
break;
}
}
if (!found) {
bc = addsprite(P_BLACKCLOUD, 320,240,"cloud");
makeinvuln(bc);
}
addoutlinetext(320,240,TEXTSIZE_HURRY, "Too slow!", &red,&black,HURRYDELAY, TT_NORM); addoutlinetext(320,240,TEXTSIZE_HURRY, "Too slow!", &red,&black,HURRYDELAY, TT_NORM);
playfx(FX_TOOSLOW); playfx(FX_TOOSLOW);
} }

View File

@ -1284,6 +1284,9 @@ int loadimagesets(void) {
SDL_Surface *tempimg; SDL_Surface *tempimg;
SDL_Surface *reds; SDL_Surface *reds;
SDL_Surface *origi; SDL_Surface *origi;
SDL_Rect redarea,temparea;
int x,y;
SDL_Color tempcol;
char tempfile[BUFLEN]; char tempfile[BUFLEN];
sprintf(tempfile, "%s/sprites/gravestone.png",datadir); sprintf(tempfile, "%s/sprites/gravestone.png",datadir);
@ -1986,12 +1989,9 @@ int loadimagesets(void) {
// manual angry image for black cloud // manual angry image for black cloud
origi = imageset[P_BLACKCLOUD].img[0]; origi = imageset[P_BLACKCLOUD].img[0];
reds = SDL_CreateRGBSurface(SDL_SWSURFACE, reds = SDL_CreateRGBSurface(SDL_SWSURFACE,2,2,
origi->w,
origi->h,
origi->format->BitsPerPixel, origi->format->Rmask, origi->format->BitsPerPixel, origi->format->Rmask,
origi->format->Gmask,origi->format->Bmask, 0); origi->format->Gmask,origi->format->Bmask, 0);
SDL_FillRect(reds, NULL, SDL_MapRGB(reds->format, 255, 0, 0)); SDL_FillRect(reds, NULL, SDL_MapRGB(reds->format, 255, 0, 0));
@ -2000,20 +2000,24 @@ int loadimagesets(void) {
// take a copy of the original image // take a copy of the original image
imageset[P_BLACKCLOUD].img[MAXFRAMES*2] = rotozoomSurfaceXY(origi, 0, 1,1,0); imageset[P_BLACKCLOUD].img[MAXFRAMES*2] = rotozoomSurfaceXY(origi, 0, 1,1,0);
redarea.x = 0; redarea.y = 0;
redarea.w = 1; redarea.h = 1;
temparea.w = 1; temparea.h = 1;
// paste the transparent one on top of it for (y = 0; y < imageset[P_BLACKCLOUD].img[MAXFRAMES*2]->h; y++) {
SDL_BlitSurface(reds, NULL, imageset[P_BLACKCLOUD].img[MAXFRAMES*2], NULL); for (x = 0; x < imageset[P_BLACKCLOUD].img[MAXFRAMES*2]->w; x++) {
SDL_FreeSurface(reds);
// Convert the reddened image to the screen format getpixelrgb(imageset[P_BLACKCLOUD].img[MAXFRAMES*2] , x, y, &tempcol);
tempsurf = SDL_DisplayFormat(imageset[P_BLACKCLOUD].img[MAXFRAMES*2]); // if pixel isn't transparent...
SDL_FreeSurface(imageset[P_BLACKCLOUD].img[MAXFRAMES*2]); if (tempcol.unused > 0 ) {
imageset[P_BLACKCLOUD].img[MAXFRAMES*2] = tempsurf; temparea.x = x;
temparea.y = y;
// Make the background red bits completely transparent // make this pixel redder
SDL_SetColorKey(imageset[P_BLACKCLOUD].img[MAXFRAMES*2], SDL_BlitSurface(reds, &redarea, imageset[P_BLACKCLOUD].img[MAXFRAMES*2], &temparea);
SDL_SRCCOLORKEY, SDL_MapRGB(imageset[P_BLACKCLOUD].img[MAXFRAMES*2]->format, 99, 0, 0)); }
}
}
/* generate rotated/flipped images */ /* generate rotated/flipped images */
for (p = 0; p < MAXPTYPES; p++) { for (p = 0; p < MAXPTYPES; p++) {