16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 12:29:18 +02:00

Merge remote-tracking branch 'remotes/origin/master' into ecs

This commit is contained in:
2026-04-16 19:08:50 +02:00
34 changed files with 1942 additions and 1589 deletions

View File

@@ -686,6 +686,7 @@ void eu07_application::exit()
glfwDestroyWindow(window);
}
m_taskqueue.exit();
glfwPollEvents(); // TODO: This fixes a segfault on Wayland when closing. Remove after updating glfw to 3.5.
glfwTerminate();
if (!Global.exec_on_exit.empty())

View File

@@ -1138,9 +1138,12 @@ debug_panel::update_section_ai( std::vector<text_line> &Output ) {
"Current order: [" + std::to_string( mechanik.OrderPos ) + "] "
+ mechanik.Order2Str( mechanik.OrderCurrentGet() );
if( mechanik.fStopTime < 0.0 ) {
textline += "\n stop time: " + to_string( std::abs( mechanik.fStopTime ), 1 );
}
if( mechanik.fStopTime < 0.0 ) {
textline += "\n stop time: " + to_string( std::abs( mechanik.fStopTime ), 1 );
}
if( mechanik.fActionTime < 0.0 ) {
textline += "\n action time: " + to_string( std::abs( mechanik.fActionTime ), 1 );
}
Output.emplace_back( textline, Global.UITextColor );
@@ -1231,7 +1234,8 @@ debug_panel::update_section_ai( std::vector<text_line> &Output ) {
std::vector<std::string> const drivingflagnames {
"StopCloser", "StopPoint", "Active", "Press", "Connect", "Primary", "Late", "StopHere",
"StartHorn", "StartHornNow", "StartHornDone", "Oerlikons", "IncSpeed", "TrackEnd", "SwitchFound", "GuardSignal",
"Visibility", "DoorOpened", "PushPull", "SignalFound", "StopPointFound" /*"SemaphorWasElapsed", "TrainInsideStation", "SpeedLimitFound"*/ };
"Visibility", "DoorOpened", "PushPull", "SignalFound", "StopPointFound", "GuardOpenDoor", "DepartureWarned"
/*"SemaphorWasElapsed", "TrainInsideStation", "SpeedLimitFound"*/ };
textline = "Driving flags:";
for( int idx = 0, flagbit = 1; idx < drivingflagnames.size(); ++idx, flagbit <<= 1 ) {

View File

@@ -97,17 +97,17 @@ void itemproperties_panel::update(scene::basic_node const *Node)
// 3d shape
auto modelfile{((subnode->pModel != nullptr) ? subnode->pModel->NameGet() : "(none)")};
if (modelfile.find(szModelPath) == 0)
if (modelfile.find(paths::models) == 0)
{
// don't include 'models/' in the path
modelfile.erase(0, std::string{szModelPath}.size());
modelfile.erase(0, std::string{paths::models}.size());
}
// texture
auto texturefile{((subnode->Material()->replacable_skins[1] != null_handle) ? GfxRenderer->Material(subnode->Material()->replacable_skins[1])->GetName() : "(none)")};
if (texturefile.find(szTexturePath) == 0)
if (texturefile.find(paths::textures) == 0)
{
// don't include 'textures/' in the path
texturefile.erase(0, std::string{szTexturePath}.size());
texturefile.erase(0, std::string{paths::textures}.size());
}
text_lines.emplace_back("mesh: " + modelfile, Global.UITextColor);
text_lines.emplace_back("skin: " + texturefile, Global.UITextColor);
@@ -131,14 +131,14 @@ void itemproperties_panel::update(scene::basic_node const *Node)
text_lines.emplace_back(textline, Global.UITextColor);
// textures
auto texturefile{((subnode->m_material1 != null_handle) ? GfxRenderer->Material(subnode->m_material1)->GetName() : "(none)")};
if (texturefile.find(szTexturePath) == 0)
if (texturefile.find(paths::textures) == 0)
{
texturefile.erase(0, std::string{szTexturePath}.size());
texturefile.erase(0, std::string{paths::textures}.size());
}
auto texturefile2{((subnode->m_material2 != null_handle) ? GfxRenderer->Material(subnode->m_material2)->GetName() : "(none)")};
if (texturefile2.find(szTexturePath) == 0)
if (texturefile2.find(paths::textures) == 0)
{
texturefile2.erase(0, std::string{szTexturePath}.size());
texturefile2.erase(0, std::string{paths::textures}.size());
}
textline = "skins:\n " + texturefile + "\n " + texturefile2;
text_lines.emplace_back(textline, Global.UITextColor);

View File

@@ -91,6 +91,8 @@ std::vector<std::string> scenarioloader_ui::get_random_trivia()
int i = RandomInt(0, static_cast<int>(triviaData.size()) - 1);
std::string triviaStr = triviaData[i]["text"];
std::string background = triviaData[i]["background"];
if (triviaData[i].contains("scenery"))
sceneryName = triviaData[i]["scenery"];
// divide trivia into multiple lines - UTF-8 safe implementation
// Different languages need different character limits due to character width differences
@@ -275,6 +277,15 @@ void scenarioloader_ui::render_()
draw_list->AddText(text_pos, IM_COL32_WHITE, line.c_str());
}
}
// Scenery name
// Draw only if defined
if (!sceneryName.empty())
{
ImVec2 text_size = ImGui::CalcTextSize(sceneryName.c_str());
ImVec2 text_pos = ImVec2(screen_size.x - 16 - text_size.x, 16);
draw_list->AddText(text_pos, IM_COL32_WHITE, sceneryName.c_str());
}
// Progress bar at the bottom of the screen
const auto p1 = ImVec2(0, Global.window_size.y - 2);

View File

@@ -30,4 +30,9 @@ private:
std::vector<std::string> get_random_trivia();
void generate_gradient_tex();
void load_wheel_frames();
/// <summary>
/// Scenery name for eligable trivias
/// </summary>
std::string sceneryName;
};