Beispiel #1
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();
        }
Beispiel #2
0
        public DoomMenu(Doom doom)
        {
            this.doom = doom;

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

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

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

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

            quitConfirm = new QuitConfirm(
                this,
                doom);

            skillMenu = new SelectableMenu(
                this,
                "M_NEWG", 96, 14,
                "M_SKILL", 54, 38,
                2,

                new SimpleMenuItem(
                    "M_JKILL", 16, 58, 48, 63,
                    () => doom.NewGame(GameSkill.Baby, selectedEpisode, 1),
                    null),

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

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

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

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

            if (doom.Options.GameMode == GameMode.Retail)
            {
                episodeMenu = new SelectableMenu(
                    this,
                    "M_EPISOD", 54, 38,
                    0,

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

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

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

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

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

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

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

                        new SimpleMenuItem(
                            "M_EPI1", 16, 58, 48, 63,
                            () => selectedEpisode = 1,
                            skillMenu),
                        new SimpleMenuItem(
                            "M_EPI2", 16, 74, 48, 79,
                            () => selectedEpisode = 2,
                            skillMenu),
                        new SimpleMenuItem(
                            "M_EPI3", 16, 90, 48, 95,
                            () => selectedEpisode = 3,
                            skillMenu));
                }
            }

            var sound = doom.Options.Sound;
            var music = doom.Options.Music;

            volume = new SelectableMenu(
                this,
                "M_SVOL", 60, 38,
                0,

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

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

            var video     = doom.Options.Video;
            var userInput = doom.Options.UserInput;

            optionMenu = new SelectableMenu(
                this,
                "M_OPTTTL", 108, 15,
                0,

                new SimpleMenuItem(
                    "M_ENDGAM", 28, 32, 60, 37,
                    null,
                    endGameConfirm,
                    () => doom.State == DoomState.Game),

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

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

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

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

            load = new LoadMenu(
                this,
                "M_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,
                "M_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 (doom.Options.GameMode == GameMode.Commercial)
            {
                main = new SelectableMenu(
                    this,
                    "M_DOOM", 94, 2,
                    0,
                    new SimpleMenuItem("M_NGAME", 65, 67, 97, 72, null, skillMenu),
                    new SimpleMenuItem("M_OPTION", 65, 83, 97, 88, null, optionMenu),
                    new SimpleMenuItem("M_LOADG", 65, 99, 97, 104, null, load),
                    new SimpleMenuItem("M_SAVEG", 65, 115, 97, 120, null, save,
                                       () => !(doom.State == DoomState.Game &&
                                               doom.Game.State != GameState.Level)),
                    new SimpleMenuItem("M_QUITG", 65, 131, 97, 136, null, quitConfirm));
            }
            else
            {
                main = new SelectableMenu(
                    this,
                    "M_DOOM", 94, 2,
                    0,
                    new SimpleMenuItem("M_NGAME", 65, 59, 97, 64, null, episodeMenu),
                    new SimpleMenuItem("M_OPTION", 65, 75, 97, 80, null, optionMenu),
                    new SimpleMenuItem("M_LOADG", 65, 91, 97, 96, null, load),
                    new SimpleMenuItem("M_SAVEG", 65, 107, 97, 112, null, save,
                                       () => !(doom.State == DoomState.Game &&
                                               doom.Game.State != GameState.Level)),
                    new SimpleMenuItem("M_RDTHIS", 65, 123, 97, 128, null, help),
                    new SimpleMenuItem("M_QUITG", 65, 139, 97, 144, null, quitConfirm));
            }

            current = main;
            active  = false;

            tics = 0;

            selectedEpisode = 1;

            saveSlots = new SaveSlots();
        }