mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-19 21:41:59 +00:00
Doc/Cleanup pass on object handling (#1227)
* `Object_InitBank` -> `Object_InitContext` * Add and use `OBJECT_SPACE_SIZE_BASE` * Remove `OBJECT_EXCHANGE_BANK_MAX` -> use `ARRAY_COUNT()` instead * "object status" -> "object load entry" * Misc. cleanup/renames * Partial docs and way too much batch renaming and cleanup for a single commit * ctrl shift h * format * format clang-11.1 * fix regressions * Improve a `@bug` comment * Move `OBJECT_SPACE_SIZE_BASE` from header to near `Object_InitContext` * "objectID" -> "objectId" * Revert iterator index to `i` in `Actor_KillActorsWithUnloadedObject` * "object load entry index" -> "object entry" * `Object_UpdateLoadEntries` -> `Object_UpdateEntries` * Run format.sh * "object entry" -> "object slot" (except internal usage) * Proper `Object_SpawnPersistent` doc Co-authored-by: fig02 <fig02srl@gmail.com> * fixup one comment "object bank index" -> "object slot" * Amend `Object_SpawnPersistent` comment to mention running out of free slots * `Actor_KillActorsWithUnloadedObject` -> `Actor_KillAllWithMissingObject` * Remove useless mention of what uses `Object_SpawnPersistent` * Fix mistake on `Object_SpawnPersistent` doing sync dma, not async * run formatter * `Object_InitContext` -> `Object_Init` * `waitObjectSlot` -> `requiredObjectSlot` * `Object_Init` -> `func_80097DD8` * one objectIndex -> objectSlot * Remove `OBJECT_SPACE_SIZE_BASE` * light fix on the merge (rm OBJECT_EXCHANGE_BANK_MAX) * `func_80097DD8` -> `Object_InitContext` --------- Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
parent
83a13a64c7
commit
57ce0cf8d9
130 changed files with 789 additions and 770 deletions
|
@ -314,22 +314,22 @@ void DemoEc_DrawSkeletonCustomColor(DemoEc* this, PlayState* play, Gfx* arg2, Gf
|
|||
|
||||
void DemoEc_UseDrawObject(DemoEc* this, PlayState* play) {
|
||||
s32 pad[2];
|
||||
s32 drawObjBankIndex = this->drawObjBankIndex;
|
||||
s32 drawObjectSlot = this->drawObjectSlot;
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_demo_ec.c", 662);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[drawObjBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[drawObjBankIndex].segment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[drawObjectSlot].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[drawObjectSlot].segment);
|
||||
if (!play) {}
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_demo_ec.c", 670);
|
||||
}
|
||||
|
||||
void DemoEc_UseAnimationObject(DemoEc* this, PlayState* play) {
|
||||
s32 animObjBankIndex = this->animObjBankIndex;
|
||||
s32 animObjectSlot = this->animObjectSlot;
|
||||
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animObjBankIndex].segment);
|
||||
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment);
|
||||
}
|
||||
|
||||
CsCmdActorCue* DemoEc_GetCue(PlayState* play, s32 cueChannel) {
|
||||
|
@ -1261,26 +1261,27 @@ void DemoEc_InitCommon(DemoEc* this, PlayState* play) {
|
|||
s32 type;
|
||||
s16 pad2;
|
||||
s16 sp28;
|
||||
s32 primaryBankIndex;
|
||||
s32 secondaryBankIndex;
|
||||
s32 primaryObjectSlot;
|
||||
s32 secondaryObjectSlot;
|
||||
|
||||
type = this->actor.params;
|
||||
primary = sDrawObjects[type];
|
||||
sp28 = sAnimationObjects[type];
|
||||
primaryBankIndex = Object_GetIndex(&play->objectCtx, primary);
|
||||
secondaryBankIndex = Object_GetIndex(&play->objectCtx, sp28);
|
||||
primaryObjectSlot = Object_GetSlot(&play->objectCtx, primary);
|
||||
secondaryObjectSlot = Object_GetSlot(&play->objectCtx, sp28);
|
||||
|
||||
if ((secondaryBankIndex < 0) || (primaryBankIndex < 0)) {
|
||||
if ((secondaryObjectSlot < 0) || (primaryObjectSlot < 0)) {
|
||||
// "Demo_Ec_main_bank: Bank unreadable arg_data = %d!"
|
||||
osSyncPrintf(VT_FGCOL(RED) "Demo_Ec_main_bank:バンクを読めない arg_data = %d!\n" VT_RST, type);
|
||||
Actor_Kill(&this->actor);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Object_IsLoaded(&play->objectCtx, primaryBankIndex) && Object_IsLoaded(&play->objectCtx, secondaryBankIndex)) {
|
||||
if (Object_IsLoaded(&play->objectCtx, primaryObjectSlot) &&
|
||||
Object_IsLoaded(&play->objectCtx, secondaryObjectSlot)) {
|
||||
|
||||
this->drawObjBankIndex = primaryBankIndex;
|
||||
this->animObjBankIndex = secondaryBankIndex;
|
||||
this->drawObjectSlot = primaryObjectSlot;
|
||||
this->animObjectSlot = secondaryObjectSlot;
|
||||
|
||||
DemoEc_InitNpc(this, play);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ typedef struct DemoEc {
|
|||
/* 0x0194 */ s32 updateMode;
|
||||
/* 0x0198 */ s32 drawConfig;
|
||||
/* 0x019C */ s32 cueId;
|
||||
/* 0x01A0 */ s32 drawObjBankIndex;
|
||||
/* 0x01A4 */ s32 animObjBankIndex;
|
||||
/* 0x01A0 */ s32 drawObjectSlot;
|
||||
/* 0x01A4 */ s32 animObjectSlot;
|
||||
} DemoEc; // size = 0x01A8
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue