]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'terencehill/frametime_checks' into 'master'
authorMario <mario.mario@y7mail.com>
Tue, 7 Jan 2020 14:40:04 +0000 (14:40 +0000)
committerMario <mario.mario@y7mail.com>
Tue, 7 Jan 2020 14:40:04 +0000 (14:40 +0000)
Frametime checks

See merge request xonotic/xonotic-data.pk3dir!751

1  2 
qcsrc/server/client.qc

diff --combined qcsrc/server/client.qc
index 248cf12db8cb794206a4af28feb1b77d2e7fc054,4fa113ce8b684e7683d21dcb593164cf4d9a3850..1d5e240b3872969166294ccf93211e1d131e3068
@@@ -25,7 -25,6 +25,7 @@@
  #include "campaign.qh"
  #include "command/common.qh"
  #include "scores_rules.qh"
 +#include "weapons/common.qh"
  
  #include "bot/api.qh"
  
@@@ -714,7 -713,10 +714,7 @@@ void PutPlayerInServer(entity this
        for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
                .entity weaponentity = weaponentities[slot];
 -              entity oldwep = this.(weaponentity);
                CL_SpawnWeaponentity(this, weaponentity);
 -              if(oldwep && oldwep.owner == this)
 -                      this.(weaponentity).m_gunalign = oldwep.m_gunalign;
        }
        this.alpha = default_player_alpha;
        this.colormod = '1 1 1' * autocvar_g_player_brightness;
  
        if (CS(this).impulse) ImpulseCommands(this);
  
 +      W_ResetGunAlign(this, CS(this).cvar_cl_gunalign);
        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
                .entity weaponentity = weaponentities[slot];
@@@ -2084,7 -2085,6 +2084,7 @@@ bool joinAllowed(entity this
  
  .int items_added;
  .string shootfromfixedorigin;
 +.bool dualwielding_prev;
  bool PlayerThink(entity this)
  {
        if (game_stopped || intermission_running) {
                stuffcmd(this, sprintf("\ncl_shootfromfixedorigin \"%s\"\n", autocvar_g_shootfromfixedorigin));
        }
  
 +      // reset gun alignment when dual wielding status changes
 +      // to ensure guns are always aligned right and left
 +      bool dualwielding = W_DualWielding(this);
 +      if(this.dualwielding_prev != dualwielding)
 +      {
 +              W_ResetGunAlign(this, CS(this).cvar_cl_gunalign);
 +              this.dualwielding_prev = dualwielding;
 +      }
 +
        // LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
        //if(frametime)
        {
                this.items |= this.items_added;
        }
  
-       player_regen(this);
-       // WEAPONTODO: Add a weapon request for this
-       // rot vortex charge to the charge limit
-       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+       if (frametime)
        {
-               .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);
-       }
+               // 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) player_anim(this);
+               player_regen(this);
+               player_anim(this);
+               this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+       }
  
-       // secret status
        secrets_setstatus(this);
-       // monsters status
        monsters_setstatus(this);
  
-       this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
        return true;
  }
  
@@@ -2466,7 -2455,7 +2464,7 @@@ void PlayerPreThink (entity this
                this.max_armorvalue = 0;
        }
  
-       if(IS_PLAYER(this))
+       if (frametime && IS_PLAYER(this))
        {
                if (STAT(FROZEN, this) == FROZEN_TEMP_REVIVING)
                {