Exemple #1
0
// =====================================================================================
//  GetUsedWads
//      parse the "wad" keyvalue into wadpath_t structs
// =====================================================================================
void        GetUsedWads()
{
    const char* pszWadPaths;
    char        szTmp[_MAX_PATH];
    int         i, j;

    pszWadPaths = ValueForKey(&g_entities[0], "wad");

    for(i = 0; i < MAX_WADPATHS; i++)
    {
        memset(szTmp, 0, sizeof(szTmp));    // are you happy zipster?
        for (j = 0; j < _MAX_PATH; j++, pszWadPaths++)
        {
            if (pszWadPaths[0] == ';')
            {
                pszWadPaths++;
                PushWadPath(szTmp, true);
                break;
            }

            if (pszWadPaths[0] == 0)
            {
                PushWadPath(szTmp, true); // fix by AmericanRPG for last wadpath ignorance bug
                return;
            }

            szTmp[j] = pszWadPaths[0];
        }
    }
}
Exemple #2
0
// =====================================================================================
//  GetUsedWads
//      parse the "wad" keyvalue into wadpath_t structs
// =====================================================================================
void        GetUsedWads()
{
    const char* pszWadPaths;
    char        szTmp[_MAX_PATH];
    int         i, j;

    pszWadPaths = ValueForKey(&g_entities[0], "wad");

#ifdef HLCSG_AUTOWAD_NEW
	for (i = 0; ; )
	{
		for (j = i; pszWadPaths[j] != '\0'; j++)
		{
			if (pszWadPaths[j] == ';')
			{
				break;
			}
		}
		if (j - i > 0)
		{
			int count = qmin (j - i, _MAX_PATH - 1);
			memcpy (szTmp, &pszWadPaths[i], count);
			szTmp[count] = '\0';

			if (g_iNumWadPaths >= MAX_WADPATHS)
			{
				Error ("Too many wad files");
			}
			PushWadPath (szTmp, true);
		}
		if (pszWadPaths[j] == '\0')
		{
			break;
		}
		else
		{
			i = j + 1;
		}
	}
#else
    for(i = 0; i < MAX_WADPATHS; i++)
    {
        memset(szTmp, 0, sizeof(szTmp));    // are you happy zipster?
        for (j = 0; j < _MAX_PATH; j++, pszWadPaths++)
        {
            if (pszWadPaths[0] == ';')
            {
                pszWadPaths++;
                PushWadPath(szTmp, true);
                break;
            }

            if (pszWadPaths[0] == 0)
            {
                PushWadPath(szTmp, true); // fix by AmericanRPG for last wadpath ignorance bug
                return;
            }

            szTmp[j] = pszWadPaths[0];
        }
    }
#endif
}
Exemple #3
0
// =====================================================================================
//  ProcessWadConfiguration
// =====================================================================================
void        ProcessWadConfiguration()
{
    int             usedwads = 0;
    char            szTmp[1024]; // arbitrary, but needs to be large. probably bigger than this.
    wadconfig_t*    config;
    wadname_t*      path;

    if(!g_bWadConfigsLoaded) // we did a graceful exit due to some warning/error, so dont complain about it
    {
        Log("Using mapfile wad configuration\n");
        return;
    }

    szTmp[0] = 0;
    config = g_WadCfg;

    if (!wadconfigname)
        return; // this should never happen

    if (!config)
    {
        Warning("No configurations detected in wad.cfg\n"
                "using map wad configuration");
        return;
    }

    while (1)
    {
        if (!strcmp(config->name, wadconfigname))
        {
            path = config->firstentry;
            while (1)
            {
                if (!path)
                    break;

                Verbose("Wadpath from wad.cfg: '%s'\n", path->wadname);
                PushWadPath(path->wadname, true);
                safe_snprintf(szTmp, 1024, "%s%s;", szTmp, path->wadname);
                usedwads++;

                if (path->wadinclude)
                    g_WadInclude.push_back(path->wadname);

                // next path
                path = path->next;
            }
            break;  // the user can only specify one wad configuration, were done here
        }

        // next config
        config = config->next;
        if (!config)
            break;
    }
    
    if (usedwads)
    {
        Log("Using custom wadfile configuration: '%s' (with %i wad%s)\n", wadconfigname, usedwads, usedwads > 1 ? "s" : "");
        SetKeyValue(&g_entities[0], "wad", szTmp);
        SetKeyValue(&g_entities[0], "_wad", szTmp);    
    }
    else
    {
        Warning("no wadfiles are specified in configuration '%s' --\n"
                "Using map wadfile configuration", wadconfigname);
        g_bWadConfigsLoaded = false;
    }

    return;
}