Esempio n. 1
0
 def read_count(self, archive) -> int:
     count_address = self.location_strategy.read_base_address(archive)
     reader = BinArchiveReader(archive, count_address)
     if self.width == 1:
         return reader.read_u8()
     elif self.width == 2:
         return reader.read_u16()
     else:
         return reader.read_u32()
Esempio n. 2
0
    def read(self, archive):
        reader = BinArchiveReader(archive)
        tile_table_address = reader.read_internal_pointer()
        tile_count = reader.read_u32()
        self.map_model.read(reader)
        grid_address = reader.read_internal_pointer()

        self.tiles.clear()
        reader.seek(tile_table_address)
        for _ in range(0, tile_count):
            tile = self._read_tile(reader)
            self.tiles.append(tile)

        reader.seek(grid_address)
        self.map_size_x.read(reader)
        self.map_size_y.read(reader)
        self.border_size_x.read(reader)
        self.border_size_y.read(reader)
        self.trimmed_size_x.read(reader)
        self.trimmed_size_y.read(reader)
        for r in range(0, 32):
            for c in range(0, 32):
                self.grid[r][c] = reader.read_u8()