added broadcast menuswitch to the programm parameters and also into the config file

origin
stpohle 21 years ago
parent a772710142
commit 790e52c9f6

@ -1,11 +1,17 @@
$Id: ChangeLog,v 1.101 2005/04/06 21:45:46 stpohle Exp $ $Id: ChangeLog,v 1.102 2005/04/08 00:18:24 stpohle Exp $
Version 0.11.6.1 Version 0.11.6.1
================ ================
- Display the number of players for each listed network game.
- Ghost Player added. - Ghost Player added.
- Playername will not overlapped by the player gfx anymore. - Playername will not overlapped by the player gfx anymore.
- Added menuswitch to enable/disable broadcast requests.
Version 0.11.6 Version 0.11.6
============== ==============

@ -1,4 +1,4 @@
/* $Id: bomberclone.h,v 1.31 2005/03/28 16:38:29 stpohle Exp $ */ /* $Id: bomberclone.h,v 1.32 2005/04/08 00:18:28 stpohle Exp $ */
/* bomberclone.h */ /* bomberclone.h */
#ifndef _BOMBERCLONE_H_ #ifndef _BOMBERCLONE_H_
@ -84,6 +84,7 @@ struct {
char ogc_port[LEN_PORT]; char ogc_port[LEN_PORT];
int firewall; int firewall;
int notifygamemaster; int notifygamemaster;
int broadcast;
int askplayername; // ask player for name at startup int askplayername; // ask player for name at startup
int start_bombs; // start values int start_bombs; // start values

@ -1,4 +1,4 @@
/* $Id: broadcast.c,v 1.4 2005/03/28 21:06:41 stpohle Exp $ /* $Id: broadcast.c,v 1.5 2005/04/08 00:18:29 stpohle Exp $
* find broadcasted games and also hold in this list * find broadcasted games and also hold in this list
* all games which the ogc reports us */ * all games which the ogc reports us */
@ -101,7 +101,8 @@ void broadcast_init () {
for (i = 0; i < BC_MAXENTRYS; i++) for (i = 0; i < BC_MAXENTRYS; i++)
broadcast_list[i].host[0] = 0; broadcast_list[i].host[0] = 0;
broadcast_send (NULL, NULL); if (bman.broadcast)
broadcast_send (NULL, NULL);
bc_lastrequest = timestamp; bc_lastrequest = timestamp;
}; };
@ -134,7 +135,7 @@ void broadcast_loop () {
struct pkg_gameinfo *pgi; struct pkg_gameinfo *pgi;
_net_addr addr; _net_addr addr;
if ((timestamp - bc_lastrequest) > BC_REQUESTTIME) { if (bman.broadcast && (timestamp - bc_lastrequest) > BC_REQUESTTIME) {
broadcast_send (NULL, NULL); broadcast_send (NULL, NULL);
bc_lastrequest = timestamp; bc_lastrequest = timestamp;
} }

@ -1,4 +1,4 @@
/* $Id: configuration.c,v 1.72 2005/03/28 16:38:34 stpohle Exp $ /* $Id: configuration.c,v 1.73 2005/04/08 00:18:29 stpohle Exp $
* configuration */ * configuration */
#include <SDL.h> #include <SDL.h>
@ -92,6 +92,7 @@ config_init (int argc, char **argv)
resend_cache.data = NULL; resend_cache.data = NULL;
resend_cache.fill = -1; resend_cache.fill = -1;
bman.notifygamemaster = 1; bman.notifygamemaster = 1;
bman.broadcast = 1;
bman.askplayername = 0; bman.askplayername = 0;
debug = 0; debug = 0;
gfx.res.x = 640; gfx.res.x = 640;
@ -317,6 +318,9 @@ config_read ()
if (!strcmp (keyword, "notify")) { if (!strcmp (keyword, "notify")) {
bman.notifygamemaster = atoi (value); bman.notifygamemaster = atoi (value);
} }
if (!strcmp (keyword, "broadcast")) {
bman.broadcast = atoi (value);
}
if (!strcmp (keyword, "ogcserver")) { if (!strcmp (keyword, "ogcserver")) {
strcpy (bman.ogcserver, value); strcpy (bman.ogcserver, value);
} }
@ -453,6 +457,7 @@ config_write ()
fprintf (config, "fieldsizex=%d\n", map.size.x); fprintf (config, "fieldsizex=%d\n", map.size.x);
fprintf (config, "fieldsizey=%d\n", map.size.y); fprintf (config, "fieldsizey=%d\n", map.size.y);
fprintf (config, "notify=%d\n", bman.notifygamemaster); fprintf (config, "notify=%d\n", bman.notifygamemaster);
fprintf (config, "broadcast=%d\n", bman.broadcast);
fprintf (config, "ai_family=%d\n", bman.net_ai_family); fprintf (config, "ai_family=%d\n", bman.net_ai_family);
fprintf (config, "ogcserver=%s\n", bman.ogcserver); fprintf (config, "ogcserver=%s\n", bman.ogcserver);
fprintf (config, "ogc_port=%s\n", bman.ogc_port); fprintf (config, "ogc_port=%s\n", bman.ogc_port);
@ -665,6 +670,7 @@ ReadPrgArgs (int argc, char **argv)
printf (" (Def.: 11000)\n"); printf (" (Def.: 11000)\n");
printf (" -ogcport PORT - set the local OGC Port (Def.: 11100)\n"); printf (" -ogcport PORT - set the local OGC Port (Def.: 11100)\n");
printf (" -ogc 0/1 - Enable/Disable OGC\n"); printf (" -ogc 0/1 - Enable/Disable OGC\n");
printf (" -broadcast 0/1 - Enable/Disable broadcast requests.\n");
printf (" -host - start a network game\n"); printf (" -host - start a network game\n");
printf (" -join - go into the join menu\n"); printf (" -join - go into the join menu\n");
printf (" -connect ADDRESS - connect to a server\n"); printf (" -connect ADDRESS - connect to a server\n");
@ -683,6 +689,8 @@ ReadPrgArgs (int argc, char **argv)
strncpy (bman.gamename, argv[++i], LEN_GAMENAME); strncpy (bman.gamename, argv[++i], LEN_GAMENAME);
if (!strcmp (argv[i], "-ogc")) if (!strcmp (argv[i], "-ogc"))
bman.notifygamemaster = atoi (argv[++i]); bman.notifygamemaster = atoi (argv[++i]);
if (!strcmp (argv[i], "-broadcast"))
bman.broadcast = atoi (argv[++i]);
if (!strcmp (argv[i], "-debug")) if (!strcmp (argv[i], "-debug"))
debug = atoi (argv[++i]); debug = atoi (argv[++i]);
} }

@ -66,17 +66,18 @@ network_options ()
menu = menu_new ("Network Options", 400, 380); menu = menu_new ("Network Options", 400, 380);
menu_create_label (menu, "Max Players", 30, 75, 0, COLOR_brown); menu_create_label (menu, "Max Players", 30, 75, 0, COLOR_brown);
menu_create_list (menu, "Players", 150, 55, 55, 70, nrplayerlist, &selnrplayer, 1); menu_create_list (menu, "Players", 150, 55, 55, 70, nrplayerlist, &selnrplayer, 1);
menu_create_entry (menu, "Gamename", -1, 150, 300, &bman.gamename, LEN_GAMENAME, MENU_entrytext, 2); menu_create_entry (menu, "Gamename", -1, 150, 300, &bman.gamename, LEN_GAMENAME, MENU_entrytext, 3);
menu_create_entry (menu, "UDP Port:", -1, 180, 200, &bman.port, LEN_PORT, MENU_entrytext,3); menu_create_entry (menu, "UDP Port:", -1, 180, 200, &bman.port, LEN_PORT, MENU_entrytext,4);
#ifndef _WIN32 #ifndef _WIN32
menu_create_bool (menu, "IPV6", 260, 60, 100, &net_ai_typ, 4); menu_create_bool (menu, "IPV6", 260, 60, 100, &net_ai_typ, 2);
#endif #endif
menu_create_bool (menu, "Private Game", 20, 220, 150, &bman.passwordenabled, 6); menu_create_bool (menu, "Private Game", 20, 220, 150, &bman.passwordenabled, 6);
menu_create_entry (menu, "Password:", 190, 220, 210, &bman.password, LEN_PASSWORD, MENU_entrytext, 7); menu_create_entry (menu, "Password:", 190, 220, 210, &bman.password, LEN_PASSWORD, MENU_entrytext, 7);
menu_create_bool (menu, "Use OpenGameCache", -1, 250, 350, &bman.notifygamemaster, 8); menu_create_bool (menu, "Use OGC", 70, 250, 120, &bman.notifygamemaster, 8);
menu_create_entry (menu, "OpenGameCache:", -1, 280, 350, &bman.ogcserver, LEN_SERVERNAME, MENU_entrytext, 9); menu_create_bool (menu, "Broadcast", 250, 250, 120, &bman.broadcast, 9);
menu_create_entry (menu, "Local OGC Port", -1, 310, 350, &bman.ogc_port, LEN_PORT, MENU_entrytext, 10); menu_create_entry (menu, "OpenGameCache:", -1, 280, 350, &bman.ogcserver, LEN_SERVERNAME, MENU_entrytext, 10);
menu_create_entry (menu, "Local OGC Port", -1, 310, 350, &bman.ogc_port, LEN_PORT, MENU_entrytext, 11);
menu_create_button (menu, "Ok", -1, 350, 150, 0); menu_create_button (menu, "Ok", -1, 350, 150, 0);
menuselect = menu_loop (menu); menuselect = menu_loop (menu);
bman.maxplayer = (selnrplayer - &nrplayerlist[0]) + 1; bman.maxplayer = (selnrplayer - &nrplayerlist[0]) + 1;

@ -1,4 +1,4 @@
/* $Id: sysfunc.c,v 1.23 2004/01/07 23:04:32 patty21 Exp $ /* $Id: sysfunc.c,v 1.24 2005/04/08 00:18:29 stpohle Exp $
sysfunc.c - this file hold some routines for the system functions.. sysfunc.c - this file hold some routines for the system functions..
like d_delay like d_delay
*/ */
@ -242,7 +242,7 @@ inline void s_calctimesync () {
timeloop1 = SDL_GetTicks (); timeloop1 = SDL_GetTicks ();
game_timediff = timeloop1 - timestamp; // only for debugging needed game_timediff = timeloop1 - timestamp; // only for debugging needed
while (timeloop1 - timestamp >= 0 && timeloop1 - timestamp < 20) { while (timeloop1 - timestamp >= 3 && timeloop1 - timestamp < 20) {
s_delay (20 - (timeloop1 - timestamp) - 1); s_delay (20 - (timeloop1 - timestamp) - 1);
timeloop1 = SDL_GetTicks (); timeloop1 = SDL_GetTicks ();
} }

Loading…
Cancel
Save