Exemple #1
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);
            }
        }
Exemple #2
0
        public void CreateTemparatureMap(CDIB32 dib)
        {
            float objX, objY, dX, dY, fX, fY;
            var   pixel = dib.GetPtr();
            float offx = m_ScrollRX - 320 / 2, offy = m_ScrollRY - 224 / 2 - 2;

            TL.Saturate(0.0f, ref offx, m_Width[1] * 32 - 320.0f);
            TL.Saturate(0.0f, ref offy, m_Height[1] * 32 - 224.0f);
            uint i = 0;

            for (int y = 0; y < 224; y++)
            {
                for (int x = 0; x < 320; x++)
                {
                    fX = x + offx; fY = y + offy;   // GetViewPosとオフセットの掛け方が逆
                    var power = 0.0f;
                    // 氷ゾーン
                    foreach (var is_ in Cf3MapObjectIceSource.All())
                    {
                        is_.GetPos(out objX, out objY);
                        dX     = objX - fX; dY = objY - fY;
                        power += 1.0f / (dX * dX + dY * dY);
                    }
                    // 炎ゾーン
                    foreach (var fr in Cf3MapObjectFire.All())
                    {
                        if (fr.IsActive())
                        {
                            fr.GetPos(out objX, out objY);
                            dX     = objX - fX; dY = objY - fY;
                            power -= 1.0f / (dX * dX + dY * dY);
                        }
                    }
                    if (power > 1.0f / 256.0f)
                    {
                        // 凍りつくゾーン
                        pixel[i] = 0x008080;
                    }
                    else if (power > 1.0f / 4096.0f)
                    {
                        // パワーアップゾーン
                        pixel[i] = 0x00ffff;
                    }
                    else if (power < -1.0f / 256.0f)
                    {
                        // 致死ゾーン
                        pixel[i] = 0x800000;
                    }
                    else if (power < -1.0f / 4096.0f)
                    {
                        // 制限ゾーン
                        pixel[i] = 0xff0000;
                    }
                    else
                    {
                        // 普通ゾーン
                        pixel[i] = 0x000000;
                    }
                    i++;
                }
            }
            var lpSrc = dib;
            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 (lpDst == dib)
            {
                lpDst.BltFast(lpSrc, 0, 0);
            }
        }