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