X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ftrigger%2Fsecret.qc;h=c3c2c7474e6983b071464d04cc59ea45bbb47c1f;hb=0071121b663dc3d841a2c28d27c1015899f0f402;hp=f94cd00ad9680e5b61b203c2c2b4e9eeaa10c3eb;hpb=3bdee6303ce762a39c2ad67a70745668ba298043;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/triggers/trigger/secret.qc b/qcsrc/common/triggers/trigger/secret.qc index f94cd00ad..c3c2c7474 100644 --- a/qcsrc/common/triggers/trigger/secret.qc +++ b/qcsrc/common/triggers/trigger/secret.qc @@ -1,15 +1,15 @@ +#include "secret.qh" #if defined(CSQC) #elif defined(MENUQC) #elif defined(SVQC) #include #include - #include "secret.qh" #endif #ifdef SVQC -void secrets_setstatus() -{SELFPARAM(); +void secrets_setstatus(entity this) +{ this.stat_secrets_total = secrets_total; this.stat_secrets_found = secrets_found; } @@ -17,10 +17,10 @@ void secrets_setstatus() /** * A secret has been found (maybe :P) */ -void trigger_secret_touch() -{SELFPARAM(); +void trigger_secret_touch(entity this, entity toucher) +{ // only a player can trigger this - if (!IS_PLAYER(other)) + if (!IS_PLAYER(toucher)) return; // update secrets found counter @@ -29,12 +29,14 @@ void trigger_secret_touch() //print(ftos(secret_counter.count), "\n"); // centerprint message (multi_touch() doesn't always call centerprint()) - centerprint(other, self.message); - self.message = ""; + centerprint(toucher, this.message); + this.message = ""; // handle normal trigger features - multi_touch(); - remove(self); + multi_touch(this, toucher); + // we can't just delete(this) here, because this is a touch function + // called while C code is looping through area links... + //delete(this); } /*QUAKED trigger_secret (.5 .5 .5) ? @@ -58,30 +60,30 @@ spawnfunc(trigger_secret) secrets_total += 1; // add default message - if (self.message == "") - self.message = "You found a secret!"; + if (this.message == "") + this.message = "You found a secret!"; // set default sound - if (self.noise == "") - if (!self.sounds) - self.sounds = 1; // misc/secret.wav + if (this.noise == "") + if (!this.sounds) + this.sounds = 1; // misc/secret.wav // this entity can't be a target itself!!!! - self.targetname = ""; + this.targetname = ""; // you can't just shoot a room to find it, can you? - self.health = 0; + this.health = 0; // a secret can not be delayed - self.delay = 0; + this.delay = 0; // convert this trigger to trigger_once - self.classname = "trigger_once"; + //this.classname = "trigger_once"; spawnfunc_trigger_once(this); // take over the touch() function, so we can mark secret as found - self.touch = trigger_secret_touch; + settouch(this, trigger_secret_touch); // ignore triggering; - self.use = func_null; + this.use = func_null; } #endif