|
|
|
@ -775,6 +775,7 @@ gfx_copyscreen (SDL_Rect * wnd)
|
|
|
|
|
return res;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* load the tileset or if not present the files from the default folder */
|
|
|
|
|
void
|
|
|
|
|
gfx_load_tileset (char *tilesetname)
|
|
|
|
@ -853,27 +854,40 @@ gfx_load_tileset (char *tilesetname)
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
SDL_FreeSurface (tmpimage1);
|
|
|
|
|
|
|
|
|
|
/* load the powerup image */
|
|
|
|
|
sprintf (fullname, "%s/tileset/%s/powerup.bmp", bman.datapath, tileset);
|
|
|
|
|
tmpimage = SDL_LoadBMP (fullname);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
/* file could not be load, so load teh default tileset */
|
|
|
|
|
sprintf (fullname, "%s/tileset/default/powerup.bmp", bman.datapath);
|
|
|
|
|
tmpimage = SDL_LoadBMP (fullname);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("default tileset could not be loaded.\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gfx.powerup.frames = tmpimage->h / GFX_IMGSIZE;
|
|
|
|
|
tmpimage1 =
|
|
|
|
|
scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x,
|
|
|
|
|
gfx.powerup.frames * gfx.block.y);
|
|
|
|
|
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY, SDL_MapRGB (tmpimage1->format, 255, 0, 255));
|
|
|
|
|
gfx.powerup.image = SDL_DisplayFormat (tmpimage1);
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
SDL_FreeSurface (tmpimage1);
|
|
|
|
|
/* load the powerup's image */
|
|
|
|
|
for (i = 0; i < PWUP_max; i++) {
|
|
|
|
|
switch (i) {
|
|
|
|
|
case (PWUP_good):
|
|
|
|
|
sprintf (filename,"powerup.bmp");
|
|
|
|
|
break;
|
|
|
|
|
case (PWUP_bad):
|
|
|
|
|
sprintf (filename,"powerbad.bmp");
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
sprintf (filename,"powersp.bmp");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sprintf (fullname, "%s/tileset/%s/%s", bman.datapath, tileset, filename);
|
|
|
|
|
tmpimage = SDL_LoadBMP (fullname);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
/* file could not be load, so load teh default tileset */
|
|
|
|
|
sprintf (fullname, "%s/tileset/default/%s", bman.datapath, filename);
|
|
|
|
|
tmpimage = SDL_LoadBMP (fullname);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("default tileset could not be loaded.\n");
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gfx.powerup[i].frames = tmpimage->h / GFX_IMGSIZE;
|
|
|
|
|
tmpimage1 =
|
|
|
|
|
scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x,
|
|
|
|
|
gfx.powerup[i].frames * gfx.block.y);
|
|
|
|
|
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY, SDL_MapRGB (tmpimage1->format, 255, 0, 255));
|
|
|
|
|
gfx.powerup[i].image = SDL_DisplayFormat (tmpimage1);
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
SDL_FreeSurface (tmpimage1);
|
|
|
|
|
}
|
|
|
|
|
/* loading the field images */
|
|
|
|
|
for (i = 0; i < FT_max; i++) {
|
|
|
|
|
switch (i) {
|
|
|
|
@ -912,13 +926,7 @@ gfx_load_tileset (char *tilesetname)
|
|
|
|
|
continue; // remove this if you find a kick image
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (i == FT_mixed) {
|
|
|
|
|
tmpimage =
|
|
|
|
|
gfx_quater_image (gfx.field[FT_bomb].image, gfx.field[FT_fire].image,
|
|
|
|
|
gfx.field[FT_death].image, gfx.field[FT_shoe].image);
|
|
|
|
|
gfx.field[i].image = SDL_DisplayFormat (tmpimage);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (i != FT_mixed) {
|
|
|
|
|
sprintf (fullname, "%s/tileset/%s/%s", bman.datapath, tileset, filename);
|
|
|
|
|
tmpimage = SDL_LoadBMP (fullname);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
@ -959,8 +967,9 @@ gfx_free_tileset ()
|
|
|
|
|
SDL_FreeSurface (gfx.bomb.image);
|
|
|
|
|
if (gfx.fire.image != NULL)
|
|
|
|
|
SDL_FreeSurface (gfx.fire.image);
|
|
|
|
|
if (gfx.powerup.image != NULL)
|
|
|
|
|
SDL_FreeSurface (gfx.powerup.image);
|
|
|
|
|
for (i = 0; i < PWUP_max; i++)
|
|
|
|
|
if (gfx.powerup[i].image != NULL)
|
|
|
|
|
SDL_FreeSurface (gfx.powerup[i].image);
|
|
|
|
|
gfx.bomb.image = NULL;
|
|
|
|
|
gfx.fire.image = NULL;
|
|
|
|
|
};
|
|
|
|
|