Retry API

"Retry API" refers to a collection of routines that Retry provides that you can call from your UberASM files if needed.

NOTE: calling these routines from files in the "library" folder will result in an error, at least when using the standard UberASMTool.

Index


Respawn in level

JSL retry_api_respawn_in_level

Call this to make the player respawn in the current level at the last checkpoint. This has the same effect as dying and hitting Retry, or dying with instant Retry enabled, but skipping everything related to death (animation, music, prompt, etc.).


Save game

JSL retry_api_save_game

Call this to save the game, which will also save the addresses defined in the sram_tables.asm file.


Reset level checkpoint

JSL retry_api_reset_level_checkpoint

Call this to reset the checkpoint in the current level. Entering the level again or respawning will load the main sublevel's entrance. Note that this won't reflect to SRAM until the game is saved.


Reset all checkpoints

JSL retry_api_reset_all_checkpoints

Call this to reset the checkpoint for every level in the game, effectively making it as if it were a fresh game. Note that this won't reflect to SRAM until the game is saved.


Configure sprite status bar

NOTE: this routine has no effect unless !sprite_status_bar = 1 in settings_global.asm.

Call this in UberASM level init code to configure graphics for the sprite status bar items (item box, timer, coin counter, lives counter, bonus stars counter) for a specific level. Calling this will override the default settings found in settings_global.asm, in case you want to hide some or all of the elements in some level or if you need to change their tile or palette.

Each item's configuration is set with a 16 bit value $PTTT. The first digit P will be the item's palette, starting from palette 8 with P = 8 and ending with palette F with P = F. TTT will determine the tile number: you can see this in Lunar Magic's "8x8 Tile Editor" if you hover over the desired tile (more specifically, the upper left 8x8 tile of the 16x16 tile you want to use). In the bottom bar you'll see "Tile 0xYYY": then, TTT = YYY - $400. For example, the Smiling Coin tile is "Tile 0x4C2", which results in TTT = $4C2 - $400 = $0C2. So, for example, to reserve that tile and use palette F, the full value will be $F0C2.

If an item's value is $0000, the item will simply not be displayed.

Note that you can also just write the $PTTT value to the RAM address for a specific item yourself, this routine is just a shorthand so set all values at the same time. To see the RAM addresses names, see RAM Info.


Get Retry type

Routine to get the current Retry type, i.e. if currently the level is set to have Retry prompt, instant Retry or no Retry.


Get SRAM variable address

Routine to get the address in SRAM for a specific variable. By "variable" it's meant any of the RAM addresses that are saved to SRAM specified in the sram save table. The returned address will be coherent with the current save file loaded when this routine is called (so, make sure to not call it before a save file is loaded!).

This could be useful to read/write values in SRAM directly, for example if you need to update some SRAM value without the game being saved.

Note that if you call this on the title screen (for example, if you need to display something based on some value saved in the three files), you will need to set $010A to the value of the save file you want to check (0 for save file 1, 1 for save file 2, 2 for save file 3) before calling this.

NOTE: this will always return "variable not found" if !sram_feature = 0.


Return to main page