Skip to content

Commit

Permalink
Fix stale storedObjId [OSH token crash]
Browse files Browse the repository at this point in the history
When spawning a model, the storedObjId should always be updated even if the object is already loaded.
  • Loading branch information
HylianFreddy committed Aug 5, 2024
1 parent d3e352f commit 7946ead
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion code/source/rnd/models.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ namespace rnd {
void Model_GetObjectBankIndex(Model* model, game::act::Actor* actor, game::GlobalContext* globalCtx) {
s32 objectBankIdx = ExtendedObject_GetIndex(&globalCtx->object_context, model->itemRow->objectId);
if (objectBankIdx < 0) {
storedObjId = model->itemRow->objectId;
objectBankIdx = ExtendedObject_Spawn(&globalCtx->object_context, model->itemRow->objectId);
}
storedObjId = model->itemRow->objectId;
#if defined ENABLE_DEBUG || defined DEBUG_PRINT
rnd::util::Print("%s: storedObjId is %#04x\n", __func__, storedObjId);
#endif
model->objectBankIdx = objectBankIdx;
}

Expand Down

0 comments on commit 7946ead

Please sign in to comment.