Пример #1
0
qboolean G_DoesMapSupportGametype(const char *mapname, int gametype)
{
	int			typeBits = 0;
	int			thisLevel = -1;
	int			n = 0;
	char		*type = NULL;

	if (!level.arenas.infos[0])
	{
		return qfalse;
	}

	if (!mapname || !mapname[0])
	{
		return qfalse;
	}

	// zyk: FFA now allows voting for maps supported by other gametypes
	if (gametype == GT_FFA)
		return qtrue;

	for( n = 0; n < level.arenas.num; n++ )
	{
		type = Info_ValueForKey( level.arenas.infos[n], "map" );

		if (Q_stricmp(mapname, type) == 0)
		{
			thisLevel = n;
			break;
		}
	}

	if (thisLevel == -1)
	{
		return qfalse;
	}

	type = Info_ValueForKey(level.arenas.infos[thisLevel], "type");

	typeBits = G_GetMapTypeBits(type);
	if (typeBits & (1 << gametype))
	{ //the map in question supports the gametype in question, so..
		return qtrue;
	}

	return qfalse;
}
Пример #2
0
qboolean G_DoesMapSupportGametype(const char *mapname, int gametype)
{
	int			typeBits = 0;
	int			thisLevel = -1;
	int			n = 0;
	char		*type = NULL;

	if (!g_arenaInfos[0])
	{
		return qfalse;
	}

	if (!mapname || !mapname[0])
	{
		return qfalse;
	}

	for( n = 0; n < g_numArenas; n++ )
	{
		type = Info_ValueForKey( g_arenaInfos[n], "map" );

		if (Q_stricmp(mapname, type) == 0)
		{
			thisLevel = n;
			break;
		}
	}

	if (thisLevel == -1)
	{
		return qfalse;
	}

	type = Info_ValueForKey(g_arenaInfos[thisLevel], "type");

	typeBits = G_GetMapTypeBits(type);
	if (typeBits & (1 << gametype))
	{ //the map in question supports the gametype in question, so..
		return qtrue;
	}

	return qfalse;
}
Пример #3
0
qboolean G_DoesMapSupportGametype( const char *mapname, int gametype ) {
	int i;
	char *type = NULL;

	if ( !level.arenas.infos[0] || !VALIDSTRING( mapname ) )
		return qfalse;

	for ( i=0; i<level.arenas.num; i++ ) {
		type = Info_ValueForKey( level.arenas.infos[i], "map" );

		if ( !Q_stricmp( mapname, type ) )
			break;
	}

	if ( i == level.arenas.num )
		return qfalse;

	type = Info_ValueForKey( level.arenas.infos[i], "type" );

	if ( G_GetMapTypeBits( type ) & (1<<gametype) )
		return qtrue;

	return qfalse;
}
Пример #4
0
//rww - auto-obtain nextmap. I could've sworn Q3 had something like this, but I guess not.
const char *G_RefreshNextMap(int gametype, qboolean forced)
{
	int			typeBits = 0;
	int			thisLevel = 0;
	int			desiredMap = 0;
	int			n = 0;
	char		*type = NULL;
	qboolean	loopingUp = qfalse;
	vmCvar_t	mapname;

	if (!g_autoMapCycle.integer && !forced)
	{
		return NULL;
	}

	if (!g_arenaInfos[0])
	{
		return NULL;
	}

	trap_Cvar_Register( &mapname, "mapname", "", CVAR_SERVERINFO | CVAR_ROM );
	for( n = 0; n < g_numArenas; n++ )
	{
		type = Info_ValueForKey( g_arenaInfos[n], "map" );

		if (Q_stricmp(mapname.string, type) == 0)
		{
			thisLevel = n;
			break;
		}
	}

	desiredMap = thisLevel;

	n = thisLevel+1;
	while (n != thisLevel)
	{ //now cycle through the arena list and find the next map that matches the gametype we're in
		if (!g_arenaInfos[n] || n >= g_numArenas)
		{
			if (loopingUp)
			{ //this shouldn't happen, but if it does we have a null entry break in the arena file
			  //if this is the case just break out of the loop instead of sticking in an infinite loop
				break;
			}
			n = 0;
			loopingUp = qtrue;
		}

		type = Info_ValueForKey(g_arenaInfos[n], "type");
		
		typeBits = G_GetMapTypeBits(type);
		if (typeBits & (1 << gametype))
		{
			desiredMap = n;
			break;
		}

		n++;
	}

	if (desiredMap == thisLevel)
	{ //If this is the only level for this game mode or we just can't find a map for this game mode, then nextmap
	  //will always restart.
		trap_Cvar_Set( "nextmap", "map_restart 0");
	}
	else
	{ //otherwise we have a valid nextmap to cycle to, so use it.
		type = Info_ValueForKey( g_arenaInfos[desiredMap], "map" );
		trap_Cvar_Set( "nextmap", va("map %s", type));
	}

	return Info_ValueForKey( g_arenaInfos[desiredMap], "map" );
}
Пример #5
0
qboolean G_DoesMapSupportGametype(const char *mapname, int gametype)
{
	int			typeBits = 0;
	int			thisLevel = -1;
	int			n = 0;
	char		*type = NULL;


	if (!mapname || !mapname[0])
	{
		return qfalse;
	}

	if (mc_mapvotefix.integer != 0)
	{
		fileHandle_t	f;
		trap_FS_FOpenFile(va("maps/%s.bsp", mapname), &f, FS_READ);
		if (f)
		{
			trap_FS_FCloseFile(f);
			return qtrue;
		}
		else
		{
			return qfalse;
		}
	}
	if (!g_arenaInfos[0])
	{
		return qfalse;
	}

			/*if ((Q_stricmp(mapname,"ffa_bespin") == 0||
				Q_stricmp(mapname,"ffa_deathstar") == 0||
				Q_stricmp(mapname,"ffa_imperial") == 0||
				Q_stricmp(mapname,"ffa_ns_hideout") == 0||
				Q_stricmp(mapname,"ffa_ns_streets") == 0||
				Q_stricmp(mapname,"ffa_raven") == 0||
				Q_stricmp(mapname,"ffa_yavin") == 0||
				Q_stricmp(mapname,"ctf_bespin") == 0||
				Q_stricmp(mapname,"ctf_imperial") == 0||
				Q_stricmp(mapname,"ctf_ns_streets") == 0||
				Q_stricmp(mapname,"ctf_yavin") == 0||
				Q_stricmp(mapname,"duel_bay") == 0||
				Q_stricmp(mapname,"duel_carbon") == 0||
				Q_stricmp(mapname,"duel_jedi") == 0||
				Q_stricmp(mapname,"duel_pit") == 0||
				Q_stricmp(mapname,"duel_bespin") == 0||
				Q_stricmp(mapname,"duel_hangar") == 0||
				Q_stricmp(mapname,"duel_temple") == 0||
				Q_stricmp(mapname,"duel_training") == 0||
				Q_stricmp(mapname,"bespin_streets") == 0||
				Q_stricmp(mapname,"yavin_temple") == 0||
				Q_stricmp(mapname,"yavin_swamp") == 0||
				Q_stricmp(mapname,"yavin_trial") == 0||
				Q_stricmp(mapname,"bespin_platform") == 0||
				Q_stricmp(mapname,"cairn_reactor") == 0||
				Q_stricmp(mapname,"doom_shields") == 0||
				Q_stricmp(mapname,"yavin_canyon") == 0||
				Q_stricmp(mapname,"yavin_courtyard") == 0||
				Q_stricmp(mapname,"artus_topside") == 0||
				Q_stricmp(mapname,"cairn_assembly") == 0||
				Q_stricmp(mapname,"pit") == 0||
				Q_stricmp(mapname,"valley") == 0||
				Q_stricmp(mapname,"yavin_final") == 0))
				{
					return qtrue;
				}*/
	for( n = 0; n < g_numArenas; n++ )
	{
		type = Info_ValueForKey( g_arenaInfos[n], "map" );

		if (Q_stricmp(mapname, type) == 0)
		{
			thisLevel = n;
			break;
		}
	}

	if (thisLevel == -1)
	{
		return qfalse;
	}

	type = Info_ValueForKey(g_arenaInfos[thisLevel], "type");

	typeBits = G_GetMapTypeBits(type);
	if (typeBits & (1 << gametype))
	{ //the map in question supports the gametype in question, so..
		return qtrue;
	}

	return qfalse;
}