Fix up new Object directives handling, more directives rendering improvements, fix chat bubbles and nametags only moving every 2px
This commit is contained in:
parent
f7d5ff8deb
commit
e2424b7dcf
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"nametag" : {
|
"nametag" : {
|
||||||
"showMasterNames" : true,
|
"showMasterNames" : true,
|
||||||
"fontDirectives" : "?border=2;444;4440",
|
"fontDirectives" : "?border=1;222;2220",
|
||||||
"inspectOpacityRate" : 0.15
|
"inspectOpacityRate" : 0.15,
|
||||||
|
"movementThreshold" : 0.5
|
||||||
},
|
},
|
||||||
"font" : {
|
"font" : {
|
||||||
"defaultDirectives" : "",
|
"defaultDirectives" : "",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"config" : {
|
"config" : {
|
||||||
"font" : {
|
"font" : {
|
||||||
"directives" : "?border=1;333a;3330",
|
"directives" : "?border=1;111a;1110",
|
||||||
"padding" : [1, 1] // Padding to prevent border clipping at the edges of the log canvas while keeping compat with mods that patch the canvas size
|
"padding" : [1, 1] // Padding to prevent border clipping at the edges of the log canvas while keeping compat with mods that patch the canvas size
|
||||||
},
|
},
|
||||||
"colors" : {
|
"colors" : {
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"movementThreshold" : 0.5
|
||||||
|
}
|
@ -301,7 +301,7 @@ StringList jsonToStringList(Json const& v) {
|
|||||||
|
|
||||||
Json jsonFromStringList(List<String> const& v) {
|
Json jsonFromStringList(List<String> const& v) {
|
||||||
JsonArray result;
|
JsonArray result;
|
||||||
for (auto e : v)
|
for (auto& e : v)
|
||||||
result.push_back(e);
|
result.push_back(e);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -322,7 +322,7 @@ StringSet jsonToStringSet(Json const& v) {
|
|||||||
|
|
||||||
Json jsonFromStringSet(StringSet const& v) {
|
Json jsonFromStringSet(StringSet const& v) {
|
||||||
JsonArray result;
|
JsonArray result;
|
||||||
for (auto e : v)
|
for (auto& e : v)
|
||||||
result.push_back(e);
|
result.push_back(e);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -369,6 +369,20 @@ List<Color> jsonToColorList(Json const& v) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Directives> jsonToDirectivesList(Json const& v) {
|
||||||
|
List<Directives> result;
|
||||||
|
for (auto const& entry : v.iterateArray())
|
||||||
|
result.append(move(entry.toString()));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Json jsonFromDirectivesList(List<Directives> const& v) {
|
||||||
|
JsonArray result;
|
||||||
|
for (auto& e : v)
|
||||||
|
result.push_back(e.toString());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
Json weightedChoiceFromJson(Json const& source, Json const& default_) {
|
Json weightedChoiceFromJson(Json const& source, Json const& default_) {
|
||||||
if (source.isNull())
|
if (source.isNull())
|
||||||
return default_;
|
return default_;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "StarColor.hpp"
|
#include "StarColor.hpp"
|
||||||
#include "StarSet.hpp"
|
#include "StarSet.hpp"
|
||||||
#include "StarWeightedPool.hpp"
|
#include "StarWeightedPool.hpp"
|
||||||
|
#include "StarDirectives.hpp"
|
||||||
|
|
||||||
namespace Star {
|
namespace Star {
|
||||||
|
|
||||||
@ -81,6 +82,8 @@ List<Vec2U> jsonToVec2UList(Json const& v);
|
|||||||
List<Vec2F> jsonToVec2FList(Json const& v);
|
List<Vec2F> jsonToVec2FList(Json const& v);
|
||||||
List<Vec4B> jsonToVec4BList(Json const& v);
|
List<Vec4B> jsonToVec4BList(Json const& v);
|
||||||
List<Color> jsonToColorList(Json const& v);
|
List<Color> jsonToColorList(Json const& v);
|
||||||
|
List<Directives> jsonToDirectivesList(Json const& v);
|
||||||
|
Json jsonFromDirectivesList(List<Directives> const& v);
|
||||||
|
|
||||||
Json weightedChoiceFromJson(Json const& source, Json const& default_);
|
Json weightedChoiceFromJson(Json const& source, Json const& default_);
|
||||||
|
|
||||||
|
@ -143,11 +143,10 @@ void Object::init(World* world, EntityId entityId, EntityMode mode) {
|
|||||||
|
|
||||||
m_orientationDrawablesCache.reset();
|
m_orientationDrawablesCache.reset();
|
||||||
|
|
||||||
if (isMaster()) {
|
// This is stupid and we should only have to deal with the new directives parameter, but blah blah backwards compatibility.
|
||||||
auto colorName = configValue("color", "default").toString();
|
auto colorName = configValue("color", "default").toString();
|
||||||
auto colorEnd = colorName.find('?');
|
auto colorEnd = colorName.find('?');
|
||||||
if (colorEnd != NPos) {
|
if (colorEnd != NPos) {
|
||||||
setImageKey("color", colorName);
|
|
||||||
m_colorDirectives = colorName.substr(colorEnd);
|
m_colorDirectives = colorName.substr(colorEnd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -159,6 +158,9 @@ void Object::init(World* world, EntityId entityId, EntityMode mode) {
|
|||||||
m_directives.parse(directives.toString());
|
m_directives.parse(directives.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isMaster()) {
|
||||||
|
setImageKey("color", colorName);
|
||||||
|
|
||||||
if (m_config->lightColors.contains(colorName))
|
if (m_config->lightColors.contains(colorName))
|
||||||
m_lightSourceColor.set(m_config->lightColors.get(colorName));
|
m_lightSourceColor.set(m_config->lightColors.get(colorName));
|
||||||
else
|
else
|
||||||
@ -562,7 +564,7 @@ List<Drawable> Object::cursorHintDrawables() const {
|
|||||||
if (m_direction.get() == Direction::Left)
|
if (m_direction.get() == Direction::Left)
|
||||||
placementImage += "?flipx";
|
placementImage += "?flipx";
|
||||||
Drawable imageDrawable = Drawable::makeImage(AssetPath::relativeTo(m_config->path, placementImage),
|
Drawable imageDrawable = Drawable::makeImage(AssetPath::relativeTo(m_config->path, placementImage),
|
||||||
1.0 / TilePixels, false, jsonToVec2F(configValue("placementImagePosition")) / TilePixels);
|
1.0 / TilePixels, false, jsonToVec2F(configValue("placementImagePosition", jsonFromVec2F(Vec2F()))) / TilePixels);
|
||||||
return {imageDrawable};
|
return {imageDrawable};
|
||||||
} else {
|
} else {
|
||||||
if (m_orientationIndex != NPos) {
|
if (m_orientationIndex != NPos) {
|
||||||
@ -1217,11 +1219,26 @@ List<Drawable> Object::orientationDrawables(size_t orientationIndex) const {
|
|||||||
m_orientationDrawablesCache = make_pair(orientationIndex, List<Drawable>());
|
m_orientationDrawablesCache = make_pair(orientationIndex, List<Drawable>());
|
||||||
for (auto const& layer : orientation->imageLayers) {
|
for (auto const& layer : orientation->imageLayers) {
|
||||||
Drawable drawable = layer;
|
Drawable drawable = layer;
|
||||||
|
|
||||||
auto& imagePart = drawable.imagePart();
|
auto& imagePart = drawable.imagePart();
|
||||||
imagePart.image.directives.clear();
|
imagePart.image.directives.clear();
|
||||||
imagePart.image = AssetPath::join(imagePart.image).replaceTags(m_imageKeys, true, "default");
|
String imagePath = AssetPath::join(imagePart.image);
|
||||||
|
if (m_colorDirectives && m_imageKeys.contains("color")) { // We had to leave color untouched despite separating its directives for server-side compatibility reasons, temporarily substr it in the image key
|
||||||
|
String& color = m_imageKeys.find("color")->second;
|
||||||
|
String backup = move(color);
|
||||||
|
color = backup.substr(0, backup.find('?'));
|
||||||
|
imagePart.image = imagePath.replaceTags(m_imageKeys, true, "default");
|
||||||
|
color = move(backup);
|
||||||
|
|
||||||
imagePart.image.directives = layer.imagePart().image.directives;
|
imagePart.image.directives = layer.imagePart().image.directives;
|
||||||
imagePart.addDirectives(m_colorDirectives).addDirectives(m_directives);
|
imagePart.addDirectives(m_colorDirectives);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
imagePart.image = imagePath.replaceTags(m_imageKeys, true, "default");
|
||||||
|
imagePart.image.directives = layer.imagePart().image.directives;
|
||||||
|
}
|
||||||
|
|
||||||
|
imagePart.addDirectives(m_directives);
|
||||||
|
|
||||||
if (orientation->flipImages)
|
if (orientation->flipImages)
|
||||||
drawable.scale(Vec2F(-1, 1), drawable.boundBox(false).center() - drawable.position);
|
drawable.scale(Vec2F(-1, 1), drawable.boundBox(false).center() - drawable.position);
|
||||||
|
@ -232,7 +232,7 @@ private:
|
|||||||
size_t m_orientationIndex;
|
size_t m_orientationIndex;
|
||||||
NetElementSize m_orientationIndexNetState;
|
NetElementSize m_orientationIndexNetState;
|
||||||
NetElementHashMap<String, String> m_netImageKeys;
|
NetElementHashMap<String, String> m_netImageKeys;
|
||||||
StringMap<String> m_imageKeys;
|
mutable StringMap<String> m_imageKeys;
|
||||||
|
|
||||||
void resetEmissionTimers();
|
void resetEmissionTimers();
|
||||||
List<GameTimer> m_emissionTimers;
|
List<GameTimer> m_emissionTimers;
|
||||||
|
@ -39,8 +39,9 @@ ParallaxLayer::ParallaxLayer(Json const& store) : ParallaxLayer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Json ParallaxLayer::store() const {
|
Json ParallaxLayer::store() const {
|
||||||
return JsonObject{{"textures", jsonFromStringList(textures)},
|
return JsonObject{
|
||||||
{"directives", directives},
|
{"textures", jsonFromStringList(textures)},
|
||||||
|
{"directives", directives.toString()},
|
||||||
{"parallaxValue", jsonFromVec2F(parallaxValue)},
|
{"parallaxValue", jsonFromVec2F(parallaxValue)},
|
||||||
{"repeat", jsonFromVec2B(repeat)},
|
{"repeat", jsonFromVec2B(repeat)},
|
||||||
{"tileLimitTop", jsonFromMaybe(tileLimitTop)},
|
{"tileLimitTop", jsonFromMaybe(tileLimitTop)},
|
||||||
@ -55,9 +56,18 @@ Json ParallaxLayer::store() const {
|
|||||||
{"fadePercent", fadePercent}};
|
{"fadePercent", fadePercent}};
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParallaxLayer::addImageDirectives(String const& newDirectives) {
|
void ParallaxLayer::addImageDirectives(Directives const& newDirectives) {
|
||||||
if (!newDirectives.empty())
|
if (newDirectives) { // TODO: Move to Directives +=
|
||||||
directives = String::joinWith("?", directives, newDirectives);
|
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) {
|
void ParallaxLayer::fadeToSkyColor(Color skyColor) {
|
||||||
@ -225,11 +235,11 @@ void Parallax::buildLayer(Json const& layerSettings, String const& kind) {
|
|||||||
|
|
||||||
layer.addImageDirectives(layerSettings.getString("directives", ""));
|
layer.addImageDirectives(layerSettings.getString("directives", ""));
|
||||||
if (isFoliage)
|
if (isFoliage)
|
||||||
layer.addImageDirectives(strf("hueshift=%s", m_parallaxTreeVariant->foliageHueShift));
|
layer.addImageDirectives(String(strf("hueshift=%s", m_parallaxTreeVariant->foliageHueShift)));
|
||||||
else if (isStem)
|
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))
|
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);
|
layer.fadePercent = layerSettings.getFloat("fadePercent", 0);
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "StarMaybe.hpp"
|
#include "StarMaybe.hpp"
|
||||||
#include "StarColor.hpp"
|
#include "StarColor.hpp"
|
||||||
#include "StarPlantDatabase.hpp"
|
#include "StarPlantDatabase.hpp"
|
||||||
|
#include "StarDirectives.hpp"
|
||||||
|
|
||||||
namespace Star {
|
namespace Star {
|
||||||
|
|
||||||
@ -16,11 +17,11 @@ struct ParallaxLayer {
|
|||||||
|
|
||||||
Json store() const;
|
Json store() const;
|
||||||
|
|
||||||
void addImageDirectives(String const& newDirectives);
|
void addImageDirectives(Directives const& newDirectives);
|
||||||
void fadeToSkyColor(Color skyColor);
|
void fadeToSkyColor(Color skyColor);
|
||||||
|
|
||||||
StringList textures;
|
List<String> textures;
|
||||||
String directives;
|
Directives directives;
|
||||||
float alpha;
|
float alpha;
|
||||||
Vec2F parallaxValue;
|
Vec2F parallaxValue;
|
||||||
Vec2B repeat;
|
Vec2B repeat;
|
||||||
|
@ -356,10 +356,11 @@ void WorldClient::render(WorldRenderData& renderData, unsigned bufferTiles) {
|
|||||||
playerAimInteractive = entity->entityId();
|
playerAimInteractive = entity->entityId();
|
||||||
}
|
}
|
||||||
|
|
||||||
Maybe<StringList> directives;
|
const List<Directives>* directives = nullptr;
|
||||||
if (auto worldTemplate = m_worldTemplate) {
|
if (auto& worldTemplate = m_worldTemplate) {
|
||||||
if(auto parameters = worldTemplate->worldParameters())
|
if (auto& parameters = worldTemplate->worldParameters())
|
||||||
directives = m_worldTemplate->worldParameters()->globalDirectives;
|
if (auto& globalDirectives = m_worldTemplate->worldParameters()->globalDirectives)
|
||||||
|
directives = &globalDirectives.get();
|
||||||
}
|
}
|
||||||
m_entityMap->forAllEntities([&](EntityPtr const& entity) {
|
m_entityMap->forAllEntities([&](EntityPtr const& entity) {
|
||||||
if (m_startupHiddenEntities.contains(entity->entityId()))
|
if (m_startupHiddenEntities.contains(entity->entityId()))
|
||||||
@ -1263,10 +1264,11 @@ void WorldClient::handleDamageNotifications() {
|
|||||||
|
|
||||||
auto hitParticles = particlesFromDefinition(damageKind.effects.get(material).get(effectHitType).particles, damageNotification.position);
|
auto hitParticles = particlesFromDefinition(damageKind.effects.get(material).get(effectHitType).particles, damageNotification.position);
|
||||||
|
|
||||||
Maybe<StringList> directives;
|
const List<Directives>* directives = nullptr;
|
||||||
if (auto worldTemplate = m_worldTemplate) {
|
if (auto& worldTemplate = m_worldTemplate) {
|
||||||
if(auto parameters = worldTemplate->worldParameters())
|
if (auto& parameters = worldTemplate->worldParameters())
|
||||||
directives = m_worldTemplate->worldParameters()->globalDirectives;
|
if (auto& globalDirectives = m_worldTemplate->worldParameters()->globalDirectives)
|
||||||
|
directives = &globalDirectives.get();
|
||||||
}
|
}
|
||||||
if (directives) {
|
if (directives) {
|
||||||
int directiveIndex = unsigned(damageNotification.targetEntityId) % directives->size();
|
int directiveIndex = unsigned(damageNotification.targetEntityId) % directives->size();
|
||||||
@ -1332,10 +1334,11 @@ void WorldClient::removeEntity(EntityId entityId, bool andDie) {
|
|||||||
ClientRenderCallback renderCallback;
|
ClientRenderCallback renderCallback;
|
||||||
entity->destroy(&renderCallback);
|
entity->destroy(&renderCallback);
|
||||||
|
|
||||||
Maybe<StringList> directives;
|
const List<Directives>* directives = nullptr;
|
||||||
if (auto worldTemplate = m_worldTemplate) {
|
if (auto& worldTemplate = m_worldTemplate) {
|
||||||
if(auto parameters = worldTemplate->worldParameters())
|
if (auto& parameters = worldTemplate->worldParameters())
|
||||||
directives = m_worldTemplate->worldParameters()->globalDirectives;
|
if (auto& globalDirectives = m_worldTemplate->worldParameters()->globalDirectives)
|
||||||
|
directives = &globalDirectives.get();
|
||||||
}
|
}
|
||||||
if (directives) {
|
if (directives) {
|
||||||
int directiveIndex = unsigned(entity->entityId()) % directives->size();
|
int directiveIndex = unsigned(entity->entityId()) % directives->size();
|
||||||
|
@ -47,7 +47,7 @@ VisitableWorldParameters::VisitableWorldParameters(Json const& store) {
|
|||||||
weatherPool = jsonToWeightedPool<String>(store.getArray("weatherPool", JsonArray()));
|
weatherPool = jsonToWeightedPool<String>(store.getArray("weatherPool", JsonArray()));
|
||||||
environmentStatusEffects = store.opt("environmentStatusEffects").apply(jsonToStringList).value();
|
environmentStatusEffects = store.opt("environmentStatusEffects").apply(jsonToStringList).value();
|
||||||
overrideTech = store.opt("overrideTech").apply(jsonToStringList);
|
overrideTech = store.opt("overrideTech").apply(jsonToStringList);
|
||||||
globalDirectives = store.opt("globalDirectives").apply(jsonToStringList);
|
globalDirectives = store.opt("globalDirectives").apply(jsonToDirectivesList);
|
||||||
beamUpRule = BeamUpRuleNames.getLeft(store.getString("beamUpRule", "Surface"));
|
beamUpRule = BeamUpRuleNames.getLeft(store.getString("beamUpRule", "Surface"));
|
||||||
disableDeathDrops = store.getBool("disableDeathDrops", false);
|
disableDeathDrops = store.getBool("disableDeathDrops", false);
|
||||||
terraformed = store.getBool("terraformed", false);
|
terraformed = store.getBool("terraformed", false);
|
||||||
@ -65,7 +65,7 @@ Json VisitableWorldParameters::store() const {
|
|||||||
{"weatherPool", jsonFromWeightedPool<String>(weatherPool)},
|
{"weatherPool", jsonFromWeightedPool<String>(weatherPool)},
|
||||||
{"environmentStatusEffects", jsonFromStringList(environmentStatusEffects)},
|
{"environmentStatusEffects", jsonFromStringList(environmentStatusEffects)},
|
||||||
{"overrideTech", jsonFromMaybe(overrideTech.apply(&jsonFromStringList))},
|
{"overrideTech", jsonFromMaybe(overrideTech.apply(&jsonFromStringList))},
|
||||||
{"globalDirectives", jsonFromMaybe(globalDirectives.apply(&jsonFromStringList))},
|
{"globalDirectives", jsonFromMaybe(globalDirectives.apply(&jsonFromDirectivesList))},
|
||||||
{"beamUpRule", BeamUpRuleNames.getRight(beamUpRule)},
|
{"beamUpRule", BeamUpRuleNames.getRight(beamUpRule)},
|
||||||
{"disableDeathDrops", disableDeathDrops},
|
{"disableDeathDrops", disableDeathDrops},
|
||||||
{"terraformed", terraformed},
|
{"terraformed", terraformed},
|
||||||
@ -606,7 +606,7 @@ TerrestrialWorldParametersPtr generateTerrestrialWorldParameters(String const& t
|
|||||||
parameters->airless = biomeDatabase->biomeIsAirless(primaryBiome);
|
parameters->airless = biomeDatabase->biomeIsAirless(primaryBiome);
|
||||||
parameters->environmentStatusEffects = biomeDatabase->biomeStatusEffects(primaryBiome);
|
parameters->environmentStatusEffects = biomeDatabase->biomeStatusEffects(primaryBiome);
|
||||||
parameters->overrideTech = config.opt("overrideTech").apply(jsonToStringList);
|
parameters->overrideTech = config.opt("overrideTech").apply(jsonToStringList);
|
||||||
parameters->globalDirectives = config.opt("globalDirectives").apply(jsonToStringList);
|
parameters->globalDirectives = config.opt("globalDirectives").apply(jsonToDirectivesList);
|
||||||
parameters->beamUpRule = BeamUpRuleNames.getLeft(config.getString("beamUpRule", "Surface"));
|
parameters->beamUpRule = BeamUpRuleNames.getLeft(config.getString("beamUpRule", "Surface"));
|
||||||
parameters->disableDeathDrops = config.getBool("disableDeathDrops", false);
|
parameters->disableDeathDrops = config.getBool("disableDeathDrops", false);
|
||||||
parameters->worldEdgeForceRegions = WorldEdgeForceRegionTypeNames.getLeft(config.getString("worldEdgeForceRegions", "Top"));
|
parameters->worldEdgeForceRegions = WorldEdgeForceRegionTypeNames.getLeft(config.getString("worldEdgeForceRegions", "Top"));
|
||||||
@ -658,7 +658,7 @@ AsteroidsWorldParametersPtr generateAsteroidsWorldParameters(uint64_t seed) {
|
|||||||
parameters->gravity = staticRandomFloatRange(gravityRange[0], gravityRange[1], seed, "WorldGravity");
|
parameters->gravity = staticRandomFloatRange(gravityRange[0], gravityRange[1], seed, "WorldGravity");
|
||||||
parameters->environmentStatusEffects = jsonToStringList(asteroidsConfig.getArray("environmentStatusEffects", JsonArray()));
|
parameters->environmentStatusEffects = jsonToStringList(asteroidsConfig.getArray("environmentStatusEffects", JsonArray()));
|
||||||
parameters->overrideTech = asteroidsConfig.opt("overrideTech").apply(jsonToStringList);
|
parameters->overrideTech = asteroidsConfig.opt("overrideTech").apply(jsonToStringList);
|
||||||
parameters->globalDirectives = asteroidsConfig.opt("globalDirectives").apply(jsonToStringList);
|
parameters->globalDirectives = asteroidsConfig.opt("globalDirectives").apply(jsonToDirectivesList);
|
||||||
parameters->beamUpRule = BeamUpRuleNames.getLeft(asteroidsConfig.getString("beamUpRule", "Surface"));
|
parameters->beamUpRule = BeamUpRuleNames.getLeft(asteroidsConfig.getString("beamUpRule", "Surface"));
|
||||||
parameters->disableDeathDrops = asteroidsConfig.getBool("disableDeathDrops", false);
|
parameters->disableDeathDrops = asteroidsConfig.getBool("disableDeathDrops", false);
|
||||||
parameters->worldEdgeForceRegions = WorldEdgeForceRegionTypeNames.getLeft(asteroidsConfig.getString("worldEdgeForceRegions", "TopAndBottom"));
|
parameters->worldEdgeForceRegions = WorldEdgeForceRegionTypeNames.getLeft(asteroidsConfig.getString("worldEdgeForceRegions", "TopAndBottom"));
|
||||||
@ -687,7 +687,7 @@ FloatingDungeonWorldParametersPtr generateFloatingDungeonWorldParameters(String
|
|||||||
parameters->airless = worldConfig.getBool("airless", false);
|
parameters->airless = worldConfig.getBool("airless", false);
|
||||||
parameters->environmentStatusEffects = jsonToStringList(worldConfig.getArray("environmentStatusEffects", JsonArray()));
|
parameters->environmentStatusEffects = jsonToStringList(worldConfig.getArray("environmentStatusEffects", JsonArray()));
|
||||||
parameters->overrideTech = worldConfig.opt("overrideTech").apply(jsonToStringList);
|
parameters->overrideTech = worldConfig.opt("overrideTech").apply(jsonToStringList);
|
||||||
parameters->globalDirectives = worldConfig.opt("globalDirectives").apply(jsonToStringList);
|
parameters->globalDirectives = worldConfig.opt("globalDirectives").apply(jsonToDirectivesList);
|
||||||
if (auto weatherPoolConfig = worldConfig.optArray("weatherPool"))
|
if (auto weatherPoolConfig = worldConfig.optArray("weatherPool"))
|
||||||
parameters->weatherPool = jsonToWeightedPool<String>(*weatherPoolConfig);
|
parameters->weatherPool = jsonToWeightedPool<String>(*weatherPoolConfig);
|
||||||
parameters->beamUpRule = BeamUpRuleNames.getLeft(worldConfig.getString("beamUpRule", "Surface"));
|
parameters->beamUpRule = BeamUpRuleNames.getLeft(worldConfig.getString("beamUpRule", "Surface"));
|
||||||
|
@ -58,7 +58,7 @@ struct VisitableWorldParameters {
|
|||||||
WeatherPool weatherPool;
|
WeatherPool weatherPool;
|
||||||
StringList environmentStatusEffects;
|
StringList environmentStatusEffects;
|
||||||
Maybe<StringList> overrideTech;
|
Maybe<StringList> overrideTech;
|
||||||
Maybe<StringList> globalDirectives;
|
Maybe<List<Directives>> globalDirectives;
|
||||||
BeamUpRule beamUpRule;
|
BeamUpRule beamUpRule;
|
||||||
bool disableDeathDrops;
|
bool disableDeathDrops;
|
||||||
bool terraformed;
|
bool terraformed;
|
||||||
|
@ -80,10 +80,10 @@ void EnvironmentPainter::renderStars(float pixelRatio, Vec2F const& screenSize,
|
|||||||
|
|
||||||
RectF viewRect = RectF::withSize(Vec2F(), viewSize).padded(screenBuffer);
|
RectF viewRect = RectF::withSize(Vec2F(), viewSize).padded(screenBuffer);
|
||||||
|
|
||||||
for (auto star : stars) {
|
for (auto& star : stars) {
|
||||||
Vec2F screenPos = transform.transformVec2(star.first);
|
Vec2F screenPos = transform.transformVec2(star.first);
|
||||||
if (viewRect.contains(screenPos)) {
|
if (viewRect.contains(screenPos)) {
|
||||||
size_t starFrame = (int)(sky.epochTime + star.second.second) % sky.starFrames;
|
size_t starFrame = (size_t)(sky.epochTime + star.second.second) % sky.starFrames;
|
||||||
auto const& texture = m_starTextures[star.second.first * sky.starFrames + starFrame];
|
auto const& texture = m_starTextures[star.second.first * sky.starFrames + starFrame];
|
||||||
m_renderer->render(renderTexturedRect(texture, screenPos * pixelRatio - Vec2F(texture->size()) / 2, 1.0, color, 0.0f));
|
m_renderer->render(renderTexturedRect(texture, screenPos * pixelRatio - Vec2F(texture->size()) / 2, 1.0, color, 0.0f));
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ void EnvironmentPainter::renderParallaxLayers(
|
|||||||
|
|
||||||
// Note: the "parallax space" referenced below is a grid where the scale of each cell is the size of the parallax image
|
// Note: the "parallax space" referenced below is a grid where the scale of each cell is the size of the parallax image
|
||||||
|
|
||||||
for (auto layer : layers) {
|
for (auto& layer : layers) {
|
||||||
if (layer.alpha == 0)
|
if (layer.alpha == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -237,8 +237,10 @@ void EnvironmentPainter::renderParallaxLayers(
|
|||||||
Vec2F parallaxValue = layer.parallaxValue;
|
Vec2F parallaxValue = layer.parallaxValue;
|
||||||
Vec2B parallaxRepeat = layer.repeat;
|
Vec2B parallaxRepeat = layer.repeat;
|
||||||
Vec2F parallaxOrigin = {0.0f, layer.verticalOrigin};
|
Vec2F parallaxOrigin = {0.0f, layer.verticalOrigin};
|
||||||
Vec2F parallaxSize =
|
|
||||||
Vec2F(m_textureGroup->loadTexture(String::joinWith("?", layer.textures.first(), layer.directives))->size());
|
AssetPath first = layer.textures.first();
|
||||||
|
first.directives += layer.directives;
|
||||||
|
Vec2F parallaxSize = Vec2F(m_textureGroup->loadTexture(first)->size());
|
||||||
Vec2F parallaxPixels = parallaxSize * camera.pixelRatio();
|
Vec2F parallaxPixels = parallaxSize * camera.pixelRatio();
|
||||||
|
|
||||||
// texture offset in *screen pixel space*
|
// texture offset in *screen pixel space*
|
||||||
@ -300,8 +302,10 @@ void EnvironmentPainter::renderParallaxLayers(
|
|||||||
if (tileLimitBottom != bottom && y < tileLimitBottom)
|
if (tileLimitBottom != bottom && y < tileLimitBottom)
|
||||||
anchorPoint[1] += fpart(tileLimitBottom) * parallaxPixels[1];
|
anchorPoint[1] += fpart(tileLimitBottom) * parallaxPixels[1];
|
||||||
|
|
||||||
for (String const& textureImage : layer.textures) {
|
for (auto const& textureImage : layer.textures) {
|
||||||
if (auto texture = m_textureGroup->tryTexture(String::joinWith("?", textureImage, layer.directives))) {
|
AssetPath withDirectives = textureImage;
|
||||||
|
withDirectives.directives += layer.directives;
|
||||||
|
if (auto texture = m_textureGroup->tryTexture(withDirectives)) {
|
||||||
RectF drawRect = RectF::withSize(anchorPoint, subImage.size() * camera.pixelRatio());
|
RectF drawRect = RectF::withSize(anchorPoint, subImage.size() * camera.pixelRatio());
|
||||||
m_renderer->render(RenderQuad{move(texture),
|
m_renderer->render(RenderQuad{move(texture),
|
||||||
{{drawRect.xMin(), drawRect.yMin()}, {subImage.xMin(), subImage.yMin()}, drawColor, lightMapMultiplier},
|
{{drawRect.xMin(), drawRect.yMin()}, {subImage.xMin(), subImage.yMin()}, drawColor, lightMapMultiplier},
|
||||||
|
@ -203,6 +203,8 @@ void WorldPainter::renderParticles(WorldRenderData& renderData, Particle::Layer
|
|||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
m_textPainter->setFontSize(size);
|
m_textPainter->setFontSize(size);
|
||||||
m_textPainter->setFontColor(particle.color.toRgba());
|
m_textPainter->setFontColor(particle.color.toRgba());
|
||||||
|
m_textPainter->setProcessingDirectives("");
|
||||||
|
m_textPainter->setFont("");
|
||||||
m_textPainter->renderText(particle.string, {position, HorizontalAnchor::HMidAnchor, VerticalAnchor::VMidAnchor});
|
m_textPainter->renderText(particle.string, {position, HorizontalAnchor::HMidAnchor, VerticalAnchor::VMidAnchor});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ private:
|
|||||||
TilePainterPtr m_tilePainter;
|
TilePainterPtr m_tilePainter;
|
||||||
|
|
||||||
Json m_highlightConfig;
|
Json m_highlightConfig;
|
||||||
Map<EntityHighlightEffectType, pair<String, String>> m_highlightDirectives;
|
Map<EntityHighlightEffectType, pair<Directives, Directives>> m_highlightDirectives;
|
||||||
|
|
||||||
Vec2F m_entityBarOffset;
|
Vec2F m_entityBarOffset;
|
||||||
Vec2F m_entityBarSpacing;
|
Vec2F m_entityBarSpacing;
|
||||||
|
Loading…
Reference in New Issue
Block a user