]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
mortar wr_aim slightly less duplication
authordrjaska <drjaska83@gmail.com>
Wed, 28 Dec 2022 11:54:57 +0000 (13:54 +0200)
committerdrjaska <drjaska83@gmail.com>
Wed, 28 Dec 2022 11:54:57 +0000 (13:54 +0200)
qcsrc/common/weapons/weapon/mortar.qc

index 52b8a571a51eb34e0265bf7fb52a3d0676e57a57..9dcd03ec8554d1a64ba38a28db47e6d53b41f167 100644 (file)
@@ -254,17 +254,15 @@ METHOD(Mortar, wr_aim, void(entity thiswep, entity actor, .entity weaponentity))
 {
     PHYS_INPUT_BUTTON_ATCK(actor) = false;
     PHYS_INPUT_BUTTON_ATCK2(actor) = false;
-    if(actor.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH
+    int sec = actor.bot_secondary_grenademooth; // is secondary?
+    if(bot_aim(actor, weaponentity, WEP_CVAR_BOTH(mortar, sec, speed), WEP_CVAR_BOTH(mortar, sec, speed_up), WEP_CVAR_BOTH(mortar, sec, lifetime), true, true))
     {
-        if(bot_aim(actor, weaponentity, WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true, true))
+        if(sec == 0)
         {
             PHYS_INPUT_BUTTON_ATCK(actor) = true;
             if(random() < 0.01) actor.bot_secondary_grenademooth = 1;
         }
-    }
-    else
-    {
-        if(bot_aim(actor, weaponentity, WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true, true))
+        else
         {
             PHYS_INPUT_BUTTON_ATCK2(actor) = true;
             if(random() < 0.02) actor.bot_secondary_grenademooth = 0;