Exemple #1
0
//========================================================================================
// Object management - internal methods.


        // Add room to active area.
        private bool ForceAddRoom(int mapX, int mapY, int width, int height, string name)
        {
            if (AreaIndex == IndexNone)
            {
                return(false);
            }
            int newRoomIndex = NewRoomIndex(AreaIndex);

            if (newRoomIndex == -1)
            {
                return(false);
            }
            DoorSet newDoorSet = new DoorSet();

            newDoorSet.SetDefault();

            Room newRoom = new Room();

            newRoom.SetDefault();
            newRoom.MapX      = (byte)mapX;
            newRoom.MapY      = (byte)mapY;
            newRoom.Width     = (byte)width;
            newRoom.Height    = (byte)height;
            newRoom.Name      = name;
            newRoom.MyDoorSet = newDoorSet;

            Rooms [AreaIndex].Add(newRoom);
            DoorSets.Add(newDoorSet);
            ForceSelectRoom(Rooms [AreaIndex].Count - 1);
            ForceAddRoomState(StateType.Standard);
            ChangesMade = true;
            return(true);
        }
Exemple #2
0
//----------------------------------------------------------------------------------------

        public void SetDoorSet(DoorSet target)
        {
            MyDoorSet.UnreferenceMe(this);
            MyDoorSet = null;
            if (target?.ReferenceMe(this) ?? false)
            {
                MyDoorSet = target;
            }
        }
Exemple #3
0
 public bool Connect(List <Data> DoorSets)
 {
     MyDoorSet = (DoorSet)DoorSets.Find(x => x.StartAddressLR == DoorsPtr);
     if (MyDoorSet != null)
     {
         MyDoorSet.MyRoom = this;
     }
     for (int n = 0; n < RoomStates.Count; n++)
     {
         RoomStates [n].MyRoom = this;
     }
     return(MyDoorSet != null);
 }
Exemple #4
0
        public Room() : base()
        {
            RoomIndex         = 0;
            Area              = 0;
            MapX              = 0;
            MapY              = 0;
            Width             = 0;
            Height            = 0;
            UpScroller        = 0;
            DownScroller      = 0;
            SpecialGfxBitflag = 0;
            DoorsPtr          = 0;

            Name             = String.Empty;
            RoomStateHeaders = new List <RoomStateHeader> ();
            RoomStates       = new List <RoomState> ();
            MyDoorSet        = null;
            MyIncomingDoors  = new HashSet <Door> ();
            MySaveStations   = new HashSet <SaveStation> ();
        }
Exemple #5
0
//----------------------------------------------------------------------------------------

        // Read all rooms from ROM.
        private void ReadRooms(Rom rom, List <Tuple <int, int, string> > rooms,
                               out List <RoomState> roomStates)

        {
            roomStates = new List <RoomState> ();
            Rooms.Clear();
            for (int n = 0; n < rooms.Count; n++)
            {
                Room newRoom = new Room();
                newRoom.ReadFromROM(rom, rooms [n].Item1);
                newRoom.Name = rooms [n].Item3;
                Rooms [newRoom.Area].Add(newRoom);
                var newDoorSet = new DoorSet()
                {
                    DoorCount = rooms [n].Item2
                };
                newDoorSet.ReadFromROM(rom, newRoom.DoorsPtrPC);
                DoorSets.Add(newDoorSet);
                for (int i = 0; i < newRoom.RoomStates.Count; i++)
                {
                    roomStates.Add(newRoom.RoomStates [i]);
                }
            }
        }