Exemplo n.º 1
0
//
// D_DoDefDehackedPatch
//
// [Russell] - Change the meaning, this will load multiple patch files if
//             specified
void D_DoDefDehackedPatch (const std::vector<std::string> patch_files = std::vector<std::string>())
{
    DArgs files;
    BOOL noDef = false;
    QWORD i;

    if (!patch_files.empty())
    {
        std::string f;
        std::string ext;

        // we want the extension of the file
        for (i = 0; i < patch_files.size(); i++)
        {
            if (M_ExtractFileExtension(patch_files[i], ext))
            {
                f = BaseFileSearch (patch_files[i], ext);

                if (f.length())
                {
                    if (DoDehPatch (f.c_str(), false))
                    {
                        std::string Filename;

                        M_ExtractFileName(f, Filename);

                        patchfiles.push_back(Filename);
                    }

                    noDef = true;
                }
            }
        }
    }
    else // [Russell] - Only load if patch_files is empty
    {
        // try .deh files on command line

        files = Args.GatherFiles ("-deh", ".deh", false);

        if (files.NumArgs())
        {
            for (i = 0; i < files.NumArgs(); i++)
            {
                std::string f = BaseFileSearch (files.GetArg (i), ".DEH");

                if (f.length())
                {
                    if (DoDehPatch (f.c_str(), false))
                    {
                        std::string Filename;

                        M_ExtractFileName(f, Filename);

                        patchfiles.push_back(Filename);
                    }
                }
            }
            noDef = true;
        }

        // remove the old arguments
        files.FlushArgs();

        // try .bex files on command line
        files = Args.GatherFiles ("-bex", ".bex", false);

        if (files.NumArgs())
        {
            for (i = 0; i < files.NumArgs(); i++)
            {
                std::string f = BaseFileSearch (files.GetArg (i), ".BEX");

                if (f.length())
                {
                    if (DoDehPatch (f.c_str(), false))
                    {
                        std::string Filename;

                        M_ExtractFileName(f, Filename);

                        patchfiles.push_back(Filename);
                    }
                }
            }
            noDef = true;
        }
    }

    // try default patches
    if (!noDef)
        DoDehPatch (NULL, true);	// See if there's a patch in a PWAD
}
Exemplo n.º 2
0
//
// D_DoDefDehackedPatch
//
// [Russell] - Change the meaning, this will load multiple patch files if
//             specified
void D_DoDefDehackedPatch (const std::vector<std::string> patch_files = std::vector<std::string>())
{
    DArgs files;
    BOOL noDef = false;
    BOOL chexLoaded = false;
    QWORD i;

    if (!patch_files.empty())
    {
        std::string f;
        std::string ext;

        // we want the extension of the file
        for (i = 0; i < patch_files.size(); i++)
        {
            if (M_ExtractFileExtension(patch_files[i], ext))
            {
                f = BaseFileSearch (patch_files[i], ext);

                if (f.length())
                {
                    DoDehPatch (f.c_str(), false);

                    noDef = true;
                }
            }
        }
    }
    else // [Russell] - Only load if patch_files is empty
    {
        // try .deh files on command line

        files = Args.GatherFiles ("-deh", ".deh", false);

        if (files.NumArgs())
        {
            for (i = 0; i < files.NumArgs(); i++)
            {
                std::string f = BaseFileSearch (files.GetArg (i), ".DEH");

                if (f.length()) {
                    DoDehPatch (f.c_str(), false);
                    if (!strncmp(files.GetArg (i),"chex.deh",8))
                        chexLoaded = true;
                }
            }
            noDef = true;
        }

        if (gamemode == retail_chex && !multiplayer && !chexLoaded)
            Printf(PRINT_HIGH,"Warning: chex.deh not loaded, experience may differ from the original!\n");

        // remove the old arguments
        files.FlushArgs();

        // try .bex files on command line
        files = Args.GatherFiles ("-bex", ".bex", false);

        if (files.NumArgs())
        {
            for (i = 0; i < files.NumArgs(); i++)
            {
                std::string f = BaseFileSearch (files.GetArg (i), ".BEX");

                if (f.length())
                    DoDehPatch (f.c_str(), false);
            }
            noDef = true;
        }
    }

    // try default patches
    if (!noDef)
        DoDehPatch (NULL, true);	// See if there's a patch in a PWAD
}