ref: 319f427c9369bfe1c5a6cad636ecd91934c3024d
parent: cbd744280545a38e62ecc0290a1312b3aeff9ae0
author: Simon Howard <[email protected]>
date: Fri May 5 15:49:34 EDT 2006
Syncronise the -timer/-avg parameters across all clients to avoid desyncs. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 475
--- a/src/d_main.c
+++ b/src/d_main.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: d_main.c 467 2006-04-09 02:50:34Z fraggle $
+// $Id: d_main.c 475 2006-05-05 19:49:34Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -184,7 +184,7 @@
//-----------------------------------------------------------------------------
-static const char rcsid[] = "$Id: d_main.c 467 2006-04-09 02:50:34Z fraggle $";
+static const char rcsid[] = "$Id: d_main.c 475 2006-05-05 19:49:34Z fraggle $";
#define BGCOLOR 7
#define FGCOLOR 8
@@ -1600,21 +1600,22 @@
autostart = true;
}
+ timelimit = 0;
+
p = M_CheckParm ("-timer");
if (p && p < myargc-1 && deathmatch)
{
- int time;
- time = atoi(myargv[p+1]);
- printf(DEH_String("Levels will end after %d minute"),time);
- if (time>1)
- printf("s");
- printf(".\n");
+ timelimit = atoi(myargv[p+1]);
+ printf("timer: %i\n", timelimit);
}
p = M_CheckParm ("-avg");
if (p && p < myargc-1 && deathmatch)
+ {
printf(DEH_String("Austin Virtual Gaming: Levels will end "
"after 20 minutes\n"));
+ timelimit = 20;
+ }
p = M_CheckParm ("-warp");
if (p && p < myargc-1)
--- a/src/d_net.c
+++ b/src/d_net.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: d_net.c 470 2006-04-14 15:25:42Z fraggle $
+// $Id: d_net.c 475 2006-05-05 19:49:34Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -117,7 +117,7 @@
//-----------------------------------------------------------------------------
-static const char rcsid[] = "$Id: d_net.c 470 2006-04-14 15:25:42Z fraggle $";
+static const char rcsid[] = "$Id: d_net.c 475 2006-05-05 19:49:34Z fraggle $";
#include "doomfeatures.h"
@@ -131,6 +131,8 @@
#include "doomdef.h"
#include "doomstat.h"
+#include "deh_main.h"
+
#include "net_client.h"
#include "net_gui.h"
#include "net_io.h"
@@ -375,12 +377,21 @@
++num_players;
}
- printf ("startskill %i deathmatch: %i startmap: %i startepisode: %i\n",
+ printf (DEH_String("startskill %i deathmatch: %i startmap: %i startepisode: %i\n"),
startskill, deathmatch, startmap, startepisode);
- printf ("player %i of %i (%i nodes)\n",
+ printf(DEH_String("player %i of %i (%i nodes)\n"),
consoleplayer+1, num_players, num_players);
+ // Show players here; the server might have specified a time limit
+
+ if (timelimit > 0)
+ {
+ printf(DEH_String("Levels will end after %d minute"),timelimit);
+ if (timelimit > 1)
+ printf("s");
+ printf(".\n");
+ }
}
--- a/src/doomstat.h
+++ b/src/doomstat.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: doomstat.h 429 2006-03-23 17:43:15Z fraggle $
+// $Id: doomstat.h 475 2006-05-05 19:49:34Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -85,6 +85,9 @@
extern skill_t gameskill;
extern int gameepisode;
extern int gamemap;
+
+// If non-zero, exit the level after this number of minutes
+extern int timelimit;
// vertical movement from mouse/joystick disabled
extern int novert;
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: g_game.c 472 2006-04-28 17:31:21Z fraggle $
+// $Id: g_game.c 475 2006-05-05 19:49:34Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -134,7 +134,7 @@
static const char
-rcsid[] = "$Id: g_game.c 472 2006-04-28 17:31:21Z fraggle $";
+rcsid[] = "$Id: g_game.c 475 2006-05-05 19:49:34Z fraggle $";
#include <string.h>
#include <stdlib.h>
@@ -218,7 +218,11 @@
boolean respawnmonsters;
int gameepisode;
int gamemap;
-
+
+// If non-zero, exit the level after this number of minutes.
+
+int timelimit;
+
boolean paused;
boolean sendpause; // send a pause event next tic
boolean sendsave; // send a save event next tic
--- a/src/net_client.c
+++ b/src/net_client.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: net_client.c 470 2006-04-14 15:25:42Z fraggle $
+// $Id: net_client.c 475 2006-05-05 19:49:34Z fraggle $
//
// Copyright(C) 2005 Simon Howard
//
@@ -470,6 +470,7 @@
settings.skill = startskill;
settings.gameversion = gameversion;
settings.nomonsters = nomonsters;
+ settings.timelimit = timelimit;
if (M_CheckParm("-oldsync") > 0)
settings.new_sync = 0;
@@ -674,6 +675,7 @@
lowres_turn = settings.lowres_turn;
nomonsters = settings.nomonsters;
net_cl_new_sync = settings.new_sync != 0;
+ timelimit = settings.timelimit;
if (net_cl_new_sync == false)
{
--- a/src/net_defs.h
+++ b/src/net_defs.h
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: net_defs.h 470 2006-04-14 15:25:42Z fraggle $
+// $Id: net_defs.h 475 2006-05-05 19:49:34Z fraggle $
//
// Copyright(C) 2005 Simon Howard
//
@@ -179,6 +179,7 @@
int gameversion;
int lowres_turn;
int new_sync;
+ int timelimit;
} net_gamesettings_t;
#define NET_TICDIFF_FORWARD (1 << 0)
--- a/src/net_structrw.c
+++ b/src/net_structrw.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: net_structrw.c 470 2006-04-14 15:25:42Z fraggle $
+// $Id: net_structrw.c 475 2006-05-05 19:49:34Z fraggle $
//
// Copyright(C) 2005 Simon Howard
//
@@ -80,6 +80,7 @@
NET_WriteInt8(packet, settings->gameversion);
NET_WriteInt8(packet, settings->lowres_turn);
NET_WriteInt8(packet, settings->new_sync);
+ NET_WriteInt32(packet, settings->timelimit);
}
boolean NET_ReadSettings(net_packet_t *packet, net_gamesettings_t *settings)
@@ -93,7 +94,8 @@
&& NET_ReadInt8(packet, (unsigned int *) &settings->skill)
&& NET_ReadInt8(packet, (unsigned int *) &settings->gameversion)
&& NET_ReadInt8(packet, (unsigned int *) &settings->lowres_turn)
- && NET_ReadInt8(packet, (unsigned int *) &settings->new_sync);
+ && NET_ReadInt8(packet, (unsigned int *) &settings->new_sync)
+ && NET_ReadInt32(packet, (unsigned int *) &settings->timelimit);
}
void NET_WriteTiccmdDiff(net_packet_t *packet, net_ticdiff_t *diff,
--- a/src/p_spec.c
+++ b/src/p_spec.c
@@ -1,7 +1,7 @@
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
-// $Id: p_spec.c 344 2006-01-25 17:38:40Z fraggle $
+// $Id: p_spec.c 475 2006-05-05 19:49:34Z fraggle $
//
// Copyright(C) 1993-1996 Id Software, Inc.
// Copyright(C) 2005 Simon Howard
@@ -45,7 +45,7 @@
//-----------------------------------------------------------------------------
static const char
-rcsid[] = "$Id: p_spec.c 344 2006-01-25 17:38:40Z fraggle $";
+rcsid[] = "$Id: p_spec.c 475 2006-05-05 19:49:34Z fraggle $";
#include <stdlib.h>
@@ -1271,23 +1271,16 @@
episode = 2;
- // See if -TIMER needs to be used.
- levelTimer = false;
-
- i = M_CheckParm("-avg");
- if (i && deathmatch)
+ // See if -TIMER was specified.
+
+ if (timelimit > 0)
{
- levelTimer = true;
- levelTimeCount = 20 * 60 * 35;
+ levelTimer = true;
+ levelTimeCount = timelimit * 60 * 35;
}
-
- i = M_CheckParm("-timer");
- if (i && deathmatch)
+ else
{
- int time;
- time = atoi(myargv[i+1]) * 60 * 35;
- levelTimer = true;
- levelTimeCount = time;
+ levelTimer = false;
}
// Init special SECTORs.