From: Mario Date: Fri, 15 Nov 2019 11:47:51 +0000 (+1000) Subject: Fix some potential crashes revolving around monster attacks' use of makevectors X-Git-Tag: xonotic-v0.8.5~1226 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3de6603a1849f6a3811c924a33a45047a6328c37;p=xonotic%2Fxonotic-data.pk3dir.git Fix some potential crashes revolving around monster attacks' use of makevectors --- diff --git a/qcsrc/common/monsters/monster/mage.qc b/qcsrc/common/monsters/monster/mage.qc index efdd836d2..1cba349ed 100644 --- a/qcsrc/common/monsters/monster/mage.qc +++ b/qcsrc/common/monsters/monster/mage.qc @@ -12,6 +12,7 @@ METHOD(MageSpike, wr_think, void(MageSpike thiswep, entity actor, .entity weapon if (!IS_PLAYER(actor) || weapon_prepareattack(thiswep, actor, weaponentity, false, 0.2)) { if (!actor.target_range) actor.target_range = autocvar_g_monsters_target_range; actor.enemy = Monster_FindTarget(actor); + monster_makevectors(actor, actor.enemy); W_SetupShot_Dir(actor, weaponentity, v_forward, false, 0, SND_MageSpike_FIRE, CH_WEAPON_B, 0, DEATH_MONSTER_MAGE.m_id); if (!IS_PLAYER(actor)) w_shotdir = normalize((actor.enemy.origin + '0 0 10') - actor.origin); M_Mage_Attack_Spike(actor, w_shotdir); diff --git a/qcsrc/common/monsters/monster/spider.qc b/qcsrc/common/monsters/monster/spider.qc index 52bf37f7d..b684af152 100644 --- a/qcsrc/common/monsters/monster/spider.qc +++ b/qcsrc/common/monsters/monster/spider.qc @@ -128,8 +128,6 @@ void adaptor_think2use_hittype_splash(entity this); void M_Spider_Attack_Web(entity this) { - monster_makevectors(this, this.enemy); - sound(this, CH_SHOTS, SND_ELECTRO_FIRE2, VOL_BASE, ATTEN_NORM); entity proj = new(plasma); diff --git a/qcsrc/common/monsters/monster/wyvern.qc b/qcsrc/common/monsters/monster/wyvern.qc index 8a4ad1605..d07669af0 100644 --- a/qcsrc/common/monsters/monster/wyvern.qc +++ b/qcsrc/common/monsters/monster/wyvern.qc @@ -22,7 +22,6 @@ METHOD(WyvernAttack, wr_think, void(WyvernAttack thiswep, entity actor, .entity if (IS_MONSTER(actor)) { actor.attack_finished_single[0] = time + 1.2; actor.anim_finished = time + 1.2; - monster_makevectors(actor, actor.enemy); } entity missile = spawn(); diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 0673cd0ba..b30bf4583 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -424,6 +424,7 @@ void Monster_Attack_Check(entity this, entity targ, .entity weaponentity) if(vdist(targ.origin - this.origin, <=, this.attack_range)) { + monster_makevectors(this, targ); int attack_success = this.monster_attackfunc(MONSTER_ATTACK_MELEE, this, targ, weaponentity); if(attack_success == 1) Monster_Sound(this, monstersound_melee, 0, false, CH_VOICE); @@ -433,6 +434,7 @@ void Monster_Attack_Check(entity this, entity targ, .entity weaponentity) if(vdist(targ.origin - this.origin, >, this.attack_range)) { + monster_makevectors(this, targ); int attack_success = this.monster_attackfunc(MONSTER_ATTACK_RANGED, this, targ, weaponentity); if(attack_success == 1) Monster_Sound(this, monstersound_melee, 0, false, CH_VOICE);