Skip to content

Commit

Permalink
Blood: Support controllers inserted after menu initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
tmyqlfpir authored Dec 8, 2024
1 parent 1f37156 commit eab273d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion source/blood/src/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,13 +417,14 @@ CGameMenu menuOptionsPlayer;
CGameMenu menuOptionsControl;

void SetupOptionsSound(CGameMenuItemChain *pItem);
void SetupPollJoystick(CGameMenuItemChain *pItem);

CGameMenuItemTitle itemOptionsTitle("OPTIONS", 1, 160, 20, 2038);
CGameMenuItemChain itemOptionsChainGame("GAME SETUP", 1, 0, 50, 320, 1, &menuOptionsGame, -1, NULL, 0);
CGameMenuItemChain itemOptionsChainDisplay("DISPLAY SETUP", 1, 0, 70, 320, 1, &menuOptionsDisplay, -1, NULL, 0);
CGameMenuItemChain itemOptionsChainSound("SOUND SETUP", 1, 0, 90, 320, 1, &menuOptionsSound, -1, SetupOptionsSound, 0);
CGameMenuItemChain itemOptionsChainPlayer("PLAYER SETUP", 1, 0, 110, 320, 1, &menuOptionsPlayer, -1, NULL, 0);
CGameMenuItemChain itemOptionsChainControl("CONTROL SETUP", 1, 0, 130, 320, 1, &menuOptionsControl, -1, NULL, 0);
CGameMenuItemChain itemOptionsChainControl("CONTROL SETUP", 1, 0, 130, 320, 1, &menuOptionsControl, -1, SetupPollJoystick, 0);
CGameMenuItemChain itemOptionsChainOld("OLD MENU", 1, 0, 170, 320, 1, &menuOptionsOld, -1, NULL, 0);

const char *pzAutoAimStrings[] = {
Expand Down Expand Up @@ -2288,6 +2289,17 @@ void SetupOptionsSound(CGameMenuItemChain *pItem)
UpdateMusicDevice(NULL);
}

void SetupPollJoystick(CGameMenuItemChain *pItem)
{
UNREFERENCED_PARAMETER(pItem);
if (CONTROL_JoyPresent && CONTROL_JoystickEnabled && !itemOptionsControlJoystickButtons.bEnable) // if joysticks menu was never initialized, and a controller is now detected, setup the menu
{
itemOptionsControlJoystickButtons.bEnable = 1;
itemOptionsControlJoystickAxes.bEnable = 1;
SetupJoysticksMenu();
}
}

void UpdatePlayerName(CGameMenuItemZEdit *pItem, CGameMenuEvent *pEvent)
{
UNREFERENCED_PARAMETER(pItem);
Expand Down

0 comments on commit eab273d

Please sign in to comment.