Example #1
0
//===================
// stalker_jump_straightup
//===================
void stalker_jump_straightup (edict_t *self)
{
	if (self->deadflag == DEAD_DEAD)
		return;

	if(STALKER_ON_CEILING(self))
	{
		if(stalker_ok_to_transition(self))
		{
//			gi.dprintf("falling off ceiling %d\n", self->health);
			self->gravityVector[2] = -1;
			self->s.angles[2] += 180.0;
			if(self->s.angles[2] > 360.0)
				self->s.angles[2] -= 360.0;
			self->groundentity = NULL;
		}
	}
	else if(self->groundentity)	// make sure we're standing on SOMETHING...
	{
		self->velocity[0] += ((random() * 10) - 5);
		self->velocity[1] += ((random() * 10) - 5);
		self->velocity[2] += -400 * self->gravityVector[2];
		if(stalker_ok_to_transition(self))
		{
//			gi.dprintf("falling TO ceiling %d\n", self->health);
			self->gravityVector[2] = 1;
			self->s.angles[2] = 180.0;
			self->groundentity = NULL;
		}
	}
}
Example #2
0
void stalker_pain (edict_t *self, edict_t *other, float kick, int damage)
{
	if (self->deadflag == DEAD_DEAD)
		return;

	if (self->health < (self->max_health / 2)) 
	{
		self->s.skinnum = 1;
	}

	if (skill->value == 3)
		return;		// no pain anims in nightmare

//	if (self->monsterinfo.aiflags & AI_DODGING)
//		monster_done_dodge (self);

	if (self->groundentity == NULL)
		return;

	// if we're reactivating or false dying, ignore the pain.
	if (self->monsterinfo.currentmove == &stalker_move_false_death_end ||
		self->monsterinfo.currentmove == &stalker_move_false_death_start )
		return;

	if (self->monsterinfo.currentmove == &stalker_move_false_death)
	{
		stalker_reactivate(self);
		return;
	}

	if ((self->health > 0) && (self->health < (self->max_health / 4)))
	{
		if(random() < (0.2 * skill->value))
		{
			if( !STALKER_ON_CEILING(self) || stalker_ok_to_transition(self) )
			{
//				gi.dprintf("starting false death sequence\n");
				stalker_false_death_start(self);
				return;
			}
		}	
	}

	if (level.time < self->pain_debounce_time)
		return;

	self->pain_debounce_time = level.time + 3;

//	gi.dprintf("stalker_pain\n");
	if (damage > 10)		// don't react unless the damage was significant
	{
		// stalker should dodge jump periodically to help avoid damage.
		if(self->groundentity && (random() < 0.5))
			stalker_dodge_jump(self);
		else
			self->monsterinfo.currentmove = &stalker_move_pain;

		gi.sound (self, CHAN_WEAPON, sound_pain, 1, ATTN_NORM, 0);
	}
}
Example #3
0
void
stalker_jump_straightup(edict_t *self)
{
	if (!self)
	{
		return;
	}

	if (self->deadflag == DEAD_DEAD)
	{
		return;
	}

	if (STALKER_ON_CEILING(self))
	{
		if (stalker_ok_to_transition(self))
		{
			self->gravityVector[2] = -1;
			self->s.angles[2] += 180.0;

			if (self->s.angles[2] > 360.0)
			{
				self->s.angles[2] -= 360.0;
			}

			self->groundentity = NULL;
		}
	}
	else if (self->groundentity) /* make sure we're standing on SOMETHING... */
	{
		self->velocity[0] += ((random() * 10) - 5);
		self->velocity[1] += ((random() * 10) - 5);
		self->velocity[2] += -400 * self->gravityVector[2];

		if (stalker_ok_to_transition(self))
		{
			self->gravityVector[2] = 1;
			self->s.angles[2] = 180.0;
			self->groundentity = NULL;
		}
	}
}
Example #4
0
qboolean stalker_blocked (edict_t *self, float dist)
{
	qboolean	onCeiling;

	if(!has_valid_enemy(self))
		return false;

	onCeiling = false;
	if(self->gravityVector[2] > 0)
		onCeiling = true;

	if(!onCeiling)
	{
		if(blocked_checkshot(self, 0.25 + (0.05 * skill->value) ))
		{
			return true;
		}

		if(visible (self, self->enemy))
		{
			stalker_do_pounce(self, self->enemy->s.origin);
			return true;
		}

		if(blocked_checkjump (self, dist, 256, 68))
		{
			stalker_jump (self);
			return true;
		}

		if(blocked_checkplat (self, dist))
			return true;
	}
	else
	{
		if(blocked_checkshot(self, 0.25 + (0.05 * skill->value) ))
		{
			return true;
		}	
		else if(stalker_ok_to_transition(self))
		{
			self->gravityVector[2] = -1;
			self->s.angles[2] += 180.0;
			if(self->s.angles[2] > 360.0)
				self->s.angles[2] -= 360.0;
			self->groundentity = NULL;
			
			return true;
		}
	}

	return false;
}
Example #5
0
qboolean stalker_blocked (edict_t *self, float dist)
{
	qboolean	onCeiling;

//	gi.dprintf("stalker_blocked\n");
	if(!has_valid_enemy(self))
		return false;

	onCeiling = false;
	if(self->gravityVector[2] > 0)
		onCeiling = true;

	if(!onCeiling)
	{
		if(blocked_checkshot(self, 0.25 + (0.05 * skill->value) ))
		{
//			gi.dprintf("blocked: shooting\n");
			return true;
		}

		if(visible (self, self->enemy))
		{
//			gi.dprintf("blocked: jumping at player!\n");
			stalker_do_pounce(self, self->enemy->s.origin);
			return true;
		}

		if(blocked_checkjump (self, dist, 256, 68))
		{
//			gi.dprintf("blocked: jumping up/down\n");
			stalker_jump (self);
			return true;
		}

		if(blocked_checkplat (self, dist))
			return true;
	}
	else
	{
		if(blocked_checkshot(self, 0.25 + (0.05 * skill->value) ))
		{
//			gi.dprintf("blocked: shooting\n");
			return true;
		}	
		else if(stalker_ok_to_transition(self))
		{
			self->gravityVector[2] = -1;
			self->s.angles[2] += 180.0;
			if(self->s.angles[2] > 360.0)
				self->s.angles[2] -= 360.0;
			self->groundentity = NULL;
			
//			gi.dprintf("falling off ceiling\n");
			return true;
		}
//		else
//			gi.dprintf("Not OK to fall!\n");
	}

	return false;
}
Example #6
0
void
stalker_pain(edict_t *self, edict_t *other /* unused */, float kick, int damage)
{
	if (!self)
	{
		return;
	}

	if (self->deadflag == DEAD_DEAD)
	{
		return;
	}

	if (self->health < (self->max_health / 2))
	{
		self->s.skinnum = 1;
	}

	if (skill->value == 3)
	{
		return; /* no pain anims in nightmare */
	}

	if (self->groundentity == NULL)
	{
		return;
	}

	/* if we're reactivating or false dying, ignore the pain. */
	if ((self->monsterinfo.currentmove == &stalker_move_false_death_end) ||
		(self->monsterinfo.currentmove == &stalker_move_false_death_start))
	{
		return;
	}

	if (self->monsterinfo.currentmove == &stalker_move_false_death)
	{
		stalker_reactivate(self);
		return;
	}

	if ((self->health > 0) && (self->health < (self->max_health / 4)))
	{
		if (random() < (0.2 * skill->value))
		{
			if (!STALKER_ON_CEILING(self) || stalker_ok_to_transition(self))
			{
				stalker_false_death_start(self);
				return;
			}
		}
	}

	if (level.time < self->pain_debounce_time)
	{
		return;
	}

	self->pain_debounce_time = level.time + 3;

	if (damage > 10) /* don't react unless the damage was significant */
	{
		/* stalker should dodge jump periodically to help avoid damage. */
		if (self->groundentity && (random() < 0.5))
		{
			stalker_dodge_jump(self);
		}
		else
		{
			self->monsterinfo.currentmove = &stalker_move_pain;
		}

		gi.sound(self, CHAN_WEAPON, sound_pain, 1, ATTN_NORM, 0);
	}
}