From a51e57c0470f965d97e329e7782d3681ac2357d5 Mon Sep 17 00:00:00 2001 From: stpohle Date: Sun, 25 Jan 2004 02:20:56 +0000 Subject: [PATCH] converted bmp to png and added support for it. --- ChangeLog | 5 ++++- TODO | 4 ++-- configure.in | 8 ++++++-- include/bomberclone.h | 3 ++- src/font.c | 6 +++--- src/gfx.c | 38 +++++++++++++++++------------------ src/gfxpixelimage.c | 25 ++++++++++++----------- src/tileset.c | 46 +++++++++++++++++++++---------------------- 8 files changed, 72 insertions(+), 63 deletions(-) diff --git a/ChangeLog b/ChangeLog index 768791b..5cc2db5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.54 2004/01/24 23:52:39 stpohle Exp $ +$Id: ChangeLog,v 1.55 2004/01/25 02:20:56 stpohle Exp $ - Added: Kick Bombs special @@ -21,6 +21,9 @@ $Id: ChangeLog,v 1.54 2004/01/24 23:52:39 stpohle Exp $ - Fixed: (Network) three more stones will be restored if a new bombdata packet reaches the player. +- Changed all Images to PNG. From now on there is alpha blending + supported too. + Version 0.11.0 ============== diff --git a/TODO b/TODO index aaa4c0c..c951d26 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,9 @@ -$Id: TODO,v 1.36 2004/01/22 20:55:16 stpohle Exp $ +$Id: TODO,v 1.37 2004/01/25 02:20:56 stpohle Exp $ * start settings for Speed, Ticking time of the bombs. How many bombs and so on. -* bug: which creates just some explosions on the field. +- bug: which creates just some explosions on the field. - support for more player on one keyboard diff --git a/configure.in b/configure.in index f1a2b1e..6fde166 100644 --- a/configure.in +++ b/configure.in @@ -4,11 +4,10 @@ dnl If you don't want it to overwrite it, dnl Please disable it in the Anjuta project configuration AC_INIT(configure.in) +AC_CANONICAL_TARGET AM_INIT_AUTOMAKE(bomberclone, 0.11.1) AM_CONFIG_HEADER(config.h) -AC_CANONICAL_HOST -AC_CANONICAL_TARGET AC_EXEEXT AC_OBJEXT @@ -75,6 +74,11 @@ else AC_MSG_WARN(Enable Debuging) fi +dnl SDL_image library ***************************** +AC_CHECK_LIB(SDL_image, IMG_LoadPNG_RW, , AC_MSG_ERROR([ +*** Unable to find SDL_image libary with PNG support +(http://www.libsdl.org/projects/SDL_image/) +])) dnl SDL_mixer ********************************** diff --git a/include/bomberclone.h b/include/bomberclone.h index 94e561c..58b22b6 100644 --- a/include/bomberclone.h +++ b/include/bomberclone.h @@ -1,4 +1,4 @@ -/* $Id: bomberclone.h,v 1.15 2004/01/06 19:52:02 stpohle Exp $ */ +/* $Id: bomberclone.h,v 1.16 2004/01/25 02:21:00 stpohle Exp $ */ /* bomberclone.h */ #ifndef _BOMBERCLONE_H_ @@ -34,6 +34,7 @@ #include #endif #include +#include #if HAVE_CONFIG_H #include "config.h" diff --git a/src/font.c b/src/font.c index 997d9e0..49e9171 100644 --- a/src/font.c +++ b/src/font.c @@ -1,4 +1,4 @@ -/* $Id: font.c,v 1.11 2003/12/24 02:38:15 stpohle Exp $ */ +/* $Id: font.c,v 1.12 2004/01/25 02:21:01 stpohle Exp $ */ // Using Fonts in SDL #include @@ -69,8 +69,8 @@ void font_load () { /* load the font */ for (i = 0; i < 3; i++) { - sprintf (filename, "%s/gfx/font%d.bmp", bman.datapath, i); - tmp = SDL_LoadBMP (filename); + sprintf (filename, "%s/gfx/font%d.png", bman.datapath, i); + tmp = IMG_Load (filename); if (tmp == NULL) { printf ("Could not load font.\n"); exit (1); diff --git a/src/gfx.c b/src/gfx.c index 94465eb..5e7806a 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -1,4 +1,4 @@ -/* $Id: gfx.c,v 1.29 2003/12/31 01:00:11 stpohle Exp $ */ +/* $Id: gfx.c,v 1.30 2004/01/25 02:21:01 stpohle Exp $ */ /* gfx.c */ #include "bomberclone.h" @@ -25,9 +25,9 @@ gfx_load_players (int sx, int sy) /* loading the player images */ for (j = i = 0; i < MAX_PLAYERS; i++) { - sprintf (filename, "%s/player/player%d.bmp", bman.datapath, j); + sprintf (filename, "%s/player/player%d.png", bman.datapath, j); j++; - tmpimage = SDL_LoadBMP (filename); + tmpimage = IMG_Load (filename); if (tmpimage == NULL) { if (j == 0) { // try again with the first image, if this don't work give up. printf ("Can't load image: %s\n", SDL_GetError ()); @@ -71,8 +71,8 @@ gfx_load_players (int sx, int sy) } /* load the death image */ - sprintf (filename, "%s/player/dead0.bmp", bman.datapath); - tmpimage = SDL_LoadBMP (filename); + sprintf (filename, "%s/player/dead0.png", bman.datapath); + tmpimage = IMG_Load (filename); if (tmpimage == NULL) { /* no image found - set field clear */ printf ("Player Animation Could not be loaded (%s)\n", filename); @@ -91,8 +91,8 @@ gfx_load_players (int sx, int sy) /* load the illnessthing */ - sprintf (filename, "%s/player/playersick.bmp", bman.datapath); - tmpimage = SDL_LoadBMP (filename); + sprintf (filename, "%s/player/playersick.png", bman.datapath); + tmpimage = IMG_Load (filename); if (tmpimage == NULL) { printf ("Can't load image: %s\n", SDL_GetError ()); exit (1); @@ -164,12 +164,12 @@ gfx_loaddata () *tmpimage1; /* load the logo */ - sprintf (filename, "%s/gfx/logo.bmp", bman.datapath); - tmpimage = SDL_LoadBMP (filename); + sprintf (filename, "%s/gfx/logo.png", bman.datapath); + tmpimage = IMG_Load (filename); if (tmpimage == NULL) { sprintf (bman.datapath, "data"); - sprintf (filename, "%s/gfx/logo.bmp", bman.datapath); - tmpimage = SDL_LoadBMP (filename); + sprintf (filename, "%s/gfx/logo.png", bman.datapath); + tmpimage = IMG_Load (filename); if (tmpimage == NULL) { printf ("Can't load image: %s\n", SDL_GetError ()); exit (1); @@ -185,8 +185,8 @@ gfx_loaddata () /* load the menugraphics */ for (i = 0; i < 9; i++) { - sprintf (filename, "%s/gfx/menu%d.bmp", bman.datapath, i); - tmpimage = SDL_LoadBMP (filename); + sprintf (filename, "%s/gfx/menu%d.png", bman.datapath, i); + tmpimage = IMG_Load (filename); if (tmpimage == NULL) { printf ("Can't load image: %s\n", SDL_GetError ()); exit (1); @@ -201,8 +201,8 @@ gfx_loaddata () /* load menu buttongraphic */ for (j = 0; j < 3; j++) for (i = 0; i < 3; i++) { - sprintf (filename, "%s/gfx/menubutton%d_%d.bmp", bman.datapath, j, i); - tmpimage = SDL_LoadBMP (filename); + sprintf (filename, "%s/gfx/menubutton%d_%d.png", bman.datapath, j, i); + tmpimage = IMG_Load (filename); if (tmpimage == NULL) { printf ("Can't load image: %s\n", SDL_GetError ()); exit (1); @@ -215,8 +215,8 @@ gfx_loaddata () /* load menu buttongraphic */ for (j = 0; j < 2; j++) for (i = 0; i < 3; i++) { - sprintf (filename, "%s/gfx/menuentry%d_%d.bmp", bman.datapath, j, i); - tmpimage = SDL_LoadBMP (filename); + sprintf (filename, "%s/gfx/menuentry%d_%d.png", bman.datapath, j, i); + tmpimage = IMG_Load (filename); if (tmpimage == NULL) { printf ("Can't load image: %s\n", SDL_GetError ()); exit (1); @@ -229,8 +229,8 @@ gfx_loaddata () /* load menu listgraphic */ for (j = 0; j < 2; j++) for (i = 0; i < 9; i++) { - sprintf (filename, "%s/gfx/menulist%d_%d.bmp", bman.datapath, j, i); - tmpimage = SDL_LoadBMP (filename); + sprintf (filename, "%s/gfx/menulist%d_%d.png", bman.datapath, j, i); + tmpimage = IMG_Load (filename); if (tmpimage == NULL) { printf ("Can't load image: %s\n", SDL_GetError ()); exit (1); diff --git a/src/gfxpixelimage.c b/src/gfxpixelimage.c index 4bb47b1..37668e2 100644 --- a/src/gfxpixelimage.c +++ b/src/gfxpixelimage.c @@ -1,4 +1,4 @@ -/* $Id: gfxpixelimage.c,v 1.7 2004/01/22 20:55:39 stpohle Exp $ */ +/* $Id: gfxpixelimage.c,v 1.8 2004/01/25 02:21:01 stpohle Exp $ */ /* gfx pixel manipulation and image manipulation */ #include "bomberclone.h" @@ -212,14 +212,14 @@ scale_image (SDL_Surface *orginal, int newx, int newy) short int ypattern[SCALE_MAXRES]; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0x0000ff00; + rmask = 0xff000000; gmask = 0x00ff0000; - bmask = 0xff000000; + bmask = 0x0000ff00; amask = 0x000000ff; #else /* */ - rmask = 0x00ff0000; + rmask = 0x000000ff; gmask = 0x0000ff00; - bmask = 0x000000ff; + bmask = 0x00ff0000; amask = 0xff000000; #endif /* */ @@ -300,17 +300,18 @@ makegray_image (SDL_Surface * org) gray; #if SDL_BYTEORDER == SDL_BIG_ENDIAN - rmask = 0x0000ff00; + rmask = 0xff000000; gmask = 0x00ff0000; - bmask = 0xff000000; + bmask = 0x0000ff00; amask = 0x000000ff; -#else - rmask = 0x00ff0000; +#else /* */ + rmask = 0x000000ff; gmask = 0x0000ff00; - bmask = 0x000000ff; + bmask = 0x00ff0000; amask = 0xff000000; -#endif - dest = SDL_CreateRGBSurface (SDL_SWSURFACE, org->w, org->h, org->format->BitsPerPixel, +#endif /* */ + + dest = SDL_CreateRGBSurface (SDL_SWSURFACE, org->w, org->h, org->format->BitsPerPixel, org->format->Rmask, org->format->Gmask, org->format->Bmask, org->format->Amask); if (dest == NULL) { diff --git a/src/tileset.c b/src/tileset.c index 3e17c38..097e0f3 100644 --- a/src/tileset.c +++ b/src/tileset.c @@ -1,4 +1,4 @@ -/* $Id: tileset.c,v 1.12 2004/01/07 23:04:32 patty21 Exp $ */ +/* $Id: tileset.c,v 1.13 2004/01/25 02:21:01 stpohle Exp $ */ /* load and select tilesets */ #include "bomberclone.h" @@ -76,14 +76,14 @@ tileset_load (char *tilesetname) gfx.offset.y = gfx.res.y - (gfx.block.y * map.size.y); /* load the fire */ - sprintf (fullname, "%s/tileset/%s/fire.bmp", bman.datapath, tileset); - tmpimage = SDL_LoadBMP (fullname); + sprintf (fullname, "%s/tileset/%s/fire.png", bman.datapath, tileset); + tmpimage = IMG_Load (fullname); if (tmpimage == NULL) { /* file could not be load, so load teh default tileset */ - sprintf (fullname, "%s/tileset/default/fire.bmp", bman.datapath); - tmpimage = SDL_LoadBMP (fullname); + sprintf (fullname, "%s/tileset/default/fire.png", bman.datapath); + tmpimage = IMG_Load (fullname); if (tmpimage == NULL) { - printf ("default tileset could not be loaded.\n"); + printf ("default tileset could not be loaded. [%s]\n", fullname); exit (1); } } @@ -98,14 +98,14 @@ tileset_load (char *tilesetname) SDL_FreeSurface (tmpimage1); /* load the bomb */ - sprintf (fullname, "%s/tileset/%s/bomb.bmp", bman.datapath, tileset); - tmpimage = SDL_LoadBMP (fullname); + sprintf (fullname, "%s/tileset/%s/bomb.png", bman.datapath, tileset); + tmpimage = IMG_Load (fullname); if (tmpimage == NULL) { /* file could not be load, so load teh default tileset */ - sprintf (fullname, "%s/tileset/default/bomb.bmp", bman.datapath); - tmpimage = SDL_LoadBMP (fullname); + sprintf (fullname, "%s/tileset/default/bomb.png", bman.datapath); + tmpimage = IMG_Load (fullname); if (tmpimage == NULL) { - printf ("default tileset could not be loaded.\n"); + printf ("default tileset could not be loaded. [%s]\n", fullname); exit (1); } } @@ -123,24 +123,24 @@ tileset_load (char *tilesetname) for (i = 0; i < PWUP_max; i++) { switch (i) { case (PWUP_good): - sprintf (filename, "powerup.bmp"); + sprintf (filename, "powerup.png"); break; case (PWUP_bad): - sprintf (filename, "powerbad.bmp"); + sprintf (filename, "powerbad.png"); break; default: - sprintf (filename, "powersp.bmp"); + sprintf (filename, "powersp.png"); break; } sprintf (fullname, "%s/tileset/%s/%s", bman.datapath, tileset, filename); - tmpimage = SDL_LoadBMP (fullname); + tmpimage = IMG_Load (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); + tmpimage = IMG_Load (fullname); if (tmpimage == NULL) { - printf ("default tileset could not be loaded.\n"); + printf ("default tileset could not be loaded. [%s]\n", fullname); exit (1); } } @@ -200,18 +200,18 @@ tileset_load (char *tilesetname) break; } if (i != FT_mixed) { - sprintf (fullname, "%s/tileset/%s/%s.bmp", bman.datapath, tileset, filename); + sprintf (fullname, "%s/tileset/%s/%s.png", bman.datapath, tileset, filename); gfx.field[i].w = GFX_IMGSIZE; gfx.field[i].h = GFX_IMGSIZE; - tmpimage = SDL_LoadBMP (fullname); + tmpimage = IMG_Load (fullname); if (tmpimage == NULL) { - sprintf (fullname, "%s/tileset/%s/%s96.bmp", bman.datapath, tileset, filename); + sprintf (fullname, "%s/tileset/%s/%s96.png", bman.datapath, tileset, filename); gfx.field[i].h = GFX_IMGBIGSIZE; - tmpimage = SDL_LoadBMP (fullname); + tmpimage = IMG_Load (fullname); if (tmpimage == NULL) { - sprintf (fullname, "%s/tileset/default/%s.bmp", bman.datapath, filename); + sprintf (fullname, "%s/tileset/default/%s.png", bman.datapath, filename); gfx.field[i].h = GFX_IMGSIZE; - tmpimage = SDL_LoadBMP (fullname); + tmpimage = IMG_Load (fullname); if (tmpimage == NULL) { printf ("Can't load image: %s\n", SDL_GetError ()); exit (1);