Exemplo n.º 1
0
qboolean BG_R_RegisterAnimationGroup(const char *filename, animModelInfo_t *animModelInfo)
{
    pc_token_t token;
    int        handle;

    animModelInfo->numAnimations = 0;
    animModelInfo->footsteps     = FOOTSTEP_NORMAL;
    animModelInfo->gender        = GENDER_MALE;
    animModelInfo->isSkeletal    = qtrue;
    animModelInfo->version       = 3;
    animModelInfo->numHeadAnims  = 0;

    handle = trap_PC_LoadSource(filename);

    if (!handle)
    {
        return qfalse;
    }

    if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "animgroup"))
    {
        return BG_RAG_ParseError(handle, "expected 'animgroup'");
    }

    if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "{"))
    {
        return BG_RAG_ParseError(handle, "expected '{'");
    }

    while (1)
    {
        if (!trap_PC_ReadToken(handle, &token))
        {
            break;
        }

        if (token.string[0] == '}')
        {
            break;
        }

        if (!Q_stricmp(token.string, "animfile"))
        {
            if (!BG_RAG_ParseAnimFile(handle, animModelInfo))
            {
                return qfalse;
            }
        }
        else
        {
            return BG_RAG_ParseError(handle, "unknown token '%s'", token.string);
        }
    }

    trap_PC_FreeSource(handle);

    return qtrue;
}
Exemplo n.º 2
0
static qboolean BG_RAG_ParseAnimFile(int handle, animModelInfo_t *animModelInfo)
{
    pc_token_t token;
    qhandle_t  mdxFile;

    animation_t *animation;

    if (!trap_PC_ReadToken(handle, &token))
    {
        return BG_RAG_ParseError(handle, "expected mdx filename");
    }

    if (!(mdxFile = trap_R_RegisterModel(token.string)))
    {
        return BG_RAG_ParseError(handle, "failed to load %s", token.string);
    }

    if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "{"))
    {
        return BG_RAG_ParseError(handle, "expected '{'");
    }

    while (1)
    {
        if (!trap_PC_ReadToken(handle, &token))
        {
            return BG_RAG_ParseError(handle, "unexpected EOF");
        }

        if (token.string[0] == '}')
        {
            break;
        }

        if (!(animation = BG_RAG_FindFreeAnimation(mdxFile, token.string)))
        {
            return BG_RAG_ParseError(handle, "out of animation storage space");
        }

        Q_strncpyz(animation->name, token.string, sizeof(animation->name));
        Q_strlwr(animation->name);

        if (!BG_RAG_ParseAnimation(handle, animation))
        {
            return qfalse;
        }

        animModelInfo->animations[animModelInfo->numAnimations] = animation;
        animModelInfo->numAnimations++;
    }

    return qtrue;
}
Exemplo n.º 3
0
qboolean BG_LoadSpeakerScript(const char *filename)
{
	pc_token_t token;
	int        handle;

	handle = trap_PC_LoadSource(filename);

	if (!handle)
	{
		return qfalse;
	}

	if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "speakerScript"))
	{
		return BG_SS_ParseError(handle, "expected 'soundScript'");
	}

	if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "{"))
	{
		return BG_SS_ParseError(handle, "expected '{'");
	}

	while (1)
	{
		if (!trap_PC_ReadToken(handle, &token))
		{
			break;
		}

		if (token.string[0] == '}')
		{
			break;
		}

		if (!Q_stricmp(token.string, "speakerDef"))
		{
			if (!BG_SS_ParseSpeaker(handle))
			{
				return qfalse;
			}
		}
		else
		{
			return BG_SS_ParseError(handle, "unknown token '%s'", token.string);
		}
	}

	trap_PC_FreeSource(handle);

	return qtrue;
}
Exemplo n.º 4
0
static qboolean CG_ReadHudFile(const char *filename)
{
	pc_token_t token;
	int        handle;

	handle = trap_PC_LoadSource(filename);

	if (!handle)
	{
		return qfalse;
	}

	if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "hudDef"))
	{
		return CG_HUD_ParseError(handle, "expected 'hudDef'");
	}

	if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "{"))
	{
		return CG_HUD_ParseError(handle, "expected '{'");
	}

	while (1)
	{
		if (!trap_PC_ReadToken(handle, &token))
		{
			break;
		}

		if (token.string[0] == '}')
		{
			break;
		}

		if (!Q_stricmp(token.string, "hud"))
		{
			if (!CG_ParseHUD(handle))
			{
				return qfalse;
			}
		}
		else
		{
			return CG_HUD_ParseError(handle, "unknown token '%s'", token.string);
		}
	}

	trap_PC_FreeSource(handle);

	return qtrue;
}
Exemplo n.º 5
0
qboolean PC_Script_Parse(int handle, const char **out)
{
	char       script[4096];
	pc_token_t token;

	memset(script, 0, sizeof(script));
	// scripts start with { and have ; separated command lists.. commands are command, arg..
	// basically we want everything between the { } as it will be interpreted at run time

	if (!trap_PC_ReadToken(handle, &token))
	{
		return qfalse;
	}

	if (Q_stricmp(token.string, "{") != 0)
	{
		return qfalse;
	}

	while (1)
	{
		if (!trap_PC_ReadToken(handle, &token))
		{
			return qfalse;
		}

		if (Q_stricmp(token.string, "}") == 0)
		{
			*out = String_Alloc(script);
			return qtrue;
		}

		if (token.string[1] != '\0')
		{
			Q_strcat(script, 4096, va("\"%s\"", token.string));
		}
		else
		{
			Q_strcat(script, 4096, token.string);
		}

		Q_strcat(script, 4096, " ");
	}

	return qfalse;
}
Exemplo n.º 6
0
qboolean PC_Char_Parse(int handle, char *out)
{
	pc_token_t token;

	if (!trap_PC_ReadToken(handle, &token))
	{
		return qfalse;
	}

	*(out) = token.string[0];
	return qtrue;
}
Exemplo n.º 7
0
/**
* @brief Same as PC_String_Parse except it uses a trap call
* to client's gettext translation function.
*/
qboolean PC_String_ParseTranslate(int handle, const char **out)
{
	pc_token_t token;

	if (!trap_PC_ReadToken(handle, &token))
	{
		return qfalse;
	}

	*(out) = String_Alloc(__(token.string));

	return qtrue;
}
Exemplo n.º 8
0
static qboolean BG_SS_ParseSpeaker(int handle)
{
	pc_token_t   token;
	bg_speaker_t speaker;

	memset(&speaker, 0, sizeof(speaker));

	speaker.volume = 127;
	speaker.range  = 1250;

	if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "{"))
	{
		return BG_SS_ParseError(handle, "expected '{'");
	}

	while (1)
	{
		if (!trap_PC_ReadToken(handle, &token))
		{
			break;
		}

		if (token.string[0] == '}')
		{
			break;
		}

		if (!Q_stricmp(token.string, "noise"))
		{
			if (!PC_String_ParseNoAlloc(handle, speaker.filename, sizeof(speaker.filename)))
			{
				return BG_SS_ParseError(handle, "expected sound filename");
			}
		}
		else if (!Q_stricmp(token.string, "origin"))
		{
			if (!PC_Vec_Parse(handle, &speaker.origin))
			{
				return BG_SS_ParseError(handle, "expected origin vector");
			}
		}
		else if (!Q_stricmp(token.string, "targetname"))
		{
			if (!PC_String_ParseNoAlloc(handle, speaker.targetname, sizeof(speaker.targetname)))
			{
				return BG_SS_ParseError(handle, "expected targetname string");
			}
			else
			{
				speaker.targetnamehash = BG_StringHashValue(speaker.targetname);
			}
		}
		else if (!Q_stricmp(token.string, "looped"))
		{
			if (!trap_PC_ReadToken(handle, &token))
			{
				return BG_SS_ParseError(handle, "expected loop value");
			}
			else
			{
				if (!Q_stricmp(token.string, "no"))
				{
					speaker.loop = S_LT_NOT_LOOPED;
				}
				else if (!Q_stricmp(token.string, "on"))
				{
					speaker.loop      = S_LT_LOOPED_ON;
					speaker.activated = qtrue;
				}
				else if (!Q_stricmp(token.string, "off"))
				{
					speaker.loop = S_LT_LOOPED_OFF;
				}
				else
				{
					return BG_SS_ParseError(handle, "unknown loop value '%s'", token.string);
				}
			}
		}
		else if (!Q_stricmp(token.string, "broadcast"))
		{
			if (!trap_PC_ReadToken(handle, &token))
			{
				return BG_SS_ParseError(handle, "expected broadcast value");
			}
			else
			{
				if (!Q_stricmp(token.string, "no"))
				{
					speaker.broadcast = S_BT_LOCAL;
				}
				else if (!Q_stricmp(token.string, "global"))
				{
					speaker.broadcast = S_BT_GLOBAL;
				}
				else if (!Q_stricmp(token.string, "nopvs"))
				{
					speaker.broadcast = S_BT_NOPVS;
				}
				else
				{
					return BG_SS_ParseError(handle, "unknown broadcast value '%s'", token.string);
				}
			}
		}
		else if (!Q_stricmp(token.string, "wait"))
		{
			if (!PC_Int_Parse(handle, &speaker.wait))
			{
				return BG_SS_ParseError(handle, "expected wait value");
			}
			else if (speaker.wait < 0)
			{
				return BG_SS_ParseError(handle, "wait value %i is invalid", speaker.wait);
			}
		}
		else if (!Q_stricmp(token.string, "random"))
		{
			if (!PC_Int_Parse(handle, &speaker.random))
			{
				return BG_SS_ParseError(handle, "expected random value");
			}
			else if (speaker.random < 0)
			{
				return BG_SS_ParseError(handle, "random value %i is invalid", speaker.random);
			}
		}
		else if (!Q_stricmp(token.string, "volume"))
		{
			if (!PC_Int_Parse(handle, &speaker.volume))
			{
				return BG_SS_ParseError(handle, "expected volume value");
			}
			else if (speaker.volume < 0 || speaker.volume > 65535)
			{
				return BG_SS_ParseError(handle, "volume value %i is invalid", speaker.volume);
			}
		}
		else if (!Q_stricmp(token.string, "range"))
		{
			if (!PC_Int_Parse(handle, &speaker.range))
			{
				return BG_SS_ParseError(handle, "expected range value");
			}
			else if (speaker.range < 0)
			{
				return BG_SS_ParseError(handle, "range value %i is invalid", speaker.range);
			}
		}
		else
		{
			return BG_SS_ParseError(handle, "unknown token '%s'", token.string);
		}
	}

	if (!BG_SS_StoreSpeaker(&speaker))
	{
		return BG_SS_ParseError(handle, "Failed to store speaker", token.string);
	}

	return qtrue;
}
Exemplo n.º 9
0
qboolean BG_ParseCharacterFile(const char *filename, bg_characterDef_t *characterDef)
{
	pc_token_t token;
	int        handle;

	handle = trap_PC_LoadSource(filename);

	if (!handle)
	{
		return qfalse;
	}

	if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "characterDef"))
	{
		return BG_PCF_ParseError(handle, "expected 'characterDef'");
	}

	if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "{"))
	{
		return BG_PCF_ParseError(handle, "expected '{'");
	}

	while (1)
	{
		if (!trap_PC_ReadToken(handle, &token))
		{
			break;
		}

		if (token.string[0] == '}')
		{
			break;
		}

		if (!Q_stricmp(token.string, "mesh"))
		{
			if (!PC_String_ParseNoAlloc(handle, characterDef->mesh, sizeof(characterDef->mesh)))
			{
				return BG_PCF_ParseError(handle, "expected mesh filename");
			}
		}
		else if (!Q_stricmp(token.string, "animationGroup"))
		{
			if (!PC_String_ParseNoAlloc(handle, characterDef->animationGroup, sizeof(characterDef->animationGroup)))
			{
				return BG_PCF_ParseError(handle, "expected animationGroup filename");
			}
		}
		else if (!Q_stricmp(token.string, "animationScript"))
		{
			if (!PC_String_ParseNoAlloc(handle, characterDef->animationScript, sizeof(characterDef->animationScript)))
			{
				return BG_PCF_ParseError(handle, "expected animationScript filename");
			}
		}
		else if (!Q_stricmp(token.string, "skin"))
		{
			if (!PC_String_ParseNoAlloc(handle, characterDef->skin, sizeof(characterDef->skin)))
			{
				return BG_PCF_ParseError(handle, "expected skin filename");
			}
		}
		else if (!Q_stricmp(token.string, "undressedCorpseModel"))
		{
			if (!PC_String_ParseNoAlloc(handle, characterDef->undressedCorpseModel, sizeof(characterDef->undressedCorpseModel)))
			{
				return BG_PCF_ParseError(handle, "expected undressedCorpseModel filename");
			}
		}
		else if (!Q_stricmp(token.string, "undressedCorpseSkin"))
		{
			if (!PC_String_ParseNoAlloc(handle, characterDef->undressedCorpseSkin, sizeof(characterDef->undressedCorpseSkin)))
			{
				return BG_PCF_ParseError(handle, "expected undressedCorpseSkin filename");
			}
		}
		else if (!Q_stricmp(token.string, "hudhead"))
		{
			if (!PC_String_ParseNoAlloc(handle, characterDef->hudhead, sizeof(characterDef->hudhead)))
			{
				return BG_PCF_ParseError(handle, "expected hudhead filename");
			}
		}
		else if (!Q_stricmp(token.string, "hudheadskin"))
		{
			if (!PC_String_ParseNoAlloc(handle, characterDef->hudheadskin, sizeof(characterDef->hudheadskin)))
			{
				return BG_PCF_ParseError(handle, "expected hudhead filename");
			}
		}
		else if (!Q_stricmp(token.string, "hudheadanims"))
		{
			if (!PC_String_ParseNoAlloc(handle, characterDef->hudheadanims, sizeof(characterDef->hudheadanims)))
			{
				return BG_PCF_ParseError(handle, "expected hudheadanims filename");
			}
		}
		else
		{
			return BG_PCF_ParseError(handle, "unknown token '%s'", token.string);
		}
	}

	trap_PC_FreeSource(handle);

	return qtrue;
}
Exemplo n.º 10
0
qboolean G_ParseSettings(int handle, qboolean setvars, config_t *config)
{
	pc_token_t token;
	char       text[256];
	char       value[256];

	if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "{"))
	{
		G_Printf("Malformed config\n");
	}

	while (1)
	{
		if (!trap_PC_ReadToken(handle, &token))
		{
			break;
		}

		if (token.string[0] == '}')
		{
			break;
		}

		//If we want to skip the settings
		if (!setvars)
		{
			continue;
		}

		if (!Q_stricmp(token.string, "set"))
		{
			if (!PC_String_ParseNoAlloc(handle, text, sizeof(text)))
			{
				return G_ConfigError(handle, "expected cvar to set");
			}
			else
			{
				if (!PC_String_ParseNoAlloc(handle, value, sizeof(value)))
				{
					return G_ConfigError(handle, "expected cvar value");
				}

				if (value[0] == '-')
				{
					if (!PC_String_ParseNoAlloc(handle, text, sizeof(text)))
					{
						return G_ConfigError(handle, "expected value after '-'");
					}

					Q_strncpyz(value, va("-%s", text), sizeof(value));
				}

				trap_Cvar_Set(text, value);
				G_Printf("set %s %s\n", text, value);
			}
		}
		else if (!Q_stricmp(token.string, "setl"))
		{
			int      i         = 0;
			qboolean overwrite = qfalse;

			if (!PC_String_ParseNoAlloc(handle, text, sizeof(text)))
			{
				return G_ConfigError(handle, "expected cvar to set");
			}
			else
			{
				if (!PC_String_ParseNoAlloc(handle, value, sizeof(value)))
				{
					return G_ConfigError(handle, "expected cvar value");
				}

				if (value[0] == '-')
				{
					if (!PC_String_ParseNoAlloc(handle, text, sizeof(text)))
					{
						return G_ConfigError(handle, "expected value after '-'");
					}

					Q_strncpyz(value, va("-%s", text), sizeof(value));
				}
			}

			for (; i < config->numSetl; i++)
			{
				if (!Q_stricmp(config->setl[i].name, text))
				{
					overwrite = qtrue;
					break;
				}
			}

			if (overwrite)
			{
				Q_strncpyz(config->setl[i].name, text, sizeof(config->setl[0].name));
				Q_strncpyz(config->setl[i].value, value, sizeof(config->setl[0].name));
			}
			else
			{
				Q_strncpyz(config->setl[config->numSetl].name, text, sizeof(config->setl[0].name));
				Q_strncpyz(config->setl[config->numSetl].value, value, sizeof(config->setl[0].name));
				i = config->numSetl;
				config->numSetl++;
			}

			trap_Cvar_Set(config->setl[i].name, config->setl[i].value);
			G_Printf("setl %s %s\n", config->setl[i].name, config->setl[i].value);
		}
		else if (!Q_stricmp(token.string, "command"))
		{
			if (!trap_PC_ReadToken(handle, &token))
			{
				return G_ConfigError(handle, "expected a command value");
			}
			trap_SendConsoleCommand(EXEC_APPEND, va("%s\n", token.string));
		}
		else if (!Q_stricmp(token.string, "mapscripthash"))
		{
			if (!PC_String_ParseNoAlloc(handle, config->mapscripthash, sizeof(config->mapscripthash)))
			{
				return G_ConfigError(handle, "expected mapscript hash value");
			}
		}
		else
		{
			return G_ConfigError(handle, "unknown token: %s", token.string);
		}
	}

	return qtrue;
}
Exemplo n.º 11
0
static qboolean CG_ParseHUD(int handle)
{
	pc_token_t    token;
	hudStucture_t temphud;

	CG_setDefaultHudValues(&temphud);

	if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "{"))
	{
		return CG_HUD_ParseError(handle, "expected '{'");
	}

	while (1)
	{
		if (!trap_PC_ReadToken(handle, &token))
		{
			break;
		}

		if (token.string[0] == '}')
		{
			break;
		}

		if (!Q_stricmp(token.string, "hudnumber"))
		{
			if (!PC_Int_Parse(handle, &temphud.hudnumber))
			{
				return CG_HUD_ParseError(handle, "expected hud number");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "compas"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.compas))
			{
				return CG_HUD_ParseError(handle, "expected compas");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "staminabar"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.staminabar))
			{
				return CG_HUD_ParseError(handle, "expected staminabar");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "healthbar"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.healthbar))
			{
				return CG_HUD_ParseError(handle, "expected healthbar");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "weaponchangebar"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.weaponchargebar))
			{
				return CG_HUD_ParseError(handle, "expected weaponchangebar");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "healthtext"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.healthtext))
			{
				return CG_HUD_ParseError(handle, "expected healthtext");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "xptext"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.xptext))
			{
				return CG_HUD_ParseError(handle, "expected xptext");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "statsdisplay"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.statsdisplay))
			{
				return CG_HUD_ParseError(handle, "expected statsdisplay");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "weaponicon"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.weaponicon))
			{
				return CG_HUD_ParseError(handle, "expected weaponicon");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "weaponammo"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.weaponammo))
			{
				return CG_HUD_ParseError(handle, "expected weaponammo");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "fireteam"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.fireteam))
			{
				return CG_HUD_ParseError(handle, "expected fireteam");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "popupmessages"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.popupmessages))
			{
				return CG_HUD_ParseError(handle, "expected popupmessages");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "powerups"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.powerups))
			{
				return CG_HUD_ParseError(handle, "expected powerups");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "hudhead"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.hudhead))
			{
				return CG_HUD_ParseError(handle, "expected hudhead");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "cursorhints"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.cursorhint))
			{
				return CG_HUD_ParseError(handle, "expected cursorhints");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "weaponstability"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.weaponstability))
			{
				return CG_HUD_ParseError(handle, "expected weaponstability");
			}
			continue;
		}

		if (!Q_stricmp(token.string, "livesleft"))
		{
			if (!CG_ParseHudComponent(handle, &temphud.livesleft))
			{
				return CG_HUD_ParseError(handle, "expected livesleft");
			}
			continue;
		}

		return CG_HUD_ParseError(handle, "unexpected token: %s", token.string);
	}

	if (CG_isHudNumberAvailable(temphud.hudnumber))
	{
		Com_Printf("Hud properties for hud: %i have been read!\n", temphud.hudnumber);
		CG_addHudToList(temphud);
	}
	else
	{
		Com_Printf("^1Hud with number: %i already exists!\n", temphud.hudnumber);
	}

	return qtrue;
}
Exemplo n.º 12
0
static qboolean G_LoadCampaignsFromFile( const char *filename ) {
	int handle;
	pc_token_t token;
	const char *s;
	qboolean mapFound = qfalse;

	handle = trap_PC_LoadSource( filename );

	if ( !handle ) {
		G_Printf( va( S_COLOR_RED "file not found: %s\n", filename ) );
		return qfalse;
	}

	if ( !trap_PC_ReadToken( handle, &token ) ) {
		trap_PC_FreeSource( handle );
		return qfalse;
	}
	if ( *token.string != '{' ) {
		trap_PC_FreeSource( handle );
		return qfalse;
	}

	while ( trap_PC_ReadToken( handle, &token ) ) {
		if ( *token.string == '}' ) {
			level.campaignCount++;

			// zinx - can't handle any more.
			if ( level.campaignCount >= MAX_CAMPAIGNS ) {
				break;
			}

			if ( !trap_PC_ReadToken( handle, &token ) ) {
				// eof
				trap_PC_FreeSource( handle );
				break;
			}

			if ( *token.string != '{' ) {
				G_Printf( va( S_COLOR_RED "unexpected token '%s' inside: %s\n", token.string, filename ) );
				trap_PC_FreeSource( handle );
				return qfalse;
			}
		} else if ( !Q_stricmp( token.string, "name" ) ||
					!Q_stricmp( token.string, "description" ) ||
					!Q_stricmp( token.string, "image" ) ) {
			if ( ( s = PC_String_Parse( handle ) ) == NULL ) {
				G_Printf( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
				trap_PC_FreeSource( handle );
				return qfalse;
			}
		} else if ( !Q_stricmp( token.string, "shortname" ) ) {
			if ( ( s = PC_String_Parse( handle ) ) == NULL ) {
				G_Printf( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
				trap_PC_FreeSource( handle );
				return qfalse;
			} else {
				Q_strncpyz( g_campaigns[level.campaignCount].shortname, s, sizeof( g_campaigns[level.campaignCount].shortname ) );
			}
		} else if ( !Q_stricmp( token.string, "next" ) ) {
			if ( ( s = PC_String_Parse( handle ) ) == NULL ) {
				G_Printf( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
				trap_PC_FreeSource( handle );
				return qfalse;
			} else {
				Q_strncpyz( g_campaigns[level.campaignCount].shortname, s, sizeof( g_campaigns[level.campaignCount].next ) );
			}
		} else if ( !Q_stricmp( token.string, "type" ) ) {
			if ( !trap_PC_ReadToken( handle, &token ) ) {
				G_Printf( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
				trap_PC_FreeSource( handle );
				return qfalse;
			}

			if ( strstr( token.string, "wolfsp" ) ) {
				g_campaigns[level.campaignCount].typeBits |= ( 1 << GT_SINGLE_PLAYER );
			}
			if ( strstr( token.string, "wolfcoop" ) ) {
				g_campaigns[level.campaignCount].typeBits |= ( 1 << GT_COOP );
			}
			if ( strstr( token.string, "wolfmp" ) ) {
				g_campaigns[level.campaignCount].typeBits |= ( 1 << GT_WOLF );
			}
			if ( strstr( token.string, "wolfsw" ) ) {
				g_campaigns[level.campaignCount].typeBits |= ( 1 << GT_WOLF_STOPWATCH );
			}
			if ( strstr( token.string, "wolflms" ) ) {
				g_campaigns[level.campaignCount].typeBits |= ( 1 << GT_WOLF_LMS );
			}
		} else if ( !Q_stricmp( token.string, "maps" ) ) {
			char *ptr, mapname[128], *mapnamePtr;

			if ( !trap_PC_ReadToken( handle, &token ) ) {
				G_Printf( S_COLOR_RED "unexpected end of file inside: %s\n", filename );
				trap_PC_FreeSource( handle );
				return qfalse;
			}

			ptr = token.string;
			while ( *ptr ) {
				mapnamePtr = mapname;
				while ( *ptr && *ptr != ';' ) {
					*mapnamePtr++ = *ptr++;
				}
				if ( *ptr ) {
					ptr++;
				}
				*mapnamePtr = '\0';

				if ( g_gametype.integer == GT_WOLF_CAMPAIGN ) {
					if ( !mapFound &&
						 !Q_stricmp( g_campaigns[level.campaignCount].shortname, g_currentCampaign.string ) &&
						 !Q_stricmp( mapname, level.rawmapname ) ) {

						if ( g_currentCampaignMap.integer == 0 ) {
							level.newCampaign = qtrue;
						} else {
							level.newCampaign = qfalse;
						}

						if ( g_campaigns[level.campaignCount].mapCount == g_currentCampaignMap.integer ) {
							g_campaigns[level.campaignCount].current = g_campaigns[level.campaignCount].mapCount;
							mapFound = qtrue;
							//trap_Cvar_Set( "g_currentCampaignMap", va( "%i", g_campaigns[level.campaignCount].mapCount ) );
						}

						level.currentCampaign = level.campaignCount;
					}
				}
				// rain - don't stomp out of bounds
				if ( g_campaigns[level.campaignCount].mapCount < MAX_MAPS_PER_CAMPAIGN ) {
					Q_strncpyz( g_campaigns[level.campaignCount].mapnames[g_campaigns[level.campaignCount].mapCount], mapname, MAX_QPATH );
					g_campaigns[level.campaignCount].mapCount++;
				} else {
					// rain - yell if there are too many maps in this campaign,
					// and then skip it

					G_Printf( "^1Error: Campaign %s (%s) has too many maps\n", g_campaigns[level.campaignCount].shortname, filename );
					// rain - hack - end of campaign will increment this
					// again, so this one will be overwritten
					// rain - clear out this campaign so that everything's
					// okay when when we add the next
					memset( &g_campaigns[level.campaignCount], 0, sizeof( g_campaigns[0] ) );
					level.campaignCount--;

					break;
				}
			}
		}
	}

	return mapFound;
}
Exemplo n.º 13
0
static void UI_LoadCampaignsFromFile( const char *filename ) {
    int handle, i;
    pc_token_t token;

    handle = trap_PC_LoadSource( filename );

    if( !handle ) {
        trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) );
        return;
    }

    if( !trap_PC_ReadToken( handle, &token ) ) {
        trap_PC_FreeSource( handle );
        return;
    }
    if( *token.string != '{' ) {
        trap_PC_FreeSource( handle );
        return;
    }

    while ( trap_PC_ReadToken( handle, &token ) ) {
        if( *token.string == '}' ) {
            if( uiInfo.campaignList[uiInfo.campaignCount].initial ) {
                if( uiInfo.campaignList[uiInfo.campaignCount].typeBits & (1<<GT_SINGLE_PLAYER) )
                    uiInfo.campaignList[uiInfo.campaignCount].unlocked = qtrue;
                // Always unlock the initial SP campaign
            }

            uiInfo.campaignList[uiInfo.campaignCount].campaignCinematic = -1;
            uiInfo.campaignList[uiInfo.campaignCount].campaignShot = -1;

            uiInfo.campaignCount++;

            if( !trap_PC_ReadToken( handle, &token ) ) {
                // eof
                trap_PC_FreeSource( handle );
                return;
            }

            if( *token.string != '{' ) {
                //uiInfo.campaignList[uiInfo.campaignCount].order = -1;

                trap_Print( va( S_COLOR_RED "unexpected token '%s' inside: %s\n", token.string, filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "shortname" ) ) {
            if( !PC_String_Parse( handle, &uiInfo.campaignList[uiInfo.campaignCount].campaignShortName ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "name" ) ) {
            if( !PC_String_Parse( handle, &uiInfo.campaignList[uiInfo.campaignCount].campaignName ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "description" ) ) {
            if( !PC_String_Parse( handle, &uiInfo.campaignList[uiInfo.campaignCount].campaignDescription ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "image" ) ) {
            if( !PC_String_Parse( handle, &uiInfo.campaignList[uiInfo.campaignCount].campaignShotName ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            } else {
                uiInfo.campaignList[uiInfo.campaignCount].campaignShot = -1;
            }
        } else if( !Q_stricmp( token.string, "initial" ) ) {
            uiInfo.campaignList[uiInfo.campaignCount].initial = qtrue;
        } else if( !Q_stricmp( token.string, "next" ) ) {
            if( !PC_String_Parse( handle, &uiInfo.campaignList[uiInfo.campaignCount].nextCampaignShortName ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "type" ) ) {
            if( !trap_PC_ReadToken( handle, &token ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }

            if( strstr( token.string, "wolfsp" ) ) {
                uiInfo.campaignList[uiInfo.campaignCount].typeBits |= (1 << GT_SINGLE_PLAYER);
            }
            if( strstr( token.string, "wolfmp" ) ) {
                uiInfo.campaignList[uiInfo.campaignCount].typeBits |= (1 << GT_WOLF);
            }
            if( strstr( token.string, "wolfsw" ) ) {
                uiInfo.campaignList[uiInfo.campaignCount].typeBits |= (1 << GT_WOLF_STOPWATCH);
            }
            if( strstr( token.string, "wolflms" ) ) {
                uiInfo.campaignList[uiInfo.campaignCount].typeBits |= (1 << GT_WOLF_LMS);
            }
        } else if( !Q_stricmp( token.string, "maps" ) ) {
            char *ptr, mapname[128], *mapnameptr;

            if( !trap_PC_ReadToken( handle, &token ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }

            // find the mapInfo's that match our mapnames
            uiInfo.campaignList[uiInfo.campaignCount].mapCount = 0;

            ptr = token.string;
            while( *ptr ) {
                mapnameptr = mapname;
                while( *ptr && *ptr != ';' ) {
                    *mapnameptr++ = *ptr++;
                }
                if( *ptr )
                    ptr++;
                *mapnameptr = '\0';
                for( i = 0; i < uiInfo.mapCount; i++ ) {
                    if( !Q_stricmp( uiInfo.mapList[i].mapLoadName, mapname ) ) {
                        uiInfo.campaignList[uiInfo.campaignCount].mapInfos[uiInfo.campaignList[uiInfo.campaignCount].mapCount++] = &uiInfo.mapList[i];
                        break;
                    }
                }
            }
        } else if( !Q_stricmp( token.string, "maptc" ) ) {
            if( !trap_PC_ReadToken( handle, &token ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }

            uiInfo.campaignList[uiInfo.campaignCount].mapTC[0][0] = token.floatvalue;

            if( !trap_PC_ReadToken( handle, &token ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }

            uiInfo.campaignList[uiInfo.campaignCount].mapTC[0][1] = token.floatvalue;

            uiInfo.campaignList[uiInfo.campaignCount].mapTC[1][0] = 650 + uiInfo.campaignList[uiInfo.campaignCount].mapTC[0][0];
            uiInfo.campaignList[uiInfo.campaignCount].mapTC[1][1] = 650 + uiInfo.campaignList[uiInfo.campaignCount].mapTC[0][1];
            /*if( !trap_PC_ReadToken( handle, &token ) ) {
            	trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
            	trap_PC_FreeSource( handle );
            	return;
            }

            uiInfo.campaignList[uiInfo.campaignCount].mapTC[1][0] = token.floatvalue + uiInfo.campaignList[uiInfo.campaignCount].mapTC[0][0];

            if( !trap_PC_ReadToken( handle, &token ) ) {
            	trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
            	trap_PC_FreeSource( handle );
            	return;
            }

            uiInfo.campaignList[uiInfo.campaignCount].mapTC[1][1] = token.floatvalue + uiInfo.campaignList[uiInfo.campaignCount].mapTC[0][1];*/
        }
    }

    trap_PC_FreeSource( handle );
}
Exemplo n.º 14
0
//===========================================================================
//
// Parameter:			-
// Returns:				-
// Changes Globals:		-
//===========================================================================
qboolean BotLoadCharacterFromFile(char *charfile, int skill, bot_character_t *ch)
{
	int indent, index, foundcharacter;
	int	source;
	pc_token_t token;

	foundcharacter = qfalse;
	//a bot character is parsed in two phases
	source = trap_PC_LoadSource(charfile, BOTFILESBASEFOLDER);
	if (!source)
	{
		BotAI_Print(PRT_ERROR, "counldn't load %s\n", charfile);
		return qfalse;
	} //end if
	strcpy(ch->filename, charfile);
	while(trap_PC_ReadToken(source, &token))
	{
		if (!strcmp(token.string, "skill"))
		{
			if (!PC_ExpectTokenType(source, TT_NUMBER, 0, &token))
			{
				trap_PC_FreeSource(source);
				BotFreeCharacterStrings(ch);
				return qfalse;
			} //end if
			if (!PC_ExpectTokenString(source, "{"))
			{
				trap_PC_FreeSource(source);
				BotFreeCharacterStrings(ch);
				return qfalse;
			} //end if
			//if it's the correct skill
			if (skill < 0 || token.intvalue == skill)
			{
				foundcharacter = qtrue;
				ch->skill = token.intvalue;
				while(PC_ExpectAnyToken(source, &token))
				{
					if (!strcmp(token.string, "}")) break;
					if (token.type != TT_NUMBER || !(token.subtype & TT_INTEGER))
					{
						PC_SourceError(source, "expected integer index, found %s", token.string);
						trap_PC_FreeSource(source);
						BotFreeCharacterStrings(ch);
						return qfalse;
					} //end if
					index = token.intvalue;
					if (index < 0 || index > MAX_CHARACTERISTICS)
					{
						PC_SourceError(source, "characteristic index out of range [0, %d]", MAX_CHARACTERISTICS);
						trap_PC_FreeSource(source);
						BotFreeCharacterStrings(ch);
						return qfalse;
					} //end if
					if (ch->c[index].type)
					{
						PC_SourceError(source, "characteristic %d already initialized", index);
						trap_PC_FreeSource(source);
						BotFreeCharacterStrings(ch);
						return qfalse;
					} //end if
					if (!PC_ExpectAnyToken(source, &token))
					{
						trap_PC_FreeSource(source);
						BotFreeCharacterStrings(ch);
						return qfalse;
					} //end if
					if (token.type == TT_NUMBER)
					{
						if (token.subtype & TT_FLOAT)
						{
							ch->c[index].value._float = token.floatvalue;
							ch->c[index].type = CT_FLOAT;
						} //end if
						else
						{
							ch->c[index].value.integer = token.intvalue;
							ch->c[index].type = CT_INTEGER;
						} //end else
					} //end if
					else if (token.type == TT_STRING)
					{
						// ZTM: FIXME: ### I think I made this be done in the engine
						//StripDoubleQuotes(token.string);
						ch->c[index].value.string = trap_Alloc(strlen(token.string)+1, NULL);
						strcpy(ch->c[index].value.string, token.string);
						ch->c[index].type = CT_STRING;
					} //end else if
					else
					{
						PC_SourceError(source, "expected integer, float or string, found %s", token.string);
						trap_PC_FreeSource(source);
						BotFreeCharacterStrings(ch);
						return qfalse;
					} //end else
				} //end if
				break;
			} //end if
			else
			{
				indent = 1;
				while(indent)
				{
					if (!PC_ExpectAnyToken(source, &token))
					{
						trap_PC_FreeSource(source);
						BotFreeCharacterStrings(ch);
						return qfalse;
					} //end if
					if (!strcmp(token.string, "{")) indent++;
					else if (!strcmp(token.string, "}")) indent--;
				} //end while
			} //end else
		} //end if
		else
		{
			PC_SourceError(source, "unknown definition %s", token.string);
			trap_PC_FreeSource(source);
			BotFreeCharacterStrings(ch);
			return qfalse;
		} //end else
	} //end while
	trap_PC_FreeSource(source);
	//
	if (!foundcharacter)
	{
		BotFreeCharacterStrings(ch);
		return qfalse;
	} //end if
	return qtrue;
} //end of the function BotLoadCharacterFromFile
Exemplo n.º 15
0
qboolean CG_FindArenaInfo(char *filename, char *mapname, arenaInfo_t *info)
{
	int             handle;
	pc_token_t      token;
	const char     *dummy;
	qboolean        found = qfalse;

	handle = trap_PC_LoadSource(filename);

	if (!handle)
	{
		trap_Print(va(S_COLOR_RED "file not found: %s\n", filename));
		return qfalse;
	}

	if (!trap_PC_ReadToken(handle, &token))
	{
		trap_PC_FreeSource(handle);
		return qfalse;
	}

	if (*token.string != '{')
	{
		trap_PC_FreeSource(handle);
		return qfalse;
	}

	while (trap_PC_ReadToken(handle, &token))
	{
		if (*token.string == '}')
		{
			if (found)
			{
//              info->image = trap_R_RegisterShaderNoMip(va("levelshots/%s", mapname));
				trap_PC_FreeSource(handle);
				return qtrue;
			}

			found = qfalse;

			if (!trap_PC_ReadToken(handle, &token))
			{
				// eof
				trap_PC_FreeSource(handle);
				return qfalse;
			}

			if (*token.string != '{')
			{
				trap_Print(va(S_COLOR_RED "unexpected token '%s' inside: %s\n", token.string, filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}
		}
		else if (!Q_stricmp(token.string, "objectives") || !Q_stricmp(token.string, "description") ||
		         !Q_stricmp(token.string, "type"))
		{
			if (!PC_String_Parse(handle, &dummy))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}
		}
		else if (!Q_stricmp(token.string, "longname"))
		{
			if (!PC_String_Parse(handle, &dummy))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}
			else
			{
				//char* p = info->longname;

				Q_strncpyz(info->longname, dummy, 128);
				// Gordon: removing cuz, er, no-one knows why it's here!...
				/*				while(*p) {
									*p = toupper(*p);
									p++;
								}*/
			}
		}
		else if (!Q_stricmp(token.string, "map"))
		{
			if (!PC_String_Parse(handle, &dummy))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}
			else
			{
				if (!Q_stricmp(dummy, mapname))
				{
					found = qtrue;
				}
			}
		}
		else if (!Q_stricmp(token.string, "Timelimit") || !Q_stricmp(token.string, "AxisRespawnTime") ||
		         !Q_stricmp(token.string, "AlliedRespawnTime"))
		{
			if (!PC_Int_Parse(handle, (int *)&dummy))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}
		}
		else if (!Q_stricmp(token.string, "lmsbriefing"))
		{
			if (!PC_String_Parse(handle, &dummy))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}
			else
			{
				Q_strncpyz(info->lmsdescription, dummy, sizeof(info->lmsdescription));
			}
		}
		else if (!Q_stricmp(token.string, "briefing"))
		{
			if (!PC_String_Parse(handle, &dummy))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}
			else
			{
				Q_strncpyz(info->description, dummy, sizeof(info->description));
			}
		}
		else if (!Q_stricmp(token.string, "alliedwintext"))
		{
			if (!PC_String_Parse(handle, &dummy))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}
			else
			{
				Q_strncpyz(info->alliedwintext, dummy, sizeof(info->description));
			}
		}
		else if (!Q_stricmp(token.string, "axiswintext"))
		{
			if (!PC_String_Parse(handle, &dummy))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}
			else
			{
				Q_strncpyz(info->axiswintext, dummy, sizeof(info->description));
			}
		}
		else if (!Q_stricmp(token.string, "mapposition_x"))
		{
			vec_t           x;

			if (!trap_PC_ReadToken(handle, &token))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}

			x = token.floatvalue;

			info->mappos[0] = x;
		}
		else if (!Q_stricmp(token.string, "mapposition_y"))
		{
			vec_t           y;

			if (!trap_PC_ReadToken(handle, &token))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}

			y = token.floatvalue;

			info->mappos[1] = y;
		}
	}

	trap_PC_FreeSource(handle);
	return qfalse;
}
Exemplo n.º 16
0
static qboolean BG_RAG_ParseAnimFile(int handle, animModelInfo_t *animModelInfo)
{
	pc_token_t token;
#ifdef CGAMEDLL
	qhandle_t mdxFile;
#else
	char mdxFileName[MAX_QPATH];
#endif // CGAMEDLL

	animation_t *animation;

	if (!trap_PC_ReadToken(handle, &token))
	{
		return BG_RAG_ParseError(handle, "expected mdx filename");
	}

#ifdef CGAMEDLL
	if (!(mdxFile = trap_R_RegisterModel(token.string)))
	{
		return BG_RAG_ParseError(handle, "failed to load %s", token.string);
	}
#else
	Q_strncpyz(mdxFileName, token.string, sizeof(mdxFileName));
#endif // CGAMEDLL

	if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "{"))
	{
		return BG_RAG_ParseError(handle, "expected '{'");
	}

	while (1)
	{
		if (!trap_PC_ReadToken(handle, &token))
		{
			return BG_RAG_ParseError(handle, "unexpected EOF");
		}

		if (token.string[0] == '}')
		{
			break;
		}

#ifdef CGAMEDLL
		if (!(animation = BG_RAG_FindFreeAnimation(mdxFile, token.string)))
		{
#else
		if (!(animation = BG_RAG_FindFreeAnimation(mdxFileName, token.string)))
		{
#endif // CGAMEDLL
			return BG_RAG_ParseError(handle, "out of animation storage space");
		}

		Q_strncpyz(animation->name, token.string, sizeof(animation->name));
		Q_strlwr(animation->name);

		if (!BG_RAG_ParseAnimation(handle, animation))
		{
			return qfalse;
		}

		animModelInfo->animations[animModelInfo->numAnimations] = animation;
		animModelInfo->numAnimations++;
	}

	return qtrue;
}

qboolean BG_R_RegisterAnimationGroup(const char *filename, animModelInfo_t *animModelInfo)
{
	pc_token_t token;
	int        handle;

	animModelInfo->numAnimations = 0;
	animModelInfo->footsteps     = FOOTSTEP_NORMAL;
	animModelInfo->gender        = GENDER_MALE;
	animModelInfo->isSkeletal    = qtrue;
	animModelInfo->version       = 3;
	animModelInfo->numHeadAnims  = 0;

	handle = trap_PC_LoadSource(filename);

	if (!handle)
	{
		return qfalse;
	}

	if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "animgroup"))
	{
		return BG_RAG_ParseError(handle, "expected 'animgroup'");
	}

	if (!trap_PC_ReadToken(handle, &token) || Q_stricmp(token.string, "{"))
	{
		return BG_RAG_ParseError(handle, "expected '{'");
	}

	while (1)
	{
		if (!trap_PC_ReadToken(handle, &token))
		{
			break;
		}

		if (token.string[0] == '}')
		{
			break;
		}

		if (!Q_stricmp(token.string, "animfile"))
		{
			if (!BG_RAG_ParseAnimFile(handle, animModelInfo))
			{
				return qfalse;
			}
		}
		else
		{
			return BG_RAG_ParseError(handle, "unknown token '%s'", token.string);
		}
	}

	trap_PC_FreeSource(handle);

	return qtrue;
}
Exemplo n.º 17
0
qboolean CG_FindCampaignInFile(char *filename, char *campaignShortName, cg_campaignInfo_t *info)
{
	int             handle;
	pc_token_t      token;

//  char* dummy;
	qboolean        campaignFound = qfalse;

	info->mapCount = 0;

	handle = trap_PC_LoadSource(filename);

	if (!handle)
	{
		trap_Print(va(S_COLOR_RED "file not found: %s\n", filename));
		return qfalse;
	}

	if (!trap_PC_ReadToken(handle, &token))
	{
		trap_PC_FreeSource(handle);
		return qfalse;
	}

	if (*token.string != '{')
	{
		trap_PC_FreeSource(handle);
		return qfalse;
	}

	while (trap_PC_ReadToken(handle, &token))
	{
		if (*token.string == '}')
		{
			if (campaignFound)
			{
				trap_PC_FreeSource(handle);
				return qtrue;
			}

			if (!trap_PC_ReadToken(handle, &token))
			{
				// eof
				trap_PC_FreeSource(handle);
				return qfalse;
			}

			if (*token.string != '{')
			{
				trap_Print(va(S_COLOR_RED "unexpected token '%s' inside: %s\n", token.string, filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}

			info->mapCount = 0;
		}
		else if (!Q_stricmp(token.string, "shortname"))
		{
			if (!trap_PC_ReadToken(handle, &token))
			{
				// don't do a stringparse due to memory constraints
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}

			if (!Q_stricmp(token.string, campaignShortName))
			{
				campaignFound = qtrue;
			}
		}
		else if (!Q_stricmp(token.string, "next") || !Q_stricmp(token.string, "image"))
		{
			//if( !PC_String_Parse( handle, &dummy ) ) {
			if (!trap_PC_ReadToken(handle, &token))
			{
				// don't do a stringparse due to memory constraints
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}
		}
		else if (!Q_stricmp(token.string, "description"))
		{
			if (!trap_PC_ReadToken(handle, &token))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}

			Q_strncpyz(info->campaignDescription, token.string, sizeof(info->campaignDescription));
		}
		else if (!Q_stricmp(token.string, "name"))
		{
			if (!trap_PC_ReadToken(handle, &token))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}

			Q_strncpyz(info->campaignName, token.string, sizeof(info->campaignName));
		}
		else if (!Q_stricmp(token.string, "maps"))
		{
			char           *ptr, mapname[128], *mapnameptr;

			if (!trap_PC_ReadToken(handle, &token))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}

			ptr = token.string;

			while (*ptr)
			{
				mapnameptr = mapname;

				while (*ptr && *ptr != ';')
				{
					*mapnameptr++ = *ptr++;
				}

				if (*ptr)
				{
					ptr++;
				}

				*mapnameptr = '\0';

				if (info->mapCount >= MAX_MAPS_PER_CAMPAIGN)
				{
					trap_Print(va(S_COLOR_RED "too many maps for a campaign inside: %s\n", filename));
					trap_PC_FreeSource(handle);
					break;
				}

				Q_strncpyz(info->mapnames[info->mapCount++], mapname, MAX_QPATH);
			}
		}
		else if (!Q_stricmp(token.string, "maptc"))
		{
			if (!trap_PC_ReadToken(handle, &token))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}

			info->mapTC[0][0] = token.floatvalue;

			if (!trap_PC_ReadToken(handle, &token))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return qfalse;
			}

			info->mapTC[0][1] = token.floatvalue;

			info->mapTC[1][0] = 650 + info->mapTC[0][0];
			info->mapTC[1][1] = 650 + info->mapTC[0][1];
		}
	}

	trap_PC_FreeSource(handle);
	return qfalse;
}
Exemplo n.º 18
0
qboolean G_ParseMapSettings(int handle, config_t *config)
{
	pc_token_t token;
	char       serverinfo[MAX_INFO_STRING];
	char       *mapname;

	trap_GetServerinfo(serverinfo, sizeof(serverinfo));
	mapname = Info_ValueForKey(serverinfo, "mapname");

	if (!trap_PC_ReadToken(handle, &token))
	{
		G_Printf("Malformed map config\n");
	}

	G_Printf("Map settings for: %s\n", token.string);
	G_Printf("Current map: %s\n", mapname);

	if (!Q_stricmp(token.string, "default"))
	{
		G_Printf("Setting rules for map: %s\n", token.string);
		return G_ParseSettings(handle, qtrue, config);
	}
	else if (!Q_stricmp(token.string, mapname))
	{
		fileHandle_t f;
		char         *code, *signature;
		qboolean     res;

		G_Printf("Setting rules for map: %s\n", token.string);
		res = G_ParseSettings(handle, qtrue, config);
		if (res && strlen(config->mapscripthash))
		{
			char sdir[MAX_QPATH];
			int  flen = 0;

			trap_Cvar_VariableStringBuffer("g_mapScriptDirectory", sdir, sizeof(sdir));

			flen = trap_FS_FOpenFile(va("%s/%s.script", sdir, mapname), &f, FS_READ);
			if (flen < 0)
			{
				// FIXME: handle this properly..
				//return G_ConfigError(handle, "Cannot open mapscript file for hash verification: %s/%s.script", sdir, mapname);
				G_Printf("Cannot open mapscript file for hash verification: %s/%s.script", sdir, mapname);
				return res;
			}

			code = malloc(flen + 1);
			trap_FS_Read(code, flen, f);
			*(code + flen) = '\0';
			trap_FS_FCloseFile(f);
			signature = G_SHA1(code);

			free(code);

			if (Q_stricmp(config->mapscripthash, signature))
			{
				return G_ConfigError(handle, "Invalid mapscript hash for map: %s hash given in config: \"%s\" scripts actual hash \"%s\"", mapname, config->mapscripthash, signature);
			}

			G_Printf("Hash is valid for map: %s\n", mapname);
		}

		return res;
	}
	else
	{
		G_Printf("Ignoring rules for map: %s\n", token.string);
		return G_ParseSettings(handle, qfalse, config);
	}
}
Exemplo n.º 19
0
/*
===============
UI_LoadArenasFromFile
===============
*/
static void UI_LoadArenasFromFile( char *filename ) {
    /*	int				len;
    	fileHandle_t	f;
    	char			buf[MAX_ARENAS_TEXT];

    	len = trap_FS_FOpenFile( filename, &f, FS_READ );
    	if ( !f ) {
    		trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) );
    		return;
    	}
    	if ( len >= MAX_ARENAS_TEXT ) {
    		trap_Print( va( S_COLOR_RED "file too large: %s is %i, max allowed is %i", filename, len, MAX_ARENAS_TEXT ) );
    		trap_FS_FCloseFile( f );
    		return;
    	}

    	trap_FS_Read( buf, len, f );
    	buf[len] = 0;
    	trap_FS_FCloseFile( f );

    	ui_numArenas += UI_ParseInfos( buf, MAX_ARENAS - ui_numArenas, &ui_arenaInfos[ui_numArenas], MAX_ARENAS );*/

    int handle;
    pc_token_t token;

    handle = trap_PC_LoadSource( filename );

    if( !handle ) {
        trap_Print( va( S_COLOR_RED "file not found: %s\n", filename ) );
        return;
    }

    if( !trap_PC_ReadToken( handle, &token ) ) {
        trap_PC_FreeSource( handle );
        return;
    }

    if( *token.string != '{' ) {
        trap_PC_FreeSource( handle );
        return;
    }

    uiInfo.mapList[uiInfo.mapCount].cinematic = -1;
    uiInfo.mapList[uiInfo.mapCount].levelShot = -1;
    uiInfo.mapList[uiInfo.mapCount].typeBits = 0;

    while( trap_PC_ReadToken( handle, &token ) ) {
        if( *token.string == '}' ) {

            if( !uiInfo.mapList[uiInfo.mapCount].typeBits ) {
                uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF);
            }

            uiInfo.mapCount++;
            if( uiInfo.mapCount >= MAX_MAPS ) {
                break;
            }

            if( !trap_PC_ReadToken( handle, &token ) ) {
                // eof
                trap_PC_FreeSource( handle );
                return;
            }

            if( *token.string != '{' ) {
                trap_Print( va( S_COLOR_RED "unexpected token '%s' inside: %s\n", token.string, filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "map" ) ) {
            if( !PC_String_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].mapLoadName ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "longname" ) ) {
            if( !PC_String_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].mapName ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "briefing" ) ) {
            if( !PC_String_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].briefing ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "lmsbriefing" ) ) {
            if( !PC_String_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].lmsbriefing ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
            /*} else if( !Q_stricmp( token.string, "objectives" ) ) {
            	if( !PC_String_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].objectives ) ) {
            		trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
            		trap_PC_FreeSource( handle );
            		return;
            	}*/
        } else if( !Q_stricmp( token.string, "timelimit" ) ) {
            if( !PC_Int_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].Timelimit ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "axisrespawntime" ) ) {
            if( !PC_Int_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].AxisRespawnTime ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "alliedrespawntime" ) ) {
            if( !PC_Int_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].AlliedRespawnTime ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "type" ) ) {
            if( !trap_PC_ReadToken( handle, &token ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            } else {
                if( strstr( token.string, "wolfsp" ) ) {
                    uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_SINGLE_PLAYER);
                }
                if( strstr( token.string, "wolflms" ) ) {
                    uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF_LMS);
                }
                if( strstr( token.string, "wolfmp" ) ) {
                    uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF);
                }
                if( strstr( token.string, "wolfsw" ) ) {
                    uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF_STOPWATCH);
                }
            }
        } else if( !Q_stricmp( token.string, "mapposition_x" ) ) {
            if( !PC_Float_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].mappos[0] ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        } else if( !Q_stricmp( token.string, "mapposition_y" ) ) {
            if( !PC_Float_Parse( handle, &uiInfo.mapList[uiInfo.mapCount].mappos[1] ) ) {
                trap_Print( va( S_COLOR_RED "unexpected end of file inside: %s\n", filename ) );
                trap_PC_FreeSource( handle );
                return;
            }
        }
    }

    trap_PC_FreeSource( handle );
    return;
}/* ============= UI_SortArenas CHRUKER: b090 - Sorting the map list ============= */
Exemplo n.º 20
0
void G_configLoadAndSet(const char *name)
{
	pc_token_t token;
	int        handle;
	config_t   *config;
	qboolean   parseOK = qtrue;

	handle = trap_PC_LoadSource(va("configs/%s.config", name));

	if (!handle)
	{
		Com_Printf(S_COLOR_RED "ERROR: File not found: %s\n", name);
		return;
	}

	memset(&level.config, 0, sizeof(config_t));

	G_wipeCvars();

	config = &level.config;

	config->publicConfig = qfalse;

	while (1)
	{
		if (!trap_PC_ReadToken(handle, &token))
		{
			break;
		}

		if (!Q_stricmp(token.string, "configname"))
		{
			if (!PC_String_ParseNoAlloc(handle, config->name, sizeof(config->name)))
			{
				G_Printf("expected config name\n");
				parseOK = qfalse;
				break;
			}
			G_Printf("Config name is: %s\n", config->name);
		}
		else if (!Q_stricmp(token.string, "version"))
		{
			if (!PC_String_ParseNoAlloc(handle, config->version, sizeof(config->name)))
			{
				G_Printf("expected config version\n");
				parseOK = qfalse;
				break;
			}
		}
		else if (!Q_stricmp(token.string, "init"))
		{
			if (!G_ParseSettings(handle, qtrue, config))
			{
				G_Printf("Reading settings failed\n");
				parseOK = qfalse;
				break;
			}
		}
		else if (!Q_stricmp(token.string, "map"))
		{
			if (!G_ParseMapSettings(handle, config))
			{
				G_Printf("Reading map settings failed\n");
				parseOK = qfalse;
				break;
			}
		}
		else if (!Q_stricmp(token.string, "signature"))
		{
			if (!PC_String_ParseNoAlloc(handle, config->signature, sizeof(config->signature)))
			{
				G_Printf("expected config signature\n");
				parseOK = qfalse;
				break;
			}
		}
		else if (!Q_stricmp(token.string, "public"))
		{
			config->publicConfig = qtrue;
		}
		else
		{
			G_Printf("unknown token %s\n", token.string);
			parseOK = qfalse;
			break;
		}
	}
	trap_PC_FreeSource(handle);

	if (parseOK)
	{
		trap_SetConfigstring(CS_CONFIGNAME, config->name);

		if (level.config.version[0] && level.config.name[0])
		{
			trap_SendServerCommand(-1, va("cp \"^7Config '%s^7' version '%s'^7 loaded\"", level.config.name, level.config.version));
		}
		else if (level.config.name[0])
		{
			trap_SendServerCommand(-1, va("cp \"^7Config '%s^7' loaded\"", level.config.name));
		}
	}
	else
	{
		trap_SetConfigstring(CS_CONFIGNAME, "");
		trap_SendServerCommand(-1, va("cp \"^7Config '%s^7' ^1FAILED ^7to load\"", name));
	}

	G_UpdateCvars();
}
Exemplo n.º 21
0
//===========================================================================
//
// Parameter:				-
// Returns:					-
// Changes Globals:		-
//===========================================================================
weightconfig_t *ReadWeightConfig(char *filename)
{
	int newindent, avail = 0, n;
	pc_token_t token;
	int source;
	fuzzyseperator_t *fs;
	weightconfig_t *config = NULL;
	int starttime;

	starttime = trap_Milliseconds();

	if (!bot_reloadcharacters.integer)
	{
		avail = -1;
		for( n = 0; n < MAX_WEIGHT_FILES; n++ )
		{
			config = weightFileList[n];
			if( !config )
			{
				if( avail == -1 )
				{
					avail = n;
				} //end if
				continue;
			} //end if
			if( strcmp( filename, config->filename ) == 0 )
			{
				//BotAI_Print( PRT_MESSAGE, "retained %s\n", filename );
				return config;
			} //end if
		} //end for

		if( avail == -1 )
		{
			BotAI_Print( PRT_ERROR, "weightFileList was full trying to load %s\n", filename );
			return NULL;
		} //end if
	} //end if

	source = trap_PC_LoadSource(filename, BOTFILESBASEFOLDER);
	if (!source)
	{
		BotAI_Print(PRT_ERROR, "counldn't load %s\n", filename);
		return NULL;
	} //end if
	//
	config = (weightconfig_t *) trap_HeapMalloc(sizeof(weightconfig_t));
	config->numweights = 0;
	Q_strncpyz( config->filename, filename, sizeof(config->filename) );
	//parse the item config file
	while(trap_PC_ReadToken(source, &token))
	{
		if (!strcmp(token.string, "weight"))
		{
			if (config->numweights >= MAX_WEIGHTS)
			{
				PC_SourceWarning(source, "too many fuzzy weights");
				break;
			} //end if
			if (!PC_ExpectTokenType(source, TT_STRING, 0, &token))
			{
				FreeWeightConfig(config);
				trap_PC_FreeSource(source);
				return NULL;
			} //end if
			config->weights[config->numweights].name = (char *) trap_HeapMalloc(strlen(token.string) + 1);
			strcpy(config->weights[config->numweights].name, token.string);
			if (!PC_ExpectAnyToken(source, &token))
			{
				FreeWeightConfig(config);
				trap_PC_FreeSource(source);
				return NULL;
			} //end if
			newindent = qfalse;
			if (!strcmp(token.string, "{"))
			{
				newindent = qtrue;
				if (!PC_ExpectAnyToken(source, &token))
				{
					FreeWeightConfig(config);
					trap_PC_FreeSource(source);
					return NULL;
				} //end if
			} //end if
			if (!strcmp(token.string, "switch"))
			{
				fs = ReadFuzzySeperators_r(source);
				if (!fs)
				{
					FreeWeightConfig(config);
					trap_PC_FreeSource(source);
					return NULL;
				} //end if
				config->weights[config->numweights].firstseperator = fs;
			} //end if
			else if (!strcmp(token.string, "return"))
			{
				fs = (fuzzyseperator_t *) trap_HeapMalloc(sizeof(fuzzyseperator_t));
				fs->index = 0;
				fs->value = MAX_INVENTORYVALUE;
				fs->next = NULL;
				fs->child = NULL;
				if (!ReadFuzzyWeight(source, fs))
				{
					trap_HeapFree(fs);
					FreeWeightConfig(config);
					trap_PC_FreeSource(source);
					return NULL;
				} //end if
				config->weights[config->numweights].firstseperator = fs;
			} //end else if
			else
			{
				PC_SourceError(source, "invalid name %s", token.string);
				FreeWeightConfig(config);
				trap_PC_FreeSource(source);
				return NULL;
			} //end else
			if (newindent)
			{
				if (!PC_ExpectTokenString(source, "}"))
				{
					FreeWeightConfig(config);
					trap_PC_FreeSource(source);
					return NULL;
				} //end if
			} //end if
			config->numweights++;
		} //end if
		else
		{
			PC_SourceError(source, "invalid name %s", token.string);
			FreeWeightConfig(config);
			trap_PC_FreeSource(source);
			return NULL;
		} //end else
	} //end while
	//free the source at the end of a pass
	trap_PC_FreeSource(source);
	//if the file was located in a pak file
	BotAI_Print(PRT_DEVELOPER, "loaded %s\n", filename);
	BotAI_Print(PRT_DEVELOPER, "weights loaded in %d msec\n", trap_Milliseconds() - starttime);
	//
	if (!bot_reloadcharacters.integer)
	{
		weightFileList[avail] = config;
	} //end if
	//
	return config;
} //end of the function ReadWeightConfig
Exemplo n.º 22
0
static void UI_LoadArenasFromFile(char *filename)
{
	int        handle;
	pc_token_t token;

	handle = trap_PC_LoadSource(filename);

	if (!handle)
	{
		trap_Print(va(S_COLOR_RED "file not found: %s\n", filename));
		return;
	}

	if (!trap_PC_ReadToken(handle, &token))
	{
		trap_PC_FreeSource(handle);
		return;
	}

	if (*token.string != '{')
	{
		trap_PC_FreeSource(handle);
		return;
	}

	uiInfo.mapList[uiInfo.mapCount].cinematic = -1;
	uiInfo.mapList[uiInfo.mapCount].levelShot = -1;
	uiInfo.mapList[uiInfo.mapCount].typeBits  = 0;

	while (trap_PC_ReadToken(handle, &token))
	{
		if (*token.string == '}')
		{

			if (!uiInfo.mapList[uiInfo.mapCount].typeBits)
			{
				uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF);
			}

			uiInfo.mapCount++;
			if (uiInfo.mapCount >= MAX_MAPS)
			{
				break;
			}

			if (!trap_PC_ReadToken(handle, &token))
			{
				// eof
				trap_PC_FreeSource(handle);
				return;
			}

			if (*token.string != '{')
			{
				trap_Print(va(S_COLOR_RED "unexpected token '%s' inside: %s\n", token.string, filename));
				trap_PC_FreeSource(handle);
				return;
			}
		}
		else if (!Q_stricmp(token.string, "map"))
		{
			if (!PC_String_Parse(handle, &uiInfo.mapList[uiInfo.mapCount].mapLoadName))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return;
			}
		}
		else if (!Q_stricmp(token.string, "longname"))
		{
			if (!PC_String_Parse(handle, &uiInfo.mapList[uiInfo.mapCount].mapName))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return;
			}
		}
		else if (!Q_stricmp(token.string, "briefing"))
		{
			if (!PC_String_Parse(handle, &uiInfo.mapList[uiInfo.mapCount].briefing))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return;
			}
		}
		else if (!Q_stricmp(token.string, "lmsbriefing"))
		{
			if (!PC_String_Parse(handle, &uiInfo.mapList[uiInfo.mapCount].lmsbriefing))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return;
			}
		}
		/*
		else if (!Q_stricmp(token.string, "objectives"))
		{
		    if (!PC_String_Parse(handle, &uiInfo.mapList[uiInfo.mapCount].objectives))
		    {
		        trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
		        trap_PC_FreeSource(handle);
		        return;
		    }
		}
		*/
		else if (!Q_stricmp(token.string, "timelimit"))
		{
			if (!PC_Int_Parse(handle, &uiInfo.mapList[uiInfo.mapCount].Timelimit))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return;
			}
		}
		else if (!Q_stricmp(token.string, "axisrespawntime"))
		{
			if (!PC_Int_Parse(handle, &uiInfo.mapList[uiInfo.mapCount].AxisRespawnTime))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return;
			}
		}
		else if (!Q_stricmp(token.string, "alliedrespawntime"))
		{
			if (!PC_Int_Parse(handle, &uiInfo.mapList[uiInfo.mapCount].AlliedRespawnTime))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return;
			}
		}
		else if (!Q_stricmp(token.string, "type"))
		{
			if (!trap_PC_ReadToken(handle, &token))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return;
			}
			else
			{
				if (strstr(token.string, "wolfsp"))
				{
					uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_SINGLE_PLAYER);
				}
				if (strstr(token.string, "wolflms"))
				{
					uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF_LMS);
				}
				if (strstr(token.string, "wolfmp"))
				{
					uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF);
				}
				if (strstr(token.string, "wolfsw"))
				{
					uiInfo.mapList[uiInfo.mapCount].typeBits |= (1 << GT_WOLF_STOPWATCH);
				}
			}
		}
		else if (!Q_stricmp(token.string, "mapposition_x"))
		{
			if (!PC_Float_Parse(handle, &uiInfo.mapList[uiInfo.mapCount].mappos[0]))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return;
			}
		}
		else if (!Q_stricmp(token.string, "mapposition_y"))
		{
			if (!PC_Float_Parse(handle, &uiInfo.mapList[uiInfo.mapCount].mappos[1]))
			{
				trap_Print(va(S_COLOR_RED "unexpected end of file inside: %s\n", filename));
				trap_PC_FreeSource(handle);
				return;
			}
		}
	}

	trap_PC_FreeSource(handle);
	return;
}