Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ enum class MainScreenSetting
Right,
Target,
Tactical,
LongRange
LongRange,
Strategic
};

enum class MainScreenOverlay
Expand Down
2 changes: 2 additions & 0 deletions src/gameGlobalInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/gameGlobalInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/gui/hotkeyConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/gui/hotkeyConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 16 additions & 0 deletions src/screenComponents/mainScreenControls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/screenComponents/mainScreenControls.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
35 changes: 31 additions & 4 deletions src/screens/mainScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(true)->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);
Expand All @@ -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();
Expand Down Expand Up @@ -125,7 +131,8 @@ void ScreenMainScreen::update(float delta)

if (my_spaceship)
{
if (auto pc = my_spaceship.getComponent<PlayerControl>()) {
if (auto pc = my_spaceship.getComponent<PlayerControl>())
{
switch(pc->main_screen_setting)
{
case MainScreenSetting::Front:
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -273,13 +294,19 @@ 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)
my_player_info->commandMainScreenSetting(MainScreenSetting::LongRange);
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;
}
Expand Down
1 change: 1 addition & 0 deletions src/screens/mainScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<ImpulseSound> impulse_sound;
public:
Expand Down
9 changes: 9 additions & 0 deletions src/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ManeuveringThrusters>();
Expand Down Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions src/script/enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ template<> struct Convert<MainScreenSetting> {
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;
Expand All @@ -424,6 +425,8 @@ template<> struct Convert<MainScreenSetting> {
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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tutorialGame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ 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);
Expand Down
Loading