diff --git a/ChangeLog b/ChangeLog index da28f81..e23d118 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -$Id: ChangeLog,v 1.69 2004/02/05 21:32:10 stpohle Exp $ +$Id: ChangeLog,v 1.70 2004/02/05 22:58:57 stpohle Exp $ - Fixed: forgot to put the Message F4 to start the game into the playerselection screen. I put this only into the @@ -33,6 +33,9 @@ $Id: ChangeLog,v 1.69 2004/02/05 21:32:10 stpohle Exp $ ex[*].count value as long as no specialy explosion was found. +- Fixed/Added: display messages enabled again (after disabling + for changing the menu style with version 0.11.0) + Version 0.11.1 ============== diff --git a/include/menu.h b/include/menu.h index 7ea9927..f19bc4e 100644 --- a/include/menu.h +++ b/include/menu.h @@ -1,4 +1,4 @@ -/* $Id: menu.h,v 1.5 2004/02/02 23:30:34 patty21 Exp $ +/* $Id: menu.h,v 1.6 2004/02/05 22:59:02 stpohle Exp $ * GUI for menuhandling */ @@ -83,5 +83,7 @@ extern _menuitem *menu_get_lastid (); extern _menuitem *menu_get_firstid (); extern int menu_create_dirlist (char *path, signed char dirflags, _charlist *cl, int maxentry); extern char *menu_dir_select (char *title, char *path, signed char dirflags); +extern void menu_displaymessage (char *title, char *line1, char *line2, char *line3, char *line4); +extern void menu_displaytext (char *title, char *line1, char *line2, char *line3, char *line4); #endif diff --git a/include/packets.h b/include/packets.h index e6adabb..58faf77 100644 --- a/include/packets.h +++ b/include/packets.h @@ -2,6 +2,10 @@ #include "flyingitems.h" + +/* All known Packettypes for the game. All types before PKG_field are + * only packets between client and server, all packets behinf PKG_field + * are between all clients so they will be forwarded. */ enum _network_data { PKG_error = 0, PKG_joingame, @@ -15,7 +19,8 @@ enum _network_data { PKG_pkgack, PKG_mapinfo, PKG_tunneldata, - PKG_field, // forward - always be the first field + PKG_updateinfo, + PKG_field, // forward - always be the first field PKG_playerdata, // forward PKG_bombdata, // forward PKG_playerstatus, // forward @@ -25,8 +30,7 @@ enum _network_data { PKG_special, // forward PKG_dropitem, // forward PKG_respawn, // forward - PKG_updateinfo, // forward - PKG_quit // always the last known type + PKG_quit // forward - always the last known type forwarded type }; diff --git a/src/font.c b/src/font.c index 49e9171..aefabd7 100644 --- a/src/font.c +++ b/src/font.c @@ -1,4 +1,4 @@ -/* $Id: font.c,v 1.12 2004/01/25 02:21:01 stpohle Exp $ */ +/* $Id: font.c,v 1.13 2004/02/05 22:59:02 stpohle Exp $ */ // Using Fonts in SDL #include @@ -137,10 +137,6 @@ void font_load () { }; -void font_setcolor (unsigned char r, unsigned char g, unsigned char b, int size) { -}; - - void font_free() { int i, c; diff --git a/src/game.c b/src/game.c index a7bfa60..1eb600e 100644 --- a/src/game.c +++ b/src/game.c @@ -1,4 +1,4 @@ -/* $Id: game.c,v 1.76 2004/02/05 21:32:18 stpohle Exp $ +/* $Id: game.c,v 1.77 2004/02/05 22:59:03 stpohle Exp $ game.c - procedures for the game. */ #include @@ -10,6 +10,7 @@ #include "packets.h" #include "chat.h" #include "flyingitems.h" +#include "menu.h" extern int blitdb_nr, blitrects_nr; @@ -312,7 +313,7 @@ game_start () { int p, i; -// menu_displaytext ("Loading..", "Please Wait", 32, 128, 32); + menu_displaytext ("Loading..", NULL, NULL, "Please Wait", NULL); bman.players_nr_s = 0; @@ -385,7 +386,7 @@ void game_showresult () { Uint8 *keys; int done = 0, keypressed = 0, x, y, i, p; -// menu_displaytext ("Loading..", "Please Wait", 32, 128, 32); + menu_displaytext ("Loading..", NULL, NULL, "Please Wait", NULL); dest.x = dest.y = 0; dest.w = gfx.res.x; dest.h = gfx.res.y; diff --git a/src/menu.c b/src/menu.c index 24f4960..70a4715 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1,4 +1,4 @@ -/* $Id: menu.c,v 1.38 2004/02/02 23:30:34 patty21 Exp $ +/* $Id: menu.c,v 1.39 2004/02/05 22:59:04 stpohle Exp $ * Menuhandling */ #include "basic.h" @@ -487,3 +487,34 @@ menu_dir_select (char *title, char *path, signed char dirflags) { strncpy (menu_dir_name, selfile->text, LEN_PATHFILENAME); return menu_dir_name; }; + + +/* display a message on the screen and wait untill ESC is pressed */ +void menu_displaymessage (char *title, char *line1, char *line2, char *line3, char *line4) { + menu_new (title, 500, 150); + if (line1 != NULL) menu_create_label (line1, -1, 55, 0); + if (line2 != NULL) menu_create_label (line2, -1, 75, 0); + if (line3 != NULL) menu_create_label (line3, -1, 95, 0); + if (line4 != NULL) menu_create_label (line4, -1, 115, 0); + menu_loop (); + menu_delete (); +}; + + +/* display a text on the screen and return */ +void menu_displaytext (char *title, char *line1, char *line2, char *line3, char *line4) { + menu_new (title, 500, 150); + if (line1 != NULL) menu_create_label (line1, -1, 55, 0); + if (line2 != NULL) menu_create_label (line2, -1, 75, 0); + if (line3 != NULL) menu_create_label (line3, -1, 95, 0); + if (line4 != NULL) menu_create_label (line4, -1, 115, 0); + menu_looprunning = 1; + menu_draw (); + gfx_blitdraw (); + SDL_FreeSurface (menu.oldscreen); + menu.oldscreen = NULL; + menuitems[0].next = NULL; + menu.items = NULL; + menu_looprunning = 0; + gfx_blitdraw (); +}; diff --git a/src/menulabels.c b/src/menulabels.c index 6fbae0d..d6bce30 100644 --- a/src/menulabels.c +++ b/src/menulabels.c @@ -1,4 +1,4 @@ -/* $Id: menulabels.c,v 1.1 2003/12/24 02:42:06 stpohle Exp $ +/* $Id: menulabels.c,v 1.2 2004/02/05 22:59:05 stpohle Exp $ * Menuhandling: labels */ #include "basic.h" @@ -19,11 +19,11 @@ void menu_draw_label (_menuitem *mi) { return; if (mi->pos.x == -1) - dx = (menu.oldscreenpos.w - (strlen (mi->label) * font[mi->pos.w].size.x)) / 2; + dx = (menu.oldscreenpos.w - 2*menu.images[0]->w - (strlen (mi->label) * font[mi->pos.w].size.x)) / 2; else dx = mi->pos.x; if (mi->pos.y == -1) - dy = (menu.oldscreenpos.h - font[mi->pos.w].size.y) / 2; + dy = (menu.oldscreenpos.h - 2*menu.images[0]->h - font[mi->pos.w].size.y) / 2; else dy = mi->pos.y; diff --git a/src/multiwait.c b/src/multiwait.c index ed5856b..64ac9b3 100644 --- a/src/multiwait.c +++ b/src/multiwait.c @@ -8,6 +8,7 @@ #include "packets.h" #include "gfx.h" #include "chat.h" +#include "menu.h" extern int UpdateRects_nr; extern int blitdb_nr; @@ -28,7 +29,7 @@ mw_init () draw_logo (); -// menu_displaytext ("Please Wait", "Loading GFX Data", 64, 128, 64); + menu_displaytext ("Please Wait", NULL, NULL, "Loading GFX Data", NULL); gfx_load_players (32, 32); network_loop (); @@ -64,7 +65,7 @@ mw_shutdown () void mw_wait_for_connect () { -// menu_displaytext ("Please Wait", "Wait For connection", 64, 128, 64); + menu_displaytext ("Please Wait", NULL, NULL, "Wait For connection", NULL); }; diff --git a/src/netmenu.c b/src/netmenu.c index a1ee82d..486c071 100644 --- a/src/netmenu.c +++ b/src/netmenu.c @@ -123,22 +123,13 @@ multiplayer_firstrun () bman.players_nr_s = 1; }; -void host_multiplayer_errormessage() -{ - menu_new ("Error", 400, 150); - menu_create_label ("You cannot host a game", 60, 54, 0); - - menu_create_label ("with Firewall option enabled.", 60, 84, 0); - menu_loop (); - menu_delete (); -} /* * We will host a network game */ void host_multiplayer_game () { if (bman.firewall) { - host_multiplayer_errormessage(); + menu_displaymessage("Error", NULL, "You can not start a network game", "with the firewall option on.", NULL); return; } multiplayer_firstrun (); diff --git a/src/packets.c b/src/packets.c index 1d10471..ad35c79 100644 --- a/src/packets.c +++ b/src/packets.c @@ -6,6 +6,7 @@ #include "packets.h" #include "chat.h" #include "sound.h" +#include "menu.h" extern _point debug_field; extern int debug_lastping; @@ -60,8 +61,12 @@ send_error (_net_addr * addr, char *text) int do_error (struct pkg_error *data, _net_addr * addr) { - d_printf ("Network Error : '%s'\n", data->text); -// menu_displaymessage ("Network Error", data->text); + char text[255]; + + d_printf ("Network Error from %s:%s : '%s'\n", addr->host, addr->port, data->text); + + sprintf (text, "Got Error from: %s:%s",addr->host, addr->port); + menu_displaymessage ("Network Error", NULL, text, data->text, NULL); if (data->nr == 1) return -1; else @@ -342,7 +347,7 @@ do_servermode (struct pkg_servermode *s_mod, _net_addr * addr) /* the server changed */ if (bman.p_servnr != s_mod->p_servnr) { -// menu_displaymessage ("Server Quit", "FIXME: Server Quit the game and code is not finished"); + menu_displaymessage ("Server Quit", NULL, NULL, "The Server Quit the game.", NULL); } /* do the normal update */ diff --git a/src/single.c b/src/single.c index 2dbd5b3..2359765 100644 --- a/src/single.c +++ b/src/single.c @@ -1,4 +1,4 @@ -/* $Id: single.c,v 1.57 2004/02/01 01:15:04 stpohle Exp $ */ +/* $Id: single.c,v 1.58 2004/02/05 22:59:06 stpohle Exp $ */ /* single player */ #include "basic.h" @@ -29,7 +29,7 @@ single_game_new () bman.last_ex_nr = 1; bman.sock = -1; - bman.state = GS_running; + bman.state = GS_ready; }; @@ -631,7 +631,9 @@ single_playergame () while (!done && bman.state != GS_quit && bman.state != GS_startup) { single_game_new (); game_start (); + bman.state = GS_running; game_loop (); + bman.state = GS_ready; game_end (); } }; @@ -790,7 +792,7 @@ single_select_player () Uint8 *keys; Uint32 timeloop1; -// menu_displaytext ("Loading..", "Please Wait", 32, 128, 32); + menu_displaytext ("Loading..", NULL, NULL, "Please Wait", NULL); dest.x = dest.y = 0; dest.w = gfx.res.x;