Пример #1
0
 public void OnPreDraw()
 {
     if (m_MainChara != null)
     {
         m_MainChara.OnPreDraw();
     }
     Cf3MapObjectBanana.OnPreDrawAll();
     Cf3MapObjectEelPitcher.OnPreDrawAll();
     Cf3MapObjectGeasprin.OnPreDrawAll();
     Cf3MapObjectmrframe.OnPreDrawAll();
     Cf3MapObjectNeedle.OnPreDrawAll();
     Cf3MapObjectIce.OnPreDrawAll();
     Cf3MapObjectIceSource.OnPreDrawAll();
     Cf3MapObjectFire.OnPreDrawAll();
     Cf3MapObjectEffect.OnPreDrawAll();
     Cf3MapObjectWind.OnPreDrawAll();
     if (m_MainChara != null)
     {
         m_MainChara.GetViewPos(out m_ScrollX, out m_ScrollY);
     }
     m_ScrollRX = (m_ScrollRX + m_ScrollX) / 2;
     m_ScrollRY = (m_ScrollRY + m_ScrollY) / 2;
 }
Пример #2
0
        public void OnDraw(CDIB32 lp, bool bShowHit)
        {
            int       x, y, z;
            int       vx, vy;
            int       sx, sy, ex, ey;
            Rectangle r;

            lp.Clear(0);
            if (m_MapData[0] != null)
            {
                float mx = 1;
                if (m_Width[1] - 10 > 0)
                {
                    mx = (float)(m_Width[0] - 10) / (float)(m_Width[1] - 10);
                }
                float my = 1;
                if (m_Height[1] - 7 > 0)
                {
                    my = (float)(m_Height[0] - 7) / (float)(m_Height[1] - 7);
                }
                sx = sy = 0;
                GetViewPos(ref sx, ref sy, mx, my);
                sx = (-sx) >> 5; sy = (-sy) >> 5;
                ex = sx + 320 / 32; ey = sy + 224 / 32;
                TL.Saturate(sx, ref ex, m_Width[0] - 1);
                TL.Saturate(sy, ref ey, m_Height[0] - 1);
                for (y = sy; y <= ey; y++)
                {
                    for (x = sx; x <= ex; x++)
                    {
                        z  = y * m_Width[0] + x;
                        r  = new Rectangle((m_MapData[0][z] & 0xf) * 32, (m_MapData[0][z] >> 4) * 32, 32, 32);
                        vx = x * 32; vy = y * 32;
                        GetViewPos(ref vx, ref vy, mx, my);
                        lp.BltFast(m_MapChip[0], vx, vy, r);
                    }
                }
            }
            if (m_MapData[1] != null)
            {
                CDIB32 pHit = null;
                if (bShowHit)
                {
                    pHit = CDIB32.Create();
                    pHit.CreateSurface(384, 32);
                    pHit.BltFast(CResourceManager.ResourceManager.Get(RID.RID_HIT), 0, 0);
                    pHit.SubColorFast(CApp.theApp.random(0x1000000));
                }
                sx = sy = 0;
                GetViewPos(ref sx, ref sy);
                sx = (-sx) >> 5; sy = (-sy) >> 5;
                ex = sx + 320 / 32; ey = sy + 224 / 32;
                TL.Saturate(sx, ref ex, m_Width[1] - 1);
                TL.Saturate(sy, ref ey, m_Height[1] - 1);
                for (y = sy; y <= ey; y++)
                {
                    for (x = sx; x <= ex; x++)
                    {
                        z  = y * m_Width[1] + x;
                        r  = new Rectangle((m_MapData[1][z] & 0xf) * 32, (m_MapData[1][z] >> 4) * 32, 32, 32);
                        vx = x * 32; vy = y * 32;
                        GetViewPos(ref vx, ref vy);
                        if (m_MapData[0] != null)
                        {
                            lp.Blt(m_MapChip[1], vx, vy, r);
                        }
                        else
                        {
                            lp.BltFast(m_MapChip[1], vx, vy, r);
                        }
                        if (bShowHit)
                        {
                            // 当たり判定表示
                            if (GetHit(x, y, HIT.HIT_TOP))
                            {
                                int f = (byte)m_Hit[GetMapData(1, x, y)] & ~0x1f;
                                r = new Rectangle(f, 0, 32, 32);
                                lp.BlendBlt(pHit, vx, vy, 0x808080, 0x7f7f7f, r);
                            }
                            if (GetHit(x, y, HIT.HIT_BOTTOM))
                            {
                                r = new Rectangle(256, 0, 32, 32);
                                lp.BlendBlt(pHit, vx, vy, 0x808080, 0x7f7f7f, r);
                            }
                            if (GetHit(x, y, HIT.HIT_LEFT))
                            {
                                r = new Rectangle(288, 0, 32, 32);
                                lp.BlendBlt(pHit, vx, vy, 0x808080, 0x7f7f7f, r);
                            }
                            if (GetHit(x, y, HIT.HIT_RIGHT))
                            {
                                r = new Rectangle(320, 0, 32, 32);
                                lp.BlendBlt(pHit, vx, vy, 0x808080, 0x7f7f7f, r);
                            }
                            if (GetHit(x, y, HIT.HIT_DEATH))
                            {
                                r = new Rectangle(352, 0, 32, 32);
                                lp.BlendBlt(pHit, vx, vy, 0x808080, 0x7f7f7f, r);
                            }
                        }
                    }
                }
                if (bShowHit)
                {
                    pHit.Dispose();
                }
            }
            Cf3MapObjectBanana.OnDrawAll(lp);
            Cf3MapObjectmrframe.OnDrawAll(lp);
            if (m_MainChara != null)
            {
                m_MainChara.OnDraw(lp);
            }
            Cf3MapObjectGeasprin.OnDrawAll(lp);
            Cf3MapObjectNeedle.OnDrawAll(lp);
            Cf3MapObjectEelPitcher.OnDrawAll(lp);
            Cf3MapObjectIceSource.OnDrawAll(lp);
            Cf3MapObjectFire.OnDrawAll(lp);
            Cf3MapObjectIce.OnDrawAll(lp);
            Cf3MapObjectEffect.OnDrawAll(lp);
            Cf3MapObjectWind.OnDrawAll(lp);
            if (m_MapData[2] != null)
            {
                float mx = 1.0f;
                if (m_Width[1] - 10 > 0)
                {
                    mx = (float)(m_Width[2] - 10) / (m_Width[1] - 10);
                }
                float my = 1.0f;
                if (m_Height[1] - 7 > 0)
                {
                    my = (float)(m_Height[2] - 7) / (m_Height[1] - 7);
                }
                sx = sy = 0;
                GetViewPos(ref sx, ref sy, mx, my);
                sx = (-sx) >> 5; sy = (-sy) >> 5;
                ex = sx + 320 / 32; ey = sy + 224 / 32;
                TL.Saturate(sx, ref ex, m_Width[2] - 1);
                TL.Saturate(sy, ref ey, m_Height[2] - 1);
                for (y = sy; y <= ey; y++)
                {
                    for (x = sx; x <= ex; x++)
                    {
                        z  = y * m_Width[2] + x;
                        r  = new Rectangle((m_MapData[2][z] & 0xf) * 32, (m_MapData[2][z] >> 4) * 32, 32, 32);
                        vx = (int)(x * 32 * mx); vy = (int)(y * 32 * my);
                        GetViewPos(ref vx, ref vy, mx, my);
                        lp.Blt(m_MapChip[2], vx, vy, r);
                    }
                }
            }
            var lpSrc = lp;
            var lpDst = m_pDIBBuf;

            if ((m_nEffect & 1) != 0)
            {
                CPlaneTransBlt.MirrorBlt1(lpDst, lpSrc, 0, 0, 128);
                TL.swap(ref lpSrc, ref lpDst);
            }
            if ((m_nEffect & 2) != 0)
            {
                CPlaneTransBlt.MirrorBlt2(lpDst, lpSrc, 0, 0, 128);
                var rc = new Rectangle(0, 16, 320, 224);
                lpSrc.BltFast(lpDst, 0, 0, rc);
            }
            if ((m_nEffect & 4) != 0)
            {
                CPlaneTransBlt.FlushBlt1(lpDst, lpSrc, 0, 0, 128);
                TL.swap(ref lpSrc, ref lpDst);
            }
            if (lpDst == lp)
            {
                lpDst.BltFast(lpSrc, 0, 0);
            }
        }