From: Mario Date: Tue, 22 Mar 2016 10:26:48 +0000 (+1000) Subject: Another load of self cases fixed X-Git-Tag: xonotic-v0.8.2~1045 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=35ded46b934755480248ac4ffe5d9ca4cc5dcc4e;p=xonotic%2Fxonotic-data.pk3dir.git Another load of self cases fixed --- diff --git a/qcsrc/common/mutators/mutator/overkill/hmg.qc b/qcsrc/common/mutators/mutator/overkill/hmg.qc index cf7174a69..1af6e82df 100644 --- a/qcsrc/common/mutators/mutator/overkill/hmg.qc +++ b/qcsrc/common/mutators/mutator/overkill/hmg.qc @@ -104,9 +104,9 @@ METHOD(HeavyMachineGun, wr_aim, void(entity thiswep)) { SELFPARAM(); if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200)) - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false); else - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false); + PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); } METHOD(HeavyMachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) diff --git a/qcsrc/common/mutators/mutator/overkill/rpc.qc b/qcsrc/common/mutators/mutator/overkill/rpc.qc index 79c491b56..a5360a20c 100644 --- a/qcsrc/common/mutators/mutator/overkill/rpc.qc +++ b/qcsrc/common/mutators/mutator/overkill/rpc.qc @@ -153,7 +153,7 @@ void W_RocketPropelledChainsaw_Attack (Weapon thiswep) METHOD(RocketPropelledChainsaw, wr_aim, void(entity thiswep)) { SELFPARAM(); - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(rpc, speed), 0, WEP_CVAR(rpc, lifetime), false); } METHOD(RocketPropelledChainsaw, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) diff --git a/qcsrc/common/weapons/weapon/arc.qc b/qcsrc/common/weapons/weapon/arc.qc index 658ca935f..d30afff01 100644 --- a/qcsrc/common/weapons/weapon/arc.qc +++ b/qcsrc/common/weapons/weapon/arc.qc @@ -732,6 +732,7 @@ METHOD(Arc, wr_aim, void(entity thiswep)) if(WEP_CVAR(arc, beam_botaimspeed)) { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim( + self, WEP_CVAR(arc, beam_botaimspeed), 0, WEP_CVAR(arc, beam_botaimlifetime), @@ -741,6 +742,7 @@ METHOD(Arc, wr_aim, void(entity thiswep)) else { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim( + self, 1000000, 0, 0.001, diff --git a/qcsrc/common/weapons/weapon/blaster.qc b/qcsrc/common/weapons/weapon/blaster.qc index cf1242aa4..23c4da6c4 100644 --- a/qcsrc/common/weapons/weapon/blaster.qc +++ b/qcsrc/common/weapons/weapon/blaster.qc @@ -156,12 +156,12 @@ METHOD(Blaster, wr_aim, void(entity thiswep)) if(WEP_CVAR(blaster, secondary)) { if((random() * (WEP_CVAR_PRI(blaster, damage) + WEP_CVAR_SEC(blaster, damage))) > WEP_CVAR_PRI(blaster, damage)) - { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); } + { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(blaster, speed), 0, WEP_CVAR_SEC(blaster, lifetime), false); } else - { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); } + { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); } } else - { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); } + { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(blaster, speed), 0, WEP_CVAR_PRI(blaster, lifetime), false); } } METHOD(Blaster, wr_think, void(Blaster thiswep, entity actor, .entity weaponentity, int fire)) diff --git a/qcsrc/common/weapons/weapon/crylink.qc b/qcsrc/common/weapons/weapon/crylink.qc index 4e912851f..9e2bb4741 100644 --- a/qcsrc/common/weapons/weapon/crylink.qc +++ b/qcsrc/common/weapons/weapon/crylink.qc @@ -571,9 +571,9 @@ METHOD(Crylink, wr_aim, void(entity thiswep)) { SELFPARAM(); if(random() < 0.10) - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(crylink, speed), 0, WEP_CVAR_PRI(crylink, middle_lifetime), false); else - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false); + PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(crylink, speed), 0, WEP_CVAR_SEC(crylink, middle_lifetime), false); } METHOD(Crylink, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 5d963e52b..e8697afd1 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -408,7 +408,7 @@ void W_Devastator_Attack(Weapon thiswep) METHOD(Devastator, wr_aim, void(entity thiswep)) { // aim and decide to fire if appropriate - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); if(skill >= 2) // skill 0 and 1 bots won't detonate rockets! { // decide whether to detonate rockets @@ -436,7 +436,7 @@ METHOD(Devastator, wr_aim, void(entity thiswep)) { SELFPARAM(); // aim and decide to fire if appropriate - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(devastator, speed), 0, WEP_CVAR(devastator, lifetime), false); if(skill >= 2) // skill 0 and 1 bots won't detonate rockets! { // decide whether to detonate rockets diff --git a/qcsrc/common/weapons/weapon/electro.qc b/qcsrc/common/weapons/weapon/electro.qc index cc540b86b..b75106806 100644 --- a/qcsrc/common/weapons/weapon/electro.qc +++ b/qcsrc/common/weapons/weapon/electro.qc @@ -435,9 +435,9 @@ METHOD(Electro, wr_aim, void(entity thiswep)) float shoot; if(WEP_CVAR_PRI(electro, speed)) - shoot = bot_aim(WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false); + shoot = bot_aim(self, WEP_CVAR_PRI(electro, speed), 0, WEP_CVAR_PRI(electro, lifetime), false); else - shoot = bot_aim(1000000, 0, 0.001, false); + shoot = bot_aim(self, 1000000, 0, 0.001, false); if(shoot) { @@ -447,7 +447,7 @@ METHOD(Electro, wr_aim, void(entity thiswep)) } else { - if(bot_aim(WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true)) + if(bot_aim(self, WEP_CVAR_SEC(electro, speed), WEP_CVAR_SEC(electro, speed_up), WEP_CVAR_SEC(electro, lifetime), true)) { PHYS_INPUT_BUTTON_ATCK2(self) = true; if(random() < 0.03) self.bot_secondary_electromooth = 0; diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index a4632eb11..4dc3bf867 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -358,7 +358,7 @@ METHOD(Fireball, wr_aim, void(entity thiswep)) PHYS_INPUT_BUTTON_ATCK2(self) = false; if(self.bot_primary_fireballmooth == 0) { - if(bot_aim(WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false)) + if(bot_aim(self, WEP_CVAR_PRI(fireball, speed), 0, WEP_CVAR_PRI(fireball, lifetime), false)) { PHYS_INPUT_BUTTON_ATCK(self) = true; if(random() < 0.02) self.bot_primary_fireballmooth = 0; @@ -366,7 +366,7 @@ METHOD(Fireball, wr_aim, void(entity thiswep)) } else { - if(bot_aim(WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true)) + if(bot_aim(self, WEP_CVAR_SEC(fireball, speed), WEP_CVAR_SEC(fireball, speed_up), WEP_CVAR_SEC(fireball, lifetime), true)) { PHYS_INPUT_BUTTON_ATCK2(self) = true; if(random() < 0.01) self.bot_primary_fireballmooth = 1; diff --git a/qcsrc/common/weapons/weapon/hagar.qc b/qcsrc/common/weapons/weapon/hagar.qc index 3204fa938..2d5085fb1 100644 --- a/qcsrc/common/weapons/weapon/hagar.qc +++ b/qcsrc/common/weapons/weapon/hagar.qc @@ -401,9 +401,9 @@ METHOD(Hagar, wr_aim, void(entity thiswep)) { SELFPARAM(); if(random()>0.15) - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false); else // not using secondary_speed since these are only 15% and should cause some ricochets without re-aiming - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false); + PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_PRI(hagar, speed), 0, WEP_CVAR_PRI(hagar, lifetime), false); } METHOD(Hagar, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { diff --git a/qcsrc/common/weapons/weapon/hlac.qc b/qcsrc/common/weapons/weapon/hlac.qc index b0d57951b..4be78821c 100644 --- a/qcsrc/common/weapons/weapon/hlac.qc +++ b/qcsrc/common/weapons/weapon/hlac.qc @@ -210,7 +210,7 @@ void W_HLAC_Attack2_Frame(Weapon thiswep) METHOD(HLAC, wr_aim, void(entity thiswep)) { SELFPARAM(); - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR_PRI(hlac, speed), 0, WEP_CVAR_PRI(hlac, lifetime), false); } METHOD(HLAC, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { diff --git a/qcsrc/common/weapons/weapon/machinegun.qc b/qcsrc/common/weapons/weapon/machinegun.qc index ddf7a281c..cb5edb1ad 100644 --- a/qcsrc/common/weapons/weapon/machinegun.qc +++ b/qcsrc/common/weapons/weapon/machinegun.qc @@ -246,9 +246,9 @@ METHOD(MachineGun, wr_aim, void(entity thiswep)) { SELFPARAM(); if(vdist(self.origin - self.enemy.origin, <, 3000 - bound(0, skill, 10) * 200)) - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false); else - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false); + PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); } METHOD(MachineGun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { diff --git a/qcsrc/common/weapons/weapon/minelayer.qc b/qcsrc/common/weapons/weapon/minelayer.qc index 5ba8c92c7..a40afe5a9 100644 --- a/qcsrc/common/weapons/weapon/minelayer.qc +++ b/qcsrc/common/weapons/weapon/minelayer.qc @@ -411,7 +411,7 @@ METHOD(MineLayer, wr_aim, void(entity thiswep)) if(self.minelayer_mines >= WEP_CVAR(minelayer, limit)) PHYS_INPUT_BUTTON_ATCK(self) = false; else - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(minelayer, speed), 0, WEP_CVAR(minelayer, lifetime), false); if(skill >= 2) // skill 0 and 1 bots won't detonate mines! { // decide whether to detonate mines diff --git a/qcsrc/common/weapons/weapon/mortar.qc b/qcsrc/common/weapons/weapon/mortar.qc index eb261aece..61ca51326 100644 --- a/qcsrc/common/weapons/weapon/mortar.qc +++ b/qcsrc/common/weapons/weapon/mortar.qc @@ -305,7 +305,7 @@ METHOD(Mortar, wr_aim, void(entity thiswep)) PHYS_INPUT_BUTTON_ATCK2(self) = false; if(self.bot_secondary_grenademooth == 0) // WEAPONTODO: merge this into using WEP_CVAR_BOTH { - if(bot_aim(WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true)) + if(bot_aim(self, WEP_CVAR_PRI(mortar, speed), WEP_CVAR_PRI(mortar, speed_up), WEP_CVAR_PRI(mortar, lifetime), true)) { PHYS_INPUT_BUTTON_ATCK(self) = true; if(random() < 0.01) self.bot_secondary_grenademooth = 1; @@ -313,7 +313,7 @@ METHOD(Mortar, wr_aim, void(entity thiswep)) } else { - if(bot_aim(WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true)) + if(bot_aim(self, WEP_CVAR_SEC(mortar, speed), WEP_CVAR_SEC(mortar, speed_up), WEP_CVAR_SEC(mortar, lifetime), true)) { PHYS_INPUT_BUTTON_ATCK2(self) = true; if(random() < 0.02) self.bot_secondary_grenademooth = 0; diff --git a/qcsrc/common/weapons/weapon/porto.qc b/qcsrc/common/weapons/weapon/porto.qc index d9f919cc4..1ff725d1f 100644 --- a/qcsrc/common/weapons/weapon/porto.qc +++ b/qcsrc/common/weapons/weapon/porto.qc @@ -298,7 +298,7 @@ METHOD(PortoLaunch, wr_aim, void(entity thiswep)) PHYS_INPUT_BUTTON_ATCK(self) = false; PHYS_INPUT_BUTTON_ATCK2(self) = false; if(!WEP_CVAR(porto, secondary)) - if(bot_aim(WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false)) + if(bot_aim(self, WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false)) PHYS_INPUT_BUTTON_ATCK(self) = true; } METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) diff --git a/qcsrc/common/weapons/weapon/rifle.qc b/qcsrc/common/weapons/weapon/rifle.qc index 92b054586..7c0e31733 100644 --- a/qcsrc/common/weapons/weapon/rifle.qc +++ b/qcsrc/common/weapons/weapon/rifle.qc @@ -147,7 +147,7 @@ METHOD(Rifle, wr_aim, void(entity thiswep)) self.bot_secondary_riflemooth = 0; if(self.bot_secondary_riflemooth == 0) { - if(bot_aim(1000000, 0, 0.001, false)) + if(bot_aim(self, 1000000, 0, 0.001, false)) { PHYS_INPUT_BUTTON_ATCK(self) = true; if(random() < 0.01) self.bot_secondary_riflemooth = 1; @@ -155,7 +155,7 @@ METHOD(Rifle, wr_aim, void(entity thiswep)) } else { - if(bot_aim(1000000, 0, 0.001, false)) + if(bot_aim(self, 1000000, 0, 0.001, false)) { PHYS_INPUT_BUTTON_ATCK2(self) = true; if(random() < 0.03) self.bot_secondary_riflemooth = 0; diff --git a/qcsrc/common/weapons/weapon/seeker.qc b/qcsrc/common/weapons/weapon/seeker.qc index d13b38118..e15175672 100644 --- a/qcsrc/common/weapons/weapon/seeker.qc +++ b/qcsrc/common/weapons/weapon/seeker.qc @@ -603,11 +603,11 @@ METHOD(Seeker, wr_aim, void(entity thiswep)) SELFPARAM(); if(WEP_CVAR(seeker, type) == 1) if(W_Seeker_Tagged_Info(self, self.enemy) != world) - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(seeker, missile_speed_max), 0, WEP_CVAR(seeker, missile_lifetime), false); else - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false); + PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false); else - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, WEP_CVAR(seeker, tag_speed), 0, WEP_CVAR(seeker, tag_lifetime), false); } METHOD(Seeker, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { diff --git a/qcsrc/common/weapons/weapon/shockwave.qc b/qcsrc/common/weapons/weapon/shockwave.qc index 9d47930ee..444f96894 100644 --- a/qcsrc/common/weapons/weapon/shockwave.qc +++ b/qcsrc/common/weapons/weapon/shockwave.qc @@ -675,9 +675,9 @@ METHOD(Shockwave, wr_aim, void(entity thiswep)) { SELFPARAM(); if(vlen(self.origin - self.enemy.origin) <= WEP_CVAR(shockwave, melee_range)) - { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false); } + { PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); } else - { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false); } + { PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false); } } METHOD(Shockwave, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 6cb0d0a74..72f3d7a77 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -230,9 +230,9 @@ METHOD(Shotgun, wr_aim, void(entity thiswep)) { SELFPARAM(); if(vdist(self.origin - self.enemy.origin, <=, WEP_CVAR_SEC(shotgun, melee_range))) - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(1000000, 0, 0.001, false); + PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, 1000000, 0, 0.001, false); else - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 0.001, false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 0.001, false); } METHOD(Shotgun, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { diff --git a/qcsrc/common/weapons/weapon/vaporizer.qc b/qcsrc/common/weapons/weapon/vaporizer.qc index 3d3e89618..933124564 100644 --- a/qcsrc/common/weapons/weapon/vaporizer.qc +++ b/qcsrc/common/weapons/weapon/vaporizer.qc @@ -343,9 +343,9 @@ METHOD(Vaporizer, wr_aim, void(entity thiswep)) { SELFPARAM(); if(self.(thiswep.ammo_field) > 0) - PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(1000000, 0, 1, false); + PHYS_INPUT_BUTTON_ATCK(self) = bot_aim(self, 1000000, 0, 1, false); else - PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars + PHYS_INPUT_BUTTON_ATCK2(self) = bot_aim(self, WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars } METHOD(Vaporizer, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { diff --git a/qcsrc/common/weapons/weapon/vortex.qc b/qcsrc/common/weapons/weapon/vortex.qc index fdb89d77a..0faccbbb7 100644 --- a/qcsrc/common/weapons/weapon/vortex.qc +++ b/qcsrc/common/weapons/weapon/vortex.qc @@ -213,7 +213,7 @@ void W_Vortex_Attack(Weapon thiswep, float issecondary) METHOD(Vortex, wr_aim, void(entity thiswep)) { SELFPARAM(); - if(bot_aim(1000000, 0, 1, false)) + if(bot_aim(self, 1000000, 0, 1, false)) PHYS_INPUT_BUTTON_ATCK(self) = true; else { diff --git a/qcsrc/server/bot/aim.qc b/qcsrc/server/bot/aim.qc index 75f1bb190..2d6a642ba 100644 --- a/qcsrc/server/bot/aim.qc +++ b/qcsrc/server/bot/aim.qc @@ -321,12 +321,12 @@ vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, flo return targorigin + targvelocity * (shotdelay + vlen(targorigin - shotorg) / shotspeed); } -float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity) -{SELFPARAM(); +bool bot_aim(entity this, float shotspeed, float shotspeedupward, float maxshottime, bool applygravity) +{ float f, r, hf, distanceratio; vector v; /* - eprint(self); + eprint(this); dprint("bot_aim(", ftos(shotspeed)); dprint(", ", ftos(shotspeedupward)); dprint(", ", ftos(maxshottime)); @@ -334,60 +334,60 @@ float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float a dprint(");\n"); */ - hf = self.dphitcontentsmask; - self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE; + hf = this.dphitcontentsmask; + this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE; shotspeed *= W_WeaponSpeedFactor(); shotspeedupward *= W_WeaponSpeedFactor(); if (!shotspeed) { - LOG_TRACE("bot_aim: WARNING: weapon ", PS(self).m_weapon.m_name, " shotspeed is zero!\n"); + LOG_TRACE("bot_aim: WARNING: weapon ", PS(this).m_weapon.m_name, " shotspeed is zero!\n"); shotspeed = 1000000; } if (!maxshottime) { - LOG_TRACE("bot_aim: WARNING: weapon ", PS(self).m_weapon.m_name, " maxshottime is zero!\n"); + LOG_TRACE("bot_aim: WARNING: weapon ", PS(this).m_weapon.m_name, " maxshottime is zero!\n"); maxshottime = 1; } - makevectors(self.v_angle); - shotorg = self.origin + self.view_ofs; + makevectors(this.v_angle); + shotorg = this.origin + this.view_ofs; shotdir = v_forward; - v = bot_shotlead(self.bot_aimtargorigin, self.bot_aimtargvelocity, shotspeed, self.bot_aimlatency); + v = bot_shotlead(this.bot_aimtargorigin, this.bot_aimtargvelocity, shotspeed, this.bot_aimlatency); distanceratio = sqrt(bound(0,skill,10000))*0.3*(vlen(v-shotorg)-100)/autocvar_bot_ai_aimskill_firetolerance_distdegrees; distanceratio = bound(0,distanceratio,1); r = (autocvar_bot_ai_aimskill_firetolerance_maxdegrees-autocvar_bot_ai_aimskill_firetolerance_mindegrees) * (1-distanceratio) + autocvar_bot_ai_aimskill_firetolerance_mindegrees; - if (applygravity && self.bot_aimtarg) + if (applygravity && this.bot_aimtarg) { - if (!findtrajectorywithleading(shotorg, '0 0 0', '0 0 0', self.bot_aimtarg, shotspeed, shotspeedupward, maxshottime, 0, self)) + if (!findtrajectorywithleading(shotorg, '0 0 0', '0 0 0', this.bot_aimtarg, shotspeed, shotspeedupward, maxshottime, 0, this)) { - self.dphitcontentsmask = hf; + this.dphitcontentsmask = hf; return false; } - f = bot_aimdir(self, findtrajectory_velocity - shotspeedupward * '0 0 1', r); + f = bot_aimdir(this, findtrajectory_velocity - shotspeedupward * '0 0 1', r); } else { - f = bot_aimdir(self, v - shotorg, r); - //dprint("AIM: ");dprint(vtos(self.bot_aimtargorigin));dprint(" + ");dprint(vtos(self.bot_aimtargvelocity));dprint(" * ");dprint(ftos(self.bot_aimlatency + vlen(self.bot_aimtargorigin - shotorg) / shotspeed));dprint(" = ");dprint(vtos(v));dprint(" : aimdir = ");dprint(vtos(normalize(v - shotorg)));dprint(" : ");dprint(vtos(shotdir));dprint("\n"); - //traceline(shotorg, shotorg + shotdir * 10000, false, self); + f = bot_aimdir(this, v - shotorg, r); + //dprint("AIM: ");dprint(vtos(this.bot_aimtargorigin));dprint(" + ");dprint(vtos(this.bot_aimtargvelocity));dprint(" * ");dprint(ftos(this.bot_aimlatency + vlen(this.bot_aimtargorigin - shotorg) / shotspeed));dprint(" = ");dprint(vtos(v));dprint(" : aimdir = ");dprint(vtos(normalize(v - shotorg)));dprint(" : ");dprint(vtos(shotdir));dprint("\n"); + //traceline(shotorg, shotorg + shotdir * 10000, false, this); //if (trace_ent.takedamage) //if (trace_fraction < 1) - //if (!bot_shouldattack(self, trace_ent)) + //if (!bot_shouldattack(this, trace_ent)) // return false; - traceline(shotorg, self.bot_aimtargorigin, false, self); + traceline(shotorg, this.bot_aimtargorigin, false, this); if (trace_fraction < 1) - if (trace_ent != self.enemy) - if (!bot_shouldattack(self, trace_ent)) + if (trace_ent != this.enemy) + if (!bot_shouldattack(this, trace_ent)) { - self.dphitcontentsmask = hf; + this.dphitcontentsmask = hf; return false; } } //if (r > maxshottime * shotspeed) // return false; - self.dphitcontentsmask = hf; + this.dphitcontentsmask = hf; return true; } diff --git a/qcsrc/server/bot/aim.qh b/qcsrc/server/bot/aim.qh index a21272d87..5a1cb16c4 100644 --- a/qcsrc/server/bot/aim.qh +++ b/qcsrc/server/bot/aim.qh @@ -91,7 +91,7 @@ void bot_lagfunc(entity this, float t, float f1, float f2, entity e1, vector v1, float bot_shouldattack(entity this, entity targ); float bot_aimdir(entity this, vector v, float maxfiredeviation); -float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity); +bool bot_aim(entity this, float shotspeed, float shotspeedupward, float maxshottime, bool applygravity); float findtrajectorywithleading(vector org, vector m1, vector m2, entity targ, float shotspeed, float shotspeedupward, float maxtime, float shotdelay, entity ignore); vector bot_shotlead(vector targorigin, vector targvelocity, float shotspeed, float shotdelay);