Beispiel #1
0
        public void Perform()
        {
            if (this.Map.Find(out this.Player.X, out this.Player.Y, cell => cell.Script == "START") == false)
            {
                throw new DDError();
            }

            this.Player.Direction = int.Parse(this.Map.GetProperty("START_DIRECTION"));

            this.WallPicture       = DDCResource.GetPicture(this.Map.GetProperty("WALL_PICTURE"));
            this.GatePicture       = DDCResource.GetPicture(this.Map.GetProperty("GATE_PICTURE"));
            this.BackgroundPicture = DDCResource.GetPicture(this.Map.GetProperty("BACKGROUND_PICTURE"));

            this.Frame = 0;

            for (; ; this.Frame++)
            {
                if (1 <= DDInput.DIR_8.GetInput())
                {
                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout, true);
                        this.DrawDungeon();

                        DDEngine.EachFrame();
                    }
                    if (this.Map[this.Player.X, this.Player.Y].GetWall(this.Player.Direction).Kind == MapWall.Kind_e.WALL)
                    {
                        // 壁衝突 todo ???
                    }
                    else
                    {
                        switch (this.Player.Direction)
                        {
                        case 4: this.Player.X--; break;

                        case 6: this.Player.X++; break;

                        case 8: this.Player.Y--; break;

                        case 2: this.Player.Y++; break;

                        default:
                            throw null;                                     // never
                        }
                    }
                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout, false);
                        this.DrawDungeon();

                        DDEngine.EachFrame();
                    }
                }
                if (1 <= DDInput.DIR_4.GetInput())
                {
                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(scene.Rate);

                        DDEngine.EachFrame();
                    }
                    this.Player.Direction = Utilities.RotL(this.Player.Direction);

                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(-scene.RemainingRate);

                        DDEngine.EachFrame();
                    }
                }
                if (1 <= DDInput.DIR_6.GetInput())
                {
                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(-scene.Rate);

                        DDEngine.EachFrame();
                    }
                    this.Player.Direction = Utilities.RotR(this.Player.Direction);

                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(scene.RemainingRate);

                        DDEngine.EachFrame();
                    }
                }
                if (1 <= DDInput.DIR_2.GetInput())
                {
                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(-scene.Rate);

                        DDEngine.EachFrame();
                    }
                    this.Player.Direction = Utilities.RotR(this.Player.Direction);

                    foreach (DDScene scene in DDSceneUtils.Create(10))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(scene.RemainingRate * 2.0 - 1.0);

                        DDEngine.EachFrame();
                    }
                    this.Player.Direction = Utilities.RotR(this.Player.Direction);

                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(scene.RemainingRate);

                        DDEngine.EachFrame();
                    }
                }

                // Draw ...

                DungeonScreen.DrawFront(this.Layout);
                this.DrawDungeon();

                DDEngine.EachFrame();
            }
        }
Beispiel #2
0
        public void Perform()
        {
            if (Ground.I.UseWallTrans)
            {
                this.WallPicture = Ground.I.Picture.WallTrans;
            }
            else
            {
                this.WallPicture = Ground.I.Picture.Wall;
            }

            this.WallBackPicture   = Ground.I.Picture.WallTransBack;
            this.GatePicture       = Ground.I.Picture.Gate;
            this.BackgroundPicture = Ground.I.Picture.Background;

restart:
            this.Player.X         = this.Map.DungeonMap.StartPoint.X;
            this.Player.Y         = this.Map.DungeonMap.StartPoint.Y;
            this.Player.Direction = this.Map.DungeonMap.StartDirection;

            DDEngine.FreezeInput();
            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(30, -0.8);

            for (; ;)              // マップのプレビュー
            {
                if (DDInput.A.GetInput() == 1)
                {
                    break;
                }

                if (DDInput.B.GetInput() == 1)
                {
                    break;
                }

                if (DDInput.PAUSE.GetInput() == 1)
                {
                    break;
                }

                DungeonScreen.DrawFront(this.Layout);
                this.DrawDungeon();

                DDCurtain.EachFrame();

                this.DrawMap();

                DDPrint.SetPrint(DDConsts.Screen_W / 2 - 90, DDConsts.Screen_H - 16);
                DDPrint.Print("PRESS Z KEY TO START");

                DDEngine.EachFrame();
            }

            DDEngine.FreezeInput();
            Ground.I.Music.Maze.Play();
            DDCurtain.SetCurtain(30, 0.0);

            this.Frame = 0;

            for (; ; this.Frame++)
            {
                if (DDInput.PAUSE.GetInput() == 1)                 // ポーズ・メニュー画面
                {
                    Ground.I.SE.PauseEnter.Play();

                    DDEngine.FreezeInput();
                    DDCurtain.SetCurtain(30, -0.8);

                    const int ITEM_NUM    = 3;
                    int       selectIndex = 0;

                    for (; ;)
                    {
                        if (DDInput.PAUSE.GetInput() == 1)
                        {
                            break;
                        }

                        if (DDInput.DIR_2.IsPound())
                        {
                            selectIndex++;
                        }

                        if (DDInput.DIR_8.IsPound())
                        {
                            selectIndex--;
                        }

                        selectIndex += ITEM_NUM;
                        selectIndex %= ITEM_NUM;

                        if (DDInput.A.GetInput() == 1)
                        {
                            switch (selectIndex)
                            {
                            case 0:
                                Ground.I.SE.Restart.Play();
                                goto restart;

                            case 1:
                                Ground.I.SE.ReturnToTitle.Play();
                                goto endGame;

                            case 2:
                                goto endPauseMenu;

                            default:
                                throw null;                                         // never
                            }
                        }
                        if (DDInput.B.GetInput() == 1)
                        {
                            if (selectIndex == ITEM_NUM - 1)
                            {
                                goto endPauseMenu;
                            }

                            selectIndex = ITEM_NUM - 1;
                        }
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon();

                        DDCurtain.EachFrame();

                        DDDraw.SetBright(new I3Color(0, 0, 100));
                        DDDraw.SetAlpha(0.3);
                        DDDraw.DrawBegin(DDGround.GeneralResource.WhiteBox, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                        DDDraw.DrawSetSize(300, 200);
                        DDDraw.DrawEnd();
                        DDDraw.Reset();

                        DDPrint.SetPrint(380, 215, 50);

                        {
                            int c = 0;

                            DDPrint.PrintLine("[" + (selectIndex == c++ ? ">" : " ") + "] この迷路をやり直す");
                            DDPrint.PrintLine("[" + (selectIndex == c++ ? ">" : " ") + "] タイトルに戻る");
                            DDPrint.PrintLine("[" + (selectIndex == c++ ? ">" : " ") + "] 迷路に戻る");
                        }

                        DDEngine.EachFrame();
                    }
endPauseMenu:
                    DDCurtain.SetCurtain(30, 0.0);

                    Ground.I.SE.PauseLeave.Play();
                }

                if (1 <= DDInput.DIR_8.GetInput())
                {
                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout, true);
                        this.DrawDungeon();

                        DDEngine.EachFrame();
                    }
                    if (this.Map[this.Player.X, this.Player.Y].GetWall(this.Player.Direction).Kind == MapWall.Kind_e.WALL)
                    {
                        // 壁衝突

                        Ground.I.SE.Poka.Play();
                    }
                    else
                    {
                        switch (this.Player.Direction)
                        {
                        case 4: this.Player.X--; break;

                        case 6: this.Player.X++; break;

                        case 8: this.Player.Y--; break;

                        case 2: this.Player.Y++; break;

                        default:
                            throw null;                                     // never
                        }
                    }
                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout, false);
                        this.DrawDungeon();

                        DDEngine.EachFrame();
                    }
                }
                if (1 <= DDInput.DIR_4.GetInput())
                {
                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(scene.Rate);

                        DDEngine.EachFrame();
                    }
                    this.Player.Direction = Utilities.RotL(this.Player.Direction);

                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(-scene.RemainingRate);

                        DDEngine.EachFrame();
                    }
                }
                if (1 <= DDInput.DIR_6.GetInput())
                {
                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(-scene.Rate);

                        DDEngine.EachFrame();
                    }
                    this.Player.Direction = Utilities.RotR(this.Player.Direction);

                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(scene.RemainingRate);

                        DDEngine.EachFrame();
                    }
                }
                if (1 <= DDInput.DIR_2.GetInput())
                {
                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(-scene.Rate);

                        DDEngine.EachFrame();
                    }
                    this.Player.Direction = Utilities.RotR(this.Player.Direction);

                    foreach (DDScene scene in DDSceneUtils.Create(10))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(scene.RemainingRate * 2.0 - 1.0);

                        DDEngine.EachFrame();
                    }
                    this.Player.Direction = Utilities.RotR(this.Player.Direction);

                    foreach (DDScene scene in DDSceneUtils.Create(5))
                    {
                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon(scene.RemainingRate);

                        DDEngine.EachFrame();
                    }
                }

                if (this.Map[this.Player.X, this.Player.Y].Script == MapCellScript.GOAL)
                {
                    Ground.I.Music.Completed.Play();
                    DDCurtain.SetCurtain(30, -0.8);

                    DDEngine.FreezeInput(30);

                    for (; ;)
                    {
                        if (DDInput.A.GetInput() == 1)
                        {
                            break;
                        }

                        if (DDInput.B.GetInput() == 1)
                        {
                            break;
                        }

                        if (DDInput.PAUSE.GetInput() == 1)
                        {
                            break;
                        }

                        DungeonScreen.DrawFront(this.Layout);
                        this.DrawDungeon();

                        DDCurtain.EachFrame();

                        DDDraw.DrawCenter(Ground.I.Picture.CongratulationsPanel, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);

                        DDPrint.SetPrint(DDConsts.Screen_W / 2 - 100, DDConsts.Screen_H - 16);
                        DDPrint.Print("PRESS Z KEY TO CONTINUE");

                        DDEngine.EachFrame();
                    }

                    // クリア後メニュー
                    {
                        DDEngine.FreezeInput();
                        DDCurtain.SetCurtain(30, -0.8);

                        const int ITEM_NUM    = 3;
                        int       selectIndex = 0;

                        for (; ;)
                        {
                            if (DDInput.PAUSE.GetInput() == 1)
                            {
                                break;
                            }

                            if (DDInput.DIR_2.IsPound())
                            {
                                selectIndex++;
                            }

                            if (DDInput.DIR_8.IsPound())
                            {
                                selectIndex--;
                            }

                            selectIndex += ITEM_NUM;
                            selectIndex %= ITEM_NUM;

                            if (DDInput.A.GetInput() == 1)
                            {
                                switch (selectIndex)
                                {
                                case 0:
                                {
                                    DDEngine.FreezeInput();

                                    for (; ;)
                                    {
                                        if (DDInput.A.GetInput() == 1)
                                        {
                                            break;
                                        }

                                        if (DDInput.B.GetInput() == 1)
                                        {
                                            break;
                                        }

                                        if (DDInput.PAUSE.GetInput() == 1)
                                        {
                                            break;
                                        }

                                        DungeonScreen.DrawFront(this.Layout);
                                        this.DrawDungeon();

                                        DDCurtain.EachFrame();

                                        this.DrawMap();

                                        DDPrint.SetPrint(DDConsts.Screen_W / 2 - 90, DDConsts.Screen_H - 16);
                                        DDPrint.Print("PRESS Z KEY TO RETURN");

                                        DDEngine.EachFrame();
                                    }
                                    DDEngine.FreezeInput();
                                }
                                break;

                                case 1:
                                    goto restart;

                                case 2:
                                    goto endGame;

                                default:
                                    throw null;                                             // never
                                }
                            }
                            if (DDInput.B.GetInput() == 1)
                            {
                                if (selectIndex == ITEM_NUM - 1)
                                {
                                    break;
                                }

                                selectIndex = ITEM_NUM - 1;
                            }
                            DungeonScreen.DrawFront(this.Layout);
                            this.DrawDungeon();

                            DDCurtain.EachFrame();

                            DDDraw.SetBright(new I3Color(100, 0, 0));
                            DDDraw.SetAlpha(0.7);
                            DDDraw.DrawBegin(DDGround.GeneralResource.WhiteBox, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                            DDDraw.DrawSetSize(400, 200);
                            DDDraw.DrawEnd();
                            DDDraw.Reset();

                            DDPrint.SetPrint(330, 215, 50);

                            {
                                int c = 0;

                                DDPrint.PrintLine("[" + (selectIndex == c++ ? ">" : " ") + "] マップを確認する");
                                DDPrint.PrintLine("[" + (selectIndex == c++ ? ">" : " ") + "] この迷路をもう一度プレイする");
                                DDPrint.PrintLine("[" + (selectIndex == c++ ? ">" : " ") + "] タイトルに戻る");
                            }

                            DDEngine.EachFrame();
                        }
                    }

                    break;
                }

                // Draw ...

                DungeonScreen.DrawFront(this.Layout);
                this.DrawDungeon();

                DDEngine.EachFrame();
            }

endGame:
            DDCurtain.SetCurtain(30, -1.0);
            DDMusicUtils.Fade();

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                DungeonScreen.DrawFront(this.Layout);
                this.DrawDungeon();

                DDEngine.EachFrame();
            }
        }