[nostalgia/core] Cleanup

This commit is contained in:
Gary Talent 2023-11-14 20:23:50 -06:00
parent b12097769e
commit 98983d1229
2 changed files with 5 additions and 3 deletions

View File

@ -20,7 +20,7 @@ constexpr std::size_t ptToIdx(int x, int y, int c, int scale = 1) noexcept {
const auto colStart = static_cast<std::size_t>(colLength * static_cast<std::size_t>(x / tileWidth)); const auto colStart = static_cast<std::size_t>(colLength * static_cast<std::size_t>(x / tileWidth));
const auto rowStart = static_cast<std::size_t>(rowLength * static_cast<std::size_t>(y / tileHeight)); const auto rowStart = static_cast<std::size_t>(rowLength * static_cast<std::size_t>(y / tileHeight));
const auto colOffset = static_cast<std::size_t>(x % tileWidth); const auto colOffset = static_cast<std::size_t>(x % tileWidth);
const auto rowOffset = static_cast<std::size_t>(static_cast<std::size_t>((y % tileHeight) * tileHeight)); const auto rowOffset = static_cast<std::size_t>((y % tileHeight) * tileHeight);
return static_cast<std::size_t>(colStart + colOffset + rowStart + rowOffset); return static_cast<std::size_t>(colStart + colOffset + rowStart + rowOffset);
} }

View File

@ -45,8 +45,10 @@ struct TileSheetV2 {
ox::Vector<uint8_t> pixels; ox::Vector<uint8_t> pixels;
constexpr SubSheet() noexcept = default; constexpr SubSheet() noexcept = default;
constexpr SubSheet(ox::CRStringView pName, int pColumns, int pRows, int bpp) noexcept: constexpr SubSheet(ox::CRStringView pName, int pColumns, int pRows, int bpp) noexcept:
name(pName), columns(pColumns), rows(pRows), name(pName),
pixels(static_cast<std::size_t>(columns * rows * PixelsPerTile) / (bpp == 4 ? 2u : 1u)) { columns(pColumns),
rows(pRows),
pixels(static_cast<size_t>(columns * rows * PixelsPerTile) / (bpp == 4 ? 2u : 1u)) {
} }
}; };