Merge branch 'master' into terencehill/ft_autorevive_progress
authorterencehill <piuntn@gmail.com>
Sun, 17 Feb 2019 18:22:22 +0000 (19:22 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 17 Feb 2019 18:22:22 +0000 (19:22 +0100)
# Conflicts:
# qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc

1  2 
qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc

index aa2cbbf80619be1f2131fbf398544b5dd695e5d9,c42c7443ba252a997d778f9c731132a292bc3857..5c73912aabb343888de45aa06113dbe306a64ac8
@@@ -487,34 -486,31 +486,38 @@@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink
                n = 0;
                vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size;
                FOREACH_CLIENT(IS_PLAYER(it) && IS_REVIVING(player, it, revive_extra_size), {
-                       if (!reviving_players)
-                               reviving_players = IL_NEW();
-                       IL_PUSH(reviving_players, it);
+                       if (reviving_players_last)
+                               reviving_players_last.chain = it;
+                       reviving_players_last = it;
+                       if (!reviving_players_first)
+                               reviving_players_first = it;
                        ++n;
                });
+               if (reviving_players_last)
+                       reviving_players_last.chain = NULL;
        }
  
 +      float base_progress = 0;
 +      if  (STAT(FROZEN, player) == FROZEN_NORMAL && autocvar_g_freezetag_revive_auto
 +              && autocvar_g_freezetag_frozen_maxtime > 0 && autocvar_g_freezetag_revive_auto_progress)
 +      {
 +              base_progress = bound(0, (1 - (player.freezetag_frozen_timeout - time) / autocvar_g_freezetag_frozen_maxtime), 1);
 +      }
 +
        if (!n) // no teammate nearby
        {
                if (STAT(FROZEN, player) == FROZEN_NORMAL)
                {
 -                      STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) - frametime * autocvar_g_freezetag_revive_clearspeed, 1);
 +                      STAT(REVIVE_PROGRESS, player) = bound(base_progress, STAT(REVIVE_PROGRESS, player) - frametime * autocvar_g_freezetag_revive_clearspeed, 1);
-                       SetResourceAmountExplicit(player, RESOURCE_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health)));
+                       SetResourceExplicit(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health)));
                }
                else if (!STAT(FROZEN, player))
 -                      STAT(REVIVE_PROGRESS, player) = 0; // thawing nobody
 +                      STAT(REVIVE_PROGRESS, player) = base_progress; // thawing nobody
        }
        else if (STAT(FROZEN, player) == FROZEN_NORMAL) // OK, there is at least one teammate reviving us
        {
 -              STAT(REVIVE_PROGRESS, player) = bound(0, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
 +              STAT(REVIVE_PROGRESS, player) = bound(base_progress, STAT(REVIVE_PROGRESS, player) + frametime * max(1/60, autocvar_g_freezetag_revive_speed), 1);
-               SetResourceAmountExplicit(player, RESOURCE_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health)));
+               SetResourceExplicit(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * ((warmup_stage) ? warmup_start_health : start_health)));
  
                if(STAT(REVIVE_PROGRESS, player) >= 1)
                {