papermario icon indicating copy to clipboard operation
papermario copied to clipboard

Tracking issue for DSLs

Open bates64 opened this issue 4 years ago • 3 comments

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

bates64 avatar Aug 16 '21 19:08 bates64

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).

bates64 avatar Aug 23 '21 22:08 bates64

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,
};

bates64 avatar Aug 24 '21 09:08 bates64

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
};

bates64 avatar Oct 11 '21 08:10 bates64