From 536e4540cb5dbec59546b858ca4be01c0ddff3a9 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Fri, 29 Dec 2023 00:39:57 -0600 Subject: [PATCH] [jasper] Fix build --- .../world/include/jasper/world/world.hpp | 1 + .../include/jasper/world/worldobjectset.hpp | 41 +++++++++++++++++++ .../include/jasper/world/worldstatic.hpp | 4 +- .../modules/world/src/keel/typeconv.cpp | 2 +- 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 src/jasper/modules/world/include/jasper/world/worldobjectset.hpp diff --git a/src/jasper/modules/world/include/jasper/world/world.hpp b/src/jasper/modules/world/include/jasper/world/world.hpp index d562f47..2fd015d 100644 --- a/src/jasper/modules/world/include/jasper/world/world.hpp +++ b/src/jasper/modules/world/include/jasper/world/world.hpp @@ -8,6 +8,7 @@ #include "consts.hpp" #include "prefab.hpp" +#include "worldobjectset.hpp" #include "worldstatic.hpp" namespace jasper::world { diff --git a/src/jasper/modules/world/include/jasper/world/worldobjectset.hpp b/src/jasper/modules/world/include/jasper/world/worldobjectset.hpp new file mode 100644 index 0000000..c50343b --- /dev/null +++ b/src/jasper/modules/world/include/jasper/world/worldobjectset.hpp @@ -0,0 +1,41 @@ +/* + * Copyright 2023 Gary Talent (gary@drinkingtea.net). All rights reserved. + */ + +#pragma once + +#include + +#include "consts.hpp" +#include "prefab.hpp" +#include "worldstatic.hpp" + +namespace jasper::world { + +namespace ncore = nostalgia::core; + +struct WorldObject { + static constexpr auto TypeName = "net.drinkingtea.nostalgia.world.WorldObject"; + static constexpr auto TypeVersion = 1; + static constexpr auto Preloadable = true; + ox::FileAddress tilesheet; + ncore::SubSheetId subSheetId; +}; + +oxModelBegin(WorldObject) + oxModelField(tilesheet) + oxModelField(subsheetId) +oxModelEnd() + +struct WorldObjectSet { + static constexpr auto TypeName = "net.drinkingtea.nostalgia.world.WorldObjectSet"; + static constexpr auto TypeVersion = 1; + static constexpr auto Preloadable = true; + ox::Vector objects; +}; + +oxModelBegin(WorldObjectSet) + oxModelField(objects) +oxModelEnd() + +} diff --git a/src/jasper/modules/world/include/jasper/world/worldstatic.hpp b/src/jasper/modules/world/include/jasper/world/worldstatic.hpp index 63fa79a..b14b4b2 100644 --- a/src/jasper/modules/world/include/jasper/world/worldstatic.hpp +++ b/src/jasper/modules/world/include/jasper/world/worldstatic.hpp @@ -44,7 +44,7 @@ struct TileDoc { if (subsheetId > -1) { return subsheetId; } - return ts.getIdFor(subsheetPath); + return getIdFor(ts, subsheetPath); } [[nodiscard]] @@ -52,7 +52,7 @@ struct TileDoc { ncore::TileSheet const&ts) const noexcept { // prefer the already present path if (!subsheetPath.len()) { - return ts.getNameFor(subsheetId); + return getNameFor(ts, subsheetId); } return ox::StringView(subsheetPath); } diff --git a/src/jasper/modules/world/src/keel/typeconv.cpp b/src/jasper/modules/world/src/keel/typeconv.cpp index c81cfa5..b081e8d 100644 --- a/src/jasper/modules/world/src/keel/typeconv.cpp +++ b/src/jasper/modules/world/src/keel/typeconv.cpp @@ -56,7 +56,7 @@ ox::Error WorldDocToWorldStaticConverter::convert( auto dstTile = dstLayer.tile(tileIdx); dstTile.tileType = srcTile.type; oxRequire(path, srcTile.getSubsheetPath(*ts)); - oxRequire(mapIdx, ts->getTileOffset(path)); + oxRequire(mapIdx, getTileOffset(*ts, path)); dstTile.tileMapIdx = static_cast(mapIdx); setLayerAttachments(layerIdx, srcTile, dstTile); ++tileIdx;