]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Check viewmodel alignment more frequently
authorTimePath <andrew.hardaker1995@gmail.com>
Tue, 15 Mar 2016 10:55:00 +0000 (21:55 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Tue, 15 Mar 2016 10:55:00 +0000 (21:55 +1100)
Fixes #1639

qcsrc/client/view.qc
qcsrc/common/physics/player.qc
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon/tuba.qc
qcsrc/server/weapons/weaponsystem.qc

index 64a8642b24a7f7a2897716d4573acb5fb6e691be..a52794ec594be9173527675b05bc8cc5c2fcf405 100644 (file)
@@ -300,10 +300,11 @@ void viewmodel_draw(entity this)
        {
                static string name_last;
                string name = wep.mdl;
-               if (name != name_last)
+               bool swap = name != name_last;
+               // if (swap)
                {
                        name_last = name;
-                       CL_WeaponEntity_SetModel(this, name);
+                       CL_WeaponEntity_SetModel(this, name, swap);
                        this.viewmodel_origin = this.origin;
                        this.viewmodel_angles = this.angles;
                }
@@ -312,7 +313,8 @@ void viewmodel_draw(entity this)
                        anim_set(this, this.anim_idle, true, false, false);
        }
        float f = 0; // 0..1; 0: fully active
-       float eta = (this.weapon_nextthink - time) / STAT(WEAPONRATEFACTOR);
+       float rate = STAT(WEAPONRATEFACTOR);
+       float eta = rate ? ((this.weapon_nextthink - time) / rate) : 0;
        if (eta <= 0) f = this.weapon_eta_last;
        else switch (this.state)
        {
index af3f87c158a4bb259dc9d7868b6fc82e03ff30d8..253010c0c957e981127a359863fa56f07b6ae5b3 100644 (file)
@@ -1247,8 +1247,10 @@ void PM_air(entity this, float buttons_prev, float maxspd_mod)
 
                if (PHYS_WARSOWBUNNY_TURNACCEL(this) && accelerating && this.movement.y == 0 && this.movement.x != 0)
                        PM_AirAccelerate(this, wishdir, wishspeed2);
-               else
-                       PM_Accelerate(this, wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, PHYS_AIRACCEL_QW_STRETCHFACTOR(this), PHYS_AIRACCEL_SIDEWAYS_FRICTION(this) / maxairspd, PHYS_AIRSPEEDLIMIT_NONQW(this));
+               else {
+                   float sidefric = maxairspd ? (PHYS_AIRACCEL_SIDEWAYS_FRICTION(this) / maxairspd) : 0;
+                       PM_Accelerate(this, wishdir, wishspeed, wishspeed0, airaccel, airaccelqw, PHYS_AIRACCEL_QW_STRETCHFACTOR(this), sidefric, PHYS_AIRSPEEDLIMIT_NONQW(this));
+        }
 
                if (PHYS_AIRCONTROL(this))
                        CPM_PM_Aircontrol(this, wishdir, wishspeed2);
index b126005eb0e3c93fd6dedf367b561303d54aaa86..4eef9e788ad7be9b2570803b99c6551b2d517765 100644 (file)
@@ -387,7 +387,7 @@ vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn
  *   call again with ""
  *   remove the ent
  */
-void CL_WeaponEntity_SetModel(entity this, string name)
+void CL_WeaponEntity_SetModel(entity this, string name, bool _anim)
 {
        if (name == "")
        {
@@ -540,6 +540,7 @@ void CL_WeaponEntity_SetModel(entity this, string name)
 
        // check if an instant weapon switch occurred
        setorigin(this, this.view_ofs);
+       if (!_anim) return;
        // reset animstate now
        this.wframe = WFRAME_IDLE;
        setanim(this, this.anim_idle, true, false, true);
index 6f380ececbe0d3fda50c7b7a20081c08f41f4e82..7fe6cef9375d55a224608060711c1f0475f2158c 100644 (file)
@@ -355,7 +355,7 @@ ENUMCLASS_END(WFRAME)
 .WFRAME wframe;
 
 vector shotorg_adjust_values(vector vecs, bool y_is_right, bool visual, int algn);
-void CL_WeaponEntity_SetModel(entity this, string name);
+void CL_WeaponEntity_SetModel(entity this, string name, bool _anim);
 #endif
 
 #endif
index 593af851828da87d95b3935c533cc3d725edcbdf..0760f79e32f574a81ccd229df7dfe11c622f8a47 100644 (file)
@@ -413,7 +413,7 @@ NET_HANDLE(tuba_instrument, bool)
        string s = (i == 0) ? "tuba" :
                   (i == 1) ? "akordeon" :
                              "kleinbottle" ;
-       CL_WeaponEntity_SetModel(viewmodel, s);
+       CL_WeaponEntity_SetModel(viewmodel, s, true);
 }
 #endif
 #ifdef SVQC
index 12dcb45144d5a2a5d40662daefb77f5d2e9eef08..1a2aaeafadc0bbc6b974be734fcaf9bd5884511b 100644 (file)
@@ -52,9 +52,9 @@ vector CL_Weapon_GetShotOrg(int wpn)
 {
        entity wi = Weapons_from(wpn);
        entity e = spawn();
-       CL_WeaponEntity_SetModel(e, wi.mdl);
+       CL_WeaponEntity_SetModel(e, wi.mdl, false);
        vector ret = e.movedir;
-       CL_WeaponEntity_SetModel(e, "");
+       CL_WeaponEntity_SetModel(e, "", false);
        remove(e);
        return ret;
 }
@@ -91,7 +91,7 @@ void CL_Weaponentity_Think()
                this.dmg = this.owner.modelindex;
                this.deadflag = this.owner.deadflag;
 
-               CL_WeaponEntity_SetModel(this, this.owner.weaponname);
+               CL_WeaponEntity_SetModel(this, this.owner.weaponname, true);
        }
 
        this.alpha = -1;  // TODO: don't render this entity at all