From 7eb010d4a1c6a90d5040b3ec2e7d189fb387b9b2 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Sat, 24 Jun 2023 22:49:47 +1000 Subject: Pretty much working now --- source/game/StarObjectDatabase.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'source/game/StarObjectDatabase.cpp') diff --git a/source/game/StarObjectDatabase.cpp b/source/game/StarObjectDatabase.cpp index d23b206..11c45c7 100644 --- a/source/game/StarObjectDatabase.cpp +++ b/source/game/StarObjectDatabase.cpp @@ -157,10 +157,11 @@ List ObjectDatabase::parseOrientations(String const& path, orientation->config = orientationSettings; if (orientationSettings.contains("imageLayers")) { - for (auto layer : orientationSettings.get("imageLayers").iterateArray()) { + for (Json layer : orientationSettings.get("imageLayers").iterateArray()) { + if (auto image = layer.opt("image")) + layer = layer.set("image", AssetPath::relativeTo(path, image->toString())); Drawable drawable(layer.set("centered", layer.getBool("centered", false))); drawable.scale(1.0f / TilePixels); - drawable.imagePart().image = AssetPath::relativeTo(path, drawable.imagePart().image); orientation->imageLayers.append(drawable); } } else { @@ -191,7 +192,7 @@ List ObjectDatabase::parseOrientations(String const& path, auto spaceScanSpaces = Set::from(orientation->spaces); for (auto const& layer : orientation->imageLayers) { spaceScanSpaces.addAll(root.imageMetadataDatabase()->imageSpaces( - layer.imagePart().image.replaceTags(StringMap(), true, "default"), + AssetPath::join(layer.imagePart().image).replaceTags(StringMap(), true, "default"), imagePosition, orientationSettings.getDouble("spaceScan"), orientation->flipImages)); @@ -578,8 +579,9 @@ List ObjectDatabase::cursorHintDrawables(World const* world, String co auto orientation = config->orientations.at(orientationIndex); for (auto const& layer : orientation->imageLayers) { - auto drawable = layer; - drawable.imagePart().image = drawable.imagePart().image.replaceTags(StringMap(), true, "default"); + Drawable drawable = layer; + auto& image = drawable.imagePart().image; + image = AssetPath::join(image).replaceTags(StringMap(), true, "default"); if (orientation->flipImages) drawable.scale(Vec2F(-1, 1), drawable.boundBox(false).center() - drawable.position); drawables.append(move(drawable)); -- cgit v1.2.3