Exemple #1
0
        private void DrawSpectra(Canvas2 frameImg, SpectrumGraph0001 sg, ShadowSpectraData ss)
        {
            using (Graphics g = frameImg.GetGraphics(false))
            {
                int dr_l = 0;
                int dr_t = MARGIN_TB;
                int dr_w = frameImg.GetWidth();
                int dr_h = frameImg.GetHeight() - MARGIN_TB * 2;

                for (int index = 0; index < sg.Spectra.Length; index++)
                {
                    int x = index * (BAR_WIDTH + BAR_INTERVAL) + BAR_INTERVAL;
                    int w = BAR_WIDTH;

                    double v1 = ss.ShadowSpectra[index];
                    double v2 = sg.Spectra[index];

                    v1 *= 0.5;                     // 要調整
                    v2 *= 0.5;                     // 要調整

                    int h1 = DoubleTools.ToInt(v1 * dr_h);
                    int h2 = DoubleTools.ToInt(v2 * dr_h);

                    int y1 = dr_h - h1;
                    int y2 = dr_h - h2;

                    g.FillRectangle(new SolidBrush(Color.FromArgb(128, 255, 255, 255)),
                                    dr_l + x, dr_t + y1, w, h1);
                    g.FillRectangle(new SolidBrush(Color.White),
                                    dr_l + x, dr_t + y2, w, h2);
                }
            }
        }
Exemple #2
0
        private void DrawSpectra(Canvas2 frameImg, SpectrumGraph0001 sg, ShadowSpectraData ss)
        {
            using (Graphics g = frameImg.GetGraphics(false))
            {
                int dr_l = 10;
                int dr_t = 10;
                int dr_w = frameImg.GetWidth() - 20;
                int dr_h = frameImg.GetHeight() - 20;

                for (int index = 0; index < sg.Spectra.Length; index++)
                {
                    int x1 = (((index * 3 + 0) * dr_w) / (sg.Spectra.Length * 3 - 2));
                    int x2 = (((index * 3 + 1) * dr_w) / (sg.Spectra.Length * 3 - 2));
                    int w  = x2 - x1;

                    double v1 = ss.ShadowSpectra[index];
                    double v2 = sg.Spectra[index];

                    v1 /= 2.0;                     // 要調整
                    v2 /= 2.0;                     // 要調整

                    int h1 = DoubleTools.ToInt(v1 * dr_h);
                    int h2 = DoubleTools.ToInt(v2 * dr_h);

                    int y1 = dr_h - h1;
                    int y2 = dr_h - h2;

                    g.FillRectangle(new SolidBrush(Color.FromArgb(128, 255, 255, 255)),
                                    dr_l + x1, dr_t + y1, w, h1);
                    g.FillRectangle(new SolidBrush(Color.White),
                                    dr_l + x1, dr_t + y2, w, h2);
                }
            }
        }
Exemple #3
0
        public void Perform()
        {
            DDUtils.SetMouseDispMode(false);
            DDEngine.FreezeInput(10);

            double x     = DDConsts.Screen_W / 2;
            double y     = DDConsts.Screen_H / 2;
            double speed = SPEED_DEF;

            for (; ;)
            {
                DDMouse.UpdateMove();

                x += DDMouse.MoveX * speed;
                y += DDMouse.MoveY * speed;

                DDUtils.ToRange(ref x, 0, DDConsts.Screen_W - 1);
                DDUtils.ToRange(ref y, 0, DDConsts.Screen_H - 1);

                int ix = DoubleTools.ToInt(x);
                int iy = DoubleTools.ToInt(y);

                if (DDKey.IsPound(DX.KEY_INPUT_Z))
                {
                    speed += SPEED_CHANGE_STEP;
                }

                if (DDKey.IsPound(DX.KEY_INPUT_X))
                {
                    speed -= SPEED_CHANGE_STEP;
                }

                DDUtils.ToRange(ref speed, SPEED_MIN, SPEED_MAX);

                if (DDMouse.L.GetInput() == -1)
                {
                    break;
                }

                DDCurtain.DrawCurtain();

                DDPrint.SetPrint(0, 0, 24);
                DDPrint.PrintLine("★マウスカーソルを奪う");
                DDPrint.PrintLine("X=" + x.ToString("F3"));
                DDPrint.PrintLine("Y=" + y.ToString("F3"));
                DDPrint.PrintLine("Speed=" + speed);
                DDPrint.PrintLine("左クリックでメニューに戻る。");
                DDPrint.PrintLine("Zキー:速度上げ");
                DDPrint.PrintLine("Xキー:速度下げ");

                DDDraw.SetBright(new I3Color(255, 128, 0));
                DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, ix, iy - CROSS_WH / 2, 1, CROSS_WH);
                DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, ix - CROSS_WH / 2, iy, CROSS_WH, 1);
                DDDraw.Reset();

                DDEngine.EachFrame();
            }
            DDUtils.SetMouseDispMode(true);
        }
Exemple #4
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void SetAlpha(double a)
        {
            int pal = DoubleTools.ToInt(a * 255.0);

            pal = IntTools.ToRange(pal, 0, 255);

            Extra.A = pal;
        }
Exemple #5
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void SetBlendAdd(double a)
        {
            int pal = DoubleTools.ToInt(a * 255.0);

            pal = IntTools.ToRange(pal, 0, 255);

            Extra.BlendAdd = pal;
        }
Exemple #6
0
		//
		//	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
		//
		public static void SetVolume(int handle, double volume)
		{
			volume = DoubleTools.ToRange(volume, 0.0, 1.0);

			int pal = DoubleTools.ToInt(volume * 255.0);

			if (pal < 0 || 255 < pal)
				throw new DDError(); // 2bs

			if (DX.ChangeVolumeSoundMem(pal, handle) != 0) // ? 失敗
				throw new DDError();
		}
Exemple #7
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void SetBright(double r, double g, double b)
        {
            int pR = DoubleTools.ToInt(r * 255.0);
            int pG = DoubleTools.ToInt(g * 255.0);
            int pB = DoubleTools.ToInt(b * 255.0);

            pR = IntTools.ToRange(pR, 0, 255);
            pG = IntTools.ToRange(pG, 0, 255);
            pB = IntTools.ToRange(pB, 0, 255);

            Extra.Bright = new I3Color(pR, pG, pB);
        }
Exemple #8
0
        public void MakeVideo(WaveData wave, WorkingDir wd, Action <Canvas2> addImage)
        {
            int frameNum = DoubleTools.ToInt((wave.Length * 1.0 / wave.WavHz) * AudioPicMP4Props.FPS);

            foreach (AbstractVideoImageMaker videoImageMaker in this.VideoImageMakers)
            {
                videoImageMaker.FrameNum = frameNum;
                videoImageMaker.Wave     = wave;
                videoImageMaker.WD       = wd;

                // ----

                videoImageMaker.GetImage = EnumerableTools.Supplier(videoImageMaker.GetImageSequence());
            }
            for (int frame = 0; frame < frameNum; frame++)
            {
                Canvas2 frameImg = new Canvas2(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H);

                foreach (AbstractVideoImageMaker videoImageMaker in this.VideoImageMakers)
                {
                    videoImageMaker.FrameImg = frameImg;
                    videoImageMaker.Frame    = frame;
                    videoImageMaker.Rate     = frame * 1.0 / (frameNum - 1);
                    videoImageMaker.InvRate  = 1.0 - videoImageMaker.Rate;

                    {
                        Canvas2 currFrameImg = videoImageMaker.GetImage();

                        if (currFrameImg != null)
                        {
                            PictureUtils.Paste(frameImg, currFrameImg);
                        }
                    }

                    videoImageMaker.FrameImg = null;
                    videoImageMaker.Frame    = -1;
                    videoImageMaker.Rate     = -1.0;
                    videoImageMaker.InvRate  = -1.0;
                }
                addImage(frameImg);
            }
            foreach (AbstractVideoImageMaker videoImageMaker in this.VideoImageMakers)
            {
                videoImageMaker.FrameNum = -1;
                videoImageMaker.Wave     = null;
                videoImageMaker.WD       = null;

                // ----

                videoImageMaker.GetImage = null;
            }
        }
Exemple #9
0
        private void EditMode()
        {
            DDEngine.FreezeInput();
            DDUtils.SetMouseDispMode(true);

            for (; ;)
            {
                int lastMouseX = DDMouse.X;
                int lastMouseY = DDMouse.Y;

                DDMouse.UpdatePos();

                if (DDKey.GetInput(DX.KEY_INPUT_E) == 1)
                {
                    break;
                }

                if (1 <= DDKey.GetInput(DX.KEY_INPUT_LSHIFT) || 1 <= DDKey.GetInput(DX.KEY_INPUT_RSHIFT))                 // シフト押下 -> 移動モード
                {
                    if (1 <= DDMouse.L.GetInput())
                    {
                        DDGround.Camera.X -= DDMouse.X - lastMouseX;
                        DDGround.Camera.Y -= DDMouse.Y - lastMouseY;

                        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);
                    }
                }
                else                 // 編集モード
                {
                    GameEdit.EachFrame();
                }

                DrawWall();

                if (GameEdit.DisplayTileFlag)
                {
                    DrawMap();
                }

                GameEdit.Draw();

                DDEngine.EachFrame();
            }
            DDEngine.FreezeInput();
            DDUtils.SetMouseDispMode(false);
        }
Exemple #10
0
        private static void SetBlend(int mode, double a)
        {
            a = DoubleTools.ToRange(a, 0.0, 1.0);

            int pal = DoubleTools.ToInt(a * 255.0);

            if (pal < 0 || 255 < pal)
            {
                throw new GameError();
            }

            if (DX.SetDrawBlendMode(mode, pal) != 0)             // ? 失敗
            {
                throw new GameError();
            }
        }
Exemple #11
0
        private static void DrawWall()
        {
            DDUtils.Approach(ref WallBokashiRate, WallBokashiRateDest, 0.93);
            DDUtils.Approach(ref WallZRate, WallZRateDest, 0.9);

            // ---

            DDSubScreenUtils.ChangeDrawScreen(WorkScreen);
            DDDraw.DrawBegin(Ground.I.Picture.TitleWall, DDConsts.Screen_W / 2.0, DDConsts.Screen_H / 2.0);
            DDDraw.DrawZoom(WallZRate);
            DDDraw.DrawEnd();
            DX.GraphFilter(WorkScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, DoubleTools.ToInt(WallBokashiRate * 1000.0));             // 1
            DX.GraphFilter(WorkScreen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, DoubleTools.ToInt(WallBokashiRate * 1000.0));             // 2
            DDSubScreenUtils.RestoreDrawScreen();

            DDDraw.DrawSimple(DDPictureLoaders2.Wrapper(WorkScreen), 0, 0);
        }
Exemple #12
0
        private static void SetBright(double cR, double cG, double cB)         // (cR, cG, cB): 0.0 - 1.0 == 暗~明
        {
            // 0 - 255 と間違えている etc.
            //
            if (cR < -0.5 || 1.5 < cR)
            {
                throw new GameError();
            }
            if (cG < -0.5 || 1.5 < cG)
            {
                throw new GameError();
            }
            if (cB < -0.5 || 1.5 < cB)
            {
                throw new GameError();
            }

            cR = DoubleTools.ToRange(cR, 0.0, 1.0);
            cG = DoubleTools.ToRange(cG, 0.0, 1.0);
            cB = DoubleTools.ToRange(cB, 0.0, 1.0);

            int palR = DoubleTools.ToInt(cR * 255.0);
            int palG = DoubleTools.ToInt(cG * 255.0);
            int palB = DoubleTools.ToInt(cB * 255.0);

            if (palR < 0 || 255 < palR)
            {
                throw new GameError();
            }
            if (palG < 0 || 255 < palG)
            {
                throw new GameError();
            }
            if (palB < 0 || 255 < palB)
            {
                throw new GameError();
            }

            if (DX.SetDrawBright(palR, palG, palB) != 0)             // ? 失敗
            {
                throw new GameError();
            }
        }
Exemple #13
0
        public override IEnumerable <Canvas2> GetImageSequence()
        {
            ShadowSpectraData ss = new ShadowSpectraData();

            for (; ;)
            {
                this.Wave.SetWavPart(DoubleTools.ToInt((this.Frame * 1.0 / AudioPicMP4Props.FPS + AudioPicMP4Props.AUDIO_DELAY_SEC) * this.Wave.WavHz));
                SpectrumGraph0001 sg = new SpectrumGraph0001(hz => this.Wave.GetSpectrum(hz));
                ss.Projection(sg.Spectra);
                int w = sg.Spectra.Length * (BAR_WIDTH + BAR_INTERVAL) + BAR_INTERVAL;

                Canvas2 frameImg = new Canvas2(w, AudioPicMP4Props.VIDEO_H);

                PictureUtils.Fill(frameImg, Color.Transparent);

                this.DrawSpectra(frameImg, sg, ss);

                yield return(frameImg);
            }
        }
Exemple #14
0
        private void Test01_a(string rFile, string wFile)
        {
            WaveData wave = new WaveData(rFile);

            using (CsvFileWriter writer = new CsvFileWriter(wFile))
            {
                for (double sec = 0.0; sec < wave.Length * 1.0 / wave.WavHz; sec += 0.1)
                {
                    Console.WriteLine("sec: " + sec);                     // test

                    wave.SetWavPart(DoubleTools.ToInt(sec * wave.WavHz));

                    for (int hz = 30; hz < 4200; hz += 10)
                    {
                        writer.WriteCell(wave.GetSpectrum(hz).ToString("F9"));
                    }
                    writer.EndRow();
                }
            }
        }
Exemple #15
0
        public override IEnumerable <Canvas2> GetImageSequence()
        {
            ShadowSpectraData ssL = new ShadowSpectraData();
            ShadowSpectraData ssR = new ShadowSpectraData();

            for (; ;)
            {
                this.Wave.SetWavPart(DoubleTools.ToInt((this.Frame * 1.0 / AudioPicMP4Props.FPS + AudioPicMP4Props.AUDIO_DELAY_SEC) * this.Wave.WavHz));
                SpectrumGraph0001 sgL = new SpectrumGraph0001(hz => this.Wave.GetSpectrum_L(hz))
                {
                    R1 = 0.5, R2 = 0.5
                };
                SpectrumGraph0001 sgR = new SpectrumGraph0001(hz => this.Wave.GetSpectrum_R(hz))
                {
                    R1 = 0.5, R2 = 0.5
                };
                ssL.Projection(sgL.Spectra);
                ssR.Projection(sgR.Spectra);
                int w = sgL.Spectra.Length * (BAR_WIDTH + BAR_INTERVAL) + BAR_INTERVAL;

                Canvas2 frameImg_L = new Canvas2(w, AudioPicMP4Props.VIDEO_H);
                Canvas2 frameImg_R = new Canvas2(w, AudioPicMP4Props.VIDEO_H);

                PictureUtils.Fill(frameImg_L, Color.Transparent);
                PictureUtils.Fill(frameImg_R, Color.Transparent);

                this.DrawSpectra(frameImg_L, sgL, ssL, Color.FromArgb(255, 255, 200), false);
                this.DrawSpectra(frameImg_R, sgR, ssR, Color.FromArgb(200, 255, 255), true);

                Canvas2 frameImg = new Canvas2(w * 2, AudioPicMP4Props.VIDEO_H);

                PictureUtils.Paste(frameImg, frameImg_L, 0, 0, w, AudioPicMP4Props.VIDEO_H);
                PictureUtils.Paste(frameImg, frameImg_R, w, 0, w, AudioPicMP4Props.VIDEO_H);

                yield return(frameImg);
            }
        }
Exemple #16
0
        public void Main01()
        {
            FileTools.Delete(W_DIR);
            FileTools.CreateDir(W_DIR);

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

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

                DDCurtain.DrawCurtain();
                DDPrint.SetPrint(0, 20, 23);

                for (int index = 0; index < 45; index++)
                {
                    double lv = 0.0;

                    for (int c = 0; c < 2; c++)
                    {
                        lv += row[index * 2 + c];
                    }

                    int iLv = DoubleTools.ToInt(lv * 145.0);

                    for (int c = 0; c < iLv; c++)
                    {
                        DDPrint.Print("*");
                    }

                    DDPrint.PrintRet();
                }

                this.MG_EachFrame();
            }
        }
Exemple #17
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;
        }
Exemple #18
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        private static void DrawPic_Main(DDPicture picture, ILayoutInfo layout)
        {
            // app > @ enter DrawPic

            // < app

            if (Extra.A != -1)
            {
                SetBlend(DX.DX_BLENDMODE_ALPHA, Extra.A);
            }
            else if (Extra.BlendAdd != -1)
            {
                SetBlend(DX.DX_BLENDMODE_ADD, Extra.BlendAdd);
            }
            else if (Extra.BlendInv)
            {
                SetBlend(DX.DX_BLENDMODE_INVSRC, 255);
            }

            if (Extra.Mosaic)
            {
                DX.SetDrawMode(DX.DX_DRAWMODE_NEAREST);
            }
            if (Extra.Bright.R != -1)
            {
                SetBright(Extra.Bright.R, Extra.Bright.G, Extra.Bright.B);
            }

            {
                FreeInfo u = layout as FreeInfo;

                if (u != null)
                {
                    // ? 失敗
                    if (
                        Extra.IntPos ?
                        DX.DrawModiGraph(
                            DoubleTools.ToInt(u.LTX),
                            DoubleTools.ToInt(u.LTY),
                            DoubleTools.ToInt(u.RTX),
                            DoubleTools.ToInt(u.RTY),
                            DoubleTools.ToInt(u.RBX),
                            DoubleTools.ToInt(u.RBY),
                            DoubleTools.ToInt(u.LBX),
                            DoubleTools.ToInt(u.LBY),
                            picture.GetHandle(),
                            1
                            )
                        != 0
                                                :
                        DX.DrawModiGraphF(
                            (float)u.LTX,
                            (float)u.LTY,
                            (float)u.RTX,
                            (float)u.RTY,
                            (float)u.RBX,
                            (float)u.RBY,
                            (float)u.LBX,
                            (float)u.LBY,
                            picture.GetHandle(),
                            1
                            )
                        != 0
                        )
                    {
                        if (Extra.IgnoreError == false)
                        {
                            throw new DDError();
                        }
                    }
                    goto endDraw;
                }
            }

            {
                RectInfo u = layout as RectInfo;

                if (u != null)
                {
                    // ? 失敗
                    if (
                        Extra.IntPos ?
                        DX.DrawExtendGraph(
                            DoubleTools.ToInt(u.L),
                            DoubleTools.ToInt(u.T),
                            DoubleTools.ToInt(u.R),
                            DoubleTools.ToInt(u.B),
                            picture.GetHandle(),
                            1
                            )
                        != 0
                                                :
                        DX.DrawExtendGraphF(
                            (float)u.L,
                            (float)u.T,
                            (float)u.R,
                            (float)u.B,
                            picture.GetHandle(),
                            1
                            )
                        != 0
                        )
                    {
                        if (Extra.IgnoreError == false)
                        {
                            throw new DDError();
                        }
                    }
                    goto endDraw;
                }
            }

            {
                SimpleInfo u = layout as SimpleInfo;

                if (u != null)
                {
                    // ? 失敗
                    if (
                        Extra.IntPos ?
                        DX.DrawGraph(
                            DoubleTools.ToInt(u.X),
                            DoubleTools.ToInt(u.Y),
                            picture.GetHandle(),
                            1
                            )
                        != 0
                                                :
                        DX.DrawGraphF(
                            (float)u.X,
                            (float)u.Y,
                            picture.GetHandle(),
                            1
                            )
                        != 0
                        )
                    {
                        if (Extra.IgnoreError == false)
                        {
                            throw new DDError();
                        }
                    }
                    goto endDraw;
                }
            }

            throw new DDError();             // ? 不明なレイアウト
endDraw:

            if (Extra.A != -1 || Extra.BlendAdd != -1 || Extra.BlendInv)
            {
                ResetBlend();
            }
            if (Extra.Mosaic)
            {
                DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR);
            }
            if (Extra.Bright.R != -1)
            {
                ResetBright();
            }

            // app > @ leave DrawPic

            // < app
        }
        public void Draw(double[] spectra)
        {
            if (spectra.Length != 90)
            {
                throw null;                 // souteigai !!!
            }
            if (this.ShadowSpectra == null)
            {
                this.ShadowSpectra = new ShadowSpectraData();
            }

            this.ShadowSpectra.Projection(spectra);

            DDSubScreenUtils.ChangeDrawScreen(this.GraphScreen);
            DX.ClearDrawScreen();

            for (int c = 0; c < 10; c++)
            {
                double v =
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 0] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 1] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 2] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 3] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 4] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 5] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 6] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 7] +
                    this.ShadowSpectra.ShadowSpectra[c * 9 + 8];

                v /= 9.0;
                v *= 10.0;

                int iv = DoubleTools.ToInt(v);

                for (int d = 0; d < iv; d++)
                {
                    int x1 = (c + 0) * 160;
                    int x2 = (c + 1) * 160;
                    int y1 = (d + 0) * 40;
                    int y2 = (d + 1) * 40;

                    x1 += 5;
                    x2 -= 5;
                    y1 += 3;
                    y2 -= 3;

                    DDDraw.SetBright(0.6, 0.4, 0.4);
                    DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, x1, y1, x2 - x1, y2 - y1);
                    DDDraw.Reset();
                }
            }
            for (int c = 0; c < 10; c++)
            {
                double v =
                    spectra[c * 9 + 0] +
                    spectra[c * 9 + 1] +
                    spectra[c * 9 + 2] +
                    spectra[c * 9 + 3] +
                    spectra[c * 9 + 4] +
                    spectra[c * 9 + 5] +
                    spectra[c * 9 + 6] +
                    spectra[c * 9 + 7] +
                    spectra[c * 9 + 8];

                v /= 9.0;
                v *= 10.0;

                int iv = DoubleTools.ToInt(v);

                for (int d = 0; d < iv; d++)
                {
                    int x1 = (c + 0) * 160;
                    int x2 = (c + 1) * 160;
                    int y1 = (d + 0) * 40;
                    int y2 = (d + 1) * 40;

                    x1 += 5;
                    x2 -= 5;
                    y1 += 3;
                    y2 -= 3;

                    DDDraw.SetBright(1.0, 0.8, 0.8);
                    DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, x1, y1, x2 - x1, y2 - y1);
                    DDDraw.Reset();
                }
            }

            DDSubScreenUtils.ChangeDrawScreen(this.Screen);
            DX.ClearDrawScreen();

            DDDraw.DrawBegin(DDPictureLoaders2.Wrapper(this.GraphScreen), this.Screen.GetSize().W / 2, this.Screen.GetSize().H / 2);
            DDDraw.SetBright(0, 0, 0);
            DDDraw.DrawEnd();
            DDDraw.Reset();

            DX.GraphFilter(this.Screen.GetHandle(), DX.DX_GRAPH_FILTER_GAUSS, 16, 1000);

            DDDraw.DrawCenter(DDPictureLoaders2.Wrapper(this.GraphScreen), this.Screen.GetSize().W / 2, this.Screen.GetSize().H / 2);

            DDSubScreenUtils.RestoreDrawScreen();
        }
Exemple #20
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        private static void DrawPic_Main(DDPicture picture, ILayoutInfo layout)
        {
            // app > @ enter DrawPic

            // < app

            if (Extra.A != -1)
            {
                SetBlend(DX.DX_BLENDMODE_ALPHA, Extra.A);
            }
            else if (Extra.BlendAdd != -1)
            {
                SetBlend(DX.DX_BLENDMODE_ADD, Extra.BlendAdd);
            }
            else if (Extra.BlendInv)
            {
                SetBlend(DX.DX_BLENDMODE_INVSRC, 255);
            }

            if (Extra.Mosaic)
            {
                DX.SetDrawMode(DX.DX_DRAWMODE_NEAREST);
            }
            if (Extra.Bright.R != -1)
            {
                SetBright(Extra.Bright.R, Extra.Bright.G, Extra.Bright.B);
            }

            {
                FreeInfo u = layout as FreeInfo;

                if (u != null)
                {
                    // ? 失敗
                    if (
                        Extra.IntPos ?
                        DX.DrawModiGraph(
                            DoubleTools.ToInt(u.LTX),
                            DoubleTools.ToInt(u.LTY),
                            DoubleTools.ToInt(u.RTX),
                            DoubleTools.ToInt(u.RTY),
                            DoubleTools.ToInt(u.RBX),
                            DoubleTools.ToInt(u.RBY),
                            DoubleTools.ToInt(u.LBX),
                            DoubleTools.ToInt(u.LBY),
                            picture.GetHandle(),
                            1
                            )
                        != 0
                                                :
                        DX.DrawModiGraphF(
                            (float)u.LTX,
                            (float)u.LTY,
                            (float)u.RTX,
                            (float)u.RTY,
                            (float)u.RBX,
                            (float)u.RBY,
                            (float)u.LBX,
                            (float)u.LBY,
                            picture.GetHandle(),
                            1
                            )
                        != 0
                        )
                    {
                        if (Extra.IgnoreError == false)
                        {
                            throw new DDError();
                        }
                    }
                    goto endDraw;
                }
            }

            {
                RectInfo u = layout as RectInfo;

                if (u != null)
                {
                    // ? 失敗
                    if (
                        Extra.IntPos ?
                        DX.DrawExtendGraph(
                            DoubleTools.ToInt(u.L),
                            DoubleTools.ToInt(u.T),
                            DoubleTools.ToInt(u.R),
                            DoubleTools.ToInt(u.B),
                            picture.GetHandle(),
                            1
                            )
                        != 0
                                                :
                        DX.DrawExtendGraphF(
                            (float)u.L,
                            (float)u.T,
                            (float)u.R,
                            (float)u.B,
                            picture.GetHandle(),
                            1
                            )
                        != 0
                        )
                    {
                        if (Extra.IgnoreError == false)
                        {
                            throw new DDError();
                        }
                    }
                    goto endDraw;
                }
            }

            {
                SimpleInfo u = layout as SimpleInfo;

                if (u != null)
                {
                    // ? 失敗
                    if (
                        Extra.IntPos ?
                        DX.DrawGraph(
                            DoubleTools.ToInt(u.X),
                            DoubleTools.ToInt(u.Y),
                            picture.GetHandle(),
                            1
                            )
                        != 0
                                                :
                        DX.DrawGraphF(
                            (float)u.X,
                            (float)u.Y,
                            picture.GetHandle(),
                            1
                            )
                        != 0
                        )
                    {
                        if (Extra.IgnoreError == false)
                        {
                            throw new DDError();
                        }
                    }
                    goto endDraw;
                }
            }

            throw new DDError();             // ? 不明なレイアウト
endDraw:

            if (Extra.A != -1 || Extra.BlendAdd != -1 || Extra.BlendInv)
            {
                ResetBlend();
            }
            if (Extra.Mosaic)
            {
                DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR);
            }
            if (Extra.Bright.R != -1)
            {
                ResetBright();
            }

            // app > @ leave DrawPic

            {
                FreeInfo u = layout as FreeInfo;

                if (u != null)
                {
                    double l = u.LTX;
                    double t = u.LTY;
                    double r = u.LTX;
                    double b = u.LTY;

                    l = Math.Min(l, u.RTX);
                    l = Math.Min(l, u.RBX);
                    l = Math.Min(l, u.LBX);

                    t = Math.Min(t, u.RTY);
                    t = Math.Min(t, u.RBY);
                    t = Math.Min(t, u.LBY);

                    r = Math.Max(r, u.RTX);
                    r = Math.Max(r, u.RBX);
                    r = Math.Max(r, u.LBX);

                    b = Math.Max(b, u.RTY);
                    b = Math.Max(b, u.RBY);
                    b = Math.Max(b, u.LBY);

                    Charlotte.Games.NamedCrashMgr.LastDrawedCrash = Charlotte.Common.Options.DDCrashUtils.Rect(new D4Rect(
                                                                                                                   l,
                                                                                                                   t,
                                                                                                                   r - l,
                                                                                                                   b - t
                                                                                                                   ));

                    goto endPostDraw;
                }
            }

            {
                RectInfo u = layout as RectInfo;

                if (u != null)
                {
                    double l = u.L;
                    double t = u.T;
                    double r = u.R;
                    double b = u.B;

                    Charlotte.Games.NamedCrashMgr.LastDrawedCrash = Charlotte.Common.Options.DDCrashUtils.Rect(new D4Rect(
                                                                                                                   l,
                                                                                                                   t,
                                                                                                                   r - l,
                                                                                                                   b - t
                                                                                                                   ));

                    goto endPostDraw;
                }
            }

            {
                SimpleInfo u = layout as SimpleInfo;

                if (u != null)
                {
                    Charlotte.Games.NamedCrashMgr.LastDrawedCrash = Charlotte.Common.Options.DDCrashUtils.Rect(new D4Rect(
                                                                                                                   u.X,
                                                                                                                   u.Y,
                                                                                                                   picture.Get_W(),
                                                                                                                   picture.Get_H()
                                                                                                                   ));

                    goto endPostDraw;
                }
            }

            throw new DDError();             // ? 不明なレイアウト
endPostDraw:
            ;

            // < app
        }
Exemple #21
0
 //
 //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
 //
 private static int RateToVolumeValue(double rate, int minval, int maxval)
 {
     return(minval + DoubleTools.ToInt(rate * (maxval - minval)));
 }
Exemple #22
0
        public void DrawTo(PictureData picture, int frame, int frameNum)
        {
            double sec = frame * 1.0 / VideoData.FPS;

            this.Wave.SetWavPart((int)((sec + AUDIO_DELAY_SEC) * this.Wave.WavHz));

            List <double> spectra = new List <double>();
            int           hz      = 10;

            for (int c = 1; c <= 9; c++)
            {
                for (int d = 0; d < 10; d++)
                {
                    double spectrum = 0.0;

                    for (int i = 0; i < c; i++)
                    {
                        spectrum = Math.Max(spectrum, this.Wave.GetSpectrum(hz));
                        hz      += 10;
                    }

                    spectrum /= 30.0;                     // 要調整
                    spectrum  = Vf(spectrum);

                    spectra.Add(spectrum);
                }
            }
            for (int i = 0; i < spectra.Count; i++)
            {
                double v = this.ShadowSpectra[i];

                v -= 0.01;
                v  = Math.Max(v, spectra[i]);

                this.ShadowSpectra[i] = v;
            }

            Canvas2 dest = new Canvas2(picture.GetFrame().GetWidth(), picture.GetFrame().GetHeight());

            using (Graphics g = dest.GetGraphics(false))
            {
                g.FillRectangle(new SolidBrush(Color.FromArgb(64, 0, 0, 0)), 0, 0, dest.GetWidth(), dest.GetHeight());

                int dr_l = 10;
                int dr_t = 10;
                int dr_w = dest.GetWidth() - 20;
                int dr_h = dest.GetHeight() - 20;

                for (int i = 0; i < spectra.Count; i++)
                {
                    int x1 = (((i * 3 + 0) * dr_w) / (spectra.Count * 3 - 2));
                    int x2 = (((i * 3 + 1) * dr_w) / (spectra.Count * 3 - 2));
                    int w  = x2 - x1;

                    double v1 = this.ShadowSpectra[i];
                    double v2 = spectra[i];

                    v1 /= 2.0;                     // 要調整
                    v2 /= 2.0;                     // 要調整

                    int h1 = DoubleTools.ToInt(v1 * dr_h);
                    int h2 = DoubleTools.ToInt(v2 * dr_h);

                    int y1 = dr_h - h1;
                    int y2 = dr_h - h2;

                    g.FillRectangle(new SolidBrush(Color.FromArgb(128, 255, 255, 255)),
                                    dr_l + x1, dr_t + y1, w, h1);
                    g.FillRectangle(new SolidBrush(Color.White),
                                    dr_l + x1, dr_t + y2, w, h2);
                }
            }
            using (Graphics g = picture.GetFrame().GetGraphics(false))
            {
                g.DrawImage(dest.GetImage(), 0, 0);
            }
        }
Exemple #23
0
        private static bool DrawPicFunc(ParamInfo i)
        {
            if (i.Extra.PicRes != null)
            {
                GamePicture.SetPicRes(i.Extra.PicRes);
            }
            if (i.Extra.AlphaOn)
            {
                SetBlend(DX.DX_BLENDMODE_ALPHA, i.Extra.A);
            }
            else if (i.Extra.BlendAddOn)
            {
                SetBlend(DX.DX_BLENDMODE_ADD, i.Extra.A);
            }
            else if (i.Extra.BlendInvOn)
            {
                SetBlend(DX.DX_BLENDMODE_INVSRC, 1.0);
            }
            if (i.Extra.MosaicOn)
            {
                DX.SetDrawMode(DX.DX_DRAWMODE_NEAREST);
            }
            if (i.Extra.BrightOn)
            {
                SetBright(i.Extra.R, i.Extra.G, i.Extra.B);
            }

            int grphHdl;

            if (i.Extra.GraphicHandleFlag)
            {
                grphHdl = i.PicId;
            }
            else
            {
                grphHdl = GamePicture.Pic(i.PicId);
            }

            switch (i.Layout.Mode)
            {
            case 'F':
            {
                LayoutInfo.FreeInfo u      = (LayoutInfo.FreeInfo)i.Layout.Entity;
                const double        F_ZURE = 0.0;

                if (i.Extra.IntPosOn ?
                    DX.DrawModiGraph(
                        DoubleTools.ToInt(u.LTX),
                        DoubleTools.ToInt(u.LTY),
                        DoubleTools.ToInt(u.RTX),
                        DoubleTools.ToInt(u.RTY),
                        DoubleTools.ToInt(u.RBX),
                        DoubleTools.ToInt(u.RBY),
                        DoubleTools.ToInt(u.LBX),
                        DoubleTools.ToInt(u.LBY),
                        grphHdl,
                        1
                        )
                    != 0
                                                        :
                    DX.DrawModiGraphF(
                        (float)(u.LTX + F_ZURE),
                        (float)(u.LTY + F_ZURE),
                        (float)(u.RTX + F_ZURE),
                        (float)(u.RTY + F_ZURE),
                        (float)(u.RBX + F_ZURE),
                        (float)(u.RBY + F_ZURE),
                        (float)(u.LBX + F_ZURE),
                        (float)(u.LBY + F_ZURE),
                        grphHdl,
                        1
                        )
                    != 0
                    )                                     // ? 失敗
                {
                    if (i.Extra.IgnoreError == false)
                    {
                        ProcMain.WriteLog(u.LTX);
                        ProcMain.WriteLog(u.LTY);
                        ProcMain.WriteLog(u.RTX);
                        ProcMain.WriteLog(u.RTY);
                        ProcMain.WriteLog(u.RBX);
                        ProcMain.WriteLog(u.RBY);
                        ProcMain.WriteLog(u.LBX);
                        ProcMain.WriteLog(u.LBY);
                        ProcMain.WriteLog(i.PicId);
                        ProcMain.WriteLog(grphHdl);

                        throw new GameError();
                    }
                }
            }
            break;

            case 'R':
            {
                LayoutInfo.RectInfo u = (LayoutInfo.RectInfo)i.Layout.Entity;

                if (i.Extra.IntPosOn ?
                    DX.DrawExtendGraph(
                        DoubleTools.ToInt(u.L),
                        DoubleTools.ToInt(u.T),
                        DoubleTools.ToInt(u.R),
                        DoubleTools.ToInt(u.B),
                        grphHdl,
                        1
                        )
                    != 0
                                                        :
                    DX.DrawExtendGraphF(
                        (float)u.L,
                        (float)u.T,
                        (float)u.R,
                        (float)u.B,
                        grphHdl,
                        1
                        )
                    != 0
                    )                                     // ? 失敗
                {
                    if (i.Extra.IgnoreError == false)
                    {
                        ProcMain.WriteLog(u.L);
                        ProcMain.WriteLog(u.T);
                        ProcMain.WriteLog(u.R);
                        ProcMain.WriteLog(u.B);
                        ProcMain.WriteLog(i.PicId);
                        ProcMain.WriteLog(grphHdl);

                        throw new GameError();
                    }
                }
            }
            break;

            case 'S':
            {
                LayoutInfo.SimpleInfo u = (LayoutInfo.SimpleInfo)i.Layout.Entity;

                if (i.Extra.IntPosOn ?
                    DX.DrawGraph(
                        DoubleTools.ToInt(u.X),
                        DoubleTools.ToInt(u.Y),
                        grphHdl,
                        1
                        )
                    != 0
                                                        :
                    DX.DrawGraphF(
                        (float)u.X,
                        (float)u.Y,
                        grphHdl,
                        1
                        )
                    != 0
                    )                                     // ? 失敗
                {
                    if (i.Extra.IgnoreError == false)
                    {
                        ProcMain.WriteLog(u.X);
                        ProcMain.WriteLog(u.Y);
                        ProcMain.WriteLog(i.PicId);
                        ProcMain.WriteLog(grphHdl);

                        throw new GameError();
                    }
                }
            }
            break;

            default:
                throw new GameError();
            }

            if (i.Extra.PicRes != null)
            {
                GamePicture.ResetPicRes();
            }
            if (i.Extra.AlphaOn || i.Extra.BlendAddOn || i.Extra.BlendInvOn)
            {
                ResetBlend();
            }
            if (i.Extra.MosaicOn)
            {
                DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR);
            }
            if (i.Extra.BrightOn)
            {
                ResetBright();
            }

            return(false);
        }
Exemple #24
0
        public void Perform()
        {
            this.Player.X = DDConsts.Screen_W / 4;
            this.Player.Y = DDConsts.Screen_H / 2;

            this.Player.BornScene.Fire();

            DDCurtain.SetCurtain(10);

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

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

                    double speed;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                DDEngine.EachFrame();
                            }

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

                // ここから描画

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

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

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

                DDEngine.EachFrame();
            }
        }
Exemple #25
0
        private void MakeMovie_Main()
        {
            this.DiscJacket         = new Canvas2(this.DiscJacketFile);
            this.BluredDiscJacket   = PictureUtils.Blur(this.DiscJacket, 5);           // 要調整
            this.MarginedDiscJacket = PictureUtils.PutMargin(this.DiscJacket);

            {
                string wavFile       = this.WD.GetPath("audio.wav");
                string masterWavFile = this.WD.GetPath("audio2.wav");

                FFmpegConv.MakeWavFile(this.SourceMediaFile, wavFile);

                if (this.MasterFlag && MasterUtils.Mastering(wavFile, masterWavFile))
                {
                    this.Wave = new WaveData(masterWavFile);
                    this.FFmpeg.Audio.PutAudioFile(masterWavFile);
                }
                else
                {
                    this.Wave = new WaveData(wavFile);
                    this.FFmpeg.Audio.PutAudioFile(this.SourceMediaFile);
                }
            }

            ShadowSpectraData ss = new ShadowSpectraData();
            FadeInOutData     f1 = new FadeInOutData()
            {
                MaxValue = 20
            };
            FadeInOutData f2 = new FadeInOutData();

            f1.Rate = 1.0;

            int frameNum = DoubleTools.ToInt((this.Wave.Length * 1.0 / this.Wave.WavHz) * AudioPicMP4Props.FPS);

            for (int frame = 0; frame < frameNum; frame++)
            {
                if (frame == 2 * AudioPicMP4Props.FPS)
                {
                    f1.TargetRate = 0.0;
                }

                if (frame == frameNum - 10 - f2.MaxValue)
                {
                    f2.TargetRate = 1.0;
                }

                f1.Approach();
                f2.Approach();

                double rate    = frame * 1.0 / (frameNum - 1);
                double invRate = 1.0 - rate;

                double r1 = 1.0 + 0.2 * rate;
                double r2 = 1.0 + 0.1 * invRate;

                D4Rect wallRect;
                D4Rect frntRect;

                {
                    D2Size size = Utils.TangentSize(
                        new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H),
                        new D2Size(this.DiscJacket.GetWidth(), this.DiscJacket.GetHeight()),
                        false
                        );

                    size.W *= r1;
                    size.H *= r1;

                    wallRect = Utils.Centering(new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), size);
                }

                {
                    D2Size size = Utils.TangentSize(
                        new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H),
                        new D2Size(this.DiscJacket.GetWidth(), this.DiscJacket.GetHeight()),
                        true
                        );

                    size.W *= r2;
                    size.H *= r2;

                    // マージン分
                    size.W *= this.MarginedDiscJacket.GetWidth() * 1.0 / this.DiscJacket.GetWidth();
                    size.H *= this.MarginedDiscJacket.GetHeight() * 1.0 / this.DiscJacket.GetHeight();

                    frntRect = Utils.Centering(new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), size);
                }

                Canvas2 frameImg = new Canvas2(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H);

                PictureUtils.Paste(frameImg, this.BluredDiscJacket, wallRect);
                PictureUtils.Filter(frameImg, Color.Black, 0.5);                 // 要調整
                PictureUtils.Paste(frameImg, this.MarginedDiscJacket, frntRect);
                PictureUtils.Filter(frameImg, Color.Black, 0.1);                 // 要調整

                PictureUtils.Filter(frameImg, Color.Black, f1.Rate);             // 背景カーテン

                this.Wave.SetWavPart(DoubleTools.ToInt((frame * 1.0 / AudioPicMP4Props.FPS + AudioPicMP4Props.AUDIO_DELAY_SEC) * this.Wave.WavHz));
                SpectrumGraph0001 sg = new SpectrumGraph0001(hz => this.Wave.GetSpectrum(hz));
                ss.Projection(sg.Spectra);
                this.DrawSpectra(frameImg, sg, ss);

                PictureUtils.Filter(frameImg, Color.Black, f2.Rate);                 // 前景カーテン

                frameImg.Save(this.FFmpeg.GetImageFile(frame), ImageFormat.Jpeg, AudioPicMP4Props.JPEG_QUALITY);

                GC.Collect();
            }

            this.FFmpeg.MakeMovie();

            File.Copy(this.FFmpeg.GetMovieFile(), this.DestMP4File);
        }
Exemple #26
0
        public void MakeVideo(WaveData wave, WorkingDir wd, Action <Canvas2> addImage)
        {
            this.DiscJacket         = new Canvas2(this.DiscJacketFile);
            this.BluredDiscJacket   = PictureUtils.Blur(this.DiscJacket, 5);           // 要調整
            this.MarginedDiscJacket = PictureUtils.PutMargin(this.DiscJacket);

            ShadowSpectraData ss = new ShadowSpectraData();
            FadeInOutData     f1 = new FadeInOutData()
            {
                MaxValue = 20
            };
            FadeInOutData f2 = new FadeInOutData();

            f1.Rate = 1.0;

            int frameNum = DoubleTools.ToInt((wave.Length * 1.0 / wave.WavHz) * AudioPicMP4Props.FPS);

            for (int frame = 0; frame < frameNum; frame++)
            {
                if (frame == 2 * AudioPicMP4Props.FPS)
                {
                    f1.TargetRate = 0.0;
                }

                if (frame == frameNum - 10 - f2.MaxValue)
                {
                    f2.TargetRate = 1.0;
                }

                f1.Approach();
                f2.Approach();

                double rate    = frame * 1.0 / (frameNum - 1);
                double invRate = 1.0 - rate;

                double r1 = 1.0 + 0.2 * rate;
                double r2 = 1.0 + 0.1 * invRate;

                D4Rect wallRect;
                D4Rect frntRect;

                {
                    D2Size size = Utils.TangentSize(
                        new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H),
                        new D2Size(this.DiscJacket.GetWidth(), this.DiscJacket.GetHeight()),
                        false
                        );

                    size.W *= r1;
                    size.H *= r1;

                    wallRect = Utils.Centering(new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), size);
                }

                {
                    D2Size size = Utils.TangentSize(
                        new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H),
                        new D2Size(this.DiscJacket.GetWidth(), this.DiscJacket.GetHeight()),
                        true
                        );

                    size.W *= r2;
                    size.H *= r2;

                    // マージン分
                    size.W *= this.MarginedDiscJacket.GetWidth() * 1.0 / this.DiscJacket.GetWidth();
                    size.H *= this.MarginedDiscJacket.GetHeight() * 1.0 / this.DiscJacket.GetHeight();

                    frntRect = Utils.Centering(new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), size);
                }

                Canvas2 frameImg = new Canvas2(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H);

                PictureUtils.Paste(frameImg, this.BluredDiscJacket, wallRect);
                PictureUtils.Filter(frameImg, Color.Black, 0.5);                 // 要調整
                PictureUtils.Paste(frameImg, this.MarginedDiscJacket, frntRect);
                PictureUtils.Filter(frameImg, Color.Black, 0.1);                 // 要調整

                PictureUtils.Filter(frameImg, Color.Black, f1.Rate);             // 背景カーテン

                wave.SetWavPart(DoubleTools.ToInt((frame * 1.0 / AudioPicMP4Props.FPS + AudioPicMP4Props.AUDIO_DELAY_SEC) * wave.WavHz));
                SpectrumGraph0001 sg = new SpectrumGraph0001(hz => wave.GetSpectrum(hz));
                ss.Projection(sg.Spectra);
                this.DrawSpectra(frameImg, sg, ss);

                PictureUtils.Filter(frameImg, Color.Black, f2.Rate);                 // 前景カーテン

                addImage(frameImg);
            }
        }
Exemple #27
0
        public void Draw()
        {
            if (PlayerLookLeftFrm == 0 && DDUtils.Random.Real2() < 0.002)             // キョロキョロするレート
            {
                PlayerLookLeftFrm = 150 + (int)(DDUtils.Random.Real2() * 90.0);
            }

            DDUtils.CountDown(ref PlayerLookLeftFrm);

            double xZoom = this.FacingLeft ? -1 : 1;

            // 立ち >

            DDPicture picture = Ground.I.Picture.PlayerStands[120 < PlayerLookLeftFrm ? 1 : 0][(DDEngine.ProcFrame / 20) % 2];

            if (1 <= this.MoveFrame)
            {
                if (this.MoveSlow)
                {
                    picture = Ground.I.Picture.PlayerWalk[(DDEngine.ProcFrame / 10) % 2];
                }
                else
                {
                    picture = Ground.I.Picture.PlayerDash[(DDEngine.ProcFrame / 5) % 2];
                }
            }
            if (this.TouchGround == false)
            {
                picture = Ground.I.Picture.PlayerJump[0];
            }
            if (1 <= this.ShagamiFrame)
            {
                picture = Ground.I.Picture.PlayerShagami;
            }

            // < 立ち

            // 攻撃中 >

            if (1 <= this.AttackFrame)
            {
                picture = Ground.I.Picture.PlayerAttack;

                if (1 <= this.MoveFrame)
                {
                    if (this.MoveSlow)
                    {
                        picture = Ground.I.Picture.PlayerAttackWalk[(DDEngine.ProcFrame / 10) % 2];
                    }
                    else
                    {
                        picture = Ground.I.Picture.PlayerAttackDash[(DDEngine.ProcFrame / 5) % 2];
                    }
                }
                if (this.TouchGround == false)
                {
                    picture = Ground.I.Picture.PlayerAttackJump;
                }
                if (1 <= this.ShagamiFrame)
                {
                    picture = Ground.I.Picture.PlayerAttackShagami;
                }
            }

            // < 攻撃中

            if (this.DeadScene.IsFlaming())
            {
                int koma = IntTools.ToRange(this.DeadScene.Count / 20, 0, 1);

                if (this.TouchGround)
                {
                    koma *= 2;
                }

                koma *= 2;
                koma++;

                picture = Ground.I.Picture.PlayerDamage[koma];

                DDDraw.SetTaskList(DDGround.EL);
            }
            if (this.DamageScene.IsFlaming())
            {
                picture = Ground.I.Picture.PlayerDamage[0];
                xZoom  *= -1;
            }

            if (this.DamageScene.IsFlaming() || this.MutekiScene.IsFlaming())
            {
                DDDraw.SetTaskList(DDGround.EL);
                DDDraw.SetAlpha(0.5);
            }
            DDDraw.DrawBegin(
                picture,
                DoubleTools.ToInt(this.X - DDGround.ICamera.X),
                DoubleTools.ToInt(this.Y - DDGround.ICamera.Y) - 16
                );
            DDDraw.DrawZoom_X(xZoom);
            DDDraw.DrawEnd();
            DDDraw.Reset();

            // debug
            {
                DDDraw.DrawBegin(DDGround.GeneralResource.Dummy, this.X - DDGround.ICamera.X, this.Y - DDGround.ICamera.Y);
                DDDraw.DrawZoom(0.1);
                DDDraw.DrawRotate(DDEngine.ProcFrame * 0.01);
                DDDraw.DrawEnd();
            }
        }