From 94b01c8ca395e5617e698663d98ec7a1ce39837c Mon Sep 17 00:00:00 2001 From: maj00r Date: Fri, 31 Jul 2026 18:45:05 +0200 Subject: [PATCH] Add -editor startup so the exe comes up straight in the editor The editor was reachable only from the driver mode with F11, which meant loading a scenario and starting the whole simulation first. With -editor the scenario loader hands over to the editor instead of the driver, so physics, AI and timetables never run - only the loaded world is there to be worked on. Without -s the scenery from eu07.ini is used, falling back to pusta.scn when the ini names none. F11 quits instead of popping the mode, since the editor is now the bottom of the mode stack and popping it would leave the rest of the frame reading an empty one. Editor entry forces free-fly even with no vehicle to leave. --- application/application.cpp | 14 +++++++++++++- application/editormode.cpp | 12 ++++++++++-- application/scenarioloadermode.cpp | 7 ++++++- utilities/Globals.h | 2 ++ 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/application/application.cpp b/application/application.cpp index e5d0b6ba..72fdda0a 100644 --- a/application/application.cpp +++ b/application/application.cpp @@ -1140,14 +1140,26 @@ int eu07_application::init_settings(int Argc, char *Argv[]) Global.local_start_vehicle = ToLower(Argv[++i]); } } + else if (token == "-editor") + { + Global.editor_startup = true; + } else { std::cout << "usage: " << std::string(Argv[0]) << " [-s sceneryfilepath]" - << " [-v vehiclename]" << std::endl; + << " [-v vehiclename]" + << " [-editor]" << std::endl; return -1; } } + if (Global.editor_startup && Global.SceneryFile.empty()) + { + // edytor potrzebuje wczytanego świata, ale niekoniecznie czegokolwiek w nim - pusta sceneria daje + // sam region, oświetlenie i zegar, bez taboru i rozkładów + Global.SceneryFile = "pusta.scn"; + } + return 0; } diff --git a/application/editormode.cpp b/application/editormode.cpp index 46a8edad..89d54453 100644 --- a/application/editormode.cpp +++ b/application/editormode.cpp @@ -1362,8 +1362,11 @@ void editor_mode::enter() Camera.m_owner = nullptr; Camera.LookAt = vehicle->GetPosition(); Camera.RaLook(); // single camera reposition - FreeFlyModeFlag = true; } + // edytor pracuje wyłącznie kamerą swobodną. Przy starcie prosto do edytora nie ma pojazdu, z + // którego można by wysiąść, a flagę i tak trzeba podnieść - inaczej kamera zostaje w trybie + // kabinowym, nie mając kabiny + FreeFlyModeFlag = true; } Global.ControlPicking = true; @@ -1455,7 +1458,12 @@ void editor_mode::on_key(int const Key, int const Scancode, int const Action, in if (!Global.ctrlState && !Global.shiftState) { - Application.pop_mode(); + // przy starcie do edytora nie ma trybu, do którego można wrócić - zdjęcie ostatniego trybu + // zostawiłoby pusty stos, z którego reszta klatki nadal by czytała + if (Global.editor_startup) + Application.queue_quit(true); + else + Application.pop_mode(); } else if (Global.ctrlState && Global.shiftState) { diff --git a/application/scenarioloadermode.cpp b/application/scenarioloadermode.cpp index f05c3869..34c91652 100644 --- a/application/scenarioloadermode.cpp +++ b/application/scenarioloadermode.cpp @@ -60,7 +60,12 @@ bool scenarioloader_mode::update() { // TODO: implement and use next mode cue Application.pop_mode(); - Application.push_mode( eu07_application::mode::driver ); + // przy starcie do edytora symulacja w ogóle nie rusza: nie ma trybu prowadzenia pod spodem, więc nie + // liczy się fizyki, AI ani rozkładów - zostaje sam wczytany świat do obrabiania + Application.push_mode( + Global.editor_startup ? + eu07_application::mode::editor : + eu07_application::mode::driver ); return true; } diff --git a/utilities/Globals.h b/utilities/Globals.h index 729b7cbc..0ee9cce5 100644 --- a/utilities/Globals.h +++ b/utilities/Globals.h @@ -77,6 +77,8 @@ struct global_settings { std::string szTexturesDDS{ ".dds" }; // lista tekstur od DDS std::string szDefaultExt{ szTexturesDDS }; std::string SceneryFile; + // uruchomienie prosto do edytora, z pominięciem symulacji; edytor jest wtedy trybem podstawowym + bool editor_startup{ false }; std::string local_start_vehicle{ "EU07-424" }; int iConvertModels{ 0 }; // tworzenie plików binarnych int iConvertIndexRange{ 1000 }; // range of duplicate vertex scan