+ if labels:
+ global statedefines
+ statedefines += "/* States for %s */\n" % item[0]
+ for (i, (label, message)) in enumerate(labels):
+ if len(message) >= 45:
+ message = message[:45] + "..."
+ statedefines += "#define %s\t%d /* %s */\n" % (label, i, message)
+ statedefines += "\n"
+ sounds_str = ""
+ if item[1].get("sounds") == None:
+ sounds_str = " " * 12 + "NULL,"
+ else:
+ for l_msg in item[1]["sounds"]:
+ sounds_str += " " * 12 + make_c_string(l_msg) + ",\n"
+ sounds_str = sounds_str[:-1] # trim trailing newline
+ texts_str = ""
+ if item[1].get("texts") == None:
+ texts_str = " " * 12 + "NULL,"
+ else:
+ for l_msg in item[1]["texts"]:
+ texts_str += " " * 12 + make_c_string(l_msg) + ",\n"
+ texts_str = texts_str[:-1] # trim trailing newline
+ treasure = "true" if item[1].get("treasure") else "false"
+ obj_str += template.format(i_msg, treasure, longs_str, sounds_str, texts_str)