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

C++ G_Find函数代码示例

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

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



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

示例1: CheckAlmostCapture

/*
==================
CheckAlmostCapture
==================
*/
void CheckAlmostCapture( gentity_t *self, gentity_t *attacker ) {
	gentity_t	*ent;
	vec3_t		dir;
	char		*classname;

	// if this player was carrying a flag
	if ( self->player->ps.powerups[PW_REDFLAG] ||
		self->player->ps.powerups[PW_BLUEFLAG] ||
		self->player->ps.powerups[PW_NEUTRALFLAG] ) {
		// get the goal flag this player should have been going for
		if ( g_gametype.integer == GT_CTF ) {
			if ( self->player->sess.sessionTeam == TEAM_BLUE ) {
				classname = "team_CTF_blueflag";
			}
			else {
				classname = "team_CTF_redflag";
			}
		}
		else {
			if ( self->player->sess.sessionTeam == TEAM_BLUE ) {
				classname = "team_CTF_redflag";
			}
			else {
				classname = "team_CTF_blueflag";
			}
		}
		ent = NULL;
		do
		{
			ent = G_Find(ent, FOFS(classname), classname);
		} while (ent && (ent->flags & FL_DROPPED_ITEM));
		// if we found the destination flag and it's not picked up
		if (ent && !(ent->r.svFlags & SVF_NOCLIENT) ) {
			// if the player was *very* close
			VectorSubtract( self->player->ps.origin, ent->s.origin, dir );
			if ( VectorLength(dir) < 200 ) {
				self->player->ps.persistant[PERS_PLAYEREVENTS] ^= PLAYEREVENT_HOLYSHIT;
				if ( attacker->player ) {
					attacker->player->ps.persistant[PERS_PLAYEREVENTS] ^= PLAYEREVENT_HOLYSHIT;
				}
			}
		}
	}
}
开发者ID:mecwerks,项目名称:revamp,代码行数:49,代码来源:g_combat.c


示例2: fx_target_beam_link

//------------------------------------------
void fx_target_beam_link( gentity_t *ent )
{
	gentity_t	*target = NULL;
	vec3_t		dir;

	target = G_Find( target, FOFS(targetname), ent->target );

	if ( !target )
	{
		Com_Printf( "bolt_link: unable to find target %s\n", ent->target );
		G_FreeEntity( ent );
		return;
	}

	ent->attackDebounceTime = level.time;

	if ( !target->classname || Q_stricmp( "info_null", target->classname ) )
	{//don't want to set enemy to something that's going to free itself... actually, this could be bad in other ways, too... ent pointer could be freed up and re-used by the time we check it next
		G_SetEnemy( ent, target );
	}
	VectorSubtract( target->s.origin, ent->s.origin, dir );//er, does it ever use dir?
	VectorNormalize( dir );//er, does it use len or dir?
	vectoangles( dir, ent->s.angles );//er, does it use s.angles?

	VectorCopy( target->s.origin, ent->s.origin2 );

	if ( ent->spawnflags & 1 )
	{
		// Do nothing
		ent->e_ThinkFunc	= thinkF_NULL;
	}
	else
	{
		if ( !(ent->spawnflags & 8 )) // one_shot, only calls when used
		{
			// switch think functions to avoid doing the bolt_link every time
			ent->e_ThinkFunc = thinkF_fx_target_beam_think;
			ent->nextthink	= level.time + FRAMETIME;
		}
	}

	ent->e_UseFunc = useF_fx_target_beam_use;
	gi.linkentity( ent );
}
开发者ID:BSzili,项目名称:OpenJK,代码行数:45,代码来源:g_fx.cpp


示例3: Use_Target_Lock

/*
==============
Use_Target_Lock
==============
*/
void Use_Target_Lock(gentity_t *ent, gentity_t *other, gentity_t *activator)
{
	gentity_t *t = 0;

	while ((t = G_Find(t, FOFS(targetname), ent->target)) != NULL)
	{
//		G_Printf("target_lock locking entity with key: %d\n", ent->count);
		t->key = ent->key;
		if (t->key)
		{
			G_SetAASBlockingEntity(t, AAS_AREA_DISABLED);
		}
		else
		{
			G_SetAASBlockingEntity(t, AAS_AREA_ENABLED);
		}
	}

}
开发者ID:morsik,项目名称:war-territory,代码行数:24,代码来源:g_target.c


示例4: G_ScriptAction_Trigger

/*
=================
G_ScriptAction_Trigger

  syntax: trigger <aiName/scriptName> <trigger>

  Calls the specified trigger for the given ai character or script entity
=================
*/
qboolean G_ScriptAction_Trigger( gentity_t *ent, char *params )
{
	gentity_t *trent;
	char *pString, name[MAX_QPATH], trigger[MAX_QPATH], *token;
	int oldId;

	// get the cast name
	pString = params;
	token = COM_ParseExt( &pString, qfalse );
	Q_strncpyz( name, token, sizeof(name) );
	if (!name[0])
	{
		G_Error( "G_Scripting: trigger must have a name and an identifier\n" );
	}

	token = COM_ParseExt( &pString, qfalse );
	Q_strncpyz( trigger, token, sizeof(trigger) );
	if (!trigger[0])
	{
		G_Error( "G_Scripting: trigger must have a name and an identifier\n" );
	}

//	trent = AICast_FindEntityForName( name );
		trent = NULL;
	if (trent)
	{	// we are triggering an AI
		//oldId = trent->scriptStatus.scriptId;
//		AICast_ScriptEvent( AICast_GetCastState( trent->s.number ), "trigger", trigger );
		return qtrue;
	}

	// look for an entity
	trent = G_Find( &g_entities[MAX_CLIENTS], FOFS(scriptName), name );
	if (trent) {
		oldId = trent->scriptStatus.scriptId;
		G_Script_ScriptEvent( trent, "trigger", trigger );
		// if the script changed, return false so we don't muck with it's variables
		return ((trent != ent) || (oldId == trent->scriptStatus.scriptId));
	}

	G_Error( "G_Scripting: trigger has unknown name: %s\n", name );
	return qfalse;	// shutup the compiler
}
开发者ID:nobowned,项目名称:rtcw-2.3,代码行数:52,代码来源:g_script_actions.c


示例5: misc_viper_bomb_use

void misc_viper_bomb_use (edict_t *self, edict_t *other, edict_t *activator)
{
	edict_t	*viper;

	self->solid = SOLID_BBOX;
	self->svflags &= ~SVF_NOCLIENT;
	self->s.effects |= EF_ROCKET;
	self->use = NULL;
	self->movetype = MOVETYPE_TOSS;
	self->prethink = misc_viper_bomb_prethink;
	self->touch = misc_viper_bomb_touch;
	self->activator = activator;

	viper = G_Find (NULL, FOFS(classname), "misc_viper");
	VectorScale (viper->moveinfo.dir, viper->moveinfo.speed, self->velocity);

	self->timestamp = level.time;
	VectorCopy (viper->moveinfo.dir, self->moveinfo.dir);
}
开发者ID:AJenbo,项目名称:Quake-2,代码行数:19,代码来源:g_misc.c


示例6: Tag_PostInitSetup

//=================
//=================
void Tag_PostInitSetup (void)
{
	edict_t		*e;
	vec3_t		origin, angles;

	// automatic spawning of tag token if one is not present on map.
	e = G_Find (NULL, FOFS(classname), "dm_tag_token");
	if(e == NULL)
	{
		e = G_Spawn();
		e->classname = "dm_tag_token";

		SelectSpawnPoint (e, origin, angles);
		VectorCopy(origin, e->s.origin);
		VectorCopy(origin, e->s.old_origin);
		VectorCopy(angles, e->s.angles);
		SP_dm_tag_token (e);
	}
}
开发者ID:MaddTheSane,项目名称:Quake2-Rogue,代码行数:21,代码来源:dm_tag.c


示例7: CreateTargetChangeLevel

/*
* G_ChooseNextMap
*/
static edict_t *G_ChooseNextMap( void )
{
	edict_t	*ent = NULL;
	const char *next;

	if( *level.forcemap )
	{
		return CreateTargetChangeLevel( level.forcemap );
	}

	if( !( *g_maplist->string ) || g_maplist->string[0] == '\0' || g_maprotation->integer == 0 )
	{
		// same map again
		return CreateTargetChangeLevel( level.mapname );
	}
	else if( g_maprotation->integer == 1 )
	{
		next = G_MapRotationNormal();

		// not in the list, we go for the first one
		ent = CreateTargetChangeLevel( next ? next : level.mapname );
		return ent;
	}
	else if( g_maprotation->integer == 2 )
	{
		next = G_MapRotationRandom();
		ent = CreateTargetChangeLevel( next ? next : level.mapname );
		return ent;
	}

	if( level.nextmap[0] )  // go to a specific map
		return CreateTargetChangeLevel( level.nextmap );

	// search for a changelevel
	ent = G_Find( NULL, FOFS( classname ), "target_changelevel" );
	if( !ent )
	{
		// the map designer didn't include a changelevel,
		// so create a fake ent that goes back to the same level
		return CreateTargetChangeLevel( level.mapname );
	}
	return ent;
}
开发者ID:DenMSC,项目名称:racemod_2.1,代码行数:46,代码来源:g_main.cpp


示例8: target_speaker_multiple

void target_speaker_multiple (gentity_t *ent)
{
	gentity_t *vis_dummy = NULL;

	if (!(ent->target))
	{
		G_Error( "target_speaker missing target at pos %s", vtos( ent->s.origin ) );	
	}

	vis_dummy = G_Find (NULL, FOFS(targetname), ent->target);

	if(vis_dummy)
	{
		ent->s.otherEntityNum = vis_dummy->s.number;
	}
	else
		G_Error( "target_speaker cant find vis_dummy_multiple %s", vtos( ent->s.origin ) );	
	
}
开发者ID:nobowned,项目名称:rtcw,代码行数:19,代码来源:g_target.c


示例9: teleporter_touch

void teleporter_touch(edict_t * self, edict_t * other, cplane_t * plane, csurface_t * surf)
{
    edict_t * dest;
    int i;

    if (!other->client)
        return;
    dest = G_Find(NULL, FOFS(targetname), self->target);
    if (!dest)
    {
        gi.dprintf("Couldn't find destination\n");
        return;
    }

    // unlink to make sure it can't possibly interfere with KillBox
    gi.unlinkentity(other);

    VectorCopy(dest->s.origin, other->s.origin);
    VectorCopy(dest->s.origin, other->s.old_origin);
    other->s.origin[2] += 10;

    // clear the velocity and hold them in place briefly
    VectorClear(other->velocity);
    other->client->ps.pmove.pm_time = 160 >> 3; // hold time
    other->client->ps.pmove.pm_flags |= PMF_TIME_TELEPORT;

    // draw the teleport splash at source and on the player
    self->owner->s.event = EV_PLAYER_TELEPORT;
    other->s.event = EV_PLAYER_TELEPORT;

    // set angles
    for (i = 0; i < 3; i++)
        other->client->ps.pmove.delta_angles[i] = ANGLE2SHORT(dest->s.angles[i] - other->client->resp.cmd_angles[i]);

    VectorClear(other->s.angles);
    VectorClear(other->client->ps.viewangles);
    VectorClear(other->client->v_angle);

    // kill anything at the destination
    KillBox(other);

    gi.linkentity(other);
}
开发者ID:glampert,项目名称:quake2-for-ps2,代码行数:43,代码来源:g_misc.c


示例10: DropPortalSource

void DropPortalSource( gentity_t *player ) {
	gentity_t	*ent;
	gentity_t	*destination;
	vec3_t		snapped;

	// create the portal source
	ent = G_Spawn();
	ent->s.modelindex = G_ModelIndex( "models/powerups/teleporter/tele_enter.md3" );

	VectorCopy( player->s.pos.trBase, snapped );
	SnapVector( snapped );
	G_SetOrigin( ent, snapped );
	VectorCopy( player->r.mins, ent->r.mins );
	VectorCopy( player->r.maxs, ent->r.maxs );

	ent->classname = "hi_portal source";
	ent->s.pos.trType = TR_STATIONARY;

	ent->r.contents = CONTENTS_CORPSE | CONTENTS_TRIGGER;
	ent->takedamage = qtrue;
	ent->health = 200;
	ent->die = PortalDie;

	trap_LinkEntity( ent );

	ent->count = player->client->portalID;
	player->client->portalID = 0;

//	ent->spawnflags = player->client->ps.persistant[PERS_TEAM];

	ent->nextthink = level.time + 1000;
	ent->think = PortalEnable;

	// find the destination
	destination = NULL;
	while( (destination = G_Find(destination, FOFS(classname), "hi_portal destination")) != NULL ) {
		if( destination->count == ent->count ) {
			VectorCopy( destination->s.pos.trBase, ent->pos1 );
			break;
		}
	}

}
开发者ID:d00man,项目名称:openarena-vm,代码行数:43,代码来源:g_misc.c


示例11: DBall_SelectSpawnPoint

//==================
void DBall_SelectSpawnPoint (edict_t *ent, vec3_t origin, vec3_t angles)
{
	edict_t	*bestspot;
	float	bestdistance, bestplayerdistance;
	edict_t	*spot;
	char	*spottype;
	char	skin[512];

	strcpy(skin, Info_ValueForKey (ent->client->pers.userinfo, "skin"));
	if(!strcmp(dball_team1_skin->string, skin))
		spottype = "dm_dball_team1_start";
	else if(!strcmp(dball_team2_skin->string, skin))
		spottype = "dm_dball_team2_start";
	else
		spottype = "info_player_deathmatch";

	spot = NULL;
	bestspot = NULL;
	bestdistance = 0;
	while ((spot = G_Find (spot, FOFS(classname), spottype)) != NULL)
	{
		bestplayerdistance = PlayersRangeFromSpot (spot);

		if (bestplayerdistance > bestdistance)
		{
			bestspot = spot;
			bestdistance = bestplayerdistance;
		}
	}

	if (bestspot)
	{
		VectorCopy (bestspot->s.origin, origin);
		origin[2] += 9;
		VectorCopy (bestspot->s.angles, angles);
		return;
	}

	// if we didn't find an appropriate spawnpoint, just
	// call the standard one.
	SelectSpawnPoint(ent, origin, angles);
}
开发者ID:DrItanium,项目名称:rogue,代码行数:43,代码来源:ball.c


示例12: camTrack_touch

void camTrack_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
	edict_t *player;
	edict_t *nextTarget;

	if (!plane)
		return;
	
	player = &g_edicts[1];	// Gotta be, since this is SP only

	//delete bullet model.
	G_FreeEdict(self->child);


	
	

	//hit wall.

	//if no next target, then abort.
	if (!self->owner->target)
	{
		camera_off(player);
		//fire targets.
		FireTarget2(self->owner);
		return;
	}

	//fire targets.
	FireTarget2(self->owner);

	nextTarget = G_Find(NULL,FOFS(targetname), self->owner->target);

	if (!nextTarget)
	{
		camera_off(player);
		return;
	}	

	FirePathTarget(nextTarget);
	WarpToNextPoint(self, nextTarget);
}
开发者ID:AimHere,项目名称:thirty-flights-of-linux,代码行数:42,代码来源:g_abel_camshoot.c


示例13: camera_cam_firstthink

void camera_cam_firstthink( gentity_t *ent ) {
	gentity_t   *target = NULL;
	vec3_t dang;
	vec3_t vec;

	if ( ent->track ) {
		target = G_Find( NULL, FOFS( targetname ), ent->track );
	}

	if ( target ) {
		VectorSubtract( target->s.origin, ent->r.currentOrigin, vec );
		vectoangles( vec, dang );
		G_SetAngle( ent, dang );
	}

	if ( ent->target ) {
		ent->nextthink = level.time + ( FRAMETIME / 2 );
		ent->think = Think_SetupTrainTargets;
	}
}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:20,代码来源:g_tramcar.c


示例14: while

/*
===========
SelectInitialSpawnPoint

Try to find a spawn point marked 'initial', otherwise
use normal spawn selection.
============
*/
gentity_t *SelectInitialSpawnPoint( vec3_t origin, vec3_t angles ) {
	gentity_t	*spot;

	spot = NULL;
	while ((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL) {
		if ( spot->spawnflags & 1 ) {
			break;
		}
	}

	if ( !spot || SpotWouldTelefrag( spot ) ) {
		return SelectSpawnPoint( vec3_origin, origin, angles );
	}

	VectorCopy (spot->s.origin, origin);
	origin[2] += 9;
	VectorCopy (spot->s.angles, angles);

	return spot;
}
开发者ID:zturtleman,项目名称:swarmedq3,代码行数:28,代码来源:g_client.c


示例15: AI_AddNode_Teleporter

//==========================================
// AI_AddNode_Teleporter
// Drop two nodes, one at trigger and other
// at target entity
//==========================================
int AI_AddNode_Teleporter( edict_t *ent )
{
	vec3_t		v1,v2;
	edict_t		*dest;

	if (nav.num_nodes + 1 > MAX_NODES)
		return INVALID;

	dest = G_Find ( NULL, FOFS(targetname), ent->target );
	if (!dest)
		return INVALID;
	
	//NODE_TELEPORTER_IN
	nodes[nav.num_nodes].flags = (NODEFLAGS_TELEPORTER_IN|NODEFLAGS_SERVERLINK);
	
	VectorCopy( ent->maxs, v1 );
	VectorCopy( ent->mins, v2 );
	nodes[nav.num_nodes].origin[0] = (v1[0] - v2[0]) / 2 + v2[0];
	nodes[nav.num_nodes].origin[1] = (v1[1] - v2[1]) / 2 + v2[1];
	nodes[nav.num_nodes].origin[2] = ent->mins[2]+32;

	nodes[nav.num_nodes].flags |= AI_FlagsForNode( nodes[nav.num_nodes].origin, ent );
	
	nav.num_nodes++;
	
	//NODE_TELEPORTER_OUT
	nodes[nav.num_nodes].flags = (NODEFLAGS_TELEPORTER_OUT|NODEFLAGS_SERVERLINK);
	VectorCopy( dest->s.origin, nodes[nav.num_nodes].origin );
	if ( ent->spawnflags & 1 ) // droptofloor
		nodes[nav.num_nodes].flags |= NODEFLAGS_FLOAT;
	else
		AI_DropNodeOriginToFloor( nodes[nav.num_nodes].origin, NULL );

	nodes[nav.num_nodes].flags |= AI_FlagsForNode( nodes[nav.num_nodes].origin, ent );
	
	// link from teleport_in
	AI_AddLink( nav.num_nodes-1, nav.num_nodes, LINK_TELEPORT );
	
	nav.num_nodes++;
	return nav.num_nodes -1;
}
开发者ID:mylemans,项目名称:vrxcl,代码行数:46,代码来源:ai_nodes.c


示例16: G_ScriptAction_AlertEntity

/*
=================
G_ScriptAction_AlertEntity

  syntax: alertentity <targetname>

 Arnout: modified to target multiple entities with the same targetname
 Martin - dumped from 1.4 to maybe fix the dam/tram bugs...3/20/08
=================
*/
qboolean G_ScriptAction_AlertEntity( gentity_t *ent, char *params )
{
	gentity_t	*alertent = NULL;
	qboolean	foundalertent = qfalse;

	if (!params || !params[0])
	{
		G_Error( "G_Scripting: alertentity without targetname\n" );
	}

	// find this targetname
	while(1) {
		alertent = G_Find( alertent, FOFS(targetname), params );
		if (!alertent )
		{
			if( !foundalertent )
				G_Error( "G_Scripting: alertentity cannot find targetname \"%s\"\n", params );
			else
				break;
		}

		foundalertent = qtrue;

		if (alertent->client) {
			// call this entity's AlertEntity function
			if (!alertent->AIScript_AlertEntity)
			{
				G_Error( "G_Scripting: alertentity \"%s\" (classname = %s) doesn't have an \"AIScript_AlertEntity\" function\n", params, alertent->classname );
			}
			alertent->AIScript_AlertEntity (alertent);
		} else {
			if (!alertent->use)
			{
				G_Error( "G_Scripting: alertentity \"%s\" (classname = %s) doesn't have a \"use\" function\n", params, alertent->classname );
			}
			alertent->use (alertent, NULL, NULL);
		}
	}

	return qtrue;
}		// ********** END MARTIN 1.4 DUMP
开发者ID:nobowned,项目名称:rtcw-2.3,代码行数:51,代码来源:g_script_actions.c


示例17: GetNextTrack

void GetNextTrack( gentity_t *ent ) {
	gentity_t   *track = NULL;
	gentity_t   *next;
	gentity_t   *choice[MAXCHOICES];
	int num_choices = 0;
	int rval;

	next = ent->nextTrain;

	if ( !( next->track ) ) {
		G_Printf( "NULL track name for %s on %s\n", ent->classname, next->targetname );
		return;
	}

	while ( 1 )
	{
		track = G_Find( track, FOFS( targetname ), next->track );

		if ( !track ) {
			break;
		}

		choice[num_choices++] = track;

		if ( num_choices == MAXCHOICES ) {
			break;
		}
	}

	if ( !num_choices ) {
		G_Printf( "GetNextTrack didnt find a track\n" );
		return;
	}

	rval = rand() % num_choices;

	ent->nextTrain = NULL;
	ent->target = choice[rval]->targetname;

}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:40,代码来源:g_tramcar.c


示例18: target_script_trigger_use

/*QUAKED target_script_trigger (1 .7 .2) (-8 -8 -8) (8 8 8)
must have an aiName
must have a target

when used it will fire its targets
*/
void target_script_trigger_use(gentity_t *ent, gentity_t *other, gentity_t *activator)
{
// START    Mad Doctor I changes, 8/16/2002

	qboolean        found = qfalse;

	// for all entities/bots with this ainame
	gentity_t      *trent = NULL;

	// Are we using ainame to find another ent instead of using scriptname for this one?
	if (ent->aiName)
	{
		// Find the first entity with this name
		trent = G_Find(trent, FOFS(scriptName), ent->aiName);

		// Was there one?
		if (trent)
		{
			// We found it
			found = qtrue;

			// Play the script
			G_Script_ScriptEvent(trent, "trigger", ent->target);

		}						// if (trent)...

	}							// if (ent->aiName)...

	// Use the old method if we didn't find an entity with the ainame
	if (!found)
	{
		if (ent->scriptName)
		{
			G_Script_ScriptEvent(ent, "trigger", ent->target);
		}
	}

	G_UseTargets(ent, other);

}
开发者ID:morsik,项目名称:warpig,代码行数:46,代码来源:g_target.c


示例19: target_lightramp_use

void target_lightramp_use (edict_t *self, edict_t *other, edict_t *activator)
{
	if (!self)
	{
		return;
	}

	if (!self->enemy)
	{
		edict_t		*e;

		// check all the targets
		e = NULL;
		while (1)
		{
			e = G_Find (e, FOFS(targetname), self->target);
			if (!e)
				break;
			if (strcmp(e->classname, "light") != 0)
			{
				gi.dprintf("%s at %s ", self->classname, vtos(self->s.origin));
				gi.dprintf("target %s (%s at %s) is not a light\n", self->target, e->classname, vtos(e->s.origin));
			}
			else
			{
				self->enemy = e;
			}
		}

		if (!self->enemy)
		{
			gi.dprintf("%s target %s not found at %s\n", self->classname, self->target, vtos(self->s.origin));
			G_FreeEdict (self);
			return;
		}
	}

	self->timestamp = level.time;
	target_lightramp_think (self);
}
开发者ID:raynorpat,项目名称:cake,代码行数:40,代码来源:g_target.c


示例20: targets

/*QUAKED target_kill (.5 .5 .5) (-8 -8 -8) (8 8 8) kill_user_too
Kills the activator. (default)
If targets, they will be killed when this is fired
"kill_user_too" will still kill the activator when this ent has targets (default is only kill targets, not activator)
*/
void target_kill_use(gentity_t *self, gentity_t *other, gentity_t *activator)
{
    gentity_t *targ = NULL;

    if(self->spawnflags & 1)       // kill usertoo
    {
        G_Damage(activator, NULL, NULL, NULL, NULL, 100000, DAMAGE_NO_PROTECTION, MOD_TELEFRAG);
    }

    while((targ = G_Find(targ, FOFS(targetname), self->target)) != NULL)
    {
        if(targ->aiCharacter)            // (SA) if it's an ai character, free it nicely
        {
            targ->aiInactive = qtrue;
        }
        else
        {
            // make sure it isn't going to respawn or show any events
            targ->nextthink = 0;

            if(targ == activator)
            {
                continue;
            }

            // RF, script_movers should die!
            if(!Q_stricmp(targ->classname, "script_mover") && targ->die)
            {
                targ->die(targ, self, self, targ->health, 0);
                continue;
            }

            trap_UnlinkEntity(targ);
            targ->use = 0;
            targ->touch = 0;
            targ->nextthink = level.time + FRAMETIME;
            targ->think = G_FreeEntity;
        }
    }
}
开发者ID:Justasic,项目名称:RTCW-SP,代码行数:45,代码来源:g_target.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ G_FindConfigstringIndex函数代码示例发布时间:2022-05-30
下一篇:
C++ G_FILE函数代码示例发布时间: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