]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Give hagar a "proper" animation fix
authorMario <mario@smbclan.net>
Mon, 3 Jul 2017 15:33:52 +0000 (01:33 +1000)
committerMario <mario@smbclan.net>
Mon, 3 Jul 2017 15:33:52 +0000 (01:33 +1000)
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/server/weapons/weaponsystem.qc
qcsrc/server/weapons/weaponsystem.qh

index 3bf72b0b6c4d70a10a1fb7c5f70fd81ddcda1d66..2dede544fcf393a8fb39f5c4509b684188e67a03 100644 (file)
@@ -586,8 +586,6 @@ NET_HANDLE(wframe, bool isNew)
        }
     a.z *= wrate;
 
-    //LOG_INFO(vtos(a), " ", ftos(fr), " ", ftos(wrate), "\n");
-
        if(fr == WFRAME_IDLE) // we don't need to enforce idle animation
                wepent.animstate_looping = false;
        else
index f7b289278608a7a0591abb74481d2d0878965302..9ee06eaa04587704ab7d05e5063b51ff6f3c45bb 100644 (file)
@@ -443,14 +443,7 @@ void W_Hagar_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity, int
 
        int slot = weaponslot(weaponentity);
        ATTACK_FINISHED(actor, slot) = time + WEP_CVAR_PRI(hagar, refire) * W_WeaponRateFactor(actor);
-       int theframe = WFRAME_FIRE1;
-       entity this = actor.(weaponentity);
-       if(this)
-       {
-               if(this.wframe == WFRAME_FIRE1)
-                       theframe = WFRAME_DONTCHANGE;
-       }
-       weapon_thinkf(actor, weaponentity, theframe, WEP_CVAR_PRI(hagar, refire), W_Hagar_Attack_Auto);
+       weapon_thinkf_ex(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(hagar, refire), W_Hagar_Attack_Auto, true);
 }
 
 METHOD(Hagar, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
index a0cc62b2a15900369f768e8d16c942f5698a8938..85f02c472188e3c77f2bfe74645b6ffa76e5eab5 100644 (file)
@@ -337,8 +337,8 @@ void wframe_send(entity actor, entity weaponentity, int a, bool restartanim);
  * @param t defer thinking until time + t
  * @param func next think function
  */
-void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,
-       .entity weaponentity, int fire) func)
+void weapon_thinkf_ex(entity actor, .entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,
+       .entity weaponentity, int fire) func, bool forcenorestart)
 {
        entity this = actor.(weaponentity);
        if (this == NULL) return;
@@ -353,10 +353,15 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(
                restartanim = fr != WFRAME_IDLE;
        }
 
+       if(forcenorestart)
+               restartanim = false;
+
        vector of = v_forward;
        vector or = v_right;
        vector ou = v_up;
 
+       this.wframe = fr;
+
        v_forward = of;
        v_right = or;
        v_up = ou;
@@ -405,6 +410,12 @@ void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(
                actor.anim_upper_action = 0;
        }
 }
+void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,
+       .entity weaponentity, int fire) func)
+{
+       weapon_thinkf_ex(actor, weaponentity, fr, t, func, false);
+}
+
 
 bool forbidWeaponUse(entity player)
 {
index 2fb0f9956833236250c0266fc70b91a2b412d21a..f2e99720e5da83f07654a483d7ab2c6b07019a44 100644 (file)
@@ -32,4 +32,6 @@ bool weapon_prepareattack_check(Weapon thiswep, entity actor, .entity weaponenti
 
 void weapon_prepareattack_do(entity actor, .entity weaponentity, float secondary, float attacktime);
 
+void weapon_thinkf_ex(entity actor, .entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor, .entity weaponentity, int fire) func, bool forcenorestart);
+
 void weapon_thinkf(entity actor, .entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor, .entity weaponentity, int fire) func);