コード例 #1
0
        protected override IEnumerable <bool> E_Draw()
        {
            double ySpeed = 0.0;

            const double GRAVITY     = 1.0;
            const double SPEED_Y_MAX = 8.0;

            for (; ;)
            {
                this.Y += ySpeed;

                ySpeed += GRAVITY;
                ySpeed  = Math.Min(ySpeed, SPEED_Y_MAX);

                if (Game.I.Map.GetCell(GameCommon.ToTablePoint(new D2Point(this.X, this.Y))).Tile.IsGround())                 // ? 地面に落ちた。
                {
                    break;
                }

                DDDraw.DrawCenter(Ground.I.Picture.Teki_a01_Shit01, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);

                this.Crash = DDCrashUtils.Point(new D2Point(this.X, this.Y));

                yield return(true);
            }
        }
コード例 #2
0
        private void DrawTrackBar(int x, int y, string lwLabel, string hiLabel, double rate, Action <double> changed, Action pulse = null)
        {
            DDDraw.DrawBegin(Ground.I.Picture.TrackBar, x, y);
            DDCrash drawedCrash = DDDraw.DrawGetCrash();

            DDDraw.DrawEnd();

            DDPrint.SetPrint(x - Ground.I.Picture.TrackBar.Get_W() / 2 - lwLabel.Length * 32, y - 15);
            DDPrint.Print(lwLabel);

            DDPrint.SetPrint(x + Ground.I.Picture.TrackBar.Get_W() / 2, y - 15);
            DDPrint.Print(hiLabel);

            double span = Ground.I.Picture.TrackBar.Get_W() - Ground.I.Picture.TrackBar_つまみ.Get_W();

            span /= 2;
            double xMin = x - span;
            double xMax = x + span;

            double xつまみ = DDUtils.AToBRate(xMin, xMax, rate);

            DDDraw.DrawCenter(Ground.I.Picture.TrackBar_つまみ, xつまみ, y);

            if (drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
            {
                this.LastHoveringTrackBar = drawedCrash;
            }
            if (
                this.LastActiveTrackBar != null &&
                this.LastActiveTrackBar.Value.IsCrashed(DDCrashUtils.Point(new D2Point(x, y)))
                )
            {
                double rateNew = DDUtils.RateAToB(xMin, xMax, DDMouse.X);
                DDUtils.ToRange(ref rateNew, 0.0, 1.0);

                if (SCommon.MICRO < Math.Abs(rate - rateNew))
                {
                    changed(rateNew);
                }

                if (pulse != null)
                {
                    const int PULSE_FRM = 60;

                    if (DDEngine.ProcFrame % PULSE_FRM == 0)
                    {
                        pulse();
                    }
                }
            }
        }
コード例 #3
0
        public static string GetName(D2Point pt, string defval = null)
        {
            DDCrash ptCrash = DDCrashUtils.Point(pt);

            foreach (NamedCrash crash in Crashes)
            {
                if (crash.Crash.IsCrashed(ptCrash))
                {
                    return(crash.Name);
                }
            }

            return(defval);
        }
コード例 #4
0
        /// <summary>
        /// 当たり判定を配置する。
        /// 処理すべきこと:
        /// Game.I.PlayerCrashes への追加
        /// Game.I.GrazeCrashes への追加
        /// </summary>
        public void Put当たり判定()
        {
            const double GRAZE_R = 10.0;

            foreach (DDScene scene in DDSceneUtils.Create(5))
            {
                D2Point pt = DDUtils.AToBRate(
                    new D2Point(this.X, this.Y),
                    new D2Point(this.LastX, this.LastY),
                    scene.Rate
                    );

                Game.I.PlayerCrashes.Add(DDCrashUtils.Point(pt));
                Game.I.GrazeCrashes.Add(DDCrashUtils.Circle(pt, GRAZE_R));
            }
        }
コード例 #5
0
        private void DrawButton(int x, int y, DDPicture picture, bool activeFlag)
        {
            DDDraw.SetAlpha(activeFlag ? 1.0 : 0.5);
            DDDraw.DrawBegin(picture, x, y);
            DDCrash drawedCrash = DDDraw.DrawGetCrash();

            DDDraw.DrawEnd();
            DDDraw.Reset();

            if (drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
            {
                this.LastHoveringButton     = picture;
                this.LastButtonHoveringFlag = true;
            }
            else
            {
                this.LastButtonHoveringFlag = false;
            }
        }
コード例 #6
0
        private void 基本設定()
        {
            DDSE[] seSamples = new DDSE[]
            {
                Ground.I.SE.Poka01,
                Ground.I.SE.Poka02,
            };

            DDEngine.FreezeInput();

            for (; ;)
            {
                // ====
                // 入力判定ここから
                // ====

                if (
                    DDInput.A.GetInput() == 1 ||
                    DDInput.B.GetInput() == 1 ||
                    DDMouse.R.GetInput() == -1
                    )
                {
                    this.Mode = Mode_e.END;
                    break;
                }

                if (DDMouse.L.GetInput() == -1)
                {
                    if (this.GetTabTitleCrash_拡張設定().IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
                    {
                        this.Mode = Mode_e.拡張設定;
                        break;
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_フルスクリーン)
                    {
                        DDMain.SetFullScreen();
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_ウィンドウ)
                    {
                        const int def_screen_w = DDConsts.Screen_W / 2;
                        const int def_screen_h = DDConsts.Screen_H / 2;

                        DDMain.SetScreenSize(def_screen_w, def_screen_h);
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_デフォルトに戻す)
                    {
                        this.デフォルトに戻す();
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_戻る)
                    {
                        this.Mode = Mode_e.END;
                        break;
                    }
                }

                // ====
                // 入力判定ここまで
                // ====

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

                this.BeforeDrawContents();

                DDDraw.DrawSimple(Ground.I.Picture.基本設定枠, 0, 0);

                this.DrawTabTitles(false);

                this.DrawPrompt(100, 250, "画面モード");
                this.DrawPrompt(100, 380, "BGM音量");
                this.DrawPrompt(100, 510, "SE音量");
                this.DrawPrompt(100, 640, "メッセージ表示速度");
                this.DrawPrompt(100, 770, "メッセージウィンドウ透明度");

                bool fullScreenFlag =
                    DDGround.RealScreen_W == DDGround.MonitorRect.W &&
                    DDGround.RealScreen_H == DDGround.MonitorRect.H;

                this.DrawButton(1100, 280, Ground.I.Picture.SettingButton_フルスクリーン, fullScreenFlag);
                this.DrawButton(1550, 280, Ground.I.Picture.SettingButton_ウィンドウ, !fullScreenFlag);
                this.DrawTrackBar(1325, 410, "小", "大", DDGround.MusicVolume, volume =>
                {
                    DDGround.MusicVolume = volume;
                    DDMusicUtils.UpdateVolume();
                });
                this.DrawTrackBar(1325, 540, "小", "大", DDGround.SEVolume, volume =>
                {
                    DDGround.SEVolume = volume;
                    //DDSEUtils.UpdateVolume(); // v_20210215 -- メソッド終了時に全て更新する。

                    foreach (DDSE se in seSamples)
                    {
                        se.UpdateVolume();
                    }
                },
                                  () =>
                {
                    DDUtils.Random.ChooseOne(seSamples).Play();
                });
                this.DrawTrackBar(1325, 670, "遅い", "速い",
                                  DDUtils.RateAToB(GameConsts.MESSAGE_SPEED_MIN, GameConsts.MESSAGE_SPEED_MAX, Ground.I.MessageSpeed),
                                  value => Ground.I.MessageSpeed = SCommon.ToInt(
                                      DDUtils.AToBRate(GameConsts.MESSAGE_SPEED_MIN, GameConsts.MESSAGE_SPEED_MAX, value)
                                      )
                                  );
                this.DrawTrackBar(1325, 800, "透明", "不透明",
                                  DDUtils.RateAToB(0, 100, Ground.I.MessageWindow_A_Pct),
                                  value => Ground.I.MessageWindow_A_Pct = SCommon.ToInt(
                                      DDUtils.AToBRate(0, 100, value)
                                      )
                                  );

                this.DrawUnderButtons();

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

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

            DDSEUtils.UpdateVolume();             // v_20210215
        }
コード例 #7
0
        private void 拡張設定()
        {
            DDEngine.FreezeInput();

            for (; ;)
            {
                // ====
                // 入力判定ここから
                // ====

                if (
                    DDInput.A.GetInput() == 1 ||
                    DDInput.B.GetInput() == 1 ||
                    DDMouse.R.GetInput() == -1
                    )
                {
                    this.Mode = Mode_e.END;
                    break;
                }

                if (DDMouse.L.GetInput() == -1)
                {
                    if (this.GetTabTitleCrash_基本設定().IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
                    {
                        this.Mode = Mode_e.基本設定;
                        break;
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_ウィンドウサイズ設定)
                    {
                        this.Mode = Mode_e.画面サイズ設定;
                        break;
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_ゲームパッドのボタン設定 && 1 <= DDPad.GetPadCount())
                    {
                        this.Mode = Mode_e.ボタン設定;
                        break;
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_キーボードのキー設定)
                    {
                        this.Mode = Mode_e.キー設定;
                        break;
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_デフォルトに戻す)
                    {
                        this.デフォルトに戻す();
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_戻る)
                    {
                        this.Mode = Mode_e.END;
                        break;
                    }
                }

                // ====
                // 入力判定ここまで
                // ====

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

                this.BeforeDrawContents();

                DDDraw.DrawSimple(Ground.I.Picture.拡張設定枠, 0, 0);

                this.DrawTabTitles(true);

                this.DrawButton(960, 330, Ground.I.Picture.SettingButton_ウィンドウサイズ設定, true);
                this.DrawButton(960, 530, Ground.I.Picture.SettingButton_ゲームパッドのボタン設定, 1 <= DDPad.GetPadCount());
                this.DrawButton(960, 730, Ground.I.Picture.SettingButton_キーボードのキー設定, true);

                this.DrawUnderButtons();

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

                DDEngine.EachFrame();
            }
            DDEngine.FreezeInput();
        }
コード例 #8
0
        public void Perform()
        {
            Func <bool> f_ゴミ回収 = SCommon.Supplier(this.E_ゴミ回収());

            this.Map = new Map(GameCommon.GetMapFile(this.World.GetCurrMapName()));
            this.ReloadEnemies();

            // デフォルトの「プレイヤーのスタート地点」
            // -- マップの中央
            this.Player.X = this.Map.W * GameConsts.TILE_W / 2.0;
            this.Player.Y = this.Map.H * GameConsts.TILE_H / 2.0;

            {
                Enemy enemy = this.Enemies.Iterate().FirstOrDefault(v => v is Enemy_スタート地点 && ((Enemy_スタート地点)v).Direction == this.Status.StartPointDirection);

                if (enemy != null)
                {
                    this.Player.X = enemy.X;
                    this.Player.Y = enemy.Y;
                }
            }

            // ★★★★★
            // プレイヤー・ステータス反映(マップ入場時)
            // その他の反映箇所:
            // -- マップ退場時
            // -- セーブ時
            {
                this.Player.HP            = this.Status.StartHP;
                this.Player.FaceDirection = this.Status.StartFaceDirection;
                this.Player.選択武器          = this.Status.Start選択武器;
            }

            this.Wall = WallCreator.Create(this.Map.WallName);

            MusicCollection.Get(this.Map.MusicName).Play();

            DDGround.Camera.X = this.Player.X - DDConsts.Screen_W / 2.0;
            DDGround.Camera.Y = this.Player.Y - DDConsts.Screen_H / 2.0;

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

            DDEngine.FreezeInput();

            // TODO: 音楽

            for (this.Frame = 0; ; this.Frame++)
            {
                if (!this.UserInputDisabled && DDInput.PAUSE.GetInput() == 1)
                {
                    this.Pause();

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

                // 死亡時にカメラ移動を止める。
                //if (this.Player.DeadFrame == 0)
                //    this.カメラ位置調整(false);

                this.カメラ位置調整(false);

                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_E) == 1)                 // エディットモード(デバッグ用)
                {
                    this.Edit();
                    this.ReloadEnemies();
                    this.Frame = 0;
                }

                // プレイヤー入力・移動
                {
                    bool deadOrUID = 1 <= this.Player.DeadFrame || this.UserInputDisabled;
                    bool dir2      = !deadOrUID && 1 <= DDInput.DIR_2.GetInput() || this.PlayerHacker.DIR_2;
                    bool dir4      = !deadOrUID && 1 <= DDInput.DIR_4.GetInput() || this.PlayerHacker.DIR_4;
                    bool dir6      = !deadOrUID && 1 <= DDInput.DIR_6.GetInput() || this.PlayerHacker.DIR_6;
                    bool dir8      = !deadOrUID && 1 <= DDInput.DIR_8.GetInput() || this.PlayerHacker.DIR_8;
                    int  dir;                    // 1~9 == { 左下, 下, 右下, 左, 動かない, 右, 左上, 上, 右上 }

                    if (dir2 && dir4)
                    {
                        dir = 1;
                    }
                    else if (dir2 && dir6)
                    {
                        dir = 3;
                    }
                    else if (dir4 && dir8)
                    {
                        dir = 7;
                    }
                    else if (dir6 && dir8)
                    {
                        dir = 9;
                    }
                    else if (dir2)
                    {
                        dir = 2;
                    }
                    else if (dir4)
                    {
                        dir = 4;
                    }
                    else if (dir6)
                    {
                        dir = 6;
                    }
                    else if (dir8)
                    {
                        dir = 8;
                    }
                    else
                    {
                        dir = 5;
                    }

                    if (1 <= this.Player.DamageFrame)                     // ? プレイヤー・ダメージ中
                    {
                        dir = 5;
                    }

                    bool camSlide = !deadOrUID && 1 <= DDInput.L.GetInput();

                    if (camSlide)
                    {
                        dir = 5;
                    }

                    bool slow = !deadOrUID && 1 <= DDInput.A.GetInput() || this.PlayerHacker.Slow;
                    bool fast = !deadOrUID && 1 <= DDInput.R.GetInput() || this.PlayerHacker.Fast;

                    if (Ground.I.FastReverseMode)
                    {
                        fast = !fast;
                    }

                    double speed = 3.0;

                    if (slow)
                    {
                        speed -= 1.0;
                    }

                    if (fast)
                    {
                        speed += 2.0;
                    }

                    double nanameSpeed = speed / Consts.ROOT_OF_2;

                    switch (dir)
                    {
                    case 2:
                        this.Player.Y += speed;
                        break;

                    case 4:
                        this.Player.X -= speed;
                        break;

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

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

                    case 1:
                        this.Player.X -= nanameSpeed;
                        this.Player.Y += nanameSpeed;
                        break;

                    case 3:
                        this.Player.X += nanameSpeed;
                        this.Player.Y += nanameSpeed;
                        break;

                    case 7:
                        this.Player.X -= nanameSpeed;
                        this.Player.Y -= nanameSpeed;
                        break;

                    case 9:
                        this.Player.X += nanameSpeed;
                        this.Player.Y -= nanameSpeed;
                        break;

                    case 5:
                        break;

                    default:
                        throw null;                                 // never
                    }
                    if (dir != 5 && !slow)
                    {
                        this.Player.FaceDirection = dir;
                    }

                    if (dir != 5)
                    {
                        this.Player.MoveFrame++;
                    }
                    else
                    {
                        this.Player.MoveFrame = 0;
                    }

                    if (this.Player.MoveFrame == 0)                     // 立ち止まったら座標を整数に矯正
                    {
                        this.Player.X = SCommon.ToInt(this.Player.X);
                        this.Player.Y = SCommon.ToInt(this.Player.Y);
                    }
                    if (camSlide)
                    {
                        if (dir4)
                        {
                            this.CamSlideCount++;
                            this.CamSlideX--;
                        }
                        if (dir6)
                        {
                            this.CamSlideCount++;
                            this.CamSlideX++;
                        }
                        if (dir8)
                        {
                            this.CamSlideCount++;
                            this.CamSlideY--;
                        }
                        if (dir2)
                        {
                            this.CamSlideCount++;
                            this.CamSlideY++;
                        }
                        DDUtils.ToRange(ref this.CamSlideX, -1, 1);
                        DDUtils.ToRange(ref this.CamSlideY, -1, 1);
                    }
                    else
                    {
                        if (this.CamSlideMode && this.CamSlideCount == 0)
                        {
                            this.CamSlideX = 0;
                            this.CamSlideY = 0;
                        }
                        this.CamSlideCount = 0;
                    }
                    this.CamSlideMode = camSlide;

                    bool attack = !deadOrUID && 1 <= DDInput.B.GetInput() || this.PlayerHacker.Attack;

                    if (attack)
                    {
                        this.Player.AttackFrame++;
                    }
                    else
                    {
                        this.Player.AttackFrame = 0;
                    }

                    bool 武器切り替え = !deadOrUID && DDInput.C.GetInput() == 1;

                    if (武器切り替え)
                    {
                        this.Player.選択武器 = (Player.武器_e)(((int)this.Player.選択武器 + 1) % Player.武器_e_Length);
                    }
                }

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

                    if (GameConsts.PLAYER_DEAD_FRAME_MAX < frame)
                    {
                        this.Player.DeadFrame     = 0;
                        this.Status.ExitDirection = 5;
                        break;
                    }
                    this.Player.DeadFrame++;

                    // ----

                    const int HITBACK_FRAME_MAX = 30;

                    if (frame < HITBACK_FRAME_MAX)
                    {
                        double rate    = (double)frame / HITBACK_FRAME_MAX;
                        double invRate = 1.0 - rate;

                        D2Point speed = GameCommon.GetXYSpeed(this.Player.FaceDirection, 10.0 * invRate);

                        this.Player.X -= speed.X;
                        this.Player.Y -= speed.Y;
                    }
                }
                //endDead:

                //startDamage:
                if (1 <= this.Player.DamageFrame)                 // プレイヤー・ダメージ中の処理
                {
                    int frame = this.Player.DamageFrame - 1;

                    if (GameConsts.PLAYER_DAMAGE_FRAME_MAX < frame)
                    {
                        this.Player.DamageFrame     = 0;
                        this.Player.InvincibleFrame = 1;
                        goto endDamage;
                    }
                    this.Player.DamageFrame++;

                    // ----

                    {
                        D2Point speed = GameCommon.GetXYSpeed(this.Player.FaceDirection, 5.0);

                        for (int c = 0; c < 5; c++)
                        {
                            {
                                int x = SCommon.ToInt(this.Player.X) / GameConsts.TILE_W;
                                int y = SCommon.ToInt(this.Player.Y) / GameConsts.TILE_H;

                                if (this.Map.GetCell(x, y).Tile.GetKind() != Tile.Kind_e.SPACE)                                 // ? 歩行可能な場所ではない -> これ以上ヒットバックさせない。
                                {
                                    break;
                                }
                            }

                            this.Player.X -= speed.X;
                            this.Player.Y -= speed.Y;
                        }
                    }
                }
endDamage:

                //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:

                // プレイヤー位置矯正
                {
                    壁キャラ処理.Perform(ref this.Player.X, ref this.Player.Y, v => v.GetKind() != Tile.Kind_e.SPACE);
                }

                if (this.Player.X < 0.0)                 // ? マップの左側に出た。
                {
                    this.Status.ExitDirection = 4;
                    break;
                }
                if (this.Map.W * GameConsts.TILE_W < this.Player.X)                 // ? マップの右側に出た。
                {
                    this.Status.ExitDirection = 6;
                    break;
                }
                if (this.Player.Y < 0.0)                 // ? マップの上側に出た。
                {
                    this.Status.ExitDirection = 8;
                    break;
                }
                if (this.Map.H * GameConsts.TILE_H < this.Player.Y)                 // ? マップの下側に出た。
                {
                    this.Status.ExitDirection = 2;
                    break;
                }

                // 画面遷移時の微妙なカメラ位置ズレ解消
                // -- 必要無いかもしれないが、念の為実行しておく。
                if (this.Frame == 0)
                {
                    this.カメラ位置調整(true);
                }

                if (1 <= this.Player.AttackFrame)
                {
                    this.Player.Attack();
                }

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

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

                this.DrawWall();
                this.DrawMap();
                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 (this.当たり判定表示)
                {
                    // 最後に描画されるように DDGround.EL.Add() する。

                    DDGround.EL.Add(() =>
                    {
                        DDCurtain.DrawCurtain(-0.8);

                        const double A = 0.3;

                        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);

                        return(false);
                    });
                }

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

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

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    if (1 <= enemy.HP)                     // ? 敵:生存 && 無敵ではない
                    {
                        foreach (Shot shot in this.Shots.Iterate())
                        {
                            // 衝突判定:敵 x 自弾
                            if (
                                !shot.DeadFlag &&                                 // ? 自弾:生存
                                enemy.Crash.IsCrashed(shot.Crash)                 // ? 衝突
                                )
                            {
                                // ★ 敵_被弾ここから

                                if (!shot.敵を貫通する)
                                {
                                    shot.Kill();
                                }

                                enemy.HP -= shot.AttackPoint;

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

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

                    // 衝突判定:敵 x 自機
                    if (
                        this.Player.DeadFrame == 0 &&                // ? プレイヤー死亡中ではない。
                        this.Player.DamageFrame == 0 &&              // ? プレイヤー・ダメージ中ではない。
                        this.Player.InvincibleFrame == 0 &&          // ? プレイヤー無敵時間中ではない。
                        !enemy.DeadFlag &&                           // ? 敵:生存
                        DDCrashUtils.IsCrashed(enemy.Crash, plCrash) // ? 衝突
                        )
                    {
                        // ★ 自機_被弾ここから

                        if (enemy.自機に当たると消滅する)
                        {
                            enemy.Kill();
                        }

                        this.Player.HP -= enemy.AttackPoint;

                        if (1 <= this.Player.HP)                         // ? まだ生存している。
                        {
                            this.Player.DamageFrame = 1;
                        }
                        else                         // ? 死亡した。
                        {
                            this.Player.HP        = -1;
                            this.Player.DeadFrame = 1;
                        }

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

                foreach (Shot shot in this.Shots.Iterate())
                {
                    // 壁への当たり判定は自弾の「中心座標のみ」であることに注意して下さい。

                    if (
                        !shot.DeadFlag &&                                                                            // ? 自弾:生存
                        !shot.壁をすり抜ける &&                                                                             // ? この自弾は壁に当たる。
                        this.Map.GetCell(GameCommon.ToTablePoint(shot.X, shot.Y)).Tile.GetKind() == Tile.Kind_e.WALL // ? 壁に当たった。
                        )
                    {
                        shot.Kill();
                    }
                }

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

                f_ゴミ回収();

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

                DDEngine.EachFrame();

                // ★★★ ゲームループの終わり ★★★
            }
            DDEngine.FreezeInput();

            if (this.Status.ExitDirection == 5)
            {
                DDMusicUtils.Fade();
                DDCurtain.SetCurtain(30, -1.0);

                foreach (DDScene scene in DDSceneUtils.Create(40))
                {
                    this.DrawWall();
                    this.DrawMap();

                    DDEngine.EachFrame();
                }
            }
            else
            {
                double destSlide_X = 0.0;
                double destSlide_Y = 0.0;

                switch (this.Status.ExitDirection)
                {
                case 4:
                    destSlide_X = DDConsts.Screen_W;
                    break;

                case 6:
                    destSlide_X = -DDConsts.Screen_W;
                    break;

                case 8:
                    destSlide_Y = DDConsts.Screen_H;
                    break;

                case 2:
                    destSlide_Y = -DDConsts.Screen_H;
                    break;

                default:
                    throw null;                             // never
                }
                using (DDSubScreen wallMapScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H))
                {
                    using (wallMapScreen.Section())
                    {
                        this.DrawWall();
                        this.DrawMap();
                    }
                    foreach (DDScene scene in DDSceneUtils.Create(30))
                    {
                        double slide_X = destSlide_X * scene.Rate;
                        double slide_Y = destSlide_Y * scene.Rate;

                        DDCurtain.DrawCurtain();
                        DDDraw.DrawSimple(wallMapScreen.ToPicture(), slide_X, slide_Y);

                        DDEngine.EachFrame();
                    }
                }
                DDCurtain.SetCurtain(0, -1.0);
            }

            // ★★★★★
            // プレイヤー・ステータス反映(マップ退場時)
            // その他の反映箇所:
            // -- マップ入場時
            // -- セーブ時
            {
                this.Status.StartHP            = this.Player.HP;
                this.Status.StartFaceDirection = this.Player.FaceDirection;
                this.Status.Start選択武器          = this.Player.選択武器;
            }

            // ★★★ end of Perform() ★★★
        }
コード例 #9
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() ★★★
        }
コード例 #10
0
        public void Perform()
        {
            Func <bool> f_ゴミ回収 = SCommon.Supplier(this.E_ゴミ回収());

            this.Map = new Map(GameCommon.GetMapFile(this.World.GetCurrMapName()));
            this.ReloadEnemies();

            // デフォルトの「プレイヤーのスタート地点」
            // -- マップの中央
            this.Player.X = this.Map.W * GameConsts.TILE_W / 2.0;
            this.Player.Y = this.Map.H * GameConsts.TILE_H / 2.0;

            {
                Enemy enemy = this.Enemies.Iterate().FirstOrDefault(v => v is Enemy_スタート地点 && ((Enemy_スタート地点)v).Direction == this.Status.StartPointDirection);

                if (enemy != null)
                {
                    this.Player.X = enemy.X;
                    this.Player.Y = enemy.Y;
                }
            }

            // ★★★★★
            // プレイヤー・ステータス反映(マップ入場時)
            // その他の反映箇所:
            // -- マップ退場時
            // -- セーブ時
            {
                this.Player.HP         = this.Status.StartHP;
                this.Player.FacingLeft = this.Status.StartFacingLeft;
                this.Player.武器         = this.Status.Start_武器;
            }

            this.Wall = WallCreator.Create(this.Map.WallName);

            MusicCollection.Get(this.Map.MusicName).Play();

            DDGround.Camera.X = this.Player.X - DDConsts.Screen_W / 2.0;
            DDGround.Camera.Y = this.Player.Y - DDConsts.Screen_H / 2.0;

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

            DDEngine.FreezeInput();

            bool jumpLock = false;             // ? ジャンプ・ロック // ジャンプしたらボタンを離すまでロックする。

            for (this.Frame = 0; ; this.Frame++)
            {
                if (!this.UserInputDisabled && DDInput.PAUSE.GetInput() == 1)
                {
                    this.Pause();

                    if (this.Pause_ReturnToTitleMenu)
                    {
                        this.Status.ExitDirection = 5;
                        break;
                    }
                }
                if (this.RequestReturnToTitleMenu)
                {
                    this.Status.ExitDirection = 5;
                    break;
                }
                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_RETURN) == 1)
                {
                    this.DebugPause();
                }

                // 死亡時にカメラ移動を止める。
                //if (this.Player.DeadFrame == 0)
                //    this.カメラ位置調整(false);

                this.カメラ位置調整(false);

                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_E) == 1)                 // エディットモード(デバッグ用)
                {
                    this.Edit();
                    this.ReloadEnemies();
                    this.Frame = 0;
                }

                // プレイヤー入力
                {
                    bool deadOrDamageOrUID = 1 <= this.Player.DeadFrame || 1 <= this.Player.DamageFrame || this.UserInputDisabled;
                    bool move     = false;
                    bool slow     = false;
                    bool camSlide = false;
                    int  jump     = 0;
                    bool shagami  = false;
                    bool attack   = false;

                    if (!deadOrDamageOrUID && 1 <= DDInput.DIR_2.GetInput() || this.PlayerHacker.DIR_2)
                    {
                        shagami = true;
                    }

                    // 入力抑止中であるか否かに関わらず左右の入力は受け付ける様にする。
                    int freezeInputFrameBackup = DDEngine.FreezeInputFrame;
                    DDEngine.FreezeInputFrame = 0;

                    if (!deadOrDamageOrUID && 1 <= DDInput.DIR_4.GetInput() || this.PlayerHacker.DIR_4)
                    {
                        this.Player.FacingLeft = true;
                        move = true;
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.DIR_6.GetInput() || this.PlayerHacker.DIR_6)
                    {
                        this.Player.FacingLeft = false;
                        move = true;
                    }

                    DDEngine.FreezeInputFrame = freezeInputFrameBackup;                     // restore

                    if (1 <= DDInput.L.GetInput())
                    {
                        move     = false;
                        shagami  = false;
                        camSlide = true;
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.R.GetInput() || this.PlayerHacker.Slow)
                    {
                        slow = true;
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.A.GetInput())
                    {
                        jump = DDInput.A.GetInput();
                    }
                    if (this.PlayerHacker.Jump != 0)
                    {
                        jump = this.PlayerHacker.Jump;
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.B.GetInput() || this.PlayerHacker.Attack)
                    {
                        attack = true;
                    }

                    if (move)
                    {
                        this.Player.MoveFrame++;
                        shagami = false;
                    }
                    else
                    {
                        this.Player.MoveFrame = 0;
                    }

                    this.Player.MoveSlow = move && slow;

                    if (jump == 0)
                    {
                        jumpLock = false;
                    }

                    if (1 <= this.Player.JumpFrame)
                    {
                        const int JUMP_FRAME_MAX = 22;

                        if (1 <= jump && this.Player.JumpFrame < JUMP_FRAME_MAX)
                        {
                            this.Player.JumpFrame++;
                        }
                        else
                        {
                            this.Player.JumpFrame = 0;
                        }
                    }
                    else
                    {
                        // 事前入力 == 着地前の数フレーム間にジャンプボタンを押し始めてもジャンプできるようにする。
                        // 入力猶予 == 落下(地面から離れた)直後の数フレーム間にジャンプボタンを押し始めてもジャンプできるようにする。

                        const int 事前入力時間 = 5;
                        const int 入力猶予時間 = 5;

                        if (1 <= jump && jump < 事前入力時間 && this.Player.AirborneFrame < 入力猶予時間 && this.Player.JumpCount == 0 && !jumpLock)
                        {
                            this.Player.JumpCount = 1;
                            this.Player.JumpFrame = 1;
                            jumpLock = true;
                        }
                    }

                    if (this.Player.JumpFrame == 1)                     // ? ジャンプ開始
                    {
                        Ground.I.SE.PlayerJump.Play();
                    }

                    if (camSlide)
                    {
                        if (DDInput.DIR_4.IsPound())
                        {
                            this.CamSlideCount++;
                            this.CamSlideX--;
                        }
                        if (DDInput.DIR_6.IsPound())
                        {
                            this.CamSlideCount++;
                            this.CamSlideX++;
                        }
                        if (DDInput.DIR_8.IsPound())
                        {
                            this.CamSlideCount++;
                            this.CamSlideY--;
                        }
                        if (DDInput.DIR_2.IsPound())
                        {
                            this.CamSlideCount++;
                            this.CamSlideY++;
                        }
                        DDUtils.ToRange(ref this.CamSlideX, -1, 1);
                        DDUtils.ToRange(ref this.CamSlideY, -1, 1);
                    }
                    else
                    {
                        if (this.CamSlideMode && this.CamSlideCount == 0)
                        {
                            this.CamSlideX = 0;
                            this.CamSlideY = 0;
                        }
                        this.CamSlideCount = 0;
                    }
                    this.CamSlideMode = camSlide;

                    if (1 <= this.Player.AirborneFrame)
                    {
                        shagami = false;
                    }

                    if (shagami)
                    {
                        this.Player.ShagamiFrame++;
                    }
                    else
                    {
                        this.Player.ShagamiFrame = 0;
                    }

                    if (attack)
                    {
                        this.Player.AttackFrame++;
                    }
                    else
                    {
                        this.Player.AttackFrame = 0;
                    }
                }

                //startDead:
                if (1 <= this.Player.DeadFrame)                 // プレイヤー死亡中の処理
                {
                    if (GameConsts.PLAYER_DEAD_FRAME_MAX < ++this.Player.DeadFrame)
                    {
                        this.Player.DeadFrame     = 0;
                        this.Status.ExitDirection = 5;
                        break;
                    }
                    int    frame = this.Player.DeadFrame;                  // 値域 == 2 ~ GameConsts.PLAYER_DEAD_FRAME_MAX
                    double rate  = DDUtils.RateAToB(2, GameConsts.PLAYER_DEAD_FRAME_MAX, frame);

                    // ---- Dead

                    const int HIT_BACK_FRAME_MAX = 30;

                    if (frame < HIT_BACK_FRAME_MAX)
                    {
                        double hitBackRate = (double)frame / HIT_BACK_FRAME_MAX;

                        this.Player.X -= 10.0 * (1.0 - hitBackRate) * (this.Player.FacingLeft ? -1 : 1);
                    }
                }
                //endDead:

                //startDamage:
                if (1 <= this.Player.DamageFrame)                 // プレイヤー・ダメージ中の処理
                {
                    if (GameConsts.PLAYER_DAMAGE_FRAME_MAX < ++this.Player.DamageFrame)
                    {
                        this.Player.DamageFrame     = 0;
                        this.Player.InvincibleFrame = 1;
                        goto endDamage;
                    }
                    int    frame = this.Player.DamageFrame;                  // 値域 == 2 ~ GameConsts.PLAYER_DAMAGE_FRAME_MAX
                    double rate  = DDUtils.RateAToB(2, GameConsts.PLAYER_DAMAGE_FRAME_MAX, frame);

                    // ---- Damage

                    this.Player.X -= (9.0 - 6.0 * rate) * (this.Player.FacingLeft ? -1 : 1);
                }
endDamage:

                //startInvincible:
                if (1 <= this.Player.InvincibleFrame)                 // プレイヤー無敵時間中の処理
                {
                    if (GameConsts.PLAYER_INVINCIBLE_FRAME_MAX < ++this.Player.InvincibleFrame)
                    {
                        this.Player.InvincibleFrame = 0;
                        goto endInvincible;
                    }
                    int    frame = this.Player.InvincibleFrame;                  // 値域 == 2 ~ GameConsts.PLAYER_INVINCIBLE_FRAME_MAX
                    double rate  = DDUtils.RateAToB(2, GameConsts.PLAYER_INVINCIBLE_FRAME_MAX, frame);

                    // ---- Invincible

                    // noop
                }
endInvincible:

                // プレイヤー移動
                {
                    if (1 <= this.Player.MoveFrame)
                    {
                        double speed = 0.0;

                        if (this.Player.MoveSlow)
                        {
                            speed = this.Player.MoveFrame * 0.2;
                            DDUtils.Minim(ref speed, GameConsts.PLAYER_SLOW_SPEED);
                        }
                        else
                        {
                            speed = GameConsts.PLAYER_SPEED;
                        }

                        speed *= this.Player.FacingLeft ? -1 : 1;

                        this.Player.X += speed;
                    }
                    else
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X);
                    }

                    if (1 <= this.Player.JumpFrame)
                    {
                        this.Player.YSpeed = GameConsts.PLAYER_ジャンプによる上昇速度;
                    }
                    else
                    {
                        this.Player.YSpeed += GameConsts.PLAYER_GRAVITY;
                    }

                    DDUtils.Minim(ref this.Player.YSpeed, GameConsts.PLAYER_FALL_SPEED_MAX);

                    this.Player.Y += this.Player.YSpeed;                     // 自由落下
                }

                // プレイヤー位置矯正
                {
                    bool touchSide_L =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_側面判定Pt_X, this.Player.Y - GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_側面判定Pt_X, this.Player.Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_側面判定Pt_X, this.Player.Y + GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall();

                    bool touchSide_R =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_側面判定Pt_X, this.Player.Y - GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_側面判定Pt_X, this.Player.Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_側面判定Pt_X, this.Player.Y + GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall();

                    if (touchSide_L && touchSide_R)                     // -> 壁抜け防止のため再チェック
                    {
                        touchSide_L = this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_側面判定Pt_X, this.Player.Y)).Tile.IsWall();
                        touchSide_R = this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_側面判定Pt_X, this.Player.Y)).Tile.IsWall();
                    }

                    if (touchSide_L && touchSide_R)
                    {
                        // noop
                    }
                    else if (touchSide_L)
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X / GameConsts.TILE_W) * GameConsts.TILE_W + GameConsts.PLAYER_側面判定Pt_X;
                    }
                    else if (touchSide_R)
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X / GameConsts.TILE_W) * GameConsts.TILE_W - GameConsts.PLAYER_側面判定Pt_X;
                    }

                    bool touchCeiling_L =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_脳天判定Pt_X, this.Player.Y - GameConsts.PLAYER_脳天判定Pt_Y)).Tile.IsWall();

                    bool touchCeiling_R =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_脳天判定Pt_X, this.Player.Y - GameConsts.PLAYER_脳天判定Pt_Y)).Tile.IsWall();

                    if (touchCeiling_L && touchCeiling_R)
                    {
                        if (this.Player.YSpeed < 0.0)
                        {
                            double plY = ((int)((this.Player.Y - GameConsts.PLAYER_脳天判定Pt_Y) / GameConsts.TILE_H) + 1) * GameConsts.TILE_H + GameConsts.PLAYER_脳天判定Pt_Y;

                            this.Player.Y         = plY;
                            this.Player.YSpeed    = 0.0;
                            this.Player.JumpFrame = 0;
                        }
                    }
                    else if (touchCeiling_L)
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X / GameConsts.TILE_W) * GameConsts.TILE_W + GameConsts.PLAYER_脳天判定Pt_X;
                    }
                    else if (touchCeiling_R)
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X / GameConsts.TILE_W) * GameConsts.TILE_W - GameConsts.PLAYER_脳天判定Pt_X;
                    }

                    bool touchGround =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_接地判定Pt_X, this.Player.Y + GameConsts.PLAYER_接地判定Pt_Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_接地判定Pt_X, this.Player.Y + GameConsts.PLAYER_接地判定Pt_Y)).Tile.IsWall();

                    if (touchGround)
                    {
                        if (0.0 < this.Player.YSpeed)
                        {
                            double plY = (int)((this.Player.Y + GameConsts.PLAYER_接地判定Pt_Y) / GameConsts.TILE_H) * GameConsts.TILE_H - GameConsts.PLAYER_接地判定Pt_Y;

                            this.Player.Y      = plY;
                            this.Player.YSpeed = 0.0;
                        }
                    }

                    if (touchGround)
                    {
                        this.Player.JumpCount     = 0;
                        this.Player.AirborneFrame = 0;
                    }
                    else
                    {
                        this.Player.AirborneFrame++;
                    }
                }
                //endPlayer:

                if (this.Player.X < 0.0)                 // ? マップの左側に出た。
                {
                    this.Status.ExitDirection = 4;
                    break;
                }
                if (this.Map.W * GameConsts.TILE_W < this.Player.X)                 // ? マップの右側に出た。
                {
                    this.Status.ExitDirection = 6;
                    break;
                }
                if (this.Player.Y < 0.0)                 // ? マップの上側に出た。
                {
                    this.Status.ExitDirection = 8;
                    break;
                }
                if (this.Map.H * GameConsts.TILE_H < this.Player.Y)                 // ? マップの下側に出た。
                {
                    this.Status.ExitDirection = 2;
                    break;
                }

                // 画面遷移時の微妙なカメラ位置ズレ解消
                // -- スタート地点(入場地点)が地面と接していると、最初のフレームでプレイヤーは上に押し出されてカメラの初期位置とズレてしまう。
                if (this.Frame == 0 || this.次のカメラ位置調整を一瞬で)
                {
                    this.次のカメラ位置調整を一瞬で = false;
                    this.カメラ位置調整(true);
                }

                if (1 <= this.Player.AttackFrame)
                {
                    this.Player.Attack();
                }

                DDCrash plCrash = DDCrashUtils.Point(new D2Point(this.Player.X, this.Player.Y + (1 <= this.Player.ShagamiFrame ? 16 : 0)));

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

                this.DrawWall();
                this.DrawMap();
                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 (this.当たり判定表示)
                {
                    // 最後に描画されるように DDGround.EL.Add() する。

                    DDGround.EL.Add(() =>
                    {
                        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);

                        return(false);
                    });
                }

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

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

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    if (1 <= enemy.HP)                     // ? 敵:生存 && 無敵ではない
                    {
                        foreach (Shot shot in this.Shots.Iterate())
                        {
                            // 衝突判定:敵 x 自弾
                            if (
                                !shot.DeadFlag &&                                 // ? 自弾:生存
                                enemy.Crash.IsCrashed(shot.Crash)                 // ? 衝突
                                )
                            {
                                // ★ 敵_被弾ここから

                                enemy.HP -= shot.AttackPoint;

                                if (!shot.敵を貫通する)                                 // 自弾の攻撃力と敵のHPを相殺
                                {
                                    if (0 <= enemy.HP)                            // ? 丁度削りきった || 削りきれなかった -> 攻撃力を使い果たしたので、ショットは消滅
                                    {
                                        shot.Kill();
                                    }
                                    else
                                    {
                                        shot.AttackPoint = -enemy.HP;                                         // 過剰に削った分を残りの攻撃力として反映
                                    }
                                }

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

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

                    // 衝突判定:敵 x 自機
                    if (
                        this.Player.DeadFrame == 0 &&                // ? プレイヤー死亡中ではない。
                        this.Player.DamageFrame == 0 &&              // ? プレイヤー・ダメージ中ではない。
                        this.Player.InvincibleFrame == 0 &&          // ? プレイヤー無敵時間中ではない。
                        !enemy.DeadFlag &&                           // ? 敵:生存
                        DDCrashUtils.IsCrashed(enemy.Crash, plCrash) // ? 衝突
                        )
                    {
                        // ★ 自機_被弾ここから

                        if (enemy.自機に当たると消滅する)
                        {
                            enemy.Kill();
                        }

                        this.Player.HP -= enemy.AttackPoint;

                        if (1 <= this.Player.HP)                         // ? まだ生存している。
                        {
                            this.Player.DamageFrame = 1;
                        }
                        else                         // ? 死亡した。
                        {
                            this.Player.HP        = -1;
                            this.Player.DeadFrame = 1;
                        }

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

                foreach (Shot shot in this.Shots.Iterate())
                {
                    // 壁への当たり判定は自弾の「中心座標のみ」であることに注意して下さい。

                    if (
                        !shot.DeadFlag &&                                                       // ? 自弾:生存
                        !shot.壁をすり抜ける &&                                                        // ? この自弾は壁に当たる。
                        this.Map.GetCell(GameCommon.ToTablePoint(shot.X, shot.Y)).Tile.IsWall() // ? 壁に当たった。
                        )
                    {
                        shot.Kill();
                    }
                }

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

                f_ゴミ回収();

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

                DDEngine.EachFrame();

                // ★★★ ゲームループの終わり ★★★
            }
            DDEngine.FreezeInput();

            if (this.Status.ExitDirection == 5)
            {
                DDMusicUtils.Fade();
                DDCurtain.SetCurtain(30, -1.0);

                foreach (DDScene scene in DDSceneUtils.Create(40))
                {
                    this.DrawWall();
                    this.DrawMap();

                    DDEngine.EachFrame();
                }
            }
            else
            {
                double destSlide_X = 0.0;
                double destSlide_Y = 0.0;

                switch (this.Status.ExitDirection)
                {
                case 4:
                    destSlide_X = DDConsts.Screen_W;
                    break;

                case 6:
                    destSlide_X = -DDConsts.Screen_W;
                    break;

                case 8:
                    destSlide_Y = DDConsts.Screen_H;
                    break;

                case 2:
                    destSlide_Y = -DDConsts.Screen_H;
                    break;

                default:
                    throw null;                             // never
                }
                using (DDSubScreen wallMapScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H))
                {
                    using (wallMapScreen.Section())
                    {
                        this.DrawWall();
                        this.DrawMap();
                    }
                    foreach (DDScene scene in DDSceneUtils.Create(30))
                    {
                        double slide_X = destSlide_X * scene.Rate;
                        double slide_Y = destSlide_Y * scene.Rate;

                        DDCurtain.DrawCurtain();
                        DDDraw.DrawSimple(wallMapScreen.ToPicture(), slide_X, slide_Y);

                        DDEngine.EachFrame();
                    }
                }
                DDCurtain.SetCurtain(0, -1.0);
            }

            // ★★★★★
            // プレイヤー・ステータス反映(マップ退場時)
            // その他の反映箇所:
            // -- マップ入場時
            // -- セーブ時
            {
                this.Status.StartHP         = this.Player.HP;
                this.Status.StartFacingLeft = this.Player.FacingLeft;
                this.Status.Start_武器        = this.Player.武器;
            }

            // ★★★ end of Perform() ★★★
        }
コード例 #11
0
        private bool ControlSkipMode = false;         // ? コントロールキー押下によるスキップモード中

        public override IEnumerable <bool> E_Draw()
        {
            for (; ;)
            {
                // 入力:スキップモード・オートモード_解除
                if (
                    DDMouse.Rot != 0 ||
                    DDMouse.L.GetInput() == -1 && Game.I.SelectedSystemButtonIndex == -1 ||                     // システムボタン以外を左クリック
                    DDMouse.R.GetInput() == -1 ||
                    DDInput.A.GetInput() == 1
                    )
                {
                    Game.I.CancelSkipAutoMode();
                }

                // 入力:スキップモード
                if (1 <= DDInput.L.GetInput())
                {
                    Game.I.SkipMode      = true;
                    this.ControlSkipMode = true;
                }
                else
                {
                    if (this.ControlSkipMode)
                    {
                        Game.I.SkipMode      = false;
                        this.ControlSkipMode = false;
                    }
                }

                // ---- ここから描画

                DDUtils.Approach(ref this.A, Hide ? 0.0 : 1.0, 0.9);

                var buttons = new[]
                {
                    // p: 画像, fp: フォーカス時の画像, oh: オプショナル・ハイライト
                    new { p = Ground.I.Picture.MessageFrame_Save, fp = Ground.I.Picture.MessageFrame_Save2, oh = false },
                    new { p = Ground.I.Picture.MessageFrame_Load, fp = Ground.I.Picture.MessageFrame_Load2, oh = false },
                    new { p = Ground.I.Picture.MessageFrame_Skip, fp = Ground.I.Picture.MessageFrame_Skip2, oh = Game.I.SkipMode },
                    new { p = Ground.I.Picture.MessageFrame_Auto, fp = Ground.I.Picture.MessageFrame_Auto2, oh = Game.I.AutoMode },
                    new { p = Ground.I.Picture.MessageFrame_Log, fp = Ground.I.Picture.MessageFrame_Log2, oh = false },
                    new { p = Ground.I.Picture.MessageFrame_Menu, fp = Ground.I.Picture.MessageFrame_Menu2, oh = false },
                };

                int selSysBtnIdx = -1;

                for (int index = 0; index < buttons.Length; index++)
                {
                    bool focused = index == Game.I.SelectedSystemButtonIndex;

                    DDDraw.SetAlpha(this.A * (focused ? 1.0 : Ground.I.MessageWindow_A_Pct / 100.0));
                    DDDraw.DrawBegin(
                        focused || buttons[index].oh ? buttons[index].fp : buttons[index].p,
                        GameConsts.SYSTEM_BUTTON_X + index * GameConsts.SYSTEM_BUTTON_X_STEP,
                        GameConsts.SYSTEM_BUTTON_Y
                        );
                    DDDraw.DrawZoom(2.0);
                    DDCrash drawedCrash = DDDraw.DrawGetCrash();
                    DDDraw.DrawEnd();
                    DDDraw.Reset();

                    if (drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
                    {
                        selSysBtnIdx = index;
                    }
                }
                Game.I.SelectedSystemButtonIndex = selSysBtnIdx;

                // 隠しているなら選択出来ない。
                if (Hide)
                {
                    Game.I.SelectedSystemButtonIndex = -1;
                }

                yield return(true);
            }
        }
コード例 #12
0
        public override IEnumerable <bool> E_Draw()
        {
            Game.I.SkipMode = false;

            for (; ;)
            {
                //Game.I.CancelSkipAutoMode();

                if (
                    this.Options.Count < GameConsts.SELECT_OPTION_MIN ||
                    this.Options.Count > GameConsts.SELECT_OPTION_MAX
                    )
                {
                    throw new DDError("選択肢の個数に問題があります。");
                }

                // ---- 入力ここから

                if (!Game.I.BacklogMode)
                {
                    int moving = 0;

                    if (DDInput.DIR_8.IsPound())
                    {
                        moving = -1;
                    }

                    if (DDInput.DIR_2.IsPound())
                    {
                        moving = 1;
                    }

                    if (moving != 0)
                    {
                        int optIndex = this.GetMouseFocusedIndex();

                        if (optIndex == -1)
                        {
                            optIndex = 0;
                        }
                        else
                        {
                            optIndex += this.Options.Count + moving;
                            optIndex %= this.Options.Count;
                        }

                        DDMouse.X =
                            GameConsts.SELECT_FRAME_L +
                            Ground.I.Picture.MessageFrame_Button2.Get_W() * 2 -
                            10;
                        DDMouse.Y =
                            GameConsts.SELECT_FRAME_T + GameConsts.SELECT_FRAME_T_STEP * optIndex +
                            Ground.I.Picture.MessageFrame_Button2.Get_H() * 2 -
                            10;

                        DDMouse.PosChanged();
                    }
                }

                // ---- ここから描画

                if (!Hide)
                {
                    for (int index = 0; index < GameConsts.SELECT_FRAME_NUM; index++)
                    {
                        DDPicture picture = Ground.I.Picture.MessageFrame_Button;

                        if (index < this.Options.Count)
                        {
                            picture = Ground.I.Picture.MessageFrame_Button2;

                            if (this.Options[index].MouseFocused)
                            {
                                picture = Ground.I.Picture.MessageFrame_Button3;
                            }
                        }

                        DDDraw.DrawBeginRect(
                            picture,
                            GameConsts.SELECT_FRAME_L,
                            GameConsts.SELECT_FRAME_T + GameConsts.SELECT_FRAME_T_STEP * index,
                            picture.Get_W() * 2.0,
                            picture.Get_H() * 2.0
                            );
                        DDCrash drawedCrash = DDDraw.DrawGetCrash();
                        DDDraw.DrawEnd();

                        // フォーカスしている選択項目を再設定
                        {
                            if (index < this.Options.Count)
                            {
                                bool mouseIn = drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y)));

                                this.Options[index].MouseFocused = mouseIn;
                            }
                        }
                    }
                    for (int index = 0; index < this.Options.Count; index++)
                    {
                        const int title_x = 160;
                        const int title_y = 56;

                        DDFontUtils.DrawString(
                            GameConsts.SELECT_FRAME_L + title_x,
                            GameConsts.SELECT_FRAME_T + GameConsts.SELECT_FRAME_T_STEP * index + title_y,
                            this.Options[index].Title,
                            DDFontUtils.GetFont("Kゴシック", 32),
                            false,
                            new I3Color(110, 100, 90)
                            );
                    }
                }

                // 隠しているなら選択出来ない。
                if (Hide)
                {
                    foreach (OptionInfo option in this.Options)
                    {
                        option.MouseFocused = false;
                    }
                }

                yield return(true);
            }
        }
コード例 #13
0
        public void Perform()
        {
            Func <bool> f_ゴミ回収 = SCommon.Supplier(this.E_ゴミ回収());

            this.Map = new Map(GameCommon.GetMapFile(this.World.GetCurrMapName()));
            this.ReloadEnemies();

            // デフォルトの「プレイヤーのスタート地点」
            // -- マップの中央
            this.Player.X = this.Map.W * GameConsts.TILE_W / 2.0;
            this.Player.Y = this.Map.H * GameConsts.TILE_H / 2.0;

            {
                Enemy enemy = this.Enemies.Iterate().FirstOrDefault(v => v is Enemy_スタート地点 && ((Enemy_スタート地点)v).Direction == this.Status.StartPointDirection);

                if (enemy != null)
                {
                    this.Player.X = enemy.X;
                    this.Player.Y = enemy.Y;
                }
            }

            // ★★★★★
            // プレイヤー・ステータス反映(マップ入場時)
            // その他の反映箇所:
            // -- マップ退場時
            // -- セーブ時
            {
                this.Player.Chara      = this.Status.StartChara;
                this.Player.HP         = this.Status.StartHP;
                this.Player.FacingLeft = this.Status.StartFacingLeft;
            }

            this.Wall = WallCreator.Create(this.Map.WallName);

            MusicCollection.Get(this.Map.MusicName).Play();

            DDGround.Camera.X = this.Player.X - DDConsts.Screen_W / 2.0;
            DDGround.Camera.Y = this.Player.Y - DDConsts.Screen_H / 2.0;

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

            DDEngine.FreezeInput();

            for (this.Frame = 0; ; this.Frame++)
            {
                // Attack_ほむらシールド 終了から Shot_ほむらシールド の PlayerTracer.Start 実行の間に
                // ポーズできるタイミングは無いはずだけど、曲芸的で気持ち悪い。

                if (
                    !this.UserInputDisabled &&
                    //Game.I.Player.Attack == null && // ? プレイヤーの攻撃モーション中ではない。// モーション中でも良いはず!
                    DDInput.PAUSE.GetInput() == 1
                    )
                {
                    this.Pause();

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

                // 死亡時にカメラ移動を止める。
                //if (this.Player.DeadFrame == 0)
                //    this.カメラ位置調整(false);

                this.カメラ位置調整(false);

                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_E) == 1)                 // エディットモード(デバッグ用)
                {
                    this.Edit();
                    this.ReloadEnemies();
                    this.Frame = 0;
                }

                if (this.Player.Attack != null)                 // プレイヤー攻撃中
                {
                    if (this.Player.Attack.EachFrame())         // ? このプレイヤー攻撃を継続する。
                    {
                        goto endPlayer;
                    }

                    this.Player.Attack = null;                     // プレイヤー攻撃_終了
                }

                // プレイヤー入力
                {
                    bool deadOrDamageOrUID = 1 <= this.Player.DeadFrame || 1 <= this.Player.DamageFrame || this.UserInputDisabled;
                    bool move           = false;
                    bool slow           = false;
                    bool camSlide       = false;
                    int  jump           = 0;
                    bool shagami        = false;
                    int  attack         = 0;
                    int  extendedAttack = 0;

                    if (!deadOrDamageOrUID && 1 <= DDInput.DIR_2.GetInput())
                    {
                        shagami = true;
                    }

                    // 入力抑止中であるか否かに関わらず左右の入力は受け付ける様にする。
                    int freezeInputFrameBackup = DDEngine.FreezeInputFrame;
                    DDEngine.FreezeInputFrame = 0;

                    if (!deadOrDamageOrUID && 1 <= DDInput.DIR_4.GetInput())
                    {
                        this.Player.FacingLeft = true;
                        move = true;
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.DIR_6.GetInput())
                    {
                        this.Player.FacingLeft = false;
                        move = true;
                    }

                    DDEngine.FreezeInputFrame = freezeInputFrameBackup;                     // restore

                    if (1 <= DDInput.L.GetInput())
                    {
                        move     = false;
                        camSlide = true;
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.R.GetInput())
                    {
                        slow = true;
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.A.GetInput())
                    {
                        jump = DDInput.A.GetInput();
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.B.GetInput())
                    {
                        attack = DDInput.B.GetInput();
                    }
                    if (!deadOrDamageOrUID && 1 <= DDInput.C.GetInput())
                    {
                        extendedAttack = DDInput.C.GetInput();
                    }

                    if (move)
                    {
                        this.Player.MoveFrame++;
                        shagami = false;
                    }
                    else
                    {
                        this.Player.MoveFrame = 0;
                    }

                    this.Player.MoveSlow = move && slow;

                    if (1 <= this.Player.JumpFrame)
                    {
                        if (1 <= jump)
                        {
                            this.Player.JumpFrame++;
                        }
                        else
                        {
                            // ★ ジャンプを中断・終了した。

                            this.Player.JumpFrame = 0;

                            if (this.Player.YSpeed < 0.0)
                            {
                                this.Player.YSpeed /= 2.0;
                            }
                        }
                    }
                    else
                    {
                        // 事前入力 == 着地前の数フレーム間にジャンプボタンを押し始めてもジャンプできるようにする。
                        // 入力猶予 == 落下(地面から離れた)直後の数フレーム間にジャンプボタンを押し始めてもジャンプできるようにする。

                        const int 事前入力時間 = 5;
                        const int 入力猶予時間 = 10;

                        if (this.Player.AirborneFrame < 入力猶予時間)                         // ? 接地状態からのジャンプが可能な状態
                        {
                            if (1 <= jump && jump < 事前入力時間)
                            {
                                // ★ ジャンプを開始した。

                                this.Player.JumpFrame = 1;
                                this.Player.JumpCount = 1;

                                this.Player.YSpeed = GameConsts.PLAYER_ジャンプ初速度;
                            }
                            else
                            {
                                this.Player.JumpCount = 0;
                            }
                        }
                        else                         // ? 接地状態からのジャンプが「可能ではない」状態
                        {
                            // 滞空状態に入ったら「通常ジャンプの状態」にする。
                            if (this.Player.JumpCount < 1)
                            {
                                this.Player.JumpCount = 1;
                            }

                            if (1 <= jump && jump < 事前入力時間 && this.Player.JumpCount < GameConsts.JUMP_MAX)
                            {
                                // ★ 空中(n-段)ジャンプを開始した。

                                this.Player.JumpFrame = 1;
                                this.Player.JumpCount++;

                                this.Player.YSpeed = GameConsts.PLAYER_ジャンプ初速度;

                                DDGround.EL.Add(SCommon.Supplier(Effects.空中ジャンプの足場(this.Player.X, this.Player.Y + 48)));
                            }
                            else
                            {
                                // noop
                            }
                        }
                    }

                    if (camSlide)
                    {
                        if (DDInput.DIR_4.IsPound())
                        {
                            this.CamSlided = true;
                            this.CamSlideX--;
                        }
                        if (DDInput.DIR_6.IsPound())
                        {
                            this.CamSlided = true;
                            this.CamSlideX++;
                        }
                        if (DDInput.DIR_8.IsPound())
                        {
                            this.CamSlided = true;
                            this.CamSlideY--;
                        }
                        if (DDInput.DIR_2.IsPound())
                        {
                            this.CamSlided = true;
                            this.CamSlideY++;
                        }
                        DDUtils.ToRange(ref this.CamSlideX, -1, 1);
                        DDUtils.ToRange(ref this.CamSlideY, -1, 1);
                    }
                    else
                    {
                        if (this.CamSlideMode && !this.CamSlided)
                        {
                            this.CamSlideX = 0;
                            this.CamSlideY = 0;
                        }
                        this.CamSlided = false;
                    }
                    this.CamSlideMode = camSlide;

                    if (this.Player.AirborneFrame != 0)                     // ? 滞空状態
                    {
                        shagami = false;
                    }

                    if (shagami)
                    {
                        this.Player.ShagamiFrame++;
                    }
                    else
                    {
                        this.Player.ShagamiFrame = 0;
                    }

                    {
                        const int 事前入力時間 = 2;                         // 無効
                        //const int 事前入力時間 = 5;
                        //const int 事前入力時間 = 10; // HACK: ちょっと長すぎるかもしれない。無効でも良いかもしれない。// 暴発があるので事前入力は無効にする。

                        if (1 <= attack && attack < 事前入力時間)
                        {
                            switch (this.Player.Chara)
                            {
                            case Player.Chara_e.HOMURA:
                            {
                                if (this.Player.AirborneFrame == 0)
                                {
                                    this.Player.Attack = new Attack_ほむら接地攻撃();
                                }
                                else
                                {
                                    this.Player.Attack = new Attack_ほむら滞空攻撃();
                                }
                            }
                            break;

                            case Player.Chara_e.SAYAKA:
                            {
                                if (this.Player.AirborneFrame == 0)
                                {
                                    this.Player.Attack = new Attack_さやか接地攻撃();
                                }
                                else
                                {
                                    this.Player.Attack = new Attack_さやか滞空攻撃();
                                }
                            }
                            break;

                            default:
                                throw null;                                         // never
                            }
                        }
                        if (1 <= extendedAttack && extendedAttack < 事前入力時間)
                        {
                            switch (this.Player.Chara)
                            {
                            case Player.Chara_e.HOMURA:
                            {
                                if (this.Player.AirborneFrame == 0)
                                {
                                    this.Player.Attack = new Attack_ほむらシールド();
                                }
                            }
                            break;

                            case Player.Chara_e.SAYAKA:
                            {
                                this.Player.Attack = new Attack_さやか突き();
                            }
                            break;

                            default:
                                throw null;                                         // never
                            }
                        }
                    }
                }

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

                    if (GameConsts.PLAYER_DEAD_FRAME_MAX < frame)
                    {
                        this.Player.DeadFrame     = 0;
                        this.Status.ExitDirection = 5;
                        break;
                    }
                    this.Player.DeadFrame++;

                    // この時点でとりうる this.Player.DeadFrame の最大値は Consts.PLAYER_DEAD_FRAME_MAX + 2

                    // ----

                    // noop
                }
                //endDead:

                //startDamage:
                if (1 <= this.Player.DamageFrame)                 // プレイヤー・ダメージ中の処理
                {
                    int frame = this.Player.DamageFrame - 1;

                    if (GameConsts.PLAYER_DAMAGE_FRAME_MAX < frame)
                    {
                        this.Player.DamageFrame = 0;

                        if (1 <= this.Player.HP)
                        {
                            this.Player.InvincibleFrame = 1;
                            goto endDamage;
                        }
                        else
                        {
                            this.Player.DeadFrame = 1;
                            goto startDead;
                        }
                    }
                    this.Player.DamageFrame++;

                    // この時点でとりうる this.Player.DamageFrame の最大値は Consts.PLAYER_DAMAGE_FRAME_MAX + 2

                    // ----

                    {
                        double rate = (double)frame / GameConsts.PLAYER_DAMAGE_FRAME_MAX;

                        this.Player.X -= (9.0 - 6.0 * rate) * (this.Player.FacingLeft ? -1 : 1);
                    }
                }
endDamage:

                //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++;

                    // この時点でとりうる this.Player.InvincibleFrame の最大値は Consts.PLAYER_INVINCIBLE_FRAME_MAX + 2

                    // ----

                    // noop
                }
endInvincible:

                // プレイヤー移動
                {
                    if (1 <= this.Player.MoveFrame)
                    {
                        double speed = 0.0;

                        if (this.Player.MoveSlow)
                        {
                            speed = this.Player.MoveFrame / 10.0;
                            DDUtils.Minim(ref speed, GameConsts.PLAYER_SLOW_SPEED);
                        }
                        else
                        {
                            speed = GameConsts.PLAYER_SPEED;
                        }

                        speed *= this.Player.FacingLeft ? -1 : 1;

                        this.Player.X += speed;
                    }
                    else
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X);
                    }

                    // 重力による加速
                    this.Player.YSpeed += GameConsts.PLAYER_GRAVITY;

                    // 自由落下の最高速度を超えないように矯正
                    DDUtils.Minim(ref this.Player.YSpeed, GameConsts.PLAYER_FALL_SPEED_MAX);

                    // 自由落下
                    this.Player.Y += this.Player.YSpeed;
                }

                // プレイヤー位置矯正
                {
                    bool touchSide_L =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_側面判定Pt_X, this.Player.Y - GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_側面判定Pt_X, this.Player.Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_側面判定Pt_X, this.Player.Y + GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall();

                    bool touchSide_R =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_側面判定Pt_X, this.Player.Y - GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_側面判定Pt_X, this.Player.Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_側面判定Pt_X, this.Player.Y + GameConsts.PLAYER_側面判定Pt_Y)).Tile.IsWall();

                    if (touchSide_L && touchSide_R)                     // -> 壁抜け防止のため再チェック
                    {
                        touchSide_L = this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_側面判定Pt_X, this.Player.Y)).Tile.IsWall();
                        touchSide_R = this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_側面判定Pt_X, this.Player.Y)).Tile.IsWall();
                    }

                    if (touchSide_L && touchSide_R)
                    {
                        // noop
                    }
                    else if (touchSide_L)
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X / GameConsts.TILE_W) * GameConsts.TILE_W + GameConsts.PLAYER_側面判定Pt_X;
                    }
                    else if (touchSide_R)
                    {
                        this.Player.X = (double)SCommon.ToInt(this.Player.X / GameConsts.TILE_W) * GameConsts.TILE_W - GameConsts.PLAYER_側面判定Pt_X;
                    }

                    bool touchCeiling =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_脳天判定Pt_X, this.Player.Y - GameConsts.PLAYER_脳天判定Pt_Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_脳天判定Pt_X, this.Player.Y - GameConsts.PLAYER_脳天判定Pt_Y)).Tile.IsWall();

                    if (touchCeiling)
                    {
                        if (this.Player.YSpeed < 0.0)
                        {
                            double plY = ((int)((this.Player.Y - GameConsts.PLAYER_脳天判定Pt_Y) / GameConsts.TILE_H) + 1) * GameConsts.TILE_H + GameConsts.PLAYER_脳天判定Pt_Y;

                            this.Player.Y      = plY;
                            this.Player.YSpeed = 0.0;
                        }
                    }

                    bool touchGround =
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X - GameConsts.PLAYER_接地判定Pt_X, this.Player.Y + GameConsts.PLAYER_接地判定Pt_Y)).Tile.IsWall() ||
                        this.Map.GetCell(GameCommon.ToTablePoint(this.Player.X + GameConsts.PLAYER_接地判定Pt_X, this.Player.Y + GameConsts.PLAYER_接地判定Pt_Y)).Tile.IsWall();

                    if (touchGround)
                    {
                        if (0.0 < this.Player.YSpeed)
                        {
                            double plY = (int)((this.Player.Y + GameConsts.PLAYER_接地判定Pt_Y) / GameConsts.TILE_H) * GameConsts.TILE_H - GameConsts.PLAYER_接地判定Pt_Y;

                            this.Player.Y      = plY;
                            this.Player.YSpeed = 0.0;
                        }
                    }

                    if (touchGround)
                    {
                        this.Player.AirborneFrame = 0;
                    }
                    else
                    {
                        this.Player.AirborneFrame++;
                    }
                }
endPlayer:

                if (this.Player.X < 0.0)                 // ? マップの左側に出た。
                {
                    this.Status.ExitDirection = 4;
                    break;
                }
                if (this.Map.W * GameConsts.TILE_W < this.Player.X)                 // ? マップの右側に出た。
                {
                    this.Status.ExitDirection = 6;
                    break;
                }
                if (this.Player.Y < 0.0)                 // ? マップの上側に出た。
                {
                    this.Status.ExitDirection = 8;
                    break;
                }
                if (this.Map.H * GameConsts.TILE_H < this.Player.Y)                 // ? マップの下側に出た。
                {
                    this.Status.ExitDirection = 2;
                    break;
                }

                // 画面遷移時の微妙なカメラ位置ズレ解消
                // -- スタート地点(入場地点)が地面と接していると、最初のフレームでプレイヤーは上に押し出されてカメラの初期位置とズレてしまう。
                if (this.Frame == 0)
                {
                    this.カメラ位置調整(true);
                }

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

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

                this.DrawWall();
                this.DrawMap();
                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 (this.当たり判定表示)
                {
                    // 最後に描画されるように DDGround.EL.Add() する。

                    DDGround.EL.Add(() =>
                    {
                        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);

                        return(false);
                    });
                }

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

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

                // ? 無敵な攻撃中 -> 敵 x 自機 の衝突判定を行わない。
                bool attackInvincibleMode =
                    Game.I.Player.Attack != null &&
                    Game.I.Player.Attack.IsInvincibleMode();

                foreach (Enemy enemy in this.Enemies.Iterate())
                {
                    if (1 <= enemy.HP)                     // ? 敵:生存 && 無敵ではない
                    {
                        foreach (Shot shot in this.Shots.Iterate())
                        {
                            // 衝突判定:敵 x 自弾
                            if (
                                !shot.DeadFlag &&                                 // ? 自弾:生存
                                enemy.Crash.IsCrashed(shot.Crash)                 // ? 衝突
                                )
                            {
                                // ★ 敵_被弾ここから

                                if (!shot.敵を貫通する)
                                {
                                    shot.Kill();
                                }

                                enemy.HP -= shot.AttackPoint;

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

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

                    // 衝突判定:敵 x 自機
                    if (
                        this.Player.DeadFrame == 0 &&                // ? プレイヤー死亡中ではない。
                        this.Player.DamageFrame == 0 &&              // ? プレイヤー・ダメージ中ではない。
                        this.Player.InvincibleFrame == 0 &&          // ? プレイヤー無敵時間中ではない。
                        !attackInvincibleMode &&                     // 無敵になる攻撃中ではない。
                        !enemy.DeadFlag &&                           // ? 敵:生存
                        DDCrashUtils.IsCrashed(enemy.Crash, plCrash) // ? 衝突
                        )
                    {
                        // ★ 自機_被弾ここから

                        if (enemy.自機に当たると消滅する)
                        {
                            enemy.Kill();
                        }

                        this.Player.HP -= enemy.AttackPoint;

                        if (1 <= this.Player.HP)                         // ? まだ生存している。
                        {
                            this.Player.DamageFrame = 1;
                        }
                        else                         // ? 死亡した。
                        {
                            this.Player.HP = -1;
                            //this.Player.DeadFrame = 1; // ヒットバックした後で死亡フレームを上げる。
                            this.Player.DamageFrame = 1;
                        }

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

                foreach (Shot shot in this.Shots.Iterate())
                {
                    // 壁への当たり判定は自弾の「中心座標のみ」であることに注意して下さい。

                    if (
                        !shot.DeadFlag &&                                                       // ? 自弾:生存
                        !shot.壁をすり抜ける &&                                                        // ? この自弾は壁に当たる。
                        this.Map.GetCell(GameCommon.ToTablePoint(shot.X, shot.Y)).Tile.IsWall() // ? 壁に当たった。
                        )
                    {
                        shot.Kill();
                    }
                }

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

                f_ゴミ回収();

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

                DDEngine.EachFrame();

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

            DDEngine.FreezeInput();

            if (this.Status.ExitDirection == 5)
            {
                DDMusicUtils.Fade();
                DDCurtain.SetCurtain(30, -1.0);

                foreach (DDScene scene in DDSceneUtils.Create(40))
                {
                    this.DrawWall();
                    this.DrawMap();

                    DDEngine.EachFrame();
                }
            }
            else
            {
                double destSlide_X = 0.0;
                double destSlide_Y = 0.0;

                switch (this.Status.ExitDirection)
                {
                case 4:
                    destSlide_X = DDConsts.Screen_W;
                    break;

                case 6:
                    destSlide_X = -DDConsts.Screen_W;
                    break;

                case 8:
                    destSlide_Y = DDConsts.Screen_H;
                    break;

                case 2:
                    destSlide_Y = -DDConsts.Screen_H;
                    break;

                default:
                    throw null;                             // never
                }
                using (DDSubScreen wallMapScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H))
                {
                    using (wallMapScreen.Section())
                    {
                        this.DrawWall();
                        this.DrawMap();
                    }
                    foreach (DDScene scene in DDSceneUtils.Create(30))
                    {
                        double slide_X = destSlide_X * scene.Rate;
                        double slide_Y = destSlide_Y * scene.Rate;

                        DDCurtain.DrawCurtain();
                        DDDraw.DrawSimple(wallMapScreen.ToPicture(), slide_X, slide_Y);

                        DDEngine.EachFrame();
                    }
                }
                DDCurtain.SetCurtain(0, -1.0);
            }

            // ★★★★★
            // プレイヤー・ステータス反映(マップ退場時)
            // その他の反映箇所:
            // -- マップ入場時
            // -- セーブ時
            {
                this.Status.StartChara      = this.Player.Chara;
                this.Status.StartHP         = this.Player.HP;
                this.Status.StartFacingLeft = this.Player.FacingLeft;
            }

            // ★★★ end of Perform() ★★★
        }
コード例 #14
0
ファイル: Game.cs プロジェクト: stackprobe/G4YokoActTM
        public void Perform()
        {
            this.ReloadEnemies();

            // デフォルトのスタート位置
            this.Player.X = this.Map.W * MapTile.WH / 2.0;
            this.Player.Y = this.Map.H * MapTile.WH / 2.0;

            foreach (EnemyBox enemy in this.Enemies.Iterate())             // スタート位置
            {
                StartPoint sp = enemy.Value as StartPoint;

                if (sp != null)
                {
                    if (sp.Index == this.Status.StartPointIndex)
                    {
                        this.Player.X = sp.X;
                        this.Player.Y = sp.Y;
                        break;
                    }
                }
            }

            this.Player.HP         = this.Status.CurrHP;
            this.Player.FacingLeft = this.Status.FacingLeft;

            this.WallPicture = WallPictureManager.GetPicutre(this.Map.GetProperty("WALL", "09311.jpg"));

            {
                double w = DDConsts.Screen_W + (this.Map.W * MapTile.WH - DDConsts.Screen_W) * WallPicture_SlideRate;
                double h = DDConsts.Screen_H + (this.Map.H * MapTile.WH - DDConsts.Screen_H) * WallPicture_SlideRate;

                double zw = w / this.WallPicture.Get_W();
                double zh = h / this.WallPicture.Get_H();

                double z = Math.Max(zw, zh);

                z *= 1.01;                 // margin

                this.WallPicture_Zoom = z;
            }

            DDGround.Camera.X = this.Player.X - DDConsts.Screen_W / 2.0;
            DDGround.Camera.Y = this.Player.Y - DDConsts.Screen_H / 2.0;

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

            // TODO music

            for (; ; this.Frame++)
            {
                {
                    double targCamX = this.Player.X - DDConsts.Screen_W / 2 + (this.CamSlideX * DDConsts.Screen_W / 3);
                    double targCamY = this.Player.Y - DDConsts.Screen_H / 2 + (this.CamSlideY * DDConsts.Screen_H / 3);

                    DDUtils.ToRange(ref targCamX, 0.0, this.Map.W * MapTile.WH - DDConsts.Screen_W);
                    DDUtils.ToRange(ref targCamY, 0.0, this.Map.H * MapTile.WH - DDConsts.Screen_H);

                    DDUtils.Approach(ref DDGround.Camera.X, targCamX, 0.8);
                    DDUtils.Approach(ref DDGround.Camera.Y, targCamY, 0.8);
                }

                DDUtils.ToRange(ref DDGround.Camera.X, 0.0, this.Map.W * MapTile.WH - DDConsts.Screen_W);
                DDUtils.ToRange(ref DDGround.Camera.Y, 0.0, this.Map.H * MapTile.WH - DDConsts.Screen_H);

                DDGround.ICamera.X = DoubleTools.ToInt(DDGround.Camera.X);
                DDGround.ICamera.Y = DoubleTools.ToInt(DDGround.Camera.Y);

                if (DDConfig.LOG_ENABLED && DDKey.GetInput(DX.KEY_INPUT_E) == 1)
                {
                    this.EditMode();
                    this.ReloadEnemies();
                    this.Frame = 0;
                }

                // プレイヤー入力
                {
                    bool deadOrDamage = this.Player.DeadScene.IsFlaming() || this.Player.DamageScene.IsFlaming();
                    bool move         = false;
                    bool slow         = false;
                    bool camSlide     = false;
                    int  jumpPress    = DDInput.A.GetInput();
                    bool jump         = false;
                    bool shagami      = false;
                    bool attack       = false;

                    if (!deadOrDamage && 1 <= DDInput.DIR_2.GetInput())
                    {
                        shagami = true;
                    }
                    if (!deadOrDamage && 1 <= DDInput.DIR_4.GetInput())
                    {
                        this.Player.FacingLeft = true;
                        move = true;
                    }
                    if (!deadOrDamage && 1 <= DDInput.DIR_6.GetInput())
                    {
                        this.Player.FacingLeft = false;
                        move = true;
                    }
                    if (1 <= DDInput.L.GetInput())
                    {
                        move     = false;
                        camSlide = true;
                    }
                    if (!deadOrDamage && 1 <= DDInput.R.GetInput())
                    {
                        slow = true;
                    }
                    if (!deadOrDamage && 1 <= jumpPress)
                    {
                        jump = true;
                    }
                    if (!deadOrDamage && 1 <= DDInput.B.GetInput())
                    {
                        attack = true;
                    }
                    if (DDKey.GetInput(DX.KEY_INPUT_Q) == 1)
                    {
                        break;
                    }

                    if (move)
                    {
                        this.Player.MoveFrame++;
                        shagami = false;
                    }
                    else
                    {
                        this.Player.MoveFrame = 0;
                    }

                    this.Player.MoveSlow = move && slow;

                    if (1 <= this.Player.JumpFrame)
                    {
                        if (jump && this.Player.JumpFrame < 22)
                        {
                            this.Player.JumpFrame++;
                        }
                        else
                        {
                            this.Player.JumpFrame = 0;
                        }
                    }
                    else
                    {
                        //if (jump && jumpPress < 5 && this.Player.TouchGround)
                        if (jump && jumpPress < 5 && this.Player.AirborneFrame < 5)
                        {
                            this.Player.JumpFrame = 1;
                        }
                    }

                    if (camSlide)
                    {
                        if (DDInput.DIR_4.IsPound())
                        {
                            this.CamSlideCount++;
                            this.CamSlideX--;
                        }
                        if (DDInput.DIR_6.IsPound())
                        {
                            this.CamSlideCount++;
                            this.CamSlideX++;
                        }
                        if (DDInput.DIR_8.IsPound())
                        {
                            this.CamSlideCount++;
                            this.CamSlideY--;
                        }
                        if (DDInput.DIR_2.IsPound())
                        {
                            this.CamSlideCount++;
                            this.CamSlideY++;
                        }
                        DDUtils.ToRange(ref this.CamSlideX, -1, 1);
                        DDUtils.ToRange(ref this.CamSlideY, -1, 1);
                    }
                    else
                    {
                        if (this.CamSlideMode && this.CamSlideCount == 0)
                        {
                            this.CamSlideX = 0;
                            this.CamSlideY = 0;
                        }
                        this.CamSlideCount = 0;
                    }
                    this.CamSlideMode = camSlide;

                    if (this.Player.TouchGround == false)
                    {
                        shagami = false;
                    }

                    if (shagami)
                    {
                        this.Player.ShagamiFrame++;
                    }
                    else
                    {
                        this.Player.ShagamiFrame = 0;
                    }

                    if (attack)
                    {
                        this.Player.AttackFrame++;
                    }
                    else
                    {
                        this.Player.AttackFrame = 0;
                    }
                }

                {
                    DDScene scene = this.Player.DeadScene.GetScene();

                    if (scene.Numer != -1)
                    {
                        if (scene.Numer < 30)
                        {
                            double rate = scene.Numer / 30.0;

                            this.Player.X -= 10.0 * (1.0 - rate) * (this.Player.FacingLeft ? -1 : 1);
                        }

                        if (scene.Remaining == 0)
                        {
                            break;
                        }
                    }
                }

                {
                    DDScene scene = this.Player.DamageScene.GetScene();

                    if (scene.Numer != -1)
                    {
                        this.Player.X -= (9.0 - 6.0 * scene.Rate) * (this.Player.FacingLeft ? -1 : 1);

                        if (scene.Remaining == 0)
                        {
                            this.Player.MutekiScene.FireDelay();
                        }
                    }
                }

                {
                    DDScene scene = this.Player.MutekiScene.GetScene();

                    if (scene.Numer != -1)
                    {
                        // noop
                    }
                }

                // プレイヤー移動
                {
                    if (1 <= this.Player.MoveFrame)
                    {
                        double speed = 0.0;

                        if (this.Player.MoveSlow)
                        {
                            speed = this.Player.MoveFrame * 0.2;
                            DDUtils.Minim(ref speed, 2.0);
                        }
                        else
                        {
                            speed = 6.0;
                        }

                        speed *= this.Player.FacingLeft ? -1 : 1;

                        this.Player.X += speed;
                    }
                    else
                    {
                        this.Player.X = (double)DoubleTools.ToInt(this.Player.X);
                    }

                    this.Player.YSpeed += 1.0;                     // += 重力加速度

                    if (1 <= this.Player.JumpFrame)
                    {
                        this.Player.YSpeed = -8.0;
                    }

                    DDUtils.Minim(ref this.Player.YSpeed, 8.0);                     // 落下する最高速度

                    this.Player.Y += this.Player.YSpeed;
                }

                if (this.Player.X < 0.0)                 // ? マップの左側に出た。
                {
                    this.ExitDir = 4;
                    break;
                }
                if (this.Map.W * MapTile.WH < this.Player.X)                 // ? マップの右側に出た。
                {
                    this.ExitDir = 6;
                    break;
                }
                if (this.Player.Y < 0.0)                 // ? マップの上側に出た。
                {
                    this.ExitDir = 8;
                    break;
                }
                if (this.Map.H * MapTile.WH < this.Player.Y)                 // ? マップの下側に出た。
                {
                    this.ExitDir = 2;
                    break;
                }

                // プレイヤー位置矯正
                {
                    bool touchSide_L =
                        this.Map.GetCell(Map.ToTablePoint(this.Player.X - 10.0, this.Player.Y - MapTile.WH / 2)).Wall ||
                        this.Map.GetCell(Map.ToTablePoint(this.Player.X - 10.0, this.Player.Y)).Wall ||
                        this.Map.GetCell(Map.ToTablePoint(this.Player.X - 10.0, this.Player.Y + MapTile.WH / 2)).Wall;

                    bool touchSide_R =
                        this.Map.GetCell(Map.ToTablePoint(this.Player.X + 10.0, this.Player.Y - MapTile.WH / 2)).Wall ||
                        this.Map.GetCell(Map.ToTablePoint(this.Player.X + 10.0, this.Player.Y)).Wall ||
                        this.Map.GetCell(Map.ToTablePoint(this.Player.X + 10.0, this.Player.Y + MapTile.WH / 2)).Wall;

                    if (touchSide_L && touchSide_R)
                    {
                        // noop
                    }
                    else if (touchSide_L)
                    {
                        this.Player.X = (double)DoubleTools.ToInt(this.Player.X / MapTile.WH) * MapTile.WH + 10.0;
                    }
                    else if (touchSide_R)
                    {
                        this.Player.X = (double)DoubleTools.ToInt(this.Player.X / MapTile.WH) * MapTile.WH - 10.0;
                    }

                    bool touchCeiling_L = this.Map.GetCell(Map.ToTablePoint(this.Player.X - 9.0, this.Player.Y - MapTile.WH)).Wall;
                    bool touchCeiling_R = this.Map.GetCell(Map.ToTablePoint(this.Player.X + 9.0, this.Player.Y - MapTile.WH)).Wall;
                    bool touchCeiling   = touchCeiling_L && touchCeiling_R;

                    if (touchCeiling_L && touchCeiling_R)
                    {
                        if (this.Player.YSpeed < 0.0)
                        {
                            this.Player.Y         = (int)(this.Player.Y / MapTile.WH + 1) * MapTile.WH;
                            this.Player.YSpeed    = 0.0;
                            this.Player.JumpFrame = 0;
                        }
                    }
                    else if (touchCeiling_L)
                    {
                        this.Player.X = (double)DoubleTools.ToInt(this.Player.X / MapTile.WH) * MapTile.WH + 9.0;
                    }
                    else if (touchCeiling_R)
                    {
                        this.Player.X = (double)DoubleTools.ToInt(this.Player.X / MapTile.WH) * MapTile.WH - 9.0;
                    }

                    this.Player.TouchGround =
                        this.Map.GetCell(Map.ToTablePoint(this.Player.X - 9.0, this.Player.Y + MapTile.WH)).Wall ||
                        this.Map.GetCell(Map.ToTablePoint(this.Player.X + 9.0, this.Player.Y + MapTile.WH)).Wall;

                    if (this.Player.TouchGround)
                    {
                        DDUtils.Minim(ref this.Player.YSpeed, 0.0);

                        double plY = (int)(this.Player.Y / MapTile.WH) * MapTile.WH;

                        DDUtils.Minim(ref this.Player.Y, plY);
                    }

                    if (this.Player.TouchGround)
                    {
                        this.Player.AirborneFrame = 0;
                    }
                    else
                    {
                        this.Player.AirborneFrame++;
                    }
                }

                if (this.Frame == 0)                 // 画面遷移時の微妙なカメラ位置ズレ解消
                {
                    DDGround.Camera.X = this.Player.X - DDConsts.Screen_W / 2.0;
                    DDGround.Camera.Y = this.Player.Y - DDConsts.Screen_H / 2.0;

                    DDUtils.ToRange(ref DDGround.Camera.X, 0.0, this.Map.W * MapTile.WH - DDConsts.Screen_W);
                    DDUtils.ToRange(ref DDGround.Camera.Y, 0.0, this.Map.H * MapTile.WH - DDConsts.Screen_H);

                    DDGround.ICamera.X = DoubleTools.ToInt(DDGround.Camera.X);
                    DDGround.ICamera.Y = DoubleTools.ToInt(DDGround.Camera.Y);
                }

                if (1 <= this.Player.AttackFrame)
                {
                    this.Player.Attack();
                }

                this.EnemyEachFrame();
                this.WeaponEachFrame();

                // Crash
                {
                    DDCrash playerCrash = DDCrashUtils.Point(new D2Point(this.Player.X, this.Player.Y));

                    foreach (WeaponBox weapon in this.Weapons.Iterate())
                    {
                        weapon.Crash = weapon.Value.GetCrash();
                    }

                    foreach (EnemyBox enemy in this.Enemies.Iterate())
                    {
                        DDCrash enemyCrash = enemy.Value.GetCrash();

                        foreach (WeaponBox weapon in this.Weapons.Iterate())
                        {
                            if (enemyCrash.IsCrashed(weapon.Crash))
                            {
                                if (enemy.Value.Crashed(weapon.Value) == false)                                 // ? 消滅
                                {
                                    enemy.Dead = true;
                                }

                                if (weapon.Value.Crashed(enemy.Value) == false)                                 // ? 消滅
                                {
                                    weapon.Dead = true;
                                }
                            }
                        }
                        this.Weapons.RemoveAll(weapon => weapon.Dead);

                        if (this.Player.DeadScene.IsFlaming() == false &&
                            this.Player.DamageScene.IsFlaming() == false &&
                            this.Player.MutekiScene.IsFlaming() == false && enemyCrash.IsCrashed(playerCrash))
                        {
                            if (enemy.Value.CrashedToPlayer() == false)                             // ? 消滅
                            {
                                enemy.Dead = true;
                            }

                            this.Player.Crashed(enemy.Value);
                        }
                    }
                    this.Enemies.RemoveAll(enemy => enemy.Dead);
                }

                // 描画ここから

                this.DrawWall();
                this.DrawMap();
                this.Player.Draw();
                this.DrawEnemies();
                this.DrawWeapons();

                DDPrint.SetPrint();
                DDPrint.Print(DDEngine.FrameProcessingMillis_Worst + " " + this.Player.HP);

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

            if (this.ExitDir == 5)
            {
                DDMusicUtils.Fade();
                DDCurtain.SetCurtain(30, -1.0);

                foreach (DDScene scene in DDSceneUtils.Create(40))
                {
                    this.DrawWall();
                    this.DrawMap();

                    DDEngine.EachFrame();
                }
            }
            else
            {
                double destSlideX = 0.0;
                double destSlideY = 0.0;

                switch (this.ExitDir)
                {
                case 4:
                    destSlideX = DDConsts.Screen_W;
                    break;

                case 6:
                    destSlideX = -DDConsts.Screen_W;
                    break;

                case 8:
                    destSlideY = DDConsts.Screen_H;
                    break;

                case 2:
                    destSlideY = -DDConsts.Screen_H;
                    break;

                default:
                    throw null;                             // never
                }
#if true
                using (DDSubScreen wallScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H))
                {
                    using (wallScreen.Section())
                    {
                        this.DrawWall();
                    }

                    foreach (DDScene scene in DDSceneUtils.Create(30))
                    {
                        this.DrawMap_SlideX = destSlideX * scene.Rate;
                        this.DrawMap_SlideY = destSlideY * scene.Rate;

                        DDCurtain.DrawCurtain();
                        DDDraw.DrawSimple(wallScreen.ToPicture(), this.DrawMap_SlideX, this.DrawMap_SlideY);
                        this.DrawMap();

                        DDEngine.EachFrame();
                    }
                }
#else // old
                foreach (DDScene scene in DDSceneUtils.Create(10))
                {
                    this.DrawWall();
                    DDCurtain.DrawCurtain(-scene.Rate);
                    this.DrawMap();

                    DDEngine.EachFrame();
                }
                foreach (DDScene scene in DDSceneUtils.Create(20))
                {
                    this.DrawMap_SlideX = destSlideX * scene.Rate;
                    this.DrawMap_SlideY = destSlideY * scene.Rate;

                    DDCurtain.DrawCurtain(-1.0);
                    this.DrawMap();

                    DDEngine.EachFrame();
                }
#endif
                this.DrawMap_SlideX = 0.0;                 // 復元
                this.DrawMap_SlideY = 0.0;                 // 復元

                DDCurtain.SetCurtain(0, -1.0);
            }

            // ここでステータスに反映

            this.Status.CurrHP     = this.Player.HP;
            this.Status.FacingLeft = this.Player.FacingLeft;
        }
コード例 #15
0
        public void Perform()
        {
            this.Player.X = DDConsts.Screen_W / 4;
            this.Player.Y = DDConsts.Screen_H / 2;

            this.Player.BornScene.Fire();

            DDCurtain.SetCurtain(10);

            for (; ; this.Frame++)
            {
                // プレイヤー行動
                {
                    bool   bornOrDead = this.Player.BornScene.IsFlaming() || this.Player.DeadScene.IsFlaming();
                    bool   dead       = this.Player.DeadScene.IsFlaming();
                    double xa         = 0.0;
                    double ya         = 0.0;

                    if (!dead && 1 <= DDInput.DIR_4.GetInput())                     // 左移動
                    {
                        xa = -1.0;
                    }
                    if (!dead && 1 <= DDInput.DIR_6.GetInput())                     // 右移動
                    {
                        xa = 1.0;
                    }
                    if (!dead && 1 <= DDInput.DIR_8.GetInput())                     // 上移動
                    {
                        ya = -1.0;
                    }
                    if (!dead && 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 (!bornOrDead && 1 <= DDInput.B.GetInput())                     // 攻撃ボタン押下中
                    {
                        this.Player.Shoot();
                    }

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

                {
                    DDScene scene = this.Player.BornScene.GetScene();

                    if (scene.Numer != -1)
                    {
                        if (scene.Remaining == 0)
                        {
                            this.Player.MutekiScene.FireDelay();
                        }
                    }
                }

                {
                    DDScene scene = this.Player.DeadScene.GetScene();

                    if (scene.Numer != -1)
                    {
                        if (scene.Remaining == 0)
                        {
                            if (this.Status.RemainingLiveCount <= 0)
                            {
                                break;
                            }

                            this.Status.RemainingLiveCount--;
                            this.Player.BornScene.FireDelay();
                        }
                    }
                }

                {
                    DDScene scene = this.Player.MutekiScene.GetScene();

                    if (scene.Numer != -1)
                    {
                        // noop
                    }
                }

                if (this.Scenario.EachFrame() == false)
                {
                    break;
                }

                this.EnemyEachFrame();
                this.WeaponEachFrame();

                DDCrashView cv = DDKey.GetInput(DX.KEY_INPUT_LSHIFT) == 0 ? null : new DDCrashView();

                // Crash
                {
                    DDCrash playerCrash = DDCrashUtils.Point(new D2Point(this.Player.X, this.Player.Y));

                    foreach (WeaponBox weapon in this.Weapons.Iterate())
                    {
                        weapon.Crash = weapon.Value.GetCrash();
                    }

                    foreach (EnemyBox enemy in this.Enemies.Iterate())
                    {
                        DDCrash enemyCrash = enemy.Value.GetCrash();

                        if (cv != null)
                        {
                            cv.Draw(enemyCrash);
                        }

                        foreach (WeaponBox weapon in this.Weapons.Iterate())
                        {
                            if (enemyCrash.IsCrashed(weapon.Crash))
                            {
                                if (enemy.Value.Crashed(weapon.Value) == false)                                 // ? 消滅
                                {
                                    enemy.Dead = true;
                                }

                                if (weapon.Value.Crashed(enemy.Value) == false)                                 // ? 消滅
                                {
                                    weapon.Dead = true;
                                }
                            }
                        }
                        this.Weapons.RemoveAll(weapon => weapon.Dead);

                        if (this.Player.BornScene.IsFlaming() == false &&
                            this.Player.DeadScene.IsFlaming() == false &&
                            this.Player.MutekiScene.IsFlaming() == false && enemyCrash.IsCrashed(playerCrash))
                        {
                            foreach (DDScene scene in DDSceneUtils.Create(30))                             // プレイヤ死亡効果
                            {
                                this.DrawWall();
                                this.Player.Draw();
                                this.DrawEnemies();

                                DDDraw.SetAlpha(0.3);
                                DDDraw.SetBright(1.0, 0.0, 0.0);
                                DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, 0, DDConsts.Screen_W, DDConsts.Screen_H);
                                DDDraw.Reset();

                                {
                                    int ix = DoubleTools.ToInt(this.Player.X);
                                    int iy = DoubleTools.ToInt(this.Player.Y);

                                    DDDraw.SetBright(1.0, 1.0, 0.0);
                                    DDDraw.SetAlpha(scene.Rate);
                                    DDDraw.DrawRect_LTRB(DDGround.GeneralResource.WhiteBox, ix - 1, 0, ix + 1, DDConsts.Screen_H);
                                    DDDraw.SetAlpha(scene.RemainingRate);
                                    DDDraw.DrawRect_LTRB(DDGround.GeneralResource.WhiteBox, 0, iy - 1, DDConsts.Screen_W, iy + 1);
                                    DDDraw.Reset();
                                }

                                DDEngine.EachFrame();
                            }

                            this.Player.DeadScene.Fire();
                        }
                    }
                    this.Enemies.RemoveAll(enemy => enemy.Dead);
                }

                // ここから描画

                this.DrawWall();
                this.Player.Draw();
                this.DrawEnemies();
                this.DrawWeapons();

                if (cv != null)
                {
                    cv.DrawToScreen(0.8);
                    cv.Dispose();
                    cv = null;
                }

                DDPrint.SetPrint();
                DDPrint.Print(DDEngine.FrameProcessingMillis_Worst + " " + this.Enemies.Count + " SPEED=" + this.Player.SpeedLevel);

                DDEngine.EachFrame();
            }
        }
コード例 #16
0
        private int SelectedSaveDataSlotIndex = -1;                    // -1 == 未選択

        private SaveDataSlot Perform(Action a_drawWall, bool saveMode) // ret: null == セーブモード || (ロードモード && キャンセルした)
        {
            this.DrawWall = a_drawWall;

            DDHashedData thumbnail = saveMode ? this.MakeThumbnail() : null;
            SaveDataSlot ret       = null;

            DDEngine.FreezeInput();

            for (; ;)
            {
                // ====
                // 入力判定ここから
                // ====

                if (
                    DDInput.A.GetInput() == 1 ||
                    DDInput.B.GetInput() == 1 ||
                    DDMouse.R.GetInput() == -1
                    )
                {
                    break;
                }

                if (DDMouse.L.GetInput() == -1)
                {
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_前へ)
                    {
                        this.PageIndex--;
                    }
                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_次へ)
                    {
                        this.PageIndex++;
                    }

                    DDUtils.ToRange(ref this.PageIndex, 0, PAGE_NUM - 1);

                    if (this.LastHoveringButton == Ground.I.Picture.SettingButton_戻る)
                    {
                        break;
                    }
                    if (this.SelectedSaveDataSlotIndex != -1)
                    {
                        SaveDataSlot sdSlot = Ground.I.SaveDataSlots[this.SelectedSaveDataSlotIndex];

                        if (saveMode)                         // ? セーブモード
                        {
                            if (new Confirm()
                            {
                                BorderColor =
                                    sdSlot.SerializedGameStatus != null ?
                                    new I3Color(255, 0, 0) :
                                    new I3Color(150, 150, 50)
                            }
                                .Perform(
                                    sdSlot.SerializedGameStatus != null ?
                                    "スロット " + (this.SelectedSaveDataSlotIndex + 1) + " のデータを上書きします。" :
                                    "スロット " + (this.SelectedSaveDataSlotIndex + 1) + " にセーブします。", "はい", "いいえ") == 0)
                            {
                                sdSlot.SerializedGameStatus = Game.I.Status.Serialize();
                                sdSlot.SavedTime            = new SCommon.SimpleDateTime(SCommon.TimeStampToSec.ToSec(DateTime.Now));
                                sdSlot.Thumbnail            = thumbnail;
                            }
                        }
                        else                                         // ? ロードモード
                        {
                            if (sdSlot.SerializedGameStatus != null) // ロードする。
                            {
                                if (new Confirm()
                                {
                                    BorderColor = new I3Color(50, 100, 200)
                                }
                                    .Perform("スロット " + (this.SelectedSaveDataSlotIndex + 1) + " のデータをロードします。", "はい", "いいえ") == 0)
                                {
                                    ret = sdSlot;
                                    break;
                                }
                            }
                        }
                    }
                }

                // ====
                // 入力判定ここまで
                // ====

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

                this.LastHoveringButton = null;                 // 不使用
                this.DrawWall();

                DDDraw.DrawSimple(Ground.I.Picture.詳細設定枠, 0, 0);

                DrawTabTitle(855, 70, saveMode ? "セーブ" : "ロード", true);

                int selSDSlotIndex = -1;
                int sdSlotIndex    = this.PageIndex * 10;

                for (int y = 0; y < 2; y++)
                {
                    for (int x = 0; x < 5; x++)
                    {
                        bool         selected = this.SelectedSaveDataSlotIndex == sdSlotIndex;
                        SaveDataSlot sdSlot   = Ground.I.SaveDataSlots[sdSlotIndex];

                        int slotX = 260 + x * 350;
                        int slotY = 360 + y * 350;

                        DDDraw.SetAlpha(selected ? 1.0 : 0.3);
                        DDDraw.DrawBegin(Ground.I.Picture.SaveDataSlot, slotX, slotY);
                        DDCrash drawedCrash = DDDraw.DrawGetCrash();
                        DDDraw.DrawEnd();
                        DDDraw.Reset();

                        if (drawedCrash.IsCrashed(DDCrashUtils.Point(new D2Point(DDMouse.X, DDMouse.Y))))
                        {
                            selSDSlotIndex = sdSlotIndex;
                        }

                        DDDraw.DrawCenter(DDHashedResource.GetPicture(sdSlot.Thumbnail), slotX, slotY);

                        DDPrint.SetBorder(new I3Color(0, 0, 150));
                        DDPrint.SetPrint(slotX - 140, slotY - 145);
                        DDPrint.Print("" + (sdSlotIndex + 1));

                        DDPrint.SetBorder(new I3Color(0, 0, 150));
                        DDPrint.SetPrint(slotX - 150, slotY + 120);
                        DDPrint.Print(sdSlot.SavedTime.Year == 1 ?
                                      "----/--/--(--)--:--"
                                      //"----/--/-- --:--:--"
                                                        : sdSlot.SavedTime.ToString(
                                          "{0:D4}/{1:D2}/{2:D2}({3}){4:D2}:{5:D2}"
                                          //"{0:D4}/{1:D2}/{2:D2} {4:D2}:{5:D2}:{6:D2}"
                                          ));

                        sdSlotIndex++;
                    }
                }
                this.SelectedSaveDataSlotIndex = selSDSlotIndex;

                this.DrawButton(800, 950, Ground.I.Picture.SettingButton_前へ, 0 < this.PageIndex);
                this.DrawButton(1120, 950, Ground.I.Picture.SettingButton_次へ, this.PageIndex < PAGE_NUM - 1);
                this.DrawButton(1630, 950, Ground.I.Picture.SettingButton_戻る, true);

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

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

            DDHashedResource.ClearPicture();

            return(ret);
        }