示例#1
0
def load_level_header(chunk_id=None, level_id=None, title=None):
    if chunk_id is None:
        if level_id is None:
            chunk_id = util.find_if(lambda (lchunk, ltitle): ltitle == title, level_info)[0]
        else:
            chunk_id = level_info[level_id][0]

    level_header = level.LevelHeader()
    level_header.load(compression.decompress_data(chunk.read_chunk(chunk_id)))

    return level_header
示例#2
0
def load_level_header(chunk_id=None, level_id=None, title=None):
    if chunk_id is None:
        if level_id is None:
            chunk_id = util.find_if(lambda (lchunk, ltitle): ltitle == title,
                                    level_info)[0]
        else:
            chunk_id = level_info[level_id][0]

    level_header = level.LevelHeader()
    level_header.load(compression.decompress_data(chunk.read_chunk(chunk_id)))

    return level_header
示例#3
0
def assemble_palette(pal_list):
    # Initialize with neon pink
    pal = [(255, 0, 255)] * 256

    for chunk_id, position in pal_list:
        loaded_pal = unpack_palette(decompress_data(chunk.read_chunk(chunk_id)))

        # Convert from 6-bit to 8-bit
        pal[position:position + len(loaded_pal)] = ((r << 2, g << 2, b << 2) for r,g,b in loaded_pal)

    # Zero entries of each sub-pal like the game does
    for i in xrange(16, 256, 16):
        pal[i] = (0, 0, 0)

    return pal
示例#4
0
def assemble_palette(pal_list):
    # Initialize with neon pink
    pal = [(255, 0, 255)] * 256

    for chunk_id, position in pal_list:
        loaded_pal = unpack_palette(decompress_data(
            chunk.read_chunk(chunk_id)))

        # Convert from 6-bit to 8-bit
        pal[position:position + len(loaded_pal)] = ((r << 2, g << 2, b << 2)
                                                    for r, g, b in loaded_pal)

    # Zero entries of each sub-pal like the game does
    for i in xrange(16, 256, 16):
        pal[i] = (0, 0, 0)

    return pal