]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix some potential crashes revolving around monster attacks' use of makevectors
authorMario <mario.mario@y7mail.com>
Fri, 15 Nov 2019 11:47:51 +0000 (21:47 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 15 Nov 2019 11:47:51 +0000 (21:47 +1000)
qcsrc/common/monsters/monster/mage.qc
qcsrc/common/monsters/monster/spider.qc
qcsrc/common/monsters/monster/wyvern.qc
qcsrc/common/monsters/sv_monsters.qc

index efdd836d21e8af7bedd7de2ebffe8555031e173a..1cba349ed96e39fe5baa594b4f447b04d7af8651 100644 (file)
@@ -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);
index 52bf37f7d2608f175ddc373c060d95c90c28990f..b684af15255e66efc70d9580e34f90c3dea825f4 100644 (file)
@@ -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);
index 8a4ad160560fa87583ab87a6dd861c7c0f274d54..d07669af0ea1861edcb230d86cc27cb151b5d8d7 100644 (file)
@@ -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();
index 0673cd0baf24810d20dc452ce469e73a6ae31a51..b30bf4583bf35fe5a8e8349971a614e00a7bb493 100644 (file)
@@ -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);