當前位置: 首頁>>代碼示例>>C++>>正文


C++ G_SpawnInt函數代碼示例

本文整理匯總了C++中G_SpawnInt函數的典型用法代碼示例。如果您正苦於以下問題:C++ G_SpawnInt函數的具體用法?C++ G_SpawnInt怎麽用?C++ G_SpawnInt使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了G_SpawnInt函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: G_SpawnItem

/*
============
G_SpawnItem

Sets the clipping size and plants the object on the floor.

Items can't be immediately dropped to floor, because they might
be on an entity that hasn't spawned yet.
============
*/
void G_SpawnItem (gentity_t *ent, gitem_t *item) {
	char	*noise;
	
	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnFloat( "wait", "0", &ent->wait );
	
	ent->item = item;
	// some movers spawn on the second frame, so delay item
	// spawns until the third frame so they can ride trains
	ent->nextthink = level.time + FRAMETIME * 2;
	ent->think = FinishSpawningItem;

	if(G_SpawnString("noise", 0, &noise))
		ent->noise_index = G_SoundIndex(noise);

	ent->physicsBounce = 0.50;		// items are bouncy

	if(ent->model) {
		ent->s.modelindex2 = G_ModelIndex(ent->model);
	}

	if ( item->giType == IT_TEAM ) {
		G_SpawnInt( "count", "1", &ent->s.density );
		G_SpawnInt( "speedscale", "100", &ent->splashDamage );
		if( !ent->splashDamage ) {
			ent->splashDamage = 100;
		}
	}
}
開發者ID:BackupTheBerlios,項目名稱:et-flf-svn,代碼行數:39,代碼來源:g_items.c

示例2: SP_CreatePuffSystem

//----------------------------------------------------------
void SP_CreatePuffSystem( gentity_t *ent )
{ 
	char	temp[128];

	// Initialize the puff system to either 1000 particles or whatever they choose.
	G_SpawnInt( "count", "1000", &ent->count );
	cvar_t *r_weatherScale = gi.cvar( "r_weatherScale", "1", CVAR_ARCHIVE );

	// See which puff system to use.
	int iPuffSystem = 0;
	int iVal = 0;
	if ( G_SpawnInt( "whichsystem", "0", &iVal ) )
	{
		iPuffSystem = iVal;
		if ( iPuffSystem < 0 || iPuffSystem > 1 )
		{
			iPuffSystem = 0;
			//ri.Error( ERR_DROP, "Weather Effect: Invalid value for whichsystem key" );
			Com_Printf( "Weather Effect: Invalid value for whichsystem key\n" );
		}
	}

	if ( r_weatherScale->value > 0.0f )
	{
		sprintf( temp, "puff%i init %i", iPuffSystem, (int)( ent->count * r_weatherScale->value ));

		G_FindConfigstringIndex( temp, CS_WORLD_FX, MAX_WORLD_FX, qtrue );

		// Should return here??? It didn't originally...
	}

	// See whether we should have the saber spark from the puff system.
	iVal = 0;
	G_SpawnInt( "sabersparks", "0", &iVal );
	if ( iVal == 1 )
		level.worldFlags |= WF_PUFFING;
	else
		level.worldFlags &= ~WF_PUFFING;

	// Go through all the fields and assign the values to the created puff system now.
	for ( int i = 0; i < 20; i++ )
	{
		char *key = NULL;
		char *value = NULL;
		// Fetch a field.
		if ( !G_SpawnField( i, &key, &value ) )
			continue;

		// Make sure we don't get key's that are worthless.
		if ( Q_stricmp( key, "origin" ) == 0 || Q_stricmp( key, "classname" ) == 0 ||
			 Q_stricmp( key, "count" ) == 0 || Q_stricmp( key, "targetname" ) == 0  ||
			 Q_stricmp( key, "sabersparks" ) == 0 || Q_stricmp( key, "whichsystem" ) == 0 )
			continue;

		// Send the command.
		_snprintf( temp, 128, "puff%i %s %s", iPuffSystem, key, value );
		G_FindConfigstringIndex( temp, CS_WORLD_FX, MAX_WORLD_FX, qtrue );
 	}
}
開發者ID:3ddy,項目名稱:Jedi-Academy,代碼行數:60,代碼來源:g_fx.cpp

示例3: SP_trigger_stage

void SP_trigger_stage( gentity_t *self )
{
    G_SpawnInt( "team", "0", (int *)&self->stageTeam );
    G_SpawnInt( "stage", "0", (int *)&self->stageStage );

    self->use = trigger_stage_use;

    self->r.svFlags = SVF_NOCLIENT;
}
開發者ID:redrumrobot,項目名稱:trem-gpp-bots,代碼行數:9,代碼來源:g_trigger.c

示例4: G_SpawnGEntityFromSpawnVars

/*
===================
G_SpawnGEntityFromSpawnVars

Spawn an entity and fill in all of the level fields from
level.spawnVars[], then call the class specfic spawn function
===================
*/
void G_SpawnGEntityFromSpawnVars( void ) {
	int			i;
	gentity_t	*ent;
	char		*s, *value, *gametypeName;
	static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"};

	// get the next free entity
	ent = G_Spawn();

	for ( i = 0 ; i < level.numSpawnVars ; i++ ) {
		G_ParseField( level.spawnVars[i][0], level.spawnVars[i][1], ent );
	}

	// check for "notsingle" flag
	if ( g_gametype.integer == GT_SINGLE_PLAYER ) {
		G_SpawnInt( "notsingle", "0", &i );
		if ( i ) {
			G_FreeEntity( ent );
			return;
		}
	}
	// check for "notteam" flag (GT_FFA, GT_DUEL, GT_SINGLE_PLAYER)
	if ( g_gametype.integer >= GT_TEAM ) {
		G_SpawnInt( "notteam", "0", &i );
		if ( i ) {
			G_FreeEntity( ent );
			return;
		}
	} else {
		G_SpawnInt( "notfree", "0", &i );
		if ( i ) {
			G_FreeEntity( ent );
			return;
		}
	}

	if( G_SpawnString( "gametype", NULL, &value ) ) {
		if( g_gametype.integer >= GT_FFA && g_gametype.integer < GT_MAX_GAME_TYPE ) {
			gametypeName = gametypeNames[g_gametype.integer];

			s = strstr( value, gametypeName );
			if( !s ) {
				G_FreeEntity( ent );
				return;
			}
		}
	}

	// move editor origin to pos
	VectorCopy( ent->s.origin, ent->s.pos.trBase );
	VectorCopy( ent->s.origin, ent->r.currentOrigin );

	// if we didn't get a classname, don't bother spawning anything
	if ( !G_CallSpawn( ent ) ) {
		G_FreeEntity( ent );
	}
}
開發者ID:LuckyBro,項目名稱:sgfork,代碼行數:65,代碼來源:g_spawn.c

示例5: SP_info_player_deathmatch

/*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 32) initial
potential spawning position for deathmatch games.
The first time a player enters the game, they will be at an 'initial' spot.
Targets will be fired when someone spawns in on them.
"nobots" will prevent bots from using this spot.
"nohumans" will prevent non-bots from using this spot.
*/
void SP_info_player_deathmatch( gentity_t *ent ) {
	int		i;

	G_SpawnInt( "nobots", "0", &i);
	if ( i ) {
		ent->flags |= FL_NO_BOTS;
	}
	G_SpawnInt( "nohumans", "0", &i );
	if ( i ) {
		ent->flags |= FL_NO_HUMANS;
	}
}
開發者ID:zturtleman,項目名稱:swarmedq3,代碼行數:19,代碼來源:g_client.c

示例6: SP_misc_turretG2

//-----------------------------------------------------
void SP_misc_turretG2( gentity_t *base )
//-----------------------------------------------------
{
    int customscaleVal;
    char* s;

    turretG2_set_models( base, qfalse );

    G_SpawnInt("painwait", "0", &base->genericValue4);
    base->genericValue8 = 0;

    G_SpawnInt("customscale", "0", &customscaleVal);
    base->s.iModelScale = customscaleVal;
    if (base->s.iModelScale)
    {
        if (base->s.iModelScale > 1023)
        {
            base->s.iModelScale = 1023;
        }
        base->modelScale[0] = base->modelScale[1] = base->modelScale[2] = base->s.iModelScale/100.0f;
    }

    G_SpawnString( "icon", "", &s );
    if (s && s[0])
    {
        // We have an icon, so index it now.  We are reusing the genericenemyindex
        // variable rather than adding a new one to the entity state.
        base->s.genericenemyindex = G_IconIndex(s);
    }

    finish_spawning_turretG2( base );

    if (( base->spawnflags & 1 )) // Start_Off
    {
        base->s.frame = 1; // black
    }
    else
    {
        base->s.frame = 0; // glow
    }
    if ( !(base->spawnflags&SPF_TURRETG2_TURBO) )
    {
        base->s.eFlags |= EF_SHADER_ANIM;
    }

    if (base->spawnflags & SPF_SHOWONRADAR)
    {
        base->s.eFlags |= EF_RADAROBJECT;
    }
#undef name
#undef name2
#undef name3
}
開發者ID:Atlas-zz,項目名稱:SDK-JKA-ACADEMIE-HCF,代碼行數:54,代碼來源:g_turret_G2.c

示例7: SP_rail_lane

void SP_rail_lane(gentity_t *ent)
{
 	gi.SetBrushModel(ent, ent->model);
	G_SpawnInt("delay", "0", &ent->delay);
	mRailLanes.push_back().Setup(ent);
	G_FreeEntity(ent);
}
開發者ID:BishopExile,項目名稱:OpenJK,代碼行數:7,代碼來源:g_rail.cpp

示例8: SP_trigger_heal

/*
===============
SP_trigger_heal
===============
*/
void SP_trigger_heal( gentity_t *self )
{
	G_SpawnInt( "heal", "5", &self->damage );

	if ( self->damage <= 0 )
	{
		self->damage = 1;
		G_Printf( S_COLOR_YELLOW "WARNING: trigger_heal with negative damage key\n" );
	}

	self->touch = trigger_heal_touch;
	self->use = trigger_heal_use;

	InitTrigger( self );

	// link in to the world if starting active
	if ( self->spawnflags & 1 )
	{
		trap_UnlinkEntity( self );
	}
	else
	{
		trap_LinkEntity( self );
	}
}
開發者ID:Sixthly,項目名稱:Unvanquished,代碼行數:30,代碼來源:g_trigger.c

示例9: SP_gfx_light_flare

void SP_gfx_light_flare( gentity_t *self )
{
	self->s.eType = ET_LIGHTFLARE;
	self->s.modelindex = G_ShaderIndex( self->shaderKey );
	VectorCopy( self->activatedPosition, self->s.origin2 );

	//try to find a spot near to the flare which is empty. This
	//is used to facilitate visibility testing
	findEmptySpot( self->s.origin, 8.0f, self->s.angles2 );

	self->act = gfx_light_flare_toggle;

	if( !self->config.speed )
		self->config.speed = 200;

	self->s.time = self->config.speed;

	G_SpawnInt( "mindist", "0", &self->s.generic1 );

	if ( self->spawnflags & SPF_SPAWN_DISABLED )
	{
		self->s.eFlags |= EF_NODRAW;
	}

	trap_LinkEntity( self );
}
開發者ID:JacksonTech,項目名稱:Unvanquished,代碼行數:26,代碼來源:sg_spawn_gfx.cpp

示例10: multiplier

/*QUAKED script_mover (0.5 0.25 1.0) ? TRIGGERSPAWN SOLID EXPLOSIVEDAMAGEONLY
Scripted brush entity. A simplified means of moving brushes around based on events.

"modelscale" - Scale multiplier (defaults to 1, and scales uniformly)
"modelscale_vec" - Set scale per-axis.  Overrides "modelscale", so if you have both the "modelscale" is ignored
"model2" optional md3 to draw over the solid clip brush
"scriptname" name used for scripting purposes (like aiName in AI scripting)
"health" optionally make this entity damagable
*/
void SP_script_mover( gentity_t *ent ) {

	float scale[3] = {1,1,1};
	vec3_t scalevec;

	if ( !ent->model ) {
		G_Error( "script_model_med must have a \"model\"\n" );
	}
	if ( !ent->scriptName ) {
		G_Error( "script_model_med must have a \"scriptname\"\n" );
	}

	ent->blocked = script_mover_blocked;

	// first position at start
	VectorCopy( ent->s.origin, ent->pos1 );

//	VectorCopy( ent->r.currentOrigin, ent->pos1 );
	VectorCopy( ent->pos1, ent->pos2 ); // don't go anywhere just yet

	trap_SetBrushModel( ent, ent->model );

	InitMover( ent );
	ent->reached = NULL;

	if ( ent->spawnflags & 1 ) {
		ent->use = script_mover_use;
		trap_UnlinkEntity( ent ); // make sure it's not visible
		return;
	}

	G_SetAngle( ent, ent->s.angles );

	G_SpawnInt( "health", "0", &ent->health );
	if ( ent->health ) {
		ent->takedamage = qtrue;
	}

	ent->die = script_mover_die;
	ent->pain = script_mover_pain;

	// look for general scaling
	if ( G_SpawnFloat( "modelscale", "1", &scale[0] ) ) {
		scale[2] = scale[1] = scale[0];
	}

	// look for axis specific scaling
	if ( G_SpawnVector( "modelscale_vec", "1 1 1", &scalevec[0] ) ) {
		VectorCopy( scalevec, scale );
	}

	if ( scale[0] != 1 || scale[1] != 1 || scale[2] != 1 ) {
//		ent->s.eType		= ET_MOVERSCALED;
		ent->s.density      = ET_MOVERSCALED;
		// scale is stored in 'angles2'
		VectorCopy( scale, ent->s.angles2 );
	}

	script_mover_spawn( ent );
}
開發者ID:JackalFrost,項目名稱:RTCW-WSGF,代碼行數:69,代碼來源:g_script.c

示例11: EnergyShieldStationSettings

/*
================
EnergyShieldStationSettings
================
*/
void EnergyShieldStationSettings(gentity_t *ent)
{
	G_SpawnInt( "count", "0", &ent->count );

	if (!ent->count)
	{
		ent->count = 50; 
	}

	G_SpawnInt("chargerate", "0", &ent->bolt_Head);

	if (!ent->bolt_Head)
	{
		ent->bolt_Head = STATION_RECHARGE_TIME;
	}
}
開發者ID:Boothand,項目名稱:Birdbones,代碼行數:21,代碼來源:g_misc.c

示例12: G_SpawnGEntityFromSpawnVars

/*
===================
G_SpawnGEntityFromSpawnVars

Spawn an entity and fill in all of the level fields from
level.spawnVars[], then call the class specfic spawn function
===================
*/
void G_SpawnGEntityFromSpawnVars( void )
{
  int         i;
  gentity_t   *ent;

  // get the next free entity
  ent = G_Spawn( );

  for( i = 0 ; i < level.numSpawnVars ; i++ )
    G_ParseField( level.spawnVars[ i ][ 0 ], level.spawnVars[ i ][ 1 ], ent );

  G_SpawnInt( "notq3a", "0", &i );

  if( i )
  {
    G_FreeEntity( ent );
    return;
  }

  // move editor origin to pos
  VectorCopy( ent->s.origin, ent->s.pos.trBase );
  VectorCopy( ent->s.origin, ent->r.currentOrigin );

  // if we didn't get a classname, don't bother spawning anything
  if( !G_CallSpawn( ent ) )
    G_FreeEntity( ent );
}
開發者ID:redrumrobot,項目名稱:korx,代碼行數:35,代碼來源:g_spawn.c

示例13: SP_misc_beam

void SP_misc_beam(gentity_t *self)
{
	char           *str;

	G_SpawnString("target2", "", &str);

	if (*str)
	{
		self->message = G_NewString(str);
	}

	G_SpawnString("shader", "lightningBolt", &str);

	if (*str)
	{
		self->s.modelindex2 = G_ShaderIndex(str);
	}

	G_SpawnInt("scale", "1", &self->s.torsoAnim);
	G_SpawnVector("color", "1 1 1", self->s.angles2);

	// let everything else get spawned before we start firing
	self->accuracy = 0;
	self->think = misc_beam_start;
	self->nextthink = level.time + FRAMETIME;
}
開發者ID:morsik,項目名稱:warpig,代碼行數:26,代碼來源:g_target.c

示例14: game

/*QUAKED target_fog (1 1 0) (-8 -8 -8) (8 8 8)
color picker chooses color of fog
"distance" sets fog distance.  Use value '0' to give control back to the game (and use the fog values specified in the sky shader if present)
"time" time it takes to change fog to new value.  default time is 1 sec
*/
void SP_target_fog(gentity_t *ent)
{
	int             dist;
	float           ftime;

	ent->use = Use_target_fog;

	// ent->s.density will carry the 'distance' value
	if (G_SpawnInt("distance", "0", &dist))
	{
		if (dist >= 0)
		{
			ent->s.density = dist;
		}
	}

	// ent->s.time will carry the 'time' value
	if (G_SpawnFloat("time", "0.5", &ftime))
	{
		if (ftime >= 0)
		{
			ent->s.time = ftime * 1000;	// sec to ms
		}
	}
}
開發者ID:morsik,項目名稱:warpig,代碼行數:30,代碼來源:g_target.c

示例15: blocked

/*QUAKED func_pendulum (0 .5 .8) ?
You need to have an origin brush as part of this entity.
Pendulums always swing north / south on unrotated models.  Add an angles field to the model to allow rotation in other directions.
Pendulum frequency is a physical constant based on the length of the beam and gravity.
"model2"	.md3 model to also draw
"speed"		the number of degrees each way the pendulum swings, (30 default)
"phase"		the 0.0 to 1.0 offset in the cycle to start at
"dmg"		damage to inflict when blocked (2 default)
"color"		constantLight color
"light"		constantLight radius
*/
void SP_func_pendulum(gentity_t *ent) {
	float		freq;
	float		length;
	float		phase;
	float		speed;

	G_SpawnFloat( "speed", "30", &speed );
	G_SpawnInt( "dmg", "2", &ent->damage );
	G_SpawnFloat( "phase", "0", &phase );

	trap_SetBrushModel( ent, ent->model );

	// find pendulum length
	length = fabs( ent->r.mins[2] );
	if ( length < 8 ) {
		length = 8;
	}

	freq = 1 / ( M_PI * 2 ) * sqrt( g_gravity.value / ( 3 * length ) );

	ent->s.pos.trDuration = ( 1000 / freq );

	InitMover( ent );

	VectorCopy( ent->s.origin, ent->s.pos.trBase );
	VectorCopy( ent->s.origin, ent->r.currentOrigin );

	VectorCopy( ent->s.angles, ent->s.apos.trBase );

	ent->s.apos.trDuration = 1000 / freq;
	ent->s.apos.trTime = ent->s.apos.trDuration * phase;
	ent->s.apos.trType = TR_SINE;
	ent->s.apos.trDelta[2] = speed;
}
開發者ID:AHPlankton,項目名稱:Quake-III-Arena,代碼行數:45,代碼來源:g_mover.c


注:本文中的G_SpawnInt函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。