1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-21 06:21:16 +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

@ -54,7 +54,7 @@ static ColliderCylinderInit sCylinderInit = {
{ 13, 13, 0, { 0 } },
};
static s16 sObjectIDs[] = {
static s16 sObjectIds[] = {
OBJECT_DEKUNUTS, OBJECT_HINTNUTS, OBJECT_SHOPNUTS, OBJECT_DNS, OBJECT_DNK,
};
@ -69,9 +69,9 @@ void EnNutsball_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 400.0f, ActorShadow_DrawCircle, 13.0f);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIDs[this->actor.params]);
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[this->actor.params]);
if (this->objBankIndex < 0) {
if (this->requiredObjectSlot < 0) {
Actor_Kill(&this->actor);
} else {
this->actionFunc = func_80ABBB34;
@ -85,8 +85,8 @@ void EnNutsball_Destroy(Actor* thisx, PlayState* play) {
}
void func_80ABBB34(EnNutsball* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
this->actor.objBankIndex = this->objBankIndex;
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
this->actor.objectSlot = this->requiredObjectSlot;
this->actor.draw = EnNutsball_Draw;
this->actor.shape.rot.y = 0;
this->timer = 30;

View file

@ -11,7 +11,7 @@ typedef void (*EnNutsballActionFunc)(struct EnNutsball*, PlayState*);
typedef struct EnNutsball {
/* 0x0000 */ Actor actor;
/* 0x014C */ EnNutsballActionFunc actionFunc;
/* 0x0150 */ s8 objBankIndex;
/* 0x0150 */ s8 requiredObjectSlot;
/* 0x0152 */ s16 timer;
/* 0x0154 */ ColliderCylinder collider;
} EnNutsball; // size = 0x01A0