diff --git a/Source/control.cpp b/Source/control.cpp index c0c5aa811..44cf3535e 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -236,6 +236,24 @@ spell_id SpellPages[6][7] = { #define SPLROWICONLS 10 #define SPLICONLAST (gbIsHellfire ? 52 : 43) +void CalculatePanelAreas(void) +{ + MainPanel = { { (gnScreenWidth - PANEL_WIDTH) / 2, gnScreenHeight - PANEL_HEIGHT }, { PANEL_WIDTH, PANEL_HEIGHT } }; + LeftPanel = { { 0, 0 }, { SPANEL_WIDTH, SPANEL_HEIGHT } }; + RightPanel = { { 0, 0 }, { SPANEL_WIDTH, SPANEL_HEIGHT } }; + + if (gnScreenWidth - 2 * SPANEL_WIDTH > PANEL_WIDTH) { + LeftPanel.position.x = (gnScreenWidth - 2 * SPANEL_WIDTH - PANEL_WIDTH) / 2; + } else { + LeftPanel.position.x = 0; + } + + LeftPanel.position.y = (gnScreenHeight - LeftPanel.size.height - PANEL_HEIGHT) / 2; + + RightPanel.position.x = gnScreenWidth - RightPanel.size.width - LeftPanel.position.x; + RightPanel.position.y = LeftPanel.position.y; +} + /** * Draw spell cell onto the given buffer. * @param out Output buffer @@ -797,46 +815,6 @@ void ClearPanel() pnumlines = 0; } -void CalculatePanelAreas(void) -{ - MainPanel = { { (gnScreenWidth - PANEL_WIDTH) / 2, gnScreenHeight - PANEL_HEIGHT }, { PANEL_WIDTH, PANEL_HEIGHT } }; - LeftPanel = { { 0, 0 }, { SPANEL_WIDTH, SPANEL_HEIGHT } }; - RightPanel = { { 0, 0 }, { SPANEL_WIDTH, SPANEL_HEIGHT } }; - - switch (sgOptions.Gameplay.nSPanelHAlign) { - case 0: // left - LeftPanel.position.x = 0; - break; - case 1: // center - LeftPanel.position.x = (gnScreenWidth / 2 - LeftPanel.size.width) / 2; - break; - case 2: // right - LeftPanel.position.x = gnScreenWidth / 2 - LeftPanel.size.width; - break; - default: - LeftPanel.position.x = 0; - break; - } - - switch (sgOptions.Gameplay.nSPanelVAlign) { - case 0: // top - LeftPanel.position.y = 0; - break; - case 1: // center - LeftPanel.position.y = (gnScreenHeight - LeftPanel.size.height - PANEL_HEIGHT) / 2; - break; - case 2: // bottom - LeftPanel.position.y = gnScreenHeight - LeftPanel.size.height - PANEL_HEIGHT; - break; - default: - LeftPanel.position.y = 0; - break; - } - - RightPanel.position.x = gnScreenWidth - RightPanel.size.width - LeftPanel.position.x; - RightPanel.position.y = LeftPanel.position.y; -} - Point GetPanelPosition(UiPanels panel, Point offset) { Displacement displacement { offset.x, offset.y }; diff --git a/Source/options.cpp b/Source/options.cpp index f29b33652..b8bd14487 100644 --- a/Source/options.cpp +++ b/Source/options.cpp @@ -264,8 +264,6 @@ void LoadOptions() sgOptions.Gameplay.bRandomizeQuests = GetIniBool("Game", "Randomize Quests", true); sgOptions.Gameplay.bShowMonsterType = GetIniBool("Game", "Show Monster Type", false); sgOptions.Gameplay.bDisableCripplingShrines = GetIniBool("Game", "Disable Crippling Shrines", false); - sgOptions.Gameplay.nSPanelHAlign = GetIniInt("Game", "Side Panel Horizontal Alignment", 0); - sgOptions.Gameplay.nSPanelVAlign = GetIniInt("Game", "Side Panel Vertical Alignment", 1); GetIniValue("Network", "Bind Address", sgOptions.Network.szBindAddress, sizeof(sgOptions.Network.szBindAddress), "0.0.0.0"); sgOptions.Network.nPort = GetIniInt("Network", "Port", 6112); @@ -375,8 +373,6 @@ void SaveOptions() SetIniValue("Game", "Randomize Quests", sgOptions.Gameplay.bRandomizeQuests); SetIniValue("Game", "Show Monster Type", sgOptions.Gameplay.bShowMonsterType); SetIniValue("Game", "Disable Crippling Shrines", sgOptions.Gameplay.bDisableCripplingShrines); - SetIniValue("Game", "Side Panel Horizontal Alignment", sgOptions.Gameplay.nSPanelHAlign); - SetIniValue("Game", "Side Panel Vertical Alignment", sgOptions.Gameplay.nSPanelVAlign); SetIniValue("Network", "Bind Address", sgOptions.Network.szBindAddress); SetIniValue("Network", "Port", sgOptions.Network.nPort); diff --git a/Source/options.h b/Source/options.h index 9a2aaf20d..aed0d6e44 100644 --- a/Source/options.h +++ b/Source/options.h @@ -118,10 +118,6 @@ struct GameplayOptions { bool bShowMonsterType; /** @brief Locally disable clicking on shrines which permanently cripple character. */ bool bDisableCripplingShrines; - /** @brief Side panel horizontal alignment (left/center/right) */ - int nSPanelHAlign; - /** @brief Side panel vertical alignment (top/center/bottom) */ - int nSPanelVAlign; }; struct ControllerOptions {