|
|
|
@ -13,17 +13,18 @@ static void gfx_load_fieldtype_menu ();
|
|
|
|
|
/*
|
|
|
|
|
* count all playergfx
|
|
|
|
|
*/
|
|
|
|
|
#define FNSIZE (LEN_PATHFILENAME+LEN_PATHFILENAME)
|
|
|
|
|
int gfx_get_nr_of_playergfx () {
|
|
|
|
|
int i = 0;
|
|
|
|
|
FILE *f = NULL;
|
|
|
|
|
char filename[255];
|
|
|
|
|
char filename[FNSIZE];
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
if (f) {
|
|
|
|
|
fclose (f);
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
sprintf (filename, "%s/player/player%d.png", bman.datapath, i);
|
|
|
|
|
snprintf (filename, FNSIZE ,"%s/player/player%d.png", bman.datapath, i);
|
|
|
|
|
f = fopen (filename, "r");
|
|
|
|
|
} while (f);
|
|
|
|
|
|
|
|
|
@ -51,7 +52,7 @@ gfx_load_players (int sx, int sy)
|
|
|
|
|
|
|
|
|
|
/* loading the player images */
|
|
|
|
|
for (i = 0; i < gfx.player_gfx_count; i++) {
|
|
|
|
|
sprintf (filename, "%s/player/player%d.png", bman.datapath, i);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/player/player%d.png", bman.datapath, i);
|
|
|
|
|
tmpimage = IMG_Load (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
@ -78,7 +79,7 @@ gfx_load_players (int sx, int sy)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* load the death image */
|
|
|
|
|
sprintf (filename, "%s/player/dead0.png", bman.datapath);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/player/dead0.png", bman.datapath);
|
|
|
|
|
tmpimage = IMG_Load (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
/* no image found - set field clear */
|
|
|
|
@ -95,7 +96,7 @@ gfx_load_players (int sx, int sy)
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
|
|
|
|
|
/* load the illnessthing */
|
|
|
|
|
sprintf (filename, "%s/player/playersick.png", bman.datapath);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/player/playersick.png", bman.datapath);
|
|
|
|
|
tmpimage = IMG_Load (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
@ -110,7 +111,7 @@ gfx_load_players (int sx, int sy)
|
|
|
|
|
SDL_FreeSurface (tmpimage1);
|
|
|
|
|
|
|
|
|
|
/* load the respawn gfx */
|
|
|
|
|
sprintf (filename, "%s/player/respawn.png", bman.datapath);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/player/respawn.png", bman.datapath);
|
|
|
|
|
tmpimage = IMG_Load (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
@ -188,7 +189,7 @@ gfx_loaddata ()
|
|
|
|
|
*tmpimage1;
|
|
|
|
|
|
|
|
|
|
/* load the logo */
|
|
|
|
|
sprintf (filename, "%s/gfx/logo.png", bman.datapath);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/gfx/logo.png", bman.datapath);
|
|
|
|
|
tmpimage = IMG_Load (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
@ -204,7 +205,7 @@ gfx_loaddata ()
|
|
|
|
|
|
|
|
|
|
/* load the menugraphics */
|
|
|
|
|
for (i = 0; i < 9; i++) {
|
|
|
|
|
sprintf (filename, "%s/gfx/menu%d.png", bman.datapath, i);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/gfx/menu%d.png", bman.datapath, i);
|
|
|
|
|
menuimages[i] = IMG_Load (filename);
|
|
|
|
|
if (menuimages[i] == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
@ -215,7 +216,7 @@ gfx_loaddata ()
|
|
|
|
|
/* load menu buttongraphic */
|
|
|
|
|
for (j = 0; j < 3; j++)
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
|
sprintf (filename, "%s/gfx/menubutton%d_%d.png", bman.datapath, j, i);
|
|
|
|
|
snprintf (filename, FNSIZE, "%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 ());
|
|
|
|
@ -229,7 +230,7 @@ gfx_loaddata ()
|
|
|
|
|
/* load menu buttongraphic */
|
|
|
|
|
for (j = 0; j < 2; j++)
|
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
|
sprintf (filename, "%s/gfx/menuentry%d_%d.png", bman.datapath, j, i);
|
|
|
|
|
snprintf (filename, FNSIZE, "%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 ());
|
|
|
|
@ -243,7 +244,7 @@ gfx_loaddata ()
|
|
|
|
|
/* load menu listgraphic */
|
|
|
|
|
for (j = 0; j < 2; j++)
|
|
|
|
|
for (i = 0; i < 9; i++) {
|
|
|
|
|
sprintf (filename, "%s/gfx/menulist%d_%d.png", bman.datapath, j, i);
|
|
|
|
|
snprintf (filename, FNSIZE, "%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 ());
|
|
|
|
@ -255,7 +256,7 @@ gfx_loaddata ()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* load menuselect animation */
|
|
|
|
|
sprintf (filename, "%s/gfx/menuselect.png", bman.datapath);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/gfx/menuselect.png", bman.datapath);
|
|
|
|
|
gfx.menuselect.image = IMG_Load (filename);
|
|
|
|
|
if (gfx.menuselect.image == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
@ -282,7 +283,7 @@ static void gfx_load_menusmall_players () {
|
|
|
|
|
SDL_Surface *img;
|
|
|
|
|
SDL_Rect rect;
|
|
|
|
|
|
|
|
|
|
sprintf (filename, "%s/player/player%d.png", bman.datapath, i);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/player/player%d.png", bman.datapath, i);
|
|
|
|
|
orgimg = IMG_Load (filename);
|
|
|
|
|
if (orgimg == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
@ -319,7 +320,7 @@ static void gfx_load_menusmall_players () {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* load the ghost player */
|
|
|
|
|
sprintf (filename, "%s/player/ghost.png", bman.datapath);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/player/ghost.png", bman.datapath);
|
|
|
|
|
orgimg = IMG_Load (filename);
|
|
|
|
|
sfkt = (float)(((float)(GFX_MENUPLAYERIMGSIZE_X * 2)) / ((float)orgimg->h));
|
|
|
|
|
gfx.ghost = scale_image (orgimg, (int)(((float)orgimg->w)*sfkt), GFX_MENUPLAYERIMGSIZE_X * 2);
|
|
|
|
@ -360,7 +361,7 @@ static void gfx_load_fieldtype_menu () {
|
|
|
|
|
*/
|
|
|
|
|
if (ft == 0) {
|
|
|
|
|
if (background != NULL) SDL_FreeSurface (background);
|
|
|
|
|
sprintf (filename, "%s/tileset/default/background.png", bman.datapath);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/tileset/default/background.png", bman.datapath);
|
|
|
|
|
orgimg = IMG_Load (filename);
|
|
|
|
|
if (!orgimg) {
|
|
|
|
|
printf ("Can't load image. :%s\n", SDL_GetError ());
|
|
|
|
@ -377,7 +378,7 @@ static void gfx_load_fieldtype_menu () {
|
|
|
|
|
|
|
|
|
|
if (ft == FT_death) {
|
|
|
|
|
if (background != NULL) SDL_FreeSurface (background);
|
|
|
|
|
sprintf (filename, "%s/tileset/default/powerbad.png", bman.datapath);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/tileset/default/powerbad.png", bman.datapath);
|
|
|
|
|
orgimg = IMG_Load (filename);
|
|
|
|
|
if (!orgimg) {
|
|
|
|
|
printf ("Can't load image. :%s\n", SDL_GetError ());
|
|
|
|
@ -394,7 +395,7 @@ static void gfx_load_fieldtype_menu () {
|
|
|
|
|
|
|
|
|
|
if (ft == FT_fire) {
|
|
|
|
|
if (background != NULL) SDL_FreeSurface (background);
|
|
|
|
|
sprintf (filename, "%s/tileset/default/powerup.png", bman.datapath);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/tileset/default/powerup.png", bman.datapath);
|
|
|
|
|
orgimg = IMG_Load (filename);
|
|
|
|
|
if (!orgimg) {
|
|
|
|
|
printf ("Can't load image. :%s\n", SDL_GetError ());
|
|
|
|
@ -411,7 +412,7 @@ static void gfx_load_fieldtype_menu () {
|
|
|
|
|
|
|
|
|
|
if (ft == FT_sp_trigger) {
|
|
|
|
|
if (background != NULL) SDL_FreeSurface (background);
|
|
|
|
|
sprintf (filename, "%s/tileset/default/powersp.png", bman.datapath);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/tileset/default/powersp.png", bman.datapath);
|
|
|
|
|
orgimg = IMG_Load (filename);
|
|
|
|
|
if (!orgimg) {
|
|
|
|
|
printf ("Can't load image. :%s\n", SDL_GetError ());
|
|
|
|
@ -430,7 +431,7 @@ static void gfx_load_fieldtype_menu () {
|
|
|
|
|
* load fieldgfx for the menu
|
|
|
|
|
*/
|
|
|
|
|
gfx.menu_field[ft] = gfx_copyfrom (background, NULL);
|
|
|
|
|
sprintf (filename, "%s/tileset/default/%s.png", bman.datapath, ft_filenames[ft]);
|
|
|
|
|
snprintf (filename, FNSIZE, "%s/tileset/default/%s.png", bman.datapath, ft_filenames[ft]);
|
|
|
|
|
|
|
|
|
|
orgimg = IMG_Load (filename);
|
|
|
|
|
if (!orgimg) {
|
|
|
|
|