From a01d3d479e293dc6109093ec78c00baf145f5266 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 1 Mar 2006 23:36:44 +0000 Subject: Detect turbo mode more accurately Subversion-branch: /trunk/chocolate-doom Subversion-revision: 402 --- src/g_game.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/g_game.c b/src/g_game.c index e43a93c1..eda5c283 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -1,7 +1,7 @@ // Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // -// $Id: g_game.c 399 2006-02-27 21:46:35Z fraggle $ +// $Id: g_game.c 402 2006-03-01 23:36:44Z 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 399 2006-02-27 21:46:35Z fraggle $"; +rcsid[] = "$Id: g_game.c 402 2006-03-01 23:36:44Z fraggle $"; #include #include @@ -231,6 +231,8 @@ boolean deathmatch; // only if started as net death boolean netgame; // only true if packets are broadcast boolean playeringame[MAXPLAYERS]; player_t players[MAXPLAYERS]; + +boolean turbodetected[MAXPLAYERS]; int consoleplayer; // player taking events and displaying int displayplayer; // view being displayed @@ -646,6 +648,7 @@ void G_DoLoadLevel (void) for (i=0 ; iforwardmove > TURBOTHRESHOLD - && !(gametic&31) && ((gametic>>5)&3) == i ) + + // check ~ 4 seconds whether to display the turbo message. + // store if the turbo threshold was exceeded in any tics + // over the past 4 seconds. offset the checking period + // for each player so messages are not displayed at the + // same time. + + if (cmd->forwardmove > TURBOTHRESHOLD) + { + turbodetected[i] = true; + } + + if ((gametic & 31) == 0 + && ((gametic >> 5) % MAXPLAYERS) == i + && turbodetected[i]) { static char turbomessage[80]; extern char *player_names[4]; sprintf (turbomessage, "%s is turbo!",player_names[i]); players[consoleplayer].message = turbomessage; + turbodetected[i] = false; } if (netgame && !netdemo && !(gametic%ticdup) ) -- cgit v1.2.3