Example #1
0
/*
============
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;
		}
	}
}
Example #2
0
//----------------------------------------------------------
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 );
 	}
}
Example #3
0
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;
}
Example #4
0
/*
===================
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 );
	}
}
Example #5
0
/*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;
	}
}
//-----------------------------------------------------
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
}
Example #7
0
/*QUAKED trigger_multiple (.1 .5 .1) ? CLIENTONLY FACING USE_BUTTON FIRE_BUTTON NPCONLY x x INACTIVE MULTIPLE
CLIENTONLY - only a player can trigger this by touch
FACING - Won't fire unless triggering ent's view angles are within 45 degrees of trigger's angles (in addition to any other conditions)
USE_BUTTON - Won't fire unless player is in it and pressing use button (in addition to any other conditions)
FIRE_BUTTON - Won't fire unless player/NPC is in it and pressing fire button (in addition to any other conditions)
NPCONLY - only non-player NPCs can trigger this by touch
INACTIVE - Start off, has to be activated to be touchable/usable
MULTIPLE - multiple entities can touch this trigger in a single frame *and* if needed, the trigger can have a wait of > 0

"wait"		Seconds between triggerings, 0 default, number < 0 means one time only.
"random"	wait variance, default is 0
"delay"		how many seconds to wait to fire targets after tripped
"hiderange" As long as NPC's head is in this trigger, NPCs out of this hiderange cannot see him.  If you set an angle on the trigger, they're only hidden from enemies looking in that direction.  the player's crouch viewheight is 36, his standing viewheight is 54.  So a trigger thast should hide you when crouched but not standing should be 48 tall.
"target2"	The trigger will fire this only when the trigger has been activated and subsequently 'cleared'( once any of the conditions on the trigger have not been satisfied).  This will not fire the "target" more than once until the "target2" is fired (trigger field is 'cleared')
"speed"		How many seconds to wait to fire the target2, default is 1
"noise"		Sound to play when the trigger fires (plays at activator's origin)
"NPC_targetname"  Only the NPC with this NPC_targetname fires this trigger

Variable sized repeatable trigger.  Must be targeted at one or more entities.
so, the basic time between firing is a random time between
(wait - random) and (wait + random)

"team" - If set, only this team can trip this trigger
	0 - any
	1 - red
	2 - blue

"soundSet"	Ambient sound set to play when this trigger is activated

usetime		-	If specified (in milliseconds) along with the USE_BUTTON flag, will
				require a client to hold the use key for x amount of ms before firing.

Applicable only during Siege gametype:
teamuser	-	if 1, team 2 can't use this. If 2, team 1 can't use this.
siegetrig	-	if non-0, can only be activated by players carrying a misc_siege_item
				which is associated with this trigger by the item's goaltarget value.
teambalance	-	if non-0, is "owned" by the last team that activated. Can only be activated
				by the other team if the number of players on the other team inside	the
				trigger outnumber the number of players on the owning team inside the
				trigger.
target3		-	fire when activated by team1
target4		-	fire when activated by team2

idealclass	-	Can only be used by this class/these classes. You can specify use by
				multiple classes with the use of |, e.g.:
				"Imperial Medic|Imperial Assassin|Imperial Demolitionist"
*/
void SP_trigger_multiple( gentity_t *ent ) 
{
	char	*s;
	if ( G_SpawnString( "noise", "", &s ) ) 
	{
		if (s && s[0])
		{
			ent->noise_index = G_SoundIndex(s);
		}
		else
		{
			ent->noise_index = 0;
		}
	}

	G_SpawnInt("usetime", "0", &ent->genericValue7);

	//For siege gametype
	G_SpawnInt("siegetrig", "0", &ent->genericValue1);
    G_SpawnInt("teambalance", "0", &ent->genericValue2);

	G_SpawnInt("delay", "0", &ent->delay);

	if ( (ent->wait > 0) && (ent->random >= ent->wait) ) {
		ent->random = ent->wait - FRAMETIME;
		Com_Printf(S_COLOR_YELLOW"trigger_multiple has random >= wait\n");
	}

	ent->delay *= 1000;//1 = 1 msec, 1000 = 1 sec
	if ( !ent->speed && ent->target2 && ent->target2[0] )
	{
		ent->speed = 1000;
	}
	else
	{
		ent->speed *= 1000;
	}

	ent->touch = Touch_Multi;
	ent->use   = Use_Multi;

	if ( ent->team && ent->team[0] )
	{
		ent->alliedTeam = atoi(ent->team);
		ent->team = NULL;
	}

	InitTrigger( ent );
	trap->LinkEntity((sharedEntity_t *)ent);
}
Example #8
0
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);
}
Example #9
0
/*
===============
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 );
	}
}
Example #10
0
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 );
}
Example #11
0
/*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 );
}
Example #12
0
/*
================
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;
	}
}
Example #13
0
/*
===================
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 );
}
Example #14
0
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;
}
Example #15
0
/*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
		}
	}
}
Example #16
0
/*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;
}
Example #17
0
void SP_trigger_entdist( gentity_t *self ) 
{
	G_SpawnInt( "distance", "0", &self->count);

	self->e_UseFunc = useF_trigger_entdist_use;

}
Example #18
0
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;
}
Example #19
0
/*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;
	}
}
Example #20
0
/*
============
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" );
	}
}
Example #21
0
/*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
    }
}
Example #22
0
/*
===================
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 );
	}

	G_SpawnInt( "notep", "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 );
	}
}
Example #23
0
/*
================
AICast_DelayedSpawnCast
================
*/
void AICast_DelayedSpawnCast( gentity_t *ent, int castType )
{
	// ............................
	// head separation
	if(!ent->aiSkin)
		G_SpawnString( "skin", "", &ent->aiSkin);
	if(!ent->aihSkin)
		G_SpawnString( "head", "default", &ent->aihSkin);
	G_SpawnInt( "aiteam", "-1", &ent->aiTeam);
	// ............................
	

	// we have to wait a bit before spawning it, otherwise the server will just delete it, since it's treated like a client
	ent->think = AIChar_spawn;
	ent->nextthink = level.time + FRAMETIME*4;	// have to wait more than 3 frames, since the server runs 3 frames before it clears all clients

	// we don't really want to start this character right away, but if we don't spawn the client
	// now, if the game gets saved after the character spawns in, when it gets re-loaded, the client
	// won't get spawned properly.
	if (ent->spawnflags & 1) // TriggerSpawn
	{
		ent->AIScript_AlertEntity = AIChar_AIScript_AlertEntity;	
		ent->aiInactive = qtrue;
	}

	// RF, had to move this down since some dev maps don't properly spawn the guys in, so we
	// get a crash when transitioning between levels after they all spawn at once (overloading
	// the client/server command buffers)
	ent->nextthink += FRAMETIME * ((numSpawningCast+1) / 3);	// space them out a bit so we don't overflow the client

	ent->aiCharacter = castType;
	numSpawningCast++;
}
Example #24
0
/*QUAKED target_fx (0 0 1) (-8 -8 -8) (8 8 8)
*/
void SP_target_fx(gentity_t * self)
{
	char           *effectName;
	int             startOn = 0;

	self->s.eType = ET_INVISIBLE;

	G_SpawnFloat("wait", "0.5", &self->wait);
	G_SpawnFloat("random", "0", &self->random);

	G_SpawnInt("start_on", "0", &startOn);
	if(!startOn)
		self->s.eFlags |= EF_NODRAW;

	G_SpawnString("luaThink", "", &effectName);
	self->s.modelindex = G_EffectIndex(effectName);

	G_SetOrigin(self, self->s.origin);

	// save angles
	VectorCopy(self->s.angles, self->s.apos.trBase);
	self->s.apos.trType = TR_STATIONARY;
	self->s.apos.trTime = 0;
	self->s.apos.trDuration = 0;
	VectorClear(self->s.apos.trDelta);
	//VectorCopy(origin, ent->r.currentAOrigin);

	VectorClear(self->r.mins);
	VectorClear(self->r.maxs);
	trap_LinkEntity(self);

	self->think = target_fx_think;
	self->nextthink = level.time + 1000;
}
Example #25
0
void SP_pos_location( gentity_t *self )
{
	char       *message;
	self->s.eType = entityType_t::ET_LOCATION;
	self->r.svFlags = SVF_BROADCAST;
	trap_LinkEntity( self );  // make the server send them to the clients

	if ( G_SpawnInt( "count", "", &self->customNumber) )
	{
		if ( self->customNumber < 0 )
		{
			self->customNumber = 0;
		}

		if ( self->customNumber > 7 )
		{
			self->customNumber = 7;
		}

		message = va( "%c%c%s^7", Color::Constants::ESCAPE, self->customNumber + '0',
		              self->message );
	}
	else
	{
		message = self->message;
	}

	self->nextPathSegment = level.locationHead;
	self->s.generic1 = G_LocationIndex(message);
	level.locationHead = self;

	G_SetOrigin( self, self->s.origin );
}
Example #26
0
/*
===================
G_SpawnGEntityFromSpawnVars

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

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

	// check for "notteam" / "notfree" flags
	G_SpawnInt("notteam", "0", &i);
	if (i)
	{
		G_FreeEntity(ent);
		return NULL;
	}

	// allowteams handling
	G_SpawnString("allowteams", "", &str);
	if (str[0])
	{
		str = Q_strlwr(str);
		if (strstr(str, "axis"))
		{
			ent->allowteams |= ALLOW_AXIS_TEAM;
		}
		if (strstr(str, "allies"))
		{
			ent->allowteams |= ALLOW_ALLIED_TEAM;
		}
		if (strstr(str, "cvops"))
		{
			ent->allowteams |= ALLOW_DISGUISED_CVOPS;
		}
	}

	if (ent->targetname && *ent->targetname)
	{
		ent->targetnamehash = BG_StringHashValue(ent->targetname);
	}
	else
	{
		ent->targetnamehash = -1;
	}

	// 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);
	}

	return ent;
}
Example #27
0
void SP_rail_track(gentity_t *ent)
{
	gi.SetBrushModel(ent, ent->model);
	G_SpawnInt("delay", "0", &ent->delay);
	mRailTracks.push_back().Setup(ent);
	G_FreeEntity(ent);
	mRailSystemActive = true;
}
Example #28
0
void SP_trigger_win( gentity_t *self )
{
    G_SpawnInt( "team", "0", (int *)&self->stageTeam );

    self->use = trigger_win;

    self->r.svFlags = SVF_NOCLIENT;
}
Example #29
0
/*
=======================================================================================================================================
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);
	}
	// check for "notteam"/"notfree" flags
	if (g_gametype.integer == GT_SINGLE_PLAYER) {
		G_SpawnInt("notsingle", "0", &i);

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

	if (g_gametype.integer >= GT_TEAM) {
		G_SpawnInt("notteam", "0", &i);

		if (i) {
			ADJUST_AREAPORTAL();
			G_FreeEntity(ent);
			return;
		}
	} else {
		G_SpawnInt("notfree", "0", &i);

		if (i) {
			ADJUST_AREAPORTAL();
			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)) {
		ADJUST_AREAPORTAL();
		G_FreeEntity(ent);
	}
}
Example #30
0
void SP_func_usable( gentity_t *self )
{
	gi.SetBrushModel( self, self->model );
	InitMover( self );
	VectorCopy( self->s.origin, self->s.pos.trBase );
	VectorCopy( self->s.origin, self->currentOrigin );
	VectorCopy( self->s.origin, self->pos1 );

	self->count = 1;
	if (self->spawnflags & 1)
	{
		self->spawnContents = self->contents;	// It Navs can temporarly turn it "on"
		self->s.solid = 0;
		self->contents = 0;
		self->clipmask = 0;
		self->svFlags |= SVF_NOCLIENT;
		self->s.eFlags |= EF_NODRAW;
		self->count = 0;
	}

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

	if (self->spawnflags & 4)
	{//FIXME: need to be able to do change to something when it's done?  Or not be usable until it's done?
		self->s.eFlags |= EF_ANIM_ONCE;
	}

	self->e_UseFunc = useF_func_usable_use;

	if ( self->health )
	{
		self->takedamage = qtrue;
		self->e_DieFunc = dieF_func_usable_die;
		self->e_PainFunc = painF_func_usable_pain;
	}

	if ( self->endFrame > 0 )
	{
		self->s.frame = self->startFrame = 0;
		self->s.eFlags |= EF_SHADER_ANIM;
	}

	gi.linkentity (self);

	int forceVisible = 0;
	G_SpawnInt( "forcevisible", "0", &forceVisible );
	if ( forceVisible )
	{//can see these through walls with force sight, so must be broadcast
		if ( VectorCompare( self->s.origin, vec3_origin ) )
		{//no origin brush
			self->svFlags |= SVF_BROADCAST;
		}
		self->s.eFlags |= EF_FORCE_VISIBLE;
	}
}