1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-14 19:10:25 +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:
Dragorn421 2023-09-19 20:10:12 +02:00 committed by GitHub
parent 83a13a64c7
commit 57ce0cf8d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
130 changed files with 789 additions and 770 deletions

View file

@ -28,7 +28,7 @@ void DemoEffect_DrawLightEffect(Actor* thisx, PlayState* play);
void DemoEffect_DrawTimeWarp(Actor* thisx, PlayState* play);
void DemoEffect_DrawJewel(Actor* thisx, PlayState* play2);
void DemoEffect_Wait(DemoEffect* this, PlayState* play);
void DemoEffect_WaitForObject(DemoEffect* this, PlayState* play);
void DemoEffect_InitTimeWarp(DemoEffect* this, PlayState* play);
void DemoEffect_InitTimeWarpTimeblock(DemoEffect* this, PlayState* play);
void DemoEffect_InitCreationFireball(DemoEffect* this, PlayState* play);
@ -166,7 +166,7 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) {
DemoEffect* this = (DemoEffect*)thisx;
s32 effectType;
s32 lightEffect;
s32 objectIndex;
s32 objectSlot;
DemoEffect* crystalLight;
DemoEffect* lightRing;
@ -175,16 +175,16 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) {
osSyncPrintf(VT_FGCOL(CYAN) " no = %d\n" VT_RST, effectType);
objectIndex = sEffectTypeObjects[effectType] == OBJECT_GAMEPLAY_KEEP
? 0
: Object_GetIndex(&play->objectCtx, sEffectTypeObjects[effectType]);
objectSlot = sEffectTypeObjects[effectType] == OBJECT_GAMEPLAY_KEEP
? 0
: Object_GetSlot(&play->objectCtx, sEffectTypeObjects[effectType]);
osSyncPrintf(VT_FGCOL(CYAN) " bank_ID = %d\n" VT_RST, objectIndex);
osSyncPrintf(VT_FGCOL(CYAN) " bank_ID = %d\n" VT_RST, objectSlot);
if (objectIndex < 0) {
if (objectSlot < 0) {
ASSERT(0, "0", "../z_demo_effect.c", 723);
} else {
this->initObjectBankIndex = objectIndex;
this->requiredObjectSlot = objectSlot;
}
this->effectFlags = 0;
@ -499,7 +499,7 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) {
}
ActorShape_Init(&thisx->shape, 0.0f, NULL, 0.0f);
DemoEffect_SetupUpdate(this, DemoEffect_Wait);
DemoEffect_SetupUpdate(this, DemoEffect_WaitForObject);
}
void DemoEffect_Destroy(Actor* thisx, PlayState* play) {
@ -518,9 +518,9 @@ void DemoEffect_Destroy(Actor* thisx, PlayState* play) {
* They are copied to actor.draw and updateFunc.
* initUpdateFunc/initDrawFunc are set during initialization and are NOT executed.
*/
void DemoEffect_Wait(DemoEffect* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->initObjectBankIndex)) {
this->actor.objBankIndex = this->initObjectBankIndex;
void DemoEffect_WaitForObject(DemoEffect* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
this->actor.objectSlot = this->requiredObjectSlot;
this->actor.draw = this->initDrawFunc;
this->updateFunc = this->initUpdateFunc;

View file

@ -79,7 +79,7 @@ typedef struct {
typedef struct DemoEffect {
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelCurve skelCurve;
/* 0x016C */ u8 initObjectBankIndex;
/* 0x016C */ u8 requiredObjectSlot;
/* 0x0170 */ Gfx* jewelDisplayList;
/* 0x0174 */ Gfx* jewelHolderDisplayList;
/* 0x0178 */ u8 primXluColor[3];