NPCs talk to you when you push Z

This commit is contained in:
2024-02-28 21:07:17 -08:00
parent c7d9f16515
commit 60e1a4ed43
5 changed files with 440 additions and 387 deletions

View File

@ -1,6 +1,7 @@
import sys
import json
import shared
import textwrap
TEMPLATE = """
// generated code! be nice
@ -136,7 +137,7 @@ def format_field_value(ty, val):
elif ty == "String":
if val is None:
return "NULL", "scalar", "const char*"
return json.dumps(val), "scalar" # this is close enough to being right in C
return json.dumps(wrap(val)), "scalar" # this is close enough to being right in C
elif ty == "Array<Int>":
return [format_field_value("Int", i)[0] for i in val], "array", "sys_i32"
elif ty == "Array<String>":
@ -145,6 +146,9 @@ def format_field_value(ty, val):
assert False, f"unknown type: {ty}"
def wrap(s):
return textwrap.fill(s, width=28)
def annot_xy(lst, w, h):
assert len(lst) == w * h
for y in range(h):