Example #1
0
/*
* Items may be spawned above other entities and they need them spawned before
*/
void G_Items_FinishSpawningItems( void )
{
	int num_timers, num_opts;
	edict_t *ent;
	edict_t *ops[MAX_EDICTS];

	num_timers = num_opts = 0;
	for( ent = game.edicts + 1 + gs.maxclients; ENTNUM( ent ) < game.numentities; ent++ )
	{
		if( !ent->r.inuse || !ent->item || ent->s.type != ET_ITEM )
			continue;

		Finish_SpawningItem( ent );

		// spawned inside solid
		if( !ent->r.inuse )
			continue;

		if( G_ItemTimerNeeded( ent->item ) && !GS_RaceGametype() ) //racesow: no item timers; will be included in basewsw if not, use the AS fix from ticket #246#comment:6
		{
			if( Spawn_ItemTimer( ent ) )
				num_timers++;
		}
		else if( G_ItemTimerUnimportant( ent->item ) )
		{
			ops[num_opts++] = ent;
		}
	}

	ops[num_opts] = NULL;

	// if there are less timers than MAX_IMPORTANT_ITEMS_THRESHOLD, spawn
	// timers for less important items
	if( num_timers < MAX_IMPORTANT_ITEMS_THRESHOLD && !GS_RaceGametype() ) //racesow: no item timers; will be included in basewsw
	{
		for( ; num_opts > 0; num_opts-- )
			Spawn_ItemTimer( ops[num_opts-1] );
	}
}
Example #2
0
/*
* Items may be spawned above other entities and they need them spawned before
*/
void G_Items_FinishSpawningItems( void )
{
	int num_timers, num_opts;
	edict_t *ent;
	edict_t *ops[MAX_EDICTS];

	num_timers = num_opts = 0;
	for( ent = game.edicts + 1 + gs.maxclients; ENTNUM( ent ) < game.numentities; ent++ )
	{
		if( !ent->r.inuse || !ent->item || ent->s.type != ET_ITEM )
			continue;

		Finish_SpawningItem( ent );

		// spawned inside solid
		if( !ent->r.inuse )
			continue;

		if( G_ItemTimerNeeded( ent->item ) )
		{
			if( Spawn_ItemTimer( ent ) )
				num_timers++;
		}
		else if( G_ItemTimerUnimportant( ent->item ) )
		{
			ops[num_opts++] = ent;
		}
	}

	ops[num_opts] = NULL;

	// if there are less timers than MAX_IMPORTANT_ITEMS_THRESHOLD, spawn
	// timers for less important items
	if( num_timers < MAX_IMPORTANT_ITEMS_THRESHOLD )
	{
		for( ; num_opts > 0; num_opts-- )
			Spawn_ItemTimer( ops[num_opts-1] );
	}
}