[jasper/world] Cleanup types, add consts
All checks were successful
Build / build (push) Successful in 3m45s
All checks were successful
Build / build (push) Successful in 3m45s
This commit is contained in:
parent
9187c07551
commit
1d185e2036
@ -16,37 +16,37 @@ namespace jasper::world {
|
|||||||
|
|
||||||
namespace ncore = nostalgia::core;
|
namespace ncore = nostalgia::core;
|
||||||
|
|
||||||
constexpr void setTopEdge(uint8_t &layerAttachments, unsigned const val) noexcept {
|
constexpr void setTopEdge(uint8_t &layerAttachments, uint8_t const val) noexcept {
|
||||||
auto const val8 = static_cast<uint8_t>(val);
|
auto const val8 = static_cast<uint8_t>(val);
|
||||||
layerAttachments = (layerAttachments & 0b11111100) | val8;
|
layerAttachments = (layerAttachments & 0b11111100) | val8;
|
||||||
}
|
}
|
||||||
constexpr void setBottomEdge(uint8_t &layerAttachments, unsigned const val) noexcept {
|
constexpr void setBottomEdge(uint8_t &layerAttachments, uint8_t const val) noexcept {
|
||||||
auto const val8 = static_cast<uint8_t>(val);
|
auto const val8 = static_cast<uint8_t>(val);
|
||||||
layerAttachments = (layerAttachments & 0b11110011) | static_cast<uint8_t>(val8 << 2);
|
layerAttachments = (layerAttachments & 0b11110011) | (val8 << 2);
|
||||||
}
|
}
|
||||||
constexpr void setLeftEdge(uint8_t &layerAttachments, unsigned const val) noexcept {
|
constexpr void setLeftEdge(uint8_t &layerAttachments, uint8_t const val) noexcept {
|
||||||
auto const val8 = static_cast<uint8_t>(val);
|
auto const val8 = static_cast<uint8_t>(val);
|
||||||
layerAttachments = (layerAttachments & 0b11001111) | static_cast<uint8_t>(val8 << 4);
|
layerAttachments = (layerAttachments & 0b11001111) | (val8 << 4);
|
||||||
}
|
}
|
||||||
constexpr void setRightEdge(uint8_t &layerAttachments, unsigned const val) noexcept {
|
constexpr void setRightEdge(uint8_t &layerAttachments, uint8_t const val) noexcept {
|
||||||
auto const val8 = static_cast<uint8_t>(val);
|
auto const val8 = static_cast<uint8_t>(val);
|
||||||
layerAttachments = (layerAttachments & 0b00111111) | static_cast<uint8_t>(val8 << 6);
|
layerAttachments = (layerAttachments & 0b00111111) | (val8 << 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr unsigned topEdge(uint8_t layerAttachments) noexcept {
|
constexpr uint8_t topEdge(uint8_t const layerAttachments) noexcept {
|
||||||
return layerAttachments & 0b11;
|
return layerAttachments & 0b11;
|
||||||
}
|
}
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr unsigned bottomEdge(uint8_t layerAttachments) noexcept {
|
constexpr uint8_t bottomEdge(uint8_t const layerAttachments) noexcept {
|
||||||
return (layerAttachments >> 2) & 0b11;
|
return (layerAttachments >> 2) & 0b11;
|
||||||
}
|
}
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr unsigned leftEdge(uint8_t layerAttachments) noexcept {
|
constexpr uint8_t leftEdge(uint8_t const layerAttachments) noexcept {
|
||||||
return (layerAttachments >> 4) & 0b11;
|
return (layerAttachments >> 4) & 0b11;
|
||||||
}
|
}
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr unsigned rightEdge(uint8_t layerAttachments) noexcept {
|
constexpr uint8_t rightEdge(uint8_t const layerAttachments) noexcept {
|
||||||
return (layerAttachments >> 6) & 0b11;
|
return (layerAttachments >> 6) & 0b11;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,6 +90,7 @@ struct ObjTileRefSet {
|
|||||||
uint8_t tilesheetId{};
|
uint8_t tilesheetId{};
|
||||||
uint8_t tileCnt{};
|
uint8_t tileCnt{};
|
||||||
// each successive frame will use tileIdx[i] + tileCnt * frameNo for the tileIdx
|
// each successive frame will use tileIdx[i] + tileCnt * frameNo for the tileIdx
|
||||||
|
uint8_t frameSets{};
|
||||||
uint8_t frames{};
|
uint8_t frames{};
|
||||||
uint16_t intervalMs{};
|
uint16_t intervalMs{};
|
||||||
};
|
};
|
||||||
@ -101,6 +102,7 @@ OX_MODEL_BEGIN(ObjTileRefSet)
|
|||||||
OX_MODEL_FIELD(palBank)
|
OX_MODEL_FIELD(palBank)
|
||||||
OX_MODEL_FIELD(tilesheetId)
|
OX_MODEL_FIELD(tilesheetId)
|
||||||
OX_MODEL_FIELD(tileCnt)
|
OX_MODEL_FIELD(tileCnt)
|
||||||
|
OX_MODEL_FIELD(frameSets)
|
||||||
OX_MODEL_FIELD(frames)
|
OX_MODEL_FIELD(frames)
|
||||||
OX_MODEL_FIELD(intervalMs)
|
OX_MODEL_FIELD(intervalMs)
|
||||||
OX_MODEL_END()
|
OX_MODEL_END()
|
||||||
@ -108,12 +110,13 @@ OX_MODEL_END()
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
constexpr bool operator==(ObjTileRefSet const&a, ObjTileRefSet const&b) noexcept {
|
constexpr bool operator==(ObjTileRefSet const&a, ObjTileRefSet const&b) noexcept {
|
||||||
return
|
return
|
||||||
a.palBank == b.palBank &&
|
|
||||||
a.tilesheetIdx == b.tilesheetIdx &&
|
a.tilesheetIdx == b.tilesheetIdx &&
|
||||||
a.cbbIdx == b.cbbIdx &&
|
a.cbbIdx == b.cbbIdx &&
|
||||||
a.cbb == b.cbb &&
|
a.cbb == b.cbb &&
|
||||||
|
a.palBank == b.palBank &&
|
||||||
a.tilesheetId == b.tilesheetId &&
|
a.tilesheetId == b.tilesheetId &&
|
||||||
a.tileCnt == b.tileCnt &&
|
a.tileCnt == b.tileCnt &&
|
||||||
|
a.frameSets == b.frameSets &&
|
||||||
a.frames == b.frames &&
|
a.frames == b.frames &&
|
||||||
a.intervalMs == b.intervalMs;
|
a.intervalMs == b.intervalMs;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user