Fixed bugs when generating angry images for monsters
This commit is contained in:
parent
bbd1f77c67
commit
58463d1535
|
@ -20,6 +20,12 @@ monsters
|
||||||
16 9 18
|
16 9 18
|
||||||
16 11 18
|
16 11 18
|
||||||
15 15 18
|
15 15 18
|
||||||
|
17 2 18
|
||||||
|
17 1 18
|
||||||
|
17 17 18
|
||||||
|
17 19 18
|
||||||
|
17 21 18
|
||||||
|
17 23 18
|
||||||
endmonsters
|
endmonsters
|
||||||
exitdir 1
|
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,
|
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,
|
||||||
|
|
75
shared.c
75
shared.c
|
@ -1869,9 +1869,14 @@ int loadimagesets(void) {
|
||||||
|
|
||||||
for (i = 0; i < imageset[p].numimages; i++) {
|
for (i = 0; i < imageset[p].numimages; i++) {
|
||||||
if (!isfruit(p) && !iseffect(p) && p != P_BLACKCLOUD) {
|
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_SetColorKey(imageset[p].img[i],
|
||||||
SDL_SRCCOLORKEY, SDL_MapRGB(screen->format, 0, 0, 0));
|
SDL_SRCCOLORKEY, SDL_MapRGB(screen->format, 0, 0, 0));
|
||||||
|
*/
|
||||||
|
|
||||||
origi = imageset[p].img[i];
|
origi = imageset[p].img[i];
|
||||||
|
|
||||||
|
@ -1888,17 +1893,13 @@ int loadimagesets(void) {
|
||||||
|
|
||||||
// create semi-transparent red square (white for bosses)
|
// create semi-transparent red square (white for bosses)
|
||||||
if (isboss(p)) {
|
if (isboss(p)) {
|
||||||
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, 255, 255));
|
SDL_FillRect(reds, NULL, SDL_MapRGB(reds->format, 255, 255, 255));
|
||||||
SDL_SetAlpha(reds, SDL_SRCALPHA,100);
|
SDL_SetAlpha(reds, SDL_SRCALPHA,100);
|
||||||
} else {
|
} else {
|
||||||
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));
|
||||||
|
@ -1906,58 +1907,36 @@ int loadimagesets(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// take a copy of the original image
|
// 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
|
getpixelrgb(temps , x, y, &tempcol);
|
||||||
SDL_BlitSurface(reds, NULL, imageset[p].img[MAXFRAMES*2+i], NULL);
|
// if pixel isn't transparent...
|
||||||
SDL_FreeSurface(reds);
|
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;
|
imageset[p].img[MAXFRAMES*2+i] = temps;
|
||||||
|
|
||||||
// Make the background red bits completely transparent
|
// free red image surface
|
||||||
if (isboss(p)) {
|
SDL_FreeSurface(reds);
|
||||||
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));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* flipped angry image */
|
/* flipped angry image */
|
||||||
imageset[p].img[MAXFRAMES*3+i] = rotozoomSurfaceXY(imageset[p].img[MAXFRAMES*2+i], 0, -1,1,0);
|
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);
|
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 ) ;
|
memcpy ( &col , pPosition , where->format->BytesPerPixel ) ;
|
||||||
|
|
||||||
//convert color
|
//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;
|
//*r = color.r;
|
||||||
//*g = color.g;
|
//*g = color.g;
|
||||||
//*b = color.b;
|
//*b = color.b;
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 2.2 KiB |
Loading…
Reference in New Issue