Exemplo n.º 1
0
    void SetupWad(IwadInfo info, string path)
    {
        if (info.mapInfo != null)
        {
            mapinfo = MapInfoLump.Load(engineWad.GetLumpAsText(info.mapInfo), engineWad);
        }
        Debug.Log("Merging: " + path);
        engineWad.Merge(new WadFile(path));

        wad = engineWad;

        if (info.mapnameFormat == "MAP")
        {
            mapFormat = MapFormat.MAP;
        }
        if (info.mapnameFormat == "EM")
        {
            mapFormat = MapFormat.EM;
        }
        iwadSelector = false;

        for (int i = 0; i < args.pwads.Count; i++)
        {
            wad.Merge(args.pwads[i]);
        }

        if (info.multigen != null)
        {
            wad.multigen = new MultigenParser(engineWad.GetLumpAsText(info.multigen));
        }
        Locale.Load(wad.GetLumpAsText("LOCAL_EN"));
        ItemData.Load(wad.GetLumpAsText("DOOMITEM"));
        StartGame(info);
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        ParseArguments();

        if (args.soundfont == "")
        {
            midiEnabled = false;
        }

        if (midiEnabled)
        {
            if (File.Exists(args.soundfont))
            {
                midiPlayer = gameObject.AddComponent <MidiPlayer>();
                midiPlayer.LoadBank(new PatchBank(File.OpenRead(args.soundfont)));
            }
            else
            {
                Debug.LogError("No soundfont found, disabling midi");
            }
        }

        cheatCodes = new List <string>()
        {
            "idclev",
            "kill",
            "test"
        };

        engineWad = new WadFile("nasty.wad");
        SetupTitleCamera();
        mapinfo = MapInfoLump.Load(engineWad.GetLumpAsText("NMAPINFO"));


        IwadData iwadData = JsonUtility.FromJson <IwadData>(engineWad.GetLumpAsText("IWADS"));


        if (args.iwad == "")           // Run IWAD selection tool

        {
            foundIwads = new List <IwadInfo>();
            for (int i = 0; i < iwadData.iwads.Length; i++)
            {
                for (int j = 0; j < iwadData.iwads[i].filenames.Length; j++)
                {
                    if (System.IO.File.Exists(iwadData.iwads[i].filenames[j]))
                    {
                        foundIwads.Add(iwadData.iwads[i]);
                    }
                }
            }

            if (foundIwads.Count == 0)
            {
                Debug.LogError("Cannot find any iwads!");
            }
            if (foundIwads.Count > 1)
            {
                iwadSelector = true;
            }

            if (foundIwads.Count == 1)
            {
                SetupWad(foundIwads[0]);
            }
        }
        else
        {
            for (int i = 0; i < iwadData.iwads.Length; i++)
            {
                if (args.iwad == iwadData.iwads[i].filenames[0])
                {
                    SetupWad(iwadData.iwads[i]);
                    break;
                }
            }
        }
    }