2021-03-17 12:14:43 +01:00
|
|
|
from pathlib import Path
|
|
|
|
import json
|
|
|
|
import pyjson5
|
|
|
|
|
|
|
|
SRC_DIR = Path(__file__).parent
|
|
|
|
REPO_DIR = SRC_DIR.parent
|
|
|
|
BUILD_DIR = REPO_DIR / "build"
|
|
|
|
|
|
|
|
|
|
|
|
def main() -> None:
|
|
|
|
gf = pyjson5.loads(
|
2021-03-18 15:08:25 +01:00
|
|
|
(REPO_DIR / "cfg/Tomb1Main_gameflow.json5").read_text(encoding="utf-8")
|
2021-03-17 12:14:43 +01:00
|
|
|
)
|
|
|
|
with (BUILD_DIR / "init.c").open("w") as handle:
|
|
|
|
print('#include "init.h"', file=handle)
|
|
|
|
print(file=handle)
|
2021-03-21 21:17:46 +01:00
|
|
|
print('#include "global/vars.h"', file=handle)
|
2021-03-17 12:14:43 +01:00
|
|
|
print(file=handle)
|
|
|
|
print("void T1MInit()", file=handle)
|
|
|
|
print("{", file=handle)
|
|
|
|
for key, value in gf["strings"].items():
|
|
|
|
print(
|
|
|
|
f" GF.strings[GS_{key}] = {json.dumps(value)};",
|
|
|
|
file=handle,
|
|
|
|
)
|
|
|
|
print("}", file=handle)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|