1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-28 15:56:51 +00:00
oot/tools/specprocess.py
playerskel f4a72303cb
Whitespace (#1112)
* remove trailing whitespaces

* minor docs tweaks

* some more trailing whitespaces

* few more tweaks
2022-01-23 18:09:02 -05:00

55 lines
1.8 KiB
Python

import os
import sys
specFile = open("spec", "r");
specText = specFile.read();
specFile.close()
specLines = specText.split("\n");
# TODO: CLEAN THIS UP!
for i in range(0, len(specLines)):
line = specLines[i]
if (line.startswith("INCLUDE_SEG_SCENE")):
params = line.split("(")[1].split(")")[0].split(",")
for j in range(0, len(params)):
while (params[j].startswith(" ")):
params[j] = params[j][1 : len(params[j])]
line = "beginseg\r\n";
line += "\tname " + params[0] + "\r\n";
line += "\tromalign 0x1000\r\n";
line += "\tinclude " + params[1] + "\r\n";
line += "\taddress SEGMENT_SCENE\r\n";
line += "endseg\r\n";
elif (line.startswith("INCLUDE_SEG_ROOM")):
params = line.split("(")[1].split(")")[0].split(",")
for j in range(0, len(params)):
while (params[j].startswith(" ")):
params[j] = params[j][1 : len(params[j])]
line = "beginseg\r\n";
line += "\tname " + params[0] + "\r\n";
line += "\tromalign 0x1000\r\n";
line += "\tinclude " + params[1] + "\r\n";
line += "\taddress SEGMENT_ROOM\r\n";
line += "endseg\r\n";
elif (line.startswith("INCLUDE_SEG_OBJECT")):
params = line.split("(")[1].split(")")[0].split(",")
for j in range(0, len(params)):
while (params[j].startswith(" ")):
params[j] = params[j][1 : len(params[j])]
line = "beginseg\r\n";
line += "\tname " + params[0] + "\r\n";
line += "\tromalign 0x1000\r\n";
line += "\tinclude " + params[1] + "\r\n";
line += "\taddress SEGMENT_OBJECT\r\n";
line += "endseg\r\n";
line += "\r\n";
specLines[i] = line;
specOut = open("build/spec_preproc", "w");
specOut.writelines(specLines);
specOut.close();