Ejemplo n.º 1
0
		private void カメラ位置調整(bool 一瞬で)
		{
			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 * GameConsts.TILE_W - DDConsts.Screen_W);
			DDUtils.ToRange(ref targCamY, 0.0, this.Map.H * GameConsts.TILE_H - DDConsts.Screen_H);

			// 不要
			//if (this.Map.W * GameConsts.TILE_W - DDConsts.Screen_W < GameConsts.TILE_W) // ? カメラの横の可動域が1タイルより狭い場合
			//    targCamX = (this.Map.W * GameConsts.TILE_W - DDConsts.Screen_W) / 2; // 中心に合わせる。

			if (this.Map.H * GameConsts.TILE_H - DDConsts.Screen_H < GameConsts.TILE_H) // ? カメラの縦の可動域が1タイルより狭い場合
				targCamY = (this.Map.H * GameConsts.TILE_H - DDConsts.Screen_H) / 2; // 中心に合わせる。

			DDUtils.Approach(ref DDGround.Camera.X, targCamX, 一瞬で ? 0.0 : 0.8);
			DDUtils.Approach(ref DDGround.Camera.Y, targCamY, 一瞬で ? 0.0 : 0.8);

			//DDUtils.ToRange(ref DDGround.Camera.X, 0.0, this.Map.W * Consts.TILE_W - DDConsts.Screen_W);
			//DDUtils.ToRange(ref DDGround.Camera.Y, 0.0, this.Map.H * Consts.TILE_H - DDConsts.Screen_H);

			DDGround.ICamera.X = SCommon.ToInt(DDGround.Camera.X);
			DDGround.ICamera.Y = SCommon.ToInt(DDGround.Camera.Y);
		}
Ejemplo n.º 2
0
                public override IEnumerable <bool> E_Task()
                {
                    for (int slide = 0; ; slide += SPEED)
                    {
                        if (PIC.Get_W() < slide)
                        {
                            slide -= PIC.Get_W();
                            DDUtils.Approach(ref this.PutRate, TARGET_PUT_RATE, PR_APPROACHING_RATE);

                            for (int y = 0; y < DDConsts.Screen_H; y += PIC.Get_H())
                            {
                                if (DDUtils.Random.Real() < this.PutRate)
                                {
                                    this.Tiles.Add(new TileTask()
                                    {
                                        PIC = PIC, X = DDConsts.Screen_W - slide, Y = y
                                    }.Task);
                                }
                            }
                        }
                        this.Tiles.ExecuteAllTask();
                        yield return(true);
                    }
                }
Ejemplo n.º 3
0
        public void Main01()
        {
            FileTools.Delete(W_DIR);
            FileTools.CreateDir(W_DIR);

            this.SpData = new SpectrumData(Path.Combine(R_DIR, "Spectrum.csv"));

            foreach (DDScene scene in DDSceneUtils.Create(20))
            {
                DDCurtain.DrawCurtain();

                this.MG_EachFrame();
            }

            Func <bool> backLayer = () => true;
            Func <bool> foreLayer = EnumerableTools.Supplier(GetLayer01(Path.Combine(SS_DIR, "0006.png")));

            double fowLv = 0.0;

            for (int frmcnt = 0; this.Frame < this.SpData.Rows.Length; frmcnt++)
            {
                {
                    Func <bool> nextLayer = null;

#if true // 本番用
                    switch (frmcnt)
                    {
                    case 15: nextLayer = EnumerableTools.Supplier(GetLayer02(Path.Combine(SS_DIR, "0003.png"), 1)); break;

                    case 30: nextLayer = EnumerableTools.Supplier(GetLayer02(Path.Combine(SS_DIR, "0007.png"), -1)); break;

                    case 45: nextLayer = EnumerableTools.Supplier(GetLayer02(Path.Combine(SS_DIR, "0008.png"), 1)); break;

                    case 60: nextLayer = EnumerableTools.Supplier(GetLayer02(Path.Combine(SS_DIR, "0013.png"), -1)); break;

                    case 75: nextLayer = EnumerableTools.Supplier(GetLayer02(Path.Combine(SS_DIR, "0017.png"), 1)); break;

                    case 90: nextLayer = EnumerableTools.Supplier(GetLayer03(Path.Combine(SS_DIR, "0018.png"))); break;

                    case 160: nextLayer = EnumerableTools.Supplier(GetLayer04(Path.Combine(SS_DIR, "0019.png"))); break;
                    }
#else // test test test
                    switch (frmcnt)
                    {
                    case 10: nextLayer = EnumerableTools.Supplier(GetLayer04(Path.Combine(SS_DIR, "0019.png"))); break;
                    }
#endif
                    if (nextLayer != null)
                    {
                        backLayer = foreLayer;
                        foreLayer = nextLayer;
                    }
                }

                backLayer();
                foreLayer();

                if (this.SpData.Rows.Length - 40 < this.Frame)
                {
                    DDUtils.Approach(ref fowLv, -1.0, 0.9);

                    DDCurtain.DrawCurtain(fowLv);
                }

                this.MG_EachFrame();
            }
        }
Ejemplo n.º 4
0
        private static void LittleFairyDraw(FairyInfo fairy, int color)
        {
            if (fairy.Frame == 0)             // init
            {
                fairy.LastX = fairy.Enemy.X;
            }
            double xDiff = fairy.Enemy.X - fairy.LastX;

            fairy.LastX = fairy.Enemy.X;

            if (fairy.Frame % 7 == 0)
            {
                if (Math.Abs(xDiff) < SCommon.MICRO)                 // ? 左右に動いてない。
                {
                    DDUtils.CountDown(ref fairy.XMoveCount);
                    DDUtils.ToRange(ref fairy.XMoveCount, -2, 2);
                }
                else if (xDiff < 0.0)                 // ? 左に動いてる。
                {
                    fairy.XMoveCount--;
                    DDUtils.Minim(ref fairy.XMoveCount, 2);
                }
                else                 // ? 右に動いてる。
                {
                    fairy.XMoveCount++;
                    DDUtils.Maxim(ref fairy.XMoveCount, -2);
                }
            }
            int mode = DDUtils.Sign(fairy.XMoveCount);
            int koma;

            if (mode != 0)
            {
                koma = Math.Abs(fairy.XMoveCount) - 1;

                if (4 <= koma)
                {
                    koma = 2 + koma % 2;
                }
            }
            else
            {
                koma = (fairy.Frame / 7) % 3;
            }

            if (1 <= fairy.Enemy.HP && fairy.Enemy.TransFrame == 0)             // ? 無敵ではない。
            {
                DDUtils.Approach(ref fairy.UntransRate, 0.5, 0.91);
            }

            DDDraw.SetAlpha(fairy.UntransRate);
            DDDraw.DrawBegin(Ground.I.Picture2.D_MAHOJIN_HAJIKE_00[5], fairy.Enemy.X, fairy.Enemy.Y);
            DDDraw.DrawRotate(fairy.Frame / 20.0);
            DDDraw.DrawZoom(0.4);
            DDDraw.DrawEnd();
            DDDraw.Reset();

            DDDraw.DrawCenter(GetLittleFairyPicture(color, mode, koma), fairy.Enemy.X, fairy.Enemy.Y);

            fairy.Enemy.Crash = DDCrashUtils.Circle(new D2Point(fairy.Enemy.X, fairy.Enemy.Y), 13.0);
        }
Ejemplo n.º 5
0
        public void Perform()
        {
            // 開発中_暫定
            {
                int endFrame = DDEngine.ProcFrame + 300;

                DDGround.EL.Add(() =>
                {
                    int sec = endFrame - DDEngine.ProcFrame;

                    DDPrint.SetPrint(180, DDConsts.Screen_H - 32);
                    DDPrint.Print("これはクローズドテスト版です。仮リソース・実装されていない機能を含みます。(あと " + (sec / 60.0).ToString("F1") + " 秒で消えます)");

                    return(0 < sec);
                });
            }

            foreach (DDScene scene in DDSceneUtils.Create(30))
            {
                DDCurtain.DrawCurtain();
                DDEngine.EachFrame();
            }

            double z1 = 0.3;
            double z2 = 2.0;
            double z3 = 3.7;

            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDCurtain.DrawCurtain();

                DDDraw.SetAlpha(scene.Rate);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.7);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(0.8 + 0.5 * scene.Rate);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z2);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z3);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDUtils.Approach(ref z1, 1.0, 0.9);
                DDUtils.Approach(ref z2, 1.0, 0.98);
                DDUtils.Approach(ref z3, 1.0, 0.95);

                DDEngine.EachFrame();
            }

            {
                long endLoopTime = long.MaxValue;

                for (int frame = 0; ; frame++)
                {
                    if (endLoopTime < DDEngine.FrameStartTime)
                    {
                        break;
                    }

                    if (frame == 1)
                    {
                        endLoopTime = DDEngine.FrameStartTime + 1500;
                        DDTouch.Touch();
                    }
                    DDCurtain.DrawCurtain();
                    DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                    DDEngine.EachFrame();
                }
            }

            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDCurtain.DrawCurtain();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(1.0 - 0.3 * scene.Rate);
                DDDraw.DrawRotate(scene.Rate * -0.1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(1.0 + 0.8 * scene.Rate);
                DDDraw.DrawRotate(scene.Rate * 0.1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2 + scene.Rate * 100.0, DDConsts.Screen_H / 2);
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2 + scene.Rate * 50.0);
                DDDraw.Reset();

                DDEngine.EachFrame();
            }
        }
Ejemplo n.º 6
0
            public override IEnumerable <bool> E_Task()
            {
                DDTaskList el = new DDTaskList();
                double     dx = 0.0;
                double     dy = 0.0;
                double     ldx;
                double     ldy;
                double     shadow_a = 0.0;
                double     shadow_x = 0.0;
                double     title_a  = 0.0;
                double     shadow_targ_a;
                double     shadow_targ_x;
                double     title_targ_a;

                for (int frame = 0; ; frame++)
                {
                    ldx = dx;
                    ldy = dy;
                    dx  = Math.Cos(frame / 199.0) * 40.0;
                    dy  = Math.Cos(frame / 211.0) * 30.0;
                    double dxa = dx - ldx;
                    double dya = dy - ldy;

                    DDDraw.DrawBegin(Ground.I.Picture.TitleWall, DDConsts.Screen_W / 2 + dx, DDConsts.Screen_H / 2 + dy);
                    DDDraw.DrawZoom(1.3);
                    DDDraw.DrawEnd();

                    if (1 <= frame && DDUtils.Random.Real() < 0.03 + Math.Sin(frame / 307.0) * 0.02)
                    {
                        el.Add(SCommon.Supplier(this.Effect_0001(dx, dy, dxa, dya)));
                    }
                    el.ExecuteAllTask_Reverse();

                    double titleX = 720.0 + dx * 0.4;
                    double titleY = 270.0 + dy * 0.4;

                    double tba = 0.5 + Math.Sin(frame / 103.0) * 0.185 + Math.Sin(frame / 3.0) * 0.015 * Math.Sin(frame / 107.0);
                    double tfa = 0.3;

                    tba *= title_a;
                    tfa *= title_a;

                    {
                        const int FRAME_MAX = 300;

                        if (frame < FRAME_MAX)
                        {
                            DDDraw.SetBlendAdd(frame * tba / FRAME_MAX);
                            DDDraw.DrawCenter(Ground.I.Picture.Title, titleX, titleY);
                            DDDraw.Reset();
                        }
                        else
                        {
                            DDDraw.SetBlendAdd(tba);
                            DDDraw.DrawCenter(Ground.I.Picture.Title, titleX, titleY);
                            DDDraw.Reset();
                        }
                    }

                    {
                        const int FRAME_MAX = 300;

                        if (frame < FRAME_MAX)
                        {
                            DDDraw.SetBlendAdd(frame * tfa / FRAME_MAX);
                            DDDraw.DrawCenter(Ground.I.Picture.Title, titleX, titleY);
                            DDDraw.Reset();
                        }
                        else
                        {
                            DDDraw.SetBlendAdd(tfa);
                            DDDraw.DrawCenter(Ground.I.Picture.Title, titleX, titleY);
                            DDDraw.Reset();
                        }
                    }

                    if (this.DeepConfigEntered)
                    {
                        shadow_targ_a = 0.3;
                        shadow_targ_x = DDConsts.Screen_W;
                        title_targ_a  = 0.0;
                    }
                    else if (this.TopMenuLeaved)
                    {
                        shadow_targ_a = 0.3;
                        shadow_targ_x = 480.0;
                        title_targ_a  = 1.0;
                    }
                    else
                    {
                        shadow_targ_a = 0.0;
                        shadow_targ_x = 30.0;
                        title_targ_a  = 1.0;
                    }
                    DDUtils.Approach(ref shadow_a, shadow_targ_a, 0.8);
                    DDUtils.Approach(ref shadow_x, shadow_targ_x, 0.8);
                    DDUtils.Approach(ref title_a, title_targ_a, 0.97);

                    DDDraw.SetAlpha(shadow_a);
                    DDDraw.SetBright(0, 0, 0);
                    DDDraw.DrawRect(Ground.I.Picture.WhiteBox, 0, 0, shadow_x, DDConsts.Screen_H);
                    DDDraw.Reset();

                    yield return(true);
                }
            }
Ejemplo n.º 7
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);
            }
        }
Ejemplo n.º 8
0
        private static void TitleDDStart()
        {
            double selRateContinue = 0.0;
            double selRateStart    = 0.0;
            double selRateBack     = 0.0;

            const int TGS_CONTINUE_X = DDConsts.Screen_W / 2;
            const int TGS_CONTINUE_Y = 150;
            const int TGS_START_X    = DDConsts.Screen_W / 2;
            const int TGS_START_Y    = 390;
            const int TGS_BACK_X     = 830;
            const int TGS_BACK_Y     = 460;

returned:
            DDEngine.FreezeInput();

            WallBokashiRateDest = 1.0;
            WallZRateDest       = 1.0;
            P_TitleBackWDest    = 450;

            for (; ;)
            {
                bool continueEnabled = SaveData.HasSaveData;

                // 描画 ---->

                DrawWall();
                DrawTitleBack();

                if (continueEnabled)
                {
                    DDDraw.DrawBegin(Ground.I.Picture.TitleItemContinue, TGS_CONTINUE_X, TGS_CONTINUE_Y);
                    DDDraw.DrawZoom(1.0 + selRateContinue * 0.1);
                    DDDraw.DrawEnd();
                    NamedCrashMgr.AddLastDrawedCrash("CONTINUE");
                }
                else
                {
                    DDDraw.SetBright(0.6, 0.6, 0.6);
                    DDDraw.DrawCenter(Ground.I.Picture.TitleItemContinue, TGS_CONTINUE_X, TGS_CONTINUE_Y);
                    DDDraw.Reset();
                }
                DDDraw.DrawBegin(Ground.I.Picture.TitleItemStart, TGS_START_X, TGS_START_Y);
                DDDraw.DrawZoom(1.0 + selRateStart * 0.1);
                DDDraw.DrawEnd();
                NamedCrashMgr.AddLastDrawedCrash("START");
                DDDraw.DrawBegin(Ground.I.Picture.TitleBtnBack, TGS_BACK_X, TGS_BACK_Y);
                DDDraw.DrawZoom(1.0 + selRateBack * 0.15);
                DDDraw.DrawEnd();
                NamedCrashMgr.AddLastDrawedCrash("BACK");

                // <---- 描画

                DDMouse.UpdatePos();

                string pointingName = NamedCrashMgr.GetName(DDMouse.X, DDMouse.Y);

                if (pointingName == "CONTINUE")
                {
                    DDUtils.Approach(ref selRateContinue, 1.0, 0.8);
                }
                else
                {
                    DDUtils.Approach(ref selRateContinue, 0.0, 0.85);
                }

                if (pointingName == "START")
                {
                    DDUtils.Approach(ref selRateStart, 1.0, 0.8);
                }
                else
                {
                    DDUtils.Approach(ref selRateStart, 0.0, 0.85);
                }

                if (pointingName == "BACK")
                {
                    DDUtils.Approach(ref selRateBack, 1.0, 0.85);
                }
                else
                {
                    DDUtils.Approach(ref selRateBack, 0.0, 0.93);
                }

                DDEngine.EachFrame();                 // ★★★ EachFrame

                if (DDMouse.L.GetInput() == 1)
                {
                    if (pointingName == "BACK")
                    {
                        break;
                    }

                    if (pointingName == "START")
                    {
                        if (SaveData.HasSaveData)
                        {
                            if (TitleDDStartConfirm())
                            {
                                SaveData.HasSaveData = false;
                                TitleDDStart2();
                            }
                        }
                        else
                        {
                            TitleDDStart2();
                        }

                        selRateContinue = 0.0;
                        selRateStart    = 0.0;
                        selRateBack     = 1.0;

                        goto returned;
                    }
                    if (pointingName == "CONTINUE")
                    {
                        TitleDDStart2();

                        selRateContinue = 0.0;
                        selRateStart    = 0.0;
                        selRateBack     = 1.0;

                        goto returned;
                    }
                }
            }
        }
Ejemplo n.º 9
0
        public static void TitleMain()
        {
            WorkScreen = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H);

            foreach (DDScene scene in DDSceneUtils.Create(30))
            {
                DDCurtain.DrawCurtain();
                DDEngine.EachFrame();
            }
            foreach (DDScene scene in DDSceneUtils.Create(30))
            {
                double a = -1.0 + scene.Rate;

                DDDraw.DrawBegin(Ground.I.Picture.Logo, DDConsts.Screen_W / 2.0, DDConsts.Screen_H / 2.0);
                DDDraw.DrawZoom(1.0 + a * a * 0.1);
                DDDraw.DrawEnd();
                //DDDraw.DrawSimple(Ground.I.Picture.Logo, 0, 0);

                DDCurtain.DrawCurtain(a);
                DDEngine.EachFrame();
            }
            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDDraw.DrawSimple(Ground.I.Picture.Logo, 0, 0);
                DDEngine.EachFrame();
            }
            foreach (DDScene scene in DDSceneUtils.Create(30))
            {
                double a = -scene.Rate;

                DDDraw.DrawBegin(Ground.I.Picture.Logo, DDConsts.Screen_W / 2.0, DDConsts.Screen_H / 2.0);
                DDDraw.DrawZoom(1.0 + a * a * 0.1);
                DDDraw.DrawEnd();
                //DDDraw.DrawSimple(Ground.I.Picture.Logo, 0, 0);

                DDCurtain.DrawCurtain(a);
                DDEngine.EachFrame();
            }
            foreach (DDScene scene in DDSceneUtils.Create(30))
            {
                DDCurtain.DrawCurtain();
                DDEngine.EachFrame();
            }

            const int TITLE_BTN_START_X = 130;
            const int TITLE_BTN_START_Y = 460;

            const int TITLE_BTN_CONFIG_X = 830;
            const int TITLE_BTN_CONFIG_Y = 70;

            const int TITLE_BTN_EXIT_X = 830;
            const int TITLE_BTN_EXIT_Y = 460;

            {
                double   a           = 0.0;
                double   z           = 1.3;
                bool     titleBackOn = false;
                double   titleBackA  = 0.0;
                double   titleBackZ  = 0.1;
                bool     titleOn     = false;
                double   titleA      = 0.0;
                double   titleZ      = 1.3;
                bool[]   titleBtnsOn = new bool[] { false, false, false };
                double[] titleBtnsA  = new double[3] {
                    0, 0, 0
                };
                double[] titleBtnsZ = new double[3] {
                    1.05, 1.1, 1.15
                };

                foreach (DDScene scene in DDSceneUtils.Create(120))
                {
                    if (scene.Numer == 30)
                    {
                        titleBackOn = true;
                    }

                    if (scene.Numer == 60)
                    {
                        titleOn = true;
                    }

                    if (scene.Numer == 90)
                    {
                        titleBtnsOn[0] = true;
                    }

                    if (scene.Numer == 100)
                    {
                        titleBtnsOn[1] = true;
                    }

                    if (scene.Numer == 110)
                    {
                        titleBtnsOn[2] = true;
                    }

                    DDCurtain.DrawCurtain();

                    // Wall >

                    DDSubScreenUtils.ChangeDrawScreen(WorkScreen.GetHandle());

                    DDDraw.SetAlpha(a);
                    DDDraw.DrawBegin(Ground.I.Picture.TitleWall, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                    DDDraw.DrawZoom(z);
                    DDDraw.DrawEnd();
                    DDDraw.Reset();

                    DX.GraphFilter(WorkScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);                     // 1
                    DX.GraphFilter(WorkScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);                     // 2

                    DDSubScreenUtils.RestoreDrawScreen();

                    DDDraw.DrawSimple(DDPictureLoaders2.Wrapper(WorkScreen), 0, 0);

                    // < Wall

                    DDDraw.SetAlpha(titleBackA);
                    DDDraw.SetBright(0, 0, 0);
                    DDDraw.DrawBeginRect(DDGround.GeneralResource.WhiteBox, TITLE_BACK_L, TITLE_BACK_T, TITLE_BACK_W, TITLE_BACK_H);
                    DDDraw.DrawZoom_X(titleBackZ);
                    DDDraw.DrawEnd();
                    DDDraw.Reset();

                    DDDraw.SetAlpha(titleA);
                    DDDraw.DrawBegin(Ground.I.Picture.Title, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                    DDDraw.DrawZoom(titleZ);
                    DDDraw.DrawEnd();
                    DDDraw.Reset();

                    DDDraw.SetAlpha(titleBtnsA[0]);
                    DDDraw.DrawBegin(Ground.I.Picture.TitleBtnStart, TITLE_BTN_START_X, TITLE_BTN_START_Y);
                    DDDraw.DrawZoom(titleBtnsZ[0]);
                    DDDraw.DrawEnd();
                    DDDraw.Reset();

                    DDDraw.SetAlpha(titleBtnsA[1]);
                    DDDraw.DrawBegin(Ground.I.Picture.TitleBtnConfig, TITLE_BTN_CONFIG_X, TITLE_BTN_CONFIG_Y);
                    DDDraw.DrawZoom(titleBtnsZ[1]);
                    DDDraw.DrawEnd();
                    DDDraw.Reset();

                    DDDraw.SetAlpha(titleBtnsA[2]);
                    DDDraw.DrawBegin(Ground.I.Picture.TitleBtnExit, TITLE_BTN_EXIT_X, TITLE_BTN_EXIT_Y);
                    DDDraw.DrawZoom(titleBtnsZ[2]);
                    DDDraw.DrawEnd();
                    DDDraw.Reset();

                    DDUtils.Approach(ref a, 1.0, 0.97);
                    DDUtils.Approach(ref z, 1.0, 0.95);

                    if (titleBackOn)
                    {
                        DDUtils.Approach(ref titleBackA, TITLE_BACK_A, 0.95);
                        DDUtils.Approach(ref titleBackZ, 1.0, 0.9);
                    }
                    if (titleOn)
                    {
                        DDUtils.Approach(ref titleA, 1.0, 0.93);
                        DDUtils.Approach(ref titleZ, 1.0, 0.8);
                    }
                    for (int c = 0; c < 3; c++)
                    {
                        if (titleBtnsOn[c])
                        {
                            DDUtils.Approach(ref titleBtnsA[c], 1.0, 0.77);
                            DDUtils.Approach(ref titleBtnsZ[c], 1.0, 0.73);
                        }
                    }
                    DDEngine.EachFrame();
                }
            }

            {
                double selRateStart  = 0.0;
                double selRateConfig = 0.0;
                double selRateExit   = 0.0;

returned:
                DDEngine.FreezeInput();

                WallBokashiRateDest = 1.0;
                P_TitleBackWDest    = TITLE_BACK_W;

                for (; ;)
                {
                    DrawWall();
                    DrawTitleBack();

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

                    DDDraw.DrawBegin(Ground.I.Picture.TitleBtnStart, TITLE_BTN_START_X, TITLE_BTN_START_Y);
                    DDDraw.DrawZoom(1.0 + selRateStart * 0.2);
                    DDDraw.DrawEnd();
                    NamedCrashMgr.AddLastDrawedCrash("START");
                    DDDraw.DrawBegin(Ground.I.Picture.TitleBtnConfig, TITLE_BTN_CONFIG_X, TITLE_BTN_CONFIG_Y);
                    DDDraw.DrawZoom(1.0 + selRateConfig * 0.15);
                    DDDraw.DrawEnd();
                    NamedCrashMgr.AddLastDrawedCrash("CONFIG");
                    DDDraw.DrawBegin(Ground.I.Picture.TitleBtnExit, TITLE_BTN_EXIT_X, TITLE_BTN_EXIT_Y);
                    DDDraw.DrawZoom(1.0 + selRateExit * 0.15);
                    DDDraw.DrawEnd();
                    NamedCrashMgr.AddLastDrawedCrash("EXIT");

                    // <---- 描画

                    DDMouse.UpdatePos();

                    string pointingName = NamedCrashMgr.GetName(DDMouse.X, DDMouse.Y);

                    if (pointingName == "START")
                    {
                        DDUtils.Approach(ref selRateStart, 1.0, 0.85);
                    }
                    else
                    {
                        DDUtils.Approach(ref selRateStart, 0.0, 0.9);
                    }

                    if (pointingName == "CONFIG")
                    {
                        DDUtils.Approach(ref selRateConfig, 1.0, 0.9);
                    }
                    else
                    {
                        DDUtils.Approach(ref selRateConfig, 0.0, 0.93);
                    }

                    if (pointingName == "EXIT")
                    {
                        DDUtils.Approach(ref selRateExit, 1.0, 0.9);
                    }
                    else
                    {
                        DDUtils.Approach(ref selRateExit, 0.0, 0.93);
                    }

                    DDEngine.EachFrame();                     // ★★★ EachFrame

                    if (DDMouse.L.GetInput() == 1)
                    {
                        if (pointingName == "EXIT")
                        {
                            break;
                        }

                        if (pointingName == "CONFIG")
                        {
                            TitleConfig();
                            goto returned;
                        }
                        if (pointingName == "START")
                        {
                            TitleDDStart();

                            selRateStart = 0.0;
                            selRateExit  = 1.0;

                            goto returned;
                        }
                    }
                }
            }

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

            foreach (DDScene scene in DDSceneUtils.Create(40))
            {
                DrawWall();
                DDEngine.EachFrame();
            }
        }
Ejemplo n.º 10
0
        public void Perform()
        {
            if (DDConfig.LOG_ENABLED)             // 開発・デバッグ_モードであることを表示
            {
                DDGround.EL.Keep(300, () =>
                {
                    DDPrint.SetPrint(100, DDConsts.Screen_H - 40);
                    DDPrint.Print("これはクローズドテスト版です。仮リソース・実装されていない機能を含みます。(このメッセージは数秒で消えます)");
                });
            }

            foreach (DDScene scene in DDSceneUtils.Create(60))             // LiteStatusDlg を閉じるまでの遅延の分(30フレーム)延長
            //foreach (DDScene scene in DDSceneUtils.Create(30))
            {
                DDCurtain.DrawCurtain();
                DDEngine.EachFrame();
            }

            double z1 = 0.3;
            double z2 = 2.0;
            double z3 = 3.7;

            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDCurtain.DrawCurtain();

                DDDraw.SetAlpha(scene.Rate);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.7);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(0.8 + 0.5 * scene.Rate);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z2);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z3);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDUtils.Approach(ref z1, 1.0, 0.9);
                DDUtils.Approach(ref z2, 1.0, 0.98);
                DDUtils.Approach(ref z3, 1.0, 0.95);

                DDEngine.EachFrame();
            }

            {
                long endLoopTime = long.MaxValue;

                for (int frame = 0; ; frame++)
                {
                    if (endLoopTime < DDEngine.FrameStartTime)
                    {
                        break;
                    }

                    if (frame == 1)
                    {
                        endLoopTime = DDEngine.FrameStartTime + 1500;
                        DDTouch.Touch();
                    }
                    DDCurtain.DrawCurtain();
                    DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                    DDEngine.EachFrame();
                }
            }

            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDCurtain.DrawCurtain();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(1.0 - 0.3 * scene.Rate);
                DDDraw.DrawRotate(scene.Rate * -0.1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(1.0 + 0.8 * scene.Rate);
                DDDraw.DrawRotate(scene.Rate * 0.1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2 + scene.Rate * 100.0, DDConsts.Screen_H / 2);
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2 + scene.Rate * 50.0);
                DDDraw.Reset();

                DDEngine.EachFrame();
            }
        }
Ejemplo n.º 11
0
        private static void TitleDDStart2()
        {
            WallBokashiRateDest = 0.0;
            WallZRateDest       = 1.02;
            P_TitleBackWDest    = 0;

            const int TGS_BACK_X = 830;
            const int TGS_BACK_Y = 460;

            double selRateBack = 0.0;

            DDEngine.FreezeInput();

            for (; ;)
            {
                DrawWall();
                DrawTitleBack();

                DDDraw.DrawBegin(Ground.I.Picture.TitleBtnBack, TGS_BACK_X, TGS_BACK_Y);
                DDDraw.DrawZoom(1.0 + selRateBack * 0.15);
                DDDraw.DrawEnd();
                NamedCrashMgr.AddLastDrawedCrash("BACK");

                // <---- 描画

                DDMouse.UpdatePos();

                string pointingName = NamedCrashMgr.GetName(DDMouse.X, DDMouse.Y);

                if (pointingName == "BACK")
                {
                    DDUtils.Approach(ref selRateBack, 1.0, 0.85);
                }
                else
                {
                    DDUtils.Approach(ref selRateBack, 0.0, 0.93);
                }

                DDEngine.EachFrame();                 // ★★★ EachFrame

                if (DDMouse.L.GetInput() == 1)
                {
                    if (pointingName == "BACK")
                    {
                        break;
                    }

                    int x = DDMouse.X;
                    int y = DDMouse.Y;

                    if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(330, 90, 640, 360)) == false) // 入口
                    {
                        SaveData.HasSaveData = true;                                               // kari

                        using (Game game = new Game())
                        {
                            game.Room = new Room0001();
                            game.Perform();
                        }

                        // TODO TitleMain()まで戻るべき
                    }
                }
            }
        }
Ejemplo n.º 12
0
        protected override IEnumerable <int> Script()
        {
            // reset
            {
                BlockCreateRateTarget   = 0.0;
                BlockCreateRateApprRate = 0.0;
                BlockCreateRate         = 0.0;
            }

            Ground.I.Music.Ending_死亡.Play();

            DDGround.EL.Add(() =>
            {
                DDUtils.Approach(ref BlockCreateRate, BlockCreateRateTarget, BlockCreateRateApprRate);
                return(true);
            });

            DDGround.EL.Add(new DrawWall()
            {
                Block_W = 40, Block_H = 100
            }.Task);
            DDGround.EL.Add(new DrawWall()
            {
                Block_W = 60, Block_H = 200
            }.Task);
            DDGround.EL.Add(new DrawWall()
            {
                Block_W = 80, Block_H = 300
            }.Task);

            // _#Include_Resource // for t20201023_GitHubRepositoriesSolve

            BlockCreateRateTarget   = 1.0;
            BlockCreateRateApprRate = 0.999;

            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(50, 200, "\u5451\u307e\u308c\u3066\u3044\u308b\u611f\u899a\u304c\u5206\u304b\u308b\u3002", 800)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(50, 250, "\u6297\u3044\u3088\u3046\u306e\u7121\u3044\u3001\u5727\u5012\u7684\u306b\u6697\u3044\u95c7\u306e\u4e2d\u3078\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(300, 300, "\u305f\u3060\u3001\u601d\u3063\u3066\u3044\u305f\u69d8\u306a\u82e6\u75db\u3084\u6050\u6016\u306f\u306a\u3044\u3002", 800)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(300, 350, "\u30a2\u30a4\u30c4\u304c\u5916\u5074\u3067\u7de9\u548c\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u3093\u3060\u308d\u3046\u3002")));

            yield return(600);

            DDGround.EL.Add(SCommon.Supplier(DrawString(150, 150, "\u3082\u3046\u4e00\u5ea6\u751f\u304d\u3066\u307f\u3088\u3046\u3002", 1200)));
            yield return(480);

            DDGround.EL.Add(SCommon.Supplier(DrawString(150, 300, "\u305d\u3093\u306a\u6c17\u6301\u3061\u3082\u306a\u304b\u3063\u305f\u308f\u3051\u3058\u3083\u306a\u3044\u3002", 800)));
            yield return(240);

            DDGround.EL.Add(SCommon.Supplier(DrawString(150, 350, "\u3051\u3069\u3001\u3053\u308c\u3082\u30a2\u30bf\u30b7\u304c\u671b\u3093\u3067\u3044\u305f\u7d50\u679c\u306e\uff11\u3064\u3002")));

            BlockCreateRateTarget   = 0.0;
            BlockCreateRateApprRate = 0.995;

            yield return(620);

            DDGround.EL.Add(SCommon.Supplier(DrawString(400, 250, "\u2026\u2026\u60aa\u304f\u306a\u3044\u7d42\u308f\u308a\u304b\u305f\u3002")));

            BlockCreateRateTarget   = 0.0;
            BlockCreateRateApprRate = 0.98;

            yield return(120);

            BlockCreateRateTarget   = 0.0;
            BlockCreateRateApprRate = 0.92;

            yield return(680);

            DDCurtain.SetCurtain(30, -1.0);
            DDMusicUtils.Fade();
            yield return(40);
        }
Ejemplo n.º 13
0
        public void Perform()
        {
            // 開発中_暫定
            {
                int endFrame = DDEngine.ProcFrame + 300;

                DDGround.EL.Add(() =>
                {
                    int sec = endFrame - DDEngine.ProcFrame;

                    DDPrint.SetDebug(70, DDConsts.Screen_H - 32);
                    DDPrint.Print("これはクローズドテスト版です。仮リソース・実装されていない機能を含みます。(あと " + (sec / 60.0).ToString("F1") + " 秒で消えます)");

                    return(0 < sec);
                });
            }

            foreach (DDScene scene in DDSceneUtils.Create(60))             // LiteStatusDlg を閉じるまでの遅延の分(30フレーム)延長
            //foreach (DDScene scene in DDSceneUtils.Create(30))
            {
                DDCurtain.DrawCurtain();
                DDEngine.EachFrame();
            }

            double z1 = 0.3;
            double z2 = 2.0;
            double z3 = 3.7;

            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDCurtain.DrawCurtain();

                DDDraw.SetAlpha(scene.Rate);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.7);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(0.8 + 0.5 * scene.Rate);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z2);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z3);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDUtils.Approach(ref z1, 1.0, 0.9);
                DDUtils.Approach(ref z2, 1.0, 0.98);
                DDUtils.Approach(ref z3, 1.0, 0.95);

                DDEngine.EachFrame();
            }
            foreach (DDScene scene in DDSceneUtils.Create(90))
            {
                DDCurtain.DrawCurtain();
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDEngine.EachFrame();
            }
            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDCurtain.DrawCurtain();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(1.0 - 0.3 * scene.Rate);
                DDDraw.DrawRotate(scene.Rate * -0.1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(1.0 + 0.8 * scene.Rate);
                DDDraw.DrawRotate(scene.Rate * 0.1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2 + scene.Rate * 100.0, DDConsts.Screen_H / 2);
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2 + scene.Rate * 50.0);
                DDDraw.Reset();

                DDEngine.EachFrame();
            }
        }
Ejemplo n.º 14
0
        public void Main01(string spectrumFile, DDPicture jacket, string wDir, int spBarNum, int spBarWidth, int spBarHeight, I3Color spBarColor, double spBarAlpha, double z2)
        {
            FileTools.Delete(wDir);
            FileTools.CreateDir(wDir);

            this.SpData = new SpectrumData(spectrumFile);

            double a   = -1.0;
            double foa = 0.0;

            double xz = DDConsts.Screen_W * 1.0 / jacket.Get_W();
            double yz = DDConsts.Screen_H * 1.0 / jacket.Get_H();

            double bz1 = Math.Max(xz, yz);
            double bz2 = Math.Min(xz, yz);

            double z1 = 1.0;
            //double z2 = 2.0;

            const int JACKET_MARGIN = 10;

            using (DDSubScreen pseudoMainScreen = new DDSubScreen(
                       DDConsts.Screen_W,
                       DDConsts.Screen_H
                       ))
                using (DDSubScreen workScreen = new DDSubScreen(
                           DDConsts.Screen_W,
                           DDConsts.Screen_H
                           ))
                    using (DDSubScreen jacketScreen = new DDSubScreen(
                               jacket.Get_W() + JACKET_MARGIN * 2,
                               jacket.Get_H() + JACKET_MARGIN * 2,
                               true
                               ))
                    {
                        // ---- jacketScreen

                        DDSubScreenUtils.ChangeDrawScreen(jacketScreen);
                        DX.ClearDrawScreen();

                        DDDraw.DrawCenter(jacket, jacketScreen.GetSize().W / 2, jacketScreen.GetSize().H / 2);

                        DDSubScreenUtils.RestoreDrawScreen();

                        // ----

                        SpectrumScreen0001 spScr = new SpectrumScreen0001(spBarNum, spBarWidth, spBarHeight, spBarColor);

                        while (this.Frame < this.SpData.Rows.Length)
                        {
                            double[] row = this.SpData.Rows[this.Frame];

                            spScr.Draw(row);

                            // ---- workScreen

                            DDSubScreenUtils.ChangeDrawScreen(workScreen);

                            DDDraw.DrawBegin(jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                            DDDraw.DrawZoom(bz1 * z1);
                            DDDraw.DrawEnd();

                            DX.GraphFilter(workScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);

                            //DDSubScreenUtils.RestoreDrawScreen();

                            // ---- pseudoMainScreen

                            DDSubScreenUtils.ChangeDrawScreen(pseudoMainScreen);

                            DDDraw.DrawSimple(workScreen.ToPicture(), 0, 0);

                            DDCurtain.DrawCurtain(-0.5);

                            DDDraw.DrawBegin(
                                jacketScreen.ToPicture(),
                                //jacket,
                                DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                            DDDraw.DrawZoom(bz2 * z2);
                            DDDraw.DrawEnd();

                            DDCurtain.DrawCurtain(Math.Min(a, foa));

                            DDDraw.SetAlpha(spBarAlpha);
                            DDDraw.DrawCenter(spScr.Screen.ToPicture(), DDConsts.Screen_W / 2, DDConsts.Screen_H - spBarHeight / 2 - 10);
                            DDDraw.Reset();

                            // ここでフレームを保存
                            DX.SaveDrawScreenToJPEG(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, Path.Combine(wDir, string.Format("{0}.jpg", this.Frame)), Consts.JPEG_QUALITY);
                            //DX.SaveDrawScreen(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, Path.Combine(wDir, string.Format("{0}.bmp", this.Frame)));

                            DDSubScreenUtils.RestoreDrawScreen();

                            // ---- 以降、フレーム毎の処理

                            if (40 < this.Frame)
                            {
                                DDUtils.Approach(ref a, 0.0, 0.985);
                            }

                            if (this.SpData.Rows.Length - 40 < this.Frame)
                            {
                                DDUtils.Approach(ref foa, -1.0, 0.9);
                            }

                            //DDUtils.Approach(ref z1, 1.2, 0.999);
                            //z1 += 0.0001;
                            DDUtils.Approach(ref z2, 1.0, 0.9985);

                            if (this.Frame % 30 == 0)             // 毎回やる必要は無い。
                            {
                                DDCurtain.DrawCurtain();

                                DDPrint.SetPrint(16, 16, 32);
                                DDPrint.SetBorder(new I3Color(0, 64, 128));

                                DDPrint.PrintLine("ConvGenVideo");
                                //DDPrint.PrintLine("ConvGenVideo [Version " + DDUserDatStrings.Version + "]");
                                DDPrint.PrintLine("映像を生成しています...");
                                DDPrint.PrintLine("右上の[X]ボタンを押すと全ての処理を中止(キャンセル)します。");

                                {
                                    double    rate           = this.Frame * 1.0 / this.SpData.Rows.Length;
                                    const int PROGRESS_BAR_H = 10;

                                    DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, (DDConsts.Screen_H - PROGRESS_BAR_H) / 2, Math.Max(5, DDConsts.Screen_W * rate), PROGRESS_BAR_H);
                                }

                                DDEngine.EachFrame();
                            }
                            this.Frame++;
                        }
                    }
        }
Ejemplo n.º 15
0
        private static void DrawWall()
        {
            {
                DDUtils.Approach(ref Game.I.BackgroundSlideRate, Game.I.Player.Y * 1.0 / GameConsts.FIELD_H, 0.99);

                D4Rect rect = DDUtils.AdjustRectExterior(
                    new D2Size(GameConsts.FIELD_W, GameConsts.FIELD_H),
                    new D4Rect(0, 0, DDConsts.Screen_W, DDConsts.Screen_H),
                    Game.I.BackgroundSlideRate
                    );

                DDDraw.DrawRect(P_Field.ToPicture(), rect);
            }

            {
                const int MARGIN = 5;

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

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

            DDCurtain.DrawCurtain(0.2);
            //DDCurtain.DrawCurtain(-0.2);

            // DDGround.MainScreen をグレースケール化
            {
                DX.GraphBlend(
                    GrayScreen_R.GetHandle(),                     // ソース画像かつ出力先
                    DDGround.MainScreen.GetHandle(),              // ブレンド画像
                    255,
                    DX.DX_GRAPH_BLEND_RGBA_SELECT_MIX,
                    DX.DX_RGBA_SELECT_BLEND_R,                  // 出力先に適用する R 値
                    DX.DX_RGBA_SELECT_BLEND_R,                  // 出力先に適用する G 値
                    DX.DX_RGBA_SELECT_BLEND_R,                  // 出力先に適用する B 値
                    DX.DX_RGBA_SELECT_SRC_A                     // 出力先に適用する A 値
                    );

                // DX_RGBA_SELECT_SRC_R == ソース画像の R 値
                // DX_RGBA_SELECT_SRC_G == ソース画像の G 値
                // DX_RGBA_SELECT_SRC_B == ソース画像の B 値
                // DX_RGBA_SELECT_SRC_A == ソース画像の A 値
                // DX_RGBA_SELECT_BLEND_R == ブレンド画像の R 値
                // DX_RGBA_SELECT_BLEND_G == ブレンド画像の G 値
                // DX_RGBA_SELECT_BLEND_B == ブレンド画像の B 値
                // DX_RGBA_SELECT_BLEND_A == ブレンド画像の A 値

                DX.GraphBlend(
                    GrayScreen_G.GetHandle(),
                    DDGround.MainScreen.GetHandle(),
                    255,
                    DX.DX_GRAPH_BLEND_RGBA_SELECT_MIX,
                    DX.DX_RGBA_SELECT_BLEND_G,
                    DX.DX_RGBA_SELECT_BLEND_G,
                    DX.DX_RGBA_SELECT_BLEND_G,
                    DX.DX_RGBA_SELECT_SRC_A
                    );

                DX.GraphBlend(
                    GrayScreen_B.GetHandle(),
                    DDGround.MainScreen.GetHandle(),
                    255,
                    DX.DX_GRAPH_BLEND_RGBA_SELECT_MIX,
                    DX.DX_RGBA_SELECT_BLEND_B,
                    DX.DX_RGBA_SELECT_BLEND_B,
                    DX.DX_RGBA_SELECT_BLEND_B,
                    DX.DX_RGBA_SELECT_SRC_A
                    );

                DDDraw.DrawSimple(GrayScreen_R.ToPicture(), 0, 0);
                DDDraw.SetAlpha(0.5);
                DDDraw.DrawSimple(GrayScreen_G.ToPicture(), 0, 0);
                DDDraw.SetAlpha(0.333);
                DDDraw.DrawSimple(GrayScreen_B.ToPicture(), 0, 0);
                DDDraw.Reset();
            }
        }
Ejemplo n.º 16
0
        public void Perform()
        {
            if (DDConfig.LOG_ENABLED)             // 開発・デバッグ_モードであることを表示
            {
#if true
                DDGround.EL.Keep(300, () =>
                {
                    DDPrint.SetPrint(50, DDConsts.Screen_H - 32, 16, 16);
                    DDPrint.Print("これはクローズドテスト版です。仮リソース・実装されていない機能を含みます。(このメッセージは数秒で消えます)");
                });
#else // old same
                int endFrame = DDEngine.ProcFrame + 300;

                DDGround.EL.Add(() =>
                {
                    int remFrame = endFrame - DDEngine.ProcFrame;

                    DDPrint.SetPrint(40, DDConsts.Screen_H - 32, 16, 18);
                    DDPrint.Print("これはクローズドテスト版です。仮リソース・実装されていない機能を含みます。(あと " + (remFrame / 60.0).ToString("F1") + " 秒で消えます)");

                    return(0 < remFrame);
                });
#endif
            }

            foreach (DDScene scene in DDSceneUtils.Create(60))             // LiteStatusDlg を閉じるまでの遅延の分(30フレーム)延長
            //foreach (DDScene scene in DDSceneUtils.Create(30))
            {
                DDCurtain.DrawCurtain();
                DDEngine.EachFrame();
            }

            double z1 = 0.3;
            double z2 = 2.0;
            double z3 = 3.7;

            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDCurtain.DrawCurtain();

                DDDraw.SetAlpha(scene.Rate);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.7);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(0.8 + 0.5 * scene.Rate);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z2);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z3);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDUtils.Approach(ref z1, 1.0, 0.9);
                DDUtils.Approach(ref z2, 1.0, 0.98);
                DDUtils.Approach(ref z3, 1.0, 0.95);

                DDEngine.EachFrame();
            }

            {
                long endLoopTime = long.MaxValue;

                for (int frame = 0; ; frame++)
                {
                    if (endLoopTime < DDEngine.FrameStartTime)
                    {
                        break;
                    }

                    if (frame == 1)
                    {
                        endLoopTime = DDEngine.FrameStartTime + 1500;
                        DDTouch.Touch();
                    }
                    DDCurtain.DrawCurtain();
                    DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                    DDEngine.EachFrame();
                }
            }

            // アプリ固有 >

            Ground.I.Music.Title.Play();             // ここで再生

            // < アプリ固有

            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDCurtain.DrawCurtain();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(1.0 - 0.3 * scene.Rate);
                DDDraw.DrawRotate(scene.Rate * -0.1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(1.0 + 0.8 * scene.Rate);
                DDDraw.DrawRotate(scene.Rate * 0.1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2 + scene.Rate * 100.0, DDConsts.Screen_H / 2);
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2 + scene.Rate * 50.0);
                DDDraw.Reset();

                DDEngine.EachFrame();
            }
        }
Ejemplo n.º 17
0
        private IEnumerable <bool> DrawString(int x, int y, string text, int frameMax = 600)
        {
            DDSubScreen subScreenTmp = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H, true);
            DDSubScreen subScreen    = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H, true);

            SubScreens.Add(subScreenTmp);
            SubScreens.Add(subScreen);

            using (subScreenTmp.Section())
            {
                DX.ClearDrawScreen();

                DDFontUtils.DrawString_XCenter(x, y, text, DDFontUtils.GetFont("K\u30b4\u30b7\u30c3\u30af", 30));

                ぼかし効果.Perform(0.01);
            }
            for (int c = 0; c < 3; c++)
            {
                using (subScreen.Section())
                {
                    DX.ClearDrawScreen();

                    for (int d = 0; d < 30; d++)
                    {
                        DDDraw.SetBlendAdd(1.0);
                        DDDraw.DrawSimple(subScreenTmp.ToPicture(), 0, 0);
                        DDDraw.Reset();
                    }
                    ぼかし効果.Perform(0.01);
                }
                SCommon.Swap(ref subScreen, ref subScreenTmp);
            }
            using (subScreen.Section())
            {
                DX.ClearDrawScreen();

                DDDraw.SetBright(0.0, 0.1, 0.2);
                DDDraw.DrawSimple(subScreenTmp.ToPicture(), 0, 0);
                DDDraw.Reset();

                DDFontUtils.DrawString_XCenter(x, y, text, DDFontUtils.GetFont("K\u30b4\u30b7\u30c3\u30af", 30));
            }

            double a     = 0.0;
            double aTarg = 1.0;

            foreach (DDScene scene in DDSceneUtils.Create(frameMax))
            {
                if (scene.Numer == scene.Denom - 300)
                {
                    aTarg = 0.0;
                }

                DDUtils.Approach(ref a, aTarg, 0.985);

                DDDraw.SetAlpha(a);
                DDDraw.DrawSimple(subScreen.ToPicture(), 0, 0);
                DDDraw.Reset();

                yield return(true);
            }
        }
Ejemplo n.º 18
0
        public void Main01(string rDir, string wRootDir, int spBarNum, int spBarWidth, int spBarHeight, I3Color spBarColor, double spBarAlpha, double z2 = 2.0)
        {
            string wLocalDir = string.Format("Bar={0:D2}_Bar-W={1:D2}_Bar-H={2:D3}_Bar-C={3}_Bar-A={4:F3}", spBarNum, spBarWidth, spBarHeight, spBarColor, spBarAlpha);

            this.RDir = rDir;
            this.WDir = Path.Combine(wRootDir, wLocalDir);

            if (Directory.Exists(this.RDir) == false)
            {
                throw new Exception("no RDir: " + this.RDir);
            }

            FileTools.Delete(this.WDir);
            FileTools.CreateDir(this.WDir);

            DDPicture jacket = DDPictureLoaders.Standard(Path.Combine(this.RDir, "Jacket.jpg"));             // g

            this.SpData = new SpectrumData(Path.Combine(this.RDir, "Spectrum.csv"));

            double a   = -1.0;
            double foa = 0.0;

            double xz = DDConsts.Screen_W * 1.0 / jacket.Get_W();
            double yz = DDConsts.Screen_H * 1.0 / jacket.Get_H();

            double bz1 = Math.Max(xz, yz);
            double bz2 = Math.Min(xz, yz);

            double z1 = 1.0;
            //double z2 = 2.0; // 引数化 @ 2020.7.19

            const int JACKET_MARGIN = 10;

            DDSubScreen workScreen   = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H);                                         // g
            DDSubScreen jacketScreen = new DDSubScreen(jacket.Get_W() + JACKET_MARGIN * 2, jacket.Get_H() + JACKET_MARGIN * 2, true); // g

            // ---- jacketScreen

            DDSubScreenUtils.ChangeDrawScreen(jacketScreen);
            DX.ClearDrawScreen();

            DDDraw.DrawCenter(jacket, jacketScreen.GetSize().W / 2, jacketScreen.GetSize().H / 2);

            DDSubScreenUtils.RestoreDrawScreen();

            // ----

            SpectrumScreen0001 spScr = new SpectrumScreen0001(spBarNum, spBarWidth, spBarHeight, spBarColor);

            while (this.Frame < this.SpData.Rows.Length)
            {
                double[] row = this.SpData.Rows[this.Frame];

                // ---- workScreen

                DDSubScreenUtils.ChangeDrawScreen(workScreen);

                DDDraw.DrawBegin(jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(bz1 * z1);
                DDDraw.DrawEnd();

                DX.GraphFilter(workScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);

                DDSubScreenUtils.RestoreDrawScreen();

                // ----

                DDDraw.DrawSimple(workScreen.ToPicture(), 0, 0);

                DDCurtain.DrawCurtain(-0.5);

                DDDraw.DrawBegin(
                    jacketScreen.ToPicture(),
                    //jacket,
                    DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(bz2 * z2);
                DDDraw.DrawEnd();

                DDCurtain.DrawCurtain(Math.Min(a, foa));

                spScr.Draw(this.SpData.Rows[this.Frame]);

                DDDraw.SetAlpha(spBarAlpha);                 // ★要調整
                DDDraw.DrawCenter(spScr.Screen.ToPicture(), DDConsts.Screen_W / 2, DDConsts.Screen_H - spBarHeight / 2 - 10);
                DDDraw.Reset();

                if (40 < this.Frame)
                {
                    DDUtils.Approach(ref a, 0.0, 0.985);
                }

                if (this.SpData.Rows.Length - 40 < this.Frame)
                {
                    DDUtils.Approach(ref foa, -1.0, 0.9);
                }

                //DDUtils.Approach(ref z1, 1.2, 0.999);
                //z1 += 0.0001;
                DDUtils.Approach(ref z2, 1.0, 0.9985);

                this.MG_EachFrame();
            }

            // ゴミ内のハンドルだけでも開放する。
            {
                DDPictureUtils.UnloadAll();
                DDSubScreenUtils.UnloadAll();
            }
        }
Ejemplo n.º 19
0
        public void Perform()
        {
            foreach (DDScene scene in DDSceneUtils.Create(30))
            {
                DDCurtain.DrawCurtain();
                DDEngine.EachFrame();
            }

            double z1 = 0.3;
            double z2 = 2.0;
            double z3 = 3.7;

            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDCurtain.DrawCurtain();

                DDDraw.SetAlpha(scene.Rate);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.7);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(0.8 + 0.5 * scene.Rate);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z2);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z3);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDUtils.Approach(ref z1, 1.0, 0.9);
                DDUtils.Approach(ref z2, 1.0, 0.98);
                DDUtils.Approach(ref z3, 1.0, 0.95);

                DDEngine.EachFrame();
            }
            foreach (DDScene scene in DDSceneUtils.Create(90))
            {
                DDCurtain.DrawCurtain();
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDEngine.EachFrame();
            }
            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDCurtain.DrawCurtain();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(1.0 - 0.3 * scene.Rate);
                DDDraw.DrawRotate(scene.Rate * -0.1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(1.0 + 0.8 * scene.Rate);
                DDDraw.DrawRotate(scene.Rate * 0.1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2 + scene.Rate * 100.0, DDConsts.Screen_H / 2);
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2 + scene.Rate * 50.0);
                DDDraw.Reset();

                DDEngine.EachFrame();
            }
        }
Ejemplo n.º 20
0
        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;
        }
Ejemplo n.º 21
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() ★★★
        }
Ejemplo n.º 22
0
        public bool PlayerWasDead = false;         // 死亡すると true にセットされる。

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

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

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

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

            this.Player.Reset(false);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    double speed;

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

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

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

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

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

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

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

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

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

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

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

                // ----

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

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

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

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

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

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

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

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

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

                    RippleEffect.EachFrame(this.Field);

                    this.EL_AfterDrawWalls.ExecuteAllTask();

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

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

                    this.EL_AfterDrawShots.ExecuteAllTask();

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

                    this.EL_AfterDrawPlayer.ExecuteAllTask();

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

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

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

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

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

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

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

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

                {
                    const int MARGIN = 5;

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

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

                DDCurtain.DrawCurtain(-0.2);

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

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

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

                this.当たり判定();

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

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

                f_ゴミ回収();

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

                DDEngine.EachFrame();

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

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

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

            DDMain.KeepMainScreen();

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

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

            // ★★★ end of Perform() ★★★
        }
Ejemplo n.º 23
0
        public void Main01(string rDir, string wDir)
        {
            this.RDir = rDir;
            this.WDir = wDir;

            if (Directory.Exists(this.RDir) == false)
            {
                throw new Exception("no RDir: " + this.RDir);
            }

            FileTools.Delete(this.WDir);
            FileTools.CreateDir(this.WDir);

            DDPicture jacket = DDPictureLoaders.Standard(Path.Combine(this.RDir, "Jacket.jpg"));             // g

            this.SpData = new SpectrumData(Path.Combine(this.RDir, "Spectrum.csv"));

            double a   = -1.0;
            double foa = 0.0;

            double xz = DDConsts.Screen_W * 1.0 / jacket.Get_W();
            double yz = DDConsts.Screen_H * 1.0 / jacket.Get_H();

            double bz1 = Math.Max(xz, yz);
            double bz2 = Math.Min(xz, yz);

            double z1 = 1.0;
            double z2 = 2.0;

            const int JACKET_MARGIN = 10;

            DDSubScreen workScreen   = new DDSubScreen(DDConsts.Screen_W, DDConsts.Screen_H);                                         // g
            DDSubScreen jacketScreen = new DDSubScreen(jacket.Get_W() + JACKET_MARGIN * 2, jacket.Get_H() + JACKET_MARGIN * 2, true); // g

            // ---- jacketScreen

            DDSubScreenUtils.ChangeDrawScreen(jacketScreen);
            DX.ClearDrawScreen();

            DDDraw.DrawCenter(jacket, jacketScreen.GetSize().W / 2, jacketScreen.GetSize().H / 2);

            DDSubScreenUtils.RestoreDrawScreen();

            // ----

            SpectrumScreen0001 spScr = new SpectrumScreen0001();

            while (this.Frame < this.SpData.Rows.Length)
            {
                double[] row = this.SpData.Rows[this.Frame];

                // ---- workScreen

                DDSubScreenUtils.ChangeDrawScreen(workScreen);

                DDDraw.DrawBegin(jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(bz1 * z1);
                DDDraw.DrawEnd();

                DX.GraphFilter(workScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);

                DDSubScreenUtils.RestoreDrawScreen();

                // ----

                DDDraw.DrawSimple(workScreen.ToPicture(), 0, 0);

                DDCurtain.DrawCurtain(-0.5);

                DDDraw.DrawBegin(
                    jacketScreen.ToPicture(),
                    //jacket,
                    DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(bz2 * z2);
                DDDraw.DrawEnd();

                DDCurtain.DrawCurtain(Math.Min(a, foa));

                spScr.Draw(this.SpData.Rows[this.Frame]);

                DDDraw.SetAlpha(0.6);                 // ★要調整
                DDDraw.DrawCenter(spScr.Screen.ToPicture(), DDConsts.Screen_W / 2, DDConsts.Screen_H - 110);
                DDDraw.Reset();

                if (40 < this.Frame)
                {
                    DDUtils.Approach(ref a, 0.0, 0.985);
                }

                if (this.SpData.Rows.Length - 40 < this.Frame)
                {
                    DDUtils.Approach(ref foa, -1.0, 0.9);
                }

                //DDUtils.Approach(ref z1, 1.2, 0.999);
                z1 += 0.0001;
                DDUtils.Approach(ref z2, 1.0, 0.9985);

                this.MG_EachFrame();
            }
        }
Ejemplo n.º 24
0
        public void Perform()
        {
            if (DDConfig.LOG_ENABLED)             // 開発・デバッグ_モードであることを表示
            {
#if true
                DDGround.EL.Keep(300, () =>
                {
                    DDPrint.SetDebug(30, DDConsts.Screen_H - 32);
                    DDPrint.Print("これはクローズドテスト版です。仮リソース・未実装・不完全な機能を含みます。(このメッセージは数秒で消えます)");
                });
#else // old nearly same
                int endFrame = DDEngine.ProcFrame + 300;

                DDGround.EL.Add(() =>
                {
                    int remFrame = endFrame - DDEngine.ProcFrame;

                    DDPrint.SetDebug(70, DDConsts.Screen_H - 32);
                    DDPrint.Print("これはクローズドテスト版です。仮リソース・未実装・不完全な機能を含みます。(あと " + (remFrame / 60.0).ToString("F1") + " 秒で消えます)");

                    return(0 < remFrame);
                });
#endif
            }

            foreach (DDScene scene in DDSceneUtils.Create(60))             // LiteStatusDlg を閉じるまでの遅延の分(30フレーム)延長
            //foreach (DDScene scene in DDSceneUtils.Create(30))
            {
                DDCurtain.DrawCurtain();
                DDEngine.EachFrame();
            }

            double z1 = 0.3;
            double z2 = 2.0;
            double z3 = 3.7;

            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDCurtain.DrawCurtain();

                DDDraw.SetAlpha(scene.Rate);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.7);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(0.8 + 0.5 * scene.Rate);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z2);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(z3);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDUtils.Approach(ref z1, 1.0, 0.9);
                DDUtils.Approach(ref z2, 1.0, 0.98);
                DDUtils.Approach(ref z3, 1.0, 0.95);

                DDEngine.EachFrame();
            }
            foreach (DDScene scene in DDSceneUtils.Create(90))
            {
                DDCurtain.DrawCurtain();
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDEngine.EachFrame();
            }
            foreach (DDScene scene in DDSceneUtils.Create(60))
            {
                DDCurtain.DrawCurtain();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(1.0 - 0.3 * scene.Rate);
                DDDraw.DrawRotate(scene.Rate * -0.1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.5);
                DDDraw.DrawBegin(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                DDDraw.DrawZoom(1.0 + 0.8 * scene.Rate);
                DDDraw.DrawRotate(scene.Rate * 0.1);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2 + scene.Rate * 100.0, DDConsts.Screen_H / 2);
                DDDraw.Reset();

                DDDraw.SetAlpha((1.0 - scene.Rate) * 0.3);
                DDDraw.DrawCenter(Ground.I.Picture.Copyright, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2 + scene.Rate * 50.0);
                DDDraw.Reset();

                DDEngine.EachFrame();
            }
        }
Ejemplo n.º 25
0
        public override void Draw()
        {
            this.X += this.XSpeed;
            this.Y += this.YSpeed;

            if (this.Y < this.Highest_Y)
            {
                DDUtils.Approach(ref this.YSpeed, 重力加速度, 0.9);
            }
            this.YSpeed = Math.Min(落下最高速度, this.YSpeed);

            int ix = SCommon.ToInt(this.X);
            int iy = SCommon.ToInt(this.Y);

            Around a2 = new Around(ix, iy, 2);

            int xDirSign = 0;
            int yDirSign = 0;

            if (this.Y < this.Highest_Y + 24.0)             // ? 最高高度に近い
            {
                if (
                    a2.Table[0, 0].IsEnemyPataWall() ||
                    a2.Table[0, 1].IsEnemyPataWall()
                    )
                {
                    xDirSign++;
                }

                if (
                    a2.Table[1, 0].IsEnemyPataWall() ||
                    a2.Table[1, 1].IsEnemyPataWall()
                    )
                {
                    xDirSign--;
                }
            }
            else
            {
                if (
                    a2.Table[0, 0].IsEnemyPataWall() &&
                    a2.Table[0, 1].IsEnemyPataWall()
                    )
                {
                    xDirSign++;
                }

                if (
                    a2.Table[1, 0].IsEnemyPataWall() &&
                    a2.Table[1, 1].IsEnemyPataWall()
                    )
                {
                    xDirSign--;
                }
            }

            if (
                !a2.Table[0, 0].IsEnemyPataWall() && a2.Table[0, 1].IsEnemyPataWall() ||
                !a2.Table[1, 0].IsEnemyPataWall() && a2.Table[1, 1].IsEnemyPataWall()
                )
            {
                yDirSign = -1;
            }
            else if (
                a2.Table[0, 0].IsEnemyPataWall() &&
                a2.Table[1, 0].IsEnemyPataWall()
                )
            {
                yDirSign = 1;
            }
            else
            {
                this.YSpeed += 重力加速度;
            }

            if (xDirSign != 0)
            {
                this.XSpeed = Math.Abs(this.XSpeed) * xDirSign;
            }

            if (yDirSign != 0)
            {
                this.YSpeed = Math.Abs(this.YSpeed) * yDirSign;
            }

            if (!EnemyCommon.IsOutOfScreen_ForDraw(this))
            {
                //DDDraw.SetBright(new I3Color(192, 32, 32)); // old
                DDDraw.SetBright(Game.I.Map.Design.EnemyColor_Pata);
                DDDraw.DrawBegin(Ground.I.Picture.WhiteBox, SCommon.ToInt(this.X - DDGround.ICamera.X), SCommon.ToInt(this.Y - DDGround.ICamera.Y));
                DDDraw.DrawSetSize(GameConsts.TILE_W, GameConsts.TILE_H);
                DDDraw.DrawEnd();
                DDDraw.Reset();

                this.Crash = DDCrashUtils.Rect_CenterSize(new D2Point(this.X, this.Y), new D2Size(GameConsts.TILE_W, GameConsts.TILE_H));

                Game.I.タイル接近_敵描画_Points.Add(new D2Point(this.X, this.Y));
            }
        }
Ejemplo n.º 26
0
        public void Main01(string spectrumFile, DDPicture jacket, string wDir, int spBarNum, int spBarWidth, int spBarHeight, I3Color spBarColor, double spBarAlpha, double z2)
        {
            FileTools.Delete(wDir);
            FileTools.CreateDir(wDir);

            this.SpData = new SpectrumData(spectrumFile);

            double a   = -1.0;
            double foa = 0.0;

            double xz = DDConsts.Screen_W * 1.0 / jacket.Get_W();
            double yz = DDConsts.Screen_H * 1.0 / jacket.Get_H();

            double bz1 = Math.Max(xz, yz);
            double bz2 = Math.Min(xz, yz);

            double z1 = 1.0;
            //double z2 = 2.0;

            const int JACKET_MARGIN = 10;

            using (DDSubScreen pseudoMainScreen = new DDSubScreen(
                       DDConsts.Screen_W,
                       DDConsts.Screen_H
                       ))
                using (DDSubScreen workScreen = new DDSubScreen(
                           DDConsts.Screen_W,
                           DDConsts.Screen_H
                           ))
                    using (DDSubScreen jacketScreen = new DDSubScreen(
                               jacket.Get_W() + JACKET_MARGIN * 2,
                               jacket.Get_H() + JACKET_MARGIN * 2,
                               true
                               ))
                    {
                        // ---- jacketScreen

                        DDSubScreenUtils.ChangeDrawScreen(jacketScreen);
                        DX.ClearDrawScreen();

                        DDDraw.DrawCenter(jacket, jacketScreen.GetSize().W / 2, jacketScreen.GetSize().H / 2);

                        DDSubScreenUtils.RestoreDrawScreen();

                        // ----

                        SpectrumScreen0001 spScr = new SpectrumScreen0001(spBarNum, spBarWidth, spBarHeight, spBarColor);

                        while (this.Frame < this.SpData.Rows.Length)
                        {
                            double[] row = this.SpData.Rows[this.Frame];

                            spScr.Draw(row);

                            // ---- workScreen

                            DDSubScreenUtils.ChangeDrawScreen(workScreen);

                            DDDraw.DrawBegin(jacket, DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                            DDDraw.DrawZoom(bz1 * z1);
                            DDDraw.DrawEnd();

                            DX.GraphFilter(workScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);

                            //DDSubScreenUtils.RestoreDrawScreen();

                            // ---- pseudoMainScreen

                            DDSubScreenUtils.ChangeDrawScreen(pseudoMainScreen);

                            DDDraw.DrawSimple(workScreen.ToPicture(), 0, 0);

                            DDCurtain.DrawCurtain(-0.5);

                            DDDraw.DrawBegin(
                                jacketScreen.ToPicture(),
                                //jacket,
                                DDConsts.Screen_W / 2, DDConsts.Screen_H / 2);
                            DDDraw.DrawZoom(bz2 * z2);
                            DDDraw.DrawEnd();

                            DDCurtain.DrawCurtain(Math.Min(a, foa));

                            DDDraw.SetAlpha(spBarAlpha);
                            DDDraw.DrawCenter(spScr.Screen.ToPicture(), DDConsts.Screen_W / 2, DDConsts.Screen_H - spBarHeight / 2 - 10);
                            DDDraw.Reset();

                            // ここでフレームを保存
                            DX.SaveDrawScreen(0, 0, DDConsts.Screen_W, DDConsts.Screen_H, Path.Combine(wDir, string.Format("{0}.bmp", this.Frame)));

                            DDSubScreenUtils.RestoreDrawScreen();

                            // ---- 実際に表示される画面の描画

                            DDCurtain.DrawCurtain();

                            {
                                double    rate           = this.Frame * 1.0 / this.SpData.Rows.Length;
                                const int PROGRESS_BAR_H = 10;

                                DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, (DDConsts.Screen_H - PROGRESS_BAR_H) / 2, Math.Max(5, DDConsts.Screen_W * rate), PROGRESS_BAR_H);
                            }

                            // ----

                            if (40 < this.Frame)
                            {
                                DDUtils.Approach(ref a, 0.0, 0.985);
                            }

                            if (this.SpData.Rows.Length - 40 < this.Frame)
                            {
                                DDUtils.Approach(ref foa, -1.0, 0.9);
                            }

                            //DDUtils.Approach(ref z1, 1.2, 0.999);
                            //z1 += 0.0001;
                            DDUtils.Approach(ref z2, 1.0, 0.9985);

                            this.MG_EachFrame();
                        }
                    }
        }