Exemple #1
0
 public Level(uint offset)
 {
     address = BitConverter.ToUInt16(Cartridge.memory, (int)offset);
     header  = new byte[37];
     for (int i = 0; i < 37; i++)
     {
         header[i] = Cartridge.memory[address + i + 0x15580];
     }
     solidityIndex = header[0];
     floorWidth    = BitConverter.ToUInt16(header, 1);
     floorHeight   = BitConverter.ToUInt16(header, 3);
     if (address == 666)
     {
         floorHeight /= 2;
     }
     floorAddress        = BitConverter.ToUInt16(header, 15) + 0x14000u;
     floorSize           = BitConverter.ToUInt16(header, 17);
     blockMappingAddress = BitConverter.ToUInt16(header, 19) + 0x10000u;
     levelXOffset        = BitConverter.ToUInt16(header, 5);
     levelWidth          = header[8];
     levelYOffset        = BitConverter.ToUInt16(header, 9);
     levelExtHeight      = header[11];
     levelHeight         = header[12];
     offsetArt           = BitConverter.ToUInt16(header, 21);
     offsetObjectLayout  = BitConverter.ToUInt16(header, 30);
     initPalette         = header[26];
     Palettes.ReadPallettes(Cartridge.memory);
     tileset      = new TileSet(offsetArt, Palettes.palettes[initPalette]);
     floor        = new Floor(floorAddress, floorSize);
     blockMapping = new BlockMapping(blockMappingAddress, solidityIndex, tileset);
     objSet       = new LevelObjectSet(0x15580 + offsetObjectLayout);
 }