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

C++ FOFS函数代码示例

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

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



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

示例1: 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


示例2: SP_FixCoopSpots

/*
 * The ugly as hell coop spawnpoint fixup function.
 * While coop was planed by id, it wasn't part of
 * the initial release and added later with patch
 * to version 2.00. The spawnpoints in some maps
 * were SNAFU, some have wrong targets and some
 * no name at all. Fix this by matching the coop
 * spawnpoint target names to the nearest named
 * single player spot.
 */
void
SP_FixCoopSpots(edict_t *self)
{
	edict_t *spot;
	vec3_t d;

	if (!self)
	{
		return;
	}

	spot = NULL;

	while (1)
	{
		spot = G_Find(spot, FOFS(classname), "info_player_start");

		if (!spot)
		{
			return;
		}

		if (!spot->targetname)
		{
			continue;
		}

		VectorSubtract(self->s.origin, spot->s.origin, d);

		if (VectorLength(d) < 550)
		{
			if ((!self->targetname) || (Q_stricmp(self->targetname, spot->targetname) != 0))
			{
				self->targetname = spot->targetname;
			}

			return;
		}
	}
}
开发者ID:ZFect,项目名称:yquake2,代码行数:50,代码来源:client.c


示例3: WP_FireDetPack

//---------------------------------------------------------
void WP_FireDetPack( gentity_t *ent, qboolean alt_fire )
//---------------------------------------------------------
{
	if ( !ent || !ent->client )
	{
		return;
	}

	if ( alt_fire  )
	{
		if ( ent->client->ps.eFlags & EF_PLANTED_CHARGE )
		{
			gentity_t *found = NULL;

			// loop through all ents and blow the crap out of them!
			while (( found = G_Find( found, FOFS( classname ), "detpack" )) != NULL )
			{
				if ( found->activator == ent )
				{
					VectorCopy( found->currentOrigin, found->s.origin );
					found->e_ThinkFunc = thinkF_WP_Explode;
					found->nextthink = level.time + 100 + random() * 100;
					G_Sound( found, G_SoundIndex( "sound/weapons/detpack/warning.wav" ));

					// would be nice if this actually worked?
					AddSoundEvent( NULL, found->currentOrigin, found->splashRadius*2, AEL_DANGER, qfalse, qtrue );//FIXME: are we on ground or not?
					AddSightEvent( NULL, found->currentOrigin, found->splashRadius*2, AEL_DISCOVERED, 100 );
				}
			}

			ent->client->ps.eFlags &= ~EF_PLANTED_CHARGE;
		}
	}
	else
	{
		WP_DropDetPack( ent, muzzle, forwardVec );

		ent->client->ps.eFlags |= EF_PLANTED_CHARGE;
	}
}
开发者ID:Almightygir,项目名称:OpenJK,代码行数:41,代码来源:wp_det_pack.cpp


示例4: while

/*
================
G_SelectHumanSpawnPoint

go to a random point that doesn't telefrag
================
*/
gentity_t *G_SelectHumanSpawnPoint( vec3_t preference )
{
  gentity_t *spot;
  int       count;
  gentity_t *spots[ MAX_SPAWN_POINTS ];

  if( level.numHumanSpawns <= 0 )
    return NULL;

  count = 0;
  spot = NULL;

  while( ( spot = G_Find( spot, FOFS( classname ),
    BG_Buildable( BA_H_SPAWN )->entityName ) ) != NULL )
  {
    if( !spot->spawned )
      continue;

    if( spot->health <= 0 )
      continue;

    if( !spot->s.groundEntityNum )
      continue;

    if( spot->clientSpawnTime > 0 )
      continue;

    if( G_CheckSpawnPoint( spot->s.number, spot->s.origin,
          spot->s.origin2, BA_H_SPAWN, NULL ) != NULL )
      continue;

    spots[ count ] = spot;
    count++;
  }

  if( !count )
    return NULL;

  return G_ClosestEnt( preference, spots, count );
}
开发者ID:ZdrytchX,项目名称:obstacle,代码行数:47,代码来源:g_client.c


示例5: 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


示例6: misc_weapon_shooter_aim

void misc_weapon_shooter_aim( gentity_t *self )
{
	//update my aim
	if ( self->target )
	{
		gentity_t *targ = G_Find( NULL, FOFS(targetname), self->target );
		if ( targ )
		{
			self->enemy = targ;
			VectorSubtract( targ->currentOrigin, self->currentOrigin, self->client->renderInfo.muzzleDir );
			VectorCopy( targ->currentOrigin, self->pos1 );
			vectoangles( self->client->renderInfo.muzzleDir, self->client->ps.viewangles );
			SetClientViewAngle( self, self->client->ps.viewangles );
			//FIXME: don't keep doing this unless target is a moving target?
			self->nextthink = level.time + FRAMETIME;
		}
		else
		{
			self->enemy = NULL;
		}
	}
}
开发者ID:Aura15,项目名称:OpenJK,代码行数:22,代码来源:g_weapon.cpp


示例7: BFIXED

gentity_t *SelectNearestDeathmatchSpawnPoint( bvec3_t from ) {
	gentity_t	*spot;
	bvec3_t		delta;
	bfixed		dist, nearestDist;
	gentity_t	*nearestSpot;

	nearestDist = BFIXED(999999,0);
	nearestSpot = NULL;
	spot = NULL;

	while ((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL) {

		VectorSubtract( spot->s.origin, from, delta );
		dist = FIXED_VEC3LEN( delta );
		if ( dist < nearestDist ) {
			nearestDist = dist;
			nearestSpot = spot;
		}
	}

	return nearestSpot;
}
开发者ID:Jsoucek,项目名称:q3ce,代码行数:22,代码来源:g_client.cpp


示例8: BotFrame

void BotFrame( void )
{
	gedict_t *te, *oself;

	oself = self;
	for ( te = world; ( te = trap_find( te, FOFS( s.v.classname ), "player" ) ); )
	{
		if ( te->has_disconnected )
			continue;

		if ( !te->isBot )
			continue;

		self = te;
		if( !tf_data.enable_bot )
		{
		        botDisconnect( self );
		        continue;
		}
		self->old_button0 = self->s.v.button0;
		self->old_button2 = self->s.v.button2;
		self->old_keys = self->keys;

               	self->s.v.button0 = 0;
       		self->s.v.button2 = 0;
       		self->s.v.impulse = 0;
       		self->keys = 0;
       		if( self->team_no && self->team_no != 1)
       		{
       		        G_bprint(3,"%s: i'm dont know how to play for team 2\n",self->s.v.netname);
       		        botDisconnect(self);
       		        continue;
       		}
       		Bot_AI(  );
		Bot_CL_KeyMove(  );
	}
	self = oself;

}
开发者ID:stayoutEE,项目名称:TF2003-qvm,代码行数:39,代码来源:qw.c


示例9: for

/*
==============================
G_UseTargets

"activator" should be set to the entity that initiated the firing.

Search for (string)targetname in all entities that
match (string)self.target and call their .use function

==============================
*/
void G_UseTargets( gentity_t *ent, gentity_t *activator )
{
	gentity_t *t;

	if ( ent->targetShaderName && ent->targetShaderNewName )
	{
		float f = level.time * 0.001;
		AddRemap( ent->targetShaderName, ent->targetShaderNewName, f );
		trap_SetConfigstring( CS_SHADERSTATE, BuildShaderStateConfig() );
	}

	if ( !ent->target )
	{
		return;
	}

	t = NULL;

	while ( ( t = G_Find( t, FOFS( targetname ), ent->target ) ) != NULL )
	{
		if ( t == ent )
		{
			G_Printf( "WARNING: Entity used itself.\n" );
		}
		else
		{
			if ( t->use )
			{
				t->use( t, ent, activator );
			}
		}

		if ( !ent->inuse )
		{
			G_Printf( "entity was removed while using targets\n" );
			return;
		}
	}
}
开发者ID:Sixthly,项目名称:Unvanquished,代码行数:50,代码来源:g_utils.c


示例10: Eng_DispUnload

void Eng_DispUnload(  )
{
    gedict_t *disp;
    float power;

    for ( disp = world; (disp = trap_find( disp, FOFS( s.v.classname ), "building_dispenser" )); )
    {
	disp->s.v.ammo_cells = disp->s.v.ammo_cells - 20;
	disp->s.v.ammo_rockets = disp->s.v.ammo_rockets - 15;
	if ( disp->s.v.ammo_rockets < 0 )
	    disp->s.v.ammo_rockets = 0;
	if ( disp->s.v.ammo_cells < 0 )
	    disp->s.v.ammo_cells = 0;
	self->hook_out = 0;
	power = ceil( 25 + disp->s.v.ammo_rockets * 1.5 + disp->s.v.ammo_cells );
	if ( power > 250 )
	    power = 250;
	G_bprint( 2, "maximum detdispenser damage - %.0f\n", power );
	return;
    }
    G_sprint( self, 2, "no disp\n" );
}
开发者ID:MrPnut,项目名称:QHome,代码行数:22,代码来源:engineer.c


示例11: while

gentity_t *SelectNearestDeathmatchSpawnPoint( vec3_t from ) {
	gentity_t	*spot;
	vec3_t		delta;
	float		dist, nearestDist;
	gentity_t	*nearestSpot;

	nearestDist = 999999;
	nearestSpot = NULL;
	spot = NULL;

	while ((spot = G_Find (spot, FOFS(classname), "info_player_deathmatch")) != NULL) {

		VectorSubtract( spot->s.origin, from, delta );
		dist = VectorLength( delta );
		if ( dist < nearestDist ) {
			nearestDist = dist;
			nearestSpot = spot;
		}
	}

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


示例12: SP_FixCoopSpots

static void SP_FixCoopSpots(edict_t *self){
	edict_t	*spot;
	vec3_t	d;
	
	spot = NULL;
	
	while(1){
		spot = G_Find(spot, FOFS(classname), "info_player_start");
		if(!spot)
			return;
		if(!spot->targetname)
			continue;
		VectorSubtract(self->s.origin, spot->s.origin, d);
		if(VectorLength(d) < 384){
			if((!self->targetname) || Q_stricmp(self->targetname, spot->targetname) != 0){
				//				gi.dprintf("FixCoopSpots changed %s at %s targetname from %s to %s\n", self->classname, vtos(self->s.origin), self->targetname, spot->targetname);
				self->targetname = spot->targetname;
			}
			return;
		}
	}
}
开发者ID:luaman,项目名称:qforge-2,代码行数:22,代码来源:p_client.c


示例13: ClassIsRestricted

int ClassIsRestricted( int tno, int pc )
{
	int     max, num = 0;
	gedict_t *te;

	if ( pc <= 0 || pc > 10 )
		return 0;
	if ( !tno )
		return 0;

	max = GetSVInfokeyInt( li_classrestricted[pc-1][0], li_classrestricted[pc-1][1], 0 );

	if ( max > 0 )
	{
	        for ( te = world; ( te = trap_find( te, FOFS( s.v.classname ), "player" ) ); )
		{
			if ( te->team_no == tno )
			{
				if ( pc == 10 )
				{
					if ( te->tfstate & TFSTATE_RANDOMPC )
						num++;
				} else
				{
					if ( te->playerclass == pc || te->nextpc == pc )
					{
						if ( !( te->tfstate & TFSTATE_RANDOMPC ) )
							num++;
					}
				}
			}
		}
		if ( num >= max )
			return 1;
	}
	if ( max == -1 )
		return 1;
	return 0;
}
开发者ID:MrPnut,项目名称:QHome,代码行数:39,代码来源:tforttm.c


示例14: drawhline

static void drawhline(int x,int y,int w,GrxColor color) {
    int copr, pl;
    GR_int32u offs;
    GRX_ENTER();
    copr = C_OPER(color);
    offs = FOFS(x,y,CURC->gc_line_offset);
    for (pl=0; pl < 3; ++pl) {
      if(DOCOLOR8(color,copr)) {
        GR_repl cval = freplicate_b(color);
        char *pp = &GRX_FRAME_MEMORY_PLANE(&CURC->gc_base_address,pl)[offs];
        int ww = w;
        switch(copr) {
            case C_XOR: repfill_b_xor(pp,cval,ww); break;
            case C_OR:  repfill_b_or( pp,cval,ww); break;
            case C_AND: repfill_b_and(pp,cval,ww); break;
            default:    repfill_b(    pp,cval,ww); break;
        }
      }
      color >>= 8;
    }
    GRX_LEAVE();
}
开发者ID:ev3dev,项目名称:grx,代码行数:22,代码来源:ram3x8.c


示例15: EAVYSpawnTeamNearFlag

void EAVYSpawnTeamNearFlag(edict_t *flag)
{
    edict_t *spot = NULL;
    float   dist;
    vec3_t  v;

    while(spot = G_Find (spot, FOFS(classname), "info_player_deathmatch"))
    {
        VectorSubtract (spot->s.origin, flag->s.origin, v);
        dist = VectorLength (v);
        if (EAVY_RESTRICTED_RADIUS > dist)
        {
            if (!strcmp(flag->classname, "item_flag_team1"))
                spot->classname = "info_player_team1";
            if (!strcmp(flag->classname, "item_flag_team2"))
                spot->classname = "info_player_team2";
            spot->svflags |= SVF_NOCLIENT;
            spot->solid = SOLID_NOT;
            ED_CallSpawn (spot);
        }
    }
}
开发者ID:qbism,项目名称:tmg,代码行数:22,代码来源:eavy.c


示例16: target_laser_start

void target_laser_start(gentity_t *self)
{
    gentity_t *ent;

    self->s.eType = ET_BEAM;

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

        if(!ent)
        {
            G_Printf("%s at %s: %s is a bad target\n", self->classname, vtos(self->s.origin), self->target);
        }

        self->enemy = ent;
    }
    else
    {
        G_SetMovedir(self->s.angles, self->movedir);
    }

    self->use = target_laser_use;
    self->think = target_laser_think;

    if(!self->damage)
    {
        self->damage = 1;
    }

    if(self->spawnflags & 1)
    {
        target_laser_on(self);
    }
    else
    {
        target_laser_off(self);
    }
}
开发者ID:Justasic,项目名称:RTCW-SP,代码行数:39,代码来源:g_target.c


示例17: FindIntermissionPoint

/*
==================
FindIntermissionPoint

This is also used for spectator spawns
==================
*/
void FindIntermissionPoint( void ) {
	gentity_t	*ent, *target;
	vec3_t		dir;

	// find the intermission spot
	ent = G_Find (NULL, FOFS(classname), "info_player_intermission");
	if ( !ent ) {	// the map creator forgot to put in an intermission point...
		SelectSpawnPoint ( vec3_origin, level.intermission_origin, level.intermission_angle, qfalse );
	} else {
		VectorCopy (ent->s.origin, level.intermission_origin);
		VectorCopy (ent->s.angles, level.intermission_angle);
		// if it has a target, look towards it
		if ( ent->target ) {
			target = G_PickTarget( ent->target );
			if ( target ) {
				VectorSubtract( target->s.origin, level.intermission_origin, dir );
				vectoangles( dir, level.intermission_angle );
			}
		}
	}

}
开发者ID:CarlGammaSagan,项目名称:Quake-3-Android-Port-QIII4A,代码行数:29,代码来源:g_main.c


示例18: target_teleporter_use

static void target_teleporter_use( edict_t *self, edict_t *other, edict_t *activator )
{
	edict_t	*dest;

	if( !G_PlayerCanTeleport( activator ) )
		return;

	if( ( self->s.team != TEAM_SPECTATOR ) && ( self->s.team != activator->s.team ) )
		return;
	if( self->spawnflags & 1 && activator->r.client->ps.pmove.pm_type != PM_SPECTATOR )
		return;

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

	G_TeleportPlayer( activator, dest );
}
开发者ID:cfr,项目名称:qfusion,代码行数:22,代码来源:g_target.cpp


示例19: 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


示例20: shipboundary_touch

void shipboundary_touch( gentity_t *self, gentity_t *other, trace_t *trace )
{
	gentity_t *ent;

	if (!other || !other->inuse || !other->client ||
		other->s.number < MAX_CLIENTS ||
		!other->m_pVehicle)
	{ //only let vehicles touch
		return;
	}

	if ( other->client->ps.hyperSpaceTime && level.time - other->client->ps.hyperSpaceTime < HYPERSPACE_TIME )
	{//don't interfere with hyperspacing ships
		return;
	}

	ent = G_Find (NULL, FOFS(targetname), self->target);
	if (!ent || !ent->inuse)
	{ //this is bad
		trap->Error(ERR_DROP, "trigger_shipboundary has invalid target '%s'\n", self->target);
		return;
	}

	if (!other->client->ps.m_iVehicleNum || other->m_pVehicle->m_iRemovedSurfaces)
	{ //if a vehicle touches a boundary without a pilot in it or with parts missing, just blow the thing up
		G_Damage(other, other, other, NULL, other->client->ps.origin, 99999, DAMAGE_NO_PROTECTION, MOD_SUICIDE);
		return;
	}

	//make sure this sucker is linked so the prediction knows where to go
	trap->LinkEntity((sharedEntity_t *)ent);

	other->client->ps.vehTurnaroundIndex = ent->s.number;
	other->client->ps.vehTurnaroundTime = level.time + (self->genericValue1*2);

	//keep up the detailed checks for another 2 seconds
	self->genericValue7 = level.time + 2000;
}
开发者ID:lNightCrawlerl,项目名称:JediKnightGalaxies,代码行数:38,代码来源:g_trigger.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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