public MiswGame2007Application()
        {
            {
                FileArchiverZip zip = new FileArchiverZip();
                zip.ZipExtName = ".btw";
                FileSys.Archiver.Add(zip);
            }
            UnmanagedResourceManager.Instance.VideoMemory.LimitSize = 64 * 1024 * 1024;
            settings = new Settings("settings.cfg");
            CreateWindow(settings.Fullscreen);
            inputDevice    = new InputDevice(!settings.Fullscreen, settings.JumpButton, settings.AttackButton, settings.StartButton);
            graphicsDevice = new GraphicsDevice(window);
            audioDevice    = new AudioDevice();
            LoadStageData();

            title             = new TitleScene(0, settings.ArcadeMode);
            title.AudioDevice = audioDevice;
            currentState      = State.Title;
            currentStageIndex = settings.StartStageIndex;
            if (settings.StartStageIndex < settings.NumUnlockedStages)
            {
                numUnlockedStages = settings.NumUnlockedStages;
            }
            else
            {
                numUnlockedStages = settings.StartStageIndex + 1;
            }

            if (numUnlockedStages < 25)
            {
                numUnlockedStages = 25;
            }

            log = null;
            if (settings.ArcadeMode)
            {
                for (int i = 1; i <= 9999; i++)
                {
                    if (!File.Exists("log" + (10000 + i).ToString().Substring(1) + ".txt"))
                    {
                        log = new StreamWriter("log" + (10000 + i).ToString().Substring(1) + ".txt");
                        break;
                    }
                }
            }
        }
Example #2
0
        public MiswGame2007Application()
        {
            {
                FileArchiverZip zip = new FileArchiverZip();
                zip.ZipExtName = ".btw";
                FileSys.Archiver.Add(zip);
            }
            UnmanagedResourceManager.Instance.VideoMemory.LimitSize = 64 * 1024 * 1024;
            settings = new Settings("settings.cfg");
            CreateWindow(settings.Fullscreen);
            inputDevice = new InputDevice(!settings.Fullscreen, settings.JumpButton, settings.AttackButton, settings.StartButton);
            graphicsDevice = new GraphicsDevice(window);
            audioDevice = new AudioDevice();
            LoadStageData();

            title = new TitleScene(0, settings.ArcadeMode);
            title.AudioDevice = audioDevice;
            currentState = State.Title;
            currentStageIndex = settings.StartStageIndex;
            if (settings.StartStageIndex < settings.NumUnlockedStages)
            {
                numUnlockedStages = settings.NumUnlockedStages;
            }
            else
            {
                numUnlockedStages = settings.StartStageIndex + 1;
            }

            if (numUnlockedStages < 25)
            {
                numUnlockedStages = 25;
            }

            log = null;
            if (settings.ArcadeMode)
            {
                for (int i = 1; i <= 9999; i++)
                {
                    if (!File.Exists("log" + (10000 + i).ToString().Substring(1) + ".txt"))
                    {
                        log = new StreamWriter("log" + (10000 + i).ToString().Substring(1) + ".txt");
                        break;
                    }
                }
            }
        }
        public bool Tick()
        {
            switch (currentState)
            {
            case State.Title:
                title.Tick(inputDevice.CurrentTitleInput);
                if (title.CurrentState == TitleScene.State.StageSelect)
                {
                    currentState            = State.StageSelect;
                    stageSelect             = new StageSelectScene(numUnlockedStages, currentStageIndex);
                    stageSelect.AudioDevice = audioDevice;
                    return(true);
                }
                else if (title.CurrentState == TitleScene.State.GotoGame)
                {
                    title                   = null;
                    currentState            = State.Game;
                    currentStageIndex       = settings.StartStageIndex;
                    currentGame             = CreateGameScene(currentStageIndex);
                    currentGame.AudioDevice = audioDevice;
                    WriteLog("NewGame");
                    return(true);
                }
                else if (title.CurrentState == TitleScene.State.Exit)
                {
                    currentState = State.Exit;
                }
                break;

            case State.StageSelect:
                stageSelect.Tick(inputDevice.CurrentStageSelectInput);
                title.Tick(TitleInput.Empty);
                if (stageSelect.CurrentState == StageSelectScene.State.GotoGame)
                {
                    currentState            = State.Game;
                    currentStageIndex       = stageSelect.SelectedStage;
                    currentGame             = CreateGameScene(currentStageIndex);
                    currentGame.AudioDevice = audioDevice;
                    WriteLog("Continue (Stage " + (currentStageIndex + 1) + ")");
                    return(true);
                }
                else if (stageSelect.CurrentState == StageSelectScene.State.Exit)
                {
                    stageSelect  = null;
                    currentState = State.Title;
                    title.StageSelectExited();
                }
                break;

            case State.Game:
                if (inputDevice.DebugKey)
                {
                    currentGame.DebugMode = true;
                }
                currentGame.Tick(inputDevice.CurrentGameInput);
                if (currentGame.CurrentState == GameScene.State.Clear)
                {
                    if (currentStageIndex == NUM_STAGES - 1)
                    {
                        currentGame        = null;
                        currentState       = State.Ending;
                        ending             = new EndingScene();
                        ending.AudioDevice = audioDevice;
                        return(true);
                    }
                    currentStageIndex       = (currentStageIndex + 1) % NUM_STAGES;
                    currentGame             = CreateGameScene(currentStageIndex, currentGame.Player.State);
                    currentGame.AudioDevice = audioDevice;
                    if (numUnlockedStages < currentStageIndex + 1)
                    {
                        numUnlockedStages = currentStageIndex + 1;
                    }
                    return(true);
                }
                else if (currentGame.CurrentState == GameScene.State.Gameover)
                {
                    currentGame       = null;
                    currentState      = State.Title;
                    title             = new TitleScene(1, settings.ArcadeMode);
                    title.AudioDevice = audioDevice;
                    return(true);
                }
                break;

            case State.Ending:
                ending.Tick(inputDevice.CurrentEndingInput);
                if (ending.CurrentState == EndingScene.State.Exit)
                {
                    ending            = null;
                    currentState      = State.Title;
                    title             = new TitleScene(1, settings.ArcadeMode);
                    title.AudioDevice = audioDevice;
                    return(true);
                }
                break;
            }
            return(false);
        }
Example #4
0
 public bool Tick()
 {
     switch (currentState)
     {
         case State.Title:
             title.Tick(inputDevice.CurrentTitleInput);
             if (title.CurrentState == TitleScene.State.StageSelect)
             {
                 currentState = State.StageSelect;
                 stageSelect = new StageSelectScene(numUnlockedStages, currentStageIndex);
                 stageSelect.AudioDevice = audioDevice;
                 return true;
             }
             else if (title.CurrentState == TitleScene.State.GotoGame)
             {
                 title = null;
                 currentState = State.Game;
                 currentStageIndex = settings.StartStageIndex;
                 currentGame = CreateGameScene(currentStageIndex);
                 currentGame.AudioDevice = audioDevice;
                 WriteLog("NewGame");
                 return true;
             }
             else if (title.CurrentState == TitleScene.State.Exit)
             {
                 currentState = State.Exit;
             }
             break;
         case State.StageSelect:
             stageSelect.Tick(inputDevice.CurrentStageSelectInput);
             title.Tick(TitleInput.Empty);
             if (stageSelect.CurrentState == StageSelectScene.State.GotoGame)
             {
                 currentState = State.Game;
                 currentStageIndex = stageSelect.SelectedStage;
                 currentGame = CreateGameScene(currentStageIndex);
                 currentGame.AudioDevice = audioDevice;
                 WriteLog("Continue (Stage " + (currentStageIndex + 1) + ")");
                 return true;
             }
             else if (stageSelect.CurrentState == StageSelectScene.State.Exit)
             {
                 stageSelect = null;
                 currentState = State.Title;
                 title.StageSelectExited();
             }
             break;
         case State.Game:
             if (inputDevice.DebugKey)
             {
                 currentGame.DebugMode = true;
             }
             currentGame.Tick(inputDevice.CurrentGameInput);
             if (currentGame.CurrentState == GameScene.State.Clear)
             {
                 if (currentStageIndex == NUM_STAGES - 1)
                 {
                     currentGame = null;
                     currentState = State.Ending;
                     ending = new EndingScene();
                     ending.AudioDevice = audioDevice;
                     return true;
                 }
                 currentStageIndex = (currentStageIndex + 1) % NUM_STAGES;
                 currentGame = CreateGameScene(currentStageIndex, currentGame.Player.State);
                 currentGame.AudioDevice = audioDevice;
                 if (numUnlockedStages < currentStageIndex + 1)
                 {
                     numUnlockedStages = currentStageIndex + 1;
                 }
                 return true;
             }
             else if (currentGame.CurrentState == GameScene.State.Gameover)
             {
                 currentGame = null;
                 currentState = State.Title;
                 title = new TitleScene(1, settings.ArcadeMode);
                 title.AudioDevice = audioDevice;
                 return true;
             }
             break;
         case State.Ending:
             ending.Tick(inputDevice.CurrentEndingInput);
             if (ending.CurrentState == EndingScene.State.Exit)
             {
                 ending = null;
                 currentState = State.Title;
                 title = new TitleScene(1, settings.ArcadeMode);
                 title.AudioDevice = audioDevice;
                 return true;
             }
             break;
     }
     return false;
 }