mirror of
https://github.com/LostArtefacts/TRX.git
synced 2025-05-02 22:57:59 +03:00
provide fallback gameflow strings (closes #80)
This commit is contained in:
parent
18b37ef106
commit
ac58a047ff
8 changed files with 137 additions and 4 deletions
30
src/generate_init.py
Normal file
30
src/generate_init.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
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(
|
||||
(REPO_DIR / "Tomb1Main_gameflow.json5").read_text(encoding="utf-8")
|
||||
)
|
||||
with (BUILD_DIR / "init.c").open("w") as handle:
|
||||
print('#include "init.h"', file=handle)
|
||||
print(file=handle)
|
||||
print('#include "game/vars.h"', file=handle)
|
||||
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()
|
Loading…
Add table
Add a link
Reference in a new issue