• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FoundTarget函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FoundTarget函数的典型用法代码示例。如果您正苦于以下问题:C++ FoundTarget函数的具体用法?C++ FoundTarget怎么用?C++ FoundTarget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FoundTarget函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: M_ReactToDamage

void M_ReactToDamage(edict_t *targ, edict_t *attacker){
	if(!(attacker->client) && !(attacker->svflags & SVF_MONSTER))
		return;
		
	if(attacker == targ || attacker == targ->enemy)
		return;
		
	// if we are a good guy monster and our attacker is a player
	// or another good guy, do not get mad at them
	if(targ->monsterinfo.aiflags & AI_GOOD_GUY){
		if(attacker->client ||(attacker->monsterinfo.aiflags & AI_GOOD_GUY))
			return;
	}
	
	// we now know that we are not both good guys
	
	// if attacker is a client, get mad at them because he's good and we're not
	if(attacker->client){
		// this can only happen in coop(both new and old enemies are clients)
		// only switch if can't see the current enemy
		if(targ->enemy && targ->enemy->client){
			if(visible(targ, targ->enemy)){
				targ->oldenemy = attacker;
				return;
			}
			targ->oldenemy = targ->enemy;
		}
		targ->enemy = attacker;
		if(!(targ->monsterinfo.aiflags & AI_DUCKED))
			FoundTarget(targ);
		return;
	}
	
	// it's the same base(walk/swim/fly) type and a different classname and it's not a tank
	//(they spray too much), get mad at them
	if(((targ->flags &(FL_FLY | FL_SWIM)) ==(attacker->flags &(FL_FLY | FL_SWIM))) &&
			(strcmp(targ->classname, attacker->classname) != 0) &&
			(strcmp(attacker->classname, "monster_tank") != 0) &&
			(strcmp(attacker->classname, "monster_supertank") != 0) &&
			(strcmp(attacker->classname, "monster_makron") != 0) &&
			(strcmp(attacker->classname, "monster_jorg") != 0)){
		if(targ->enemy)
			if(targ->enemy->client)
				targ->oldenemy = targ->enemy;
		targ->enemy = attacker;
		if(!(targ->monsterinfo.aiflags & AI_DUCKED))
			FoundTarget(targ);
	} else
		// otherwise get mad at whoever they are mad at(help our buddy)
	{
		if(targ->enemy)
			if(targ->enemy->client)
				targ->oldenemy = targ->enemy;
		targ->enemy = attacker->enemy;
		FoundTarget(targ);
	}
}
开发者ID:luaman,项目名称:qforge-2,代码行数:57,代码来源:g_combat.c


示例2: GetMadAtAttacker

/*
=============
GetMadAtAttacker

T_Damage calls this when a monster is hurt
=============
*/
void GetMadAtAttacker( gedict_t *attacker )
{
	if ( !attacker || attacker == world )
		return; // ignore world attacks

	if ( k_bloodfest && attacker->ct != ctPlayer)
		return; // in bloodfest mode get mad only on players.

	if ( attacker == self )
		return; // do not mad on self.
	
	if ( attacker == PROG_TO_EDICT( self->s.v.enemy ))
		return; // alredy mad on this.

	// get mad unless of the same class (except for soldiers)
	if (   streq( self->s.v.classname, attacker->s.v.classname )
		&& strneq( self->s.v.classname, "monster_army" ) 
	)
		return; 

	// OK, we are MAD!

	// remember current enemy if it was "player enemy", later we restore it
	if ( PROG_TO_EDICT( self->s.v.enemy )->ct == ctPlayer )
		self->oldenemy = PROG_TO_EDICT( self->s.v.enemy );

	// set new enemy
	self->s.v.enemy = EDICT_TO_PROG( attacker );

	FoundTarget ();
}
开发者ID:JosephPecoraro,项目名称:ktx,代码行数:38,代码来源:sp_ai.c


示例3: medic_run

void medic_run (edict_t *self)
{
	monster_done_dodge (self);
	if (!(self->monsterinfo.aiflags & AI_MEDIC))
	{
		edict_t	*ent;

		ent = medic_FindDeadMonster(self);
		if (ent)
		{
			self->oldenemy = self->enemy;
			self->enemy = ent;
			self->enemy->monsterinfo.healer = self;
			self->monsterinfo.aiflags |= AI_MEDIC;
			FoundTarget (self);
			return;
		}
	}
//	else if (!canReach(self, self->enemy))
//	{
//		abortHeal (self, 0);
//	}

	if (self->monsterinfo.aiflags & AI_STAND_GROUND)
		self->monsterinfo.currentmove = &medic_move_stand;
	else
		self->monsterinfo.currentmove = &medic_move_run;
}
开发者ID:ajbonner,项目名称:yet-another-quake2-fork,代码行数:28,代码来源:m_medic.c


示例4: medic_search

void
medic_search(edict_t *self)
{
	edict_t *ent;

	if (!self)
	{
		return;
	}

	gi.sound(self, CHAN_VOICE, sound_search, 1, ATTN_IDLE, 0);

	if (!self->oldenemy)
	{
		ent = medic_FindDeadMonster(self);

		if (ent)
		{
			self->oldenemy = self->enemy;
			self->enemy = ent;
			self->enemy->owner = self;
			self->monsterinfo.aiflags |= AI_MEDIC;
			FoundTarget(self);
		}
	}
}
开发者ID:Clever-Boy,项目名称:yquake2,代码行数:26,代码来源:medic.c


示例5: monster_use

/*
================
monster_use

Using a monster makes it angry at the current activator
================
*/
void monster_use (edict_t *self, edict_t *other, edict_t *activator)
{
	if (self->enemy)
		return;
	if (self->health <= 0)
		return;
	if (activator->flags & FL_NOTARGET)
		return;
	if (!(activator->client) && !(activator->monsterinfo.aiflags & AI_GOOD_GUY))
		return;
	if (activator->flags & FL_DISGUISED)
		return;

	// if monster is "used" by player, turn off good guy stuff
	if (activator->client)
	{
		self->spawnflags &= ~SF_MONSTER_GOODGUY;
		self->monsterinfo.aiflags &= ~(AI_GOOD_GUY + AI_FOLLOW_LEADER);
		if(self->dmgteam && !Q_strcasecmp(self->dmgteam,"player"))
			self->dmgteam = NULL;
	}

// delay reaction so if the monster is teleported, its sound is still heard
	self->enemy = activator;
	FoundTarget (self);
}
开发者ID:qbism,项目名称:qbq2,代码行数:33,代码来源:g_monster.c


示例6: medic_run

void
medic_run(edict_t *self)
{
	if (!self)
	{
		return;
	}

	if (!(self->monsterinfo.aiflags & AI_MEDIC))
	{
		edict_t *ent;

		ent = medic_FindDeadMonster(self);

		if (ent)
		{
			self->oldenemy = self->enemy;
			self->enemy = ent;
			self->enemy->owner = self;
			self->monsterinfo.aiflags |= AI_MEDIC;
			FoundTarget(self);
			return;
		}
	}

	if (self->monsterinfo.aiflags & AI_STAND_GROUND)
	{
		self->monsterinfo.currentmove = &medic_move_stand;
	}
	else
	{
		self->monsterinfo.currentmove = &medic_move_run;
	}
}
开发者ID:Clever-Boy,项目名称:yquake2,代码行数:34,代码来源:medic.c


示例7: stalker_dodge

void
stalker_dodge(edict_t *self, edict_t *attacker, float eta, trace_t *tr /* unused */)
{
	if (!self || !attacker)
	{
		return;
	}

	if (!self->groundentity || (self->health <= 0))
	{
		return;
	}

	if (!self->enemy)
	{
		self->enemy = attacker;
		FoundTarget(self);
		return;
	}

	if ((eta < 0.1) || (eta > 5))
	{
		return;
	}

	/* this will override the foundtarget call of stalker_run */
	stalker_dodge_jump(self);
}
开发者ID:acebox,项目名称:yquake2_acemod,代码行数:28,代码来源:stalker.c


示例8: monster_triggered_spawn

void monster_triggered_spawn (edict_t *self)
{
	self->s.origin[2] += 1;
	MonsterKillBox (self);

	self->solid = SOLID_BBOX;
	self->movetype = MOVETYPE_STEP;
	self->svflags &= ~SVF_NOCLIENT;
	self->air_finished = level.time + 12;
	gi.linkentity (self);

	monster_start_go (self);

	if (self->enemy && !(self->spawnflags & 1) && !(self->enemy->flags & FL_NOTARGET))
	{
		FoundTarget (self);
	}
	else
	{
		self->enemy = NULL;
	}

	// some sort of spawn effect
	// TODO good enough?
	self->s.event = EV_PLAYER_TELEPORT;
	MonsterPlayerKillBox(self);
}
开发者ID:yquake2,项目名称:zaero,代码行数:27,代码来源:g_monster.c


示例9: while

edict_t *medic_FindDeadMonster (edict_t *self)
{
	edict_t	*ent = NULL;
	edict_t	*best = NULL;

	while ((ent = findradius(ent, self->s.origin, 1024)) != NULL)
	{
		if (ent == self)
			continue;
		if (!(ent->svflags & SVF_MONSTER))
			continue;
		if (ent->monsterinfo.aiflags & AI_GOOD_GUY)
			continue;
		if (ent->owner)
			continue;
		if (ent->health > 0)
			continue;
		if (ent->nextthink && (ent->think != M_FliesOff) && (ent->think != M_FliesOn))
			continue;
		// check to make sure we haven't bailed on this guy already
		if ((ent->monsterinfo.badMedic1 == self) || (ent->monsterinfo.badMedic2 == self))
			continue;
		if (!visible(self, ent))
			continue;
		if (embedded(ent))
			continue;
		if (!canReach(self,ent))
			continue;
		if (!best)
		{
			best = ent;
			continue;
		}
		if (ent->max_health <= best->max_health)
			continue;
		best = ent;
	}

	if(best)
	{
		self->oldenemy = self->enemy;
		self->enemy = best;
		self->enemy->owner = best;
		self->monsterinfo.aiflags |= AI_MEDIC;
		self->monsterinfo.aiflags &= ~AI_MEDIC_PATROL;
		self->monsterinfo.medicTries = 0;
		self->movetarget = self->goalentity = NULL;
		self->enemy->monsterinfo.healer = self;
		self->timestamp = level.time + MEDIC_TRY_TIME;
		FoundTarget (self);

		if(developer->value)
			gi.dprintf("medic found dead monster: %s at %s\n",
			best->classname,vtos(best->s.origin));

	}
	return best;
}
开发者ID:qbism,项目名称:qbq2,代码行数:58,代码来源:m_medic.c


示例10: monster_use

/*
================
monster_use
 
Using a monster makes it angry at the current activator
================
*/
void monster_use(edict_t *self, edict_t *other, edict_t *activator){
	if(self->enemy)
		return;
	if(self->health <= 0)
		return;
	if(activator->flags & FL_NOTARGET)
		return;
	if(!(activator->client) && !(activator->monsterinfo.aiflags & AI_GOOD_GUY))
		return;
		
	// delay reaction so if the monster is teleported, its sound is still heard
	self->enemy = activator;
	FoundTarget(self);
}
开发者ID:luaman,项目名称:qforge-2,代码行数:21,代码来源:g_monster.c


示例11: medic_idle

void medic_idle(edict_t * self)
{
	edict_t *ent;

	gi.sound(self, CHAN_VOICE, sound_idle1, 1, ATTN_IDLE, 0);

	ent = medic_FindDeadMonster(self);
	if (ent) {
		self->enemy = ent;
		self->enemy->owner = self;
		self->monsterinfo.aiflags |= AI_MEDIC;
		FoundTarget(self);
	}
}
开发者ID:slapin,项目名称:q2game-lua,代码行数:14,代码来源:m_medic.c


示例12: WidowSpawn

void
WidowSpawn(edict_t *self)
{
	vec3_t f, r, u, offset, startpoint, spawnpoint;
	edict_t *ent, *designated_enemy;
	int i;

	if (!self)
	{
		return;
	}

	AngleVectors(self->s.angles, f, r, u);

	for (i = 0; i < 2; i++)
	{
		VectorCopy(spawnpoints[i], offset);

		G_ProjectSource2(self->s.origin, offset, f, r, u, startpoint);

		if (FindSpawnPoint(startpoint, stalker_mins, stalker_maxs, spawnpoint,
					64))
		{
			ent = CreateGroundMonster(spawnpoint, self->s.angles, stalker_mins, stalker_maxs,
					"monster_stalker", 256);

			if (!ent)
			{
				continue;
			}

			self->monsterinfo.monster_used++;
			ent->monsterinfo.commander = self;
			ent->nextthink = level.time;
			ent->think(ent);

			ent->monsterinfo.aiflags |= /* AI_SPAWNED_WIDOW | */ AI_DO_NOT_COUNT | AI_IGNORE_SHOTS;

			designated_enemy = self->enemy;

			if ((designated_enemy->inuse) && (designated_enemy->health > 0))
			{
				ent->enemy = designated_enemy;
				FoundTarget(ent);
				ent->monsterinfo.attack(ent);
			}
		}
	}
}
开发者ID:acebox,项目名称:yquake2_acemod,代码行数:49,代码来源:widow.c


示例13: fixbot_search

int fixbot_search (edict_t *self)
{
	edict_t	*ent;

	if (!self->goalentity)
	{
		ent = fixbot_FindDeadMonster(self);
		if (ent)
		{
			self->oldenemy = self->enemy;
			self->enemy = ent;
			self->enemy->owner = self;
			self->monsterinfo.aiflags |= AI_MEDIC;
			FoundTarget (self);
			return (1);
		}
	}
	return (0);
}
开发者ID:DrItanium,项目名称:xatrix,代码行数:19,代码来源:fixbot.c


示例14: hintpath_stop

/*
=====================
hintpath_stop

Makes a monster stop following hint_paths.
=====================
*/
void hintpath_stop (edict_t *monster)
{
	monster->movetarget = monster->goalentity = NULL;
	monster->monsterinfo.last_hint_time = level.time;
	monster->monsterinfo.goal_hint = NULL;
	monster->monsterinfo.aiflags &= ~AI_HINT_PATH;

	// If we don't have an enemy to get mad at, just stand around like an unactivated monster.
	if (!has_valid_enemy(monster))
	{
		monster->enemy = NULL;
		monster->monsterinfo.pausetime = level.time + 100000000;
		monster->monsterinfo.stand (monster);
	}
	else if (visible(monster, monster->enemy)) 	// attack if we can see our foe
		FoundTarget (monster);
	else // keep pursuing
		HuntTarget (monster);
}
开发者ID:AimHere,项目名称:thirty-flights-of-linux,代码行数:26,代码来源:g_moreai.c


示例15: stalker_dodge

void stalker_dodge (edict_t *self, edict_t *attacker, float eta, trace_t *tr)
{
	if (!self->groundentity || self->health <= 0)
		return;

	if (!self->enemy)
	{
		self->enemy = attacker;
		FoundTarget(self);
		return;
	}
	
	// PMM - don't bother if it's going to hit anyway; fix for weird in-your-face etas (I was
	// seeing numbers like 13 and 14)
	if ((eta < 0.1) || (eta > 5))
		return;

	// this will override the foundtarget call of stalker_run
	stalker_dodge_jump(self);
}
开发者ID:ZwS,项目名称:qudos,代码行数:20,代码来源:m_stalker.c


示例16: medic_StopPatrolling

void medic_StopPatrolling (edict_t *self)
{
	self->goalentity = NULL;
	self->movetarget = NULL;
	self->monsterinfo.aiflags &= ~AI_MEDIC_PATROL;
	if (!(self->monsterinfo.aiflags & AI_MEDIC))
	{
		if(medic_FindDeadMonster(self))
			return;
	}
	if (has_valid_enemy(self))
	{
		if (visible(self, self->enemy))
		{
			FoundTarget (self);
			return;
		}
		HuntTarget (self);
		return;
	}
	if(self->monsterinfo.aiflags & AI_MEDIC)
		abortHeal(self,false);
}
开发者ID:qbism,项目名称:qbq2,代码行数:23,代码来源:m_medic.c


示例17: medic_search

void medic_search (edict_t *self)
{
	edict_t	*ent;

	// PMM - commander sounds
	if (self->mass == 400)
		gi.sound (self, CHAN_VOICE, sound_search, 1, ATTN_IDLE, 0);
	else
		gi.sound (self, CHAN_VOICE, commander_sound_search, 1, ATTN_IDLE, 0);

	if (!self->oldenemy)
	{
		ent = medic_FindDeadMonster(self);
		if (ent)
		{
			self->oldenemy = self->enemy;
			self->enemy = ent;
			self->enemy->monsterinfo.healer = self;
			self->monsterinfo.aiflags |= AI_MEDIC;
			FoundTarget (self);
		}
	}
}
开发者ID:ajbonner,项目名称:yet-another-quake2-fork,代码行数:23,代码来源:m_medic.c


示例18: EyePosition


//.........这里部分代码省略.........
	Vector vecTargetCenter;
	float flMinDist2 = 1100.0f * 1100.0f;
	CBaseEntity *pTargetCurrent = NULL;
	CBaseEntity *pTargetOld = m_hEnemy.Get();
	float flOldTargetDist2 = FLT_MAX;

	// Sentries will try to target players first, then objects.  However, if the enemy held was an object it will continue
	// to try and attack it first.

	for (int i = 0; i < pTeamList.Size(); i++)
	{
		int nTeamCount = pTeamList[i]->GetNumPlayers();
		for (int iPlayer = 0; iPlayer < nTeamCount; ++iPlayer)
		{
			CTFPlayer *pTargetPlayer = static_cast<CTFPlayer*>(pTeamList[i]->GetPlayer(iPlayer));
			if (pTargetPlayer == NULL)
				continue;

			// Make sure the player is alive.
			if (!pTargetPlayer->IsAlive())
				continue;

			if (pTargetPlayer->GetFlags() & FL_NOTARGET)
				continue;

			vecTargetCenter = pTargetPlayer->GetAbsOrigin();
			vecTargetCenter += pTargetPlayer->GetViewOffset();
			VectorSubtract(vecTargetCenter, vecSentryOrigin, vecSegment);
			float flDist2 = vecSegment.LengthSqr();

			// Store the current target distance if we come across it
			if (pTargetPlayer == pTargetOld)
			{
				flOldTargetDist2 = flDist2;
			}

			// Check to see if the target is closer than the already validated target.
			if (flDist2 > flMinDist2)
				continue;

			// It is closer, check to see if the target is valid.
			if (ValidTargetPlayer(pTargetPlayer, vecSentryOrigin, vecTargetCenter))
			{
				flMinDist2 = flDist2;
				pTargetCurrent = pTargetPlayer;
			}
		}

		// If we already have a target, don't check objects.
		if (pTargetCurrent == NULL)
		{
			int nTeamObjectCount = pTeamList[i]->GetNumObjects();
			for (int iObject = 0; iObject < nTeamObjectCount; ++iObject)
			{
				CBaseObject *pTargetObject = pTeamList[i]->GetObject(iObject);
				if (!pTargetObject)
					continue;

				vecTargetCenter = pTargetObject->GetAbsOrigin();
				vecTargetCenter += pTargetObject->GetViewOffset();
				VectorSubtract(vecTargetCenter, vecSentryOrigin, vecSegment);
				float flDist2 = vecSegment.LengthSqr();

				// Store the current target distance if we come across it
				if (pTargetObject == pTargetOld)
				{
					flOldTargetDist2 = flDist2;
				}

				// Check to see if the target is closer than the already validated target.
				if (flDist2 > flMinDist2)
					continue;

				// It is closer, check to see if the target is valid.
				if (ValidTargetObject(pTargetObject, vecSentryOrigin, vecTargetCenter))
				{
					flMinDist2 = flDist2;
					pTargetCurrent = pTargetObject;
				}
			}
		}
		// We have a target.
		if (pTargetCurrent)
		{
			if (pTargetCurrent != pTargetOld)
			{
				// flMinDist2 is the new target's distance
				// flOldTargetDist2 is the old target's distance
				// Don't switch unless the new target is closer by some percentage
				if (flMinDist2 < (flOldTargetDist2 * 0.75f))
				{
					FoundTarget(pTargetCurrent, vecSentryOrigin);
				}
			}
			return true;
		}
	}

	return false;
}
开发者ID:MrBoomer568,项目名称:TF2Classic,代码行数:101,代码来源:tf_obj_sentrygun.cpp


示例19: noise

/*
===============
PlayerNoise

Each player can have two noise objects associated with it:
a personal noise (jumping, pain, weapon firing), and a weapon
target noise (bullet wall impacts)

Monsters that don't directly see the player can move
to a noise in hopes of seeing the player from there.
===============
*/
void PlayerNoise(edict_t *who, vec3_t where, int type) {
	edict_t		*noise;
	edict_t		*blip = NULL;
return;
	if (deathmatch->value && !dmmonsters->value)
		return;

	if (who->flags & FL_NOTARGET)
		return;

	if (type == PNOISE_WEAPON) {
		if (who->client->silencer_shots > 0) {
			who->client->silencer_shots--;
			return;
		} else {
			who->client->silencer_shots = 0;
		}
	}

	if (!who->mynoise) {
		noise = G_Spawn();
		noise->classid = CI_P_NOISE;
		noise->classname = "player noise";
		VectorSet (noise->mins, -8, -8, -8);
		VectorSet (noise->maxs, 8, 8, 8);
		noise->owner = who;
		noise->svflags = SVF_NOCLIENT;
		who->mynoise = noise;

		noise = G_Spawn();
		noise->classid = CI_P_NOISE;
		noise->classname = "player noise";
		VectorSet (noise->mins, -8, -8, -8);
		VectorSet (noise->maxs, 8, 8, 8);
		noise->owner = who;
		noise->svflags = SVF_NOCLIENT;
		who->mynoise2 = noise;
	}

	// Zheele
	while ((blip = findradius(blip, where, 750)) != NULL) {
		if (!blip->inuse)
			continue;
		if (!blip->takedamage)
			continue;
		if (!(blip->svflags & SVF_MONSTER) || (blip->monsterinfo.aiflags & AI_GOOD_GUY))
			continue;
		if ((!blip->monsterinfo.aggressive) && (deathmatch->value) && (game.craze != 10) && (game.monsterhunt != 10))
			continue;
		if (blip->enemy)
			continue;
		if (((float) pow(who->radius_dmg, GIEX_MONSTER_PLAYERLEVEL_MULT_POW) * GIEX_MONSTER_PLAYERLEVEL_MULT) < ((float) blip->monsterinfo.skill * 0.75) && (game.monsterhunt != 10)) {
			continue;
		}
		blip->enemy = who;
		FoundTarget(blip);
		if (!(blip->monsterinfo.aiflags & AI_SOUND_TARGET) && (blip->monsterinfo.sight))
			blip->monsterinfo.sight (blip, blip->enemy);
	}

	if (type == PNOISE_SELF || type == PNOISE_WEAPON)
	{
		noise = who->mynoise;
		level.sound_entity = noise;
		level.sound_entity_framenum = level.framenum;
	}
	else // type == PNOISE_IMPACT
	{
		noise = who->mynoise2;
		level.sound2_entity = noise;
		level.sound2_entity_framenum = level.framenum;
	}

	VectorCopy (where, noise->s.origin);
	VectorSubtract (where, noise->maxs, noise->absmin);
	VectorAdd (where, noise->maxs, noise->absmax);
	noise->teleport_time = level.time;
	gi.linkentity (noise);
}
开发者ID:Chromozon,项目名称:Quake2_Giex-G10,代码行数:91,代码来源:p_weapon.c


示例20: medic_cable_attack

void
medic_cable_attack(edict_t *self)
{
	vec3_t offset, start, end, f, r;
	trace_t tr;
	vec3_t dir, angles;
	float distance;

	if (!self)
	{
		return;
	}

	if (!self->enemy->inuse)
	{
		return;
	}

	AngleVectors(self->s.angles, f, r, NULL);
	VectorCopy(medic_cable_offsets[self->s.frame - FRAME_attack42], offset);
	G_ProjectSource(self->s.origin, offset, f, r, start);

	/* check for max distance */
	VectorSubtract(start, self->enemy->s.origin, dir);
	distance = VectorLength(dir);

	if (distance > 256)
	{
		return;
	}

	/* check for min/max pitch */
	vectoangles(dir, angles);

	if (angles[0] < -180)
	{
		angles[0] += 360;
	}

	if (fabs(angles[0]) > 45)
	{
		return;
	}

	tr = gi.trace(start, NULL, NULL, self->enemy->s.origin, self, MASK_SHOT);

	if ((tr.fraction != 1.0) && (tr.ent != self->enemy))
	{
		return;
	}

	if (self->s.frame == FRAME_attack43)
	{
		gi.sound(self->enemy, CHAN_AUTO, sound_hook_hit, 1, ATTN_NORM, 0);
		self->enemy->monsterinfo.aiflags |= AI_RESURRECTING;
	}
	else if (self->s.frame == FRAME_attack50)
	{
		self->enemy->spawnflags = 0;
		self->enemy->monsterinfo.aiflags = 0;
		self->enemy->target = NULL;
		self->enemy->targetname = NULL;
		self->enemy->combattarget = NULL;
		self->enemy->deathtarget = NULL;
		self->enemy->owner = self;
		ED_CallSpawn(self->enemy);
		self->enemy->owner = NULL;

		if (self->enemy->think)
		{
			self->enemy->nextthink = level.time;
			self->enemy->think(self->enemy);
		}

		self->enemy->monsterinfo.aiflags |= AI_RESURRECTING;

		if (self->oldenemy && self->oldenemy->client)
		{
			self->enemy->enemy = self->oldenemy;
			FoundTarget(self->enemy);
		}
	}
	else
	{
		if (self->s.frame == FRAME_attack44)
		{
			gi.sound(self, CHAN_WEAPON, sound_hook_heal, 1, ATTN_NORM, 0);
		}
	}

	/* adjust start for beam origin being in middle of a segment */
	VectorMA(start, 8, f, start);

	/* adjust end z for end spot since the monster is currently dead */
	VectorCopy(self->enemy->s.origin, end);
	end[2] = self->enemy->absmin[2] + self->enemy->size[2] / 2;

	gi.WriteByte(svc_temp_entity);
	gi.WriteByte(TE_MEDIC_CABLE_ATTACK);
	gi.WriteShort(self - g_edicts);
//.........这里部分代码省略.........
开发者ID:Clever-Boy,项目名称:yquake2,代码行数:101,代码来源:medic.c



注:本文中的FoundTarget函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Fprintf函数代码示例发布时间:2022-05-30
下一篇:
C++ Forward函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap