diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-25 16:10:57 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-25 16:10:57 +1000 |
commit | e2424b7dcf60d18b277b092eb7f2a947fff27415 (patch) | |
tree | 1887d34419f16a6720405182d16829a97463e6df /source/game/StarParallax.cpp | |
parent | f7d5ff8debbbc1d80e8cd892d1184cb5aeb5bca4 (diff) |
Fix up new Object directives handling, more directives rendering improvements, fix chat bubbles and nametags only moving every 2px
Diffstat (limited to 'source/game/StarParallax.cpp')
-rw-r--r-- | source/game/StarParallax.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/source/game/StarParallax.cpp b/source/game/StarParallax.cpp index b676e24..a950086 100644 --- a/source/game/StarParallax.cpp +++ b/source/game/StarParallax.cpp @@ -39,8 +39,9 @@ ParallaxLayer::ParallaxLayer(Json const& store) : ParallaxLayer() { } Json ParallaxLayer::store() const { - return JsonObject{{"textures", jsonFromStringList(textures)}, - {"directives", directives}, + return JsonObject{ + {"textures", jsonFromStringList(textures)}, + {"directives", directives.toString()}, {"parallaxValue", jsonFromVec2F(parallaxValue)}, {"repeat", jsonFromVec2B(repeat)}, {"tileLimitTop", jsonFromMaybe(tileLimitTop)}, @@ -55,9 +56,18 @@ Json ParallaxLayer::store() const { {"fadePercent", fadePercent}}; } -void ParallaxLayer::addImageDirectives(String const& newDirectives) { - if (!newDirectives.empty()) - directives = String::joinWith("?", directives, newDirectives); +void ParallaxLayer::addImageDirectives(Directives const& newDirectives) { + if (newDirectives) { // TODO: Move to Directives += + if (directives) { + List<Directives::Entry> newEntries = *directives.entries; + for (auto const& entry : *newDirectives.entries) + newEntries.push_back(entry); + + directives = move(newEntries); + } + else + directives = newDirectives; + } } void ParallaxLayer::fadeToSkyColor(Color skyColor) { @@ -225,11 +235,11 @@ void Parallax::buildLayer(Json const& layerSettings, String const& kind) { layer.addImageDirectives(layerSettings.getString("directives", "")); if (isFoliage) - layer.addImageDirectives(strf("hueshift=%s", m_parallaxTreeVariant->foliageHueShift)); + layer.addImageDirectives(String(strf("hueshift=%s", m_parallaxTreeVariant->foliageHueShift))); else if (isStem) - layer.addImageDirectives(strf("hueshift=%s", m_parallaxTreeVariant->stemHueShift)); + layer.addImageDirectives(String(strf("hueshift=%s", m_parallaxTreeVariant->stemHueShift))); else if (!layerSettings.getBool("nohueshift", false)) - layer.addImageDirectives(strf("hueshift=%s", m_hueShift)); + layer.addImageDirectives(String(strf("hueshift=%s", m_hueShift))); layer.fadePercent = layerSettings.getFloat("fadePercent", 0); |