Example #1
0
void door_use (edict_t *self, edict_t *other, edict_t *activator)
{
	edict_t	*ent;

	if (self->flags & FL_TEAMSLAVE)
		return;

	if (self->spawnflags & DOOR_TOGGLE)
	{
		if (self->moveinfo.state == STATE_UP || self->moveinfo.state == STATE_TOP)
		{
			// trigger all paired doors
			for (ent = self ; ent ; ent = ent->teamchain)
			{
				ent->message = NULL;
				ent->touch = NULL;
				door_go_down (ent);
			}
			return;
		}
	}
	
	// trigger all paired doors
	for (ent = self ; ent ; ent = ent->teamchain)
	{
		ent->message = NULL;
		ent->touch = NULL;
		door_go_up (ent, activator);
	}
};
Example #2
0
void door_blocked()
{
	other->deathtype = "squish";
	T_Damage( other, self, PROG_TO_EDICT( self->s.v.goalentity ), self->dmg );

// if a door has a negative wait, it would never come back if blocked,
// so let it just squash the object to death real fast
	if ( self->wait >= 0 )
	{
		if ( self->state == STATE_DOWN )
			door_go_up();
		else
			door_go_down();
	}
}
Example #3
0
void door_fire()
{
	gedict_t       *oself, *starte;

	if ( PROG_TO_EDICT( self->s.v.owner ) != self )
		G_Error( "door_fire: self.owner != self" );

// play use key sound

	if ( self->s.v.items )
		sound( self, CHAN_VOICE, self->noise4, 1, ATTN_NORM );

	self->s.v.message = 0;	// no more message
	oself = self;

	if ( ( int ) ( self->s.v.spawnflags ) & DOOR_TOGGLE )
	{
		if ( self->state == STATE_UP || self->state == STATE_TOP )
		{
			starte = self;
			do
			{
				door_go_down();

				self = PROG_TO_EDICT( self->s.v.enemy );
			}
			while ( ( self != starte ) && ( self != world ) );
			self = oself;
			return;
		}
	}
// trigger all paired doors
	starte = self;

	do
	{
		self->s.v.goalentity = EDICT_TO_PROG( activator );	// Who fired us
		door_go_up( self );
		self = PROG_TO_EDICT( self->s.v.enemy );
	}
	while ( ( self != starte ) && ( self != world ) );
	self = oself;
}
Example #4
0
void door_blocked  (edict_t *self, edict_t *other)
{
	edict_t	*ent;

	if (!(other->svflags & SVF_MONSTER) && (!other->client) )
	{
		// give it a chance to go away on it's own terms (like gibs)
		T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH);
		// if it's still there, nuke it
		if (other)
			BecomeExplosion1 (other);
		return;
	}

	T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, self->dmg, 1, 0, MOD_CRUSH);

	if (self->spawnflags & DOOR_CRUSHER)
		return;


// if a door has a negative wait, it would never come back if blocked,
// so let it just squash the object to death real fast
	if (self->moveinfo.wait >= 0)
	{
		if (self->moveinfo.state == STATE_DOWN)
		{
			for (ent = self->teammaster ; ent ; ent = ent->teamchain)
				door_go_up (ent, ent->activator);
		}
		else
		{
			for (ent = self->teammaster ; ent ; ent = ent->teamchain)
				door_go_down (ent);
		}
	}
}