Exemple #1
0
        private DDHashedData MakeThumbnail()
        {
            DDMain.KeepMainScreen();

            using (DDSubScreen screen = new DDSubScreen(THUMB_W, THUMB_H))
                using (screen.Section())
                {
                    DDDraw.DrawRect(DDGround.KeptMainScreen.ToPicture(), 0, 0, THUMB_W, THUMB_H);

                    using (WorkingDir wd = new WorkingDir())
                    {
                        string bmpFile = wd.MakePath();
                        string pngFile = wd.MakePath();

                        DX.SaveDrawScreenToBMP(0, 0, THUMB_W, THUMB_H, bmpFile);

                        using (
                            Bitmap                       // KeepComment:@^_ConfuserElsa // NoRename:@^_ConfuserElsa
                            bmp =
                                (Bitmap)Bitmap.FromFile( // KeepComment:@^_ConfuserElsa // NoRename:@^_ConfuserElsa
                                    bmpFile
                                    ))
                        {
                            bmp
                            .Save(                             // KeepComment:@^_ConfuserElsa // NoRename:@^_ConfuserElsa
                                pngFile,
                                ImageFormat.Png                // KeepComment:@^_ConfuserElsa // NoRename:@^_ConfuserElsa
                                );
                        }
                        return(new DDHashedData(File.ReadAllBytes(pngFile)));
                    }
                }
        }
Exemple #2
0
        /// <summary>
        /// ポーズメニュー(デバッグ用)
        /// </summary>
        private void DebugPause()
        {
            DDMain.KeepMainScreen();

            DDSimpleMenu simpleMenu = new DDSimpleMenu()
            {
                Color       = new I3Color(255, 255, 255),
                BorderColor = new I3Color(0, 128, 64),
                WallPicture = DDGround.KeptMainScreen.ToPicture(),
                WallCurtain = -0.5,
            };

            int selectIndex = 0;

            for (; ;)
            {
                selectIndex = simpleMenu.Perform(
                    "デバッグ用メニュー",
                    new string[]
                {
                    "----",
                    "----",
                    "----",
                    "ゲームに戻る",
                },
                    selectIndex,
                    true,
                    true
                    );

                switch (selectIndex)
                {
                case 0:
                    // none
                    break;

                case 1:
                    // none
                    break;

                case 2:
                    // none
                    break;

                case 3:
                    goto endLoop;

                default:
                    throw null;                             // never
                }
                //DDEngine.EachFrame(); // 不要
            }
endLoop:
            DDEngine.FreezeInput();

            // 寧ろやりにくい
            //DDInput.A.FreezeInputUntilRelease = true;
            //DDInput.B.FreezeInputUntilRelease = true;
        }
Exemple #3
0
        /// <summary>
        /// ポーズメニュー
        /// </summary>
        private void Pause()
        {
            DDMain.KeepMainScreen();

            DDSimpleMenu simpleMenu = new DDSimpleMenu()
            {
                Color       = new I3Color(255, 255, 255),
                BorderColor = new I3Color(0, 64, 128),
                WallPicture = DDGround.KeptMainScreen.ToPicture(),
                WallCurtain = -0.5,
            };

            int selectIndex = 0;

            for (; ;)
            {
                selectIndex = simpleMenu.Perform(
                    "PAUSE",
                    new string[]
                {
                    "最初からやり直す",
                    "タイトルに戻る",
                    "ゲームに戻る",
                },
                    selectIndex,
                    true,
                    true
                    );

                switch (selectIndex)
                {
                case 0:
                    this.Pause_RestartGame = true;
                    goto endLoop;

                case 1:
                    this.Pause_ReturnToTitleMenu = true;
                    goto endLoop;

                case 2:
                    goto endLoop;

                default:
                    throw null;                             // never
                }
                //DDEngine.EachFrame(); // 不要
            }
endLoop:
            DDEngine.FreezeInput();

            // 寧ろやりにくい
            //DDInput.A.FreezeInputUntilRelease = true;
            //DDInput.B.FreezeInputUntilRelease = true;
        }
Exemple #4
0
        private void 最終ノベルパート()
        {
            using (DDSubScreen tmpScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H))
            {
                DDMain.KeepMainScreen();

                using (tmpScreen.Section())
                {
                    DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);
                }

                DDCurtain.SetCurtain(0, 0.5);
                DDCurtain.SetCurtain(20);

                foreach (DDScene scene in DDSceneUtils.Create(80))
                {
                    if (scene.Numer == scene.Denom - 20)
                    {
                        DDCurtain.SetCurtain(20, -1.0);
                    }

                    白黒効果.Perform(tmpScreen);

                    DDEngine.EachFrame();
                }

                Ground.I.会話スキップ抑止 = !Ground.I.SawFinalNovel;

                using (new Novel())
                {
                    Novel.I.Status.Scenario = GameProgressMaster.I.GetFinalScenario();
                    Novel.I.Perform();
                }

                Ground.I.会話スキップ抑止      = false;            // restore
                Ground.I.SawFinalNovel = true;

                DDCurtain.SetCurtain(0, -1.0);
                DDCurtain.SetCurtain();

                foreach (DDScene scene in DDSceneUtils.Create(40))
                {
                    白黒効果.Perform(tmpScreen);

                    DDEngine.EachFrame();
                }

                DDCurtain.SetCurtain(0, 0.5);
                DDCurtain.SetCurtain(20);
            }
        }
Exemple #5
0
        private void イベント実行()
        {
            DDMain.KeepMainScreen();

            // swap
            {
                DDSubScreen tmp = _lastGameScreen;
                _lastGameScreen         = DDGround.KeptMainScreen;
                DDGround.KeptMainScreen = tmp;
            }

            DDMusicUtils.Fade();

            DDCurtain.SetCurtain(10, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(20))
            {
                DDDraw.DrawSimple(_lastGameScreen.ToPicture(), 0, 0);
                DDEngine.EachFrame();
            }

            DDCurtain.SetCurtain(10);

            using (new Novel())
            {
                Novel.I.Status.Scenario = new Scenario("テスト0001");
                //Novel.I.Status.Scenario = new Scenario("イベント0001"); // old
                Novel.I.Perform();

                if (Novel.I.ReturnToTitleMenu)
                {
                    Game.I.RequestReturnToTitleMenu = true;
                }
            }

            MusicCollection.Get(Game.I.Map.MusicName).Play();

            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain(10);

#if false // いらん
            foreach (DDScene scene in DDSceneUtils.Create(20))
            {
                DDDraw.DrawSimple(_lastGameScreen.ToPicture(), 0, 0);
                DDEngine.EachFrame();
            }
#endif
        }
Exemple #6
0
        private void DeadPlayerMoment()
        {
            DDMain.KeepMainScreen();

            // memo: 喰らいボムはここでやれば良いんじゃないだろうか。

            foreach (DDScene scene in DDSceneUtils.Create(30))
            {
                DDDraw.DrawRect(DDGround.KeptMainScreen.ToPicture(), 0, 0, DDConsts.Screen_W, DDConsts.Screen_H);

                DDDraw.SetAlpha(0.2 + 0.2 * scene.Rate);
                DDDraw.SetBright(1.0, 0.0, 0.0);
                DDDraw.DrawRect(Ground.I.Picture.WhiteBox, new D4Rect(0, 0, DDConsts.Screen_W, DDConsts.Screen_H));
                DDDraw.Reset();

                DDEngine.EachFrame();
            }
            DDEngine.FreezeInput();
        }
Exemple #7
0
        // <---- prm

        public int Perform(string prompt, params string[] options)
        {
            DDMain.KeepMainScreen();

            DDSimpleMenu simpleMenu = new DDSimpleMenu()
            {
                BorderColor = this.BorderColor,
                WallDrawer  = () =>
                {
                    DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);

                    DDDraw.SetAlpha(0.7);
                    DDDraw.SetBright(0, 0, 0);
                    DDDraw.DrawRect(Ground.I.Picture.WhiteBox, this.BackBoardRect.ToD4Rect());
                    DDDraw.Reset();
                },
            };

            return(simpleMenu.Perform(Text_L, Text_T, 40, 24, prompt, options, 0));
        }
Exemple #8
0
        private void カットイン()
        {
            DDMain.KeepMainScreen();

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);

                DDDraw.SetBright(0, 0, 0);
                DDDraw.SetAlpha(1.0 - scene.Rate);
                DDDraw.DrawBegin(
                    Ground.I.Picture.WhiteCircle,
                    Game.I.Player.X - DDGround.ICamera.X,
                    Game.I.Player.Y - DDGround.ICamera.Y
                    );
                DDDraw.DrawZoom(0.3 + 20.0 * scene.Rate);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDEngine.EachFrame();
            }
        }
Exemple #9
0
        public static void Perform()
        {
            DDMain.KeepMainScreen();

            DDCurtain.SetCurtain(0, 0.5);
            DDCurtain.SetCurtain(20);

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                白黒効果.Perform(DDGround.KeptMainScreen);

                DDEngine.EachFrame();
            }

            // Swap
            {
                DDSubScreen tmp = DDGround.KeptMainScreen;
                DDGround.KeptMainScreen = EL_Screen;
                EL_Screen = tmp;
            }

            DDGround.EL.Add(SCommon.Supplier(E_残像()));
        }
Exemple #10
0
        /// <summary>
        /// ポーズメニュー(デバッグ用)
        /// </summary>
        private void DebugPause()
        {
            DDMain.KeepMainScreen();

            DDSimpleMenu simpleMenu = new DDSimpleMenu()
            {
                Color       = new I3Color(255, 255, 255),
                BorderColor = new I3Color(0, 128, 64),
                WallPicture = DDGround.KeptMainScreen.ToPicture(),
                WallCurtain = -0.5,
            };

            DDEngine.FreezeInput();

            int selectIndex = 0;

            for (; ;)
            {
                selectIndex = simpleMenu.Perform(
                    "デバッグ用メニュー",
                    new string[]
                {
                    "キャラクタ切り替え [ 現在のキャラクタ:---- ]",
                    "デバッグ強制遅延 [ 現在の設定:" + DDEngine.SlowdownLevel + " ]",
                    "当たり判定表示 [ 現在の設定:" + this.当たり判定表示 + " ]",
                    "ゲームに戻る",
                },
                    selectIndex,
                    true,
                    true
                    );

                switch (selectIndex)
                {
                case 0:
                    break;

                case 1:
                    if (DDEngine.SlowdownLevel == 0)
                    {
                        DDEngine.SlowdownLevel++;
                    }
                    else
                    {
                        DDEngine.SlowdownLevel *= 2;
                    }

                    DDEngine.SlowdownLevel %= 16;
                    break;

                case 2:
                    this.当たり判定表示 = !this.当たり判定表示;
                    break;

                case 3:
                    goto endLoop;

                default:
                    throw null;                             // never
                }
                //DDEngine.EachFrame(); // 不要
            }
endLoop:
            DDEngine.FreezeInput();

            DDInput.A.FreezeInputUntilRelease = true;
            DDInput.B.FreezeInputUntilRelease = true;
        }
Exemple #11
0
        public void Perform()
        {
            Func <bool> f_ゴミ回収 = SCommon.Supplier(this.E_ゴミ回収());

            DDUtils.Random = new DDRandom(1u);             // 電源パターン確保のため

            this.Player.X = DDConsts.Screen_W / 4;
            this.Player.Y = DDConsts.Screen_H / 2;

            // ★★★★★
            // プレイヤー・ステータス反映(ステージ開始時)
            {
                // none
            }

            this.Player.RebornFrame = 1;

            Game.I.Walls.Add(new Wall_Dark());

            DDCurtain.SetCurtain(0, -1.0);
            DDCurtain.SetCurtain(20);

            DDEngine.FreezeInput();

            for (this.Frame = 0; ; this.Frame++)
            {
                if (!this.Script.EachFrame())
                {
                    break;
                }

                if (!this.UserInputDisabled && DDInput.PAUSE.GetInput() == 1)                 // ポーズ
                {
                    DDMusicUtils.Pause();
                    this.Pause();

                    if (this.Pause_ReturnToTitleMenu)
                    {
                        break;
                    }
                    DDMusicUtils.Resume();
                }
                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_RETURN) == 1)
                {
                    this.DebugPause();
                }

                // プレイヤー行動
                {
                    bool   deadOrRebornOrUID = 1 <= this.Player.DeadFrame || 1 <= this.Player.RebornFrame || this.UserInputDisabled;
                    bool   deadOrUID         = 1 <= this.Player.DeadFrame || this.UserInputDisabled;
                    double xa = 0.0;
                    double ya = 0.0;

                    if (!deadOrUID && 1 <= DDInput.DIR_4.GetInput())                     // 左移動
                    {
                        xa = -1.0;
                    }
                    if (!deadOrUID && 1 <= DDInput.DIR_6.GetInput())                     // 右移動
                    {
                        xa = 1.0;
                    }
                    if (!deadOrUID && 1 <= DDInput.DIR_8.GetInput())                     // 上移動
                    {
                        ya = -1.0;
                    }
                    if (!deadOrUID && 1 <= DDInput.DIR_2.GetInput())                     // 下移動
                    {
                        ya = 1.0;
                    }

                    double speed;

                    if (1 <= DDInput.A.GetInput())                     // 低速ボタン押下中
                    {
                        speed = (double)this.Player.SpeedLevel;
                    }
                    else
                    {
                        speed = (double)(this.Player.SpeedLevel * 2);
                    }

                    this.Player.X += xa * speed;
                    this.Player.Y += ya * speed;

                    DDUtils.ToRange(ref this.Player.X, 0.0, DDConsts.Screen_W);
                    DDUtils.ToRange(ref this.Player.Y, 0.0, DDConsts.Screen_H);

                    if (!deadOrRebornOrUID && 1 <= DDInput.B.GetInput())                     // 攻撃ボタン押下中
                    {
                        this.Player.Shoot();
                    }

                    if (DDInput.C.GetInput() == 1)
                    {
                        this.Player.SpeedLevel--;
                    }
                    if (DDInput.D.GetInput() == 1)
                    {
                        this.Player.SpeedLevel++;
                    }
                    DDUtils.ToRange(ref this.Player.SpeedLevel, Player.SPEED_LEVEL_MIN, Player.SPEED_LEVEL_MAX);
                }

                //startDead:
                if (1 <= this.Player.DeadFrame)                 // プレイヤー死亡中の処理
                {
                    int frame = this.Player.DeadFrame - 1;

                    if (GameConsts.PLAYER_DEAD_FRAME_MAX < frame)
                    {
                        this.Player.DeadFrame = 0;

                        if (this.Status.Zanki <= 0)                         // ? 残機不足
                        {
                            break;
                        }

                        this.システム的な敵クリア();

                        this.Status.Zanki--;
                        this.Player.AttackLevel = Math.Max(0, this.Player.AttackLevel - 1);
                        this.Player.RebornFrame = 1;
                        goto endDead;
                    }
                    this.Player.DeadFrame++;

                    // ----

                    if (frame == 0)                     // init
                    {
                        DDMain.KeepMainScreen();

                        foreach (DDScene scene in DDSceneUtils.Create(20))
                        {
                            DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);

                            DDDraw.SetAlpha(0.3 + scene.Rate * 0.3);
                            DDDraw.SetBright(1.0, 0.0, 0.0);
                            DDDraw.DrawRect(Ground.I.Picture.WhiteBox, new D4Rect(0, 0, DDConsts.Screen_W, DDConsts.Screen_H));
                            DDDraw.Reset();

                            DDEngine.EachFrame();
                        }
                        DDGround.EL.Add(SCommon.Supplier(Effects.PlayerDead(this.Player.X, this.Player.Y)));
                    }
                }
endDead:

                //startReborn:
                if (1 <= this.Player.RebornFrame)                 // プレイヤー登場中の処理
                {
                    int frame = this.Player.RebornFrame - 1;

                    if (GameConsts.PLAYER_REBORN_FRAME_MAX < frame)
                    {
                        this.Player.RebornFrame     = 0;
                        this.Player.InvincibleFrame = 1;
                        goto endReborn;
                    }
                    this.Player.RebornFrame++;

                    // ----

                    double rate = (double)frame / GameConsts.PLAYER_REBORN_FRAME_MAX;

                    if (frame == 0)                     // init
                    {
                        this.Player.Reborn_X = -50.0;
                        this.Player.Reborn_Y = DDConsts.Screen_H / 2.0;
                    }
                    DDUtils.Approach(ref this.Player.Reborn_X, this.Player.X, 0.9 - 0.3 * rate);
                    DDUtils.Approach(ref this.Player.Reborn_Y, this.Player.Y, 0.9 - 0.3 * rate);
                }
endReborn:

                //startInvincible:
                if (1 <= this.Player.InvincibleFrame)                 // プレイヤー無敵時間中の処理
                {
                    int frame = this.Player.InvincibleFrame - 1;

                    if (GameConsts.PLAYER_INVINCIBLE_FRAME_MAX < frame)
                    {
                        this.Player.InvincibleFrame = 0;
                        goto endInvincible;
                    }
                    this.Player.InvincibleFrame++;

                    // ----

                    // noop
                }
endInvincible:

                DDCrash plCrash = DDCrashUtils.Point(new D2Point(this.Player.X, this.Player.Y));

                // ====
                // 描画ここから
                // ====

                foreach (Wall wall in this.Walls.Iterate())
                {
                    wall.Draw();
                }

                this.Player.Draw();

                // memo: DeadFlag をチェックするのは「当たり判定」から

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    enemy.Crash = DDCrashUtils.None();                     // reset
                    enemy.Draw();
                }
                foreach (Shot shot in this.Shots.Iterate())
                {
                    shot.Crash = DDCrashUtils.None();                     // reset
                    shot.Draw();
                }

                if (DDConfig.LOG_ENABLED && 1 <= DDInput.R.GetInput())                 // 当たり判定表示(チート)
                {
                    DDCurtain.DrawCurtain(-0.7);

                    const double A = 0.7;

                    DDCrashView.Draw(new DDCrash[] { plCrash }, new I3Color(255, 0, 0), 1.0);
                    DDCrashView.Draw(this.Enemies.Iterate().Select(v => v.Crash), new I3Color(255, 255, 255), A);
                    DDCrashView.Draw(this.Shots.Iterate().Select(v => v.Crash), new I3Color(0, 255, 255), A);
                }

                // ====
                // 描画ここまで
                // ====

                // ====
                // 当たり判定ここから
                // ====

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    if (
                        1 <= enemy.HP &&                                      // ? 敵:生存 && 無敵ではない
                        !DDUtils.IsOutOfScreen(new D2Point(enemy.X, enemy.Y)) // ? 画面内の敵である。
                        )
                    {
                        foreach (Shot shot in this.Shots.Iterate())
                        {
                            // 衝突判定:敵 x 自弾
                            if (
                                !shot.DeadFlag &&                                 // ? 自弾:生存
                                DDCrashUtils.IsCrashed(enemy.Crash, shot.Crash)   // ? 衝突
                                )
                            {
                                // ★ 敵_被弾ここから

                                shot.Kill();

                                enemy.HP -= shot.AttackPoint;

                                if (1 <= enemy.HP)                                 // ? まだ生存している。
                                {
                                    enemy.Damaged();
                                }
                                else                                 // ? 撃破した。
                                {
                                    enemy.Kill(true);
                                    break;                                     // この敵は死亡したので、この敵について以降の当たり判定は不要
                                }

                                // ★ 敵_被弾ここまで
                            }
                        }
                    }

                    // 衝突判定:敵 x 自機
                    if (
                        this.Player.RebornFrame == 0 &&                          // ? プレイヤー登場中ではない。
                        this.Player.DeadFrame == 0 &&                            // ? プレイヤー死亡中ではない。
                        this.Player.InvincibleFrame == 0 &&                      // ? プレイヤー無敵時間中ではない。
                        !enemy.DeadFlag &&                                       // ? 敵:生存
                        !DDUtils.IsOutOfScreen(new D2Point(enemy.X, enemy.Y)) && // ? 画面内の敵である。
                        DDCrashUtils.IsCrashed(enemy.Crash, plCrash)             // ? 衝突
                        )
                    {
                        // ★ 自機_被弾ここから

                        this.Player.DeadFrame = 1;

                        // ★ 自機_被弾ここまで
                    }
                }

                // ====
                // 当たり判定ここまで
                // ====

                // 不要な壁の死亡フラグを立てる。
                // -- FilledFlag == true な Wall より下の Wall は見えないので破棄して良い。
                {
                    bool flag = false;

                    for (int index = this.Walls.Count - 1; 0 <= index; index--)
                    {
                        this.Walls[index].DeadFlag |= flag;
                        flag |= this.Walls[index].FilledFlag;
                    }
                }

                f_ゴミ回収();

                this.Walls.RemoveAll(v => v.DeadFlag);
                this.Enemies.RemoveAll(v => v.DeadFlag);
                this.Shots.RemoveAll(v => v.DeadFlag);

                DDEngine.EachFrame();

                // ★★★ ゲームループの終わり ★★★
            }

            DDMain.KeepMainScreen();

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

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);
                DDEngine.EachFrame();
            }

            // ★★★★★
            // プレイヤー・ステータス反映(ステージ終了時)
            {
                // none
            }

            // ★★★ end of Perform() ★★★
        }
Exemple #12
0
        /// <summary>
        /// ポーズメニュー(デバッグ用)
        /// </summary>
        private void DebugPause()
        {
            DDMain.KeepMainScreen();

            DDSimpleMenu simpleMenu = new DDSimpleMenu()
            {
                BorderColor = new I3Color(0, 128, 64),
                WallDrawer  = () =>
                {
                    DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);
                    DDCurtain.DrawCurtain(-0.5);
                },
            };

            DDEngine.FreezeInput();

            int selectIndex = 0;

            for (; ;)
            {
                selectIndex = simpleMenu.Perform(
                    40,
                    40,
                    40,
                    24,
                    "デバッグ用メニュー",
                    new string[]
                {
                    "装備している武器の切り替え [ 現在装備している武器:" + Player.武器_e_Names[(int)this.Player.武器] + " ]",
                    "強制遅延 [ 現在の設定:" + DDEngine.SlowdownLevel + " ]",
                    "当たり判定表示 [ 現在の設定:" + this.当たり判定表示 + " ]",
                    "ゲームに戻る",
                },
                    selectIndex,
                    true,
                    true
                    );

                switch (selectIndex)
                {
                case 0:
                    this.Player.武器 = (Player.武器_e)(((int)this.Player.武器 + 1) % Enum.GetValues(typeof(Player.武器_e)).Length);
                    break;

                case 1:
                    if (DDEngine.SlowdownLevel == 0)
                    {
                        DDEngine.SlowdownLevel = 1;
                    }
                    else
                    {
                        DDEngine.SlowdownLevel *= 2;
                    }

                    DDEngine.SlowdownLevel %= 16;
                    break;

                case 2:
                    this.当たり判定表示 = !this.当たり判定表示;
                    break;

                case 3:
                    goto endLoop;

                default:
                    throw null;                             // never
                }
                //DDEngine.EachFrame(); // 不要
            }
endLoop:
            DDEngine.FreezeInput();

            DDInput.A.FreezeInputUntilRelease = true;
            DDInput.B.FreezeInputUntilRelease = true;
        }
Exemple #13
0
        /// <summary>
        /// ポーズメニュー
        /// </summary>
        private void Pause()
        {
            DDMain.KeepMainScreen();
            SCommon.Swap(ref DDGround.KeptMainScreen, ref Pause_KeptMainScreen);

            DDSimpleMenu simpleMenu = new DDSimpleMenu()
            {
                BorderColor = new I3Color(0, 64, 128),
                WallDrawer  = () =>
                {
                    DDDraw.DrawSimple(Pause_KeptMainScreen.ToPicture(), 0, 0);

                    DDDraw.SetAlpha(0.5);
                    DDDraw.SetBright(0, 0, 0);
                    DDDraw.DrawRect(Ground.I.Picture.WhiteBox, 0, DDConsts.Screen_H / 4, DDConsts.Screen_W, DDConsts.Screen_H / 2);
                    DDDraw.Reset();
                },
            };

            DDEngine.FreezeInput();

            int selectIndex = 0;

            for (; ;)
            {
                selectIndex = simpleMenu.Perform(
                    100,
                    180,
                    50,
                    24,
                    "システムメニュー",
                    new string[]
                {
                    "設定",
                    "タイトルに戻る",
                    "ゲームに戻る",
                },
                    selectIndex,
                    true
                    );

                switch (selectIndex)
                {
                case 0:
                    using (new SettingMenu()
                    {
                        SimpleMenu = new DDSimpleMenu()
                        {
                            BorderColor = new I3Color(0, 64, 128),
                            WallDrawer = () =>
                            {
                                DDDraw.DrawSimple(Pause_KeptMainScreen.ToPicture(), 0, 0);
                                DDCurtain.DrawCurtain(-0.7);
                            },
                        },
                    })
                    {
                        SettingMenu.I.Perform();
                    }
                    break;

                case 1:
                    if (new Confirm()
                    {
                        BorderColor = new I3Color(0, 0, 200),
                    }.Perform("タイトル画面に戻ります。", "はい", "いいえ") == 0)
                    {
                        this.Pause_ReturnToTitleMenu = true;
                        goto endLoop;
                    }
                    break;

                case 2:
                    goto endLoop;

                default:
                    throw null;                             // never
                }
                //DDEngine.EachFrame(); // 不要
            }
endLoop:
            DDEngine.FreezeInput();

            DDInput.A.FreezeInputUntilRelease = true;
            DDInput.B.FreezeInputUntilRelease = true;
        }
Exemple #14
0
        /// <summary>
        /// ポーズメニュー(デバッグ用)
        /// </summary>
        private void DebugPause()
        {
            DDMain.KeepMainScreen();

            DDSimpleMenu simpleMenu = new DDSimpleMenu()
            {
                BorderColor = new I3Color(0, 128, 64),
                WallDrawer  = () =>
                {
                    DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);
                    DDCurtain.DrawCurtain(-0.5);
                },
            };

            DDEngine.FreezeInput();

            int selectIndex = 0;

            for (; ;)
            {
                string 現在のキャラクタ;

                現在のキャラクタ = "標準(Actor83)";

                selectIndex = simpleMenu.Perform(
                    40,
                    40,
                    40,
                    24,
                    "デバッグ用メニュー",
                    new string[]
                {
                    "キャラクタ切り替え [ 現在のキャラクタ:" + 現在のキャラクタ + " ] (Lホールド=逆順)",
                    "デバッグ強制遅延 [ 現在の設定:" + DDEngine.SlowdownLevel + " ]",
                    "当たり判定表示 [ 現在の設定:" + this.当たり判定表示 + " ]",
                    "ゲームに戻る",
                },
                    selectIndex,
                    true,
                    true
                    );

                switch (selectIndex)
                {
                case 0:
                    // noop
                    break;

                case 1:
                    if (DDEngine.SlowdownLevel == 0)
                    {
                        DDEngine.SlowdownLevel++;
                    }
                    else
                    {
                        DDEngine.SlowdownLevel *= 2;
                    }

                    DDEngine.SlowdownLevel %= 16;
                    break;

                case 2:
                    this.当たり判定表示 = !this.当たり判定表示;
                    break;

                case 3:
                    goto endLoop;

                default:
                    throw null;                             // never
                }
                //DDEngine.EachFrame(); // 不要
            }
endLoop:
            DDEngine.FreezeInput();

            DDInput.A.FreezeInputUntilRelease = true;
            DDInput.B.FreezeInputUntilRelease = true;
        }
Exemple #15
0
        /// <summary>
        /// ポーズメニュー(デバッグ用)
        /// </summary>
        private void DebugPause()
        {
            DDMain.KeepMainScreen();

            DDSimpleMenu simpleMenu = new DDSimpleMenu()
            {
                BorderColor = new I3Color(0, 128, 64),
                WallDrawer  = () =>
                {
                    DDDraw.DrawSimple(DDGround.KeptMainScreen.ToPicture(), 0, 0);
                    DDCurtain.DrawCurtain(-0.5);
                },
            };

            DDEngine.FreezeInput();

            int selectIndex = 0;

            for (; ;)
            {
                string 現在のキャラクタ;

                if (this.Status.東方キャラ選択中)
                {
                    現在のキャラクタ = ResourcePicture2.Player_e_Names[(int)this.Status.東方キャラ];
                }
                else
                {
                    現在のキャラクタ = "標準(Actor83)";
                }

                selectIndex = simpleMenu.Perform(
                    40,
                    40,
                    40,
                    24,
                    "デバッグ用メニュー",
                    new string[]
                {
                    "キャラクタ切り替え [ 現在のキャラクタ:" + 現在のキャラクタ + " ] (Lホールド=逆順)",
                    "デバッグ強制遅延 [ 現在の設定:" + DDEngine.SlowdownLevel + " ]",
                    "当たり判定表示 [ 現在の設定:" + this.当たり判定表示 + " ]",
                    "ゲームに戻る",
                },
                    selectIndex,
                    true,
                    true
                    );

                switch (selectIndex)
                {
                case 0:
                {
                    bool backMode;

                    {
                        int bk_freezeInputFrame = DDEngine.FreezeInputFrame;
                        DDEngine.FreezeInputFrame = 0;
                        backMode = 1 <= DDInput.L.GetInput();
                        DDEngine.FreezeInputFrame = bk_freezeInputFrame;
                    }

                    if (this.Status.東方キャラ選択中)
                    {
                        int chara = (int)this.Status.東方キャラ;

                        if (backMode)
                        {
                            chara--;
                        }
                        else
                        {
                            chara++;
                        }

                        if (0 <= chara && chara < ResourcePicture2.Player_e_Length)
                        {
                            this.Status.東方キャラ = (ResourcePicture2.Player_e)chara;
                        }
                        else
                        {
                            this.Status.東方キャラ選択中 = false;
                            this.Status.東方キャラ    = ResourcePicture2.Player_e.Alice;                                          // 適当なキャラを設定しておく
                        }
                    }
                    else
                    {
                        this.Status.東方キャラ選択中 = true;

                        if (backMode)
                        {
                            this.Status.東方キャラ = (ResourcePicture2.Player_e)(ResourcePicture2.Player_e_Length - 1);                                             // 最後のキャラ
                        }
                        else
                        {
                            this.Status.東方キャラ = (ResourcePicture2.Player_e) 0;                                            // 最初のキャラ
                        }
                    }
                }
                break;

                case 1:
                    if (DDEngine.SlowdownLevel == 0)
                    {
                        DDEngine.SlowdownLevel++;
                    }
                    else
                    {
                        DDEngine.SlowdownLevel *= 2;
                    }

                    DDEngine.SlowdownLevel %= 16;
                    break;

                case 2:
                    this.当たり判定表示 = !this.当たり判定表示;
                    break;

                case 3:
                    goto endLoop;

                default:
                    throw null;                             // never
                }
                //DDEngine.EachFrame(); // 不要
            }
endLoop:
            DDEngine.FreezeInput();

            DDInput.A.FreezeInputUntilRelease = true;
            DDInput.B.FreezeInputUntilRelease = true;
        }
Exemple #16
0
        public bool PlayerWasDead = false;         // 死亡すると true にセットされる。

        public void Perform()
        {
            DDUtils.Random = new DDRandom(1u, 1u, 1u, 1u);             // 電源パターン確保のため

            DDCurtain.SetCurtain();
            DDEngine.FreezeInput();

            Func <bool> f_ゴミ回収 = SCommon.Supplier(this.E_ゴミ回収());

            // reset
            {
                RippleEffect.Clear();
                画面分割.Enabled = false;
            }

            this.Player.Reset(false);

            // ★★★★★ ステータス反映
            {
                this.Score        = this.Status.Score;
                this.Player.Power = this.Status.PlayerPower;
                this.Zanki        = this.Status.PlayerZanki;
                this.ZanBomb      = this.Status.PlayerZanBomb;
            }

            for (this.Frame = 0; ; this.Frame++)
            {
                if (!this.Script.EachFrame())                 // シナリオ進行
                {
                    break;
                }

                if (DDConfig.LOG_ENABLED)                 // チート機能
                {
                    if (DDKey.IsPound(DX.KEY_INPUT_PGUP))
                    {
                        this.Player.Power += GameConsts.PLAYER_POWER_PER_LEVEL;
                    }
                    if (DDKey.IsPound(DX.KEY_INPUT_PGDN))
                    {
                        this.Player.Power -= GameConsts.PLAYER_POWER_PER_LEVEL;
                    }
                    DDUtils.ToRange(ref this.Player.Power, 0, GameConsts.PLAYER_POWER_MAX);
                }

                if (DDInput.PAUSE.GetInput() == 1 && 10 < this.Frame)                 // ポーズ
                {
                    this.Pause();

                    if (this.Pause_RestartGame)
                    {
                        GameMaster.RestartFlag = true;
                        break;
                    }
                    if (this.Pause_ReturnToTitleMenu)
                    {
                        GameMaster.ReturnToTitleMenu = true;
                        break;
                    }
                }
                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_RETURN) == 1)
                {
                    this.DebugPause();
                }

                this.LastInput = this.Input;                 // 前回のプレイヤー入力を退避

                // プレイヤー入力
                {
                    this.Input.Dir2  = 1 <= DDInput.DIR_2.GetInput();
                    this.Input.Dir4  = 1 <= DDInput.DIR_4.GetInput();
                    this.Input.Dir6  = 1 <= DDInput.DIR_6.GetInput();
                    this.Input.Dir8  = 1 <= DDInput.DIR_8.GetInput();
                    this.Input.Slow  = 1 <= DDInput.A.GetInput();
                    this.Input.Shoot = 1 <= DDInput.B.GetInput();
                    this.Input.Bomb  = 1 <= DDInput.C.GetInput();
                }

                this.Player.LastX = this.Player.X;
                this.Player.LastY = this.Player.Y;

startBornPlayer:
                if (1 <= this.Player.BornFrame)                 // プレイヤー登場中の処理
                {
                    int frm = this.Player.BornFrame - 1;

                    if (GameConsts.PLAYER_BORN_FRAME_MAX < frm)
                    {
                        this.Player.BornFrame = 0;
                        goto endBornPlayer;
                    }
                    this.Player.BornFrame++;
                    double rate = (double)frm / GameConsts.PLAYER_BORN_FRAME_MAX;

                    if (frm == 0)                     // init
                    {
                        this.Player.BornFollowX = GameConsts.FIELD_W * 0.5;
                        this.Player.BornFollowY = GameConsts.FIELD_H * 1.2;
                    }

                    double approachingRate = 0.99 - 0.01 * frm;
                    DDUtils.ToRange(ref approachingRate, 0.0, 1.0);

                    DDUtils.Approach(ref this.Player.BornFollowX, this.Player.X, approachingRate);
                    DDUtils.Approach(ref this.Player.BornFollowY, this.Player.Y, approachingRate);
                }
endBornPlayer:

                //startDeadPlayer:
                if (1 <= this.Player.DeadFrame)                 // プレイヤー死亡中の処理
                {
                    int frm = this.Player.DeadFrame - 1;

                    if (GameConsts.PLAYER_DEAD_FRAME_MAX < frm)
                    {
                        if (this.Zanki <= 0)                         // 残機不足のため終了
                        {
                            GameMaster.ReturnToTitleMenu = true;
                            break;
                        }
                        this.Zanki--;
                        this.Player.Reset(true);
                        goto startBornPlayer;
                    }
                    this.Player.DeadFrame++;

                    if (frm == 0)                     // init
                    {
                        this.DeadPlayerMoment();
                        this.PlayerEffects.Add(SCommon.Supplier(Effects.PlayerDead(this.Player.X, this.Player.Y)));
                    }
                    goto endPlayerMove;
                }
                //endDeadPlayer:

                //startBombPlayer:
                if (1 <= this.Player.BombFrame)                 // ボム使用中の処理
                {
                    int frm = this.Player.BombFrame - 1;

                    if (GameConsts.PLAYER_BOMB_FRAME_MAX < frm)
                    {
                        this.Player.BombFrame = 0;
                        goto endBombPlayer;
                    }
                    this.Player.BombFrame++;

                    if (frm == 0)                     // init
                    {
                        this.Player.Bomb();
                    }
                }
endBombPlayer:

                //startPlayerMove:
                // プレイヤー移動
                {
                    bool d2 = this.Input.Dir2;
                    bool d4 = this.Input.Dir4;
                    bool d6 = this.Input.Dir6;
                    bool d8 = this.Input.Dir8;

                    double speed;

                    if (this.Input.Slow)
                    {
                        speed = 2.5;
                    }
                    else
                    {
                        speed = 5.0;
                    }

                    double nanameSpeed = speed / Math.Sqrt(2.0);

                    if (d2 && d4)                     // 左下
                    {
                        this.Player.X -= nanameSpeed;
                        this.Player.Y += nanameSpeed;
                    }
                    else if (d2 && d6)                     // 右下
                    {
                        this.Player.X += nanameSpeed;
                        this.Player.Y += nanameSpeed;
                    }
                    else if (d4 && d8)                     // 左上
                    {
                        this.Player.X -= nanameSpeed;
                        this.Player.Y -= nanameSpeed;
                    }
                    else if (d6 && d8)                     // 右上
                    {
                        this.Player.X += nanameSpeed;
                        this.Player.Y -= nanameSpeed;
                    }
                    else if (d2)                     // 下
                    {
                        this.Player.Y += speed;
                    }
                    else if (d4)                     // 左
                    {
                        this.Player.X -= speed;
                    }
                    else if (d6)                     // 右
                    {
                        this.Player.X += speed;
                    }
                    else if (d8)                     // 上
                    {
                        this.Player.Y -= speed;
                    }

                    DDUtils.ToRange(ref this.Player.X, 0.0, (double)GameConsts.FIELD_W);
                    DDUtils.ToRange(ref this.Player.Y, 0.0, (double)GameConsts.FIELD_H);

                    if (d4)                     // 左
                    {
                        DDUtils.Minim(ref this.Player.XMoveFrame, 0);
                        this.Player.XMoveFrame--;
                    }
                    else if (d6)                     // 右
                    {
                        DDUtils.Maxim(ref this.Player.XMoveFrame, 0);
                        this.Player.XMoveFrame++;
                    }
                    else
                    {
                        this.Player.XMoveFrame = 0;
                    }

                    if (d8)                     // 上
                    {
                        DDUtils.Minim(ref this.Player.YMoveFrame, 0);
                        this.Player.YMoveFrame--;
                    }
                    else if (d2)                     // 下
                    {
                        DDUtils.Maxim(ref this.Player.YMoveFrame, 0);
                        this.Player.YMoveFrame++;
                    }
                    else
                    {
                        this.Player.YMoveFrame = 0;
                    }

                    DDUtils.Approach(ref this.Player.XMoveRate, DDUtils.Sign(this.Player.XMoveFrame), 0.95);
                    DDUtils.Approach(ref this.Player.YMoveRate, DDUtils.Sign(this.Player.YMoveFrame), 0.95);
                }
endPlayerMove:

                if (this.Input.Slow)
                {
                    DDUtils.Maxim(ref this.Player.SlowFrame, 0);
                    this.Player.SlowFrame++;
                }
                else
                {
                    DDUtils.Minim(ref this.Player.SlowFrame, 0);
                    this.Player.SlowFrame--;
                }

                if (this.Input.Shoot)
                {
                    DDUtils.Maxim(ref this.Player.ShootFrame, 0);
                    this.Player.ShootFrame++;
                }
                else
                {
                    DDUtils.Minim(ref this.Player.ShootFrame, 0);
                    this.Player.ShootFrame--;
                }

                DDUtils.Approach(ref this.Player.SlowRate, this.Player.SlowFrame < 0 ? 0.0 : 1.0, 0.85);
                DDUtils.Approach(ref this.Player.ShootRate, this.Player.ShootFrame < 0 ? 0.0 : 1.0, 0.85);

                if (this.LastInput.Shoot && this.Input.Shoot && SCommon.IsRange(this.Player.SlowFrame, -1, 1))                 // ? ショット中に低速・高速を切り替えた。
                {
                    this.Player.ShootRate = 0.0;
                }

                // ----

                if (this.Input.Shoot && this.Player.DeadFrame == 0)                 // プレイヤー攻撃
                {
                    this.Player.Shoot();
                }
                if (this.Input.Bomb && this.Player.DeadFrame == 0 && this.Player.BombFrame == 0 && 1 <= this.ZanBomb)                 // ボム使用
                {
                    this.ZanBomb--;
                    this.Player.BombFrame = 1;
                }

                // 当たり判定 reset
                {
                    this.PlayerCrashes.Clear();
                    this.GrazeCrashes.Clear();
                    this.EnemyCrashes.Clear();
                    this.ShotCrashes.Clear();
                }

                this.Player.Put当たり判定();

                // ====
                // 描画ここから
                // ====

                // Swap
                {
                    DDSubScreen tmp = this.Field;
                    this.Field      = this.Field_Last;
                    this.Field_Last = tmp;
                }

                using (this.Field.Section())                 // フィールド描画
                {
                    // Walls
                    {
                        int filledIndex = -1;

                        for (int index = 0; index < this.Walls.Count; index++)
                        {
                            Wall wall = this.Walls[index];

                            if (!wall.Draw())
                            {
                                this.Walls[index] = null;
                            }
                            else if (wall.Filled)
                            {
                                filledIndex = index;
                            }
                        }
                        for (int index = 0; index < filledIndex; index++)
                        {
                            this.Walls[index] = null;
                        }

                        this.Walls.RemoveAll(v => v == null);
                    }

                    RippleEffect.EachFrame(this.Field);

                    this.EL_AfterDrawWalls.ExecuteAllTask();

                    // Shots
                    {
                        for (int index = 0; index < this.Shots.Count; index++)
                        {
                            Shot shot = this.Shots[index];

                            if (!shot.Draw())
                            {
                                this.Shots[index] = null;
                            }
                        }
                        this.Shots.RemoveAll(v => v == null);
                    }

                    this.EL_AfterDrawShots.ExecuteAllTask();

                    if (this.Player.DeadFrame == 0)
                    {
                        this.Player.Draw();
                    }

                    this.EL_AfterDrawPlayer.ExecuteAllTask();

                    // Enemies
                    {
                        foreach (Enemy.Kind_e kind in new Enemy.Kind_e[]
                        {
                            Enemy.Kind_e.ENEMY,
                            Enemy.Kind_e.TAMA,
                            Enemy.Kind_e.ITEM,
                        })
                        {
                            for (int index = 0; index < this.Enemies.Count; index++)
                            {
                                Enemy enemy = this.Enemies[index];

                                if (enemy != null && enemy.Kind == kind)
                                {
                                    if (!enemy.Draw())
                                    {
                                        this.Enemies[index] = null;
                                    }
                                }
                            }
                        }
                        this.Enemies.RemoveAll(v => v == null);
                    }

                    this.EnemyEffects.ExecuteAllTask();
                    this.PlayerEffects.ExecuteAllTask();

                    // 当たり判定表示
                    // -- デバッグ用だが、ボタン設定に割り当てがあるので、常に使えるようにする。
                    if (1 <= DDInput.R.GetInput())
                    {
                        this.Draw当たり判定();
                    }

                    画面分割.EachFrame(this.Field);
                }

                {
                    DDUtils.Approach(ref this.BackgroundSlideRate, this.Player.Y * 1.0 / GameConsts.FIELD_H, 0.99);                     // HACK

                    D4Rect rect = DDUtils.AdjustRectExterior(
                        new D2Size(GameConsts.FIELD_W, GameConsts.FIELD_H),
                        new D4Rect(0, 0, DDConsts.Screen_W, DDConsts.Screen_H),
                        this.BackgroundSlideRate
                        //this.Player.Y * 1.0 / GameConsts.FIELD_H
                        );

                    DDDraw.DrawRect(this.Field.ToPicture(), rect);
                }

                {
                    const int MARGIN = 5;

                    DDDraw.SetBright(0, 0, 0);
                    DDDraw.DrawRect(
                        Ground.I.Picture.WhiteBox,
                        GameConsts.FIELD_L - MARGIN,
                        GameConsts.FIELD_T - MARGIN,
                        GameConsts.FIELD_W + MARGIN * 2,
                        GameConsts.FIELD_H + MARGIN * 2
                        );
                    DDDraw.Reset();
                }

                DX.GraphFilter(
                    DDGround.MainScreen.GetHandle(),
                    DX.DX_GRAPH_FILTER_GAUSS,
                    16,
                    SCommon.ToInt(500.0)
                    );

                DDCurtain.DrawCurtain(-0.2);

                DDDraw.DrawSimple(this.Field.ToPicture(), GameConsts.FIELD_L, GameConsts.FIELD_T);
                this.DrawStatus();
                this.SurfaceManager.Draw();

                // ====
                // 描画ここまで
                // ====

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    if (!DDUtils.IsOut(new D2Point(enemy.X, enemy.Y), new D4Rect(0, 0, GameConsts.FIELD_W, GameConsts.FIELD_H)))                     // ? フィールド内
                    {
                        DDUtils.CountDown(ref enemy.TransFrame);
                        enemy.OnFieldFrame++;
                    }
                }

                this.当たり判定();

                if (this.AH_Grazed)
                {
                    if (
                        1 <= this.Player.BornFrame ||
                        1 <= this.Player.DeadFrame
                        )
                    {
                        // 登場中・死亡中は何もしない。
                    }
                    else
                    {
                        Ground.I.SE.SE_KASURI.Play();
                        this.Score++;
                    }
                }
                if (this.AH_PlayerCrashedFlag)
                {
                    if (
                        1 <= this.Player.BornFrame ||
                        1 <= this.Player.DeadFrame ||
                        1 <= this.Player.BombFrame
                        )
                    {
                        // 登場中・死亡中・ボム使用中は何もしない。
                    }
                    else
                    {
                        this.Player.DeadFrame = 1;                         // プレイヤー死亡
                        this.PlayerWasDead    = true;
                    }
                }

                if (Ground.I.HiScore < this.Score)
                {
                    if (Ground.I.HiScore + 10L < this.Score)
                    {
                        Ground.I.HiScore -= this.Score;
                        Ground.I.HiScore /= 2L;
                        Ground.I.HiScore += this.Score;
                    }
                    else
                    {
                        Ground.I.HiScore++;
                    }
                }

                f_ゴミ回収();

                this.Enemies.RemoveAll(v => v.HP == -1);
                this.Shots.RemoveAll(v => v.Vanished);

                DDEngine.EachFrame();

                // ★★★ ゲームループの終わり ★★★
            }

            DDUtils.Maxim(ref Ground.I.HiScore, this.Score);             // 確実な同期

            // ★★★★★ ステータス反映
            {
                this.Status.Score         = this.Score;
                this.Status.PlayerPower   = this.Player.Power;
                this.Status.PlayerZanki   = this.Zanki;
                this.Status.PlayerZanBomb = this.ZanBomb;
            }

            DDMain.KeepMainScreen();

            DDMusicUtils.Fade();
            DDCurtain.SetCurtain(60, -1.0);

            foreach (DDScene scene in DDSceneUtils.Create(120))
            {
                DDDraw.DrawRect(DDGround.KeptMainScreen.ToPicture(), 0, 0, DDConsts.Screen_W, DDConsts.Screen_H);
                DDEngine.EachFrame();
            }

            // ★★★ end of Perform() ★★★
        }