int LoadData(int index) { List <LayerDungeonObject> currentLayer = this.Layer1Objects; List <DoorDungeonObject> currentDoorLayer = this.Layer1DoorObjects; bool isDoor = false; while (true) { if (IsDoorStartChunk(index)) { isDoor = true; index += 2; } if (IsEndingChunk(index)) { if (currentLayer == this.Layer1Objects || currentDoorLayer == this.Layer1DoorObjects) { currentLayer = this.Layer2Objects; currentDoorLayer = this.Layer2DoorObjects; } else if (currentLayer == this.Layer2Objects || currentDoorLayer == this.Layer2DoorObjects) { currentLayer = this.Layer3Objects; currentDoorLayer = this.Layer3DoorObjects; } else if (currentLayer == this.Layer3Objects || currentDoorLayer == this.Layer3DoorObjects) { return(index); } isDoor = false; index += 2; continue; } if (isDoor) { currentDoorLayer.Add(DoorDungeonObject.GetDungeonObjectFromBytes(romData.GetDataChunk(index, 2))); index += 2; } else { currentLayer.Add(LayerDungeonObject.GetDungeonObjectFromBytes(romData.GetDataChunk(index, 3))); index += 3; } } }
public DungeonObjectDataPointerCollection(RomData romData) { this.romData = romData; for (int i = 0; i < TotalRooms; i++) { var pointerAddress = AddressConstants.ObjectDataPointerTableAddress + (i * 3); RoomDungeonObjectDataPointers.Add(i, new DungeonObjectDataPointer(romData, i, pointerAddress, romData.GetDataChunk(pointerAddress, 3))); } }