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) {
	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnFloat( "wait", "0", &ent->wait );

	RegisterItem( item );
	if ( G_ItemDisabled(item) )
		return;

	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;

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

	if ( item->giType == IT_POWERUP ) {
		G_SoundIndex( "sound/items/poweruprespawn.wav" );
		G_SpawnFloat( "noglobalsound", "0", &ent->speed);
	}

	if ( item->giType == IT_PERSISTANT_POWERUP ) {
		// allow both teams to pick it up
		if ( ( ent->spawnflags & 2 ) && ( ent->spawnflags & 4 ) ) {
			ent->s.team = 255;
		}
		// only one team can pick it up
		else if ( ent->spawnflags & 2 )
			ent->s.team = TEAM_RED;
		else if ( ent->spawnflags & 4 )
			ent->s.team = TEAM_BLUE;
	}
}
Example #2
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) {
	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnFloat( "wait", "0", &ent->wait );

	RegisterItem( item );
	if ( G_ItemDisabled(item) )
		return;

	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;

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

	if ( item->giType == IT_POWERUP ) {
		G_SoundIndex( "sound/items/poweruprespawn.wav" );
		G_SpawnFloat( "noglobalsound", "0", &ent->speed);
	}

#ifdef MISSIONPACK
	if ( item->giType == IT_PERSISTANT_POWERUP ) {
		ent->s.generic1 = ent->spawnflags;
	}
#endif
}
Example #3
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.
============
*/
qboolean G_SpawnItem (gentity_t *ent, gitem_t *item) {
	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnFloat( "wait", "0", &ent->wait );

	RegisterItem( item );
	
	if ( G_ItemDisabled(item) )
		return qfalse;

	if ( g_spacetrader.integer ) {
		if ( !G_ST_exec( ST_SPAWN_ITEM, ent, item ) )
			return qfalse;
	}

	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;

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

	if ( item->giType == IT_PERSISTANT_POWERUP ) {
		ent->s.generic1 = ent->spawnflags;
	}

	return qtrue;
}
Example #4
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)
{
	G_SpawnFloat("random", "0", &ent->random);
	G_SpawnFloat("wait", "0", &ent->wait);

	//Elder: check spawn angles; client-side should make use of them too
	G_SpawnFloat("angle", "0", &ent->s.angles[1]);

	RegisterItem(item);
	if (G_ItemDisabled(item))
		return;

	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;
	//Makro - respawn function
	ent->reset = G_ResetItem;

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

	if (item->giType == IT_POWERUP) {
		G_SoundIndex("sound/items/poweruprespawn.wav");
		G_SpawnFloat("noglobalsound", "0", &ent->speed);
	}
}
Example #5
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) {
	G_SpawnFloat( "random", "0", &ent->random );
	G_SpawnFloat( "wait", "0", &ent->wait );

	if((item->giType == IT_TEAM && (g_instantgib.integer || g_rockets.integer) ) || (!g_instantgib.integer && !g_rockets.integer) )
	{
		//Don't load pickups in Elimination (or maybe... gives warnings)
		if (g_gametype.integer != GT_ELIMINATION && g_gametype.integer != GT_CTF_ELIMINATION && g_gametype.integer != GT_LMS)
			RegisterItem( item );
		//Registrer flags anyway in CTF Elimination:
		if (g_gametype.integer == GT_CTF_ELIMINATION && item->giType == IT_TEAM)
			RegisterItem( item );
		if ( G_ItemDisabled(item) )
			return;
	}
        if(!g_persistantpowerups.integer && item->giType == IT_PERSISTANT_POWERUP)
            return;

	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;

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

	if (g_gametype.integer == GT_ELIMINATION || g_gametype.integer == GT_LMS || 
			( item->giType != IT_TEAM && (g_instantgib.integer || g_rockets.integer || g_elimination_allgametypes.integer || g_gametype.integer==GT_CTF_ELIMINATION) ) ) {
		ent->s.eFlags |= EF_NODRAW; //Invisible in elimination
                ent->r.svFlags |= SVF_NOCLIENT;  //Don't broadcast
        }

	if(g_gametype.integer == GT_DOUBLE_D && (strcmp(ent->classname, "team_CTF_redflag")==0 || strcmp(ent->classname, "team_CTF_blueflag")==0 || strcmp(ent->classname, "team_CTF_neutralflag") == 0 || item->giType == IT_PERSISTANT_POWERUP  ))
		ent->s.eFlags |= EF_NODRAW; //Don't draw the flag models/persistant powerups

	if( g_gametype.integer != GT_1FCTF && strcmp(ent->classname, "team_CTF_neutralflag") == 0)
		ent->s.eFlags |= EF_NODRAW; // Don't draw the flag in CTF_elimination

        if(strcmp(ent->classname, "domination_point") == 0)
                ent->s.eFlags |= EF_NODRAW; // Don't draw domination_point. It is just a pointer to where the Domination points should be placed
	if ( item->giType == IT_POWERUP ) {
		G_SoundIndex( "sound/items/poweruprespawn.wav" );
		G_SpawnFloat( "noglobalsound", "0", &ent->speed);
	}

	if ( item->giType == IT_PERSISTANT_POWERUP ) {
		ent->s.generic1 = ent->spawnflags;
	}
}
Example #6
0
//bool G_CallSpawn( GameEntity *ent )
bool G_CallSpawn( SpawnFieldHolder *sfh )
{
	spawn_t	*s;
	gitem_t	*item;

	if ( !sfh->classname_ )
	{
		Com_Printf ("G_CallSpawn: NULL classname\n");
		return false;
	}

	// check item spawn functions
	for ( item=bg_itemlist+1 ; item->classname ; item++ ) 
	{
		if ( !strcmp(item->classname, sfh->classname_) ) 
		{
			if ( G_ItemDisabled(item) )	// MFQ3
				return false;			// MFQ3
			theLevel.createItemFromSpawnFields(sfh, item);
			//G_SpawnItem( sfh, item );
			return true;
		}
	}

	// check normal spawn functions
	for ( s=spawns ; s->name ; s++ ) 
	{
		if ( !strcmp(s->name, sfh->classname_) ) 
		{
			theLevel.createEntityFromSpawnFields(sfh, s);
			return true;
		}
	}
	Com_Printf ("%s doesn't have a spawn function\n", sfh->classname_);
	return false;
}
Example #7
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 *MinHealth = "1";
	qboolean Egg = qfalse;

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

	if (item->giType == IT_TEAM)
	{
		if (g_gametype.integer == GT_INVASION || g_gametype.integer == GT_DESTROY)
		{
			if (!Q_stricmp(item->pickup_name, "Blue Flag"))
			{
				gitem_t *NewItem = BG_FindItem("Alien Egg");

				if (NewItem)
				{
					item = NewItem;
					MinHealth = "60";//2500;
					Egg = qtrue;
				}
				ent->classname = item->classname;
			}
			else if (!Q_stricmp(item->pickup_name, "Red Flag"))
			{
				gitem_t *NewItem = BG_FindItem("Teleporter");

				if (NewItem)
					item = NewItem;
				ent->classname = item->classname;
			}
			else if (!Q_stricmp(item->pickup_name, "Alien Egg"))
				Egg = qtrue;
		}

		RegisterItem(item);
	}

	if (G_ItemDisabled(item))
		return;

	if (Egg && g_gametype.integer == GT_DESTROY)
	{
		float Coeff, Radius;

		G_SpawnFloat("health", MinHealth, &Coeff);

		if (Coeff < 0.1f)
			Coeff = 0.1f;

		ent->health = Coeff * g_InvEggHealth.integer;

		if (ent->health < 1)//MinHealth)
			ent->health = 1;//MinHealth;
		else if (ent->health > 25000)
			ent->health = 25000;

		G_SpawnFloat("Radius", "6", &Radius);
		G_SpawnFloat("Height", "24", &Coeff);

		Radius = Com_Clamp(3, 50, Radius);
		Coeff = Com_Clamp(3, 200, Coeff);

		VectorSet(ent->r.mins, -Radius, -Radius, 0);
		VectorSet(ent->r.maxs, Radius, Radius, Coeff);

		G_SpawnInt("Number", "100", &ent->count);
		if (ent->count < 0)
			ent->count = 0;
	}

	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;

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

	if (item->giType == IT_POWERUP)
	{
		G_SoundIndex("sound/items/poweruprespawn.wav");
		G_SpawnFloat("noglobalsound", "0", &ent->speed);
	}

#ifdef MISSIONPACK
	if (item->giType == IT_PERSISTANT_POWERUP)
	{
		ent->s.generic1 = ent->spawnflags;
	}
#endif
}