Beispiel #1
0
        public static void SetCurtain(int frameMax, double destWhiteLevel, double startWhiteLevel)
        {
            frameMax        = IntTools.ToRange(frameMax, 0, 3600);      // 0 frame - 1 min
            destWhiteLevel  = DoubleTools.ToRange(destWhiteLevel, -1.0, 1.0);
            startWhiteLevel = DoubleTools.ToRange(startWhiteLevel, -1.0, 1.0);

            CurtainQueue.Clear();

            if (frameMax == 0)
            {
                CurtainQueue.Enqueue(destWhiteLevel);
            }
            for (int frmcnt = 0; frmcnt <= frameMax; frmcnt++)
            {
                double wl;

                if (frmcnt == 0)
                {
                    wl = startWhiteLevel;
                }
                else if (frmcnt == frameMax)
                {
                    wl = destWhiteLevel;
                }
                else
                {
                    wl = startWhiteLevel + (destWhiteLevel - startWhiteLevel) * ((double)frmcnt / frameMax);
                }

                CurtainQueue.Enqueue(wl);
            }
        }
        protected override void Invoke_02(string command, params string[] arguments)
        {
            int c = 0;

            if (command == ScenarioWords.COMMAND_画像)
            {
                int index = int.Parse(arguments[c++]);

                if (index < 0 || this.Images.Length <= index)
                {
                    throw new DDError("Bad index: " + index);
                }

                this.ImageIndex    = index;
                this.ImageDrawSize = DDUtils.AdjustRectExterior(this.Images[index].GetSize().ToD2Size(), new D4Rect(0, 0, DDConsts.Screen_W, DDConsts.Screen_H)).Size;
                this.ImageLTStart  = new D2Point(DDConsts.Screen_W - this.ImageDrawSize.W, DDConsts.Screen_H - this.ImageDrawSize.H);
                //this.ImageLTEnd = new D2Point(0, 0); // 固定値なので更新しない。
            }
            else if (command == ScenarioWords.COMMAND_Slide)
            {
                double rate1 = double.Parse(arguments[c++]);
                double rate2 = double.Parse(arguments[c++]);

                rate1 = DoubleTools.ToRange(rate1, 0.0, 1.0);
                rate2 = DoubleTools.ToRange(rate2, 0.0, 1.0);

                this.CurrDrawPosRate = rate1;
                this.DestDrawPosRate = rate2;
            }
            else
            {
                throw new DDError();
            }
        }
Beispiel #3
0
        public static void Report(double progressRate, BigInteger currentValue, string currValTrailer = "")
        {
            progressRate = DoubleTools.ToRange(progressRate, 0.0, 1.0);

            using (new MSection(Ground.MtxReport))
            {
                File.WriteAllText(Consts.ReportFile, progressRate.ToString("F9") + "\n" + ToExponentNotation(ToString(currentValue)) + currValTrailer, Encoding.ASCII);
            }
            Ground.EvReported.Set();
        }
Beispiel #4
0
        public static double MixVolume(double volume1, double volume2)
        {
            volume1 = DoubleTools.ToRange(volume1, 0.0, 1.0);
            volume2 = DoubleTools.ToRange(volume2, 0.0, 1.0);

            double mixedVolume = volume1 * volume2 * 2.0;

            mixedVolume = DoubleTools.ToRange(mixedVolume, 0.0, 1.0);

            return(mixedVolume);
        }
Beispiel #5
0
        public static double MixVolume(double volume1, double volume2)         // (volume1, volume2): 0.0 - 1.0, ret: 0.0 - 1.0
        {
            volume1 = DoubleTools.ToRange(volume1, 0.0, 1.0);
            volume2 = DoubleTools.ToRange(volume2, 0.0, 1.0);

            double mixedVolume = volume1 * volume2 * 2.0;             // 0.0 - 2.0

            mixedVolume = DoubleTools.ToRange(mixedVolume, 0.0, 1.0);

            return(mixedVolume);
        }
Beispiel #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();
		}
Beispiel #7
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();
            }
        }
Beispiel #8
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();
            }
        }
Beispiel #9
0
        //
        //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
        //
        public static void DrawCurtain(double whiteLevel = -1.0)
        {
            if (whiteLevel == 0.0)
            {
                return;
            }

            whiteLevel = DoubleTools.ToRange(whiteLevel, -1.0, 1.0);

            if (whiteLevel < 0.0)
            {
                DDDraw.SetAlpha(-whiteLevel);
                DDDraw.SetBright(0.0, 0.0, 0.0);
            }
            else
            {
                DDDraw.SetAlpha(whiteLevel);
            }

            DDDraw.DrawRect(DDGround.GeneralResource.WhiteBox, 0, 0, DDConsts.Screen_W, DDConsts.Screen_H);
            DDDraw.Reset();
        }
Beispiel #10
0
        public static void MusicFade(int frameMax, double destVRate, double startVRate)
        {
            if (CurrDestMusic == null)
            {
                return;
            }

            frameMax   = IntTools.ToRange(frameMax, 1, 3600);           // 1 frame - 1 min
            destVRate  = DoubleTools.ToRange(destVRate, 0.0, 1.0);
            startVRate = DoubleTools.ToRange(startVRate, 0.0, 1.0);

            for (int frmcnt = 0; frmcnt <= frameMax; frmcnt++)
            {
                double vRate;

                if (frmcnt == 0)
                {
                    vRate = startVRate;
                }
                else if (frmcnt == frameMax)
                {
                    vRate = destVRate;
                }
                else
                {
                    vRate = startVRate + ((destVRate - startVRate) * frmcnt) / frameMax;
                }

                PlayList.Enqueue(CreatePI('V', CurrDestMusic, false, false, vRate));
            }
            CurrDestMusicVolumeRate = destVRate;

            if (destVRate == 0.0)             // ? フェード目標音量ゼロ -> 曲停止
            {
                MusicStop();
            }
        }
Beispiel #11
0
 //
 //	copied the source file by https://github.com/stackprobe/Factory/blob/master/SubTools/CopyLib.c
 //
 public static void Range(ref double value, double minval, double maxval)
 {
     value = DoubleTools.ToRange(value, minval, maxval);
 }
Beispiel #12
0
        private static void TitleConfig()
        {
            P_TitleBackWDest = DDConsts.Screen_W;

            DDEngine.FreezeInput();

            for (; ;)
            {
                DDMouse.UpdatePos();

                if (DDUtils.IsPound(DDMouse.L.GetInput()))
                {
                    int x = DDMouse.X;
                    int y = DDMouse.Y;

                    if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(270, 120, 470, 160)) == false)                     // [960x540]
                    {
                        DDMain.SetScreenSize(960, 540);
                    }
                    else if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(530, 120, 800, 160)) == false)                     // [1440x810]
                    {
                        DDMain.SetScreenSize(1440, 810);
                    }
                    else if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(270, 160, 470, 200)) == false)                     // [1920x1080]
                    {
                        DDMain.SetScreenSize(1920, 1080);
                    }
                    else if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(530, 160, 800, 200)) == false)                     // [フルスクリーン]
                    {
                        int w = DDGround.MonitorRect.W;
                        int h = (DDConsts.Screen_H * DDGround.MonitorRect.W) / DDConsts.Screen_W;

                        if (DDGround.MonitorRect.H < h)
                        {
                            h = DDGround.MonitorRect.H;
                            w = (DDConsts.Screen_W * DDGround.MonitorRect.H) / DDConsts.Screen_H;

                            if (DDGround.MonitorRect.W < w)
                            {
                                throw new DDError();
                            }
                        }
                        DDMain.SetScreenSize(DDGround.MonitorRect.W, DDGround.MonitorRect.H);

                        DDGround.RealScreenDraw_L = (DDGround.MonitorRect.W - w) / 2;
                        DDGround.RealScreenDraw_T = (DDGround.MonitorRect.H - h) / 2;
                        DDGround.RealScreenDraw_W = w;
                        DDGround.RealScreenDraw_H = h;
                    }
                    else if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(400, 240, 530, 280)) == false)
                    {
                        DDGround.MusicVolume += 0.01;
                    }
                    else if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(550, 240, 690, 280)) == false)
                    {
                        DDGround.MusicVolume -= 0.01;
                    }
                    else if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(700, 240, 900, 280)) == false)
                    {
                        DDGround.MusicVolume = DDConsts.DefaultVolume;
                    }
                    else if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(400, 320, 530, 360)) == false)
                    {
                        DDGround.SEVolume += 0.01;
                    }
                    else if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(550, 320, 690, 360)) == false)
                    {
                        DDGround.SEVolume -= 0.01;
                    }
                    else if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(700, 320, 900, 360)) == false)
                    {
                        DDGround.SEVolume = DDConsts.DefaultVolume;
                    }
                    else if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(270, 400, 600, 440)) == false)
                    {
                        TitleConfigResetPlayData();
                    }
                    else if (DDUtils.IsOut(new D2Point(x, y), D4Rect.LTRB(830, 480, 930, 520)) == false)
                    {
                        break;
                    }
                    DDGround.MusicVolume = DoubleTools.ToRange(DDGround.MusicVolume, 0.0, 1.0);
                    DDGround.SEVolume    = DoubleTools.ToRange(DDGround.SEVolume, 0.0, 1.0);
                }
                DrawWall();
                DrawTitleBack();

                PrintByFont.SetPrint();
                PrintByFont.Print("");
                PrintByFont.Print(" 設定");
                PrintByFont.Print("");
                PrintByFont.Print(" 画面サイズ   [960x540]      [1440x810]");
                PrintByFont.Print("         [1920x1080]    [フルスクリーン]");
                PrintByFont.Print("");
                PrintByFont.Print(string.Format(" BGM音量   {0:F2}  [上げる] [下げる] [デフォルト]", DDGround.MusicVolume));
                PrintByFont.Print("");
                PrintByFont.Print(string.Format(" SE音量    {0:F2}  [上げる] [下げる] [デフォルト]", DDGround.SEVolume));
                PrintByFont.Print("");
                PrintByFont.Print("         プレイデータリセット");
                PrintByFont.Print("");
                PrintByFont.Print("                           [戻る]");

                DDEngine.EachFrame();
            }
        }