[jasper/world] Move obj states initialization to initial loading of resources
All checks were successful
Build / build (push) Successful in 3m54s
All checks were successful
Build / build (push) Successful in 3m54s
This commit is contained in:
parent
2823db63ac
commit
c8217e5ab0
@ -23,6 +23,18 @@ ox::Error World::setupDisplay() noexcept {
|
|||||||
if (m_worldStatic.objTileRefSets.empty()) {
|
if (m_worldStatic.objTileRefSets.empty()) {
|
||||||
return ox::Error{1, "WorldStatic must have at least one ref set"};
|
return ox::Error{1, "WorldStatic must have at least one ref set"};
|
||||||
}
|
}
|
||||||
|
m_currentTicks = ticksMs(turbineCtx(m_nctx));
|
||||||
|
m_objStates.clear();
|
||||||
|
for (uint16_t objIdx{}; auto &obj : m_worldStatic.objTileRefSets) {
|
||||||
|
if (isUpdatingObj(obj)) {
|
||||||
|
m_objStates.emplace_back(ObjState{
|
||||||
|
.objIdx = objIdx,
|
||||||
|
.frame = 0,
|
||||||
|
.nextUpdateTime = m_currentTicks + obj.intervalMs,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
++objIdx;
|
||||||
|
}
|
||||||
auto &kctx = keelCtx(m_nctx);
|
auto &kctx = keelCtx(m_nctx);
|
||||||
if (m_tilesheets.empty()) {
|
if (m_tilesheets.empty()) {
|
||||||
for (auto const&tsAddr : m_worldStatic.tilesheets) {
|
for (auto const&tsAddr : m_worldStatic.tilesheets) {
|
||||||
@ -62,7 +74,6 @@ ox::Result<int> World::update() noexcept {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void World::setupTiles() noexcept {
|
void World::setupTiles() noexcept {
|
||||||
m_objStates.clear();
|
|
||||||
m_currentTicks = ticksMs(turbineCtx(m_nctx));
|
m_currentTicks = ticksMs(turbineCtx(m_nctx));
|
||||||
ncore::setBgStatus(m_nctx, 0); // disable all backgrounds
|
ncore::setBgStatus(m_nctx, 0); // disable all backgrounds
|
||||||
for (auto layerNo = 0u; auto const&layer : m_worldStatic.map) {
|
for (auto layerNo = 0u; auto const&layer : m_worldStatic.map) {
|
||||||
@ -95,13 +106,6 @@ void World::setupTile(
|
|||||||
.tileIdx = static_cast<uint_t>(obj.cbbIdx + 3),
|
.tileIdx = static_cast<uint_t>(obj.cbbIdx + 3),
|
||||||
.palBank = obj.palBank,
|
.palBank = obj.palBank,
|
||||||
});
|
});
|
||||||
if (isUpdatingObj(obj)) {
|
|
||||||
m_objStates.emplace_back(ObjState{
|
|
||||||
.objIdx = t.objIdxRefSet,
|
|
||||||
.frame = 0,
|
|
||||||
.nextUpdateTime = m_currentTicks + obj.intervalMs,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ox::Result<turbine::TimeMs> World::updateObj(ObjState &state) noexcept {
|
ox::Result<turbine::TimeMs> World::updateObj(ObjState &state) noexcept {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user