From df3cc2d1ec82e18d9e0970520f2711d79dd5a532 Mon Sep 17 00:00:00 2001 From: flowtron Date: Wed, 6 Oct 2010 19:43:59 +0000 Subject: [PATCH] DOC: gametime variables git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5718 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- docs/reference.xml | 52 +++++++++++++++++++++++++++++++++++++++ source/src/clientgame.cpp | 4 ++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/docs/reference.xml b/docs/reference.xml index 51dba1e0..1151fcf7 100644 --- a/docs/reference.xml +++ b/docs/reference.xml @@ -1995,8 +1995,60 @@ Output: Returns the remaining minutes of the currently played game. READ ONLY + + + + + + + + Returns the time (in milliseconds) of the currently played game. READ ONLY + + + $lastgametimeupdate 0) [ + gmr = (- $gametimemaximum (+ $gametimecurrent (- (millis) $lastgametimeupdate))) + gsr = (div $gmr 1000) + gts = (mod $gsr 60) + if (< $gts 10) [ gts = (concatword 0 $gts) ] [ ] + gtm = (div $gsr 60) + if (< $gtm 10) [ gtm = (concatword 0 $gtm) ] [ ] + echo (concatword $gtm : $gts) remaining + ] [ + echo gametime not updated yet + ] +]]]> + + + + + + + + + + + + Returns the maximum time (in milliseconds) of the currently played game. READ ONLY + + + + + + + + + + Returns the last time (in milliseconds) the gametime was updated. READ ONLY + + + + + + + Determines if the game should be paused. diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 4cd3b779..f21bb736 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -778,7 +778,8 @@ COMMAND(pstat_weap, ARG_1INT); VAR(minutesremaining, 1, 0, 0); VAR(gametimecurrent, 1, 0, 0); VAR(gametimemaximum, 1, 0, 0); -int lastgametimeupdate = 0; +VAR(lastgametimeupdate, 1, 0, 0); + void timeupdate(int milliscur, int millismax) { lastgametimeupdate = lastmillis; @@ -939,6 +940,7 @@ void startmap(const char *name, bool reset) // called just after a map load intermission = false; showscores(false); minutesremaining = -1; + lastgametimeupdate = 0; arenaintermission = 0; bool noflags = (m_ctf || m_ktf) && (!numflagspawn[0] || !numflagspawn[1]); if(*clientmap) conoutf(_("game mode is \"%s\"%s"), modestr(gamemode, modeacronyms > 0), noflags ? " - \f2but there are no flag bases on this map" : "");