当前位置: 首页>>代码示例>>C++>>正文


C++ FoundTarget函数代码示例

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


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


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