From: Mario Date: Sat, 30 May 2020 11:46:40 +0000 (+1000) Subject: Remove an obscure macro from trigger code that was hiding a simple targetname check X-Git-Tag: xonotic-v0.8.5~993 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f2f8783552bd4b1098a4fa61f9b12e78bf694d31;p=xonotic%2Fxonotic-data.pk3dir.git Remove an obscure macro from trigger code that was hiding a simple targetname check --- diff --git a/qcsrc/common/mapobjects/func/conveyor.qc b/qcsrc/common/mapobjects/func/conveyor.qc index 4c40598d3..3666dd337 100644 --- a/qcsrc/common/mapobjects/func/conveyor.qc +++ b/qcsrc/common/mapobjects/func/conveyor.qc @@ -98,7 +98,7 @@ void conveyor_init(entity this) setthink(this, conveyor_think); this.nextthink = time; this.setactive = generic_netlinked_setactive; - IFTARGETED + if(this.targetname && this.targetname != "") { // backwards compatibility this.use = generic_netlinked_legacy_use; diff --git a/qcsrc/common/mapobjects/func/door.qc b/qcsrc/common/mapobjects/func/door.qc index e9fd04b72..57faf5145 100644 --- a/qcsrc/common/mapobjects/func/door.qc +++ b/qcsrc/common/mapobjects/func/door.qc @@ -443,7 +443,7 @@ void LinkDoors(entity this) if (GetResource(this, RES_HEALTH)) return; - IFTARGETED + if(this.targetname && this.targetname != "") return; if (this.items) return; @@ -511,7 +511,7 @@ void LinkDoors(entity this) if (GetResource(this, RES_HEALTH)) return; - IFTARGETED + if(this.targetname && this.targetname != "") return; if (this.items) return; diff --git a/qcsrc/common/mapobjects/func/door_secret.qc b/qcsrc/common/mapobjects/func/door_secret.qc index c008e500d..50593a4e2 100644 --- a/qcsrc/common/mapobjects/func/door_secret.qc +++ b/qcsrc/common/mapobjects/func/door_secret.qc @@ -244,10 +244,7 @@ spawnfunc(func_door_secret) setblocked(this, secret_blocked); this.speed = 50; this.use = fd_secret_use; - IFTARGETED - { - } - else + if(!this.targetname || this.targetname == "") this.spawnflags |= DOOR_SECRET_YES_SHOOT; if (this.spawnflags & DOOR_SECRET_YES_SHOOT) diff --git a/qcsrc/common/mapobjects/func/pointparticles.qc b/qcsrc/common/mapobjects/func/pointparticles.qc index 7de5a03ef..72ad35598 100644 --- a/qcsrc/common/mapobjects/func/pointparticles.qc +++ b/qcsrc/common/mapobjects/func/pointparticles.qc @@ -115,7 +115,7 @@ spawnfunc(func_pointparticles) Net_LinkEntity(this, (this.spawnflags & PARTICLES_VISCULLING), 0, pointparticles_SendEntity); - IFTARGETED + if(this.targetname && this.targetname != "") { // backwards compatibility this.use = generic_netlinked_legacy_use; diff --git a/qcsrc/common/mapobjects/misc/laser.qc b/qcsrc/common/mapobjects/misc/laser.qc index df88b750f..403a46813 100644 --- a/qcsrc/common/mapobjects/misc/laser.qc +++ b/qcsrc/common/mapobjects/misc/laser.qc @@ -280,7 +280,7 @@ spawnfunc(misc_laser) this.setactive = laser_setactive; - IFTARGETED + if(this.targetname && this.targetname != "") { // backwards compatibility this.use = laser_use; diff --git a/qcsrc/common/mapobjects/misc/teleport_dest.qc b/qcsrc/common/mapobjects/misc/teleport_dest.qc index e7eedd52c..7402726d4 100644 --- a/qcsrc/common/mapobjects/misc/teleport_dest.qc +++ b/qcsrc/common/mapobjects/misc/teleport_dest.qc @@ -39,10 +39,7 @@ spawnfunc(info_teleport_destination) //setorigin(this, this.origin + '0 0 27'); // To fix a mappers' habit as old as Quake setorigin(this, this.origin); - IFTARGETED - { - } - else + if(!this.targetname || this.targetname == "") { objerror (this, "^3Teleport destination without a targetname"); return; // don't link it to CSQC in this case! diff --git a/qcsrc/common/mapobjects/platforms.qc b/qcsrc/common/mapobjects/platforms.qc index 832b25b6b..aae20894d 100644 --- a/qcsrc/common/mapobjects/platforms.qc +++ b/qcsrc/common/mapobjects/platforms.qc @@ -179,7 +179,7 @@ void plat_use(entity this, entity actor, entity trigger) void plat_reset(entity this) { - IFTARGETED + if(this.targetname && this.targetname != "") { setorigin(this, this.pos1); this.state = STATE_UP; diff --git a/qcsrc/common/mapobjects/target/speaker.qc b/qcsrc/common/mapobjects/target/speaker.qc index 11c9ad7ba..354f4ca6f 100644 --- a/qcsrc/common/mapobjects/target/speaker.qc +++ b/qcsrc/common/mapobjects/target/speaker.qc @@ -91,7 +91,7 @@ spawnfunc(target_speaker) if(!this.atten) { - IFTARGETED + if(this.targetname && this.targetname != "") this.atten = ATTEN_NORM; else this.atten = ATTEN_STATIC; @@ -102,7 +102,7 @@ spawnfunc(target_speaker) if(!this.volume) this.volume = 1; - IFTARGETED + if(this.targetname && this.targetname != "") { if(this.spawnflags & SPEAKER_ACTIVATOR) this.use = target_speaker_use_activator; diff --git a/qcsrc/common/mapobjects/trigger/gravity.qc b/qcsrc/common/mapobjects/trigger/gravity.qc index 1ac0f8768..4b9fb2236 100644 --- a/qcsrc/common/mapobjects/trigger/gravity.qc +++ b/qcsrc/common/mapobjects/trigger/gravity.qc @@ -100,7 +100,7 @@ spawnfunc(trigger_gravity) this.active = ACTIVE_ACTIVE; this.setactive = generic_setactive; - IFTARGETED + if(this.targetname && this.targetname != "") { // legacy use this.use = trigger_gravity_use; diff --git a/qcsrc/common/mapobjects/trigger/multivibrator.qc b/qcsrc/common/mapobjects/trigger/multivibrator.qc index 932fda13c..34876aeb7 100644 --- a/qcsrc/common/mapobjects/trigger/multivibrator.qc +++ b/qcsrc/common/mapobjects/trigger/multivibrator.qc @@ -72,7 +72,7 @@ spawnfunc(trigger_multivibrator) setthink(this, multivibrator_send_think); this.nextthink = max(1, time); - IFTARGETED + if(this.targetname && this.targetname != "") multivibrator_reset(this); } #endif diff --git a/qcsrc/common/mapobjects/triggers.qc b/qcsrc/common/mapobjects/triggers.qc index 27ffead9c..29b00d5db 100644 --- a/qcsrc/common/mapobjects/triggers.qc +++ b/qcsrc/common/mapobjects/triggers.qc @@ -43,7 +43,7 @@ void generic_netlinked_setactive(entity this, int act) void generic_netlinked_reset(entity this) { - IFTARGETED + if(this.targetname && this.targetname != "") { if(this.spawnflags & START_ENABLED) { diff --git a/qcsrc/common/mapobjects/triggers.qh b/qcsrc/common/mapobjects/triggers.qh index 797c9767f..73113b4b5 100644 --- a/qcsrc/common/mapobjects/triggers.qh +++ b/qcsrc/common/mapobjects/triggers.qh @@ -8,8 +8,6 @@ .float height; -#define IFTARGETED if(this.targetname && this.targetname != "") - .float lip; // used elsewhere (will fix)