vn/code/vn_character.md

27 lines
760 B
Markdown
Raw Permalink Normal View History

2023-10-04 17:21:15 +00:00
@table(TypedName, EnumName) character_states:
{
{ "none", None },
{ "normal", Normal },
{ "happy", Happy },
{ "leaning", Leaning },
2023-10-04 17:21:15 +00:00
}
@table_gen
{
`enum character_state`;
`{`;
`CR_State_Invalid = 0,`
@expand(character_states s) `CR_State_$(s.EnumName),`
`};`;
}
@table_gen @c
{
`static character_state CR_CharacterStateFromString(string String)`;
`{`;
`character_state Result = CR_State_Invalid;`;
`if(0) {}`;
@expand(character_states s) `else if(AreEqual(String, StrLit("$(s.TypedName)")))$(=>40) { Result = CR_State_$(s.EnumName); }`;
`return(Result);`;
`}`;
}