import fxconv def convert(input_name, output, params, target): if params["custom-type"] == "map": convert_map(input_name, output, params, target) return 0 else: return 1 def convert_map(input_name, output, params, target): # Read informations with open(input_name, "r") as file: csv_data = file.read().splitlines() walkable = [-1, 11, 12, 13, 14, 15, 16, 17, 18, 20, 24, 25, 26, 30, 31, 37, 43, 44, 45, 62, 63, 64] # Convertion into bytes tiles = bytes() collision = bytes() for line in csv_data: for value in line.split(","): value = int(value) tiles += fxconv.u32(value) collision += fxconv.u8(int(value in walkable)) data = fxconv.ObjectData() data += tiles + collision fxconv.elf(data, output, "_" + params["name"], **target)