Beispiel #1
0
        // Read all scroll sets from ROM.
        private void ReadScrollSets(Rom rom)
        {
            ScrollSets.Clear();
            List <int> addressesPC = new List <int> ();

            for (int k = 0; k < AreaCount; k++)
            {
                foreach (Room r in Rooms[k])
                {
                    int roomArea   = r.Width * r.Height;
                    int stateCount = r.RoomStates.Count;
                    addressesPC.Clear();
                    for (int i = 0; i < stateCount; i++)
                    {
                        int address = Tools.LRtoPC(r.RoomStates [i].ScrollSetPtr);
                        if (address != 0)
                        {
                            addressesPC.Add(address);
                        }
                    }
                    Tools.RemoveDuplicates(addressesPC);
                    for (int i = 0; i < addressesPC.Count; i++)
                    {
                        var s = new ScrollSet();
                        s.SetSize(roomArea);
                        s.ReadFromROM(rom, addressesPC [i]);
                        ScrollSets.Add(s);
                    }
                }
            }
        }
Beispiel #2
0
        // Constructor.
        public RoomState() : base()
        {
            LevelDataPtr        = 0;
            TileSet             = 0;
            SongSet             = 0;
            PlayIndex           = 0;
            FxPtr               = 0;
            EnemySetPtr         = 0;
            EnemyGfxPtr         = 0;
            BackgroundScrolling = 0;
            ScrollSetPtr        = 0;
            UnusedPtr           = 0;
            MainAsmPtr          = 0;
            PlmSetPtr           = 0;
            BackgroundPtr       = 0;
            SetupAsmPtr         = 0;

            MyPlmSet     = null;
            MyScrollSet  = null;
            MyBackground = null;
            MyFx         = null;
            MyLevelData  = null;
            MyEnemySet   = null;
            MyEnemyGfx   = null;
            MyRoom       = null;
        }
Beispiel #3
0
 // Constructor, coping from existing scroll set.
 public ScrollSet(ScrollSet source) : base()
 {
     MyRoomStates = new HashSet <RoomState> ();
     for (int n = 0; n < source.Bytes.Count; n++)
     {
         Bytes.Add(source.Bytes [n]);
     }
 }
Beispiel #4
0
 public void SetScrollSet(ScrollSet target, out ScrollSet deleteScrollSet)
 {
     SetReference(ref MyScrollSet, target, out deleteScrollSet);
 }
Beispiel #5
0
        public bool Connect(List <Data> PlmSets,
                            List <Data> ScrollSets,
                            List <Data> Backgrounds,
                            List <Data> Fxs,
                            List <Data> LevelDatas,
                            List <Data> EnemySets,
                            List <Data> EnemyGfxs,
                            List <Data> SetupAsms,
                            List <Data> MainAsms)
        {
            bool success = true;

            if (PlmSetPtr >= 0x8F8000)
            {
                MyPlmSet = (PlmSet)PlmSets.Find(x => x.StartAddressLR == PlmSetPtr);
                if (MyPlmSet != null)
                {
                    MyPlmSet.MyRoomStates.Add(this);
                }
                else
                {
                    success = false;
                }
            }
            if (ScrollSetPtr >= 0x8F8000)
            {
                MyScrollSet = (ScrollSet)ScrollSets.Find(x => x.StartAddressLR == ScrollSetPtr);
                if (MyScrollSet != null)
                {
                    MyScrollSet.MyRoomStates.Add(this);
                }
                else
                {
                    success = false;
                }
            }
            if (BackgroundPtr >= 0x8F8000)
            {
                MyBackground = (Background)Backgrounds.Find(x => x.StartAddressLR == BackgroundPtr);
                if (MyBackground != null)
                {
                    MyBackground.MyRoomStates.Add(this);
                }
                else
                {
                    success = false;
                }
            }
            if (FxPtr >= 0x838000)
            {
                MyFx = (Fx)Fxs.Find(x => x.StartAddressLR == FxPtr);
                if (MyFx != null)
                {
                    MyFx.MyRoomStates.Add(this);
                }
                else
                {
                    success = false;
                }
            }
            if (SetupAsmPtr >= 0x8F8000)
            {
                MySetupAsm = (Asm)SetupAsms.Find(x => x.StartAddressLR == SetupAsmPtr);
                if (MySetupAsm != null)
                {
                    MySetupAsm.MyReferringData.Add(this);
                }
                else
                {
                    success = false;
                }
            }
            if (MainAsmPtr >= 0x8F8000)
            {
                MyMainAsm = (Asm)MainAsms.Find(x => x.StartAddressLR == MainAsmPtr);
                if (MyMainAsm != null)
                {
                    MyMainAsm.MyReferringData.Add(this);
                }
                else
                {
                    success = false;
                }
            }
            MyLevelData = (LevelData)LevelDatas.Find(x => x.StartAddressLR == LevelDataPtr);
            if (MyLevelData != null)
            {
                MyLevelData.MyRoomStates.Add(this);
            }
            else
            {
                success = false;
            }
            MyEnemySet = (EnemySet)EnemySets.Find(x => x.StartAddressLR == EnemySetPtr);
            if (MyEnemySet != null)
            {
                MyEnemySet.MyRoomStates.Add(this);
            }
            else
            {
                success = false;
            }
            MyEnemyGfx = (EnemyGfx)EnemyGfxs.Find(x => x.StartAddressLR == EnemyGfxPtr);
            if (MyEnemyGfx != null)
            {
                MyEnemyGfx.MyRoomStates.Add(this);
            }
            else
            {
                success = false;
            }
            return(success);
        }