Пример #1
0
        protected void Reaction(Cf3MapObjectBase obj)
        {
            if (obj == null)
            {
                return;
            }
            obj.GetPos(out var objX, out var objY);
            switch (obj.GetMapObjectType())
            {
            case f3MapObjectType.MOT_FUNYA:
            case f3MapObjectType.MOT_GEASPRIN:
            {
                if (m_Type != NDT.NDT_VERTICAL || m_State != NDS.NDS_STOP || m_Speed != 0)
                {
                    return;
                }
                if (TL.IsIn(m_X - 16, objX, m_X + 16))
                {
                    if (TL.IsIn(m_Y + 15, objY, m_Y + 271))
                    {
                        m_State = NDS.NDS_DOWN;
                    }
                }
                break;
            }

            default:
            {
                return;
            }
            }
        }
Пример #2
0
 public void OnMove()
 {
     if (m_MainChara != null)
     {
         m_MainChara.OnMove();
     }
     Cf3MapObjectEelPitcher.OnMoveAll();
     Cf3MapObjectGeasprin.OnMoveAll();
     Cf3MapObjectmrframe.OnMoveAll();
     Cf3MapObjectNeedle.OnMoveAll();
     Cf3MapObjectIce.OnMoveAll();
     Cf3MapObjectFire.OnMoveAll();
     Cf3MapObjectBase.UpdateCPosAll();
     if (m_MainChara != null)
     {
         m_MainChara.Synergy();
     }
     Cf3MapObjectBanana.SynergyAll();
     Cf3MapObjectEelPitcher.SynergyAll();
     Cf3MapObjectGeasprin.SynergyAll();
     Cf3MapObjectmrframe.SynergyAll();
     Cf3MapObjectNeedle.SynergyAll();
     Cf3MapObjectIce.SynergyAll();
     Cf3MapObjectFire.SynergyAll();
 }
Пример #3
0
        public void RemoveMapObject(int x, int y, Cf3MapObjectBase p)
        {
            if (p == null)
            {
                return;
            }
            TL.Saturate(0, ref x, m_Width[1] - 1);
            TL.Saturate(0, ref y, m_Height[1] - 1);
            int i = GetIndex(x, y);
            var o = m_pObject[i];

            if (o == p)
            {
                o = m_pObject[i] = p.m_pNext;
            }
            while (o != null)
            {
                if (o.m_pNext == p)
                {
                    o.m_pNext = p.m_pNext;
                }
                o = o.m_pNext;
            }
            p.m_pNext = null;
        }
Пример #4
0
        public void Reaction(Cf3MapObjectBase obj)
        {
            if (!IsValid())
            {
                return;
            }
            switch (obj.GetMapObjectType())
            {
            case f3MapObjectType.MOT_FUNYA:
            {
                GetCPos(out var cx1, out var cy1);
                obj.GetCPos(out var cx2, out var cy2);
                if (cx1 == cx2 && cy1 == cy2)
                {
                    m_pParent.m_nGotBanana++;
                    Kill();
                }
                break;
            }

            default:
            {
                return;
            }
            }
        }
Пример #5
0
 public void GarbageMapObject()
 {
     if (m_MainChara != null && !m_MainChara.IsValid())
     {
         m_MainChara = null;
     }
     Cf3MapObjectBase.Garbage();
 }
Пример #6
0
        public void Reaction(Cf3MapObjectBase obj)
        {
            if (obj == null || obj == this)
            {
                return;
            }
            obj.GetPos(out var objX, out var objY);
            switch (obj.GetMapObjectType())
            {
            case f3MapObjectType.MOT_FUNYA:
            {
                if (TL.IsIn(m_X - 16, objX, m_X + 16))
                {
                    if (TL.IsIn(m_Y - 16, objY, m_Y))
                    {
                        // 踏まれた!!
                        m_bBlinking = true;
                    }
                }
                break;
            }

            case f3MapObjectType.MOT_NEEDLE:
            case f3MapObjectType.MOT_GEASPRIN:
            {
                if (TL.IsIn(m_X - 16, objX, m_X + 16))
                {
                    if (TL.IsIn(m_Y, objY, m_Y + 40))
                    {
                        // 食べちゃった!!
                        m_Level++;
                    }
                }
                break;
            }

            default:
            {
                return;
            }
            }
        }
Пример #7
0
        public Cf3Map(Cf3StageFile lp, int stage, bool playable = true)
        {
            byte[] buf;
            string text;

            uint[] bgm = new uint[(int)BGMNumber.BGMN_SIZE];
            m_pDIBBuf = CDIB32.Create();
            m_pDIBBuf.CreateSurface(320, 240);
            m_Stage     = (byte)stage;
            m_bPlayable = playable;
            Cf3MapObjectBase.SetParent(this);
            m_nGotBanana = m_nTotalBanana = 0;
            m_Wind       = null;
            m_pObject    = null;
            // キャラ
            m_MainChara = null;
            // タイトル
            m_Title = "";
            if ((text = lp.GetStageDataString(GetChunkType(CT.CT_TL00, stage))) != null)
            {
                m_Title = text;
            }
            // マップチップ
            m_MapChip[0] = ReadMapChip(lp, 0);
            m_MapChip[1] = ReadMapChip(lp, 1);
            m_MapChip[2] = ReadMapChip(lp, 2);
            // 当たり判定
            Array.Copy(m_defHit, m_Hit, 240);
            if ((buf = lp.GetStageData(CT.CT_HITS)) != null)
            {
                Array.Copy(buf, m_Hit, Math.Min(buf.Length, 240));
            }
            // マップデータ(下層)
            if ((buf = lp.GetStageData(GetChunkType(CT.CT_M000, stage))) != null)
            {
                m_Width[0]   = buf[0];
                m_Height[0]  = buf[1];
                m_MapData[0] = new byte[m_Width[0] * m_Height[0]];
                Array.Copy(buf, 2, m_MapData[0], 0, m_Width[0] * m_Height[0]);
            }
            else
            {
                m_MapData[0] = null;
            }
            // マップデータ(中層)
            if ((buf = lp.GetStageData(GetChunkType(CT.CT_M100, stage))) != null)
            {
                m_Width[1]  = buf[0];
                m_Height[1] = buf[1];
                var stagesize = m_Width[1] * m_Height[1];
                m_MapData[1] = new byte[stagesize];
                m_Wind       = new float[stagesize];
                m_pObject    = new Cf3MapObjectBase[stagesize];
                var windmap = new byte[stagesize];
                Array.Copy(buf, 2, m_MapData[1], 0, stagesize);
                int x, y, z, n;
                z = 0;
                for (y = 0; y < m_Height[1]; y++)
                {
                    for (x = 0; x < m_Width[1]; x++)
                    {
                        windmap[z] = 0;
                        n          = m_MapData[1][z];
                        if (n >= 0xf0)
                        {
                            if (n == 0xf0)      // 主人公
                            {
                                if (m_MainChara == null)
                                {
                                    m_MainChara = Cf3MapObjectMain.Create(x, y);
                                }
                                bgm[(int)BGMNumber.BGMN_GAMEFUNYA] += 99;
                            }
                            else if (n == 0xf1)     // バナナ
                            {
                                new Cf3MapObjectBanana(x, y);
                                bgm[(int)BGMNumber.BGMN_GAMEBANANA] += 1;
                                m_nTotalBanana++;
                            }
                            else if (n == 0xf2)     // とげとげ
                            {
                                new Cf3MapObjectNeedle(x, y);
                                bgm[(int)BGMNumber.BGMN_GAMENEEDLE] += 4;
                            }
                            else if (n == 0xf3)     // ギヤバネ左向き
                            {
                                new Cf3MapObjectGeasprin(x, y, f3MapObjectDirection.DIR_LEFT);
                                bgm[(int)BGMNumber.BGMN_GAMEGEASPRIN] += 10;
                            }
                            else if (n == 0xf4)     // ギヤバネ右向き
                            {
                                new Cf3MapObjectGeasprin(x, y, f3MapObjectDirection.DIR_RIGHT);
                                bgm[(int)BGMNumber.BGMN_GAMEGEASPRIN] += 10;
                            }
                            else if (n == 0xf5)     // 風ストップ
                            {
                                windmap[z] = 0xC;
                            }
                            else if (n == 0xf6)     // 風左向き
                            {
                                windmap[z] = 0x1;
                                bgm[(int)BGMNumber.BGMN_GAMEWIND] += 1;
                            }
                            else if (n == 0xf7)     // 風右向き
                            {
                                windmap[z] = 0x2;
                                bgm[(int)BGMNumber.BGMN_GAMEWIND] += 1;
                            }
                            else if (n == 0xf8)     // ミスター・フレーム
                            {
                                new Cf3MapObjectmrframe(x, y);
                                bgm[(int)BGMNumber.BGMN_GAMEMRFRAME] += 40;
                            }
                            else if (n == 0xf9)     // ウナギカズラ
                            {
                                new Cf3MapObjectEelPitcher(x, y);
                                bgm[(int)BGMNumber.BGMN_GAMEEELPITCHER] += 5;
                            }
                            else if (n == 0xfa)     // 氷
                            {
                                new Cf3MapObjectIceSource(x, y);
                                bgm[(int)BGMNumber.BGMN_GAMEICE] += 8;
                            }
                            else if (n == 0xfb)     // 火
                            {
                                new Cf3MapObjectFire(x, y);
                                bgm[(int)BGMNumber.BGMN_GAMEFIRE] += 8;
                            }
                            else if (n == 0xfc)     // とげとげ
                            {
                                new Cf3MapObjectNeedle(x, y, 1);
                                bgm[(int)BGMNumber.BGMN_GAMENEEDLE] += 4;
                            }
                            else if (n == 0xfd)     // とげとげ
                            {
                                new Cf3MapObjectNeedle(x, y, 2);
                                bgm[(int)BGMNumber.BGMN_GAMENEEDLE] += 4;
                            }
                            else if (n == 0xfe)     // とげとげ
                            {
                                new Cf3MapObjectNeedle(x, y, 3);
                                bgm[(int)BGMNumber.BGMN_GAMENEEDLE] += 4;
                            }
                            m_MapData[1][z] = 0;
                        }
                        else
                        {
                            if (GetHit(x, y, HIT.HIT_LEFT))
                            {
                                windmap[z] = 0x4;
                            }
                            else
                            {
                                windmap[z] = 0;
                            }
                            if (GetHit(x, y, HIT.HIT_RIGHT))
                            {
                                windmap[z] |= 0x8;
                            }
                        }
                        z++;
                    }
                }
                z = 0;
                var wind = 0.0f;
                int dx;
                for (y = 0; y < m_Height[1]; y++)
                {
                    for (x = 0; x < m_Width[1]; x++)
                    {
                        if ((windmap[z] & 0x10) != 0)
                        {
                        }
                        else
                        {
                            wind = 0.0f;
                            for (dx = 0; x + dx < m_Width[1]; dx++)
                            {
                                if ((windmap[z + dx] & 0x4) != 0)
                                {
                                    break;
                                }
                                if ((windmap[z + dx] & 0x1) != 0)
                                {
                                    wind -= 1.0f;
                                }
                                if ((windmap[z + dx] & 0x2) != 0)
                                {
                                    wind += 1.0f;
                                }
                                windmap[z + dx] |= 0x10;
                                if ((windmap[z + dx] & 0x8) != 0)
                                {
                                    break;
                                }
                            }
                            if (TL.IsIn(-0.01f, wind, 0.01f))
                            {
                                wind = 0.0f;
                            }
                            else
                            {
                                new Cf3MapObjectWind(x, y, dx, wind);
                            }
                        }
                        m_Wind[z] = wind;
                        z++;
                    }
                }
                Cf3MapObjectBase.UpdateCPosAll();
            }
            else
            {
                m_MapData[1] = null;
            }
            // マップデータ(上層)
            if ((buf = lp.GetStageData(GetChunkType(CT.CT_M200, stage))) != null)
            {
                m_Width[2]   = buf[0];
                m_Height[2]  = buf[1];
                m_MapData[2] = new byte[m_Width[2] * m_Height[2]];
                Array.Copy(buf, 2, m_MapData[2], 0, m_Width[2] * m_Height[2]);
            }
            else
            {
                m_MapData[2] = null;
            }
            // BGM
            uint bgmm = 0;

            m_BGMNumber = BGMNumber.BGMN_SIRENT;
            for (int i = (int)BGMNumber.BGMN_SIRENT; i < (int)BGMNumber.BGMN_SIZE; i++)
            {
                if (bgmm < bgm[i])
                {
                    bgmm        = bgm[i];
                    m_BGMNumber = (BGMNumber)i;
                }
            }
            m_ScrollX = m_ScrollY = 0;
            if (m_MainChara != null)
            {
                m_MainChara.GetPos(out m_ScrollRX, out m_ScrollRY);
            }
        }
Пример #8
0
 public void KillAllMapObject()
 {
     Cf3MapObjectBase.KillAll();
 }
Пример #9
0
        public void Reaction(Cf3MapObjectBase obj)
        {
            if (obj == null)
            {
                return;
            }
            obj.GetPos(out var objX, out var objY);
            switch (obj.GetMapObjectType())
            {
            case f3MapObjectType.MOT_FUNYA:
            {
                if (TL.IsIn(m_X - 16, objX, m_X + 16))
                {
                    if (TL.IsIn(m_Y - 32, objY, m_Y))
                    {
                        // 踏まれた!
                        Laugh();
                        m_Spring[(int)f3MapObjectDirection.DIR_FRONT] = 32;
                        if (!m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP))
                        {
                            m_GY++;
                        }
                    }
                }
                else if (TL.IsIn(m_X + 16, objX, m_X + 29))
                {
                    if (TL.IsIn(m_Y - 16, objY, m_Y + 16))
                    {
                        // 右から来た!
                        if (m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP))
                        {
                            Back(f3MapObjectDirection.DIR_RIGHT);
                        }
                        else
                        {
                            Laugh();
                        }
                        m_Spring[(int)f3MapObjectDirection.DIR_RIGHT] = 32;
                    }
                }
                else if (TL.IsIn(m_X - 29, objX, m_X - 16))
                {
                    if (TL.IsIn(m_Y - 16, objY, m_Y + 16))
                    {
                        // 左から来た!
                        if (m_pParent.GetHit((int)Math.Floor(m_X / 32), (int)Math.Floor((m_Y + 16) / 32), HIT.HIT_TOP))
                        {
                            Back(f3MapObjectDirection.DIR_LEFT);
                        }
                        else
                        {
                            Laugh();
                        }
                        m_Spring[(int)f3MapObjectDirection.DIR_LEFT] = 32;
                    }
                }
                break;
            }

            default:
            {
                return;
            }
            }
        }
Пример #10
0
 protected static void RemoveCharaFromList(Cf3MapObjectBase lp)
 {
     m_CharaList.Remove(lp);
 }
Пример #11
0
 public float GetDistanceSquare(Cf3MapObjectBase obj)
 {
     obj.GetPos(out var x, out var y);
     return((x - m_X) * (x - m_X) + (y - m_Y) * (y - m_Y));
 }