papermario
papermario copied to clipboard
Tracking issue for DSLs
Known DSLs we need macros and disassemblers for:
- [x] si scripts (evt)
- [ ] sparkle scripts
- [x] hud element animations (AKA icon scripts)
- [ ] entity scripts
- [ ] entity model scripts
- [ ] item entity scripts
- [ ] model animations
- [ ] sprite animations (supported in star rod xml, icky)
...this game is ridiculous
Now we've renamed ScriptInstance to Evt it may be worth renaming all the si funcs to evt (and even matching the TTYD opcode names).
Considering getting rid of cc_dsl in favour of simple macros since this repo will be used for learning about the game's internals and the fancy DSL can make it harder to understand
EvtSource script = {
evt_ifgt(SI_VAR(0), 0),
evt_call(SetPlayerPos, 0, SI_VAR(0), 0),
evt_endif,
evt_return,
evt_end,
};
Greenlit script macros:
ApiStatus api_GetPlayerPos(Evt* script, ...)
// Macros are used to make EVT_USER_FUNCs easier to use, and to document the number of args they take
// outX: x position of player
#define GetPlayerPos(outX, outY, outZ) EVT_USER_FUNC(api_GetPlayerPos, outX, outY, outZ)
EvtSource myScript = {
GetPlayerPos(EVT_VAR(0), EVT_VAR(1), EVT_VAR(2))
EVT_IF_GT(EVT_VAR(1), 100)
SetPlayerPos(EVT_VAR(1))
EVT_END_IF
EVT_RETURN
EVT_END
};