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


C++ G_UseTargets函数代码示例

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


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

示例1: Reached_BinaryMover

/*
================
Reached_BinaryMover
================
*/
void Reached_BinaryMover( gentity_t *ent ) {

	// stop the looping sound
	ent->s.loopSound = ent->soundLoop;

	if ( ent->moverState == MOVER_1TO2 ) {
		// reached pos2
		SetMoverState( ent, MOVER_POS2, level.time );

		// play sound
		if ( ent->soundPos2 ) {
			G_AddEvent( ent, EV_GENERAL_SOUND, ent->soundPos2 );
		}

		// return to pos1 after a delay
		ent->think = ReturnToPos1;
		ent->nextthink = level.time + ent->wait;

		// fire targets
		if ( !ent->activator ) {
			ent->activator = ent;
		}
		G_UseTargets( ent, ent->activator );
	} else if ( ent->moverState == MOVER_2TO1 ) {
		// reached pos1
		SetMoverState( ent, MOVER_POS1, level.time );

		// play sound
		if ( ent->soundPos1 ) {
			G_AddEvent( ent, EV_GENERAL_SOUND, ent->soundPos1 );
		}

		// close areaportals
		if ( ent->teammaster == ent || !ent->teammaster ) {
			trap_AdjustAreaPortalState( ent, qfalse );
		}
	} else {
		G_Error( "Reached_BinaryMover: bad moverState" );
	}
}
开发者ID:OpenArena,项目名称:legacy,代码行数:45,代码来源:g_mover.c

示例2: target_explosion_explode

/*QUAKED target_explosion (1 0 0) (-8 -8 -8) (8 8 8)
Spawns an explosion temporary entity when used.

"delay"		wait this long before going off
"dmg"		how much radius damage should be done, defaults to 0
*/
void target_explosion_explode (edict_t *self)
{
	float save;

  	if (!self)
	{
		return;
	}

	gi.WriteByte(svc_temp_entity);
	gi.WriteByte(TE_EXPLOSION1);
	gi.WritePosition(self->s.origin);
	gi.multicast(self->s.origin, MULTICAST_PHS);

	T_RadiusDamage(self, self->activator, self->dmg, NULL,
			self->dmg + 40, MOD_EXPLOSIVE);

	save = self->delay;
	self->delay = 0;
	G_UseTargets(self, self->activator);
	self->delay = save;
}
开发者ID:basecq,项目名称:q2dos,代码行数:28,代码来源:g_target.c

示例3: path_corner_touch

static void path_corner_touch( edict_t *self, edict_t *other, cplane_t *plane, int surfFlags )
{
	vec3_t v;
	edict_t	*next;

	if( other->movetarget != self )
		return;
	if( other->enemy )
		return;

	if( self->pathtarget )
	{
		const char *savetarget;

		savetarget = self->target;
		self->target = self->pathtarget;
		G_UseTargets( self, other );
		self->target = savetarget;
	}

	if( self->target )
		next = G_PickTarget( self->target );
	else
		next = NULL;

	if( next && ( next->spawnflags & 1 ) )
	{
		VectorCopy( next->s.origin, v );
		v[2] += next->r.mins[2];
		v[2] -= other->r.mins[2];
		VectorCopy( v, other->s.origin );
		next = G_PickTarget( next->target );
		other->s.teleported = qtrue;
	}

	other->goalentity = other->movetarget = next;

	VectorSubtract( other->goalentity->s.origin, other->s.origin, v );
}
开发者ID:codetwister,项目名称:qfusion,代码行数:39,代码来源:g_misc.cpp

示例4: multi_trigger

// the trigger was just activated
// ent->activator should be set to the activator so it can be held through a delay
// so wait for the delay time before firing
void multi_trigger( gentity_t *ent, gentity_t *activator ) {
	ent->activator = activator;

	G_Script_ScriptEvent( ent, "activate", NULL );

	if ( ent->nextthink ) {
		return;		// can't retrigger until the wait is over
	}

	G_UseTargets (ent, ent->activator);

	if ( ent->wait > 0 ) {
		ent->think = multi_wait;
		ent->nextthink = level.time + ( ent->wait + ent->random * crandom() ) * 1000;
	} else {
		// we can't just remove (self) here, because this is a touch function
		// called while looping through area links...
		ent->touch = 0;
		ent->nextthink = level.time + FRAMETIME;
		ent->think = G_FreeEntity;
	}
}
开发者ID:BackupTheBerlios,项目名称:et-flf-svn,代码行数:25,代码来源:g_trigger.c

示例5: multi_trigger

// the trigger was just activated
// ent->activator should be set to the activator so it can be held through a delay
// so wait for the delay time before firing
void multi_trigger(gentity_t *ent, gentity_t *activator)
{
	ent->activator = activator;
	if (ent->nextthink)
	{
		return;		// can't retrigger until the wait is over
	}

	if (activator->client)
	{
		if ((ent->spawnflags & 1) &&
			activator->client->sess.sessionTeam != TEAM_RED)
			{
			return;
		}
		if ((ent->spawnflags & 2) &&
			activator->client->sess.sessionTeam != TEAM_BLUE)
			{
			return;
		}
	}

	G_UseTargets (ent, ent->activator);

	if (ent->wait > 0)
	{
		ent->think = multi_wait;
		ent->nextthink = level.time + (ent->wait + ent->random * crandom()) * 1000;
	}
	else
	{
		// we can't just remove (self) here, because this is a touch function
		// called while looping through area links...
		ent->touch = 0;
		ent->nextthink = level.time + FRAMETIME;
		ent->think = G_FreeEntity;
	}
}
开发者ID:ElderPlayerX,项目名称:Invasion,代码行数:41,代码来源:g_trigger.c

示例6: target_explosion_explode

/*QUAKED target_explosion (1 0 0) (-8 -8 -8) (8 8 8)
Spawns an explosion temporary entity when used.

"delay"		wait this long before going off
"dmg"		how much radius damage should be done, defaults to 0
"fxdensity" size of explosion 1 - 100 (default is 10)
*/
void target_explosion_explode (edict_t *self)
{
	float		save;
	vec3_t	vec;

	VectorClear(vec);
	vec[2] = 1;

	gi.WriteByte (svc_temp_entity);
	gi.WriteByte (TE_EXPLOSION1B);
	gi.WritePosition (self->s.origin);
	gi.WriteDir( vec );
	gi.WriteByte( (int)(self->dmg / 2) );
	gi.WriteByte (self->fxdensity);
	gi.multicast (self->s.origin, MULTICAST_PVS);

	{
		edict_t *breakit;
		
		breakit = G_Spawn();
		
		if (breakit)
		{
			VectorCopy (self->s.origin, breakit->s.origin);
			gi.linkentity(breakit);
			gi.sound (breakit, CHAN_VOICE, gi.soundindex("world/explosion1.wav"), 1, ATTN_NORM, 0);
			breakit->think = G_FreeEdict;
			breakit->nextthink = level.time + 5.0;
		}
	}

	T_RadiusDamage (self, self->activator, self->dmg, NULL, self->dmg+40, MOD_EXPLOSIVE);

	save = self->delay;
	self->delay = 0;
	G_UseTargets (self, self->activator);
	self->delay = save;
}
开发者ID:MonkeyHarris,项目名称:monkey-mod,代码行数:45,代码来源:g_target.c

示例7: target_lock_use

void target_lock_use(edict_t *self, edict_t *other, edict_t *activator)
{
	char current[16];
	memset(current, 0, 16);

	for (edict_t *e = self->teammaster; e; e = e->teamchain)
	{
		if (!e->count)
			continue;

		const int n = e->count - 1;
		current[n] = '0' + e->s.frame;
	}

	if (strcmp(current, self->key_message) == 0)
	{
		char *copy_message = self->message;
		self->message = NULL;
		G_UseTargets(self, activator);
		self->message = copy_message;
	}
	else
	{
		if (self->message) 
			safe_centerprintf(activator, self->message);

		if (self->pathtarget)
		{
			edict_t *e = G_Find(NULL, FOFS(targetname), self->pathtarget);
			if (e) 
				e->use(e, other, activator);
		}
		else
		{
			BeepBeep(activator);
		}
	}
}
开发者ID:m-x-d,项目名称:Mission64-src,代码行数:38,代码来源:g_lock.c

示例8: 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)
{
    gentity_t   *player;

    if(ent->aiName)
    {
        player = AICast_FindEntityForName("player");

        if(player)
        {
            AICast_ScriptEvent(AICast_GetCastState(player->s.number), "trigger", ent->target);
        }
    }

    // DHM - Nerve :: In multiplayer, we use the brush scripting only
    if(g_gametype.integer == GT_WOLF && ent->scriptName)
    {
        G_Script_ScriptEvent(ent, "trigger", ent->target);
    }

    G_UseTargets(ent, other);

}
开发者ID:Justasic,项目名称:RTCW-SP,代码行数:29,代码来源:g_target.c

示例9: target_relay_use

/*QUAKED target_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) RED_ONLY BLUE_ONLY RANDOM
This doesn't perform any actions except fire its targets.
The activator can be forced to be from a certain team.
if RANDOM is checked, only one of the targets will be fired, not all of them
*/
void target_relay_use( gentity_t *self, gentity_t *other, gentity_t *activator )
{
  if( ( self->spawnflags & 1 ) && activator && activator->client &&
      activator->client->ps.stats[ STAT_TEAM ] != TEAM_HUMANS )
    return;

  if( ( self->spawnflags & 2 ) && activator && activator->client &&
      activator->client->ps.stats[ STAT_TEAM ] != TEAM_ALIENS )
    return;

  if( self->spawnflags & 4 )
  {
    gentity_t *ent;

    ent = G_PickTarget( self->target );
    if( ent && ent->use )
      ent->use( ent, self, activator );

    return;
  }

  G_UseTargets( self, activator );
}
开发者ID:norfenstein,项目名称:umbra,代码行数:28,代码来源:g_target.c

示例10: funcGlassDie

//-----------------------------------------------------
void funcGlassDie( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int mod,int dFlags,int hitLoc )
{
	vec3_t		verts[4], normal;

	// if a missile is stuck to us, blow it up so we don't look dumb....we could, alternately, just let the missile drop off??
	for ( int i = 0; i < MAX_GENTITIES; i++ )
	{
		if ( g_entities[i].s.groundEntityNum == self->s.number && ( g_entities[i].s.eFlags & EF_MISSILE_STICK ))
		{
			G_Damage( &g_entities[i], self, self, NULL, NULL, 99999, 0, MOD_CRUSH ); //?? MOD?
		}
	}

	// Really naughty cheating.  Put in an EVENT at some point...
	cgi_R_GetBModelVerts( cgs.inlineDrawModel[self->s.modelindex], verts, normal );
	CG_DoGlass( verts, normal, self->pos1, self->pos2, self->splashRadius );

	self->takedamage = qfalse;//stop chain reaction runaway loops

	G_SetEnemy( self, self->enemy );

	//NOTE: MUST do this BEFORE clearing contents, or you may not open the area portal!!!
	gi.AdjustAreaPortalState( self, qtrue );

	//So chunks don't get stuck inside me
	self->s.solid = 0;
	self->contents = 0;
	self->clipmask = 0;
	gi.linkentity(self); 

	if ( self->target && attacker != NULL )
	{
		G_UseTargets( self, attacker );
	}

	G_FreeEntity( self );
}
开发者ID:3ddy,项目名称:Jedi-Academy,代码行数:38,代码来源:g_breakable.cpp

示例11: target_relay_use

/*QUAKED target_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) RED_ONLY BLUE_ONLY RANDOM
This doesn't perform any actions except fire its targets.
The activator can be forced to be from a certain team.
if RANDOM is checked, only one of the targets will be fired, not all of them
*/
void target_relay_use (gentity_t *self, gentity_t *other, gentity_t *activator) {

	/* LQ3A */
	UNREFERENCED_PARAMETER(other);

	if ( ( self->spawnflags & 1 ) && activator->client 
		&& activator->client->sess.sessionTeam != TEAM_RED ) {
		return;
	}
	if ( ( self->spawnflags & 2 ) && activator->client 
		&& activator->client->sess.sessionTeam != TEAM_BLUE ) {
		return;
	}
	if ( self->spawnflags & 4 ) {
		gentity_t	*ent;

		ent = G_PickTarget( self->target );
		if ( ent && ent->use ) {
			ent->use( ent, self, activator );
		}
		return;
	}
	G_UseTargets (self, activator);
}
开发者ID:monoknot,项目名称:loaded-q3a,代码行数:29,代码来源:g_target.c

示例12: target_script_trigger

/*
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)
{
	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:GenaSG,项目名称:etlegacy,代码行数:43,代码来源:g_target.c

示例13: trigger_win

/*
===============
trigger_win
===============
*/
void trigger_win( gentity_t *self, gentity_t *other, gentity_t *activator )
{
    G_UseTargets( self, self );
}
开发者ID:redrumrobot,项目名称:trem-gpp-bots,代码行数:9,代码来源:g_trigger.c

示例14: and

/*QUAKED func_timer (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) START_ON
This should be renamed trigger_timer...
Repeatedly fires its targets.
Can be turned on or off by using.

"wait"      base time between triggering all targets, default is 1
"random"    wait variance, default is 0
so, the basic time between firing is a random time between
(wait - random) and (wait + random)

*/
void func_timer_think( gentity_t *self )
{
    G_UseTargets( self, self->activator );
    // set time before next firing
    self->nextthink = level.time + 1000 * ( self->wait + crandom( ) * self->random );
}
开发者ID:redrumrobot,项目名称:trem-gpp-bots,代码行数:17,代码来源:g_trigger.c

示例15: trigger_always_think

void trigger_always_think( gentity_t *ent )
{
    G_UseTargets( ent, ent );
    G_FreeEntity( ent );
}
开发者ID:redrumrobot,项目名称:trem-gpp-bots,代码行数:5,代码来源:g_trigger.c


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