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

C++ G_UseTargets函数代码示例

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

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



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


示例16: target_actor_touch

void target_actor_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
	vec3_t	v;

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

	other->goalentity = other->movetarget = NULL;

	if (self->message)
	{
		int		n;
		edict_t	*ent;

		for (n = 1; n <= game.maxclients; n++)
		{
			ent = &g_edicts[n];
			if (!ent->inuse)
				continue;
			gi.cprintf (ent, PRINT_CHAT, "%s: %s\n", actor_names[(other - g_edicts)%MAX_ACTOR_NAMES], self->message);
		}
	}

	if (self->spawnflags & 1)		//jump
	{
		other->velocity[0] = self->movedir[0] * self->speed;
		other->velocity[1] = self->movedir[1] * self->speed;
		
		if (other->groundentity)
		{
			other->groundentity = NULL;
			other->velocity[2] = self->movedir[2];
			gi.sound(other, CHAN_VOICE, gi.soundindex("player/male/jump1.wav"), 1, ATTN_NORM, 0);
		}
	}

	if (self->spawnflags & 2)	//shoot
	{
	}
	else if (self->spawnflags & 4)	//attack
	{
		other->enemy = G_PickTargetIgnore(self->pathtarget,self->owner);
		if (other->enemy)
		{
			other->goalentity = other->enemy;
			if (self->spawnflags & 32)
				other->monsterinfo.aiflags |= AI_BRUTAL;
			if (self->spawnflags & 16)
			{
				other->monsterinfo.aiflags |= AI_STAND_GROUND;
				actor_stand (other);
			}
			else
			{
				actor_run (other);
			}
		}
	}

	if (!(self->spawnflags & 6) && (self->pathtarget))
	{
		char *savetarget;

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

	other->movetarget = G_PickTargetIgnore(self->target,self->owner);

	if (!other->goalentity)
		other->goalentity = other->movetarget;

	if (!other->movetarget && !other->enemy)
	{
		other->monsterinfo.pausetime = level.time + 100000000;
		other->monsterinfo.stand (other);
	}
	else if (other->movetarget == other->goalentity)
	{
		VectorSubtract (other->movetarget->s.origin, other->s.origin, v);
		other->ideal_yaw = vectoyaw (v);
	}
}
开发者ID:cm243,项目名称:Quake-Game,代码行数:88,代码来源:m_actor.c


示例17: Use_Target_Alarm

void Use_Target_Alarm( gentity_t *ent, gentity_t *other, gentity_t *activator )
{
	G_UseTargets(ent, other);
}
开发者ID:nobowned,项目名称:rtcw,代码行数:4,代码来源:g_target.c


示例18: int

/*QUAKED target_relay (1 1 0) (-8 -8 -8) (8 8 8) RED_ONLY BLUE_ONLY RANDOM NOKEY_ONLY TAKE_KEY NO_LOCKED_NOISE
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
"key" specifies an item you can be carrying that affects the operation of this relay
this key is currently an int (1-16) which matches the id of a key entity (key_key1 = 1, etc)
NOKEY_ONLY means "fire only if I do /not/ have the specified key"
TAKE_KEY removes the key from the players inventory
"lockednoise" specifies a .wav file to play if the relay is used and the player doesn't have the necessary key.
By default this sound is "sound/movers/doors/default_door_locked.wav"
NO_LOCKED_NOISE specifies that it will be silent if activated without proper key
*/
void target_relay_use (gentity_t *self, gentity_t *other, gentity_t *activator) {
	if ( ( self->spawnflags & 1 ) && activator && activator->client 
		&& activator->client->sess.sessionTeam != TEAM_RED ) {
		return;
	}
	if ( ( self->spawnflags & 2 ) && activator && 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;
	}

	if(activator) {	// activator can be NULL if called from script
		if(self->key)
		{
			gitem_t *item;

			if(self->key == -1)	// relay permanently locked
			{
				if (self->soundPos1)
					G_Sound( self, self->soundPos1);	//----(SA)	added
				return;
			}

			item = BG_FindItemForKey(self->key, 0);

			if(item)
			{
				if(activator->client->ps.stats[STAT_KEYS] & (1<<item->giTag))	// user has key
				{
					if (self->spawnflags & 8 ) {	// relay is NOKEY_ONLY and player has key
						if (self->soundPos1)
							G_Sound( self, self->soundPos1);	//----(SA)	added
						return;
					}
				}
				else							// user does not have key
				{
					if (!(self->spawnflags & 8) )
					{
						if (self->soundPos1)
							G_Sound( self, self->soundPos1);	//----(SA)	added
						return;
					}
				}
			}

			if(self->spawnflags & 16) {	// (SA) take key
				activator->client->ps.stats[STAT_KEYS] &= ~(1<<item->giTag);
				// (SA) TODO: "took inventory item" sound
			}
		}
	}

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


示例19: Use_Target_Alarm

void Use_Target_Alarm(gentity_t *ent, gentity_t *other, gentity_t *activator) {
	// Nico, silent GCC
	(void)activator;

	G_UseTargets(ent, other);
}
开发者ID:boutetnico,项目名称:ETrun,代码行数:6,代码来源:g_target.c


示例20: trigger_relay_use

/*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8)
This fixed size trigger cannot be touched, it can only be fired by other events.
*/
void trigger_relay_use (edict_t *self, edict_t *other, edict_t *activator)
{
	G_UseTargets (self, activator);
}
开发者ID:ajbonner,项目名称:yet-another-quake2-fork,代码行数:7,代码来源:g_trigger.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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