nfx
4 weeks ago
1 changed files with 0 additions and 21 deletions
@ -1,21 +0,0 @@ |
|||||||
""" |
|
||||||
Converts json level data files into binary level data |
|
||||||
""" |
|
||||||
import json |
|
||||||
from os import listdir |
|
||||||
from os.path import isfile, join |
|
||||||
|
|
||||||
LVL_DIR = "lvl/" |
|
||||||
BIN_DIR = "lvl_bin/" |
|
||||||
|
|
||||||
if __name__ == "__main__": |
|
||||||
files = [f for f in listdir(LVL_DIR) if isfile(join(LVL_DIR, f))] |
|
||||||
decoder = json.JSONDecoder() |
|
||||||
for v in files: |
|
||||||
file = open(join(LVL_DIR, v), "r", encoding="utf-8") |
|
||||||
content = decoder.decode(file.read()) |
|
||||||
newfile = open(join(BIN_DIR, v.replace(".json", ".dat")), "wb") |
|
||||||
bin_content = b'' |
|
||||||
for line in content: |
|
||||||
bin_content += bytes(line+[255]) |
|
||||||
newfile.write(bin_content) |
|
Loading…
Reference in new issue