mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-29 15:07:29 +01:00
Fix the base map orientation, drop the city overlay, keep td.scn out of the editor
The Geoportal images arrive with their first row at the north edge, which is the opposite of what the default texture coordinates assume - the vertical ones are now swapped, for the picker's base map and the orthophoto alike. With the real map carrying its own detail as the view zooms in, the drawn city markers had nothing to add and are gone, along with the coordinate table behind them. Only the country's extent remains, to open the picker on. -editor no longer inherits the scenery named in eu07.ini. That is whatever was last driven, which has nothing to do with editing; without an explicit -s the editor opens on empty ground.
This commit is contained in:
@@ -1121,6 +1121,7 @@ int eu07_application::init_settings(int Argc, char *Argv[])
|
||||
}
|
||||
|
||||
// process command line arguments
|
||||
auto scenerywasasked = false;
|
||||
for (int i = 1; i < Argc; ++i)
|
||||
{
|
||||
|
||||
@@ -1131,6 +1132,7 @@ int eu07_application::init_settings(int Argc, char *Argv[])
|
||||
if (i + 1 < Argc)
|
||||
{
|
||||
Global.SceneryFile = ToLower(Argv[++i]);
|
||||
scenerywasasked = true;
|
||||
}
|
||||
}
|
||||
else if (token == "-v")
|
||||
@@ -1153,10 +1155,11 @@ int eu07_application::init_settings(int Argc, char *Argv[])
|
||||
}
|
||||
}
|
||||
|
||||
if (Global.editor_startup && Global.SceneryFile.empty())
|
||||
if (Global.editor_startup && false == scenerywasasked)
|
||||
{
|
||||
// the editor needs a loaded world, but not necessarily anything in it - an empty scenery gives
|
||||
// just the region, the lighting and the clock, with no rolling stock and no timetables
|
||||
// the editor opens on empty ground unless a scenery was actually asked for. whatever the ini
|
||||
// happens to name is the last thing that was driven, which has nothing to do with editing; an
|
||||
// empty scenery still gives the region, the lighting and the clock, just nothing standing on it
|
||||
Global.SceneryFile = "pusta.scn";
|
||||
}
|
||||
|
||||
|
||||
@@ -158,8 +158,6 @@ void plan_panel::render_location_dialog()
|
||||
ImGui::InvisibleButton("poland_map", mapsize);
|
||||
auto const hovered{ImGui::IsItemHovered()};
|
||||
|
||||
auto const &places{editor::poland_places()};
|
||||
|
||||
// fit the whole country the first time round; afterwards the wheel decides
|
||||
if (m_mapscale <= 0.0)
|
||||
{
|
||||
@@ -213,14 +211,10 @@ void plan_panel::render_location_dialog()
|
||||
// the picture on screen is the one that was fetched, which may lag the current view by a
|
||||
// request; drawing it against its own box keeps it registered while the new one arrives
|
||||
auto const &covered{m_topomap.covered()};
|
||||
drawlist->AddImage(reinterpret_cast<ImTextureID>(static_cast<intptr_t>(backdrop)), to_screen(covered.min_x, covered.max_y), to_screen(covered.max_x, covered.min_y));
|
||||
}
|
||||
|
||||
for (auto const &place : places)
|
||||
{
|
||||
auto const point{to_screen(place.position.x, place.position.y)};
|
||||
drawlist->AddCircleFilled(point, 3.0f, IM_COL32(200, 200, 200, 255));
|
||||
drawlist->AddText(ImVec2(point.x + 5.0f, point.y - 6.0f), IM_COL32(190, 190, 190, 255), place.name.c_str());
|
||||
// the image arrives with its first row at the north edge, which is the opposite of what the
|
||||
// default texture coordinates assume, so the vertical ones are swapped
|
||||
drawlist->AddImage(reinterpret_cast<ImTextureID>(static_cast<intptr_t>(backdrop)), to_screen(covered.min_x, covered.max_y), to_screen(covered.max_x, covered.min_y), ImVec2(0.0f, 1.0f),
|
||||
ImVec2(1.0f, 0.0f));
|
||||
}
|
||||
|
||||
auto const picked{to_screen(m_pickx, m_picky)};
|
||||
@@ -238,22 +232,6 @@ void plan_panel::render_location_dialog()
|
||||
ImGui::SetNextItemWidth(180.0f);
|
||||
ImGui::InputDouble("northing", &m_picky, 100.0, 1000.0, "%.0f");
|
||||
|
||||
ImGui::SetNextItemWidth(220.0f);
|
||||
if (ImGui::BeginCombo("go to", "pick a city"))
|
||||
{
|
||||
for (auto const &place : places)
|
||||
{
|
||||
if (ImGui::Selectable(place.name.c_str()))
|
||||
{
|
||||
m_pickx = place.position.x;
|
||||
m_picky = place.position.y;
|
||||
m_mapviewx = m_pickx;
|
||||
m_mapviewy = m_picky;
|
||||
}
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
if (ImGui::Button("Use this place", ImVec2(160.0f, 0.0f)))
|
||||
{
|
||||
@@ -374,7 +352,9 @@ void plan_panel::draw_on_scene()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
drawlist->AddImageQuad(reinterpret_cast<ImTextureID>(static_cast<intptr_t>(tile.texture)), corners[0], corners[1], corners[2], corners[3]);
|
||||
// same north-first row order as the picker's base map, so the same swap applies
|
||||
drawlist->AddImageQuad(reinterpret_cast<ImTextureID>(static_cast<intptr_t>(tile.texture)), corners[0], corners[1], corners[2], corners[3], ImVec2(0.0f, 1.0f), ImVec2(1.0f, 1.0f),
|
||||
ImVec2(1.0f, 0.0f), ImVec2(0.0f, 0.0f));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user