Skip to content

Commit

Permalink
Handle other control schemes
Browse files Browse the repository at this point in the history
  • Loading branch information
kphoenix137 committed Feb 13, 2025
1 parent 38b4969 commit 79d23ef
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMake/Assets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ set(devilutionx_assets
fonts/30-03.clx
fonts/30-04.clx
fonts/30-20.clx
fonts/30-e0.clx
fonts/42-00.clx
fonts/42-01.clx
fonts/42-02.clx
Expand Down
35 changes: 32 additions & 3 deletions Source/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1181,6 +1181,19 @@ void CheckMainPanelButtonUp()
DoAutoMap();
break;
case PanelButtonMainmenu:
if (MyPlayerIsDead) {
if (!gbIsMultiplayer) {
if (gbValidSaveFile)
gamemenu_load_game(false);
else
gamemenu_exit_game(false);
} else {
NetSendCmd(true, CMD_RETOWN);
}
break;
} else if (MyPlayer->_pHitPoints == 0) {
break;
}
qtextflag = false;
gamemenu_handle_previous();
gamemenuOff = false;
Expand Down Expand Up @@ -1432,13 +1445,29 @@ void DrawDeathText(const Surface &out)
text = _("You have died");
DrawString(out, text, linePosition, largeTextOptions);
linePosition.y += verticalPadding;

std::string buttonText;

switch (ControlMode) {
case ControlTypes::KeyboardAndMouse:
buttonText = _("ESC");
break;
case ControlTypes::Gamepad:
buttonText = ToString(GamepadType, ControllerButton_BUTTON_START);
break;
case ControlTypes::VirtualGamepad:
buttonText = _("Menu Button");
break;
}

if (!gbIsMultiplayer) {
if (gbValidSaveFile)
text = _("Press ESC to load last save.");
text = fmt::format(fmt::runtime(_("Press {} to load last save.")), buttonText);
else
text = _("Press ESC to return to Main Menu.");
text = fmt::format(fmt::runtime(_("Press {} to return to Main Menu.")), buttonText);

} else {
text = _("Press ESC to restart in town.");
text = fmt::format(fmt::runtime(_("Press {} to restart in town.")), buttonText);
}
DrawString(out, text, linePosition, smallTextOptions);
}
Expand Down
Binary file added assets/fonts/30-e0.clx
Binary file not shown.

0 comments on commit 79d23ef

Please sign in to comment.