3 const int FUNC_ROTATING_STARTOFF = BIT(4);
5 void func_rotating_setactive(entity this, int astate)
7 if (astate == ACTIVE_TOGGLE) {
8 if (this.active == ACTIVE_ACTIVE) {
9 this.active = ACTIVE_NOT;
11 this.active = ACTIVE_ACTIVE;
17 if (this.active == ACTIVE_NOT) {
18 this.avelocity = '0 0 0';
20 this.avelocity = this.pos1;
24 void func_rotating_reset(entity this)
26 // TODO: reset angles as well?
28 if (this.spawnflags & FUNC_ROTATING_STARTOFF) {
29 this.avelocity = '0 0 0';
30 this.active = ACTIVE_NOT;
32 this.avelocity = this.pos1;
33 this.active = ACTIVE_ACTIVE;
37 /*QUAKED spawnfunc_func_rotating (0 .5 .8) ? - - X_AXIS Y_AXIS
38 Brush model that spins in place on one axis (default Z).
39 speed : speed to rotate (in degrees per second)
40 noise : path/name of looping .wav file to play.
41 dmg : Do this mutch dmg every .dmgtime intervall when blocked
45 spawnfunc(func_rotating)
47 if (this.noise != "") {
48 precache_sound(this.noise);
49 ambientsound(this.origin, this.noise, VOL_BASE, ATTEN_IDLE);
52 this.setactive = func_rotating_setactive;
57 // FIXME: test if this turns the right way, then remove this comment (negate as needed)
58 if (this.spawnflags & BIT(2)) { // X (untested)
59 this.avelocity = '0 0 1' * this.speed;
61 // FIXME: test if this turns the right way, then remove this comment (negate as needed)
62 else if (this.spawnflags & BIT(3)) { // Y (untested)
63 this.avelocity = '1 0 0' * this.speed;
65 // FIXME: test if this turns the right way, then remove this comment (negate as needed)
67 this.avelocity = '0 1 0' * this.speed;
70 this.pos1 = this.avelocity;
72 // do this after setting pos1, so we can safely reactivate the func_rotating
73 if (this.spawnflags & FUNC_ROTATING_STARTOFF) {
74 this.avelocity = '0 0 0';
75 this.active = ACTIVE_NOT;
77 this.active = ACTIVE_ACTIVE;
80 if (this.dmg && (this.message == "")) {
81 this.message = " was squished";
83 if (this.dmg && (this.message2 == "")) {
84 this.message2 = "was squished by";
88 if (this.dmg && (!this.dmgtime)) {
94 if (!InitMovingBrushTrigger(this)) {
97 // no EF_LOWPRECISION here, as rounding angles is bad
99 setblocked(this, generic_plat_blocked);
101 // wait for targets to spawn
102 this.nextthink = this.ltime + 999999999;
103 setthink(this, SUB_NullThink); // for PushMove
105 this.reset = func_rotating_reset;