|
|
|
@ -289,7 +289,7 @@ void gfx_load_players (int sx, int sy) {
|
|
|
|
|
|
|
|
|
|
/* loading the player images */
|
|
|
|
|
for (j = i = 0; i < MAX_PLAYERS; i++) {
|
|
|
|
|
sprintf (filename, "%s/player%d.bmp", bman.datapath, j);
|
|
|
|
|
sprintf (filename, "%s/player/player%d.bmp", bman.datapath, j);
|
|
|
|
|
j++;
|
|
|
|
|
tmpimage = SDL_LoadBMP (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
@ -325,131 +325,23 @@ void gfx_load_players (int sx, int sy) {
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* load the images with teh right scaleing */
|
|
|
|
|
void gfx_game_init () {
|
|
|
|
|
int i,
|
|
|
|
|
r,
|
|
|
|
|
g,
|
|
|
|
|
b;
|
|
|
|
|
|
|
|
|
|
char filename[255];
|
|
|
|
|
SDL_Surface *tmpimage, *tmpimage1;
|
|
|
|
|
float sfkt;
|
|
|
|
|
|
|
|
|
|
d_printf ("GFX Init\n");
|
|
|
|
|
|
|
|
|
|
menu_displaytext ("Please Wait", "Loading GFX Data", 64, 64, 128);
|
|
|
|
|
|
|
|
|
|
/* Calculate the Best Size of the Images */
|
|
|
|
|
gfx.block.x = gfx.res.x / (bman.fieldsize.x+1);
|
|
|
|
|
gfx.block.y = (gfx.res.y - 80) / (bman.fieldsize.y+1);
|
|
|
|
|
|
|
|
|
|
if (gfx.block.x < gfx.block.y)
|
|
|
|
|
gfx.block.y = gfx.block.x;
|
|
|
|
|
else
|
|
|
|
|
gfx.block.x = gfx.block.y;
|
|
|
|
|
|
|
|
|
|
/* create Table of points */
|
|
|
|
|
scale (gfx.postab, gfx.block.x, 256);
|
|
|
|
|
|
|
|
|
|
sfkt = ((float) gfx.block.x) / ((float) GFX_IMGSIZE);
|
|
|
|
|
|
|
|
|
|
/* calculating the best offset for the field on the screen */
|
|
|
|
|
gfx.offset.x = (gfx.res.x - (gfx.block.x * bman.fieldsize.x)) / 2;
|
|
|
|
|
gfx.offset.y = gfx.res.y - (gfx.block.y * bman.fieldsize.y);
|
|
|
|
|
|
|
|
|
|
/* load the fire */
|
|
|
|
|
sprintf (filename, "%s/fire.bmp", bman.datapath);
|
|
|
|
|
tmpimage = SDL_LoadBMP (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
gfx.fire.frames = tmpimage->h / GFX_IMGSIZE;
|
|
|
|
|
tmpimage1 = scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x, gfx.fire.frames * gfx.block.y);
|
|
|
|
|
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,
|
|
|
|
|
SDL_MapRGB (tmpimage1->format, 255, 0, 255));
|
|
|
|
|
gfx.fire.image = SDL_DisplayFormat (tmpimage1);
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
SDL_FreeSurface (tmpimage1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* load the bomb */
|
|
|
|
|
sprintf (filename, "%s/bomb.bmp", bman.datapath);
|
|
|
|
|
tmpimage = SDL_LoadBMP (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
gfx.bomb.frames = tmpimage->h / GFX_IMGSIZE;
|
|
|
|
|
tmpimage1 = scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x, gfx.bomb.frames * gfx.block.y);
|
|
|
|
|
getRGBpixel (tmpimage1, 0, 0, &r, &g, &b);
|
|
|
|
|
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,SDL_MapRGB (tmpimage1->format, r, g, b));
|
|
|
|
|
gfx.bomb.image = SDL_DisplayFormat (tmpimage1);
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
SDL_FreeSurface (tmpimage1);
|
|
|
|
|
|
|
|
|
|
/* load the illnessthing */
|
|
|
|
|
sprintf (filename, "%s/playersick.bmp", bman.datapath);
|
|
|
|
|
sprintf (filename, "%s/player/playersick.bmp", bman.datapath);
|
|
|
|
|
tmpimage = SDL_LoadBMP (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
gfx.ill.frames = tmpimage->h / (2*GFX_IMGSIZE);
|
|
|
|
|
tmpimage1 = scale_image (tmpimage, (tmpimage->w / (2*GFX_IMGSIZE)) * (2 * gfx.block.x), gfx.ill.frames * (2*gfx.block.y));
|
|
|
|
|
tmpimage1 = scale_image (tmpimage, (tmpimage->w / (2*GFX_IMGSIZE)) * (2 * sx), gfx.ill.frames * (2*sy));
|
|
|
|
|
getRGBpixel (tmpimage1, 0, 0, &r, &g, &b);
|
|
|
|
|
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,SDL_MapRGB (tmpimage1->format, r, g, b));
|
|
|
|
|
gfx.ill.image = SDL_DisplayFormat (tmpimage1);
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
SDL_FreeSurface (tmpimage1);
|
|
|
|
|
|
|
|
|
|
/* loading the field images */
|
|
|
|
|
for (i = 0; i < FT_max; i++) {
|
|
|
|
|
switch (i) {
|
|
|
|
|
case (FT_nothing):
|
|
|
|
|
sprintf (filename, "%s/background.bmp", bman.datapath);
|
|
|
|
|
break;
|
|
|
|
|
case (FT_stone):
|
|
|
|
|
sprintf (filename, "%s/stone.bmp", bman.datapath);
|
|
|
|
|
break;
|
|
|
|
|
case (FT_block):
|
|
|
|
|
sprintf (filename, "%s/block.bmp", bman.datapath);
|
|
|
|
|
break;
|
|
|
|
|
case (FT_death):
|
|
|
|
|
sprintf (filename, "%s/fielddeath.bmp", bman.datapath);
|
|
|
|
|
break;
|
|
|
|
|
case (FT_bomb):
|
|
|
|
|
sprintf (filename, "%s/fieldbomb.bmp", bman.datapath);
|
|
|
|
|
break;
|
|
|
|
|
case (FT_fire):
|
|
|
|
|
sprintf (filename, "%s/fieldfire.bmp", bman.datapath);
|
|
|
|
|
break;
|
|
|
|
|
case (FT_shoe):
|
|
|
|
|
sprintf (filename, "%s/fieldshoe.bmp", bman.datapath);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tmpimage = SDL_LoadBMP (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
gfx.field[i].frames = tmpimage->h / GFX_IMGSIZE;
|
|
|
|
|
tmpimage1 = scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x, gfx.field[i].frames * gfx.block.y);
|
|
|
|
|
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,SDL_MapRGB (tmpimage1->format, 255, 255, 255));
|
|
|
|
|
gfx.field[i].image = SDL_DisplayFormat (tmpimage1);
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
SDL_FreeSurface (tmpimage1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* loading the player images */
|
|
|
|
|
gfx_load_players (gfx.block.x, gfx.block.y);
|
|
|
|
|
|
|
|
|
|
UpdateRects_nr = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* frees the player images */
|
|
|
|
@ -464,34 +356,28 @@ void gfx_free_players () {
|
|
|
|
|
SDL_FreeSurface (gfx.players[i].smal_image);
|
|
|
|
|
gfx.players[i].smal_image = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void gfx_game_shutdown () {
|
|
|
|
|
int i;
|
|
|
|
|
SDL_FreeSurface (gfx.ill.image);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
menu_displaytext ("Please Wait", "Freeing GFX Data", 64, 128, 64);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < FT_max; i++) {
|
|
|
|
|
if (gfx.field[i].image != NULL)
|
|
|
|
|
SDL_FreeSurface (gfx.field[i].image);
|
|
|
|
|
gfx.field[i].image = NULL;
|
|
|
|
|
}
|
|
|
|
|
/* load the images with the right scaleing */
|
|
|
|
|
void gfx_game_init () {
|
|
|
|
|
menu_displaytext ("Loading..", "Please Wait", 32, 128, 32);
|
|
|
|
|
|
|
|
|
|
gfx_free_players ();
|
|
|
|
|
gfx_load_tileset (gfx.tileset);
|
|
|
|
|
gfx_load_players (gfx.block.x,gfx.block.y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (gfx.bomb.image != NULL)
|
|
|
|
|
SDL_FreeSurface (gfx.bomb.image);
|
|
|
|
|
|
|
|
|
|
if (gfx.fire.image != NULL)
|
|
|
|
|
SDL_FreeSurface (gfx.fire.image);
|
|
|
|
|
void gfx_game_shutdown () {
|
|
|
|
|
menu_displaytext ("Freeing..", "Please Wait", 32, 128, 32);
|
|
|
|
|
|
|
|
|
|
gfx.bomb.image = NULL;
|
|
|
|
|
gfx.fire.image = NULL;
|
|
|
|
|
gfx_free_players ();
|
|
|
|
|
gfx_free_tileset ();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* init the whole GFX Part */
|
|
|
|
|
void gfx_init () {
|
|
|
|
|
if (gfx.fullscreen)
|
|
|
|
@ -523,7 +409,7 @@ gfx_loaddata ()
|
|
|
|
|
SDL_Surface *tmpimage, *tmpimage1;
|
|
|
|
|
|
|
|
|
|
/* load the font */
|
|
|
|
|
sprintf (filename, "%s/font.bmp", bman.datapath);
|
|
|
|
|
sprintf (filename, "%s/gfx/font.bmp", bman.datapath);
|
|
|
|
|
tmpimage = SDL_LoadBMP (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
@ -537,7 +423,7 @@ gfx_loaddata ()
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
|
|
|
|
|
/* load the font */
|
|
|
|
|
sprintf (filename, "%s/font1.bmp", bman.datapath);
|
|
|
|
|
sprintf (filename, "%s/gfx/font1.bmp", bman.datapath);
|
|
|
|
|
tmpimage = SDL_LoadBMP (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
@ -551,7 +437,7 @@ gfx_loaddata ()
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
|
|
|
|
|
/* load the logo */
|
|
|
|
|
sprintf (filename, "%s/logo.bmp", bman.datapath);
|
|
|
|
|
sprintf (filename, "%s/gfx/logo.bmp", bman.datapath);
|
|
|
|
|
tmpimage = SDL_LoadBMP (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
@ -564,9 +450,8 @@ gfx_loaddata ()
|
|
|
|
|
gfx.logo = SDL_DisplayFormat (tmpimage1);
|
|
|
|
|
SDL_FreeSurface (tmpimage1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* load the menuselector */
|
|
|
|
|
sprintf (filename, "%s/menuselect.bmp", bman.datapath);
|
|
|
|
|
sprintf (filename, "%s/gfx/menuselect.bmp", bman.datapath);
|
|
|
|
|
tmpimage = SDL_LoadBMP (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
@ -763,3 +648,128 @@ SDL_Surface *gfx_copyscreen (SDL_Rect *wnd) {
|
|
|
|
|
SDL_BlitSurface (gfx.screen, wnd, res, &dest);
|
|
|
|
|
return res;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void gfx_load_tileset (char *tileset) {
|
|
|
|
|
int i,
|
|
|
|
|
r,
|
|
|
|
|
g,
|
|
|
|
|
b;
|
|
|
|
|
|
|
|
|
|
char filename[255];
|
|
|
|
|
SDL_Surface *tmpimage, *tmpimage1;
|
|
|
|
|
float sfkt;
|
|
|
|
|
|
|
|
|
|
d_printf ("Loading Tileset\n");
|
|
|
|
|
|
|
|
|
|
/* Calculate the Best Size of the Images */
|
|
|
|
|
gfx.block.x = gfx.res.x / (bman.fieldsize.x+1);
|
|
|
|
|
gfx.block.y = (gfx.res.y - 80) / (bman.fieldsize.y+1);
|
|
|
|
|
|
|
|
|
|
if (gfx.block.x < gfx.block.y)
|
|
|
|
|
gfx.block.y = gfx.block.x;
|
|
|
|
|
else
|
|
|
|
|
gfx.block.x = gfx.block.y;
|
|
|
|
|
|
|
|
|
|
/* create Table of points */
|
|
|
|
|
scale (gfx.postab, gfx.block.x, 256);
|
|
|
|
|
|
|
|
|
|
sfkt = ((float) gfx.block.x) / ((float) GFX_IMGSIZE);
|
|
|
|
|
|
|
|
|
|
/* calculating the best offset for the field on the screen */
|
|
|
|
|
gfx.offset.x = (gfx.res.x - (gfx.block.x * bman.fieldsize.x)) / 2;
|
|
|
|
|
gfx.offset.y = gfx.res.y - (gfx.block.y * bman.fieldsize.y);
|
|
|
|
|
|
|
|
|
|
/* load the fire */
|
|
|
|
|
sprintf (filename, "%s/tileset/%s/fire.bmp", bman.datapath,tileset);
|
|
|
|
|
tmpimage = SDL_LoadBMP (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
gfx.fire.frames = tmpimage->h / GFX_IMGSIZE;
|
|
|
|
|
tmpimage1 = scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x, gfx.fire.frames * gfx.block.y);
|
|
|
|
|
getRGBpixel (tmpimage1, 0, 0, &r, &g, &b);
|
|
|
|
|
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,SDL_MapRGB (tmpimage1->format, r, g, b));
|
|
|
|
|
gfx.fire.image = SDL_DisplayFormat (tmpimage1);
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
SDL_FreeSurface (tmpimage1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* load the bomb */
|
|
|
|
|
sprintf (filename, "%s/tileset/%s/bomb.bmp", bman.datapath, tileset);
|
|
|
|
|
tmpimage = SDL_LoadBMP (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
gfx.bomb.frames = tmpimage->h / GFX_IMGSIZE;
|
|
|
|
|
tmpimage1 = scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x, gfx.bomb.frames * gfx.block.y);
|
|
|
|
|
getRGBpixel (tmpimage1, 0, 0, &r, &g, &b);
|
|
|
|
|
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,SDL_MapRGB (tmpimage1->format, r, g, b));
|
|
|
|
|
gfx.bomb.image = SDL_DisplayFormat (tmpimage1);
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
SDL_FreeSurface (tmpimage1);
|
|
|
|
|
|
|
|
|
|
/* loading the field images */
|
|
|
|
|
for (i = 0; i < FT_max; i++) {
|
|
|
|
|
switch (i) {
|
|
|
|
|
case (FT_nothing):
|
|
|
|
|
sprintf (filename, "%s/tileset/%s/background.bmp", bman.datapath, tileset);
|
|
|
|
|
break;
|
|
|
|
|
case (FT_stone):
|
|
|
|
|
sprintf (filename, "%s/tileset/%s/stone.bmp", bman.datapath, tileset);
|
|
|
|
|
break;
|
|
|
|
|
case (FT_block):
|
|
|
|
|
sprintf (filename, "%s/tileset/%s/block.bmp", bman.datapath, tileset);
|
|
|
|
|
break;
|
|
|
|
|
case (FT_death):
|
|
|
|
|
sprintf (filename, "%s/tileset/%s/fielddeath.bmp", bman.datapath, tileset);
|
|
|
|
|
break;
|
|
|
|
|
case (FT_bomb):
|
|
|
|
|
sprintf (filename, "%s/tileset/%s/fieldbomb.bmp", bman.datapath, tileset);
|
|
|
|
|
break;
|
|
|
|
|
case (FT_fire):
|
|
|
|
|
sprintf (filename, "%s/tileset/%s/fieldfire.bmp", bman.datapath, tileset);
|
|
|
|
|
break;
|
|
|
|
|
case (FT_shoe):
|
|
|
|
|
sprintf (filename, "%s/tileset/%s/fieldshoe.bmp", bman.datapath, tileset);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tmpimage = SDL_LoadBMP (filename);
|
|
|
|
|
if (tmpimage == NULL) {
|
|
|
|
|
printf ("Can't load image: %s\n", SDL_GetError ());
|
|
|
|
|
exit (1);
|
|
|
|
|
}
|
|
|
|
|
gfx.field[i].frames = tmpimage->h / GFX_IMGSIZE;
|
|
|
|
|
tmpimage1 = scale_image (tmpimage, (tmpimage->w / GFX_IMGSIZE) * gfx.block.x, gfx.field[i].frames * gfx.block.y);
|
|
|
|
|
SDL_SetColorKey (tmpimage1, SDL_SRCCOLORKEY,SDL_MapRGB (tmpimage1->format, 255, 255, 255));
|
|
|
|
|
gfx.field[i].image = SDL_DisplayFormat (tmpimage1);
|
|
|
|
|
SDL_FreeSurface (tmpimage);
|
|
|
|
|
SDL_FreeSurface (tmpimage1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateRects_nr = 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void gfx_free_tileset () {
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < FT_max; i++) {
|
|
|
|
|
if (gfx.field[i].image != NULL)
|
|
|
|
|
SDL_FreeSurface (gfx.field[i].image);
|
|
|
|
|
gfx.field[i].image = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (gfx.bomb.image != NULL)
|
|
|
|
|
SDL_FreeSurface (gfx.bomb.image);
|
|
|
|
|
|
|
|
|
|
if (gfx.fire.image != NULL)
|
|
|
|
|
SDL_FreeSurface (gfx.fire.image);
|
|
|
|
|
|
|
|
|
|
gfx.bomb.image = NULL;
|
|
|
|
|
gfx.fire.image = NULL;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|