Пример #1
0
 // Constructor, copy from existing scroll ASM.
 public ScrollAsm(ScrollAsm source) : base()
 {
     Entries = new List <int> ();
     MyDoors = new HashSet <Door> ();
     foreach (int entry in source.Entries)
     {
         Entries.Add(entry);
     }
 }
Пример #2
0
 public void SetDoorAsm(Asm target, out ScrollAsm DeleteScrollAsm)
 {
     MyDoorAsm?.UnreferenceMe(this);
     MyDoorAsm       = null;
     DeleteScrollAsm = MyScrollAsm?.UnreferenceMe(this) == 0 ? MyScrollAsm : null;
     MyScrollAsm     = null;
     if (target?.ReferenceMe(this) ?? false)
     {
         MyDoorAsm = target;
     }
 }
Пример #3
0
        // Constructor.
        public Door() : base()
        {
            RoomPtr         = 0;
            Bitflag         = 0;
            Direction       = 0;
            DoorCapX        = 0;
            DoorCapY        = 0;
            ScreenX         = 0;
            ScreenY         = 0;
            DistanceToSpawn = 0;
            DoorAsmPtr      = 0;
            ElevatorPad     = false;

            MyTargetRoom    = null;
            MyScrollAsm     = null;
            MyDoorSets      = new HashSet <DoorSet> ();
            MyReferringData = new HashSet <Data> ();
        }
Пример #4
0
 public bool Connect(List <Data> Rooms, List <Data> ScrollAsms, List <Data> DoorAsms)
 {
     MyTargetRoom = (Room)Rooms.Find(x => x.StartAddressLR == RoomPtr);
     if (MyTargetRoom != null)
     {
         MyTargetRoom.MyIncomingDoors.Add(this);
     }
     MyScrollAsm = (ScrollAsm)ScrollAsms.Find(x => x.StartAddressLR == DoorAsmPtr);
     if (MyScrollAsm != null)
     {
         MyScrollAsm.MyDoors.Add(this);
     }
     else
     {
         MyDoorAsm = (Asm)DoorAsms.Find(x => x.StartAddressLR == DoorAsmPtr);
         if (MyDoorAsm != null)
         {
             MyDoorAsm.MyReferringData.Add(this);
         }
     }
     return(MyTargetRoom != null);
 }
Пример #5
0
        // Read all scroll ASMs from ROM.
        private void ReadScrollAsms(Rom rom)
        {
            List <int> addressesPC = new List <int> ();

            foreach (Door d in Doors)
            {
                int address = Tools.LRtoPC(d.DoorAsmPtr);
                if (address != 0) // Skip invalid addresses
                {
                    addressesPC.Add(address);
                }
            }
            Tools.RemoveDuplicates(addressesPC);
            ScrollAsms.Clear();
            for (int n = 0; n < addressesPC.Count; n++)
            {
                var s = new ScrollAsm();
                if (s.ReadFromROM(rom, addressesPC [n]))
                {
                    ScrollAsms.Add(s);
                }
            }
        }