void plat_hit_top(entity this)
{
_sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
- this.state = 1;
+ this.state = STATE_TOP;
setthink(this, plat_go_down);
this.nextthink = this.ltime + 3;
void plat_hit_bottom(entity this)
{
_sound (this, CH_TRIGGER_SINGLE, this.noise1, VOL_BASE, ATTEN_NORM);
- this.state = 2;
+ this.state = STATE_BOTTOM;
}
void plat_go_down(entity this)
{
_sound (this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_NORM);
- this.state = 3;
+ this.state = STATE_DOWN;
SUB_CalcMove (this, this.pos2, TSPEED_LINEAR, this.speed, plat_hit_bottom);
}
void plat_go_up(entity this)
{
_sound (this, CH_TRIGGER_SINGLE, this.noise, VOL_BASE, ATTEN_NORM);
- this.state = 4;
+ this.state = STATE_UP;
SUB_CalcMove (this, this.pos1, TSPEED_LINEAR, this.speed, plat_hit_top);
}
return;
#endif
- if (this.enemy.state == 2) {
+ if (this.enemy.state == STATE_BOTTOM) {
plat_go_up(this.enemy);
- } else if (this.enemy.state == 1)
+ } else if (this.enemy.state == STATE_TOP)
this.enemy.nextthink = this.enemy.ltime + 1;
}
return;
#endif
- if (this.enemy.state == 1) {
+ if (this.enemy.state == STATE_TOP) {
entity e = this.enemy;
plat_go_down(e);
}
void plat_crush(entity this, entity blocker)
{
- if((this.spawnflags & 4) && (blocker.takedamage != DAMAGE_NO))
+ if((this.spawnflags & PLAT_CRUSH) && (blocker.takedamage != DAMAGE_NO))
{ // KIll Kill Kill!!
#ifdef SVQC
Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0');
}
#endif
- if (this.state == 4)
+ if (this.state == STATE_UP)
plat_go_down (this);
- else if (this.state == 3)
+ else if (this.state == STATE_DOWN)
plat_go_up (this);
// when in other states, then the plat_crush event came delayed after
// plat state already had changed
void plat_use(entity this, entity actor, entity trigger)
{
this.use = func_null;
- if (this.state != 4)
+ if (this.state != STATE_UP)
objerror (this, "plat_use: not in up state");
plat_go_down(this);
}
IFTARGETED
{
setorigin(this, this.pos1);
- this.state = 4;
+ this.state = STATE_UP;
this.use = plat_use;
}
else
{
setorigin(this, this.pos2);
- this.state = 2;
+ this.state = STATE_BOTTOM;
this.use = plat_trigger_use;
}
#ifdef CSQC
// this stuff is defined in the server side engine VM, so we must define it separately here
.float takedamage;
-const float DAMAGE_NO = 0;
-const float DAMAGE_YES = 1;
-const float DAMAGE_AIM = 2;
-
-float STATE_TOP = 0;
-float STATE_BOTTOM = 1;
-float STATE_UP = 2;
-float STATE_DOWN = 3;
+const int DAMAGE_NO = 0;
+const int DAMAGE_YES = 1;
+const int DAMAGE_AIM = 2;
+
+const int STATE_TOP = 0;
+const int STATE_BOTTOM = 1;
+const int STATE_UP = 2;
+const int STATE_DOWN = 3;
.string noise, noise1, noise2, noise3; // contains names of wavs to play