From f623ecec4714fc73ceff2f43276e9eec8e89b819 Mon Sep 17 00:00:00 2001 From: Oznogon Date: Thu, 30 Oct 2025 12:28:10 -0700 Subject: [PATCH 1/3] Add Strategic Map view to main screen Adds a third radar view to Main Screen that provides the same 50U rectangular radar view as Relay and Strategic Map. --- src/components/player.h | 3 +- src/gameGlobalInfo.cpp | 2 ++ src/gameGlobalInfo.h | 1 + src/gui/hotkeyConfig.cpp | 1 + src/gui/hotkeyConfig.h | 1 + src/screenComponents/mainScreenControls.cpp | 16 ++++++++++ src/screenComponents/mainScreenControls.h | 1 + src/screens/mainScreen.cpp | 35 ++++++++++++++++++--- src/screens/mainScreen.h | 1 + src/script.cpp | 9 ++++++ src/script/enum.h | 3 ++ src/tutorialGame.cpp | 3 +- src/tutorialGame.h | 1 + 13 files changed, 71 insertions(+), 6 deletions(-) diff --git a/src/components/player.h b/src/components/player.h index 55448ad104..42690e3f70 100644 --- a/src/components/player.h +++ b/src/components/player.h @@ -12,7 +12,8 @@ enum class MainScreenSetting Right, Target, Tactical, - LongRange + LongRange, + Strategic }; enum class MainScreenOverlay diff --git a/src/gameGlobalInfo.cpp b/src/gameGlobalInfo.cpp index 984fec8c14..e16e5cfa3b 100644 --- a/src/gameGlobalInfo.cpp +++ b/src/gameGlobalInfo.cpp @@ -33,6 +33,7 @@ GameGlobalInfo::GameGlobalInfo() use_system_damage = true; allow_main_screen_tactical_radar = true; allow_main_screen_long_range_radar = true; + allow_main_screen_strategic_map = true; gm_control_code = ""; elapsed_time = 0.0f; @@ -49,6 +50,7 @@ GameGlobalInfo::GameGlobalInfo() registerMemberReplication(&use_system_damage); registerMemberReplication(&allow_main_screen_tactical_radar); registerMemberReplication(&allow_main_screen_long_range_radar); + registerMemberReplication(&allow_main_screen_strategic_map); registerMemberReplication(&gm_control_code); registerMemberReplication(&elapsed_time, 0.1); registerMemberReplication(&default_skybox); diff --git a/src/gameGlobalInfo.h b/src/gameGlobalInfo.h index 81137d3de7..86f9fec213 100644 --- a/src/gameGlobalInfo.h +++ b/src/gameGlobalInfo.h @@ -55,6 +55,7 @@ class GameGlobalInfo : public MultiplayerObject, public Updatable bool use_system_damage; bool allow_main_screen_tactical_radar; bool allow_main_screen_long_range_radar; + bool allow_main_screen_strategic_map; string default_skybox = "default"; string gm_control_code; float elapsed_time; diff --git a/src/gui/hotkeyConfig.cpp b/src/gui/hotkeyConfig.cpp index 7da875f6fa..8447f8ebf2 100644 --- a/src/gui/hotkeyConfig.cpp +++ b/src/gui/hotkeyConfig.cpp @@ -95,6 +95,7 @@ Keys::Keys() : mainscreen_target("MAINSCREEN_TARGET", "T"), mainscreen_tactical_radar("MAINSCREEN_TACTICAL", "Tab"), mainscreen_long_range_radar("MAINSCREEN_LONG_RANGE", "Q"), + mainscreen_strategic_map("MAINSCREEN_STRATEGIC", "W"), mainscreen_first_person("MAINSCREEN_FIRST_PERSON", "F"), //helms diff --git a/src/gui/hotkeyConfig.h b/src/gui/hotkeyConfig.h index 34520c706f..dbd7e488ab 100644 --- a/src/gui/hotkeyConfig.h +++ b/src/gui/hotkeyConfig.h @@ -41,6 +41,7 @@ class Keys sp::io::Keybinding mainscreen_target; sp::io::Keybinding mainscreen_tactical_radar; sp::io::Keybinding mainscreen_long_range_radar; + sp::io::Keybinding mainscreen_strategic_map; sp::io::Keybinding mainscreen_first_person; //helms diff --git a/src/screenComponents/mainScreenControls.cpp b/src/screenComponents/mainScreenControls.cpp index 51207df368..f2be2080ba 100644 --- a/src/screenComponents/mainScreenControls.cpp +++ b/src/screenComponents/mainScreenControls.cpp @@ -49,6 +49,11 @@ GuiMainScreenControls::GuiMainScreenControls(GuiContainer* owner) long_range_button->setValue(active_mode == MainScreenSetting::LongRange); long_range_button->setVisible(gameGlobalInfo->allow_main_screen_long_range_radar); } + if (strategic_map_button) + { + strategic_map_button->setValue(active_mode == MainScreenSetting::Strategic); + strategic_map_button->setVisible(gameGlobalInfo->allow_main_screen_strategic_map); + } // Overlay controls if (show_comms_button) @@ -149,6 +154,17 @@ GuiMainScreenControls::GuiMainScreenControls(GuiContainer* owner) })); long_range_button = buttons.back(); + // Strategic map button. + buttons.push_back(new GuiToggleButton(button_strip, "MAIN_SCREEN_STRATEGIC_MAP_BUTTON", tr("mainscreen", "Strategic map"), + [this](bool value) + { + if (my_spaceship) + my_player_info->commandMainScreenSetting(MainScreenSetting::Strategic); + + closePopup(); + })); + strategic_map_button = buttons.back(); + // If the player has control over comms, they can toggle the comms overlay // on the main screen. if (my_player_info->hasPosition(CrewPosition::relayOfficer) diff --git a/src/screenComponents/mainScreenControls.h b/src/screenComponents/mainScreenControls.h index f946573334..9fd634b5cc 100644 --- a/src/screenComponents/mainScreenControls.h +++ b/src/screenComponents/mainScreenControls.h @@ -19,6 +19,7 @@ class GuiMainScreenControls : public GuiElement GuiToggleButton* target_lock_button; GuiToggleButton* tactical_button; GuiToggleButton* long_range_button; + GuiToggleButton* strategic_map_button; GuiToggleButton* show_comms_button; bool onscreen_comms_active; diff --git a/src/screens/mainScreen.cpp b/src/screens/mainScreen.cpp index d09f60039e..bc498340c9 100644 --- a/src/screens/mainScreen.cpp +++ b/src/screens/mainScreen.cpp @@ -30,21 +30,26 @@ ScreenMainScreen::ScreenMainScreen(RenderLayer* render_layer) viewport = new GuiViewportMainScreen(this, "VIEWPORT"); viewport->setPosition(0, 0, sp::Alignment::TopLeft)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); + // Radars main_screen_radar = new GuiRadarView(viewport, "VIEWPORT_RADAR", nullptr); main_screen_radar->setStyle(GuiRadarView::CircularMasked)->setSize(200, 200)->setPosition(-20, 20, sp::Alignment::TopRight); tactical_radar = new GuiRadarView(this, "TACTICAL", nullptr); tactical_radar->setPosition(0, 0, sp::Alignment::TopLeft)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); tactical_radar->setRangeIndicatorStepSize(1000.0f)->shortRange()->enableCallsigns()->hide(); - long_range_radar = new GuiRadarView(this, "TACTICAL", nullptr); + long_range_radar = new GuiRadarView(this, "LONG_RANGE", nullptr); long_range_radar->setPosition(0, 0, sp::Alignment::TopLeft)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); long_range_radar->setRangeIndicatorStepSize(5000.0f)->longRange()->enableCallsigns()->hide(); long_range_radar->setFogOfWarStyle(GuiRadarView::NebulaFogOfWar); + strategic_map = new GuiRadarView(this, "STRATEGIC", 50000.0f, nullptr); + strategic_map->setPosition(0.0f, 0.0f, sp::Alignment::TopLeft)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); + strategic_map->longRange()->enableWaypoints()->enableCallsigns()->setStyle(GuiRadarView::Rectangular)->hide(); + strategic_map->setAutoCentering(false)->setFogOfWarStyle(GuiRadarView::FriendlysShortRangeFogOfWar); + + // Overlays onscreen_comms = new GuiCommsOverlay(this); onscreen_comms->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax)->setVisible(false); - new GuiShipDestroyedPopup(this); - new GuiJumpIndicator(this); new GuiSelfDestructIndicator(this); new GuiGlobalMessage(this); @@ -70,6 +75,7 @@ ScreenMainScreen::ScreenMainScreen(RenderLayer* render_layer) keyboard_help->setText(keyboard_help_text); + // Music playback if (PreferencesManager::get("music_enabled") != "0") { threat_estimate = new ThreatLevelEstimate(); @@ -125,7 +131,8 @@ void ScreenMainScreen::update(float delta) if (my_spaceship) { - if (auto pc = my_spaceship.getComponent()) { + if (auto pc = my_spaceship.getComponent()) + { switch(pc->main_screen_setting) { case MainScreenSetting::Front: @@ -136,16 +143,25 @@ void ScreenMainScreen::update(float delta) viewport->show(); tactical_radar->hide(); long_range_radar->hide(); + strategic_map->hide(); break; case MainScreenSetting::Tactical: viewport->hide(); tactical_radar->show(); long_range_radar->hide(); + strategic_map->hide(); break; case MainScreenSetting::LongRange: viewport->hide(); tactical_radar->hide(); long_range_radar->show(); + strategic_map->hide(); + break; + case MainScreenSetting::Strategic: + viewport->hide(); + tactical_radar->hide(); + long_range_radar->hide(); + strategic_map->show(); break; } @@ -188,6 +204,8 @@ void ScreenMainScreen::update(float delta) my_player_info->commandMainScreenSetting(MainScreenSetting::Tactical); if (keys.mainscreen_long_range_radar.getDown()) my_player_info->commandMainScreenSetting(MainScreenSetting::LongRange); + if (keys.mainscreen_strategic_map.getDown()) + my_player_info->commandMainScreenSetting(MainScreenSetting::Strategic); if (keys.mainscreen_first_person.getDown()) viewport->first_person = !viewport->first_person; } @@ -226,6 +244,9 @@ bool ScreenMainScreen::onPointerDown(sp::io::Pointer::Button button, glm::vec2 p case MainScreenSetting::LongRange: button = check_radar(*long_range_radar); break; + case MainScreenSetting::Strategic: + button = check_radar(*strategic_map); + break; default: // Tapping the radar brings it up (middle mouse) if (main_screen_radar->getRect().contains(position)) @@ -273,6 +294,8 @@ bool ScreenMainScreen::onPointerDown(sp::io::Pointer::Button button, glm::vec2 p my_player_info->commandMainScreenSetting(MainScreenSetting::Tactical); else if (gameGlobalInfo->allow_main_screen_long_range_radar) my_player_info->commandMainScreenSetting(MainScreenSetting::LongRange); + else if (gameGlobalInfo->allow_main_screen_strategic_map) + my_player_info->commandMainScreenSetting(MainScreenSetting::Strategic); break; case MainScreenSetting::Tactical: if (gameGlobalInfo->allow_main_screen_long_range_radar) @@ -280,6 +303,10 @@ bool ScreenMainScreen::onPointerDown(sp::io::Pointer::Button button, glm::vec2 p break; case MainScreenSetting::LongRange: if (gameGlobalInfo->allow_main_screen_tactical_radar) + my_player_info->commandMainScreenSetting(MainScreenSetting::Strategic); + break; + case MainScreenSetting::Strategic: + if (gameGlobalInfo->allow_main_screen_strategic_map) my_player_info->commandMainScreenSetting(MainScreenSetting::Tactical); break; } diff --git a/src/screens/mainScreen.h b/src/screens/mainScreen.h index 42119d77e3..01a732e39f 100644 --- a/src/screens/mainScreen.h +++ b/src/screens/mainScreen.h @@ -22,6 +22,7 @@ class ScreenMainScreen : public GuiCanvas, public Updatable GuiRadarView* main_screen_radar; GuiRadarView* tactical_radar; GuiRadarView* long_range_radar; + GuiRadarView* strategic_map; GuiCommsOverlay* onscreen_comms; std::unique_ptr impulse_sound; public: diff --git a/src/script.cpp b/src/script.cpp index 733365acee..7642b8ad79 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -827,6 +827,11 @@ static bool luaIsLongRangeRadarAllowed() return gameGlobalInfo->allow_main_screen_long_range_radar; } +static bool luaIsStrategicMapAllowed() +{ + return gameGlobalInfo->allow_main_screen_strategic_map; +} + void luaCommandTargetRotation(sp::ecs::Entity ship, float rotation) { if (my_player_info && my_player_info->ship == ship) { my_player_info->commandTargetRotation(rotation); return; } auto thrusters = ship.getComponent(); @@ -1295,6 +1300,10 @@ bool setupScriptEnvironment(sp::script::Environment& env) /// Returns whether the "Long Range Radar" setting for main screens is enabled in the running scenario. /// Example: isLongRangeRadarAllowed() -- returns true by default env.setGlobal("isLongRangeRadarAllowed", &luaIsLongRangeRadarAllowed); + /// bool isStrategicMapAllowed() + /// Returns whether the "Strategic Map" setting for main screens is enabled in the running scenario. + /// Example: isStrategicMapAllowed() -- returns true by default + env.setGlobal("isStrategicMapAllowed", &luaIsStrategicMapAllowed); env.setGlobal("addGMFunction", &luaAddGMFunction); diff --git a/src/script/enum.h b/src/script/enum.h index c42a0eace4..9550386a6d 100644 --- a/src/script/enum.h +++ b/src/script/enum.h @@ -404,6 +404,7 @@ template<> struct Convert { case MainScreenSetting::Target: lua_pushstring(L, "target"); break; case MainScreenSetting::Tactical: lua_pushstring(L, "tactical"); break; case MainScreenSetting::LongRange: lua_pushstring(L, "longrange"); break; + case MainScreenSetting::Strategic: lua_pushstring(L, "strategic"); break; default: lua_pushstring(L, "none"); break; } return 1; @@ -424,6 +425,8 @@ template<> struct Convert { return MainScreenSetting::Tactical; else if (str == "longrange") return MainScreenSetting::LongRange; + else if (str == "strategic") + return MainScreenSetting::Strategic; luaL_error(L, "Unknown MainScreenSetting: %s", str.c_str()); return MainScreenSetting::Front; } diff --git a/src/tutorialGame.cpp b/src/tutorialGame.cpp index 62a1bb01c4..4c4376daa6 100644 --- a/src/tutorialGame.cpp +++ b/src/tutorialGame.cpp @@ -65,10 +65,11 @@ void TutorialGame::createScreens() tactical_radar = new GuiRadarView(this, "TACTICAL", nullptr); tactical_radar->setPosition(0, 0, sp::Alignment::TopLeft)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); tactical_radar->setRangeIndicatorStepSize(1000.0f)->shortRange()->enableCallsigns()->hide(); - long_range_radar = new GuiRadarView(this, "TACTICAL", nullptr); + long_range_radar = new GuiRadarView(this, "LONG_RANGE", nullptr); long_range_radar->setPosition(0, 0, sp::Alignment::TopLeft)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); long_range_radar->setRangeIndicatorStepSize(5000.0f)->longRange()->enableCallsigns()->hide(); long_range_radar->setFogOfWarStyle(GuiRadarView::NebulaFogOfWar); + // TODO: Strategic map station_screen[0] = new HelmsScreen(this); station_screen[1] = new WeaponsScreen(this); diff --git a/src/tutorialGame.h b/src/tutorialGame.h index 337a227b95..ccdb11b5f4 100644 --- a/src/tutorialGame.h +++ b/src/tutorialGame.h @@ -18,6 +18,7 @@ class TutorialGame : public Updatable, public GuiCanvas GuiElement* viewport; GuiRadarView* tactical_radar; GuiRadarView* long_range_radar; + // TODO: GuiRadarView* strategic_map; GuiElement* station_screen[8]; GuiPanel* frame; From c95c667c912c9893530ed4c1aa2df4325a7bb084 Mon Sep 17 00:00:00 2001 From: Garrett Guillotte Date: Fri, 21 Nov 2025 12:59:41 -0800 Subject: [PATCH 2/3] Apply suggestions from code review --- src/tutorialGame.cpp | 1 - src/tutorialGame.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/tutorialGame.cpp b/src/tutorialGame.cpp index 4c4376daa6..ea6909f240 100644 --- a/src/tutorialGame.cpp +++ b/src/tutorialGame.cpp @@ -69,7 +69,6 @@ void TutorialGame::createScreens() long_range_radar->setPosition(0, 0, sp::Alignment::TopLeft)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); long_range_radar->setRangeIndicatorStepSize(5000.0f)->longRange()->enableCallsigns()->hide(); long_range_radar->setFogOfWarStyle(GuiRadarView::NebulaFogOfWar); - // TODO: Strategic map station_screen[0] = new HelmsScreen(this); station_screen[1] = new WeaponsScreen(this); diff --git a/src/tutorialGame.h b/src/tutorialGame.h index ccdb11b5f4..337a227b95 100644 --- a/src/tutorialGame.h +++ b/src/tutorialGame.h @@ -18,7 +18,6 @@ class TutorialGame : public Updatable, public GuiCanvas GuiElement* viewport; GuiRadarView* tactical_radar; GuiRadarView* long_range_radar; - // TODO: GuiRadarView* strategic_map; GuiElement* station_screen[8]; GuiPanel* frame; From 1df1811267f5abfef1b7b661b2718efc9b6db20e Mon Sep 17 00:00:00 2001 From: oznogon Date: Sun, 4 Jan 2026 10:30:22 -0800 Subject: [PATCH 3/3] Autocenter Strategic Map view by default --- src/screens/mainScreen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/mainScreen.cpp b/src/screens/mainScreen.cpp index bc498340c9..32aa98ae54 100644 --- a/src/screens/mainScreen.cpp +++ b/src/screens/mainScreen.cpp @@ -44,7 +44,7 @@ ScreenMainScreen::ScreenMainScreen(RenderLayer* render_layer) strategic_map = new GuiRadarView(this, "STRATEGIC", 50000.0f, nullptr); strategic_map->setPosition(0.0f, 0.0f, sp::Alignment::TopLeft)->setSize(GuiElement::GuiSizeMax, GuiElement::GuiSizeMax); strategic_map->longRange()->enableWaypoints()->enableCallsigns()->setStyle(GuiRadarView::Rectangular)->hide(); - strategic_map->setAutoCentering(false)->setFogOfWarStyle(GuiRadarView::FriendlysShortRangeFogOfWar); + strategic_map->setAutoCentering(true)->setFogOfWarStyle(GuiRadarView::FriendlysShortRangeFogOfWar); // Overlays onscreen_comms = new GuiCommsOverlay(this);