Beispiel #1
0
        public static void DrawBegin(int picId, double x, double y)
        {
            if (DB_L != null)
            {
                throw new GameError();
            }

            LayoutInfo i = new LayoutInfo();

            double w;
            double h;

            if (DPE.GraphicHandleFlag)
            {
                w = DPE.GraphicSize.W;
                h = DPE.GraphicSize.H;

                if (
                    w < 1 || IntTools.IMAX < w ||
                    h < 1 || IntTools.IMAX < h
                    )
                {
                    throw new GameError();
                }
            }
            else
            {
                w = GamePicture.Pic_W(picId);
                h = GamePicture.Pic_H(picId);
            }
            w /= 2.0;
            h /= 2.0;

            i.Mode   = 'F';
            i.Entity = new LayoutInfo.FreeInfo()
            {
                LTX = -w,
                LTY = -h,
                RTX = w,
                RTY = -h,
                RBX = w,
                RBY = h,
                LBX = -w,
                LBY = h,
            };

            DB_PicId = picId;
            DB_X     = x;
            DB_Y     = y;
            DB_L     = i;
        }
Beispiel #2
0
        private static void DxPrv_SetScreenSize(int w, int h)
        {
            bool mdm = GetMouseDispMode();

            GamePicture.UnloadAllPicResHandle();
            SubScreen.UnloadAllSubScreenHandle();
            //ReleaseAllFontHandle(); // TODO

            if (DX.SetGraphMode(w, h, 32) != DX.DX_CHANGESCREEN_OK)
            {
                throw new GameError();
            }

            DX.SetDrawScreen(DX.DX_SCREEN_BACK);
            DX.SetDrawMode(DX.DX_DRAWMODE_BILINEAR);

            SetMouseDispMode(mdm);
        }
Beispiel #3
0
        private static GamePicture.PicInfo LoadMirrorPic(byte[] rawData)
        {
            int si_h = GamePicture.FileData2SoftImage(rawData);
            int w;
            int h;

            GamePicture.GetSoftImageSize(si_h, out w, out h);

            int new_si_h = GamePicture.CreateSoftImage(w * 2, h);

            for (int x = 0; x < w; x++)
            {
                for (int y = 0; y < h; y++)
                {
                    GamePicture.SIPixel pixel = GamePicture.GetSIPixel(si_h, x, y);

                    GamePicture.SetSIPixel(new_si_h, x, y, pixel);
                    GamePicture.SetSIPixel(new_si_h, x * 2 - 1 - x, y, pixel);
                }
            }
            GamePicture.ReleaseSoftImage(si_h);
            return(GamePicture.GraphicHandle2PicInfo(GamePicture.SoftImage2GraphicHandle(new_si_h)));
        }
Beispiel #4
0
        private static GamePicture.PicInfo LoadInvPic(byte[] rawData)
        {
            int si_h = GamePicture.FileData2SoftImage(rawData);
            int w;
            int h;

            GamePicture.GetSoftImageSize(si_h, out w, out h);

            for (int x = 0; x < w; x++)
            {
                for (int y = 0; y < h; y++)
                {
                    GamePicture.SIPixel pixel = GamePicture.GetSIPixel(si_h, x, y);

                    pixel.R ^= 0xff;
                    pixel.G ^= 0xff;
                    pixel.B ^= 0xff;

                    GamePicture.SetSIPixel(si_h, x, y, pixel);
                }
            }
            return(GamePicture.GraphicHandle2PicInfo(GamePicture.SoftImage2GraphicHandle(si_h)));
        }
Beispiel #5
0
 private static GamePicture.PicInfo LoadPic(byte[] rawData)
 {
     return(GamePicture.GraphicHandle2PicInfo(GamePicture.SoftImage2GraphicHandle(GamePicture.FileData2SoftImage(rawData))));
 }
Beispiel #6
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);
        }
Beispiel #7
0
 public static int Der(int derId)
 {
     return(Der(derId, GamePicture.GetPicRes()));
 }