Get NPCs showing up in-engine

This commit is contained in:
2024-02-28 19:42:03 -08:00
parent 567db0bd71
commit f5f5e2c20b
8 changed files with 202 additions and 16 deletions

View File

@ -4,6 +4,7 @@ import shared
TEMPLATE = """
// generated code! be nice
#include <stdbool.h>
#include "sys/sys.h"
sys_maptile map_{{map_name}}_data[{{width * height}}] = { {{ tiles|join(",") }} };
@ -128,7 +129,9 @@ def load_mapdata(fname_ldtk):
def format_field_value(ty, val):
if ty == "Int":
if ty == "Bool":
return "true" if val else "false", "scalar", "bool"
elif ty == "Int":
return str(val), "scalar", "sys_i32"
elif ty == "String":
if val is None:
@ -138,6 +141,8 @@ def format_field_value(ty, val):
return [format_field_value("Int", i)[0] for i in val], "array", "sys_i32"
elif ty == "Array<String>":
return [format_field_value("String", i)[0] for i in val], "array", "const char*"
else:
assert False, f"unknown type: {ty}"
def annot_xy(lst, w, h):