+#include "button.qh"
#ifdef SVQC
// button and multiple button
void button_wait(entity this)
{
this.state = STATE_TOP;
- this.SUB_NEXTTHINK = this.SUB_LTIME + this.wait;
- SUB_THINK(this, button_return);
+ if(this.wait >= 0)
+ {
+ this.nextthink = this.ltime + this.wait;
+ setthink(this, button_return);
+ }
SUB_UseTargets(this, this.enemy, NULL);
this.frame = 1; // use alternate textures
}
}
-void button_blocked()
+void button_blocked(entity this, entity blocker)
{
// do nothing, just don't come all the way back out
}
setorigin(this, this.pos1);
this.frame = 0; // use normal textures
this.state = STATE_BOTTOM;
+ this.velocity = '0 0 0';
+ setthink(this, func_null);
+ this.nextthink = 0;
if (this.health)
this.takedamage = DAMAGE_YES; // can be shot again
}
return;
this.enemy = actor;
- WITHSELF(this, button_fire(this));
+ button_fire(this);
}
-void button_touch(entity this)
+void button_touch(entity this, entity toucher)
{
- if (!other)
+ if (!toucher)
return;
- if (!other.iscreature)
+ if (!toucher.iscreature)
return;
- if(other.velocity * this.movedir < 0)
+ if(toucher.velocity * this.movedir < 0)
return;
- this.enemy = other;
- if (other.owner)
- this.enemy = other.owner;
+ this.enemy = toucher;
+ if (toucher.owner)
+ this.enemy = toucher.owner;
button_fire (this);
}
this.health = this.health - damage;
if (this.health <= 0)
{
- this.enemy = damage_attacker;
- WITHSELF(this, button_fire(this));
+ this.enemy = attacker;
+ button_fire(this);
}
}
return;
this.effects |= EF_LOWPRECISION;
- this.blocked = button_blocked;
+ setblocked(this, button_blocked);
this.use = button_use;
// if (this.health == 0) // all buttons are now shootable
this.pos2 = this.pos1 + this.movedir*(fabs(this.movedir*this.size) - this.lip);
this.flags |= FL_NOTARGET;
+ this.reset = button_reset;
+
button_reset(this);
}
#endif