tewtal / sm_practice_hack

Super Metroid Practice Hack
The Unlicense
27 stars 19 forks source link

Add support for dynamic menu entries #172

Closed idlechild closed 1 year ago

idlechild commented 1 year ago

I'll be using this to support more custom portal doors, but might as well make this available now. You can use it like this to show or hide an option based on a setting in the same menu:

some_feature_enable:
    %cm_toggle("Some Feature", !ram_some_feature_enabled, #$0001, #0)

some_feature_dynamic_option:
    dw !ACTION_DYNAMIC
    dl #!ram_some_feature_enabled
    dw #$0000
    dw #some_feature_option

some_feature_option:
    ...

Use #$0000 to make the line blank. It can support more than two dynamic options. There's no range checking though; be careful!