X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Ftriggers%2Ffunc%2Ffourier.qc;h=28e0f0f7c74df039f84a7f2d111ca32a634f0844;hp=31e3835914ecb59d5722942ed35f1b824dbf83aa;hb=d865de7a9a17c5a1d9286aec40f68c3530697660;hpb=719ba01817465b96db552e18c7f277721d8dbb7e diff --git a/qcsrc/common/triggers/func/fourier.qc b/qcsrc/common/triggers/func/fourier.qc index 31e383591..28e0f0f7c 100644 --- a/qcsrc/common/triggers/func/fourier.qc +++ b/qcsrc/common/triggers/func/fourier.qc @@ -1,3 +1,4 @@ +#include "fourier.qh" #ifdef SVQC /*QUAKED spawnfunc_func_fourier (0 .5 .8) ? Brush model that moves in a pattern of added up sine waves, can be used e.g. for circular motions. @@ -10,78 +11,78 @@ dmg: Do this mutch dmg every .dmgtime intervall when blocked dmgtime: See above. */ -void func_fourier_controller_think() -{SELFPARAM(); +void func_fourier_controller_think(entity this) +{ vector v; float n, i, t; - self.nextthink = time + 0.1; - if(self.owner.active != ACTIVE_ACTIVE) + this.nextthink = time + 0.1; + if(this.owner.active != ACTIVE_ACTIVE) { - self.owner.velocity = '0 0 0'; + this.owner.velocity = '0 0 0'; return; } - n = floor((tokenize_console(self.owner.netname)) / 5); - t = self.nextthink * self.owner.cnt + self.owner.phase * 360; + n = floor((tokenize_console(this.owner.netname)) / 5); + t = this.nextthink * this.owner.cnt + this.owner.phase * 360; - v = self.owner.destvec; + v = this.owner.destvec; for(i = 0; i < n; ++i) { makevectors((t * stof(argv(i*5)) + stof(argv(i*5+1)) * 360) * '0 1 0'); - v = v + ('1 0 0' * stof(argv(i*5+2)) + '0 1 0' * stof(argv(i*5+3)) + '0 0 1' * stof(argv(i*5+4))) * self.owner.height * v_forward_y; + v = v + ('1 0 0' * stof(argv(i*5+2)) + '0 1 0' * stof(argv(i*5+3)) + '0 0 1' * stof(argv(i*5+4))) * this.owner.height * v_forward_y; } - if(self.owner.classname == "func_fourier") // don't brake stuff if the func_fourier was killtarget'ed + if(this.owner.classname == "func_fourier") // don't brake stuff if the func_fourier was killtarget'ed // * 10 so it will arrive in 0.1 sec - self.owner.velocity = (v - self.owner.origin) * 10; + this.owner.velocity = (v - this.owner.origin) * 10; } spawnfunc(func_fourier) { entity controller; - if (self.noise != "") + if (this.noise != "") { - precache_sound(self.noise); - soundto(MSG_INIT, self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_IDLE); + precache_sound(this.noise); + soundto(MSG_INIT, this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_IDLE); } - if (!self.speed) - self.speed = 4; - if (!self.height) - self.height = 32; - self.destvec = self.origin; - self.cnt = 360 / self.speed; - - self.blocked = generic_plat_blocked; - if(self.dmg && (self.message == "")) - self.message = " was squished"; - if(self.dmg && (self.message2 == "")) - self.message2 = "was squished by"; - if(self.dmg && (!self.dmgtime)) - self.dmgtime = 0.25; - self.dmgtime2 = time; - - if(self.netname == "") - self.netname = "1 0 0 0 1"; - - if (!InitMovingBrushTrigger()) + if (!this.speed) + this.speed = 4; + if (!this.height) + this.height = 32; + this.destvec = this.origin; + this.cnt = 360 / this.speed; + + setblocked(this, generic_plat_blocked); + if(this.dmg && (this.message == "")) + this.message = " was squished"; + if(this.dmg && (this.message2 == "")) + this.message2 = "was squished by"; + if(this.dmg && (!this.dmgtime)) + this.dmgtime = 0.25; + this.dmgtime2 = time; + + if(this.netname == "") + this.netname = "1 0 0 0 1"; + + if (!InitMovingBrushTrigger(this)) return; - self.active = ACTIVE_ACTIVE; + this.active = ACTIVE_ACTIVE; // wait for targets to spawn controller = new(func_fourier_controller); - controller.owner = self; + controller.owner = this; controller.nextthink = time + 1; - controller.think = func_fourier_controller_think; - self.SUB_NEXTTHINK = self.SUB_LTIME + 999999999; - self.SUB_THINK = SUB_NullThink; // for PushMove + setthink(controller, func_fourier_controller_think); + this.nextthink = this.ltime + 999999999; + setthink(this, SUB_NullThink); // for PushMove // Savage: Reduce bandwith, critical on e.g. nexdm02 - self.effects |= EF_LOWPRECISION; + this.effects |= EF_LOWPRECISION; // TODO make a reset function for this one }