From: Freddy Date: Mon, 12 Mar 2018 15:16:30 +0000 (+0100) Subject: trigger_hurt: minor cleanup X-Git-Tag: xonotic-v0.8.5~2176^2~15 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=128f8283316749da3de6dc675d7b3f74a157c53e;p=xonotic%2Fxonotic-data.pk3dir.git trigger_hurt: minor cleanup --- diff --git a/qcsrc/common/triggers/spawnflags.qh b/qcsrc/common/triggers/spawnflags.qh index 711fdd1f4..c4b974631 100644 --- a/qcsrc/common/triggers/spawnflags.qh +++ b/qcsrc/common/triggers/spawnflags.qh @@ -3,6 +3,7 @@ // generic usage const int START_ENABLED = BIT(0); const int ON_MAPLOAD = BIT(1); +const int INVERT_TEAMS = BIT(2); const int NOSPLASH = BIT(8); // generic anti-splashdamage spawnflag // triggers diff --git a/qcsrc/common/triggers/trigger/hurt.qc b/qcsrc/common/triggers/trigger/hurt.qc index 9c09f923b..7df3ee7a9 100644 --- a/qcsrc/common/triggers/trigger/hurt.qc +++ b/qcsrc/common/triggers/trigger/hurt.qc @@ -15,7 +15,7 @@ void trigger_hurt_touch(entity this, entity toucher) return; if(this.team) - if(((this.spawnflags & 4) == 0) == (this.team != toucher.team)) + if(((this.spawnflags & INVERT_TEAMS) == 0) == (this.team != toucher.team)) return; // only do the EXACTTRIGGER_TOUCH checks when really needed (saves some cpu) @@ -53,7 +53,7 @@ void trigger_hurt_touch(entity this, entity toucher) /*QUAKED spawnfunc_trigger_hurt (.5 .5 .5) ? Any object touching this will be hurt set dmg to damage amount -defalt dmg = 5 +default dmg = 1000 */ .entity trigger_hurt_next; entity trigger_hurt_last; @@ -80,12 +80,12 @@ spawnfunc(trigger_hurt) trigger_hurt_last = this; } -float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end) +bool tracebox_hits_trigger_hurt(vector start, vector min, vector max, vector end) { entity th; for(th = trigger_hurt_first; th; th = th.trigger_hurt_next) - if(tracebox_hits_box(start, mi, ma, end, th.absmin, th.absmax)) + if(tracebox_hits_box(start, min, max, end, th.absmin, th.absmax)) return true; return false;