Beispiel #1
0
void
hunter_pain(edict_t *self, edict_t *other, float kick, int damage)
{
	edict_t *owner;
	float dist;
	vec3_t dir;

	if (!self || !other)
	{
		return;
	}

	if (self->enemy)
	{
		return;
	}

	owner = self->owner;

	if (!(self->spawnflags & SPHERE_DOPPLEGANGER))
	{
		if (owner && (owner->health > 0))
		{
			return;
		}

		if (other == owner)
		{
			return;
		}
	}
	else
	{
		/* if fired by a doppleganger, set it to 10 second timeout */
		self->wait = level.time + MINIMUM_FLY_TIME;
	}

	if ((self->wait - level.time) < MINIMUM_FLY_TIME)
	{
		self->wait = level.time + MINIMUM_FLY_TIME;
	}

	self->s.effects |= EF_BLASTER | EF_TRACKER;
	self->touch = hunter_touch;
	self->enemy = other;

	if ((self->spawnflags & SPHERE_DOPPLEGANGER) || !(owner && owner->client))
	{
		return;
	}

	if (!((int)dmflags->value & DF_FORCE_RESPAWN) &&
		(huntercam && (huntercam->value)))
	{
		VectorSubtract(other->s.origin, self->s.origin, dir);
		dist = VectorLength(dir);

		if (owner && (dist >= 192))
		{
			/* detach owner from body and send him flying */
			owner->movetype = MOVETYPE_FLYMISSILE;

			/* gib like we just died, even though we didn't, really. */
			body_gib(owner);

			/* move the sphere to the owner's current viewpoint./
			   we know it's a valid spot (or will be momentarily) */
			VectorCopy(owner->s.origin, self->s.origin);
			self->s.origin[2] += owner->viewheight;

			/* move the player's origin to the sphere's new origin */
			VectorCopy(self->s.origin, owner->s.origin);
			VectorCopy(self->s.angles, owner->s.angles);
			VectorCopy(self->s.angles, owner->client->v_angle);
			VectorClear(owner->mins);
			VectorClear(owner->maxs);
			VectorSet(owner->mins, -5, -5, -5);
			VectorSet(owner->maxs, 5, 5, 5);
			owner->client->ps.fov = 140;
			owner->s.modelindex = 0;
			owner->s.modelindex2 = 0;
			owner->viewheight = 8;
			owner->solid = SOLID_NOT;
			owner->flags |= FL_SAM_RAIMI;
			gi.linkentity(owner);

			self->solid = SOLID_BBOX;
			gi.linkentity(self);
		}
	}
}
Beispiel #2
0
// =================
// =================
void hunter_pain (edict_t *self, edict_t *other, float kick, int damage)
{
	edict_t	*owner;
	float	dist;
	vec3_t	dir;

	if(self->enemy)
		return;

	owner = self->owner;

	if(!(self->spawnflags & SPHERE_DOPPLEGANGER))
	{
		if(owner && (owner->health > 0))
			return;

		//PMM
		if(other == owner)
		{
//			if ((g_showlogic) && (g_showlogic->value))
//				gi.dprintf ("hunter: won't get mad at my owner!\n");
			return;
		}
		//pmm
	}
	else
	{
		// if fired by a doppleganger, set it to 10 second timeout
		self->wait = level.time + MINIMUM_FLY_TIME;
	}

	if((self->wait - level.time) < MINIMUM_FLY_TIME)
		self->wait = level.time + MINIMUM_FLY_TIME;
	self->s.effects |= EF_BLASTER | EF_TRACKER;
	self->touch = hunter_touch;
	self->enemy = other;

//	if(g_showlogic && g_showlogic->value)
//		gi.dprintf("hunter_pain: mad at %s\n", other->classname);

	// if we're not owned by a player, no sam raimi
	// if we're spawned by a doppleganger, no sam raimi
	if((self->spawnflags & SPHERE_DOPPLEGANGER)  || !(owner && owner->client))		
		return;

	// sam raimi cam is disabled if FORCE_RESPAWN is set.
	// sam raimi cam is also disabled if huntercam->value is 0.
	if(!((int)dmflags->value & DF_FORCE_RESPAWN) &&	(huntercam && (huntercam->value)))
	{
		VectorSubtract(other->s.origin, self->s.origin, dir);
		dist=VectorLength(dir);

		if(owner && (dist >= 192))
		{
			// detach owner from body and send him flying
			owner->movetype = MOVETYPE_FLYMISSILE;

			// gib like we just died, even though we didn't, really.
			body_gib(owner);

			// move the sphere to the owner's current viewpoint.
			// we know it's a valid spot (or will be momentarily)
			VectorCopy(owner->s.origin, self->s.origin);
			self->s.origin[2] += owner->viewheight;

			// move the player's origin to the sphere's new origin
			VectorCopy(self->s.origin, owner->s.origin);
			VectorCopy(self->s.angles, owner->s.angles);
			VectorCopy(self->s.angles, owner->client->v_angle);
			VectorClear(owner->mins);
			VectorClear(owner->maxs);
			VectorSet(owner->mins, -5, -5, -5);
			VectorSet(owner->maxs, 5, 5, 5);
			owner->client->ps.fov = 140;
			owner->s.modelindex = 0;
			owner->s.modelindex2 = 0;
			owner->viewheight = 8;
			owner->solid = SOLID_NOT;
			owner->flags |= FL_SAM_RAIMI;
			gi.linkentity(owner);

			// PMM - set bounding box so we don't clip out of world
//			VectorSet(self->mins, -5, -5, -5);
//			VectorSet(self->maxs, 5, 5, 5);
			self->solid = SOLID_BBOX;
			gi.linkentity (self);
		}
//		else
//			gi.dprintf("too close for sam raimi cam\n");
	}
}