Ejemplo n.º 1
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();
 }
Ejemplo n.º 2
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);
            }
        }