]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Restore functionality of g_ca_round_timelimit and add g_freezetag_round_timelimit
authorterencehill <piuntn@gmail.com>
Tue, 25 Dec 2012 14:40:33 +0000 (15:40 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 25 Dec 2012 14:40:33 +0000 (15:40 +0100)
gamemodes.cfg
qcsrc/server/autocvars.qh
qcsrc/server/mutators/gamemode_ca.qc
qcsrc/server/mutators/gamemode_freezetag.qc
qcsrc/server/round_handler.qc
qcsrc/server/round_handler.qh

index 515b8ce6c8aa7e74a62446e266569ceffa540483..596477cca5a3a744a0f5214553a883e37fe52814 100644 (file)
@@ -285,6 +285,7 @@ seta g_freezetag_point_leadlimit -1 "Freeze Tag point lead limit overriding the
 seta g_freezetag_revive_speed 0.4 "Speed for reviving a frozen teammate"
 seta g_freezetag_revive_clearspeed 1.6 "Speed at which reviving progress gets lost when out of range"
 seta g_freezetag_revive_extra_size 100 "Distance in qu that you can stand from a frozen teammate to keep reviving him"
+set g_freezetag_round_timelimit 180
 seta g_freezetag_frozen_force 0.6 "How much to multiply the force on a frozen player with"
 seta g_freezetag_teams_override 0
 set g_freezetag_teams 0
index bbae1e234df093a51a91820b8adebdfdc9ac97ff..28387db04cd78c478fd6ea429bcb5dc7be78ae7a 100644 (file)
@@ -856,6 +856,7 @@ float autocvar_g_freezetag_point_limit;
 float autocvar_g_freezetag_revive_extra_size;
 float autocvar_g_freezetag_revive_speed;
 float autocvar_g_freezetag_revive_clearspeed;
+float autocvar_g_freezetag_round_timelimit;
 float autocvar_g_freezetag_teams;
 float autocvar_g_freezetag_teams_override;
 float autocvar_g_freezetag_warmup;
index 03e68c05d97c45e86d8e31d2720101e8af001f24..8f6d6923eb2d5ef720bfc29edcba2c4dcfc2507d 100644 (file)
@@ -59,7 +59,15 @@ float CA_GetWinnerTeam()
 
 float CA_CheckWinner()
 {
-       // TODO round tied if(time - warmup > autocvar_g_ca_round_timelimit
+       entity e;
+       if(round_handler_GetTimeLeft() <= 0)
+       {
+               FOR_EACH_REALCLIENT(e)
+                       centerprint(e, "Round over, there's no winner");
+               bprint("Round over, there's no winner.\n");
+               allowed_to_spawn = TRUE;
+               return 1;
+       }
 
        if(inWarmupStage)
                allowed_to_spawn = TRUE;
@@ -70,7 +78,6 @@ float CA_CheckWinner()
        if(CA_ALIVE_TEAMS() > 1)
                return 0;
 
-       entity e;
        float winner_team;
        string teamname;
        winner_team = CA_GetWinnerTeam();
@@ -178,7 +185,7 @@ void ca_Initialize()
 {
        allowed_to_spawn = TRUE;
 
-       round_handler_Spawn(CA_CheckTeams, CA_CheckWinner, 5, autocvar_g_ca_warmup);
+       round_handler_Spawn(CA_CheckTeams, CA_CheckWinner, 5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
 
        addstat(STAT_REDALIVE, AS_INT, redalive_stat);
        addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat);
index 4e7fbd1d7daec5a7104280499a002ac1b9ca3236..f2e624c56325826affe75d0f4420d4ef43b71c48 100644 (file)
@@ -6,7 +6,7 @@ void freezetag_Initialize()
        precache_model("models/ice/ice.md3");
        ScoreRules_freezetag();
 
-       round_handler_Spawn(freezetag_CheckTeams, freezetag_CheckWinner, 5, autocvar_g_freezetag_warmup);
+       round_handler_Spawn(freezetag_CheckTeams, freezetag_CheckWinner, 5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
 
        addstat(STAT_REDALIVE, AS_INT, redalive_stat);
        addstat(STAT_BLUEALIVE, AS_INT, bluealive_stat);
@@ -112,10 +112,18 @@ float freezetag_getWinnerTeam()
 
 float freezetag_CheckWinner()
 {
+       entity e;
+       if(round_handler_GetTimeLeft() <= 0)
+       {
+               FOR_EACH_REALCLIENT(e)
+                       centerprint(e, "Round over, there's no winner");
+               bprint("Round over, there's no winner.\n");
+               return 1;
+       }
+
        if(FREEZETAG_ALIVE_TEAMS() > 1)
                return 0;
 
-       entity e;
        float winner_team;
        string teamname;
        winner_team = freezetag_getWinnerTeam();
index 2bac357fba292ee5cc6f11538022c83ce893860c..5fbe24ead3f83b171fa6d07489a2d4f107eb225d 100644 (file)
@@ -38,6 +38,7 @@ void round_handler_Think()
                                FOR_EACH_REALCLIENT(e)
                                        Send_CSQC_Centerprint_Generic(e, CPID_ROUND_STARTING, "^1Begin!", 1, 0);
                                self.cnt = 0;
+                               self.round_endtime = time + self.round_timelimit;
                                self.nextthink = time;
                                return;
                        }
@@ -67,7 +68,7 @@ void round_handler_Think()
        }
 }
 
-void round_handler_Spawn(float() canRoundStart_func, float() canRoundEnd_func, float the_delay, float the_count)
+void round_handler_Spawn(float() canRoundStart_func, float() canRoundEnd_func, float the_delay, float the_count, float the_round_timelimit)
 {
        if(round_handler)
        {
@@ -84,6 +85,7 @@ void round_handler_Spawn(float() canRoundStart_func, float() canRoundEnd_func, f
        round_handler.count = fabs(floor(the_count));
        round_handler.wait = FALSE;
        round_handler.cnt = round_handler.count + 1;
+       round_handler.round_timelimit = the_round_timelimit;
        round_handler.nextthink = max(time, game_starttime + 1);
 }
 
@@ -107,6 +109,11 @@ float round_handler_IsRoundStarted()
        return (!round_handler.wait && !round_handler.cnt);
 }
 
+float round_handler_GetTimeLeft()
+{
+       return (round_handler.round_endtime - time);
+}
+
 void round_handler_Reset(float next_think)
 {
        entity e;
index 55026fa84401565d9aca334ee75021c6d07b87d9..3ab61bc3e2763baf3189ef0459c9f2fdb2f30224 100644 (file)
@@ -4,14 +4,17 @@ entity round_handler;
 .float wait; // it's set to TRUE when round ends, to FALSE when countdown starts
 .float cnt;    // its initial value is .count + 1, then decreased while counting down
                        // reaches 0 when the round starts
+.float round_timelimit;
+.float round_endtime;
 .float() canRoundStart;
 .float() canRoundEnd;
 
-void round_handler_Spawn(float() canRoundStart_func, float() canRoundEnd_func, float the_delay, float the_count);
+void round_handler_Spawn(float() canRoundStart_func, float() canRoundEnd_func, float the_delay, float the_count, float the_round_timelimit);
 float round_handler_IsActive();
 float round_handler_AwaitingNextRound();
 float round_handler_CountdownRunning();
 float round_handler_IsRoundStarted();
+float round_handler_GetTimeLeft();
 void round_handler_Reset(float next_think);
 void round_handler_Remove();