DOC: gametime variables
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@5718 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -1995,8 +1995,60 @@ Output:
|
||||
|
||||
<variable name="minutesremaining">
|
||||
<description>Returns the remaining minutes of the currently played game. READ ONLY</description>
|
||||
<references>
|
||||
<identifierReference identifier="gametimecurrent"/>
|
||||
<identifierReference identifier="gametimemaximum"/>
|
||||
<identifierReference identifier="lastgametimeupdate"/>
|
||||
<identifierReference identifier="millis"/>
|
||||
</references>
|
||||
</variable>
|
||||
|
||||
<variable name="gametimecurrent">
|
||||
<description>Returns the time (in milliseconds) of the currently played game. READ ONLY</description>
|
||||
<examples>
|
||||
<example>
|
||||
<code><![CDATA[showtime = [
|
||||
if (> $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
|
||||
]
|
||||
]]]></code>
|
||||
</example>
|
||||
</examples>
|
||||
<references>
|
||||
<identifierReference identifier="minutesremaining"/>
|
||||
<identifierReference identifier="gametimemaximum"/>
|
||||
<identifierReference identifier="lastgametimeupdate"/>
|
||||
<identifierReference identifier="millis"/>
|
||||
</references>
|
||||
</variable>
|
||||
|
||||
<variable name="gametimemaximum">
|
||||
<description>Returns the maximum time (in milliseconds) of the currently played game. READ ONLY</description>
|
||||
<references>
|
||||
<identifierReference identifier="minutesremaining"/>
|
||||
<identifierReference identifier="gametimecurrent"/>
|
||||
<identifierReference identifier="lastgametimeupdate"/>
|
||||
<identifierReference identifier="millis"/>
|
||||
</references>
|
||||
</variable>
|
||||
|
||||
<variable name="lastgametimeupdate">
|
||||
<description>Returns the last time (in milliseconds) the gametime was updated. READ ONLY</description>
|
||||
<references>
|
||||
<identifierReference identifier="minutesremaining"/>
|
||||
<identifierReference identifier="gametimecurrent"/>
|
||||
<identifierReference identifier="gametimemaximum"/>
|
||||
<identifierReference identifier="millis"/>
|
||||
</references>
|
||||
</variable>
|
||||
<variable name="paused">
|
||||
<description>Determines if the game should be paused.</description>
|
||||
<value token="B" description="pause game" minValue="0" maxValue="1" defaultValue="0"/>
|
||||
|
||||
@@ -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" : "");
|
||||
|
||||
Reference in New Issue
Block a user