Exemplo n.º 1
0
def tile_from_string(string):
    assert len(string) == 6
    ret = pf.Tile()
    ret.type = int(string[0], 16)
    ret.pathable = int(string[1])
    ret.base_height = int(string[2])
    ret.top_mat_idx = int(string[3])
    ret.sides_mat_idx = int(string[4])
    ret.ramp_height = int(string[5])
    return ret
Exemplo n.º 2
0
    def __init__(self):
        """
        A default chunk starts with all tiles set to flat type and 0 height. 
        All tiles will use index 0 for the top material and index 1 for the side material.
        """
        self.rows = pf.TILES_PER_CHUNK_HEIGHT
        self.cols = pf.TILES_PER_CHUNK_WIDTH

        self.tiles = []
        for r in range(0, self.rows):
            row = [pf.Tile() for c in range(0, self.cols)]
            self.tiles.append(row)
        assert (len(self.tiles) == self.rows)
Exemplo n.º 3
0
def tile_from_string(string):
    assert len(string) == 24
    ret = pf.Tile()
    ret.type = int(string[0], 16)
    ret.base_height = int(string[2:4])
    if string[1] == '-':
        ret.base_height *= -1
    ret.ramp_height = int(string[4:6])
    ret.top_mat_idx = int(string[6:9])
    ret.sides_mat_idx = int(string[9:12])
    ret.pathable = int(string[12])
    ret.blend_mode = int(string[13])
    ret.blend_normals = int(string[14])
    return ret
Exemplo n.º 4
0
    def __init__(self):
        """
        A default chunk starts with all tiles set to flat type and 0 height. 
        All tiles will use index 0 for the top material and index 1 for the side material.
        """
        self.rows = pf.TILES_PER_CHUNK_WIDTH
        self.cols = pf.TILES_PER_CHUNK_HEIGHT

        self.tiles = []
        for r in range(0, self.rows):
            row = [pf.Tile() for c in range(0, self.cols)]
            self.tiles.append(row)

        self.materials = [None] * pf.MATERIALS_PER_CHUNK
        self.materials[0] = copy.deepcopy(Chunk.DEFAULT_TOP_MATERIAL)
        self.materials[0].refcount = self.rows * self.cols
        self.materials[1] = copy.deepcopy(Chunk.DEFAULT_SIDE_MATERIAL)
        self.materials[1].refcount = self.rows * self.cols