diff options
| author | Kenix3 <kenixwhisperwind@gmail.com> | 2020-05-27 10:10:03 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-27 10:10:03 -0400 |
| commit | c350eaeda5e76b22e1aa331dab73da98b0a89230 (patch) | |
| tree | 142c856fb248db447348a03fe6fd5422a6443f76 /src/code | |
| parent | 235b0b8e0b53ebe1962a33291f02c7b9853d1de3 (diff) | |
Scene Header Command 0x0B is now OK (#147)
* Scene Header Command 0x0B is now OK
* Delete func_8009899C.s
* Updates assert check on func_8009899C
Per Roman's suggestion of placing the __assert outside of the if (1)
* Updates func_8009899C to have array access rather than pointer math
* Removes deprecated comment in func_8009899C
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_scene.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/code/z_scene.c b/src/code/z_scene.c index 23ad42dbd..b790f2e87 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -279,59 +279,57 @@ void func_80098958(GlobalContext* globalCtx, SceneCmd* cmd) { } // Scene Command 0x0B: Object List -#ifdef NON_MATCHING -// this function still needs some work but it should be functionally equivalent void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd) { s32 i, j, k; - s16* objectEntry; ObjectStatus* status; ObjectStatus* status2; - ObjectStatus* status3; + ObjectStatus* firstStatus; + s16* objectEntry; void* nextPtr; objectEntry = SEGMENTED_TO_VIRTUAL(cmd->objectList.segment); - status2 = &globalCtx->objectCtx.status[globalCtx->objectCtx.unk_09]; k = 0; - status = status2; i = globalCtx->objectCtx.unk_09; + firstStatus = &globalCtx->objectCtx.status[0]; + status = &globalCtx->objectCtx.status[i]; + while (i < globalCtx->objectCtx.num) { if (status->id != *objectEntry) { - status3 = status2; + status2 = &globalCtx->objectCtx.status[i]; for (j = i; j < globalCtx->objectCtx.num; j++) { - status3->id = 0; - status3++; + status2->id = 0; + status2++; } globalCtx->objectCtx.num = i; func_80031A28(globalCtx, &globalCtx->actorCtx); - } else { - i++; - status++; - k++; - objectEntry++; - status2++; + + continue; } + + i++; + k++; + objectEntry++; + status++; } - + if (cmd->objectList.num > OBJECT_EXCHANGE_BANK_MAX) { __assert("scene_info->object_bank.num <= OBJECT_EXCHANGE_BANK_MAX", "../z_scene.c", 705); } + + if (1) {} while (k < cmd->objectList.num) { nextPtr = func_800982FC(&globalCtx->objectCtx, i, *objectEntry); if (i < OBJECT_EXCHANGE_BANK_MAX - 1) { - globalCtx->objectCtx.status[i + 1].segment = nextPtr; + firstStatus[i + 1].segment = nextPtr; } + i++; k++; objectEntry++; - status++; } - globalCtx->objectCtx.num = k; + globalCtx->objectCtx.num = i; } -#else -void func_8009899C(GlobalContext* globalCtx, SceneCmd* cmd); -#pragma GLOBAL_ASM("asm/non_matchings/code/z_scene/func_8009899C.s") -#endif // Scene Command 0x0C: Light List void func_80098B74(GlobalContext* globalCtx, SceneCmd* cmd) { |
