]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Clean up monster direction checking code a bit more
authorMario <mario@smbclan.net>
Wed, 19 Oct 2016 20:46:04 +0000 (06:46 +1000)
committerMario <mario@smbclan.net>
Wed, 19 Oct 2016 20:46:04 +0000 (06:46 +1000)
qcsrc/common/monsters/sv_monsters.qc

index 44ce0245b430afa6f56bd5577e0d284a0cc3d8d1..fd921a032553f2f606d6d8e904bb0bf7d29a5f16 100644 (file)
@@ -1128,21 +1128,17 @@ void Monster_Move_2D(entity this, float mspeed, bool allow_jumpoff)
                return;
        }
 
-       bool reverse = false;
-       vector a, b;
-
        makevectors(this.angles);
-       a = this.origin + '0 0 16';
-       b = this.origin + '0 0 16' + v_forward * 32;
+       vector a = CENTER_OR_VIEWOFS(this);
+       vector b = CENTER_OR_VIEWOFS(this) + v_forward * 32;
 
        traceline(a, b, MOVE_NORMAL, this);
 
+       bool reverse = false;
        if(trace_fraction != 1.0)
                reverse = true;
-
        if(trace_ent && IS_PLAYER(trace_ent) && !(trace_ent.items & ITEM_Strength.m_itemid))
                reverse = false;
-
        if(trace_ent && IS_MONSTER(trace_ent))
                reverse = true;