本文整理汇总了C++中G_SpawnInt函数的典型用法代码示例。如果您正苦于以下问题:C++ G_SpawnInt函数的具体用法?C++ G_SpawnInt怎么用?C++ G_SpawnInt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了G_SpawnInt函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: SP_trigger_entdist
void SP_trigger_entdist( gentity_t *self )
{
G_SpawnInt( "distance", "0", &self->count);
self->e_UseFunc = useF_trigger_entdist_use;
}
开发者ID:AlexXT,项目名称:OpenJK,代码行数:7,代码来源:g_trigger.cpp
示例17: SP_target_stoptimer
void SP_target_stoptimer(gentity_t *ent) {
char *t = NULL;
// Nico, used to look for parent
gentity_t *parent = NULL;
// Nico, override wait -1 or wait 9999 on stop timer entities
if (g_forceTimerReset.integer) {
parent = G_FindByTarget(NULL, ent->targetname);
if (parent && parent->wait != 0.5 && !Q_stricmp(parent->classname, "trigger_multiple")) {
G_DPrintf("%s: SP_target_stoptimer, wait found = %f, overrided to 0.5\n", GAME_VERSION, parent->wait);
G_SpawnFloat("wait", "0.5", &parent->wait);
}
}
G_SpawnString("name", "default", &t);
ent->timerunName = G_NewString(t);
// create a timerun with this name if it doesn't exit yet
GetTimerunNum(ent->timerunName);
G_SpawnInt("mincheckpoints", "0", &ent->count);
ent->use = target_stoptimer_use;
level.isTimerun = qtrue;
}
开发者ID:boutetnico,项目名称:ETrun,代码行数:26,代码来源:g_target.c
示例18: bob
/*QUAKED func_bobbing (0 .5 .8) ? X_AXIS Y_AXIS
Normally bobs on the Z axis
"model2" .md3 model to also draw
"height" amplitude of bob (32 default)
"speed" seconds to complete a bob cycle (4 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_bobbing (gentity_t *ent) {
float height;
float phase;
G_SpawnFloat( "speed", "4", &ent->speed );
G_SpawnFloat( "height", "32", &height );
G_SpawnInt( "dmg", "2", &ent->damage );
G_SpawnFloat( "phase", "0", &phase );
trap_SetBrushModel( ent, ent->model );
InitMover( ent );
VectorCopy( ent->s.origin, ent->s.pos.trBase );
VectorCopy( ent->s.origin, ent->r.currentOrigin );
ent->s.pos.trDuration = ent->speed * 1000;
ent->s.pos.trTime = ent->s.pos.trDuration * phase;
ent->s.pos.trType = TR_SINE;
// set the axis of bobbing
if ( ent->spawnflags & 1 ) {
ent->s.pos.trDelta[0] = height;
} else if ( ent->spawnflags & 2 ) {
ent->s.pos.trDelta[1] = height;
} else {
ent->s.pos.trDelta[2] = height;
}
}
开发者ID:AHPlankton,项目名称:Quake-III-Arena,代码行数:38,代码来源:g_mover.c
示例19: 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;
int page;
G_SpawnFloat( "random", "0", &ent->random );
G_SpawnFloat( "wait", "0", &ent->wait );
RegisterItem( item );
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_CLIPBOARD ) {
if ( G_SpawnInt( "notebookpage", "1", &page ) ) {
ent->key = page;
}
}
if ( item->giType == IT_POWERUP ) {
G_SoundIndex( "sound/items/poweruprespawn.wav" );
}
}
开发者ID:MAN-AT-ARMS,项目名称:iortcw-archive,代码行数:44,代码来源:g_items.c
示例20: 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)
distance value sets the type of fog. values > 1 are distance fog (ex. 2048), values < 1 are density fog (ex. .0002)
"near" is fog start distance when using distance fog
"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 startdist;
float ftime;
ent->use = Use_target_fog;
// ent->random will carry the 'far' or density value
G_SpawnInt("distance", "0", &dist);
if(dist >= 0)
{
ent->random = dist;
}
G_SpawnFloat("near", "1.0", &startdist);
ent->accuracy = startdist;
// ent->s.time will carry the 'time' value
G_SpawnFloat("time", "0.5", &ftime);
if(ftime >= 0)
{
ent->s.time = ftime * 1000; // sec to ms
}
}
开发者ID:Justasic,项目名称:RTCW-SP,代码行数:35,代码来源:g_target.c
注:本文中的G_SpawnInt函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论