Esempio n. 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;
 }
Esempio n. 2
0
 public override void Synergy()
 {
     if (m_State == f3MainCharaState.DEAD || m_State == f3MainCharaState.SMILING)
     {
         return;
     }
     m_OnEnemy = false;
     m_Power   = m_PowerX = m_PowerY = 0.0f;
     // ギヤバネ
     foreach (var it in m_pParent.GetMapObjects(m_nCX - 2, m_nCY - 2, m_nCX + 2, m_nCY + 2, f3MapObjectType.MOT_GEASPRIN))
     {
         if (it.IsValid())
         {
             it.GetPos(out var objX, out var objY);
             if (!((Cf3MapObjectGeasprin)it).IsFrozen())
             {
                 if (TL.IsIn(objX - 16, m_X, objX + 15))
                 {
                     if (TL.IsIn(objY - 30, m_Y, objY + 16))
                     {
                         if (m_bOriginal)
                         {
                             CApp.theApp.GetBGM().MusicEffect(MENumber.MEN_GEASPRIN);
                         }
                         m_Y--;
                         HighJump();
                     }
                 }
                 else if (TL.IsIn(objX + 16, m_X, objX + 29))
                 {
                     if (TL.IsIn(objY - 16, m_Y, objY + 15))
                     {
                         if (m_bOriginal)
                         {
                             CApp.theApp.GetBGM().MusicEffect(MENumber.MEN_GEASPRIN);
                         }
                         m_DX = 10;
                     }
                 }
                 else if (TL.IsIn(objX - 29, m_X, objX - 16))
                 {
                     if (TL.IsIn(objY - 16, m_Y, objY + 15))
                     {
                         if (m_bOriginal)
                         {
                             CApp.theApp.GetBGM().MusicEffect(MENumber.MEN_GEASPRIN);
                         }
                         m_DX = -10;
                     }
                 }
             }
             else
             {
                 if (TL.IsIn(objX - 16, m_X, objX + 15))
                 {
                     if (TL.IsIn(objY - 30, m_Y, objY) && m_DY >= 0)
                     {
                         m_OnEnemy = true;
                         m_Y       = objY - 30;
                         if (m_State == f3MainCharaState.JUMPING)
                         {
                             Land();
                         }
                     }
                 }
                 else if (TL.IsIn(objX + 16, m_X, objX + 29))
                 {
                     if (TL.IsIn(objY - 16, m_Y, objY + 15))
                     {
                         m_X  = objX + 30;
                         m_DX = 0;
                     }
                 }
                 else if (TL.IsIn(objX - 29, m_X, objX - 16))
                 {
                     if (TL.IsIn(objY - 16, m_Y, objY + 15))
                     {
                         m_X  = objX - 30;
                         m_DX = -0;
                     }
                 }
             }
         }
     }
     // とげとげ
     foreach (var it in m_pParent.GetMapObjects(m_nCX - 2, m_nCY - 2, m_nCX + 2, m_nCY + 2, f3MapObjectType.MOT_NEEDLE))
     {
         if (it.IsValid())
         {
             it.GetPos(out var objX, out var objY);
             if ((objX - m_X) * (objX - m_X) + (objY - m_Y) * (objY - m_Y) < 256)
             {
                 Die();
                 return;
             }
         }
     }
     // ウナギカズラ
     foreach (var it in m_pParent.GetMapObjects(m_nCX - 2, m_nCY - 2, m_nCX + 2, m_nCY + 2, f3MapObjectType.MOT_EELPITCHER))
     {
         if (it.IsValid() && ((Cf3MapObjectEelPitcher)it).IsLeaf())
         {
             it.GetPos(out var objX, out var objY);
             if (TL.IsIn(objX - 16, m_X, objX + 16))
             {
                 if (TL.IsIn(objY - 14, m_Y, objY))
                 {
                     if (m_DY >= 0)
                     {
                         m_OnEnemy = true;
                         m_Y       = objY - 14;
                         if (m_State == f3MainCharaState.JUMPING)
                         {
                             Land();
                         }
                     }
                 }
             }
         }
     }
     if (m_State != f3MainCharaState.FROZEN)
     {
         // 氷
         foreach (var it in m_pParent.GetMapObjects(m_nCX - 2, m_nCY - 2, m_nCX + 2, m_nCY + 2, f3MapObjectType.MOT_ICE))
         {
             if (it.IsValid() && ((Cf3MapObjectIce)it).GetSize() > 10)
             {
                 it.GetPos(out var objX, out var objY);
                 if ((objX - m_X) * (objX - m_X) + (objY - m_Y) * (objY - m_Y) < 256)
                 {
                     // あたった!
                     Freeze(((Cf3MapObjectIce)it).GetSize());
                 }
             }
         }
         // 氷ゾーン
         foreach (var is_ in Cf3MapObjectIceSource.All())
         {
             is_.GetPos(out var objX, out var objY);
             float dX = objX - m_X, dY = objY - m_Y,
                   p = 1.0f / (dX * dX + dY * dY), p3 = (float)(p * Math.Sqrt(p));
             m_Power  += p;
             m_PowerX += dX * p3;
             m_PowerY += dY * p3;
         }
         // 炎ゾーン
         foreach (var fr in Cf3MapObjectFire.All())
         {
             if (fr.IsActive())
             {
                 fr.GetPos(out var objX, out var objY);
                 float dX = objX - m_X, dY = objY - m_Y,
                       p = 1.0f / (dX * dX + dY * dY), p3 = (float)(p * Math.Sqrt(p));
                 m_Power  -= p;
                 m_PowerX -= dX * p3;
                 m_PowerY -= dY * p3;
             }
         }
         if (m_Power > 1.0f / 256.0f)
         {
             Freeze();
         }
         else if (m_Power > 1.0f / 4096.0f)
         {
             m_nPower = 4;
             m_PowerX = m_PowerY = 0.0f;
         }
         else if (m_Power < -1.0f / 256.0f)
         {
             Die();
         }
         else if (m_Power < -1.0f / 4096.0f)
         {
         }
         else
         {
             m_PowerX = m_PowerY = 0.0f;
         }
     }
     // バナナ(BGMの調整用)
     if (m_pParent.GetMainChara() == this)
     {
         m_BananaDistance = MAXDISTANCE;
         float bd;
         int   nBanana = 0, nPosition = 0;
         foreach (var bn in Cf3MapObjectBanana.All())
         {
             if (bn.IsValid())
             {
                 bn.GetCPos(out var cx, out var cy);
                 bd = (cx * 32 + 16 - m_X) * (cx * 32 + 16 - m_X) + (cy * 32 + 16 - m_Y) * (cy * 32 + 16 - m_Y);
                 if (bd < m_BananaDistance)
                 {
                     m_BananaDistance = bd;
                 }
                 nBanana++;
                 nPosition += cx - m_nCX;
             }
         }
         CApp.theApp.GetBGM().MusicEffect(MENumber.MEN_BANANADISTANCE, m_BananaDistance);
         CApp.theApp.GetBGM().MusicEffect(MENumber.MEN_BANANAPOSITION, nBanana != 0 ? (float)nPosition / nBanana : 0.0f);
     }
     if (m_OnEnemy)
     {
         HitCheck();
     }
 }
Esempio n. 3
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);
            }
        }
Esempio n. 4
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);
            }
        }