]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
track how far completed the game is (var: game_completion_ratio)
authorRudolf Polzer <divverent@xonotic.org>
Fri, 6 Jul 2012 09:43:14 +0000 (11:43 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Fri, 6 Jul 2012 09:43:14 +0000 (11:43 +0200)
qcsrc/server/defs.qh
qcsrc/server/g_world.qc

index 2391f37ae3bd42cea432fa6f40d5fa87e98fa7dd..8564e04e9d3c7cb7624287acb8343486a46e989c 100644 (file)
@@ -277,6 +277,7 @@ float blockSpectators; //if set, new or existing spectators or observers will be
 .float spectatortime; //point in time since the client is spectating or observing
 void checkSpectatorBlock();
 
 .float spectatortime; //point in time since the client is spectating or observing
 void checkSpectatorBlock();
 
+float game_completion_ratio; // 0 at start, 1 near end
 .float winning;
 .float jointime; // time of joining
 .float alivetime; // time of being alive
 .float winning;
 .float jointime; // time of joining
 .float alivetime; // time of being alive
@@ -673,4 +674,4 @@ string modname;
 
 #define MISSILE_IS_CONFUSABLE(m) ((m.missile_flags & MIF_GUIDED_CONFUSABLE) ? TRUE : FALSE)
 #define MISSILE_IS_GUIDED(m) ((m.missile_flags & MIF_GUIDED_ALL) ? TRUE : FALSE)
 
 #define MISSILE_IS_CONFUSABLE(m) ((m.missile_flags & MIF_GUIDED_CONFUSABLE) ? TRUE : FALSE)
 #define MISSILE_IS_GUIDED(m) ((m.missile_flags & MIF_GUIDED_ALL) ? TRUE : FALSE)
-#define MISSILE_IS_TRACKING(m) ((m.missile_flags & MIF_GUIDED_TRACKING) ? TRUE : FALSE)
\ No newline at end of file
+#define MISSILE_IS_TRACKING(m) ((m.missile_flags & MIF_GUIDED_TRACKING) ? TRUE : FALSE)
index f2ce297010bd567ec72b6f810794fd6689017530..7c632c1e508bf185e6b5680d7723f96c55103f07 100644 (file)
@@ -1979,6 +1979,8 @@ float WinningCondition_Scores(float limit, float leadlimit)
                        limitreached = (limitreached || leadlimitreached);
        }
 
                        limitreached = (limitreached || leadlimitreached);
        }
 
+       game_completion_ratio = max(game_completion_ratio, bound(0, WinningConditionHelper_topscore / max(1, limit), 1));
+
        return GetWinningCode(
                WinningConditionHelper_topscore && limitreached,
                WinningConditionHelper_equality
        return GetWinningCode(
                WinningConditionHelper_topscore && limitreached,
                WinningConditionHelper_equality
@@ -2167,6 +2169,11 @@ void CheckRules_World()
        float wantovertime;
        wantovertime = 0;
 
        float wantovertime;
        wantovertime = 0;
 
+       if(timelimit > game_starttime)
+               game_completion_ratio = (time - game_starttime) / (timelimit - game_starttime);
+       else
+               game_completion_ratio = 0;
+
        if(checkrules_suddendeathend)
        {
                if(!checkrules_suddendeathwarning)
        if(checkrules_suddendeathend)
        {
                if(!checkrules_suddendeathwarning)