示例#1
0
 static void Main(string[] args)
 {
     using (var app = new DoomApplication())
     {
         app.Run();
     }
 }
示例#2
0
        public static void Main(string[] args)
        {
            Console.ForegroundColor = ConsoleColor.White;
            Console.BackgroundColor = ConsoleColor.DarkGreen;
            Console.WriteLine(ApplicationInfo.Title);
            Console.ResetColor();

            try
            {
                string quitMessage = null;

                using (var app = new DoomApplication(new CommandLineArgs(args)))
                {
                    app.Run();
                    quitMessage = app.QuitMessage;
                }

                if (quitMessage != null)
                {
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine(quitMessage);
                    Console.ResetColor();
                    Console.Write("Press any key to exit.");
                    Console.ReadKey();
                }
            }
            catch (Exception e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(e);
                Console.ResetColor();
                Console.Write("Press any key to exit.");
                Console.ReadKey();
            }
        }
示例#3
0
        public DoomMenu(DoomApplication app)
        {
            this.app = app;
            options  = app.Options;

            thisIsShareware = new PressAnyKey(
                this,
                DoomInfo.Strings.SWSTRING,
                null);

            saveFailed = new PressAnyKey(
                this,
                DoomInfo.Strings.SAVEDEAD,
                null);

            nightmareConfirm = new YesNoConfirm(
                this,
                DoomInfo.Strings.NIGHTMARE,
                () => app.NewGame(GameSkill.Nightmare, selectedEpisode, 1));

            endGameConfirm = new YesNoConfirm(
                this,
                DoomInfo.Strings.ENDGAME,
                () => app.EndGame());

            quitConfirm = new QuitConfirm(
                this,
                app);

            skillMenu = new SelectableMenu(
                this,
                "NEW GAME", 110, 56,
                "SKILL", 38, 30,
                2,
                true,
                new SimpleMenuItem(
                    "SKILL", 16, 58, 48, 63,
                    () => app.NewGame(GameSkill.Baby, selectedEpisode, 1),
                    null),

                new SimpleMenuItem(
                    "ROUGH", 16, 74, 48, 79,
                    () => app.NewGame(GameSkill.Easy, selectedEpisode, 1),
                    null),

                new SimpleMenuItem(
                    "HURT", 16, 90, 48, 95,
                    () => app.NewGame(GameSkill.Medium, selectedEpisode, 1),
                    null),

                new SimpleMenuItem(
                    "ULTRA", 16, 106, 48, 111,
                    () => app.NewGame(GameSkill.Hard, selectedEpisode, 1),
                    null),

                new SimpleMenuItem(
                    "NMARE", 16, 122, 48, 127,
                    null,
                    nightmareConfirm));

            if (app.Options.GameMode == GameMode.Retail)
            {
                episodeMenu = new SelectableMenu(
                    this,
                    "EPISODES", 54, 38,
                    0,
                    true,

                    new SimpleMenuItem(
                        "EPI1", 16, 58, 48, 63,
                        () => selectedEpisode = 1,
                        skillMenu),

                    new SimpleMenuItem(
                        "EPI2", 16, 74, 48, 79,
                        () => selectedEpisode = 2,
                        skillMenu),

                    new SimpleMenuItem(
                        "EPI3", 16, 90, 48, 95,
                        () => selectedEpisode = 3,
                        skillMenu),

                    new SimpleMenuItem(
                        "EPI4", 16, 106, 48, 111,
                        () => selectedEpisode = 4,
                        skillMenu));
            }
            else
            {
                if (app.Options.GameMode == GameMode.Shareware)
                {
                    episodeMenu = new SelectableMenu(
                        this,
                        "EPISOD", 54, 38,
                        0,
                        true,

                        new SimpleMenuItem(
                            "EPI1", 16, 58, 48, 63,
                            () => selectedEpisode = 1,
                            skillMenu),

                        new SimpleMenuItem(
                            "EPI2", 16, 74, 48, 79,
                            null,
                            thisIsShareware),

                        new SimpleMenuItem(
                            "EPI3", 16, 90, 48, 95,
                            null,
                            thisIsShareware));
                }
                else
                {
                    episodeMenu = new SelectableMenu(
                        this,
                        "EPISODES", 54, 38,
                        0,
                        true,

                        new SimpleMenuItem(
                            "EPI1", 16, 58, 48, 63,
                            () => selectedEpisode = 1,
                            skillMenu),
                        new SimpleMenuItem(
                            "EPI2", 16, 74, 48, 79,
                            () => selectedEpisode = 2,
                            skillMenu),
                        new SimpleMenuItem(
                            "EPI3", 16, 90, 48, 95,
                            () => selectedEpisode = 3,
                            skillMenu));
                }
            }

            var sound = options.Sound;
            var music = options.Music;

            volume = new SelectableMenu(
                this,
                "SVOL", 60, 38,
                0,
                true,

                new SliderMenuItem(
                    "SFXVOL", 48, 59, 80, 64,
                    sound.MaxVolume + 1,
                    () => sound.Volume,
                    vol => sound.Volume = vol),

                new SliderMenuItem("MUSVOL", 48, 91, 80, 96,
                                   music.MaxVolume + 1,
                                   () => music.Volume,
                                   vol => music.Volume = vol));

            var renderer  = options.Renderer;
            var userInput = options.UserInput;

            optionMenu = new SelectableMenu(
                this,
                "OPTTTL", 108, 15,
                0,
                true,

                new SimpleMenuItem(
                    "ENDGAM", 28, 32, 60, 37,
                    null,
                    endGameConfirm,
                    () => app.State == ApplicationState.Game),

                new ToggleMenuItem(
                    "MESSG", 28, 48, 60, 53, "M_MSGON", "M_MSGOFF", 180,
                    () => renderer.DisplayMessage ? 0 : 1,
                    value => renderer.DisplayMessage = value == 0),

                new SliderMenuItem(
                    "SCRNSZ", 28, 80 - 16, 60, 85 - 16,
                    renderer.MaxWindowSize + 1,
                    () => renderer.WindowSize,
                    size => renderer.WindowSize = size),

                new SliderMenuItem(
                    "MSENS", 28, 112 - 16, 60, 117 - 16,
                    userInput.MaxMouseSensitivity + 1,
                    () => userInput.MouseSensitivity,
                    ms => userInput.MouseSensitivity = ms),

                new SimpleMenuItem(
                    "SVOL", 28, 144 - 16, 60, 149 - 16,
                    null,
                    volume));

            load = new LoadMenu(
                this,
                "LOADG", 72, 28,
                0,
                new TextBoxMenuItem(48, 49, 72, 61),
                new TextBoxMenuItem(48, 65, 72, 77),
                new TextBoxMenuItem(48, 81, 72, 93),
                new TextBoxMenuItem(48, 97, 72, 109),
                new TextBoxMenuItem(48, 113, 72, 125),
                new TextBoxMenuItem(48, 129, 72, 141));

            save = new SaveMenu(
                this,
                "SAVEG", 72, 28,
                0,
                new TextBoxMenuItem(48, 49, 72, 61),
                new TextBoxMenuItem(48, 65, 72, 77),
                new TextBoxMenuItem(48, 81, 72, 93),
                new TextBoxMenuItem(48, 97, 72, 109),
                new TextBoxMenuItem(48, 113, 72, 125),
                new TextBoxMenuItem(48, 129, 72, 141));

            help = new HelpScreen(this);

            if (app.Options.GameMode == GameMode.Commercial)
            {
                main = new SelectableMenu(
                    this,
                    "M_HTIC", 80, 0,
                    0,
                    false,
                    new SimpleMenuItem("NEW GAME", 65, 67, 120, 80, null, skillMenu),
                    new SimpleMenuItem("OPTIONS", 65, 83, 97, 88, null, optionMenu),
                    new SimpleMenuItem("LOAD GAME", 65, 99, 97, 104, null, load),
                    new SimpleMenuItem("SAVE GAME", 65, 115, 97, 120, null, save,
                                       () => !(app.State == ApplicationState.Game &&
                                               app.Game.State != GameState.Level)),
                    new SimpleMenuItem("QUIT GAME", 65, 131, 97, 136, null, quitConfirm));
            }
            else
            {
                main = new SelectableMenu(
                    this,
                    "M_HTIC", 80, 0,
                    0,
                    false,
                    new SimpleMenuItem("NEW GAME", 70, 60, 100, 70, null, episodeMenu),
                    new SimpleMenuItem("OPTIONS", 70, 80, 100, 90, null, optionMenu),
                    new SimpleMenuItem("LOAD GAME", 70, 100, 100, 110, null, load),
                    new SimpleMenuItem("SAVE GAME", 70, 120, 100, 130, null, save,
                                       () => !(app.State == ApplicationState.Game &&
                                               app.Game.State != GameState.Level)),
                    new SimpleMenuItem("INFO", 70, 140, 100, 150, null, help),
                    new SimpleMenuItem("QUIT GAME", 70, 160, 100, 170, null, quitConfirm));
            }

            current = main;
            active  = false;

            tics = 0;

            selectedEpisode = 1;

            saveSlots = new SaveSlots();
        }
示例#4
0
        public DoomMenu(DoomApplication app)
        {
            this.app = app;

            skill = new MenuDef(
                this,
                "M_NEWG", 96, 14,
                "M_SKILL", 54, 38,
                2,
                new SimpleMenuItem("M_JKILL", 16, 58, 48, 63, () => app.NewGame(), null),
                new SimpleMenuItem("M_ROUGH", 16, 74, 48, 79, () => app.NewGame(), null),
                new SimpleMenuItem("M_HURT", 16, 90, 48, 95, () => app.NewGame(), null),
                new SimpleMenuItem("M_ULTRA", 16, 106, 48, 111, () => app.NewGame(), null),
                new SimpleMenuItem("M_NMARE", 16, 122, 48, 127, () => app.NewGame(), null));

            volume = new MenuDef(
                this,
                "M_SVOL", 60, 38,
                0,
                new SliderMenuItem("M_SFXVOL", 48, 59, 80, 64, 16, 8),
                new SliderMenuItem("M_MUSVOL", 48, 91, 80, 96, 16, 8));

            options = new MenuDef(
                this,
                "M_OPTTTL", 108, 15,
                0,
                new SimpleMenuItem("M_ENDGAM", 28, 32, 60, 37, null, null),
                new ToggleMenuItem("M_MESSG", 28, 48, 60, 53, "M_MSGON", "M_MSGOFF", 180, 0),
                new SliderMenuItem("M_SCRNSZ", 28, 80 - 16, 60, 85 - 16, 9, 3),
                new SliderMenuItem("M_MSENS", 28, 112 - 16, 60, 117 - 16, 10, 3),
                new SimpleMenuItem("M_SVOL", 28, 144 - 16, 60, 149 - 16, null, volume));

            load = new MenuDef(
                this,
                "M_LOADG", 72, 28,
                0,
                new TextBoxMenuItem("TEST!!!", 48, 49, 72, 61),
                new TextBoxMenuItem("TEST!!!", 48, 65, 72, 77),
                new TextBoxMenuItem("TE ST!!!", 48, 81, 72, 93),
                new TextBoxMenuItem("TE  ST!!!", 48, 97, 72, 109),
                new TextBoxMenuItem("TEST!!!", 48, 113, 72, 125),
                new TextBoxMenuItem("TEST!!!", 48, 129, 72, 141));

            save = new MenuDef(
                this,
                "M_SAVEG", 72, 28,
                0,
                new TextBoxMenuItem("TEST!!!", 48, 49, 72, 61),
                new TextBoxMenuItem("TEST!!!", 48, 65, 72, 77),
                new TextBoxMenuItem("TE ST!!!", 48, 81, 72, 93),
                new TextBoxMenuItem("TE ST!!!", 48, 97, 72, 109),
                new TextBoxMenuItem("test???", 48, 113, 72, 125),
                new TextBoxMenuItem("testtest___", 48, 129, 72, 141));

            main = new MenuDef(
                this,
                "M_DOOM", 94, 2,
                0,
                new SimpleMenuItem("M_NGAME", 65, 67, 97, 72, null, skill),
                new SimpleMenuItem("M_OPTION", 65, 83, 97, 88, null, options),
                new SimpleMenuItem("M_LOADG", 65, 99, 97, 104, null, load),
                new SimpleMenuItem("M_SAVEG", 65, 115, 97, 120, null, save),
                new SimpleMenuItem("M_QUITG", 65, 131, 97, 136, null, null));

            current = main;
            active  = false;

            tics = 0;
        }
示例#5
0
 public QuitConfirm(DoomMenu menu, DoomApplication app) : base(menu)
 {
     this.app = app;
     random   = new DoomRandom(DateTime.Now.Millisecond);
     endCount = -1;
 }