From 884fd357b1800288e829409af081e2efb339d3ea Mon Sep 17 00:00:00 2001 From: James Packer Date: Tue, 1 Sep 2026 08:03:45 +0100 Subject: [PATCH 1/4] Allow own ship to be hidden in the 3d view --- bin/language-en.txt | 1 + bin/language-es.txt | 1 + bin/language-fr.txt | 1 + src/GUIMain.cpp | 7 +++++-- src/GUIMain.hpp | 3 ++- src/MyEventReceiver.cpp | 5 +++++ src/SimulationModel.cpp | 10 ++++++++++ src/SimulationModel.hpp | 3 +++ src/main.cpp | 3 +++ 9 files changed, 31 insertions(+), 3 deletions(-) diff --git a/bin/language-en.txt b/bin/language-en.txt index 2a769903..98aca012 100644 --- a/bin/language-en.txt +++ b/bin/language-en.txt @@ -30,6 +30,7 @@ zoom="Zoom" magnification="Magnification" view="View" changeView="View" +ownShipVisible="Own ship visible" 3dView="3D View" range="Range: " vrm="VRM: " diff --git a/bin/language-es.txt b/bin/language-es.txt index 9bc2db63..9548795f 100644 --- a/bin/language-es.txt +++ b/bin/language-es.txt @@ -30,6 +30,7 @@ zoom="Zoom" magnification="Aumento" view="Vista" changeView="Vista" +ownShipVisible="Visibilidad del barco" 3dView="Vista 3D" range="Alcance: " vrm="VRM: " diff --git a/bin/language-fr.txt b/bin/language-fr.txt index 20e571b2..e9bc2079 100644 --- a/bin/language-fr.txt +++ b/bin/language-fr.txt @@ -30,6 +30,7 @@ zoom="Zoom" magnification="Grossissement" view="Vue" changeView="Vue" +ownShipVisible="Visibilité du navire" 3dView="Vue 3D" range="Echelle : " vrm="VRM : " diff --git a/src/GUIMain.cpp b/src/GUIMain.cpp index 90238549..84108bb9 100644 --- a/src/GUIMain.cpp +++ b/src/GUIMain.cpp @@ -465,9 +465,12 @@ void GUIMain::load(irr::IrrlichtDevice* device, Lang* language, std::vectoraddTab(language->translate("view").c_str()); - guienv->addStaticText(language->translate("3dView").c_str(), irr::core::rect(0.005 * su, 0.02 * sh, 0.085 * su, 0.05 * sh), false, true, extraControlsTabView)->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); - show3d = guienv->addCheckBox(true, irr::core::rect(0.038 * su, 0.080 * sh, 0.052 * su, 0.100 * sh), extraControlsTabView); + guienv->addStaticText(language->translate("3dView").c_str(), irr::core::rect(0.005 * su, 0.02 * sh, 0.085 * su, 0.04 * sh), false, true, extraControlsTabView)->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); + show3d = guienv->addCheckBox(true, irr::core::rect(0.038 * su, 0.040 * sh, 0.052 * su, 0.060 * sh), extraControlsTabView); + guienv->addStaticText(language->translate("ownShipVisible").c_str(), irr::core::rect(0.005 * su, 0.070 * sh, 0.085 * su, 0.090 * sh), false, true, extraControlsTabView)->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); + guienv->addCheckBox(true, irr::core::rect(0.038 * su, 0.090 * sh, 0.052 * su, 0.110 * sh), extraControlsTabView, GUI_ID_OWNSHIP_VIEW_BOX); + guienv->addStaticText(language->translate("magnification").c_str(), irr::core::rect(0.085 * su, 0.02 * sh, 0.165 * su, 0.05 * sh), false, true, extraControlsTabView)->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); magnificationScrollbar = new irr::gui::ScrollDial(irr::core::vector2d(0.125 * su, 0.09 * sh), 0.03 * su, guienv, extraControlsTabView, GUI_ID_MAGNIFICATION_SCROLL_BAR); magnificationScrollbar->setMax(200); //Divide by 10 to get magnification diff --git a/src/GUIMain.hpp b/src/GUIMain.hpp index e8092db8..f0507781 100644 --- a/src/GUIMain.hpp +++ b/src/GUIMain.hpp @@ -213,7 +213,8 @@ class GUIMain //Create, build and update GUI GUI_ID_TIMECOMPRESSION_15_BUTTON, GUI_ID_TIMECOMPRESSION_30_BUTTON, GUI_ID_TIMECOMPRESSION_60_BUTTON, - GUI_ID_TIMECOMPRESSION_3600_BUTTON + GUI_ID_TIMECOMPRESSION_3600_BUTTON, + GUI_ID_OWNSHIP_VIEW_BOX }; bool getShowInterface() const; diff --git a/src/MyEventReceiver.cpp b/src/MyEventReceiver.cpp index 907226ea..4f4e5a92 100644 --- a/src/MyEventReceiver.cpp +++ b/src/MyEventReceiver.cpp @@ -291,6 +291,11 @@ bool MyEventReceiver::OnEvent(const irr::SEvent &event) { model->setStreamOverride(((irr::gui::IGUICheckBox *)event.GUIEvent.Caller)->isChecked()); } + + if (id == GUIMain::GUI_ID_OWNSHIP_VIEW_BOX) + { + model->setOwnShipVisibility(((irr::gui::IGUICheckBox *)event.GUIEvent.Caller)->isChecked()); + } } if (event.GUIEvent.EventType == irr::gui::EGET_SCROLL_BAR_CHANGED) diff --git a/src/SimulationModel.cpp b/src/SimulationModel.cpp index 3a20b4aa..e809b8c8 100644 --- a/src/SimulationModel.cpp +++ b/src/SimulationModel.cpp @@ -1783,6 +1783,11 @@ SimulationModel::~SimulationModel() return contactPointNode; } + void SimulationModel::setOwnShipVisibility(bool visible) + { + ownShip.getSceneNode()->setVisible(visible); + } + irr::scene::ISceneNode* SimulationModel::getOwnShipSceneNode() { return (irr::scene::ISceneNode*)ownShip.getSceneNode(); @@ -1828,6 +1833,11 @@ SimulationModel::~SimulationModel() return &lines; } + irr::scene::ISceneNode* SimulationModel::getRadarSceneNode() + { + return radarScreen.getSceneNode(); + } + void SimulationModel::updateCameraVRPos(irr::core::quaternion quat, irr::core::vector3df pos, irr::core::vector2df lensShift) { camera.update(0, quat, pos, lensShift, true); diff --git a/src/SimulationModel.hpp b/src/SimulationModel.hpp index b890d3b2..a938b7ec 100644 --- a/src/SimulationModel.hpp +++ b/src/SimulationModel.hpp @@ -356,12 +356,15 @@ class SimulationModel //Start of the 'Model' part of MVC irr::scene::ISceneNode* getContactFromRay(irr::core::line3d ray, irr::s32 linesMode); + void setOwnShipVisibility(bool visible); irr::scene::ISceneNode* getOwnShipSceneNode(); irr::scene::ISceneNode* getOtherShipSceneNode(int number); irr::scene::ISceneNode* getBuoySceneNode(int number); irr::scene::ISceneNode* getLandObjectSceneNode(int number); irr::scene::ISceneNode* getTerrainSceneNode(int number); + irr::scene::ISceneNode* getRadarSceneNode(); + Terrain* getTerrain(); irr::f32 getTerrainHeight(irr::f32 posX, irr::f32 posZ) const; diff --git a/src/main.cpp b/src/main.cpp index 7b6fde93..20170064 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1200,6 +1200,9 @@ int main(int argc, char ** argv) } } + model.getRadarSceneNode()->setVisible(model.getOwnShipSceneNode()->isVisible()); + + // renderRadarProfile.toc(); // renderProfile.tic(); From 804b39d36c8e386da332dc36f178cb8e2ad6f12b Mon Sep 17 00:00:00 2001 From: James Packer Date: Tue, 1 Sep 2026 08:24:18 +0100 Subject: [PATCH 2/4] Add ini setting for own ship visibility --- bin/bc5.ini | 2 ++ src/GUIMain.cpp | 4 +++- src/GUIMain.hpp | 2 ++ src/SimulationModel.cpp | 1 + src/main.cpp | 7 +++++++ 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/bin/bc5.ini b/bin/bc5.ini index 70023691..6b84835e 100644 --- a/bin/bc5.ini +++ b/bin/bc5.ini @@ -267,6 +267,8 @@ secondary_mode=0 secondary_mode_DESC=Set to 1 to automatically start Bridge Command in secondary mode hide_instruments=0 hide_instruments_DESC=Set to 1 to start Bridge Command with a full screen 3d view and the 2d instrument panel hidden +own_ship_hidden=0 +own_ship_hidden_DESC=Set to 1 to start Bridge Command with the own ship model hidden in the 3d view full_radar=0 full_radar_DESC=Set to 1 to start Bridge Command with a full screen radar view arpa_on=0 diff --git a/src/GUIMain.cpp b/src/GUIMain.cpp index 84108bb9..9b75e7e5 100644 --- a/src/GUIMain.cpp +++ b/src/GUIMain.cpp @@ -469,7 +469,7 @@ void GUIMain::load(irr::IrrlichtDevice* device, Lang* language, std::vectoraddCheckBox(true, irr::core::rect(0.038 * su, 0.040 * sh, 0.052 * su, 0.060 * sh), extraControlsTabView); guienv->addStaticText(language->translate("ownShipVisible").c_str(), irr::core::rect(0.005 * su, 0.070 * sh, 0.085 * su, 0.090 * sh), false, true, extraControlsTabView)->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); - guienv->addCheckBox(true, irr::core::rect(0.038 * su, 0.090 * sh, 0.052 * su, 0.110 * sh), extraControlsTabView, GUI_ID_OWNSHIP_VIEW_BOX); + viewOwnShip = guienv->addCheckBox(true, irr::core::rect(0.038 * su, 0.090 * sh, 0.052 * su, 0.110 * sh), extraControlsTabView, GUI_ID_OWNSHIP_VIEW_BOX); guienv->addStaticText(language->translate("magnification").c_str(), irr::core::rect(0.085 * su, 0.02 * sh, 0.165 * su, 0.05 * sh), false, true, extraControlsTabView)->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER); magnificationScrollbar = new irr::gui::ScrollDial(irr::core::vector2d(0.125 * su, 0.09 * sh), 0.03 * su, guienv, extraControlsTabView, GUI_ID_MAGNIFICATION_SCROLL_BAR); @@ -1229,6 +1229,8 @@ void GUIMain::load(irr::IrrlichtDevice* device, Lang* language, std::vectorsetPos(Utilities::round(guiData->streamSpeed)); streamOverride->setChecked(guiData->streamOverride); + viewOwnShip->setChecked(guiData->viewOwnShip); + // DEE vvvvv this should display the rate of turn data on the screen // DEE since internalrate of turn is in rads per second then for deg per min x 3438 diff --git a/src/GUIMain.hpp b/src/GUIMain.hpp index f0507781..218c2424 100644 --- a/src/GUIMain.hpp +++ b/src/GUIMain.hpp @@ -60,6 +60,7 @@ struct GUIData { irr::f32 streamSpeed; bool streamOverride; bool radarOn; + bool viewOwnShip; irr::f32 radarRangeNm; irr::f32 radarGain; irr::f32 radarClutter; @@ -340,6 +341,7 @@ class GUIMain //Create, build and update GUI irr::gui::IGUIScrollBar* magnificationScrollbar; irr::gui::IGUICheckBox* show3d; + irr::gui::IGUICheckBox* viewOwnShip; irr::gui::IGUIButton* showInterfaceButton; irr::gui::IGUIButton* hideInterfaceButton; diff --git a/src/SimulationModel.cpp b/src/SimulationModel.cpp index e809b8c8..e930ad12 100644 --- a/src/SimulationModel.cpp +++ b/src/SimulationModel.cpp @@ -2065,6 +2065,7 @@ SimulationModel::~SimulationModel() guiData->streamDirection = streamOverrideDirection; guiData->streamSpeed = streamOverrideSpeed; guiData->streamOverride = streamOverride; + guiData->viewOwnShip = getOwnShipSceneNode()->isVisible(); guiData->radarRangeNm = radarCalculation.getRangeNm(); guiData->radarGain = radarCalculation.getGain(); guiData->radarClutter = radarCalculation.getClutter(); diff --git a/src/main.cpp b/src/main.cpp index 20170064..b451c23b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -538,6 +538,8 @@ int main(int argc, char ** argv) viewAngle = 90; } + bool viewOwnShip = (IniFile::iniFileTou32(iniFilename, "own_ship_hidden") != 1); + irr::f32 cameraMinDistance = IniFile::iniFileTof32(iniFilename, "minimum_distance"); irr::f32 cameraMaxDistance = IniFile::iniFileTof32(iniFilename, "maximum_distance"); if (cameraMinDistance<=0) { @@ -1026,6 +1028,11 @@ int main(int argc, char ** argv) scenarioData, modelParameters); + // Set own ship visibility + if (!viewOwnShip) { + model.getOwnShipSceneNode()->setVisible(false); + } + //check enough time has elapsed to show the credits screen (5s) while (device->getTimer()->getRealTime() - creditsStartTime < 5000) { device->run(); From 7dfe0480d171e81abbbd7f82feded77decec70c5 Mon Sep 17 00:00:00 2001 From: James Packer Date: Tue, 1 Sep 2026 08:40:56 +0100 Subject: [PATCH 3/4] Allow both main and ini to read custom ini file relative to user folder. --- src/iniEditor/main.cpp | 6 ++++++ src/main.cpp | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/iniEditor/main.cpp b/src/iniEditor/main.cpp index 4909cc2b..065de642 100644 --- a/src/iniEditor/main.cpp +++ b/src/iniEditor/main.cpp @@ -221,6 +221,12 @@ int main (int argc, char ** argv) iniFilename = "repeater.ini"; } + // Allow ini file name to be overwritten from the command line + if ((argc>2)&&(strcmp(argv[1],"-c")==0)) { + iniFilename = std::string(argv[2]); //TODO: Check this for sanity? + std::cout << "Using Ini file >" << iniFilename << "<" << std::endl; + } + bool autoMode = false; if (((argc > 1) && (strcmp(argv[1], "-auto") == 0)) || ((argc > 2) && (strcmp(argv[2], "-auto") == 0))) { diff --git a/src/main.cpp b/src/main.cpp index b451c23b..646872c0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -434,16 +434,18 @@ int main(int argc, char ** argv) //Read basic ini settings std::string iniFilename = "bc5.ini"; - //Use local ini file if it exists - if (Utilities::pathExists(userFolder + iniFilename)) { - iniFilename = userFolder + iniFilename; - } + // Allow ini file name to be overwritten from the command line if ((argc>2)&&(strcmp(argv[1],"-c")==0)) { iniFilename = std::string(argv[2]); //TODO: Check this for sanity? std::cout << "Using Ini file >" << iniFilename << "<" << std::endl; } + //Use local ini file if it exists + if (Utilities::pathExists(userFolder + iniFilename)) { + iniFilename = userFolder + iniFilename; + } + std::string scriptToExe = IniFile::iniFileToString(iniFilename, "script_start_BC"); if (!scriptToExe.empty()) { std::string scriptPath; From 9ccd10cb9bd13052febb34adf6f8110f0a2917f8 Mon Sep 17 00:00:00 2001 From: James Packer Date: Tue, 1 Sep 2026 18:09:26 +0100 Subject: [PATCH 4/4] Use OwnShip scene node, instead of helper function. --- src/MyEventReceiver.cpp | 2 +- src/SimulationModel.cpp | 5 ----- src/SimulationModel.hpp | 1 - 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/MyEventReceiver.cpp b/src/MyEventReceiver.cpp index 4f4e5a92..9d7ed827 100644 --- a/src/MyEventReceiver.cpp +++ b/src/MyEventReceiver.cpp @@ -294,7 +294,7 @@ bool MyEventReceiver::OnEvent(const irr::SEvent &event) if (id == GUIMain::GUI_ID_OWNSHIP_VIEW_BOX) { - model->setOwnShipVisibility(((irr::gui::IGUICheckBox *)event.GUIEvent.Caller)->isChecked()); + model->getOwnShipSceneNode()->setVisible(((irr::gui::IGUICheckBox *)event.GUIEvent.Caller)->isChecked()); } } diff --git a/src/SimulationModel.cpp b/src/SimulationModel.cpp index e930ad12..96393f9f 100644 --- a/src/SimulationModel.cpp +++ b/src/SimulationModel.cpp @@ -1783,11 +1783,6 @@ SimulationModel::~SimulationModel() return contactPointNode; } - void SimulationModel::setOwnShipVisibility(bool visible) - { - ownShip.getSceneNode()->setVisible(visible); - } - irr::scene::ISceneNode* SimulationModel::getOwnShipSceneNode() { return (irr::scene::ISceneNode*)ownShip.getSceneNode(); diff --git a/src/SimulationModel.hpp b/src/SimulationModel.hpp index a938b7ec..31c2fe9d 100644 --- a/src/SimulationModel.hpp +++ b/src/SimulationModel.hpp @@ -356,7 +356,6 @@ class SimulationModel //Start of the 'Model' part of MVC irr::scene::ISceneNode* getContactFromRay(irr::core::line3d ray, irr::s32 linesMode); - void setOwnShipVisibility(bool visible); irr::scene::ISceneNode* getOwnShipSceneNode(); irr::scene::ISceneNode* getOtherShipSceneNode(int number); irr::scene::ISceneNode* getBuoySceneNode(int number);