Skip to content

Add "continue" and "playersetup" Lua HUD hooks & draw followitems in the Player Setup menu

Lach requested to merge Lach/SRB2:playersetup-and-continue-lua into next

Adds two new HUD hooks to Lua to add to or override how players are drawn on the Continue screen and in the Player Setup menu.

Hook name Function format Description
"continue" function(drawer v, player_t stplyr, fixed_t x, fixed_t y, fixed_t scale, string skin, int sprite2, int frame, int rotation, int color, int ticker, boolean continuing) The function is run for each player displayed on the Continue screen. If the function returns true, the default player sprite is not drawn; otherwise, it will be drawn after executing the function.
During the countdown, the boolean continuing is false and ticker is the number of tics left before the option to continue the game expires; if the player confirms to continue, continuing becomes true and ticker is the number of tics since the player confirmed.
"playersetup" function(drawer v, player_t stplyr, fixed_t x, fixed_t y, fixed_t scale, string skin, int sprite2, int frame, int rotation, int color, int ticker, boolean paused) The function is run when a player is displayed on the Player Setup menu. If the function returns true, the default player sprite is not drawn; otherwise, it will be drawn after executing the function.
ticker is the number of tics remaining before the default player walk animation's frame updates, and the boolean paused is true if the player has pressed the Pause|Break key to pause the default player walk animation.

In addition, the Player Setup menu now draws followitems belonging to the vanilla player skins, i.e. MT_TAILSOVERLAY used by Tails and MT_METALJETFUME used by Metal Sonic. These also work for addon skins that use these followitems, such as Metal Knuckles and Maimy.
srb20161

Attached is the script I used to test these features. In the Continue screen, the player can press Custom 1 to smack the player sprite, or hold Custom 2 to cycle through the vanilla player skincolors. Skins without tails will also use their pain sprites while ascending. In the Player Setup menu, the Derp will display his notoriously missing ear. (At least, as long as he hasn't thrown it!) characterHUD.lua
srb20162srb20160

Merge request reports