예제 #1
0
        private void LoadBaseHog(string filename)
        {
            editor.SetDescentGame(0);
            betterEditor?.SetDescentGame(0);

            baseHogLabel.Text = "No Descent HOG file specified";
            baseHog           = null;
            try
            {
                baseHog = new HOGFile(baseHogFile = filename);
            }
            catch (ArgumentException aex)
            {
                MessageBox.Show(this, aex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            baseHogLabel.Text = "No Descent HOG file specified";
            if (!baseHog.ContainsFile("descent.txb") || !baseHog.ContainsFile("end01.pcx"))
            {
                MessageBox.Show(this, "This is not a valid registered Descent 1 or Descent 2 main HOG", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                baseHog = null;
                return;
            }

            if (baseHog.ContainsFile("neptun01.pcx"))
            {
                descentGame       = 1;
                baseHogLabel.Text = "Main HOG: Descent 1";
            }
            else if (baseHog.ContainsFile("d2levf-s.rl2"))
            {
                descentGame       = 2;
                baseHogLabel.Text = "Main HOG: Descent 2";
            }
            else
            {
                MessageBox.Show(this, "This is not a valid registered Descent 1 or Descent 2 main HOG", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                baseHog = null;
                return;
            }

            byte[] font3_1 = baseHog.GetLumpData("FONT3-1.FNT");
            if (font3_1 == null)
            {
                MessageBox.Show(this, "FONT3-1.FNT not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                baseHog = null;
                return;
            }

            FNTRenderer gamefontL, gamefontH = null;

            gamefontL = new FNTRenderer(LoadFont(new MemoryStream(font3_1)));

            if (descentGame == 1)
            {
                gamefontH = new FNTRendererUpScale(gamefontL.font);
            }
            else if (descentGame == 2)
            {
                font3_1 = baseHog.GetLumpData("FONT3-1H.FNT");
                if (font3_1 == null)
                {
                    MessageBox.Show(this, "FONT3-1H.FNT not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    baseHog = null;
                    return;
                }
                gamefontH = new FNTRenderer(LoadFont(new MemoryStream(font3_1)));
            }

            InitScreens(gamefontL, gamefontH);
            lowres.Refresh();
            highres.Refresh();
            editor.SetDescentGame(descentGame);
            betterEditor?.SetDescentGame(descentGame);
            Properties.Settings.Default.baseHogPath = filename;
            Properties.Settings.Default.Save();
        }
예제 #2
0
 public bool Exists()
 {
     return(hog.ContainsFile(this.fileName));
 }