Exemple #1
0
/*
===============
G_CallSpawn

Finds the spawn function for the entity and calls it,
returning qfalse if not found
===============
*/
qboolean G_CallSpawn(gentity_t *ent)
{
	spawn_t *s;
	gitem_t *item;

	if (!ent->classname)
	{
		G_Printf("G_CallSpawn: NULL classname\n");
		return qfalse;
	}

	// check item spawn functions
	for (item = bg_itemlist + 1 ; item->classname ; item++)
	{
		if (!strcmp(item->classname, ent->classname))
		{
			// found it
			if (g_gametype.integer != GT_WOLF_LMS)     // lets not have items in last man standing for the moment
			{
				G_SpawnItem(ent, item);

				G_Script_ScriptParse(ent);
				G_Script_ScriptEvent(ent, "spawn", "");
			}
			else
			{
				return qfalse;
			}
			return qtrue;
		}
	}

	// check normal spawn functions
	for (s = spawns ; s->name ; s++)
	{
		if (!strcmp(s->name, ent->classname))
		{
			// found it
			s->spawn(ent);

			// entity scripting
			if (/*ent->s.number >= MAX_CLIENTS &&*/ ent->scriptName)
			{
				G_Script_ScriptParse(ent);
				G_Script_ScriptEvent(ent, "spawn", "");
			}

			return qtrue;
		}
	}

	// hack: this avoids spammy prints on start, bsp uses obsolete classnames!
	// bot_sniper_spot (railgun)
	if (Q_stricmp(ent->classname, "bot_sniper_spot"))
	{
		G_Printf("%s doesn't have a spawn function\n", ent->classname);
	}

	return qfalse;
}
Exemple #2
0
/*
===============
G_CallSpawn

Finds the spawn function for the entity and calls it,
returning qfalse if not found
===============
*/
qboolean G_CallSpawn(gentity_t * ent)
{
	spawn_t        *s;
	gitem_t        *item;

	if(!ent->classname)
	{
		G_Printf("G_CallSpawn: NULL classname\n");
		return qfalse;
	}

	// check item spawn functions
	for(item = bg_itemlist + 1; item->classname; item++)
	{
		if(!strcmp(item->classname, ent->classname))
		{
			// found it
			if(g_gametype.integer != GT_WOLF_LMS)
			{					// Gordon: lets not have items in last man standing for the moment
				G_SpawnItem(ent, item);

				G_Script_ScriptParse(ent);
				G_Script_ScriptEvent(ent, "spawn", "");
			}
			else
			{
				return qfalse;
			}
			return qtrue;
		}
	}

	// check normal spawn functions
	for(s = spawns; s->name; s++)
	{
		if(!strcmp(s->name, ent->classname))
		{
			// found it
			s->spawn(ent);

			// RF, entity scripting
			if( /*ent->s.number >= MAX_CLIENTS && */ ent->scriptName)
			{
				G_Script_ScriptParse(ent);
				G_Script_ScriptEvent(ent, "spawn", "");
			}

			return qtrue;
		}
	}
	G_Printf("%s doesn't have a spawn function\n", ent->classname);
	return qfalse;
}
Exemple #3
0
/*
===============
G_CallSpawn

Finds the spawn function for the entity and calls it,
returning qfalse if not found
===============
*/
qboolean G_CallSpawn( gentity_t *ent ) {
	spawn_t *s;
	gitem_t *item;
	int hash;

	if ( !ent->classname ) {
		G_Printf( "G_CallSpawn: NULL classname\n" );
		return qfalse;
	}

	if ( g_deathmatch.integer ) {
		if ( !strcmp( "func_explosive", ent->classname ) ) {
			return qfalse;
		}

		if ( !strcmp( "trigger_hurt", ent->classname ) ) {
			return qfalse;
		}

		// don't spawn the flags in cp
		if ( g_gametype.integer == 7 && !strcmp( "team_WOLF_checkpoint", ent->classname ) ) {
			return qfalse;
		}
	}

	// check item spawn functions
	for ( item = bg_itemlist + 1 ; item->classname ; item++ ) {
		if ( !strcmp( item->classname, ent->classname ) ) {
			// found it
			// DHM - Nerve :: allow flags in GTWOLF
			if ( item->giType == IT_TEAM && ( g_gametype.integer != GT_CTF && g_gametype.integer < GT_WOLF ) ) {
				return qfalse;
			}
			G_SpawnItem( ent, item );
			return qtrue;
		}
	}

	// check normal spawn functions
	hash = BG_StringHashValue( ent->classname );
	for ( s = spawns ; s->name ; s++ ) {
		if ( s->hash == hash ) {
			// found it
			s->spawn( ent );

			// RF, entity scripting
			if ( ent->s.number >= MAX_CLIENTS && ent->scriptName ) {
				G_Script_ScriptParse( ent );
				G_Script_ScriptEvent( ent, "spawn", "" );
			}

			return qtrue;
		}
	}
	G_Printf( "%s doesn't have a spawn function\n", ent->classname );
	return qfalse;
}
Exemple #4
0
/*
===============
G_CallSpawn

Finds the spawn function for the entity and calls it,
returning qfalse if not found
===============
*/
qboolean G_CallSpawn(gentity_t *ent) {
	spawn_t *s;
	gitem_t *item;

	if (!ent->classname) {
		G_DPrintf("G_CallSpawn: NULL classname\n");
		return qfalse;
	}

	// check item spawn functions
	for (item = bg_itemlist + 1 ; item->classname ; ++item) {
		if (!strcmp(item->classname, ent->classname)) {
			// found it
			G_SpawnItem(ent, item);

			G_Script_ScriptParse(ent);
			G_Script_ScriptEvent(ent, "spawn", "");
			return qtrue;
		}
	}

	// check normal spawn functions
	for (s = spawns ; s->name ; ++s) {
		if (!strcmp(s->name, ent->classname)) {
			// found it
			s->spawn(ent);

			// RF, entity scripting
			if (ent->scriptName) {
				G_Script_ScriptParse(ent);
				G_Script_ScriptEvent(ent, "spawn", "");
			}

			return qtrue;
		}
	}
	G_DPrintf("%s doesn't have a spawn function\n", ent->classname);
	return qfalse;
}
Exemple #5
0
/*
===============
G_CallSpawn

Finds the spawn function for the entity and calls it,
returning qfalse if not found
===============
*/
qboolean G_CallSpawn( gentity_t *ent ) {
	spawn_t *s;
	gitem_t *item;

	if ( !ent->classname ) {
		G_Printf( "G_CallSpawn: NULL classname\n" );
		return qfalse;
	}

	// check item spawn functions
	for ( item = bg_itemlist + 1 ; item->classname ; item++ ) {
		if ( !strcmp( item->classname, ent->classname ) ) {
			// found it
			// DHM - Nerve :: allow flags in GTWOLF
			if ( item->giType == IT_TEAM && ( g_gametype.integer != GT_CTF && g_gametype.integer < GT_WOLF ) ) {
				return qfalse;
			}
			G_SpawnItem( ent, item );
			return qtrue;
		}
	}

	// check normal spawn functions
	for ( s = spawns ; s->name ; s++ ) {
		if ( !strcmp( s->name, ent->classname ) ) {
			// found it
			s->spawn( ent );

			// RF, entity scripting
			if ( ent->s.number >= MAX_CLIENTS && ent->scriptName ) {
				G_Script_ScriptParse( ent );
				G_Script_ScriptEvent( ent, "spawn", "" );
			}

			return qtrue;
		}
	}
	G_Printf( "%s doesn't have a spawn function\n", ent->classname );
	return qfalse;
}