Compare commits

..

No commits in common. 'master' and 'origin' have entirely different histories.

47
.gitignore vendored

@ -1,47 +0,0 @@
src/.deps/
src/bomberclone
stamp-h1
config.status
*.o
config.log
config.h
Makefile
.cproject
.project
.settings/
*.cache/
Makefile.in
aclocal.m4
compile
config.guess
config.h.in
config.sub
configure
configure~
data/Makefile.in
data/gfx/Makefile.in
data/maps/Makefile.in
data/music/Makefile.in
data/pixmaps/Makefile.in
data/player/Makefile.in
data/tileset/Makefile.in
data/tileset/cemetery/Makefile.in
data/tileset/classic/Makefile.in
data/tileset/cucumber/Makefile.in
data/tileset/default/Makefile.in
data/tileset/farm/Makefile.in
data/tileset/hell/Makefile.in
data/tileset/jungle/Makefile.in
data/tileset/modern/Makefile.in
data/tileset/radioactive/Makefile.in
data/tileset/sheep/Makefile.in
data/tileset/supermario/Makefile.in
data/tileset/tricked/Makefile.in
ata/tileset/uccia_garbage/Makefile.in
data/tileset/zbb_frog/Makefile.in
depcomp
include/Makefile.in
install-sh
missing
src/Makefile.in

@ -1,9 +1,5 @@
$Id: ChangeLog,v 1.137 2015/07/10 21:59:37 steffen Exp $
08.05.2022: fixing possible out of buffer write errors
- fixed: sound.c had a possible out of buffer write error do to the
usage of sprintf reading two buffers each of the same as the destinations buffer.
10.07.2015: serval patches from Peter Spiess-Knafl applied
- changed: enter key on the numpad works now also in menus

@ -174,7 +174,7 @@ extern void playerinput_keyb_read (int pk_offset, int pl_nr);
extern void playernamemenu ();
extern void playermenu ();
extern int playermenu_selgfx (int pl_nr);
extern void playermenu_getflags (char *text, int txtlen, _player *player);
extern void playermenu_getflags (char *text, _player *player);
extern int teammenu_select (_player *pl);
extern void teammenu ();

@ -75,7 +75,8 @@ chat_drawbox ()
SDL_Rect src;
int i;
if (gfx_locksurface (gfx.screen)) return;
if (gfx_locksurface (gfx.screen))
return;
src = chat.window;
SDL_BlitSurface (chat.oldscreen, NULL, gfx.screen, &src);
@ -136,7 +137,8 @@ chat_drawlines ()
if (i < 0) i = 0;
for (nr = 0; i <= chat.curline; i++, nr++) font_gfxdraw (chat.window.x + 4, chat.window.y + 4 + font[0].size.y * nr, chat.lines[i].text, 0, chat.lines[i].color, 0x1000);
for (nr = 0; i <= chat.curline; i++, nr++)
font_gfxdraw (chat.window.x + 4, chat.window.y + 4 + font[0].size.y * nr, chat.lines[i].text, 0, chat.lines[i].color, 0x1000);
};
@ -167,8 +169,10 @@ chat_drawinput ()
src.w = chat.window.x + chat.window.w - 4;
src.h = chat.window.y + chat.window.h - 4;
if (chat.active) draw_shadefield (gfx.screen, &src, CHAT_BG_SHADE_BRIGHT);
else draw_shadefield (gfx.screen, &src, CHAT_BG_SHADE_DARK);
if (chat.active)
draw_shadefield (gfx.screen, &src, CHAT_BG_SHADE_BRIGHT);
else
draw_shadefield (gfx.screen, &src, CHAT_BG_SHADE_DARK);
gfx_blitupdaterectadd (&chat.window);
start = strlen (chat.input.text) - maxlen;
@ -216,11 +220,6 @@ chat_show (int x, int y, int w, int h)
/*
* loop through the chat and draw it
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-overflow"
#pragma GCC diagnostic ignored "-Wformat-truncation"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
void
chat_loop (SDL_Event * event)
{
@ -228,19 +227,21 @@ chat_loop (SDL_Event * event)
char text[255];
if (chat.active) { /* the chat mode is active */
if (event != NULL) i = keybinput_loop (&chat.input, event);
if (event != NULL)
i = keybinput_loop (&chat.input, event);
else {
i = 0;
chat.input.changed = 1;
}
if (i == 1 && chat.input.text[0] != 0) {
snprintf (text, 255, "%s: %s", bman.playername, chat.input.text);
sprintf (text, "%s: %s", bman.playername, chat.input.text);
net_send_chat (text, 1);
chat_addline (text, CHAT_TEXTCOLOR);
keybinput_new (&chat.input, KEYBI_text, 255);
i = 0;
if (!chat.keepactive) chat.active = 0;
if (!chat.keepactive)
chat.active = 0;
chat.changed = 1;
}
}
@ -250,11 +251,12 @@ chat_loop (SDL_Event * event)
/*
* check if we have to redraw the input line
*/
if (chat.changed) chat_draw ();
if (chat.changed)
chat_draw ();
if (chat.input.changed) chat_drawinput ();
if (chat.input.changed)
chat_drawinput ();
};
#pragma GCC diagnostic pop
/*

@ -14,10 +14,6 @@
#include "keyb.h"
#include "player.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-overflow"
#pragma GCC diagnostic ignored "-Wformat-truncation"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
/*
* try to find the datapath and set the variable bman.datapath
@ -883,5 +879,3 @@ check_version (int ma, int mi, int su, char *ver)
return res;
};
#pragma GCC diagnostic pop

@ -33,37 +33,35 @@ void d_printf (char *fmt,...) {
va_end (args);
};
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-overflow"
#pragma GCC diagnostic ignored "-Wformat-truncation"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#define TEXTLEN 255
void d_playerstat (char *head) {
int i, j;
char text1[TEXTLEN];
char text2[TEXTLEN];
char text[255];
d_printf ("---------------> %s nb play: %d\n", head, bman.playnum);
sprintf (text1, "id Name killed Unknown");
sprintf (text, "id Name killed Unknown");
for (i = 0; i < MAX_PLAYERS; i++)
if (players[i].gamestats.isaplayer == 1)
snprintf(text2, TEXTLEN, "%s %02d", text1, i);
strncat(text2, "\n", TEXTLEN);
d_printf (text2);
sprintf(text, "%s %02d", text, i);
sprintf(text, "%s\n", text);
d_printf (text);
for (i = 0; i < MAX_PLAYERS; i++){
if (players[i].gamestats.isaplayer == 1 ) {
sprintf(text1, "%02d %-16s %2d %d ", i, players[i].name, players[i].gamestats.killed, players[i].gamestats.unknown);
sprintf(text, "%02d %-16s %2d %d ", i, players[i].name, players[i].gamestats.killed, players[i].gamestats.unknown);
for (j = 0; j < MAX_PLAYERS; j++)
if (players[j].gamestats.isaplayer == 1 )
sprintf(text2, "%s %2d", text1, players[i].gamestats.killedBy[j]);
strncat(text2, "\n", TEXTLEN);
d_printf (text2);
sprintf(text, "%s %2d", text, players[i].gamestats.killedBy[j]);
sprintf(text, "%s\n", text);
d_printf (text);
}
}
};
#pragma GCC diagnostic pop
// int killed[MAX_PLAYERS];
void d_playerdetail (char *head) {

@ -180,7 +180,8 @@ draw_stone (int x, int y)
}
// draw explosions if there is any
for (d = 0; d < 4; d++) if (stone->ex[d].count > 0) {
for (d = 0; d < 4; d++)
if (stone->ex[d].count > 0) {
stone_drawfire (x, y, -1);
break;
}
@ -503,10 +504,13 @@ field_hurrysize ()
/* check if a bomb is at this position, if so let the bomb explode
and wait untill the explosion is over */
for (i = 0, d = 0; d < 4; d++) if (map.field[fieldhurrypos.x][fieldhurrypos.y].ex[d].count > 0) i++;
for (i = 0, d = 0; d < 4; d++)
if (map.field[fieldhurrypos.x][fieldhurrypos.y].ex[d].count > 0)
i++;
get_bomb_on (fieldhurrypos.x, fieldhurrypos.y, bombs);
if (i) fieldhurrypos = old;
if (i)
fieldhurrypos = old;
else if (bombs[0].y != -1 && bombs[0].x != -1) {
fieldhurrypos = old;
bomb_explode (&players[bombs[0].x].bombs[bombs[0].y], 1);

@ -65,15 +65,15 @@ font_gfxdraw (int x, int y, char *text, int size, int color, int ypos)
};
#define FNSIZE (16+LEN_PATHFILENAME)
void font_load () {
int c,i,r,g,b;
char filename[FNSIZE];
char filename[LEN_PATHFILENAME];
SDL_Surface *raw, *tmp;
/* load the font */
for (i = 0; i < 3; i++) {
snprintf (filename, FNSIZE, "%s/gfx/font%d.png", bman.datapath, i);
sprintf (filename, "%s/gfx/font%d.png", bman.datapath, i);
tmp = IMG_Load (filename);
if (tmp == NULL) {
printf ("Could not load font.\n");

@ -224,8 +224,10 @@ game_loop ()
int done = 0,
eventstate;
if (GT_MP) net_game_fillsockaddr ();
if ( SDL_InitSubSystem ( SDL_INIT_JOYSTICK ) < 0 ) {
if (GT_MP)
net_game_fillsockaddr ();
if ( SDL_InitSubSystem ( SDL_INIT_JOYSTICK ) < 0 )
{
fprintf ( stderr, "Unable to initialize Joystick: %s\n", SDL_GetError() );
}
printf ( "%i joysticks found\n", SDL_NumJoysticks () );

@ -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) {

@ -310,7 +310,7 @@ makegray_image (SDL_Surface * org)
fprintf (stderr, "Can't lock screen: %s\n", SDL_GetError ());
return NULL;
}
if (SDL_MUSTLOCK (org)) {
if (SDL_MUSTLOCK (org))
if (SDL_LockSurface (org) < 0) {
fprintf (stderr, "Can't lock screen: %s\n", SDL_GetError ());
if (SDL_MUSTLOCK (dest)) {
@ -318,7 +318,7 @@ makegray_image (SDL_Surface * org)
}
return NULL;
}
}
switch (bpp) {
case (2):
for (x = 0; x < org->w; x++)

@ -179,7 +179,8 @@ void keyb_config_createkeymenu (_menu *menu, int key, int x, int y, int menu_nr)
*/
void keyb_config_joypad (int key) {
unsigned int n = 0;
int done = 0, reorder = 0, i, j;
SDL_Event event;
int done = 0, eventstate = 0, reorder = 0, i, j;
if (joy[0] == NULL || key < 0 || key >= BCK_max) return;
@ -201,7 +202,8 @@ void keyb_config_joypad (int key) {
SDL_JoystickEventState ( SDL_QUERY ); // js
SDL_JoystickUpdate ();
for ( j = 0; j < 2; j++) for ( i=0; i < SDL_JoystickNumButtons ( joy[j] ); ++i ) {
for ( j = 0; j < 2; j++)
for ( i=0; i < SDL_JoystickNumButtons ( joy[j] ); ++i ) {
n = SDL_JoystickGetButton ( joy[j], i );
// 2 .. bomb
/* Sadly every other controller enumberates different */
@ -211,10 +213,19 @@ void keyb_config_joypad (int key) {
joy_keys[j].drop = i;
if (key == BCPK_special || key == BCPK_special + BCPK_max + BCPK_max)
joy_keys[j].special = i;
eventstate = 1;
done = 1;
}
}
if (eventstate >= 1) {
switch (event.type) {
case (SDL_QUIT):
bman.state = GS_quit;
done = 1;
break;
}
}
s_calctimesync ();
}

@ -214,7 +214,8 @@ map_genmorerandom ()
if (map.size.x > MAX_FIELDSIZE_X)
map.size.x = MAX_FIELDSIZE_X;
for (x = 0; x < map.size.x; x++) for (y = 0; y < map.size.y; y++) {
for (x = 0; x < map.size.x; x++)
for (y = 0; y < map.size.y; y++) {
if ((y == 0) || (y == map.size.y - 1))
map.field[x][y].type = FT_block;
else if ((x == 0) || (x == map.size.x - 1))
@ -267,10 +268,6 @@ map_set_playerposition (int usermap)
}
/* load a random map */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-overflow"
#pragma GCC diagnostic ignored "-Wformat-truncation"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
void
map_random ()
{
@ -281,7 +278,7 @@ map_random ()
int max,
sel;
snprintf (path, LEN_PATHFILENAME, "%s/maps", bman.datapath);
sprintf (path, "%s/maps", bman.datapath);
desel = destart = s_getdir (path);
for (max = 0, de = destart; de != NULL; de = de->next)
@ -298,9 +295,8 @@ map_random ()
d_printf ("Random Map %s (%d on %d)\n", desel->name, sel, max);
if (desel != NULL)
snprintf (map.map, LEN_PATHFILENAME, "%s/maps/%s", bman.datapath, desel->name);
sprintf (map.map, "%s/maps/%s", bman.datapath, desel->name);
}
#pragma GCC diagnostic pop
// Init the game according to options

@ -4,11 +4,6 @@
#include "bomberclone.h"
#include "menu.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-overflow"
#pragma GCC diagnostic ignored "-Wformat-truncation"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
/* launch the map options menu */
void
mapmenu ()
@ -117,18 +112,18 @@ mapmenu ()
menuselect = -1;
break;
case (2): // Select Map
snprintf (pathname, LEN_PATHFILENAME, "%s/maps", bman.datapath);
sprintf (pathname, "%s/maps", bman.datapath);
mapname = menu_dir_select ("Select Map", pathname, DF_file);
if (mapname == NULL) {
map.map[0] = 0;
map.map_selection = 2;
}
else
snprintf (map.map, LEN_PATHFILENAME, "%s/maps/%s", bman.datapath, mapname);
sprintf (map.map, "%s/maps/%s", bman.datapath, mapname);
break;
case (5): // Selected Tileset
snprintf (pathname, LEN_PATHFILENAME, "%s/tileset", bman.datapath);
sprintf (pathname, "%s/tileset", bman.datapath);
mapname = menu_dir_select ("Select Tileset", pathname, DF_dir);
if (mapname == NULL) {
map.tileset[0] = 0;
@ -154,11 +149,15 @@ mapmenu ()
map.map_selection = selmt - &maptypes[0];
}
map.size.x = map.size.x | 1;
if (map.size.x < MIN_FIELDSIZE_X) map.size.x = MIN_FIELDSIZE_X;
if (map.size.x > MAX_FIELDSIZE_X) map.size.x = MAX_FIELDSIZE_X;
if (map.size.x < MIN_FIELDSIZE_X)
map.size.x = MIN_FIELDSIZE_X;
if (map.size.x > MAX_FIELDSIZE_X)
map.size.x = MAX_FIELDSIZE_X;
map.size.y = map.size.y | 1;
if (map.size.y < MIN_FIELDSIZE_Y) map.size.y = MIN_FIELDSIZE_Y;
if (map.size.y > MAX_FIELDSIZE_Y) map.size.y = MAX_FIELDSIZE_Y;
if (map.size.y < MIN_FIELDSIZE_Y)
map.size.y = MIN_FIELDSIZE_Y;
if (map.size.y > MAX_FIELDSIZE_Y)
map.size.y = MAX_FIELDSIZE_Y;
config_write ();
if (GT_MP_PTPM) net_send_servermode ();
@ -170,7 +169,6 @@ mapmenu ()
*/
#define WIN_X 500
#define WIN_Y 350
#define TEXTLEN 255
void
mapinfo ()
{
@ -179,7 +177,7 @@ mapinfo ()
int y,
eventstate,
done = 0;
char text[TEXTLEN];
char text[255];
// draw_menubox (WIN_X, WIN_Y);
@ -205,7 +203,7 @@ mapinfo ()
if (map.random_tileset)
sprintf (text, "Random Tileset");
else
snprintf (text, TEXTLEN, "Tileset: %s", map.tileset);
sprintf (text, "Tileset: %s", map.tileset);
// font_setcolor (128,128,128,0);
// font_draw (2 + x - (WIN_X / 2), y, text, 0);
// font_setcolor (255,255,255,0);
@ -213,7 +211,7 @@ mapinfo ()
/* Mapselection */
if (map.map_selection == 0)
snprintf (text, TEXTLEN, "Selected Map: %s", map.map);
sprintf (text, "Selected Map: %s", map.map);
else if (map.map_selection == 1)
sprintf (text, "Random Map");
else
@ -225,14 +223,14 @@ mapinfo ()
y = y + 2 + (font[0].size.y << 1);
/* Bomb Powerups */
snprintf (text, TEXTLEN, "Bomb Powerup: %d", map.bombs);
sprintf (text, "Bomb Powerup: %d", map.bombs);
// font_setcolor (128,128,128,0);
// font_draw (2 + x - (WIN_X / 2), y, text, 0);
// font_setcolor (255,255,255,0);
// font_draw (3 + x - (WIN_X / 2) ,1 + y, text, 0);
/* Trigger */
snprintf (text, TEXTLEN, "Trigger Specials: %d", map.sp_trigger);
sprintf (text, "Trigger Specials: %d", map.sp_trigger);
// font_setcolor (128,128,128,0);
// font_draw (x , y, text, 0);
// font_setcolor (255,255,255,0);
@ -240,14 +238,14 @@ mapinfo ()
y = y + 2 + font[0].size.y;
/* Fire Powerups */
snprintf (text, TEXTLEN, "Fire Powerup: %d", map.fire);
sprintf (text, "Fire Powerup: %d", map.fire);
// font_setcolor (128,128,128,0);
// font_draw (2 + x - (WIN_X / 2), y, text, 0);
// font_setcolor (255,255,255,0);
// font_draw (3 + x - (WIN_X / 2) ,1 + y, text, 0);
/* Push */
snprintf (text, TEXTLEN, "Push Specials: %d", map.sp_push);
sprintf (text, "Push Specials: %d", map.sp_push);
// font_setcolor (128,128,128,0);
// font_draw (x , y, text, 0);
// font_setcolor (255,255,255,0);
@ -255,14 +253,14 @@ mapinfo ()
y = y + 2 + font[0].size.y;
/* Shoe Powerups */
snprintf (text, TEXTLEN, "Shoe Powerup: %d", map.shoes);
sprintf (text, "Shoe Powerup: %d", map.shoes);
// font_setcolor (128,128,128,0);
// font_draw (2 + x - (WIN_X / 2), y, text, 0);
// font_setcolor (255,255,255,0);
// font_draw (3 + x - (WIN_X / 2) ,1 + y, text, 0);
/* Row */
snprintf (text, TEXTLEN, "Row Specials: %d", map.sp_row);
sprintf (text, "Row Specials: %d", map.sp_row);
// font_setcolor (128,128,128,0);
// font_draw (x , y, text, 0);
// font_setcolor (255,255,255,0);
@ -271,7 +269,7 @@ mapinfo ()
/* Mixed Powerups */
snprintf (text, TEXTLEN, "Mixed Powerup: %d", map.mixed);
sprintf (text, "Mixed Powerup: %d", map.mixed);
// font_setcolor (128,128,128,0);
// font_draw (2 + x - (WIN_X / 2), y, text, 0);
// font_setcolor (255,255,255,0);
@ -286,7 +284,7 @@ mapinfo ()
y = y + 2 + font[0].size.y;
/* Death Powerups */
snprintf (text, TEXTLEN, "Death Powerup: %d", map.death);
sprintf (text, "Death Powerup: %d", map.death);
// font_setcolor (128,128,128,0);
// font_draw (2 + x - (WIN_X / 2), y, text, 0);
// font_setcolor (255,255,255,0);
@ -325,8 +323,6 @@ mapinfo ()
#undef WIN_X
#undef WIN_Y
#pragma GCC diagnostic pop
/* change start settings for the game */

@ -219,7 +219,8 @@ menu_draw_menuitem (_menuitem * m)
{
_menu *menu;
if (m == NULL) return;
if (m == NULL)
return;
menu = (_menu *) m->menu;

@ -164,11 +164,13 @@ void host_multiplayer_game () {
bman.p_nr = bman.p_servnr = 0;
team_choose (&players[0]);
players[0].state = PSF_used;
if (bman.notifygamemaster) send_ogc_update (); /* send the information that we started an server */
if (bman.notifygamemaster)
send_ogc_update (); /* send the information that we started an server */
multiplayer_game ();
if (bman.notifygamemaster) send_ogc_update (); /* send the information that we started an server */
if (bman.notifygamemaster)
send_ogc_update (); /* send the information that we started an server */
network_shutdown ();
};

@ -10,13 +10,8 @@
#include "ogcache-client.h"
#include "broadcast.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-overflow"
#pragma GCC diagnostic ignored "-Wformat-truncation"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
#define SRVLST_TIMEREBUILD 2000
#define SRVLST_LENCOMMENT 32
_charlist srvlst_text[MAX_SRVLIST];
struct __srvlst_entry {
char host[LEN_SERVERNAME];
@ -33,12 +28,11 @@ int srvlst_cnt = 0;
/* will build up our srvlst list with
* all servers we have in there */
#define TEXTLEN 255
void srvlist_rebuildlist () {
int ogclst, i, j;
char txt1[TEXTLEN];
char txt2[TEXTLEN];
char txt3[TEXTLEN];
char txt1[255];
char txt2[255];
char txt3[255];
/* delete the whole list */
for (i = 0; i < MAX_SRVLIST; i++) {
@ -66,9 +60,9 @@ void srvlist_rebuildlist () {
srvlst_dat[srvlst_cnt].maxplayers = broadcast_list[i].maxplayers;
srvlst_dat[srvlst_cnt].ai_family = bman.net_ai_family;
if (broadcast_list[i].lan)
snprintf (srvlst_dat[srvlst_cnt].comment, SRVLST_LENCOMMENT, "LAN");
sprintf (srvlst_dat[srvlst_cnt].comment, "LAN");
else
snprintf (srvlst_dat[srvlst_cnt].comment, SRVLST_LENCOMMENT, "Inet");
sprintf (srvlst_dat[srvlst_cnt].comment, "Inet");
srvlst_cnt++;
}
}
@ -90,7 +84,7 @@ void srvlist_rebuildlist () {
strncpy (srvlst_dat[srvlst_cnt].port,ogc_array[ogclst].port, LEN_PORT);
strncpy (srvlst_dat[srvlst_cnt].gamename,ogc_array[ogclst].gamename, LEN_GAMENAME);
strncpy (srvlst_dat[srvlst_cnt].version,ogc_array[ogclst].version, LEN_VERSION);
snprintf (srvlst_dat[srvlst_cnt].comment, SRVLST_LENCOMMENT, "INet");
sprintf (srvlst_dat[srvlst_cnt].comment, "INet");
srvlst_cnt++;
}
@ -105,15 +99,15 @@ void srvlist_rebuildlist () {
if (srvlst_dat[i].ping == -2)
txt2[0] = 0;
else if (srvlst_dat[i].ping == -1)
snprintf (txt2, TEXTLEN, "NoCon");
sprintf (txt2, "NoCon");
else
snprintf (txt2, TEXTLEN, "%dms", srvlst_dat[i].ping);
sprintf (txt2, "%dms", srvlst_dat[i].ping);
if (srvlst_dat[i].gamename[0] != 0) /* gamename is present */
snprintf (txt1, TEXTLEN, "%-15s %-5s %5s %-11s %-4s", srvlst_dat[i].gamename, txt3, txt2, srvlst_dat[i].version, srvlst_dat[i].comment);
sprintf (txt1, "%-15s %-5s %5s %-11s %-4s", srvlst_dat[i].gamename, txt3, txt2, srvlst_dat[i].version, srvlst_dat[i].comment);
else {
snprintf (txt3, TEXTLEN, "%s:%s", srvlst_dat[i].host, srvlst_dat[i].port);
snprintf (txt1, TEXTLEN, "%-20s %5s %-11s %-4s", txt3,txt2, srvlst_dat[i].version, srvlst_dat[i].comment);
sprintf (txt1, "%s:%s", srvlst_dat[i].host, srvlst_dat[i].port);
sprintf (txt1, "%-20s %5s %-11s %-4s", txt1,txt2, srvlst_dat[i].version, srvlst_dat[i].comment);
}
strncpy (srvlst_text[i].text, txt1, LEN_CHARENTRY);
}
@ -216,6 +210,3 @@ void net_getserver () {
ogc_browsestop ();
menu_delete (menu);
};
#pragma GCC diagnostic pop

@ -7,11 +7,6 @@
#include "udp.h"
#include "ogcache-client.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-overflow"
#pragma GCC diagnostic ignored "-Wformat-truncation"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
int ogc_sock = -1;
struct game_entry ogc_array[MAX_OGC_ENTRYS];
char ogc_host[LEN_OGCHOST+1];
@ -200,20 +195,17 @@ int ogc_init (char *localport, char *server, char *port, char *game, int ai_fami
/* send the status of the curent game to the game cache */
int ogc_sendgamestatus (int sock, char *game, char *version, char *gamename,
int curplayers, int maxplayers, char *status) {
char data1[BUF_SIZE];
char data2[BUF_SIZE];
char data[BUF_SIZE];
if (sock <= 0 || ogc_sock <= 0) return 0;
snprintf (data1, BUF_SIZE, "GAME:%s\t%s\t%s", game, version, gamename);
if (ogc_ai_family == PF_INET) {
snprintf (data2, BUF_SIZE, "%s\tIPv4", data1);
}
else {
snprintf (data2, BUF_SIZE, "%s\tIPv6", data1);
}
snprintf (data1, BUF_SIZE, "%s\t%d\t%d\t%s", data2, curplayers, maxplayers, status);
sprintf (data, "GAME:%s\t%s\t%s", game, version, gamename);
if (ogc_ai_family == PF_INET)
sprintf (data, "%s\tIPv4", data);
else
sprintf (data, "%s\tIPv6", data);
sprintf (data, "%s\t%d\t%d\t%s", data, curplayers, maxplayers, status);
udp_send (sock, data2, strlen (data2), &ogc_addr, ogc_ai_family);
udp_send (sock, data, strlen (data), &ogc_addr, ogc_ai_family);
return 1;
};
@ -304,5 +296,3 @@ void ogc_browsestop () {
udp_send (ogc_sock, data, strlen (data), &ogc_addr, ogc_ai_family);
};
#pragma GCC diagnostic pop

@ -9,6 +9,9 @@
#include "sound.h"
#include "menu.h"
extern _point debug_field;
extern int debug_lastping;
static short int pkg_lastid; /* the packet id, this will only counted
* up nothing more.. if we are at 0x10000
* we will start at 0 */
@ -1006,9 +1009,8 @@ void do_bombdata (struct pkg_bombdata *b_dat, _net_addr * addr) {
return;
}
if (b_dat->state == BS_off) {
if (b_dat->state == BS_off)
return; // if there was a bomb let it explose don't delete the bomb
}
d_printf ("do_bombdata [%f,%f] Player: %d PlayerIgnition: %d Bomb: %d, ex_nr:%d\n",
I16TOF (NTOH16 (b_dat->x)), I16TOF (NTOH16 (b_dat->y)), b_dat->p_nr, b_dat->pi_nr, b_dat->b_nr, NTOH32 (b_dat->ex_nr));
@ -1166,13 +1168,11 @@ do_quit (struct pkg_quit *q_dat, _net_addr * addr)
d_printf ("do_quit (%s:%s) pl_nr=%d new_server=%d\n", addr->host, addr->port, q_dat->pl_nr,
q_dat->new_server);
if (addr->pl_nr == -1) {
if (addr->pl_nr == -1)
return;
}
if (q_dat->pl_nr == -1) {
if (q_dat->pl_nr == -1)
q_dat->pl_nr = addr->pl_nr;
}
bman.updatestatusbar = 1;
player_delete (q_dat->pl_nr);
@ -1573,10 +1573,6 @@ send_special (_net_addr * addr, int p_nr, int typ, int ex_nr)
/***
*** Packettype: mapinfo
***/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-overflow"
#pragma GCC diagnostic ignored "-Wformat-truncation"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
void
send_mapinfo (_net_addr * addr)
{
@ -1619,7 +1615,6 @@ send_mapinfo (_net_addr * addr)
printf ("Addr after send: %p\n", addr);
#endif
};
#pragma GCC diagnostic pop
void

@ -74,11 +74,6 @@ int rscache_del (_net_addr *addr, unsigned char typ, short unsigned int id) {
/* test for old packets where we haven't got a ackreq packet for.
* If the timeout is up resend the packet again until RESENDCACHE_RETRY
* has reached then delete the packet. */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
void rscache_loop () {
int i;
int timeout;
@ -116,4 +111,3 @@ void rscache_loop () {
}
}
};
#pragma GCC diagnostic pop

@ -271,7 +271,8 @@ check_field (short int x, short int y)
int check_exfield (short int x, short int y) {
int res = 1, i;
if (map.field[x][y].type == FT_stone || map.field[x][y].type == FT_block) res = 0;
if (map.field[x][y].type == FT_stone || map.field[x][y].type == FT_block)
res = 0;
for (i = 0; (i < 4 && res == 1); i++)
if (map.field[x][y].ex[i].count > 0)
@ -834,7 +835,8 @@ player_set_ilness (_player * p, int t, float new_to)
void
player_clear_ilness (_player * p, int type)
{
if (type < 0 || type >= PI_max) return;
if (type < 0 || type >= PI_max)
return;
d_printf ("player_clear_ilness Player: %s Type: %d\n", p->name, type);
@ -1024,10 +1026,13 @@ player_delete (int pl_nr) {
net_game_send_delplayer (pl_nr);
}
if (GT_MP_PTPM && bman.notifygamemaster) send_ogc_update ();
if (GT_MP_PTPM && bman.notifygamemaster)
send_ogc_update ();
if (bman.p_nr == pl_nr) bman.p_nr = -1;
if (bman.p2_nr == pl_nr) bman.p2_nr = -1;
if (bman.p_nr == pl_nr)
bman.p_nr = -1;
if (bman.p2_nr == pl_nr)
bman.p2_nr = -1;
d_playerdetail (" Player Left ... Playerlist\n");
};

@ -287,7 +287,7 @@ void playermenu () {
sprintf (detail_Addr->label, "%-32s:%s",players[pl_nr].net.addr.host, players[pl_nr].net.addr.port);
sprintf (detail_Flags->label, "FIX ME");
playermenu_getflags (detail_Flags->label, MENU_TITLELEN, &players[pl_nr]);
playermenu_getflags (detail_Flags->label, &players[pl_nr]);
sel_pl_nr = pl_nr;
}
@ -368,14 +368,16 @@ void playermenu () {
* put all flags into the givin text like:
* NET_FW, NET_2P, AI...
*/
#define TXTLEN 512
void playermenu_getflags (char *text, int txtlen, _player *player) {
void playermenu_getflags (char *text, _player *player) {
text[0] = 0;
if (player->net.flags & NETF_firewall) strncat (text, "NET_FW ", txtlen);
if (player->net.flags & NETF_local2) strncat (text, "NET_2P ", txtlen);
if (player->state & PSF_net) strncat (text, "%sPSF_NET ", txtlen);
if (player->state & PSF_ai) strncat (text, "%sPSF_AI ", txtlen);
if (player->net.flags & NETF_firewall)
sprintf (text, "%sNET_FW ", text);
if (player->net.flags & NETF_local2)
sprintf (text, "%sNET_2P ", text);
if (player->state & PSF_net)
sprintf (text, "%sPSF_NET ", text);
if (player->state & PSF_ai)
sprintf (text, "%sPSF_AI ", text);
};

@ -570,9 +570,9 @@ single_playergame (int second_player, int ai_players)
}
done = 0;
for (bman.p_nr = -1, p = 0; (bman.p_nr == -1 && p < MAX_PLAYERS); p++) {
if (!(PS_IS_used (players[p].state))) bman.p_nr = p;
}
for (bman.p_nr = -1, p = 0; (bman.p_nr == -1 && p < MAX_PLAYERS); p++)
if (!(PS_IS_used (players[p].state)))
bman.p_nr = p;
players[bman.p_nr].team_nr = 0;
if (bman.p_nr >= MAX_PLAYERS) {

@ -116,8 +116,7 @@ void
snd_load (char *tilesetname)
{
#if HAVE_SDL_MIXER
#define FULLNAMELEN (LEN_PATHFILENAME+2*LEN_FILENAME)
char fullname[FULLNAMELEN];
char fullname[LEN_PATHFILENAME];
char filename[LEN_FILENAME];
_direntry *destart, *de, *desel;
int i, max, sel;
@ -139,9 +138,9 @@ snd_load (char *tilesetname)
}
/* try loading the sample from the tileset or the default */
snprintf (fullname, FULLNAMELEN, "%s/tileset/%s/%s", bman.datapath, tilesetname, filename);
sprintf (fullname, "%s/tileset/%s/%s", bman.datapath, tilesetname, filename);
if ((snd.sample[i] = Mix_LoadWAV (fullname)) == NULL) {
snprintf (fullname, FULLNAMELEN, "%s/tileset/default/%s", bman.datapath, filename);
sprintf (fullname, "%s/tileset/default/%s", bman.datapath, filename);
if ((snd.sample[i] = Mix_LoadWAV (fullname)) == NULL)
d_printf ("Couldn't load %s: %s\n", fullname, SDL_GetError ());
}
@ -149,7 +148,7 @@ snd_load (char *tilesetname)
/* random selection of an sound file */
snprintf (fullname, FULLNAMELEN, "%s/music", bman.datapath);
sprintf (fullname, "%s/music", bman.datapath);
desel = destart = s_getdir (fullname);
for (max = 0, de = destart; de != NULL; de = de->next)
@ -165,7 +164,7 @@ snd_load (char *tilesetname)
/* try loading the music from the tileset or the default */
if (desel != NULL) {
snprintf (fullname, FULLNAMELEN, "%s/music/%s", bman.datapath, desel->name);
sprintf (fullname, "%s/music/%s", bman.datapath, desel->name);
if ((snd.music = Mix_LoadMUS (fullname)) == NULL)
d_printf ("Couldn't load %s: %s\n", fullname, SDL_GetError ());
}

@ -23,10 +23,6 @@ const char *ft_filenames[] = {
"spkick"
};
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-overflow"
#pragma GCC diagnostic ignored "-Wformat-truncation"
#pragma GCC diagnostic ignored "-Wstringop-overflow"
/* load a random tileset */
void
@ -39,7 +35,7 @@ tileset_random ()
int max,
sel;
snprintf (path, LEN_PATHFILENAME, "%s/tileset", bman.datapath);
sprintf (path, "%s/tileset", bman.datapath);
desel = destart = s_getdir (path);
for (max = 0, de = destart; de != NULL; de = de->next)
@ -110,11 +106,11 @@ tileset_load (char *tilesetname, int dx, int dy)
gfx.offset.y = gfx.res.y - (gfx.block.y * map.size.y);
/* load the fire */
snprintf (fullname, LEN_PATHFILENAME, "%s/tileset/%s/fire.png", bman.datapath, tileset);
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 */
snprintf (fullname, LEN_PATHFILENAME, "%s/tileset/default/fire.png", bman.datapath);
sprintf (fullname, "%s/tileset/default/fire.png", bman.datapath);
tmpimage = IMG_Load (fullname);
if (tmpimage == NULL) {
printf ("default tileset could not be loaded. [%s]\n", fullname);
@ -132,7 +128,7 @@ tileset_load (char *tilesetname, int dx, int dy)
SDL_FreeSurface (tmpimage1);
/* load the bomb */
snprintf (fullname, LEN_PATHFILENAME, "%s/tileset/%s/bomb.png", bman.datapath, tileset);
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 */
@ -167,11 +163,11 @@ tileset_load (char *tilesetname, int dx, int dy)
break;
}
snprintf (fullname, LEN_PATHFILENAME, "%s/tileset/%s/%s", bman.datapath, tileset, filename);
sprintf (fullname, "%s/tileset/%s/%s", bman.datapath, tileset, filename);
tmpimage = IMG_Load (fullname);
if (tmpimage == NULL) {
/* file could not be load, so load teh default tileset */
snprintf (fullname, LEN_PATHFILENAME, "%s/tileset/default/%s", bman.datapath, filename);
sprintf (fullname, "%s/tileset/default/%s", bman.datapath, filename);
tmpimage = IMG_Load (fullname);
if (tmpimage == NULL) {
printf ("default tileset could not be loaded. [%s]\n", fullname);
@ -190,16 +186,16 @@ tileset_load (char *tilesetname, int dx, int dy)
/* loading the field images */
for (i = 0; i < FT_max; i++) {
if (i != FT_mixed) {
snprintf (fullname, LEN_PATHFILENAME,"%s/tileset/%s/%s.png", bman.datapath, tileset, ft_filenames[i]);
sprintf (fullname, "%s/tileset/%s/%s.png", bman.datapath, tileset, ft_filenames[i]);
gfx.field[i].w = GFX_IMGSIZE;
gfx.field[i].h = GFX_IMGSIZE;
tmpimage = IMG_Load (fullname);
if (tmpimage == NULL) {
snprintf (fullname, LEN_PATHFILENAME, "%s/tileset/%s/%s96.png", bman.datapath, tileset, ft_filenames[i]);
sprintf (fullname, "%s/tileset/%s/%s96.png", bman.datapath, tileset, ft_filenames[i]);
gfx.field[i].h = GFX_IMGBIGSIZE;
tmpimage = IMG_Load (fullname);
if (tmpimage == NULL) {
snprintf (fullname, LEN_PATHFILENAME, "%s/tileset/default/%s.png", bman.datapath, ft_filenames[i]);
sprintf (fullname, "%s/tileset/default/%s.png", bman.datapath, ft_filenames[i]);
gfx.field[i].h = GFX_IMGSIZE;
tmpimage = IMG_Load (fullname);
if (tmpimage == NULL) {

Loading…
Cancel
Save