From 56eb2c9812f9d9b7ca88ff9438c0ffa52c74f258 Mon Sep 17 00:00:00 2001 From: stpohle Date: Fri, 29 Aug 2003 23:50:39 +0000 Subject: [PATCH] load free data bug found.. sound didn't wanted to stop --- ChangeLog | 6 +++++- TODO | 4 +--- src/bomberclone.h | 3 ++- src/configuration.c | 5 +++++ src/game.c | 6 +++--- src/mapmenu.c | 11 +++++++++-- src/netmenu.c | 11 ++++++++--- src/packets.c | 1 + src/tileset.c | 4 +++- 9 files changed, 37 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9eb8c60..3b952d6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -$Id: ChangeLog,v 1.38 2003/08/24 20:18:06 stpohle Exp $ +$Id: ChangeLog,v 1.39 2003/08/29 23:50:39 stpohle Exp $ + +- added liquid and moving bombs special. + +- timer options, for how long the game will go. - added tunnels to the game so player can go through. PKG_playermove changed and PGK_tunneldata added diff --git a/TODO b/TODO index 09226d5..e2a6cf4 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,4 @@ -$Id: TODO,v 1.21 2003/08/27 21:14:48 stpohle Exp $ - -- timer options, for how long the game will go. +$Id: TODO,v 1.22 2003/08/29 23:50:39 stpohle Exp $ - more specials (Kicking Bomb, Pushing Bomb Ver.2) diff --git a/src/bomberclone.h b/src/bomberclone.h index 0936e02..1f63ece 100644 --- a/src/bomberclone.h +++ b/src/bomberclone.h @@ -1,4 +1,4 @@ -/* $Id: bomberclone.h,v 1.53 2003/08/29 22:04:19 stpohle Exp $ */ +/* $Id: bomberclone.h,v 1.54 2003/08/29 23:50:39 stpohle Exp $ */ /* bomberclone.h */ #ifndef _BOMBERCLONE_H_ @@ -135,6 +135,7 @@ struct __bomberclone { unsigned char gametype; unsigned char multitype; unsigned char state; + int init_timeout; // gametimeout init value int timeout; // game timeout char playername[LEN_PLAYERNAME]; int players_nr_s; // number of players at the beginning diff --git a/src/configuration.c b/src/configuration.c index 5a1a391..0f31692 100644 --- a/src/configuration.c +++ b/src/configuration.c @@ -59,6 +59,7 @@ game_init (int argc, char **argv) map.type = -1; bman.firewall = 0; bman.broadcasted_chat = 1; + bman.init_timeout = GAME_TIMEOUT; bman.ai_players = 1; snd.inited = 0; snd.audio_rate = 22050; @@ -235,6 +236,9 @@ ReadConfig () } if (!strcmp (keyword, "randomtileset")) { map.random_tileset = atoi (value); + } + if (!strcmp (keyword, "gametimeout")) { + bman.init_timeout = atoi (value); } if(!strcmp (keyword, "sndrate")) { snd.audio_rate = atoi (value); @@ -290,6 +294,7 @@ WriteConfig () fprintf (config, "ai_family=%d\n", bman.net_ai_family); fprintf (config, "masterserver=%s\n", bman.gamemaster); fprintf (config, "gamename=%s\n", bman.gamename); + fprintf (config, "gametimeout=%d\n", bman.init_timeout); fprintf (config, "maxplayer=%d\n", bman.maxplayer); for (i = 0; i < MAX_SERVERENTRYS; i++) fprintf (config, "ip%d=%s\n", i, bman.serverlist[i].name); diff --git a/src/game.c b/src/game.c index f488c26..94f054c 100644 --- a/src/game.c +++ b/src/game.c @@ -1,4 +1,4 @@ -/* $Id: game.c,v 1.52 2003/08/27 21:14:50 stpohle Exp $ +/* $Id: game.c,v 1.53 2003/08/29 23:50:39 stpohle Exp $ game.c - procedures for the game. */ #include @@ -254,9 +254,9 @@ game_end () { int i; - snd_music_stop (); gfx_free_players (); tileset_free (); + snd_music_stop (); snd_free (); /* count the points */ @@ -337,7 +337,7 @@ game_start () snd_load (map.tileset); snd_music_start (); map.state = MS_normal; - bman.timeout = GAME_TIMEOUT; + bman.timeout = bman.init_timeout; }; diff --git a/src/mapmenu.c b/src/mapmenu.c index b87448d..e4735fb 100644 --- a/src/mapmenu.c +++ b/src/mapmenu.c @@ -1,4 +1,4 @@ -/* $Id: mapmenu.c,v 1.10 2003/08/29 22:04:19 stpohle Exp $ */ +/* $Id: mapmenu.c,v 1.11 2003/08/29 23:50:39 stpohle Exp $ */ /* map/tileset selection menu */ #include "bomberclone.h" @@ -29,7 +29,7 @@ mapmenu () {12, "Special Trigger :"}, {13, "Special Push Liq. Moved:"}, {14, "Special Row :"}, - {0, ""}, + {15, "Gamet Timeout:"}, {16, "Maptype: Random"}, {0, ""}, {15, "Return To Previous Menu"}, @@ -99,6 +99,8 @@ mapmenu () sprintf (menu[13].text, "Special Push :%d", map.sp_push); sprintf (menu[14].text, "Special Row :%d", map.sp_row); + sprintf (menu[15].text, "Game Timeout:%d", bman.init_timeout); + switch (map.type) { case (MAPT_normal): sprintf (menu[16].text, "Maptype: NORMAL"); @@ -222,6 +224,11 @@ mapmenu () menu_get_text ("Row Specials", text, 2); map.sp_row = atoi (text); break; + case (15): + sprintf (text, "%d", bman.init_timeout); + menu_get_text ("Game Timeout", text, 7); + bman.init_timeout = atoi (text); + break; case (16): map.type++; if (map.type >= MAPT_max) diff --git a/src/netmenu.c b/src/netmenu.c index fda56de..3030421 100644 --- a/src/netmenu.c +++ b/src/netmenu.c @@ -251,6 +251,8 @@ host_multiplayer_game () net_send_servermode (); net_send_players (); } + else + game_end (); } } @@ -278,9 +280,12 @@ join_multiplayer_game () if (bman.state == GS_ready || bman.state == GS_running) game_loop (); - } - else - bman.state = GS_startup; + + game_end (); + } + else { + bman.state = GS_startup; + } } network_shutdown (); diff --git a/src/packets.c b/src/packets.c index 9efb67b..bbde3f0 100644 --- a/src/packets.c +++ b/src/packets.c @@ -699,6 +699,7 @@ void send_tunneldata (_net_addr *addr, int tunnelnr, int x, int y) { d_printf ("send_tunneldata (Tunnel %d Target [%d,%d])\n", tunnelnr, x, y); tun_pkg.h.typ = PKG_tunneldata; + tun_pkg.h.flags = PKGF_ackreq; tun_pkg.h.len = sizeof (struct pkg_tunneldata); if ((GT_MP_PTPM && x != -1 && y != -1) || (GT_MP_PTPS && x == -1 && y == -1)) { diff --git a/src/tileset.c b/src/tileset.c index d1413dc..83e8a83 100644 --- a/src/tileset.c +++ b/src/tileset.c @@ -1,4 +1,4 @@ -/* $Id: tileset.c,v 1.8 2003/08/29 22:04:19 stpohle Exp $ */ +/* $Id: tileset.c,v 1.9 2003/08/29 23:50:39 stpohle Exp $ */ /* load and select tilesets */ #include "bomberclone.h" @@ -243,6 +243,7 @@ tileset_load (char *tilesetname) void tileset_free () { int i; + for (i = 0; i < FT_max; i++) { if (gfx.field[i].image != NULL) SDL_FreeSurface (gfx.field[i].image); @@ -260,6 +261,7 @@ tileset_free () { for (i = 0; i < PWUP_max; i++) if (gfx.powerup[i].image != NULL) SDL_FreeSurface (gfx.powerup[i].image); + gfx.bomb.image = NULL; gfx.fire.image = NULL; };