From 1c4b1e8cdfba62f81a4d27c716cbc4bd816e3fe7 Mon Sep 17 00:00:00 2001 From: drjaska Date: Wed, 28 Dec 2022 13:54:57 +0200 Subject: [PATCH] mortar wr_aim slightly less duplication --- qcsrc/common/weapons/weapon/mortar.qc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index 52b8a571a..9dcd03ec8 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -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; -- 2.39.2