diff --git a/src/editor/system/GalaxyEditAPI.cpp b/src/editor/system/GalaxyEditAPI.cpp index 32c70eb94c7..7577a2b2671 100644 --- a/src/editor/system/GalaxyEditAPI.cpp +++ b/src/editor/system/GalaxyEditAPI.cpp @@ -584,6 +584,14 @@ void SystemBody::EditorAPI::EditStarportProperties(SystemBody *body, UndoSystem } EditEconomicProperties(body, undo); + + ImGui::SeparatorText("Misc. Properties"); + + ImGui::InputText("Model Name", &body->m_spaceStationType); + if (Draw::UndoHelper("Edit Station Model Name", undo)) + AddUndoSingleValue(undo, &body->m_spaceStationType); + + Draw::HelpMarker("Model name (without extension) to use for this starport.\nA random model is chosen if not specified."); } void SystemBody::EditorAPI::EditBodyName(SystemBody *body, Random &rng, LuaNameGen *nameGen, UndoSystem *undo) @@ -743,6 +751,18 @@ void SystemBody::EditorAPI::EditProperties(SystemBody *body, Random &rng, UndoSy if (Draw::UndoHelper("Edit Life", undo)) AddUndoSingleValue(undo, &body->m_life); + ImGui::InputText("HMap Path", &body->m_heightMapFilename); + if (Draw::UndoHelper("Edit Heightmap Path", undo)) + AddUndoSingleValue(undo, &body->m_heightMapFilename); + + Draw::HelpMarker("Path to a custom heightmap file for this body, relative to the game's data directory."); + + ImGui::SliderInt("HMap Fractal", reinterpret_cast(&body->m_heightMapFractal), 0, 1, "%d", ImGuiSliderFlags_AlwaysClamp); + if (Draw::UndoHelper("Edit Heightmap Fractal", undo)) + AddUndoSingleValue(undo, &body->m_heightMapFractal); + + Draw::HelpMarker("Fractal type index for use with a custom heightmap file."); + if (Draw::DerivedValues("Surface Parameters")) { ImGui::BeginDisabled(); diff --git a/src/galaxy/SystemBody.cpp b/src/galaxy/SystemBody.cpp index 3b74a27596c..c856f294d69 100644 --- a/src/galaxy/SystemBody.cpp +++ b/src/galaxy/SystemBody.cpp @@ -117,10 +117,16 @@ void SystemBodyData::LoadFromJson(const Json &obj) m_rings.baseColor = obj.value("ringsBaseColor", {}); } + // NOTE: the following parameters should be replaced with entries + // in a PropertyMap owned by the system body m_spaceStationType = obj.value("spaceStationType", ""); + // HACK: this is to support the current / legacy heightmap fractal system + // Should be replaced with PropertyMap entries and validation moved to Terrain.cpp m_heightMapFilename = obj.value("heightMapFilename", ""); m_heightMapFractal = obj.value("heightMapFractal", 0); + + m_heightMapFractal = std::min(m_heightMapFractal, uint32_t(1)); } SystemBody::SystemBody(const SystemPath &path, StarSystem *system) : diff --git a/src/terrain/Terrain.cpp b/src/terrain/Terrain.cpp index 4647e5048d5..79f7afec74e 100644 --- a/src/terrain/Terrain.cpp +++ b/src/terrain/Terrain.cpp @@ -18,7 +18,7 @@ Terrain *Terrain::InstanceTerrain(const SystemBody *body) // special case for heightmaps // XXX this is terrible but will do for now until we get a unified // heightmap setup. if you add another height fractal, remember to change - // the check in CustomSystem::l_height_map + // the check in CustomSystem::l_height_map / SystemBodyData::LoadFromJson if (!body->GetHeightMapFilename().empty()) { const GeneratorInstancer choices[] = { InstanceGenerator,