From 22ab73808ebfd07cd9708fbdfedf48de3b3671de Mon Sep 17 00:00:00 2001 From: terencehill Date: Wed, 1 Jan 2020 23:13:26 +0100 Subject: [PATCH] More frametime checks --- .../gamemode/freezetag/sv_freezetag.qc | 5 +- qcsrc/common/mutators/mutator/nades/nades.qc | 65 ++++++++++--------- qcsrc/server/client.qc | 18 ++--- 3 files changed, 47 insertions(+), 41 deletions(-) diff --git a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc index 54f6268e3..89060694a 100644 --- a/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc +++ b/qcsrc/common/gamemodes/gamemode/freezetag/sv_freezetag.qc @@ -472,15 +472,18 @@ MUTATOR_HOOKFUNCTION(ft, PlayerPreThink, CBC_ORDER_FIRST) if(!round_handler_IsRoundStarted()) return true; - int n; entity player = M_ARGV(0, entity); //if (STAT(FROZEN, player) == FROZEN_NORMAL) //if(player.freezetag_frozen_timeout > 0 && time < player.freezetag_frozen_timeout) //player.iceblock.alpha = ICE_MIN_ALPHA + (ICE_MAX_ALPHA - ICE_MIN_ALPHA) * (player.freezetag_frozen_timeout - time) / (player.freezetag_frozen_timeout - player.freezetag_frozen_time); + if (!(frametime && IS_PLAYER(player))) + return true; + entity reviving_players_last = NULL; entity reviving_players_first = NULL; + int n; if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout) n = -1; else diff --git a/qcsrc/common/mutators/mutator/nades/nades.qc b/qcsrc/common/mutators/mutator/nades/nades.qc index 67e3d4ad1..510fcf92e 100644 --- a/qcsrc/common/mutators/mutator/nades/nades.qc +++ b/qcsrc/common/mutators/mutator/nades/nades.qc @@ -1347,44 +1347,47 @@ MUTATOR_HOOKFUNCTION(nades, PlayerPreThink) } } - int n = 0; - - IntrusiveList reviving_players = NULL; - - if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout) - n = -1; - else if (STAT(FROZEN, player) == FROZEN_TEMP_DYING) + if (frametime && IS_PLAYER(player)) { - vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size; - n = 0; - FOREACH_CLIENT(IS_PLAYER(it) && IS_REVIVING(player, it, revive_extra_size), { - if (!reviving_players) - reviving_players = IL_NEW(); - IL_PUSH(reviving_players, it); - ++n; - }); - } + int n = 0; - if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // 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); - SetResource(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health)); + IntrusiveList reviving_players = NULL; - if(STAT(REVIVE_PROGRESS, player) >= 1) + if(player.freezetag_frozen_timeout > 0 && time >= player.freezetag_frozen_timeout) + n = -1; + else if (STAT(FROZEN, player) == FROZEN_TEMP_DYING) { - Unfreeze(player, false); - - entity first = IL_FIRST(reviving_players); - Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, first.netname); - Send_Notification(NOTIF_ONE, first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname); + vector revive_extra_size = '1 1 1' * autocvar_g_freezetag_revive_extra_size; + n = 0; + FOREACH_CLIENT(IS_PLAYER(it) && IS_REVIVING(player, it, revive_extra_size), { + if (!reviving_players) + reviving_players = IL_NEW(); + IL_PUSH(reviving_players, it); + ++n; + }); } - IL_EACH(reviving_players, true, { - STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player); - }); + if (n > 0 && STAT(FROZEN, player) == FROZEN_TEMP_DYING) // 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); + SetResource(player, RES_HEALTH, max(1, STAT(REVIVE_PROGRESS, player) * start_health)); + + if(STAT(REVIVE_PROGRESS, player) >= 1) + { + Unfreeze(player, false); + + entity first = IL_FIRST(reviving_players); + Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_FREEZETAG_REVIVED, first.netname); + Send_Notification(NOTIF_ONE, first, MSG_CENTER, CENTER_FREEZETAG_REVIVE, player.netname); + } + + IL_EACH(reviving_players, true, { + STAT(REVIVE_PROGRESS, it) = STAT(REVIVE_PROGRESS, player); + }); + } + if (reviving_players) + IL_DELETE(reviving_players); } - if (reviving_players) - IL_DELETE(reviving_players); } MUTATOR_HOOKFUNCTION(nades, PlayerPhysics_UpdateStats) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 175885dbe..4fa113ce8 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2207,17 +2207,17 @@ bool PlayerThink(entity this) this.items |= this.items_added; } - // WEAPONTODO: Add a weapon request for this - // rot vortex charge to the charge limit - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - { - .entity weaponentity = weaponentities[slot]; - if (WEP_CVAR(vortex, charge_rot_rate) && this.(weaponentity).vortex_charge > WEP_CVAR(vortex, charge_limit) && this.(weaponentity).vortex_charge_rottime < time) - this.(weaponentity).vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.(weaponentity).vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1); - } - if (frametime) { + // WEAPONTODO: Add a weapon request for this + // rot vortex charge to the charge limit + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + if (WEP_CVAR(vortex, charge_rot_rate) && this.(weaponentity).vortex_charge > WEP_CVAR(vortex, charge_limit) && this.(weaponentity).vortex_charge_rottime < time) + this.(weaponentity).vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.(weaponentity).vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1); + } + player_regen(this); player_anim(this); this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime); -- 2.39.2