コード例 #1
0
ファイル: persistence.py プロジェクト: jpmouracodex/pywolf
    def extract_chunk(self, index):
        data_stream = self._data_stream

        chunk_size = self.sizeof(index)
        self._seek(index)
        chunk = stream_read(data_stream, chunk_size)
        return chunk
コード例 #2
0
ファイル: persistence.py プロジェクト: TexZK/pywolf
    def extract_chunk(self, index):
        self._log_extract_chunk(index)
        data_stream = self._data_stream

        chunk_size = self.sizeof(index)
        self._seek(index)
        chunk = stream_read(data_stream, chunk_size)
        return chunk
コード例 #3
0
ファイル: persistence.py プロジェクト: jpmouracodex/pywolf
    def extract_chunk(self, index):
        chunk_count = self._chunk_count
        data_stream = self._data_stream
        huffman_nodes = self._huffman_nodes
        index = sequence_index(index, chunk_count)

        chunk = b''
        chunk_size = self.sizeof(index)
        if chunk_size:
            self._seek(index)
            compressed_size, expanded_size = self._read_sizes(index)
            chunk = stream_read(data_stream, compressed_size)
            chunk = huffman_expand(chunk, expanded_size, huffman_nodes)
        return chunk
コード例 #4
0
ファイル: persistence.py プロジェクト: TexZK/pywolf
    def extract_chunk(self, index):
        self._log_extract_chunk(index)
        chunk_count = self._chunk_count
        data_stream = self._data_stream
        huffman_nodes = self._huffman_nodes
        index = sequence_index(index, chunk_count)

        chunk = b''
        chunk_size = self.sizeof(index)
        if chunk_size:
            self._seek(index)
            compressed_size, expanded_size = self._read_sizes(index)
            chunk = stream_read(data_stream, compressed_size)
            chunk = huffman_expand(chunk, expanded_size, huffman_nodes)
        return chunk
コード例 #5
0
ファイル: persistence.py プロジェクト: jpmouracodex/pywolf
    def extract_chunk(self, index):
        data_stream = self._data_stream
        carmacized = self._carmacized
        rlew_tag = self._rlew_tag
        planes_count = self.planes_count

        header = None
        planes = [None] * planes_count
        chunk_size = self.sizeof(index)
        if chunk_size:
            self._seek(index)
            header = TileMapHeader.from_stream(data_stream, planes_count)

            for i in range(planes_count):
                self._seek(i, header.plane_offsets)
                expanded_size = stream_unpack('<H', data_stream)[0]
                compressed_size = header.plane_sizes[i] - 2
                chunk = stream_read(data_stream, compressed_size)
                if carmacized:
                    chunk = carmack_expand(chunk, expanded_size)[2:]
                planes[i] = rlew_expand(chunk, rlew_tag)
        return (header, planes)
コード例 #6
0
ファイル: persistence.py プロジェクト: TexZK/pywolf
    def extract_chunk(self, index):
        self._log_extract_chunk(index)
        data_stream = self._data_stream
        carmacized = self._carmacized
        rlew_tag = self._rlew_tag
        planes_count = self.planes_count

        header = None
        planes = [None] * planes_count
        chunk_size = self.sizeof(index)
        if chunk_size:
            self._seek(index)
            header = TileMapHeader.from_stream(data_stream, planes_count)

            for i in range(planes_count):
                self._seek(i, header.plane_offsets)
                expanded_size = stream_unpack('<H', data_stream)[0]
                compressed_size = header.plane_sizes[i] - struct.calcsize('<H')
                chunk = stream_read(data_stream, compressed_size)
                if carmacized:
                    chunk = carmack_expand(chunk, expanded_size)[struct.calcsize('<H'):]
                planes[i] = rlew_expand(chunk, rlew_tag)
        return (header, planes)
コード例 #7
0
 def from_stream(cls, stream):
     header = AdLibSoundHeader.from_stream(stream)
     events = stream_read(stream, header.length)
     return cls(header, events)