[nostalgia/scene] Cleanup

This commit is contained in:
Gary Talent 2023-06-18 20:28:08 -05:00
parent de45e7a075
commit bac3eed958
2 changed files with 27 additions and 17 deletions

View File

@ -17,6 +17,9 @@ class Scene {
ox::Error setupDisplay(core::Context *ctx) const noexcept;
private:
void setupLayer(core::Context*, const ox::Vector<uint16_t> &layer, unsigned layerNo) const noexcept;
};
}

View File

@ -22,13 +22,23 @@ ox::Error Scene::setupDisplay(core::Context *ctx) const noexcept {
// disable all backgrounds
core::setBgStatus(ctx, 0);
for (auto layerNo = 0u; const auto &layer : m_sceneStatic.tileMapIdx) {
setupLayer(ctx, layer, layerNo);
++layerNo;
}
return {};
}
void Scene::setupLayer(
core::Context *ctx,
const ox::Vector<uint16_t> &layer,
unsigned layerNo) const noexcept {
core::setBgStatus(ctx, layerNo, true);
core::setBgCbb(ctx, layerNo, 0);
auto x = 0;
auto y = 0;
auto width = m_sceneStatic.rows[layerNo];
const auto width = m_sceneStatic.rows[layerNo];
for (const auto &tile : layer) {
auto tile8 = static_cast<uint8_t >(tile);
const auto tile8 = static_cast<uint8_t>(tile);
core::setTile(ctx, layerNo, x, y, tile8);
core::setTile(ctx, layerNo, x + 1, y, tile8 + 1);
core::setTile(ctx, layerNo, x, y + 1, tile8 + 2);
@ -39,9 +49,6 @@ ox::Error Scene::setupDisplay(core::Context *ctx) const noexcept {
y += 2;
}
}
++layerNo;
}
return {};
}
}