您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ G_UseTargets函数代码示例

51自学网 2021-06-01 21:02:19
  C++
这篇教程C++ G_UseTargets函数代码示例写得很实用,希望能帮到您。

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

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


示例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,


示例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,


示例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 firingvoid 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,


示例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 firingvoid 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,


示例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,


示例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,


示例8: target_script_trigger_use

/*QUAKED target_script_trigger (1 .7 .2) (-8 -8 -8) (8 8 8)must have an aiNamemust have a targetwhen 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,


示例9: target_relay_use

/*QUAKED target_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) RED_ONLY BLUE_ONLY RANDOMThis 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,


示例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,


示例11: target_relay_use

/*QUAKED target_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) RED_ONLY BLUE_ONLY RANDOMThis 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,


示例12: target_script_trigger

/*QUAKED target_script_trigger (1 .7 .2) (-8 -8 -8) (8 8 8)must have an aiNamemust have a targetwhen 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,


示例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,


示例14: and

/*QUAKED func_timer (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) START_ONThis 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 0so, 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,


示例15: trigger_always_think

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


示例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,


示例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,


示例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_NOISEThis 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 relaythis 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,


示例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,


示例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,


示例21: func_clock_think

void func_clock_think (edict_t *self){	if (!self->enemy)	{		self->enemy = G_Find (NULL, FOFS(targetname), self->target);		if (!self->enemy)			return;	}	if (self->spawnflags & 1)	{		func_clock_format_countdown (self);		self->health++;	}	else if (self->spawnflags & 2)	{		func_clock_format_countdown (self);		self->health--;	}	else	{		struct tm	*ltime;		time_t		gmtime;		time(&gmtime);		ltime = localtime(&gmtime);		Com_sprintf (self->message, CLOCK_MESSAGE_SIZE, "%2i:%2i:%2i", ltime->tm_hour, ltime->tm_min, ltime->tm_sec);		if (self->message[3] == ' ')			self->message[3] = '0';		if (self->message[6] == ' ')			self->message[6] = '0';	}	self->enemy->message = self->message;	self->enemy->use (self->enemy, self, self);	if (((self->spawnflags & 1) && (self->health > self->wait)) ||		((self->spawnflags & 2) && (self->health < self->wait)))	{		if (self->pathtarget)		{			char *savetarget;			char *savemessage;			savetarget = self->target;			savemessage = self->message;			self->target = self->pathtarget;			self->message = NULL;			G_UseTargets (self, self->activator);			self->target = savetarget;			self->message = savemessage;		}		if (!(self->spawnflags & 8))			return;		func_clock_reset (self);		if (self->spawnflags & 4)			return;	}	self->nextthink = level.time + 1;}
开发者ID:AJenbo,项目名称:Quake-2,代码行数:64,


示例22: Think_Target_Delay

/*QUAKED target_delay (1 0 0) (-8 -8 -8) (8 8 8)"wait" seconds to pause before firing targets."random" delay variance, total delay = delay +/- random seconds*/void Think_Target_Delay( gentity_t *ent ) {	G_UseTargets( ent, ent->activator );}
开发者ID:ElderPlayerX,项目名称:Rune,代码行数:7,


示例23: func_usable_use

void func_usable_use( gentity_t *self, gentity_t *other, gentity_t *activator ){//Toggle on and off	if ( other == activator )	{//directly used by use button trace		if ( (self->spawnflags&32) )		{//only usable by NPCs			if ( activator->NPC == NULL )			{//Not an NPC				return;			}		}	}	G_ActivateBehavior( self, BSET_USE );	if ( self->s.eFlags & EF_SHADER_ANIM )	{//animate shader when used		self->s.frame++;//inc frame		if ( self->s.frame > self->endFrame )		{//wrap around			self->s.frame = 0;		}		if ( self->target && self->target[0] )		{			G_UseTargets( self, activator );		}	}	else if ( self->spawnflags & 8 )	{//ALWAYS_ON		//Remove the ability to use the entity directly		self->svFlags &= ~SVF_PLAYER_USABLE;		//also remove ability to call any use func at all!		self->e_UseFunc = useF_NULL;		if(self->target && self->target[0])		{			G_UseTargets(self, activator);		}		if ( self->wait )		{			self->e_ThinkFunc = thinkF_func_usable_think;			self->nextthink = level.time + ( self->wait * 1000 );		}		return;	}	else if ( !self->count )	{//become solid again		self->count = 1;		self->activator = activator;		func_wait_return_solid( self );	}	else	{		//NOTE: MUST do this BEFORE clearing contents, or you may not open the area portal!!!		if ( !(self->spawnflags&1) )		{//START_OFF doesn't effect area portals			gi.AdjustAreaPortalState( self, qtrue );		}		self->s.solid = 0;		self->contents = 0;		self->clipmask = 0;		self->svFlags |= SVF_NOCLIENT;		self->s.eFlags |= EF_NODRAW;		self->count = 0;		if(self->target && self->target[0])		{			G_UseTargets(self, activator);		}		self->e_ThinkFunc = thinkF_NULL;		self->nextthink = -1;	}}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:74,


示例24: Touch_Item

/*===============Touch_Item===============*/void Touch_Item (gentity_t *ent, gentity_t *other, trace_t *trace) {	int			respawn;	qboolean	predict;	if (!other->client)		return;	if (other->health < 1)		return;		// dead people can't pickup	// the same pickup rules are used for client side and server side	if ( !BG_CanItemBeGrabbed( g_gametype.integer, &ent->s, &other->client->ps ) ) {		return;	}	G_LogPrintf( "Item: %i %s/n", other->s.number, ent->item->classname );	predict = other->client->pers.predictItemPickup;	// call the item-specific pickup function	switch( ent->item->giType ) {	case IT_WEAPON:		respawn = Pickup_Weapon(ent, other);//		predict = qfalse;		break;	case IT_AMMO:		respawn = Pickup_Ammo(ent, other);//		predict = qfalse;		break;	case IT_ARMOR:		respawn = Pickup_Armor(ent, other);		break;	case IT_HEALTH:		respawn = Pickup_Health(ent, other);		break;	case IT_POWERUP:		respawn = Pickup_Powerup(ent, other);		predict = qfalse;		break;#ifdef MISSIONPACK	case IT_PERSISTANT_POWERUP:		respawn = Pickup_PersistantPowerup(ent, other);		break;#endif	case IT_TEAM:		respawn = Pickup_Team(ent, other);		break;	case IT_HOLDABLE:		respawn = Pickup_Holdable(ent, other);		break;	default:		return;	}	if ( !respawn ) {		return;	}	// play the normal pickup sound	if (predict) {		G_AddPredictableEvent( other, EV_ITEM_PICKUP, ent->s.modelindex );	} else {		G_AddEvent( other, EV_ITEM_PICKUP, ent->s.modelindex );	}	// powerup pickups are global broadcasts	if ( ent->item->giType == IT_POWERUP || ent->item->giType == IT_TEAM) {		// if we want the global sound to play		if (!ent->speed) {			gentity_t	*te;			te = G_TempEntity( ent->s.pos.trBase, EV_GLOBAL_ITEM_PICKUP );			te->s.eventParm = ent->s.modelindex;			te->r.svFlags |= SVF_BROADCAST;		} else {			gentity_t	*te;			te = G_TempEntity( ent->s.pos.trBase, EV_GLOBAL_ITEM_PICKUP );			te->s.eventParm = ent->s.modelindex;			// only send this temp entity to a single client			te->r.svFlags |= SVF_SINGLECLIENT;			te->r.singleClient = other->s.number;		}	}	// fire item targets	G_UseTargets (ent, other);	// wait of -1 will not respawn	if ( ent->wait == -1 ) {		ent->r.svFlags |= SVF_NOCLIENT;		ent->s.eFlags |= EF_NODRAW;		ent->r.contents = 0;		ent->unlinkAfterEvent = qtrue;		return;	}//.........这里部分代码省略.........
开发者ID:Garey27,项目名称:quake3-brainworks,代码行数:101,


示例25: mass

/*QUAKED func_explosive (0 .5 .8) ? Trigger_Spawn ANIMATED ANIMATED_FASTAny brush that you want to explode or break apart.  If you want anex0plosion, set dmg and it will do a radius explosion of that amountat the center of the bursh.If targeted it will not be shootable.health defaults to 100.mass defaults to 75.  This determines how much debris is emitted whenit explodes.  You get one large chunk per 100 of mass (up to 8) andone small chunk per 25 of mass (up to 16).  So 800 gives the most.*/void func_explosive_explode (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point){	vec3_t	origin;	vec3_t	chunkorigin;	vec3_t	size;	int		count;	int		mass;	// bmodel origins are (0 0 0), we need to adjust that here	VectorScale (self->size, 0.5, size);	VectorAdd (self->absmin, size, origin);	VectorCopy (origin, self->s.origin);	self->takedamage = DAMAGE_NO;	if (self->dmg)		T_RadiusDamage (self, attacker, self->dmg, NULL, self->dmg+40, MOD_EXPLOSIVE);	VectorSubtract (self->s.origin, inflictor->s.origin, self->velocity);	VectorNormalize (self->velocity);	VectorScale (self->velocity, 150, self->velocity);	// start chunks towards the center	VectorScale (size, 0.5, size);	mass = self->mass;	if (!mass)		mass = 75;	// big chunks	if (mass >= 100)	{		count = mass / 100;		if (count > 8)			count = 8;		while(count--)		{			chunkorigin[0] = origin[0] + crandom() * size[0];			chunkorigin[1] = origin[1] + crandom() * size[1];			chunkorigin[2] = origin[2] + crandom() * size[2];			ThrowDebris (self, "models/objects/debris1/tris.md2", 1, chunkorigin);		}	}	// small chunks	count = mass / 25;	if (count > 16)		count = 16;	while(count--)	{		chunkorigin[0] = origin[0] + crandom() * size[0];		chunkorigin[1] = origin[1] + crandom() * size[1];		chunkorigin[2] = origin[2] + crandom() * size[2];		ThrowDebris (self, "models/objects/debris2/tris.md2", 2, chunkorigin);	}	G_UseTargets (self, attacker);	if (self->dmg)		BecomeExplosion1 (self);	else		G_FreeEdict (self);}
开发者ID:AJenbo,项目名称:Quake-2,代码行数:76,


示例26: Reached_Train

/*===============Reached_Train===============*/void Reached_Train( gentity_t *ent ) {	gentity_t		*next;	float			speed;	vec3_t			move;	float			length;	// copy the apropriate values	next = ent->nextTrain;	if ( !next || !next->nextTrain ) {		return;		// just stop	}	// fire all other targets	G_UseTargets( next, NULL );	// set the new trajectory	ent->nextTrain = next->nextTrain;	VectorCopy( next->s.origin, ent->pos1 );	VectorCopy( next->nextTrain->s.origin, ent->pos2 );	// if the path_corner has a speed, use that	if ( next->speed ) {		speed = next->speed;	} else {		// otherwise use the train's speed		speed = ent->speed;	}	if ( speed < 1 ) {		speed = 1;	}	// calculate duration	VectorSubtract( ent->pos2, ent->pos1, move );	length = VectorLength( move );	ent->s.pos.trDuration = length * 1000 / speed;	// Tequila comment: Be sure to send to clients after any fast move case	ent->r.svFlags &= ~SVF_NOCLIENT;	// Tequila comment: Fast move case	if(ent->s.pos.trDuration<1) {		// Tequila comment: As trDuration is used later in a division, we need to avoid that case now		// With null trDuration,		// the calculated rocks bounding box becomes infinite and the engine think for a short time		// any entity is riding that mover but not the world entity... In rare case, I found it		// can also stuck every map entities after func_door are used.		// The desired effect with very very big speed is to have instant move, so any not null duration		// lower than a frame duration should be sufficient.		// Afaik, the negative case don't have to be supported.		ent->s.pos.trDuration=1;		// Tequila comment: Don't send entity to clients so it becomes really invisible 		ent->r.svFlags |= SVF_NOCLIENT;	}	// looping sound	ent->s.loopSound = next->soundLoop;	// start it going	SetMoverState( ent, MOVER_1TO2, level.time );	// if there is a "wait" value on the target, don't start moving yet	if ( next->wait ) {		ent->nextthink = level.time + next->wait * 1000;		ent->think = Think_BeginMoving;		ent->s.pos.trType = TR_STATIONARY;	}}
开发者ID:LavenderMoon,项目名称:mint-arena,代码行数:74,


示例27: trigger_key_use

/*QUAKED trigger_key (.5 .5 .5) (-8 -8 -8) (8 8 8)A relay trigger that only fires it's targets if player has the proper key.Use "item" to specify the required key, for example "key_data_cd"*/void trigger_key_use (edict_t *self, edict_t *other, edict_t *activator){	int			index;	if (!self->item)		return;	if (!activator->client)		return;	index = ITEM_INDEX(self->item);	if (!activator->client->pers.inventory[index])	{		if (level.time < self->touch_debounce_time)			return;		self->touch_debounce_time = level.time + 5.0;		gi.centerprintf (activator, "You need the %s", self->item->pickup_name);		gi.sound (activator, CHAN_AUTO, gi.soundindex ("misc/keytry.wav"), 1, ATTN_NORM, 0);		return;	}	gi.sound (activator, CHAN_AUTO, gi.soundindex ("misc/keyuse.wav"), 1, ATTN_NORM, 0);	if (coop->value)	{		int		player;		edict_t	*ent;		if (strcmp(self->item->classname, "key_power_cube") == 0)		{			int	cube;			for (cube = 0; cube < 8; cube++)				if (activator->client->pers.power_cubes & (1 << cube))					break;			for (player = 1; player <= game.maxclients; player++)			{				ent = &g_edicts[player];				if (!ent->inuse)					continue;				if (!ent->client)					continue;				if (ent->client->pers.power_cubes & (1 << cube))				{					ent->client->pers.inventory[index]--;					ent->client->pers.power_cubes &= ~(1 << cube);				}			}		}		else		{			for (player = 1; player <= game.maxclients; player++)			{				ent = &g_edicts[player];				if (!ent->inuse)					continue;				if (!ent->client)					continue;				ent->client->pers.inventory[index] = 0;			}		}	}	else	{		activator->client->pers.inventory[index]--;	}	G_UseTargets (self, activator);	self->use = NULL;}
开发者ID:ajbonner,项目名称:yet-another-quake2-fork,代码行数:73,


示例28: target_random_use

void target_random_use(gentity_t *self, gentity_t *other, gentity_t *activator){	int			t_count = 0, pick;	gentity_t	*t = NULL;	//gi.Printf("target_random %s used by %s (entnum %d)/n", self->targetname, activator->targetname, activator->s.number );	G_ActivateBehavior(self,BSET_USE);	if(self->spawnflags & 1)	{		self->use = 0;	}	while ( (t = G_Find (t, FOFS(targetname), self->target)) != NULL )	{		if (t != self)		{			t_count++;		}	}	if(!t_count)	{		return;	}	if(t_count == 1)	{		G_UseTargets (self, activator);		return;	}	//FIXME: need a seed	// FIXME2: Proper numbers now	pick = Q_irand(0, t_count-1);	t_count = 0;	while ( (t = G_Find (t, FOFS(targetname), self->target)) != NULL )	{		if (t != self)		{			t_count++;		}		else		{			continue;		}				if (t == self)		{//				gi.Printf ("WARNING: Entity used itself./n");		}		else if(t_count == pick)		{			if (t->use != NULL)	// check can be omitted			{				GlobalUse(t, self, activator);				return;			}		}		if (!self->inuse)		{			Com_Printf("entity was removed while using targets/n");			return;		}	}}
开发者ID:NikitaRus,项目名称:JediKnightGalaxies-1,代码行数:67,



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


C++ G_UseTargets2函数代码示例
C++ G_UNLOCK函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。