- 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
if (!levelcomplete) {
sprite_t *bc;
bc = addsprite(P_BLACKCLOUD, 320,240,"cloud");
makeinvuln(bc);
sprite_t *bc,*s2;
int found;
// 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);
playfx(FX_TOOSLOW);
}

View File

@ -1284,6 +1284,9 @@ int loadimagesets(void) {
SDL_Surface *tempimg;
SDL_Surface *reds;
SDL_Surface *origi;
SDL_Rect redarea,temparea;
int x,y;
SDL_Color tempcol;
char tempfile[BUFLEN];
sprintf(tempfile, "%s/sprites/gravestone.png",datadir);
@ -1986,12 +1989,9 @@ int loadimagesets(void) {
// manual angry image for black cloud
origi = imageset[P_BLACKCLOUD].img[0];
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));
@ -2000,20 +2000,24 @@ int loadimagesets(void) {
// take a copy of the original image
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
SDL_BlitSurface(reds, NULL, imageset[P_BLACKCLOUD].img[MAXFRAMES*2], NULL);
SDL_FreeSurface(reds);
for (y = 0; y < imageset[P_BLACKCLOUD].img[MAXFRAMES*2]->h; y++) {
for (x = 0; x < imageset[P_BLACKCLOUD].img[MAXFRAMES*2]->w; x++) {
// Convert the reddened image to the screen format
tempsurf = SDL_DisplayFormat(imageset[P_BLACKCLOUD].img[MAXFRAMES*2]);
SDL_FreeSurface(imageset[P_BLACKCLOUD].img[MAXFRAMES*2]);
imageset[P_BLACKCLOUD].img[MAXFRAMES*2] = tempsurf;
// Make the background red bits completely transparent
SDL_SetColorKey(imageset[P_BLACKCLOUD].img[MAXFRAMES*2],
SDL_SRCCOLORKEY, SDL_MapRGB(imageset[P_BLACKCLOUD].img[MAXFRAMES*2]->format, 99, 0, 0));
getpixelrgb(imageset[P_BLACKCLOUD].img[MAXFRAMES*2] , 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, imageset[P_BLACKCLOUD].img[MAXFRAMES*2], &temparea);
}
}
}
/* generate rotated/flipped images */
for (p = 0; p < MAXPTYPES; p++) {