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

@ -458,7 +458,7 @@ void Enemy_StartFinishingBlow(PlayState* play, Actor* actor);
s16 func_80032CB4(s16* arg0, s16 arg1, s16 arg2, s16 arg3);
void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play);
void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList,
s16 objectId);
s16 objectSlot);
s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s16 type);
void Actor_SpawnFloorDustRing(PlayState* play, Actor* actor, Vec3f* posXZ, f32 radius, s32 amountMinusOne,
f32 randAccelWeight, s16 scale, s16 scaleStep, u8 useLighting);
@ -1106,11 +1106,10 @@ void Sample_Init(GameState* thisx);
void Inventory_ChangeEquipment(s16 equipment, u16 value);
u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment);
void Inventory_ChangeUpgrade(s16 upgrade, s16 value);
s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId);
void Object_InitBank(PlayState* play, ObjectContext* objectCtx);
void Object_UpdateBank(ObjectContext* objectCtx);
s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId);
s32 Object_IsLoaded(ObjectContext* objectCtx, s32 bankIndex);
void Object_InitContext(PlayState* play, ObjectContext* objectCtx);
void Object_UpdateEntries(ObjectContext* objectCtx);
s32 Object_GetSlot(ObjectContext* objectCtx, s16 objectId);
s32 Object_IsLoaded(ObjectContext* objectCtx, s32 slot);
void func_800981B8(ObjectContext* objectCtx);
s32 Scene_ExecuteCommands(PlayState* play, SceneCmd* sceneCmd);
void TransitionActor_InitContext(GameState* state, TransitionActorContext* transiActorCtx);

View File

@ -199,7 +199,7 @@ typedef struct Actor {
/* 0x004 */ u32 flags; // Flags used for various purposes
/* 0x008 */ PosRot home; // Initial position/rotation when spawned. Can be used for other purposes
/* 0x01C */ s16 params; // Configurable variable set by the actor's spawn data; original name: "args_data"
/* 0x01E */ s8 objBankIndex; // Object bank index of the actor's object dependency; original name: "bank"
/* 0x01E */ s8 objectSlot; // Object slot (in ObjectContext) corresponding to the actor's object; original name: "bank"
/* 0x01F */ s8 targetMode; // Controls how far the actor can be targeted from and how far it can stay locked on
/* 0x020 */ u16 sfx; // SFX ID to play. Sfx plays when value is set, then is cleared the following update cycle
/* 0x024 */ PosRot world; // Position/rotation in the world
@ -287,14 +287,14 @@ typedef struct DynaPolyActor {
typedef struct {
/* 0x00 */ MtxF* matrices;
/* 0x04 */ s16* objectIds;
/* 0x04 */ s16* objectSlots;
/* 0x08 */ s16 count;
/* 0x0C */ Gfx** dLists;
/* 0x10 */ s32 val; // used for various purposes: both a status indicator and counter
/* 0x14 */ s32 prevLimbIndex;
} BodyBreak;
#define BODYBREAK_OBJECT_DEFAULT -1 // use the same object as the actor
#define BODYBREAK_OBJECT_SLOT_DEFAULT -1 // use the same object as the actor
#define BODYBREAK_STATUS_READY -1
#define BODYBREAK_STATUS_FINISHED 0

View File

@ -246,7 +246,7 @@ typedef struct {
#define rgEnvColorG regs[8]
#define rgEnvColorB regs[9]
#define rgEnvColorA regs[10]
#define rgObjBankIdx regs[11]
#define rgObjectSlot regs[11]
#define DEFINE_EFFECT_SS(_0, enum) enum,
#define DEFINE_EFFECT_SS_UNSET(enum) enum,

View File

@ -4,24 +4,22 @@
#include "ultra64.h"
#include "z64dma.h"
#define OBJECT_EXCHANGE_BANK_MAX 19
typedef struct {
/* 0x00 */ s16 id;
/* 0x04 */ void* segment;
/* 0x08 */ DmaRequest dmaRequest;
/* 0x00 */ s16 id;
/* 0x04 */ void* segment;
/* 0x08 */ DmaRequest dmaRequest;
/* 0x28 */ OSMesgQueue loadQueue;
/* 0x40 */ OSMesg loadMsg;
} ObjectStatus; // size = 0x44
/* 0x40 */ OSMesg loadMsg;
} ObjectEntry; // size = 0x44
typedef struct {
/* 0x0000 */ void* spaceStart;
/* 0x0004 */ void* spaceEnd; // original name: "endSegment"
/* 0x0008 */ u8 num; // number of objects in bank
/* 0x0009 */ u8 unk_09;
/* 0x000A */ u8 mainKeepIndex; // "gameplay_keep" index in bank
/* 0x000B */ u8 subKeepIndex; // "gameplay_field_keep" or "gameplay_dangeon_keep" index in bank
/* 0x000C */ ObjectStatus status[OBJECT_EXCHANGE_BANK_MAX];
/* 0x0000 */ void* spaceStart;
/* 0x0004 */ void* spaceEnd; // original name: "endSegment"
/* 0x0008 */ u8 numEntries; // total amount of used entries
/* 0x0009 */ u8 numPersistentEntries; // amount of entries that won't be reused when loading a new object list (when loading a new room)
/* 0x000A */ u8 mainKeepSlot; // "gameplay_keep" slot
/* 0x000B */ u8 subKeepSlot; // "gameplay_field_keep" or "gameplay_dangeon_keep" slot
/* 0x000C */ ObjectEntry slots[19];
} ObjectContext; // size = 0x518
#define DEFINE_OBJECT(_0, enum) enum,
@ -31,7 +29,7 @@ typedef struct {
typedef enum {
#include "tables/object_table.h"
/* 0x0192 */ OBJECT_ID_MAX
} ObjectID;
} ObjectId;
#undef DEFINE_OBJECT
#undef DEFINE_OBJECT_NULL

View File

@ -799,7 +799,7 @@ void Actor_SetScale(Actor* actor, f32 scale) {
}
void Actor_SetObjectDependency(PlayState* play, Actor* actor) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[actor->objBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[actor->objectSlot].segment);
}
void Actor_Init(Actor* actor, PlayState* play) {
@ -818,7 +818,7 @@ void Actor_Init(Actor* actor, PlayState* play) {
CollisionCheck_InitInfo(&actor->colChkInfo);
actor->floorBgId = BGCHECK_SCENE;
ActorShape_Init(&actor->shape, 0.0f, NULL, 0.0f);
if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
if (Object_IsLoaded(&play->objectCtx, actor->objectSlot)) {
Actor_SetObjectDependency(play, actor);
actor->init(actor, play);
actor->init = NULL;
@ -2143,13 +2143,13 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) {
actor->sfx = 0;
if (actor->init != NULL) {
if (Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
if (Object_IsLoaded(&play->objectCtx, actor->objectSlot)) {
Actor_SetObjectDependency(play, actor);
actor->init(actor, play);
actor->init = NULL;
}
actor = actor->next;
} else if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
} else if (!Object_IsLoaded(&play->objectCtx, actor->objectSlot)) {
Actor_Kill(actor);
actor = actor->next;
} else if ((requiredActorFlag && !(actor->flags & requiredActorFlag)) ||
@ -2272,8 +2272,8 @@ void Actor_Draw(PlayState* play, Actor* actor) {
Matrix_Scale(actor->scale.x, actor->scale.y, actor->scale.z, MTXMODE_APPLY);
Actor_SetObjectDependency(play, actor);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment);
gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[actor->objBankIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[actor->objectSlot].segment);
gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.slots[actor->objectSlot].segment);
if (actor->colorFilterTimer != 0) {
Color_RGBA8 color = { 0, 0, 0, 255 };
@ -2570,7 +2570,7 @@ void Actor_KillAllWithMissingObject(PlayState* play, ActorContext* actorCtx) {
for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++) {
actor = actorCtx->actorLists[i].head;
while (actor != NULL) {
if (!Object_IsLoaded(&play->objectCtx, actor->objBankIndex)) {
if (!Object_IsLoaded(&play->objectCtx, actor->objectSlot)) {
Actor_Kill(actor);
}
actor = actor->next;
@ -2745,7 +2745,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
s32 pad;
Actor* actor;
ActorInit* actorInit;
s32 objBankIndex;
s32 objectSlot;
ActorOverlay* overlayEntry;
uintptr_t temp;
char* name;
@ -2828,13 +2828,13 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
: NULL);
}
objBankIndex = Object_GetIndex(&play->objectCtx, actorInit->objectId);
objectSlot = Object_GetSlot(&play->objectCtx, actorInit->objectId);
if ((objBankIndex < 0) ||
if ((objectSlot < 0) ||
((actorInit->category == ACTORCAT_ENEMY) && Flags_GetClear(play, play->roomCtx.curRoom.num))) {
// "No data bank!! <data bank%d> (profilep->bank=%d)"
osSyncPrintf(VT_COL(RED, WHITE) "データバンク無し!!<データバンク=%d>(profilep->bank=%d)\n" VT_RST,
objBankIndex, actorInit->objectId);
objectSlot, actorInit->objectId);
Actor_FreeOverlay(overlayEntry);
return NULL;
}
@ -2864,10 +2864,10 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
actor->flags = actorInit->flags;
if (actorInit->id == ACTOR_EN_PART) {
actor->objBankIndex = rotZ;
actor->objectSlot = rotZ;
rotZ = 0;
} else {
actor->objBankIndex = objBankIndex;
actor->objectSlot = objectSlot;
}
actor->init = actorInit->init;
@ -3155,7 +3155,7 @@ s16 func_80032D60(s16* arg0, s16 arg1, s16 arg2, s16 arg3) {
void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) {
u32 matricesSize;
u32 dListsSize;
u32 objectIdsSize;
u32 objectSlotsSize;
matricesSize = (count + 1) * sizeof(*bodyBreak->matrices);
bodyBreak->matrices = ZeldaArena_MallocDebug(matricesSize, "../z_actor.c", 7540);
@ -3165,13 +3165,13 @@ void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) {
bodyBreak->dLists = ZeldaArena_MallocDebug(dListsSize, "../z_actor.c", 7543);
if (bodyBreak->dLists != NULL) {
objectIdsSize = (count + 1) * sizeof(*bodyBreak->objectIds);
bodyBreak->objectIds = ZeldaArena_MallocDebug(objectIdsSize, "../z_actor.c", 7546);
objectSlotsSize = (count + 1) * sizeof(*bodyBreak->objectSlots);
bodyBreak->objectSlots = ZeldaArena_MallocDebug(objectSlotsSize, "../z_actor.c", 7546);
if (bodyBreak->objectIds != NULL) {
if (bodyBreak->objectSlots != NULL) {
Lib_MemSet((u8*)bodyBreak->matrices, matricesSize, 0);
Lib_MemSet((u8*)bodyBreak->dLists, dListsSize, 0);
Lib_MemSet((u8*)bodyBreak->objectIds, objectIdsSize, 0);
Lib_MemSet((u8*)bodyBreak->objectSlots, objectSlotsSize, 0);
bodyBreak->val = 1;
return;
}
@ -3186,20 +3186,20 @@ void BodyBreak_Alloc(BodyBreak* bodyBreak, s32 count, PlayState* play) {
ZeldaArena_FreeDebug(bodyBreak->dLists, "../z_actor.c", 7561);
}
if (bodyBreak->objectIds != NULL) {
ZeldaArena_FreeDebug(bodyBreak->objectIds, "../z_actor.c", 7564);
if (bodyBreak->objectSlots != NULL) {
ZeldaArena_FreeDebug(bodyBreak->objectSlots, "../z_actor.c", 7564);
}
}
void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s32 maxLimbIndex, u32 count, Gfx** dList,
s16 objectId) {
s16 objectSlot) {
PlayState* play = Effect_GetPlayState();
if ((play->actorCtx.freezeFlashTimer == 0) && (bodyBreak->val > 0)) {
if ((limbIndex >= minLimbIndex) && (limbIndex <= maxLimbIndex) && (*dList != NULL)) {
bodyBreak->dLists[bodyBreak->val] = *dList;
Matrix_Get(&bodyBreak->matrices[bodyBreak->val]);
bodyBreak->objectIds[bodyBreak->val] = objectId;
bodyBreak->objectSlots[bodyBreak->val] = objectSlot;
bodyBreak->val++;
}
@ -3219,7 +3219,7 @@ void BodyBreak_SetInfo(BodyBreak* bodyBreak, s32 limbIndex, s32 minLimbIndex, s3
s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s16 type) {
EnPart* spawnedEnPart;
MtxF* mtx;
s16 objBankIndex;
s16 objectSlot;
if (bodyBreak->val != BODYBREAK_STATUS_READY) {
return false;
@ -3231,17 +3231,17 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s1
Matrix_Get(&bodyBreak->matrices[bodyBreak->count]);
if (1) {
if (bodyBreak->objectIds[bodyBreak->count] >= 0) {
objBankIndex = bodyBreak->objectIds[bodyBreak->count];
if (bodyBreak->objectSlots[bodyBreak->count] > BODYBREAK_OBJECT_SLOT_DEFAULT) {
objectSlot = bodyBreak->objectSlots[bodyBreak->count];
} else {
objBankIndex = actor->objBankIndex;
objectSlot = actor->objectSlot;
}
}
mtx = &bodyBreak->matrices[bodyBreak->count];
spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, mtx->xw, mtx->yw,
mtx->zw, 0, 0, objBankIndex, type);
mtx->zw, 0, 0, objectSlot, type);
if (spawnedEnPart != NULL) {
Matrix_MtxFToYXZRotS(&bodyBreak->matrices[bodyBreak->count], &spawnedEnPart->actor.shape.rot, 0);
@ -3256,7 +3256,7 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, PlayState* play, s1
ZeldaArena_FreeDebug(bodyBreak->matrices, "../z_actor.c", 7678);
ZeldaArena_FreeDebug(bodyBreak->dLists, "../z_actor.c", 7679);
ZeldaArena_FreeDebug(bodyBreak->objectIds, "../z_actor.c", 7680);
ZeldaArena_FreeDebug(bodyBreak->objectSlots, "../z_actor.c", 7680);
return true;
}
@ -4329,7 +4329,7 @@ Actor* func_800358DC(Actor* actor, Vec3f* spawnPos, Vec3s* spawnRot, f32* arg3,
EnPart* spawnedEnPart;
spawnedEnPart = (EnPart*)Actor_SpawnAsChild(&play->actorCtx, actor, play, ACTOR_EN_PART, spawnPos->x, spawnPos->y,
spawnPos->z, spawnRot->x, spawnRot->y, actor->objBankIndex, params);
spawnPos->z, spawnRot->x, spawnRot->y, actor->objectSlot, params);
if (spawnedEnPart != NULL) {
spawnedEnPart->actor.scale = actor->scale;
spawnedEnPart->actor.speed = arg3[0];

View File

@ -49,7 +49,7 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) {
MtxF mfTransBillboard;
s32 pad1;
Mtx* mtx;
void* object = play->objectCtx.status[this->rgObjBankIdx].segment;
void* objectPtr = play->objectCtx.slots[this->rgObjectSlot].segment;
OPEN_DISPS(gfxCtx, "../z_effect_soft_sprite_old_init.c", 196);
@ -58,8 +58,8 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) {
SkinMatrix_SetScale(&mfScale, scale, scale, scale);
SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTransBillboard);
SkinMatrix_MtxFMtxFMult(&mfTransBillboard, &mfScale, &mfResult);
gSegments[6] = VIRTUAL_TO_PHYSICAL(object);
gSPSegment(POLY_XLU_DISP++, 0x06, object);
gSegments[6] = VIRTUAL_TO_PHYSICAL(objectPtr);
gSPSegment(POLY_XLU_DISP++, 0x06, objectPtr);
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &mfResult);

View File

@ -236,7 +236,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
this->scale = 0.01f;
break;
case ITEM00_SHIELD_DEKU:
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_1);
this->actor.objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GI_SHIELD_1);
Actor_SetObjectDependency(play, &this->actor);
Actor_SetScale(&this->actor, 0.5f);
this->scale = 0.5f;
@ -245,7 +245,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
this->actor.world.rot.x = 0x4000;
break;
case ITEM00_SHIELD_HYLIAN:
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_2);
this->actor.objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GI_SHIELD_2);
Actor_SetObjectDependency(play, &this->actor);
Actor_SetScale(&this->actor, 0.5f);
this->scale = 0.5f;
@ -255,7 +255,7 @@ void EnItem00_Init(Actor* thisx, PlayState* play) {
break;
case ITEM00_TUNIC_ZORA:
case ITEM00_TUNIC_GORON:
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_CLOTHES);
this->actor.objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GI_CLOTHES);
Actor_SetObjectDependency(play, &this->actor);
Actor_SetScale(&this->actor, 0.5f);
this->scale = 0.5f;
@ -765,10 +765,10 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
case ITEM00_RECOVERY_HEART:
if (this->despawnTimer < 0) {
if (this->despawnTimer == -1) {
s8 bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GI_HEART);
s8 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GI_HEART);
if (Object_IsLoaded(&play->objectCtx, bankIndex)) {
this->actor.objBankIndex = bankIndex;
if (Object_IsLoaded(&play->objectCtx, objectSlot)) {
this->actor.objectSlot = objectSlot;
Actor_SetObjectDependency(play, &this->actor);
this->despawnTimer = -2;
}

View File

@ -432,7 +432,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
play->csCtx.actorCues[i] = NULL;
}
if (Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) < 0 && !play->envCtx.sunMoonDisabled) {
if (Object_GetSlot(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) < 0 && !play->envCtx.sunMoonDisabled) {
play->envCtx.sunMoonDisabled = true;
// "Sun setting other than field keep! So forced release!"
osSyncPrintf(VT_COL(YELLOW, BLACK) "\n\nフィールド常駐以外、太陽設定!よって強制解除!\n" VT_RST);

View File

@ -482,8 +482,8 @@ void Play_Update(PlayState* this) {
ActorOverlayTable_LogPrint();
}
gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment);
gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment);
gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment);
if (FrameAdvance_Update(&this->frameAdvCtx, &input[1])) {
@ -855,7 +855,7 @@ void Play_Update(PlayState* this) {
AnimationContext_Reset(&this->animationCtx);
PLAY_LOG(3561);
Object_UpdateBank(&this->objectCtx);
Object_UpdateEntries(&this->objectCtx);
PLAY_LOG(3577);
@ -1035,21 +1035,21 @@ void Play_Draw(PlayState* this) {
OPEN_DISPS(gfxCtx, "../z_play.c", 3907);
gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
gSegments[4] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment);
gSegments[5] = VIRTUAL_TO_PHYSICAL(this->objectCtx.slots[this->objectCtx.subKeepSlot].segment);
gSegments[2] = VIRTUAL_TO_PHYSICAL(this->sceneSegment);
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
gSPSegment(POLY_XLU_DISP++, 0x00, NULL);
gSPSegment(OVERLAY_DISP++, 0x00, NULL);
gSPSegment(POLY_OPA_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
gSPSegment(POLY_XLU_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
gSPSegment(OVERLAY_DISP++, 0x04, this->objectCtx.status[this->objectCtx.mainKeepIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x04, this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment);
gSPSegment(POLY_XLU_DISP++, 0x04, this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment);
gSPSegment(OVERLAY_DISP++, 0x04, this->objectCtx.slots[this->objectCtx.mainKeepSlot].segment);
gSPSegment(POLY_OPA_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
gSPSegment(POLY_XLU_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
gSPSegment(OVERLAY_DISP++, 0x05, this->objectCtx.status[this->objectCtx.subKeepIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x05, this->objectCtx.slots[this->objectCtx.subKeepSlot].segment);
gSPSegment(POLY_XLU_DISP++, 0x05, this->objectCtx.slots[this->objectCtx.subKeepSlot].segment);
gSPSegment(OVERLAY_DISP++, 0x05, this->objectCtx.slots[this->objectCtx.subKeepSlot].segment);
gSPSegment(POLY_OPA_DISP++, 0x02, this->sceneSegment);
gSPSegment(POLY_XLU_DISP++, 0x02, this->sceneSegment);
@ -1434,7 +1434,7 @@ void Play_InitScene(PlayState* this, s32 spawn) {
this->numActorEntries = 0;
Object_InitBank(this, &this->objectCtx);
Object_InitContext(this, &this->objectCtx);
LightContext_Init(this, &this->lightCtx);
TransitionActor_InitContext(&this->state, &this->transiActorCtx);
func_80096FD4(this, &this->roomCtx.curRoom);

View File

@ -1370,7 +1370,7 @@ void Player_DrawHookshotReticle(PlayState* play, Player* this, f32 arg2) {
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_player_lib.c", 2587),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(OVERLAY_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment);
gSPSegment(OVERLAY_DISP++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment);
gSPDisplayList(OVERLAY_DISP++, gLinkAdultHookshotReticleDL);
CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2592);

View File

@ -3,64 +3,77 @@
RomFile sNaviQuestHintFiles[];
s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) {
/**
* Spawn an object file of a specified ID that will persist through room changes.
*
* This waits for the file to be fully loaded, the data is available when the function returns.
*
* @return The new object slot corresponding to the requested object ID.
*
* @note This function is not meant to be called externally to spawn object files on the fly.
* When an object is spawned with this function, all objects that come before it in the entry list will be treated as
* persistent, which will likely cause either the amount of free slots or object space memory to run out.
* This function is only meant to be called internally on scene load, before the object list from any room is processed.
*/
s32 Object_SpawnPersistent(ObjectContext* objectCtx, s16 objectId) {
u32 size;
objectCtx->status[objectCtx->num].id = objectId;
objectCtx->slots[objectCtx->numEntries].id = objectId;
size = gObjectTable[objectId].vromEnd - gObjectTable[objectId].vromStart;
osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectId, size / 1024.0f, objectCtx->status[objectCtx->num].segment);
osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectId, size / 1024.0f,
objectCtx->slots[objectCtx->numEntries].segment);
osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->num, (uintptr_t)objectCtx->status[objectCtx->num].segment + size,
objectCtx->spaceEnd);
osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->numEntries,
(uintptr_t)objectCtx->slots[objectCtx->numEntries].segment + size, objectCtx->spaceEnd);
ASSERT(((objectCtx->num < OBJECT_EXCHANGE_BANK_MAX) &&
(((uintptr_t)objectCtx->status[objectCtx->num].segment + size) < (uintptr_t)objectCtx->spaceEnd)),
ASSERT(((objectCtx->numEntries < ARRAY_COUNT(objectCtx->slots)) &&
(((uintptr_t)objectCtx->slots[objectCtx->numEntries].segment + size) < (uintptr_t)objectCtx->spaceEnd)),
"this->num < OBJECT_EXCHANGE_BANK_MAX && (this->status[this->num].Segment + size) < this->endSegment",
"../z_scene.c", 142);
DmaMgr_RequestSyncDebug(objectCtx->status[objectCtx->num].segment, gObjectTable[objectId].vromStart, size,
DmaMgr_RequestSyncDebug(objectCtx->slots[objectCtx->numEntries].segment, gObjectTable[objectId].vromStart, size,
"../z_scene.c", 145);
if (objectCtx->num < OBJECT_EXCHANGE_BANK_MAX - 1) {
objectCtx->status[objectCtx->num + 1].segment =
(void*)ALIGN16((uintptr_t)objectCtx->status[objectCtx->num].segment + size);
if (objectCtx->numEntries < (ARRAY_COUNT(objectCtx->slots) - 1)) {
objectCtx->slots[objectCtx->numEntries + 1].segment =
(void*)ALIGN16((uintptr_t)objectCtx->slots[objectCtx->numEntries].segment + size);
}
objectCtx->num++;
objectCtx->unk_09 = objectCtx->num;
objectCtx->numEntries++;
objectCtx->numPersistentEntries = objectCtx->numEntries;
return objectCtx->num - 1;
return objectCtx->numEntries - 1;
}
void Object_InitBank(PlayState* play, ObjectContext* objectCtx) {
PlayState* play2 = play; // Needs to be a new variable to match (possibly a sub struct?)
void Object_InitContext(PlayState* play, ObjectContext* objectCtx) {
PlayState* play2 = play;
u32 spaceSize;
s32 i;
if (play2->sceneId == SCENE_HYRULE_FIELD) {
spaceSize = 1024000;
spaceSize = 1000 * 1024;
} else if (play2->sceneId == SCENE_GANON_BOSS) {
if (gSaveContext.sceneLayer != 4) {
spaceSize = 1177600;
spaceSize = 1150 * 1024;
} else {
spaceSize = 1024000;
spaceSize = 1000 * 1024;
}
} else if (play2->sceneId == SCENE_SPIRIT_TEMPLE_BOSS) {
spaceSize = 1075200;
spaceSize = 1050 * 1024;
} else if (play2->sceneId == SCENE_CHAMBER_OF_THE_SAGES) {
spaceSize = 1075200;
spaceSize = 1050 * 1024;
} else if (play2->sceneId == SCENE_GANONDORF_BOSS) {
spaceSize = 1075200;
spaceSize = 1050 * 1024;
} else {
spaceSize = 1024000;
spaceSize = 1000 * 1024;
}
objectCtx->num = objectCtx->unk_09 = 0;
objectCtx->mainKeepIndex = objectCtx->subKeepIndex = 0;
objectCtx->numEntries = objectCtx->numPersistentEntries = 0;
objectCtx->mainKeepSlot = objectCtx->subKeepSlot = 0;
for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) {
objectCtx->status[i].id = OBJECT_INVALID;
for (i = 0; i < ARRAY_COUNT(objectCtx->slots); i++) {
objectCtx->slots[i].id = OBJECT_INVALID;
}
osSyncPrintf(VT_FGCOL(GREEN));
@ -68,42 +81,43 @@ void Object_InitBank(PlayState* play, ObjectContext* objectCtx) {
osSyncPrintf("オブジェクト入れ替えバンク情報 %8.3fKB\n", spaceSize / 1024.0f);
osSyncPrintf(VT_RST);
objectCtx->spaceStart = objectCtx->status[0].segment =
GameState_Alloc(&play->state, spaceSize, "../z_scene.c", 219);
objectCtx->spaceStart = objectCtx->slots[0].segment = GameState_Alloc(&play->state, spaceSize, "../z_scene.c", 219);
objectCtx->spaceEnd = (void*)((uintptr_t)objectCtx->spaceStart + spaceSize);
objectCtx->mainKeepIndex = Object_Spawn(objectCtx, OBJECT_GAMEPLAY_KEEP);
gSegments[4] = VIRTUAL_TO_PHYSICAL(objectCtx->status[objectCtx->mainKeepIndex].segment);
objectCtx->mainKeepSlot = Object_SpawnPersistent(objectCtx, OBJECT_GAMEPLAY_KEEP);
gSegments[4] = VIRTUAL_TO_PHYSICAL(objectCtx->slots[objectCtx->mainKeepSlot].segment);
}
void Object_UpdateBank(ObjectContext* objectCtx) {
void Object_UpdateEntries(ObjectContext* objectCtx) {
s32 i;
ObjectStatus* status = &objectCtx->status[0];
ObjectEntry* entry = &objectCtx->slots[0];
RomFile* objectFile;
u32 size;
for (i = 0; i < objectCtx->num; i++) {
if (status->id < 0) {
if (status->dmaRequest.vromAddr == 0) {
osCreateMesgQueue(&status->loadQueue, &status->loadMsg, 1);
objectFile = &gObjectTable[-status->id];
for (i = 0; i < objectCtx->numEntries; i++) {
if (entry->id < 0) {
if (entry->dmaRequest.vromAddr == 0) {
osCreateMesgQueue(&entry->loadQueue, &entry->loadMsg, 1);
objectFile = &gObjectTable[-entry->id];
size = objectFile->vromEnd - objectFile->vromStart;
osSyncPrintf("OBJECT EXCHANGE BANK-%2d SIZE %8.3fK SEG=%08x\n", i, size / 1024.0f, status->segment);
DmaMgr_RequestAsync(&status->dmaRequest, status->segment, objectFile->vromStart, size, 0,
&status->loadQueue, NULL, "../z_scene.c", 266);
} else if (osRecvMesg(&status->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) {
status->id = -status->id;
osSyncPrintf("OBJECT EXCHANGE BANK-%2d SIZE %8.3fK SEG=%08x\n", i, size / 1024.0f, entry->segment);
DmaMgr_RequestAsync(&entry->dmaRequest, entry->segment, objectFile->vromStart, size, 0,
&entry->loadQueue, NULL, "../z_scene.c", 266);
} else if (osRecvMesg(&entry->loadQueue, NULL, OS_MESG_NOBLOCK) == 0) {
entry->id = -entry->id;
}
}
status++;
entry++;
}
}
s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId) {
s32 Object_GetSlot(ObjectContext* objectCtx, s16 objectId) {
s32 i;
for (i = 0; i < objectCtx->num; i++) {
if (ABS(objectCtx->status[i].id) == objectId) {
for (i = 0; i < objectCtx->numEntries; i++) {
if (ABS(objectCtx->slots[i].id) == objectId) {
return i;
}
}
@ -111,8 +125,8 @@ s32 Object_GetIndex(ObjectContext* objectCtx, s16 objectId) {
return -1;
}
s32 Object_IsLoaded(ObjectContext* objectCtx, s32 bankIndex) {
if (objectCtx->status[bankIndex].id > 0) {
s32 Object_IsLoaded(ObjectContext* objectCtx, s32 slot) {
if (objectCtx->slots[slot].id > 0) {
return true;
} else {
return false;
@ -124,30 +138,30 @@ void func_800981B8(ObjectContext* objectCtx) {
s32 id;
u32 size;
for (i = 0; i < objectCtx->num; i++) {
id = objectCtx->status[i].id;
for (i = 0; i < objectCtx->numEntries; i++) {
id = objectCtx->slots[i].id;
size = gObjectTable[id].vromEnd - gObjectTable[id].vromStart;
osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectCtx->status[i].id, size / 1024.0f,
objectCtx->status[i].segment);
osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->num, (uintptr_t)objectCtx->status[i].segment + size,
osSyncPrintf("OBJECT[%d] SIZE %fK SEG=%x\n", objectCtx->slots[i].id, size / 1024.0f,
objectCtx->slots[i].segment);
osSyncPrintf("num=%d adrs=%x end=%x\n", objectCtx->numEntries, (uintptr_t)objectCtx->slots[i].segment + size,
objectCtx->spaceEnd);
DmaMgr_RequestSyncDebug(objectCtx->status[i].segment, gObjectTable[id].vromStart, size, "../z_scene.c", 342);
DmaMgr_RequestSyncDebug(objectCtx->slots[i].segment, gObjectTable[id].vromStart, size, "../z_scene.c", 342);
}
}
void* func_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) {
ObjectStatus* status = &objectCtx->status[bankIndex];
void* func_800982FC(ObjectContext* objectCtx, s32 slot, s16 objectId) {
ObjectEntry* entry = &objectCtx->slots[slot];
RomFile* objectFile = &gObjectTable[objectId];
u32 size;
void* nextPtr;
status->id = -objectId;
status->dmaRequest.vromAddr = 0;
entry->id = -objectId;
entry->dmaRequest.vromAddr = 0;
size = objectFile->vromEnd - objectFile->vromStart;
osSyncPrintf("OBJECT EXCHANGE NO=%2d BANK=%3d SIZE=%8.3fK\n", bankIndex, objectId, size / 1024.0f);
osSyncPrintf("OBJECT EXCHANGE NO=%2d BANK=%3d SIZE=%8.3fK\n", slot, objectId, size / 1024.0f);
nextPtr = (void*)ALIGN16((uintptr_t)status->segment + size);
nextPtr = (void*)ALIGN16((uintptr_t)entry->segment + size);
ASSERT(nextPtr < objectCtx->spaceEnd, "nextptr < this->endSegment", "../z_scene.c", 381);
@ -191,7 +205,7 @@ void Scene_CommandPlayerEntryList(PlayState* play, SceneCmd* cmd) {
linkObjectId = gLinkObjectIds[((void)0, gSaveContext.save.linkAge)];
gActorOverlayTable[playerEntry->id].initInfo->objectId = linkObjectId;
Object_Spawn(&play->objectCtx, linkObjectId);
Object_SpawnPersistent(&play->objectCtx, linkObjectId);
}
void Scene_CommandActorEntryList(PlayState* play, SceneCmd* cmd) {
@ -226,8 +240,8 @@ void Scene_CommandSpawnList(PlayState* play, SceneCmd* cmd) {
void Scene_CommandSpecialFiles(PlayState* play, SceneCmd* cmd) {
if (cmd->specialFiles.keepObjectId != OBJECT_INVALID) {
play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, cmd->specialFiles.keepObjectId);
gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[play->objectCtx.subKeepIndex].segment);
play->objectCtx.subKeepSlot = Object_SpawnPersistent(&play->objectCtx, cmd->specialFiles.keepObjectId);
gSegments[5] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[play->objectCtx.subKeepSlot].segment);
}
if (cmd->specialFiles.naviQuestHintFileId != NAVI_QUEST_HINTS_NONE) {
@ -250,25 +264,27 @@ void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) {
s32 i;
s32 j;
s32 k;
ObjectStatus* status;
ObjectStatus* status2;
ObjectStatus* firstStatus;
s16* objectEntry = SEGMENTED_TO_VIRTUAL(cmd->objectList.data);
ObjectEntry* entry;
ObjectEntry* invalidatedEntry;
ObjectEntry* entries;
s16* objectListEntry = SEGMENTED_TO_VIRTUAL(cmd->objectList.data);
void* nextPtr;
k = 0;
i = play->objectCtx.unk_09;
firstStatus = &play->objectCtx.status[0];
status = &play->objectCtx.status[i];
i = play->objectCtx.numPersistentEntries;
entries = play->objectCtx.slots;
entry = &play->objectCtx.slots[i];
while (i < play->objectCtx.num) {
if (status->id != *objectEntry) {
status2 = &play->objectCtx.status[i];
for (j = i; j < play->objectCtx.num; j++) {
status2->id = OBJECT_INVALID;
status2++;
while (i < play->objectCtx.numEntries) {
if (entry->id != *objectListEntry) {
invalidatedEntry = &play->objectCtx.slots[i];
for (j = i; j < play->objectCtx.numEntries; j++) {
invalidatedEntry->id = OBJECT_INVALID;
invalidatedEntry++;
}
play->objectCtx.num = i;
play->objectCtx.numEntries = i;
Actor_KillAllWithMissingObject(play, &play->actorCtx);
continue;
@ -276,24 +292,24 @@ void Scene_CommandObjectList(PlayState* play, SceneCmd* cmd) {
i++;
k++;
objectEntry++;
status++;
objectListEntry++;
entry++;
}
ASSERT(cmd->objectList.length <= OBJECT_EXCHANGE_BANK_MAX,
ASSERT(cmd->objectList.length <= ARRAY_COUNT(play->objectCtx.slots),
"scene_info->object_bank.num <= OBJECT_EXCHANGE_BANK_MAX", "../z_scene.c", 705);
while (k < cmd->objectList.length) {
nextPtr = func_800982FC(&play->objectCtx, i, *objectEntry);
if (i < OBJECT_EXCHANGE_BANK_MAX - 1) {
firstStatus[i + 1].segment = nextPtr;
nextPtr = func_800982FC(&play->objectCtx, i, *objectListEntry);
if (i < (ARRAY_COUNT(play->objectCtx.slots) - 1)) {
entries[i + 1].segment = nextPtr;
}
i++;
k++;
objectEntry++;
objectListEntry++;
}
play->objectCtx.num = i;
play->objectCtx.numEntries = i;
}
void Scene_CommandLightList(PlayState* play, SceneCmd* cmd) {

View File

@ -103,10 +103,10 @@ void BgBreakwall_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.world.pos.y -= 40.0f;
}
this->bankIndex = (wallType >= BWALL_KD_FLOOR) ? Object_GetIndex(&play->objectCtx, OBJECT_KINGDODONGO)
: Object_GetIndex(&play->objectCtx, OBJECT_BWALL);
this->requiredObjectSlot = (wallType >= BWALL_KD_FLOOR) ? Object_GetSlot(&play->objectCtx, OBJECT_KINGDODONGO)
: Object_GetSlot(&play->objectCtx, OBJECT_BWALL);
if (this->bankIndex < 0) {
if (this->requiredObjectSlot < 0) {
Actor_Kill(&this->dyna.actor);
} else {
BgBreakwall_SetupAction(this, BgBreakwall_WaitForObject);
@ -201,11 +201,11 @@ Actor* BgBreakwall_SpawnFragments(PlayState* play, BgBreakwall* this, Vec3f* pos
* Sets up the collision model as well is the object dependency and action function to use.
*/
void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->bankIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
CollisionHeader* colHeader = NULL;
s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF;
this->dyna.actor.objBankIndex = this->bankIndex;
this->dyna.actor.objectSlot = this->requiredObjectSlot;
Actor_SetObjectDependency(play, &this->dyna.actor);
this->dyna.actor.flags &= ~ACTOR_FLAG_4;
this->dyna.actor.draw = BgBreakwall_Draw;

View File

@ -12,7 +12,7 @@ typedef struct BgBreakwall {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ Gfx* bombableWallDList;
/* 0x0168 */ s8 colType;
/* 0x0169 */ s8 bankIndex;
/* 0x0169 */ s8 requiredObjectSlot;
/* 0x016C */ ColliderQuad collider;
/* 0x01EC */ BgBreakwallActionFunc actionFunc;
} BgBreakwall; // size = 0x01F0

View File

@ -66,12 +66,12 @@ void BgHakaMegane_Init(Actor* thisx, PlayState* play) {
DynaPolyActor_Init(&this->dyna, 0);
if (thisx->params < 3) {
this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKACH_OBJECTS);
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HAKACH_OBJECTS);
} else {
this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS);
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HAKA_OBJECTS);
}
if (this->objBankIndex < 0) {
if (this->requiredObjectSlot < 0) {
Actor_Kill(thisx);
} else {
this->actionFunc = func_8087DB24;
@ -88,8 +88,8 @@ void func_8087DB24(BgHakaMegane* this, PlayState* play) {
CollisionHeader* colHeader;
CollisionHeader* collision;
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
this->dyna.actor.objBankIndex = this->objBankIndex;
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
this->dyna.actor.objectSlot = this->requiredObjectSlot;
this->dyna.actor.draw = BgHakaMegane_Draw;
Actor_SetObjectDependency(play, &this->dyna.actor);
if (play->roomCtx.curRoom.lensMode != LENS_MODE_HIDE_ACTORS) {

View File

@ -12,7 +12,7 @@ typedef struct BgHakaMegane {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgHakaMeganeActionFunc actionFunc;
/* 0x0168 */ char unk_168[0x1];
/* 0x0169 */ s8 objBankIndex;
/* 0x0169 */ s8 requiredObjectSlot;
/* 0x016A */ char unk_16A[0x2];
} BgHakaMegane; // size = 0x016C

View File

@ -169,16 +169,16 @@ void BgHakaSgami_Init(Actor* thisx, PlayState* play) {
Effect_Add(play, &this->blureEffectIndex[1], EFFECT_BLURE1, 0, 0, &blureInit);
if (thisx->params == SCYTHE_TRAP_SHADOW_TEMPLE) {
this->requiredObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS);
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HAKA_OBJECTS);
thisx->flags &= ~ACTOR_FLAG_0;
} else {
this->requiredObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_ICE_OBJECTS);
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_ICE_OBJECTS);
this->colliderScytheCenter.dim.radius = 30;
this->colliderScytheCenter.dim.height = 70;
Actor_SetFocus(thisx, 40.0f);
}
if (this->requiredObjBankIndex < 0) {
if (this->requiredObjectSlot < 0) {
Actor_Kill(thisx);
return;
}
@ -196,8 +196,8 @@ void BgHakaSgami_Destroy(Actor* thisx, PlayState* play) {
}
void BgHakaSgami_SetupSpin(BgHakaSgami* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) {
this->actor.objBankIndex = this->requiredObjBankIndex;
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
this->actor.objectSlot = this->requiredObjectSlot;
this->actor.draw = BgHakaSgami_Draw;
this->timer = SCYTHE_SPIN_TIME;
this->actor.flags &= ~ACTOR_FLAG_4;

View File

@ -11,7 +11,7 @@ typedef void (*BgHakaSgamiActionFunc)(struct BgHakaSgami*, PlayState*);
typedef struct BgHakaSgami {
/* 0x0000 */ Actor actor;
/* 0x014C */ BgHakaSgamiActionFunc actionFunc;
/* 0x0150 */ s8 requiredObjBankIndex;
/* 0x0150 */ s8 requiredObjectSlot;
/* 0x0151 */ s8 unk_151;
/* 0x0152 */ s16 timer;
/* 0x0154 */ s32 blureEffectIndex[2];

View File

@ -102,11 +102,11 @@ void BgHakaZou_Init(Actor* thisx, PlayState* play) {
}
}
this->requiredObjBankIndex = (thisx->params == STA_BOMBABLE_RUBBLE)
? Object_GetIndex(&play->objectCtx, OBJECT_HAKACH_OBJECTS)
: Object_GetIndex(&play->objectCtx, OBJECT_HAKA_OBJECTS);
this->requiredObjectSlot = (thisx->params == STA_BOMBABLE_RUBBLE)
? Object_GetSlot(&play->objectCtx, OBJECT_HAKACH_OBJECTS)
: Object_GetSlot(&play->objectCtx, OBJECT_HAKA_OBJECTS);
if (this->requiredObjBankIndex < 0) {
if (this->requiredObjectSlot < 0) {
Actor_Kill(thisx);
} else if ((thisx->params != STA_UNKNOWN) && Flags_GetSwitch(play, this->switchFlag)) {
if (thisx->params != STA_GIANT_BIRD_STATUE) {
@ -158,8 +158,8 @@ void func_808828F4(BgHakaZou* this, PlayState* play) {
void BgHakaZou_Wait(BgHakaZou* this, PlayState* play) {
CollisionHeader* colHeader;
if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) {
this->dyna.actor.objBankIndex = this->requiredObjBankIndex;
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
this->dyna.actor.objectSlot = this->requiredObjectSlot;
this->dyna.actor.draw = BgHakaZou_Draw;
if (this->dyna.actor.params == STA_UNKNOWN) {

View File

@ -11,7 +11,7 @@ typedef void (*BgHakaZouActionFunc)(struct BgHakaZou*, PlayState*);
typedef struct BgHakaZou {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgHakaZouActionFunc actionFunc;
/* 0x0168 */ s8 requiredObjBankIndex;
/* 0x0168 */ s8 requiredObjectSlot;
/* 0x0169 */ u8 switchFlag;
/* 0x016A */ s16 timer;
/* 0x016C */ ColliderCylinder collider;

View File

@ -117,8 +117,8 @@ void BgJyaBigmirror_SetBombiwaFlag(Actor* thisx, PlayState* play) {
}
void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) {
static s16 sMirRayParamss[] = { 0x0005, 0x0007, 0x0008 };
static Vec3f sMirRayPoss[] = {
static s16 sMirRayParamsVals[] = { 0x0005, 0x0007, 0x0008 };
static Vec3f sMirRayPositions[] = {
{ 60.0f, 1802.0f, -1102.0f },
{ -560.0f, 1800.0f, -310.0f },
{ 60.0f, 1800.0f, -310.0f },
@ -127,11 +127,11 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) {
s32 puzzleSolved;
s32 lightBeamToggles[3];
s32 i;
s32 objBankIndex;
s32 mirRayObjectSlot;
objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_MIR_RAY);
mirRayObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MIR_RAY);
if ((objBankIndex < 0) || (objBankIndex != this->mirRayObjIndex)) {
if ((mirRayObjectSlot < 0) || (mirRayObjectSlot != this->mirRayObjectSlot)) {
this->lightBeams[2] = NULL;
this->lightBeams[1] = NULL;
this->lightBeams[0] = NULL;
@ -152,9 +152,11 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) {
for (i = 0; i < 3; i++) {
if (lightBeamToggles[i]) {
if ((this->lightBeams[i] == NULL) && Object_IsLoaded(&play->objectCtx, objBankIndex)) {
this->lightBeams[i] = Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPoss[i].x,
sMirRayPoss[i].y, sMirRayPoss[i].z, 0, 0, 0, sMirRayParamss[i]);
if ((this->lightBeams[i] == NULL) && Object_IsLoaded(&play->objectCtx, mirRayObjectSlot)) {
this->lightBeams[i] =
Actor_Spawn(&play->actorCtx, play, ACTOR_MIR_RAY, sMirRayPositions[i].x, sMirRayPositions[i].y,
sMirRayPositions[i].z, 0, 0, 0, sMirRayParamsVals[i]);
if (this->lightBeams[i] == NULL) {
// "Mir Ray generation failed"
@ -169,7 +171,7 @@ void BgJyaBigmirror_HandleMirRay(Actor* thisx, PlayState* play) {
}
}
}
this->mirRayObjIndex = objBankIndex;
this->mirRayObjectSlot = mirRayObjectSlot;
}
void BgJyaBigmirror_Init(Actor* thisx, PlayState* play) {
@ -186,7 +188,7 @@ void BgJyaBigmirror_Init(Actor* thisx, PlayState* play) {
this->actor.room = -1;
sIsSpawned = true;
this->spawned = true;
this->mirRayObjIndex = -1;
this->mirRayObjectSlot = -1;
// "jya Bigmirror"
osSyncPrintf("(jya 大鏡)(arg_data 0x%04x)\n", this->actor.params);

View File

@ -25,7 +25,7 @@ typedef struct BgJyaBigmirror {
/* 0x015C */ u8 puzzleFlags;
/* 0x015D */ u8 spawned;
/* 0x0160 */ Actor* lightBeams[3];
/* 0x016C */ s32 mirRayObjIndex;
/* 0x016C */ s32 mirRayObjectSlot;
/* 0x0170 */ f32 liftHeight;
} BgJyaBigmirror; // size = 0x0174

View File

@ -45,7 +45,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 400, ICHAIN_STOP),
};
static s16 sObjectIDs[] = { OBJECT_MJIN_FLASH, OBJECT_MJIN_DARK, OBJECT_MJIN_FLAME,
static s16 sObjectIds[] = { OBJECT_MJIN_FLASH, OBJECT_MJIN_DARK, OBJECT_MJIN_FLAME,
OBJECT_MJIN_ICE, OBJECT_MJIN_SOUL, OBJECT_MJIN_WIND };
void BgMjin_SetupAction(BgMjin* this, BgMjinActionFunc actionFunc) {
@ -54,12 +54,12 @@ void BgMjin_SetupAction(BgMjin* this, BgMjinActionFunc actionFunc) {
void BgMjin_Init(Actor* thisx, PlayState* play) {
BgMjin* this = (BgMjin*)thisx;
s8 objBankIndex;
s8 objectSlot;
Actor_ProcessInitChain(thisx, sInitChain);
objBankIndex = Object_GetIndex(&play->objectCtx, (thisx->params != 0 ? OBJECT_MJIN : OBJECT_MJIN_OKA));
this->objBankIndex = objBankIndex;
if (objBankIndex < 0) {
objectSlot = Object_GetSlot(&play->objectCtx, (thisx->params != 0 ? OBJECT_MJIN : OBJECT_MJIN_OKA));
this->requiredObjectSlot = objectSlot;
if (objectSlot < 0) {
Actor_Kill(thisx);
} else {
BgMjin_SetupAction(this, func_808A0850);
@ -76,10 +76,10 @@ void func_808A0850(BgMjin* this, PlayState* play) {
CollisionHeader* colHeader;
CollisionHeader* collision;
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
colHeader = NULL;
this->dyna.actor.flags &= ~ACTOR_FLAG_4;
this->dyna.actor.objBankIndex = this->objBankIndex;
this->dyna.actor.objectSlot = this->requiredObjectSlot;
Actor_SetObjectDependency(play, &this->dyna.actor);
DynaPolyActor_Init(&this->dyna, 0);
collision = this->dyna.actor.params != 0 ? &gWarpPadCol : &gOcarinaWarpPadCol;
@ -106,10 +106,10 @@ void BgMjin_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mjin.c", 250);
if (thisx->params != 0) {
s32 objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIDs[thisx->params - 1]);
s32 objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[thisx->params - 1]);
if (objBankIndex >= 0) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment);
if (objectSlot >= 0) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment);
}
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(&D_06000000));

View File

@ -10,7 +10,7 @@ typedef void (*BgMjinActionFunc)(struct BgMjin*, PlayState*);
typedef struct BgMjin {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ s8 objBankIndex;
/* 0x0164 */ s8 requiredObjectSlot;
/* 0x0168 */ BgMjinActionFunc actionFunc;
} BgMjin; // size = 0x016C

View File

@ -77,8 +77,8 @@ void BgMoriBigst_Init(Actor* thisx, PlayState* play) {
GET_PLAYER(play)->actor.world.pos.y);
BgMoriBigst_InitDynapoly(this, play, &gMoriBigstCol, 0);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjIndex < 0) {
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjectSlot < 0) {
// "【Big Stalfos key ceiling】 bank danger!"
osSyncPrintf("【ビッグスタルフォス鍵型天井】 バンク危険!\n");
osSyncPrintf("%s %d\n", "../z_bg_mori_bigst.c", 234);
@ -108,7 +108,7 @@ void BgMoriBigst_SetupWaitForMoriTex(BgMoriBigst* this, PlayState* play) {
void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, PlayState* play) {
Actor* thisx = &this->dyna.actor;
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
thisx->draw = BgMoriBigst_Draw;
if (Flags_GetClear(play, thisx->room) && (GET_PLAYER(play)->actor.world.pos.y > 700.0f)) {
if (Flags_GetSwitch(play, (thisx->params >> 8) & 0x3F)) {
@ -248,7 +248,7 @@ void BgMoriBigst_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_bigst.c", 541);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_bigst.c", 548),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View File

@ -12,7 +12,7 @@ typedef struct BgMoriBigst {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgMoriBigstActionFunc actionFunc;
/* 0x0168 */ s16 waitTimer;
/* 0x016A */ s8 moriTexObjIndex;
/* 0x016A */ s8 moriTexObjectSlot;
} BgMoriBigst; // size = 0x016C
#endif

View File

@ -87,8 +87,8 @@ void BgMoriElevator_Init(Actor* thisx, PlayState* play) {
CollisionHeader* colHeader = NULL;
this->unk_172 = sIsSpawned;
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjIndex < 0) {
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjectSlot < 0) {
Actor_Kill(thisx);
// "Forest Temple obj elevator Bank Danger!"
osSyncPrintf("Error : 森の神殿 obj elevator バンク危険!(%s %d)\n", "../z_bg_mori_elevator.c", 277);
@ -134,7 +134,7 @@ void BgMoriElevator_SetupWaitAfterInit(BgMoriElevator* this) {
}
void BgMoriElevator_WaitAfterInit(BgMoriElevator* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
if (Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) {
if (play->roomCtx.curRoom.num == 2) {
this->dyna.actor.world.pos.y = 73.0f;
@ -255,7 +255,7 @@ void BgMoriElevator_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_elevator.c", 575);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_elevator.c", 580),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gMoriElevatorDL);

View File

@ -14,7 +14,7 @@ typedef struct BgMoriElevator {
/* 0x0168 */ f32 targetY;
/* 0x016C */ s32 unk_16C;
/* 0x0170 */ u8 unk_170;
/* 0x0171 */ s8 moriTexObjIndex;
/* 0x0171 */ s8 moriTexObjectSlot;
/* 0x0172 */ s16 unk_172;
} BgMoriElevator; // size = 0x0174

View File

@ -164,8 +164,8 @@ void BgMoriHashigo_Init(Actor* thisx, PlayState* play) {
return;
}
}
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjIndex < 0) {
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjectSlot < 0) {
// "Bank danger!"
osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params,
"../z_bg_mori_hashigo.c", 312);
@ -194,7 +194,7 @@ void BgMoriHashigo_SetupWaitForMoriTex(BgMoriHashigo* this) {
}
void BgMoriHashigo_WaitForMoriTex(BgMoriHashigo* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
if (this->dyna.actor.params == HASHIGO_CLASP) {
BgMoriHashigo_SetupClasp(this);
} else if (this->dyna.actor.params == HASHIGO_LADDER) {
@ -285,7 +285,7 @@ void BgMoriHashigo_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hashigo.c", 516);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
if (1) {}
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hashigo.c", 521),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View File

@ -15,7 +15,7 @@ typedef struct BgMoriHashigo {
/* 0x01C4 */ BgMoriHashigoActionFunc actionFunc;
/* 0x01C8 */ s16 hitTimer;
/* 0x01CA */ s16 bounceCounter;
/* 0x01CC */ s8 moriTexObjIndex;
/* 0x01CC */ s8 moriTexObjectSlot;
} BgMoriHashigo; // size = 0x01D0
typedef enum {

View File

@ -78,8 +78,8 @@ void BgMoriHashira4_Init(Actor* thisx, PlayState* play) {
BgMoriHashira4_InitDynaPoly(this, play, &gMoriHashira2Col, 0);
}
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjIndex < 0) {
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjectSlot < 0) {
Actor_Kill(&this->dyna.actor);
// "Bank danger!"
osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->dyna.actor.params,
@ -109,7 +109,7 @@ void BgMoriHashira4_SetupWaitForMoriTex(BgMoriHashira4* this) {
}
void BgMoriHashira4_WaitForMoriTex(BgMoriHashira4* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
this->gateTimer = 0;
if (this->dyna.actor.params == 0) {
BgMoriHashira4_SetupPillarsRotate(this);
@ -163,7 +163,7 @@ void BgMoriHashira4_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hashira4.c", 339);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hashira4.c", 344),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View File

@ -11,7 +11,7 @@ typedef void (*BgMoriHashira4ActionFunc)(struct BgMoriHashira4*, PlayState*);
typedef struct BgMoriHashira4 {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgMoriHashira4ActionFunc actionFunc;
/* 0x0168 */ s8 moriTexObjIndex;
/* 0x0168 */ s8 moriTexObjectSlot;
/* 0x0169 */ s8 switchFlag;
/* 0x016A */ s16 gateTimer;
} BgMoriHashira4; // size = 0x016C

View File

@ -54,7 +54,7 @@ static Gfx* sDLists[] = {
void BgMoriHineri_Init(Actor* thisx, PlayState* play) {
BgMoriHineri* this = (BgMoriHineri*)thisx;
s8 moriHineriObjIdx;
s8 objectSlot;
u32 switchFlagParam;
s32 t6;
@ -78,26 +78,26 @@ void BgMoriHineri_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.params = 3;
}
}
this->boxObjIdx = -1;
this->boxObjectSlot = -1;
if (this->dyna.actor.params == 0) {
this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1);
this->moriHineriObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI1);
if (t6 == 0) {
this->boxObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_BOX);
this->boxObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_BOX);
}
} else {
if (this->dyna.actor.params == 1) {
moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1A);
objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI1A);
} else {
moriHineriObjIdx = (this->dyna.actor.params == 2) ? Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2)
: Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2A);
objectSlot = (this->dyna.actor.params == 2) ? Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI2)
: Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI2A);
}
this->moriHineriObjIdx = moriHineriObjIdx;
this->moriHineriObjectSlot = objectSlot;
}
this->moriTexObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
if (t6 != 0) {
this->dyna.actor.params += 4;
}
if ((this->moriHineriObjIdx < 0) || (this->moriTexObjIdx < 0)) {
if ((this->moriHineriObjectSlot < 0) || (this->moriTexObjectSlot < 0)) {
Actor_Kill(&this->dyna.actor);
} else {
this->actionFunc = func_808A39FC;
@ -112,22 +112,22 @@ void BgMoriHineri_Destroy(Actor* thisx, PlayState* play) {
void func_808A39FC(BgMoriHineri* this, PlayState* play) {
CollisionHeader* colHeader;
if (Object_IsLoaded(&play->objectCtx, this->moriHineriObjIdx) &&
Object_IsLoaded(&play->objectCtx, this->moriTexObjIdx) &&
((this->boxObjIdx < 0) || Object_IsLoaded(&play->objectCtx, this->boxObjIdx))) {
this->dyna.actor.objBankIndex = this->moriHineriObjIdx;
if (Object_IsLoaded(&play->objectCtx, this->moriHineriObjectSlot) &&
Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot) &&
((this->boxObjectSlot < 0) || Object_IsLoaded(&play->objectCtx, this->boxObjectSlot))) {
this->dyna.actor.objectSlot = this->moriHineriObjectSlot;
if (this->dyna.actor.params >= 4) {
this->dyna.actor.params -= 4;
if (this->dyna.actor.params == 0) {
this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1A);
this->moriHineriObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI1A);
} else if (this->dyna.actor.params == 1) {
this->moriHineriObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI1);
this->moriHineriObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI1);
} else {
this->moriHineriObjIdx = (this->dyna.actor.params == 2)
? Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2A)
: Object_GetIndex(&play->objectCtx, OBJECT_MORI_HINERI2);
this->moriHineriObjectSlot = (this->dyna.actor.params == 2)
? Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI2A)
: Object_GetSlot(&play->objectCtx, OBJECT_MORI_HINERI2);
}
if (this->moriHineriObjIdx < 0) {
if (this->moriHineriObjectSlot < 0) {
Actor_Kill(&this->dyna.actor);
} else {
this->actionFunc = func_808A3D58;
@ -194,13 +194,13 @@ void func_808A3D58(BgMoriHineri* this, PlayState* play) {
}
void func_808A3E54(BgMoriHineri* this, PlayState* play) {
s8 objBankIndex;
s8 objectSlot;
if (play->activeCamId == sSubCamId) {
if (sSubCamId != SUB_CAM_ID_DONE) {
objBankIndex = this->dyna.actor.objBankIndex;
this->dyna.actor.objBankIndex = this->moriHineriObjIdx;
this->moriHineriObjIdx = objBankIndex;
objectSlot = this->dyna.actor.objectSlot;
this->dyna.actor.objectSlot = this->moriHineriObjectSlot;
this->moriHineriObjectSlot = objectSlot;
this->dyna.actor.params ^= 1;
sSubCamId = SUB_CAM_ID_DONE;
Sfx_PlaySfxCentered(NA_SE_SY_TRE_BOX_APPEAR);
@ -223,17 +223,17 @@ void BgMoriHineri_Update(Actor* thisx, PlayState* play) {
void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play) {
BgMoriHineri* this = (BgMoriHineri*)thisx;
s8 objIndex;
s32 pad;
MtxF mtx;
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_hineri.c", 611);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIdx].segment);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_hineri.c", 618),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, sDLists[this->dyna.actor.params]);
if (this->boxObjIdx > 0) {
if (this->boxObjectSlot > 0) {
Matrix_Get(&mtx);
}
if ((this->actionFunc == func_808A3C8C) && (this->dyna.actor.shape.rot.z != 0)) {
@ -249,9 +249,9 @@ void BgMoriHineri_DrawHallAndRoom(Actor* thisx, PlayState* play) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gDungeonDoorDL);
}
if ((this->boxObjIdx > 0) && ((this->boxObjIdx = Object_GetIndex(&play->objectCtx, OBJECT_BOX)) > 0) &&
Object_IsLoaded(&play->objectCtx, this->boxObjIdx)) {
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->boxObjIdx].segment);
if ((this->boxObjectSlot > 0) && ((this->boxObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_BOX)) > 0) &&
Object_IsLoaded(&play->objectCtx, this->boxObjectSlot)) {
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->boxObjectSlot].segment);
gSPSegment(POLY_OPA_DISP++, 0x08, &D_80116280[2]);
Matrix_Put(&mtx);
Matrix_Translate(147.0f, -245.0f, -453.0f, MTXMODE_APPLY);

View File

@ -11,9 +11,9 @@ typedef void (*BgMoriHineriActionFunc)(struct BgMoriHineri*, PlayState*);
typedef struct BgMoriHineri {
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgMoriHineriActionFunc actionFunc;
/* 0x0168 */ s8 moriHineriObjIdx;
/* 0x0169 */ s8 moriTexObjIdx;
/* 0x016A */ s8 boxObjIdx;
/* 0x0168 */ s8 moriHineriObjectSlot;
/* 0x0169 */ s8 moriTexObjectSlot;
/* 0x016A */ s8 boxObjectSlot;
/* 0x016B */ s8 switchFlag;
} BgMoriHineri; // size = 0x016C

View File

@ -66,8 +66,8 @@ void BgMoriIdomizu_Init(Actor* thisx, PlayState* play) {
this->actor.world.pos.y = 184.0f;
BgMoriIdomizu_SetWaterLevel(play, 184);
}
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjIndex < 0) {
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjectSlot < 0) {
Actor_Kill(&this->actor);
// "Bank danger!"
osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", this->actor.params, "../z_bg_mori_idomizu.c",
@ -96,7 +96,7 @@ void BgMoriIdomizu_SetupWaitForMoriTex(BgMoriIdomizu* this) {
}
void BgMoriIdomizu_WaitForMoriTex(BgMoriIdomizu* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
BgMoriIdomizu_SetupMain(this);
this->actor.draw = BgMoriIdomizu_Draw;
}
@ -169,7 +169,7 @@ void BgMoriIdomizu_Draw(Actor* thisx, PlayState* play) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_idomizu.c", 360),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(POLY_XLU_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
gSPSegment(POLY_XLU_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 128);

View File

@ -15,7 +15,7 @@ typedef struct BgMoriIdomizu {
/* 0x0154 */ s32 prevSwitchFlagSet;
/* 0x0158 */ s16 isLoaded;
/* 0x015A */ s16 drainTimer;
/* 0x015C */ s8 moriTexObjIndex;
/* 0x015C */ s8 moriTexObjectSlot;
} BgMoriIdomizu; // size = 0x0160
#endif

View File

@ -56,8 +56,8 @@ void BgMoriKaitenkabe_Init(Actor* thisx, PlayState* play) {
DynaPolyActor_Init(&this->dyna, 0);
CollisionHeader_GetVirtual(&gMoriKaitenkabeCol, &colHeader);
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjIndex < 0) {
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjectSlot < 0) {
Actor_Kill(&this->dyna.actor);
// "【Rotating wall】 Bank danger!"
osSyncPrintf("【回転壁】 バンク危険!(%s %d)\n", "../z_bg_mori_kaitenkabe.c", 176);
@ -74,7 +74,7 @@ void BgMoriKaitenkabe_Destroy(Actor* thisx, PlayState* play) {
}
void BgMoriKaitenkabe_WaitForMoriTex(BgMoriKaitenkabe* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
BgMoriKaitenkabe_SetupWait(this);
this->dyna.actor.draw = BgMoriKaitenkabe_Draw;
}
@ -163,7 +163,7 @@ void BgMoriKaitenkabe_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_kaitenkabe.c", 347);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_kaitenkabe.c", 352),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View File

@ -16,7 +16,7 @@ typedef struct BgMoriKaitenkabe {
/* 0x0170 */ f32 rotSpeed;
/* 0x0174 */ f32 rotYdeg;
/* 0x0178 */ Vec3f lockedPlayerPos;
/* 0x0184 */ s8 moriTexObjIndex;
/* 0x0184 */ s8 moriTexObjectSlot;
} BgMoriKaitenkabe; // size = 0x0188
#endif

View File

@ -64,8 +64,8 @@ void BgMoriRakkatenjo_Init(Actor* thisx, PlayState* play) {
// "The set Angle has changed. Let's fix the program."
osSyncPrintf("Warning : セット Angle が変更されています。プログラムを修正しましょう。\n");
}
this->moriTexObjIndex = Object_GetIndex(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjIndex < 0) {
this->moriTexObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_MORI_TEX);
if (this->moriTexObjectSlot < 0) {
// "Forest Temple obj Falling Ceiling Bank Danger!"
osSyncPrintf("Error : 森の神殿 obj 落下天井 バンク危険!(%s %d)\n", "../z_bg_mori_rakkatenjo.c", 205);
Actor_Kill(&this->dyna.actor);
@ -102,7 +102,7 @@ void BgMoriRakkatenjo_SetupWaitForMoriTex(BgMoriRakkatenjo* this) {
}
void BgMoriRakkatenjo_WaitForMoriTex(BgMoriRakkatenjo* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->moriTexObjectSlot)) {
BgMoriRakkatenjo_SetupWait(this);
this->dyna.actor.draw = BgMoriRakkatenjo_Draw;
}
@ -226,7 +226,7 @@ void BgMoriRakkatenjo_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx, "../z_bg_mori_rakkatenjo.c", 497);
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.status[this->moriTexObjIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x08, play->objectCtx.slots[this->moriTexObjectSlot].segment);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_bg_mori_rakkatenjo.c", 502),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View File

@ -14,7 +14,7 @@ typedef struct BgMoriRakkatenjo {
/* 0x0168 */ s32 timer;
/* 0x016C */ s32 bounceCount;
/* 0x0170 */ s32 fallCount;
/* 0x0174 */ s8 moriTexObjIndex;
/* 0x0174 */ s8 moriTexObjectSlot;
} BgMoriRakkatenjo; // size = 0x0178
#endif

View File

@ -59,8 +59,8 @@ void BgSpot01Objects2_Init(Actor* thisx, PlayState* play) {
}
if (this->objectId >= 0) {
this->objBankIndex = Object_GetIndex(&play->objectCtx, this->objectId);
if (this->objBankIndex < 0) {
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, this->objectId);
if (this->requiredObjectSlot < 0) {
// "There was no bank setting."
osSyncPrintf("-----------------------------バンク設定ありませんでした.");
Actor_Kill(&this->dyna.actor);
@ -91,12 +91,12 @@ void func_808AC2BC(BgSpot01Objects2* this, PlayState* play) {
s32 pad;
Vec3f position;
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
// "---- Successful bank switching!!"
osSyncPrintf("-----バンク切り換え成功!!\n");
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment);
this->dyna.actor.objBankIndex = this->objBankIndex;
this->dyna.actor.objectSlot = this->requiredObjectSlot;
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
switch (this->dyna.actor.params & 7) {

View File

@ -13,7 +13,7 @@ typedef struct BgSpot01Objects2 {
/* 0x0164 */ BgSpot01Objects2ActionFunc actionFunc;
/* 0x0168 */ char unk_168[0x10];
/* 0x0178 */ s32 objectId;
/* 0x017C */ s8 objBankIndex;
/* 0x017C */ s8 requiredObjectSlot;
} BgSpot01Objects2; // size = 0x0180
#endif

View File

@ -218,9 +218,9 @@ s32 func_808B4E58(BgSpot16Bombstone* this, PlayState* play) {
actor->shape.rot.z = D_808B5DD8[actor->params][9];
this->dList = object_bombiwa_DL_0009E0;
this->bombiwaBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_BOMBIWA);
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_BOMBIWA);
if (this->bombiwaBankIndex < 0) {
if (this->requiredObjectSlot < 0) {
osSyncPrintf("Error : バンク危険!(arg_data 0x%04x)(%s %d)\n", actor->params, "../z_bg_spot16_bombstone.c",
589);
return false;
@ -486,7 +486,7 @@ void func_808B5AF0(BgSpot16Bombstone* this) {
}
void func_808B5B04(BgSpot16Bombstone* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->bombiwaBankIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
func_808B5B58(this);
this->actor.draw = BgSpot16Bombstone_Draw;
}
@ -546,7 +546,7 @@ void BgSpot16Bombstone_Draw(Actor* thisx, PlayState* play) {
gSPDisplayList(POLY_OPA_DISP++, this->dList);
} else {
// The boulder is debris
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->bombiwaBankIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->requiredObjectSlot].segment);
gSPDisplayList(POLY_OPA_DISP++, this->dList);
}

View File

@ -22,7 +22,7 @@ typedef struct BgSpot16Bombstone {
/* 0x01C4 */ ColliderCylinder colliderCylinder;
/* 0x0210 */ s16 unk_210;
/* 0x0212 */ s16 unk_212;
/* 0x0214 */ s8 bombiwaBankIndex;
/* 0x0214 */ s8 requiredObjectSlot;
} BgSpot16Bombstone; // size = 0x0218
#endif

View File

@ -321,8 +321,8 @@ void BossGanon_SetColliderPos(Vec3f* pos, ColliderCylinder* collider) {
}
void BossGanon_SetAnimationObject(BossGanon* this, PlayState* play, s32 objectId) {
this->animBankIndex = Object_GetIndex(&play->objectCtx, objectId);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment);
this->animObjectSlot = Object_GetSlot(&play->objectCtx, objectId);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment);
}
static InitChainEntry sInitChain[] = {
@ -474,18 +474,18 @@ void BossGanon_Destroy(Actor* thisx, PlayState* play) {
void BossGanon_SetupIntroCutscene(BossGanon* this, PlayState* play) {
s32 pad;
s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2);
s32 animObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME2);
if (animBankIndex < 0) {
if (animObjectSlot < 0) {
Actor_Kill(&this->actor);
return;
}
if (Object_IsLoaded(&play->objectCtx, animBankIndex)) {
if (Object_IsLoaded(&play->objectCtx, animObjectSlot)) {
this->actionFunc = BossGanon_IntroCutscene;
this->unk_198 = 1;
this->animBankIndex = animBankIndex;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment);
this->animObjectSlot = animObjectSlot;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment);
Animation_MorphToLoop(&this->skelAnime, &gGanondorfPlayOrganAnim, 0.0f);
} else {
this->actionFunc = BossGanon_SetupIntroCutscene;
@ -533,7 +533,7 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
f32 cos;
Camera* mainCam;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment);
sCape->backPush = -2.0f;
sCape->backSwayMagnitude = 0.25f;
@ -1079,8 +1079,8 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
}
if (this->csTimer == 50) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(
play->objectCtx.status[Object_GetIndex(&play->objectCtx, OBJECT_GANON)].segment);
gSegments[6] =
VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[Object_GetSlot(&play->objectCtx, OBJECT_GANON)].segment);
if (!GET_EVENTCHKINF(EVENTCHKINF_78)) {
TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gGanondorfTitleCardTex),
@ -1163,14 +1163,14 @@ void BossGanon_IntroCutscene(BossGanon* this, PlayState* play) {
void BossGanon_SetupDeathCutscene(BossGanon* this, PlayState* play) {
s32 pad;
s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2);
s32 animObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME2);
if (Object_IsLoaded(&play->objectCtx, animBankIndex)) {
if (Object_IsLoaded(&play->objectCtx, animObjectSlot)) {
this->actionFunc = BossGanon_DeathAndTowerCutscene;
this->csTimer = this->csState = 0;
this->unk_198 = 1;
this->animBankIndex = animBankIndex;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment);
this->animObjectSlot = animObjectSlot;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment);
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDefeatedStartAnim, 0.0f);
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim);
this->unk_508 = 0.0f;
@ -1179,11 +1179,11 @@ void BossGanon_SetupDeathCutscene(BossGanon* this, PlayState* play) {
void BossGanon_SetupTowerCutscene(BossGanon* this, PlayState* play) {
s32 pad;
s32 animBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME2);
s32 animObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME2);
if (Object_IsLoaded(&play->objectCtx, animBankIndex)) {
this->animBankIndex = animBankIndex;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[animBankIndex].segment);
if (Object_IsLoaded(&play->objectCtx, animObjectSlot)) {
this->animObjectSlot = animObjectSlot;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[animObjectSlot].segment);
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfDefeatedStartAnim, 0.0f);
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfDefeatedStartAnim);
this->actionFunc = BossGanon_DeathAndTowerCutscene;
@ -1226,7 +1226,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) {
Camera* mainCam;
Vec3f sp64;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment);
this->csTimer++;
SkelAnime_Update(&this->skelAnime);
@ -2796,7 +2796,7 @@ void BossGanon_Update(Actor* thisx, PlayState* play2) {
if ((this->actionFunc != BossGanon_IntroCutscene) && (this->actionFunc != BossGanon_DeathAndTowerCutscene)) {
BossGanon_SetAnimationObject(this, play, OBJECT_GANON_ANIME1);
} else {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->animBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->animObjectSlot].segment);
}
if (this->windowShatterState != GDF_WINDOW_SHATTER_OFF) {

View File

@ -85,7 +85,7 @@ typedef enum {
typedef struct BossGanon {
/* 0x0000 */ Actor actor;
/* 0x014C */ s32 animBankIndex;
/* 0x014C */ s32 animObjectSlot;
/* 0x0150 */ SkelAnime skelAnime;
/* 0x0194 */ BossGanonActionFunc actionFunc;
/* 0x0198 */ u8 unk_198;

View File

@ -78,15 +78,15 @@ void func_808FD080(s32 idx, ColliderJntSph* collider, Vec3f* arg2) {
void BossGanon2_SetObjectSegment(BossGanon2* this, PlayState* play, s32 objectId, u8 setRSPSegment) {
s32 pad;
s32 objectIdx = Object_GetIndex(&play->objectCtx, objectId);
s32 objectSlot = Object_GetSlot(&play->objectCtx, objectId);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIdx].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment);
if (setRSPSegment) {
OPEN_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 790);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objectIdx].segment);
gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.status[objectIdx].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment);
gSPSegment(POLY_XLU_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment);
CLOSE_DISPS(play->state.gfxCtx, "../z_boss_ganon2.c", 799);
}
@ -183,7 +183,7 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
s16 pad;
u8 sp8D;
Player* player;
s32 objectIdx;
s32 objectSlot;
s32 zero = 0;
s32 pad2;
@ -193,8 +193,8 @@ void func_808FD5F4(BossGanon2* this, PlayState* play) {
switch (this->unk_39C) {
case 0:
objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GANON_ANIME3);
if (Object_IsLoaded(&play->objectCtx, objectIdx)) {
objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON_ANIME3);
if (Object_IsLoaded(&play->objectCtx, objectSlot)) {
Cutscene_StartManual(play, &play->csCtx);
func_8002DF54(play, &this->actor, PLAYER_CSMODE_8);
this->subCamId = Play_CreateSubCamera(play);
@ -1040,10 +1040,10 @@ void func_808FFCFC(BossGanon2* this, PlayState* play) {
void func_808FFDB0(BossGanon2* this, PlayState* play) {
s32 sp28;
s32 objectIdx = Object_GetIndex(&play->objectCtx, OBJECT_GANON2);
s32 objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GANON2);
if (Object_IsLoaded(&play->objectCtx, objectIdx)) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objectIdx].segment);
if (Object_IsLoaded(&play->objectCtx, objectSlot)) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment);
Animation_MorphToLoop(&this->skelAnime, &gGanonGuardIdleAnim, -10.0f);
this->actionFunc = func_808FFEBC;

View File

@ -2083,7 +2083,7 @@ void BossGoma_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* r
sDeadLimbLifetime[limbIndex] + 100);
if (babyGohma != NULL) {
babyGohma->bossLimbDL = *dList;
babyGohma->actor.objBankIndex = this->actor.objBankIndex;
babyGohma->actor.objectSlot = this->actor.objectSlot;
}
}

View File

@ -17,7 +17,7 @@ void Demo6K_Init(Actor* thisx, PlayState* play);
void Demo6K_Destroy(Actor* thisx, PlayState* play);
void Demo6K_Update(Actor* thisx, PlayState* play);
void func_80966DB0(Demo6K* this, PlayState* play);
void Demo6K_WaitForObject(Demo6K* this, PlayState* play);
void func_80966E04(Demo6K* this, PlayState* play);
void func_80966E98(Demo6K* this, PlayState* play);
void func_80966F84(Demo6K* this, PlayState* play);
@ -69,26 +69,26 @@ void Demo6K_Init(Actor* thisx, PlayState* play) {
Demo6K* this = (Demo6K*)thisx;
s32 pad;
s32 params = this->actor.params;
s32 objBankIndex;
s32 objectSlot;
s32 i;
osSyncPrintf("no = %d\n", params);
if (sObjectIds[params] != OBJECT_GAMEPLAY_KEEP) {
objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[params]);
objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[params]);
} else {
objBankIndex = 0;
objectSlot = 0;
}
osSyncPrintf("bank_ID = %d\n", objBankIndex);
osSyncPrintf("bank_ID = %d\n", objectSlot);
if (objBankIndex < 0) {
if (objectSlot < 0) {
ASSERT(0, "0", "../z_demo_6k.c", 334);
} else {
this->objBankIndex = objBankIndex;
this->requiredObjectSlot = objectSlot;
}
Demo6K_SetupAction(this, func_80966DB0);
Demo6K_SetupAction(this, Demo6K_WaitForObject);
this->timer1 = 0;
this->flags = 0;
this->timer2 = 0;
@ -197,9 +197,9 @@ void Demo6K_Destroy(Actor* thisx, PlayState* play) {
LightContext_RemoveLight(play, &play->lightCtx, this->lightNode);
}
void func_80966DB0(Demo6K* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
this->actor.objBankIndex = this->objBankIndex;
void Demo6K_WaitForObject(Demo6K* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
this->actor.objectSlot = this->requiredObjectSlot;
this->actor.draw = this->drawFunc;
this->actionFunc = this->initActionFunc;
}

View File

@ -27,7 +27,7 @@ typedef struct Demo6K {
/* 0x028C */ u16 flags;
/* 0x028E */ u16 timer1;
/* 0x0290 */ u16 timer2;
/* 0x0292 */ u8 objBankIndex;
/* 0x0292 */ u8 requiredObjectSlot;
/* 0x0293 */ u8 unk_293;
} Demo6K; // size = 0x0294

View File

@ -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);
}

View File

@ -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

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];

View File

@ -23,7 +23,7 @@ void func_80978308(DemoGeff* this, PlayState* play);
void func_809784D4(DemoGeff* this, PlayState* play);
void func_80978344(DemoGeff* this, PlayState* play);
static s16 sObjectIDs[] = {
static s16 sObjectIds[] = {
OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF,
};
@ -86,13 +86,13 @@ void func_80977EA8(PlayState* play, Gfx* dlist) {
void func_80977F80(DemoGeff* this, PlayState* play) {
s32 pad[2];
s32 objBankIndex = this->objBankIndex;
s32 objectSlot = this->objectSlot;
GraphicsContext* gfxCtx = play->state.gfxCtx;
OPEN_DISPS(gfxCtx, "../z_demo_geff.c", 204);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[objBankIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[objectSlot].segment);
// Necessary to match
if (!play) {}
@ -188,17 +188,17 @@ void func_809783D4(DemoGeff* this, PlayState* play) {
ObjectContext* objCtx = &play->objectCtx;
Actor* thisx = &this->actor;
s32 params = thisx->params;
s16 objectId = sObjectIDs[params];
s32 objBankIndex = Object_GetIndex(objCtx, objectId);
s16 objectId = sObjectIds[params];
s32 objectSlot = Object_GetSlot(objCtx, objectId);
s32 pad;
if (objBankIndex < 0) {
if (objectSlot < 0) {
osSyncPrintf(VT_FGCOL(RED) "Demo_Geff_main_bank:バンクを読めない arg_data = %d!\n" VT_RST, params);
Actor_Kill(thisx);
return;
}
if (Object_IsLoaded(objCtx, objBankIndex)) {
this->objBankIndex = objBankIndex;
if (Object_IsLoaded(objCtx, objectSlot)) {
this->objectSlot = objectSlot;
func_80978370(this, play);
}
}

View File

@ -16,7 +16,7 @@ typedef struct DemoGeff {
/* 0x0000 */ Actor actor;
/* 0x014C */ s32 action;
/* 0x0150 */ s32 drawConfig;
/* 0x0154 */ s32 objBankIndex;
/* 0x0154 */ s32 objectSlot;
/* 0x0158 */ DemoGt* demoGt;
/* 0x015C */ f32 deltaPosX;
/* 0x0160 */ f32 deltaPosY;

View File

@ -52,7 +52,7 @@ ActorInit Demo_Kankyo_InitVars = {
(ActorFunc)DemoKankyo_Draw,
};
static s16 sObjIds[] = {
static s16 sObjectIds[] = {
OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD,
OBJECT_EFC_STAR_FIELD, OBJECT_EFC_STAR_FIELD, OBJECT_GAMEPLAY_KEEP, OBJECT_GI_MELODY, OBJECT_GI_MELODY,
OBJECT_GI_MELODY, OBJECT_GI_MELODY, OBJECT_GI_MELODY, OBJECT_TOKI_OBJECTS, OBJECT_TOKI_OBJECTS,
@ -181,13 +181,13 @@ void DemoKankyo_SetupAction(DemoKankyo* this, DemoKankyoActionFunc actionFunc) {
void DemoKankyo_Init(Actor* thisx, PlayState* play) {
DemoKankyo* this = (DemoKankyo*)thisx;
s16 i;
s32 objBankIndex = Object_GetIndex(&play->objectCtx, sObjIds[this->actor.params]);
s32 objectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[this->actor.params]);
osSyncPrintf("bank_ID = %d\n", objBankIndex);
if (objBankIndex < 0) {
osSyncPrintf("bank_ID = %d\n", objectSlot);
if (objectSlot < 0) {
ASSERT(0, "0", "../z_demo_kankyo.c", 521);
} else {
this->objBankIndex = objBankIndex;
this->requiredObjectSlot = objectSlot;
}
switch (this->actor.params) {
@ -279,7 +279,7 @@ void DemoKankyo_SetupType(DemoKankyo* this, PlayState* play) {
Player* player = GET_PLAYER(play);
f32 temp;
if (this->actor.objBankIndex == this->objBankIndex) {
if (this->actor.objectSlot == this->requiredObjectSlot) {
switch (this->actor.params) {
case DEMOKANKYO_ROCK_1:
case DEMOKANKYO_ROCK_2:
@ -432,7 +432,7 @@ void DemoKankyo_Update(Actor* thisx, PlayState* play) {
void DemoKankyo_Draw(Actor* thisx, PlayState* play) {
DemoKankyo* this = (DemoKankyo*)thisx;
if (this->actor.objBankIndex == this->objBankIndex) {
if (this->actor.objectSlot == this->requiredObjectSlot) {
switch (this->actor.params) {
case DEMOKANKYO_BLUE_RAIN:
case DEMOKANKYO_BLUE_RAIN_2:
@ -480,8 +480,8 @@ void DemoKankyo_Draw(Actor* thisx, PlayState* play) {
break;
}
}
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
this->actor.objBankIndex = this->objBankIndex;
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
this->actor.objectSlot = this->requiredObjectSlot;
}
}

View File

@ -42,7 +42,7 @@ typedef struct {
typedef struct DemoKankyo {
/* 0x0000 */ Actor actor;
/* 0x014C */ u8 objBankIndex;
/* 0x014C */ u8 requiredObjectSlot;
/* 0x014D */ u8 sparkleCounter;
/* 0x014E */ u8 warpTimer;
/* 0x0150 */ DemoKankyoUnk150 unk_150[30];

View File

@ -25,7 +25,7 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2);
void DoorKiller_Destroy(Actor* thisx, PlayState* play);
void DoorKiller_Update(Actor* thisx, PlayState* play);
void DoorKiller_Wait(DoorKiller* this, PlayState* play);
void DoorKiller_SetProperties(DoorKiller* this, PlayState* play);
void DoorKiller_WaitForObject(DoorKiller* this, PlayState* play);
void DoorKiller_DrawDoor(Actor* thisx, PlayState* play);
void DoorKiller_DrawRubble(Actor* thisx, PlayState* play);
@ -99,18 +99,19 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
f32 randF;
DoorKiller* this = (DoorKiller*)thisx;
s32 bankIndex;
s32 objectSlot;
s32 i;
// Look in the object bank for one of the four objects containing door textures
bankIndex = -1;
for (i = 0; bankIndex < 0; i++) {
bankIndex = Object_GetIndex(&play->objectCtx, sDoorTextures[i].objectId);
objectSlot = -1;
//! @bug If no objectSlot is found, `sDoorTextures` will be read out of bounds
for (i = 0; objectSlot < 0; i++) {
objectSlot = Object_GetSlot(&play->objectCtx, sDoorTextures[i].objectId);
this->textureEntryIndex = i;
}
osSyncPrintf("bank_ID = %d\n", bankIndex);
osSyncPrintf("bank_ID = %d\n", objectSlot);
osSyncPrintf("status = %d\n", this->textureEntryIndex);
this->doorObjBankIndex = bankIndex;
this->requiredObjectSlot = objectSlot;
this->texture = sDoorTextures[this->textureEntryIndex].texture;
ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f);
@ -126,8 +127,8 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) {
// play any animations it does not cause problems, but it would need to be changed otherwise.
SkelAnime_InitFlex(play, &this->skelAnime, &object_door_killer_Skel_001BC8, NULL, this->jointTable,
this->jointTable, 9);
this->actionFunc = DoorKiller_SetProperties;
DoorKiller_SetProperties(this, play);
this->actionFunc = DoorKiller_WaitForObject;
DoorKiller_WaitForObject(this, play);
// manually set the overall rotation of the door
this->jointTable[1].x = this->jointTable[1].z = 0x4000;
@ -152,8 +153,8 @@ void DoorKiller_Init(Actor* thisx, PlayState* play2) {
case DOOR_KILLER_RUBBLE_PIECE_2:
case DOOR_KILLER_RUBBLE_PIECE_3:
case DOOR_KILLER_RUBBLE_PIECE_4:
this->actionFunc = DoorKiller_SetProperties;
DoorKiller_SetProperties(this, play);
this->actionFunc = DoorKiller_WaitForObject;
DoorKiller_WaitForObject(this, play);
this->actor.gravity = -0.6f;
this->actor.minVelocityY = -6.0f;
@ -459,17 +460,17 @@ void DoorKiller_Wait(DoorKiller* this, PlayState* play) {
void DoorKiller_UpdateTexture(Actor* thisx, PlayState* play) {
DoorKiller* this = (DoorKiller*)thisx;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->doorObjBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment);
this->texture = SEGMENTED_TO_VIRTUAL(this->texture);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[thisx->objBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment);
}
/**
* Gets the correct door texture, defines the appropriate draw fucntion and action function based on type behaviour
* (door or rubble).
*/
void DoorKiller_SetProperties(DoorKiller* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->doorObjBankIndex)) {
void DoorKiller_WaitForObject(DoorKiller* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
DoorKiller_UpdateTexture(&this->actor, play);
switch (this->actor.params & 0xFF) {
case DOOR_KILLER_DOOR:

View File

@ -25,7 +25,7 @@ typedef struct DoorKiller {
/* 0x0214 */ void* texture;
/* 0x0218 */ u16 hasHitPlayerOrGround;
/* 0x021A */ u16 timer;
/* 0x021C */ u8 doorObjBankIndex;
/* 0x021C */ u8 requiredObjectSlot;
/* 0x021D */ u8 textureEntryIndex;
/* 0x0220 */ ColliderJntSph colliderJntSph;
/* 0x0240 */ ColliderJntSphElement colliderJntSphItems[1];

View File

@ -402,7 +402,7 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
s32 styleType;
s32 pad;
s32 objectIndex;
s32 objectSlot;
s32 i;
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
@ -432,9 +432,8 @@ void DoorShutter_Init(Actor* thisx, PlayState* play2) {
} else { // DOORSHUTTER_STYLE_PHANTOM_GANON, DOORSHUTTER_STYLE_GOHMA_BLOCK
this->dyna.actor.room = -1;
}
if (this->requiredObjBankIndex = objectIndex = Object_GetIndex(&play->objectCtx, sStyleInfo[styleType].objectId),
(s8)objectIndex < 0) {
if (this->requiredObjectSlot = objectSlot = Object_GetSlot(&play->objectCtx, sStyleInfo[styleType].objectId),
(s8)objectSlot < 0) {
Actor_Kill(&this->dyna.actor);
return;
}
@ -468,8 +467,8 @@ void DoorShutter_Destroy(Actor* thisx, PlayState* play) {
}
void DoorShutter_WaitForObject(DoorShutter* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) {
this->dyna.actor.objBankIndex = this->requiredObjBankIndex;
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
this->dyna.actor.objectSlot = this->requiredObjectSlot;
if (this->doorType == SHUTTER_PG_BARS || this->doorType == SHUTTER_GOHMA_BLOCK) {
// Init dynapoly for shutters of the type that uses it
CollisionHeader* colHeader = NULL;
@ -977,7 +976,7 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) {
DoorShutter* this = (DoorShutter*)thisx;
//! @bug This actor is not fully initialized until the required object dependency is loaded.
//! In most cases, the check for objBankIndex to equal requiredObjBankIndex prevents the actor
//! In most cases, the check for objectSlot to equal requiredObjectSlot prevents the actor
//! from drawing until initialization is complete. However if the required object is the same as the
//! object dependency listed in init vars (gameplay_keep in this case), the check will pass even though
//! initialization has not completed. When this happens, it will try to draw the display list of the
@ -988,7 +987,7 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) {
//! The best way to fix this issue (and what was done in Majora's Mask) is to null out the draw function in
//! the init vars for the actor, and only set draw after initialization is complete.
if (this->dyna.actor.objBankIndex == this->requiredObjBankIndex &&
if (this->dyna.actor.objectSlot == this->requiredObjectSlot &&
(this->styleType == DOORSHUTTER_STYLE_PHANTOM_GANON || DoorShutter_ShouldDraw(this, play))) {
s32 pad[2];
DoorShutterGfxInfo* gfxInfo = &sGfxInfo[this->gfxType];

View File

@ -48,7 +48,7 @@ typedef struct DoorShutter {
/* 0x016A */ u8 doorType;
/* 0x016B */ u8 styleType;
/* 0x016C */ u8 gfxType;
/* 0x016D */ s8 requiredObjBankIndex;
/* 0x016D */ s8 requiredObjectSlot;
/* 0x016E */ s8 unlockTimer; // non-0 if the door is locked, ticks down while the door is unlocking
/* 0x016F */ s8 actionTimer;
/* 0x0170 */ f32 barsClosedAmount; // Ranges from 0.0f (unbarred) to 1.0f (barred)

View File

@ -1267,7 +1267,7 @@ void EnBb_Update(Actor* thisx, PlayState* play2) {
void EnBb_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
EnBb* this = (EnBb*)thisx;
BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 4, 15, 15, dList, BODYBREAK_OBJECT_DEFAULT);
BodyBreak_SetInfo(&this->bodyBreak, limbIndex, 4, 15, 15, dList, BODYBREAK_OBJECT_SLOT_DEFAULT);
}
static Vec3f sFireIceOffsets[] = {

View File

@ -470,18 +470,18 @@ void EnCs_Draw(Actor* thisx, PlayState* play) {
EnCs_OverrideLimbDraw, EnCs_PostLimbDraw, &this->actor);
if (GET_ITEMGETINF(ITEMGETINF_3A)) {
s32 childLinkObjectIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD);
s32 linkChildObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_LINK_CHILD);
// Handle attaching the Spooky Mask to the boy's face
if (childLinkObjectIndex >= 0) {
if (linkChildObjectSlot >= 0) {
Mtx* mtx;
Matrix_Put(&this->spookyMaskMtx);
mtx = Matrix_NewMtx(play->state.gfxCtx, "../z_en_cs.c", 1000);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[childLinkObjectIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[linkChildObjectSlot].segment);
gSPSegment(POLY_OPA_DISP++, 0x0D, mtx - 7);
gSPDisplayList(POLY_OPA_DISP++, gLinkChildSpookyMaskDL);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment);
}
}

View File

@ -124,7 +124,7 @@ void EnDntNomal_Init(Actor* thisx, PlayState* play) {
}
this->actor.flags &= ~ACTOR_FLAG_0;
this->actor.colChkInfo.mass = 0xFF;
this->objId = -1;
this->objectId = -1;
if (this->type == ENDNTNOMAL_TARGET) {
osSyncPrintf("\n\n");
// "Deku Scrub target"
@ -132,21 +132,21 @@ void EnDntNomal_Init(Actor* thisx, PlayState* play) {
Collider_InitQuad(play, &this->targetQuad);
Collider_SetQuad(play, &this->targetQuad, &this->actor, &sTargetQuadInit);
this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
this->objId = OBJECT_HINTNUTS;
this->objectId = OBJECT_HINTNUTS;
} else {
osSyncPrintf("\n\n");
// "Deku Scrub mask show audience"
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ デグナッツお面品評会一般人 ☆☆☆☆☆ \n" VT_RST);
Collider_InitCylinder(play, &this->bodyCyl);
Collider_SetCylinder(play, &this->bodyCyl, &this->actor, &sBodyCylinderInit);
this->objId = OBJECT_DNK;
this->objectId = OBJECT_DNK;
}
if (this->objId >= 0) {
this->objIndex = Object_GetIndex(&play->objectCtx, this->objId);
if (this->objIndex < 0) {
if (this->objectId >= 0) {
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, this->objectId);
if (this->requiredObjectSlot < 0) {
Actor_Kill(&this->actor);
// "What?"
osSyncPrintf(VT_FGCOL(MAGENTA) " なにみの? %d\n" VT_RST "\n", this->objIndex);
osSyncPrintf(VT_FGCOL(MAGENTA) " なにみの? %d\n" VT_RST "\n", this->requiredObjectSlot);
// "Bank is funny"
osSyncPrintf(VT_FGCOL(CYAN) " バンクおかしいしぞ!%d\n" VT_RST "\n", this->actor.params);
return;
@ -169,9 +169,9 @@ void EnDntNomal_Destroy(Actor* thisx, PlayState* play) {
}
void EnDntNomal_WaitForObject(EnDntNomal* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->objIndex)) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objIndex].segment);
this->actor.objBankIndex = this->objIndex;
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment);
this->actor.objectSlot = this->requiredObjectSlot;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f);
this->actor.gravity = -2.0f;
Actor_SetScale(&this->actor, 0.01f);

View File

@ -24,7 +24,7 @@ typedef struct EnDntNomal {
/* 0x0260 */ s16 blinkTimer;
/* 0x0262 */ s16 unkCounter;
/* 0x0264 */ s16 timer3;
/* 0x0266 */ s16 objId;
/* 0x0266 */ s16 objectId;
/* 0x0268 */ s16 eyeState;
/* 0x026A */ s16 type;
/* 0x026C */ s16 hitCounter;
@ -35,7 +35,7 @@ typedef struct EnDntNomal {
/* 0x0276 */ u8 ignore;
/* 0x0277 */ u8 spawnedItem;
/* 0x0278 */ u8 stagePrize;
/* 0x0279 */ s8 objIndex;
/* 0x0279 */ s8 requiredObjectSlot;
/* 0x027C */ Vec3f mouthPos;
/* 0x0288 */ Vec3f targetPos;
/* 0x0294 */ ColliderQuad targetQuad;

View File

@ -111,7 +111,7 @@ void EnDoor_Init(Actor* thisx, PlayState* play2) {
EnDoor* this = (EnDoor*)thisx;
EnDoorInfo* objectInfo;
s32 i;
s32 objBankIndex;
s32 objectSlot;
f32 xOffset;
f32 zOffset;
@ -124,20 +124,20 @@ void EnDoor_Init(Actor* thisx, PlayState* play2) {
break;
}
}
if (i >= ARRAY_COUNT(sDoorInfo) - 2 && Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) >= 0) {
if (i >= ARRAY_COUNT(sDoorInfo) - 2 && Object_GetSlot(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP) >= 0) {
objectInfo++;
}
this->dListIndex = objectInfo->dListIndex;
objBankIndex = Object_GetIndex(&play->objectCtx, objectInfo->objectId);
if (objBankIndex < 0) {
objectSlot = Object_GetSlot(&play->objectCtx, objectInfo->objectId);
if (objectSlot < 0) {
Actor_Kill(&this->actor);
return;
}
this->requiredObjBankIndex = objBankIndex;
this->requiredObjectSlot = objectSlot;
this->dListIndex = objectInfo->dListIndex;
if (this->actor.objBankIndex == this->requiredObjBankIndex) {
if (this->actor.objectSlot == this->requiredObjectSlot) {
EnDoor_SetupType(this, play);
} else {
this->actionFunc = EnDoor_SetupType;
@ -175,10 +175,10 @@ void EnDoor_Destroy(Actor* thisx, PlayState* play) {
void EnDoor_SetupType(EnDoor* this, PlayState* play) {
s32 doorType;
if (Object_IsLoaded(&play->objectCtx, this->requiredObjBankIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
doorType = ENDOOR_GET_TYPE(&this->actor);
this->actor.flags &= ~ACTOR_FLAG_4;
this->actor.objBankIndex = this->requiredObjBankIndex;
this->actor.objectSlot = this->requiredObjectSlot;
this->actionFunc = EnDoor_Idle;
if (doorType == DOOR_EVENING) {
doorType = (gSaveContext.save.dayTime > CLOCK_TIME(18, 0) && gSaveContext.save.dayTime < CLOCK_TIME(21, 0))
@ -360,7 +360,7 @@ s32 EnDoor_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
void EnDoor_Draw(Actor* thisx, PlayState* play) {
EnDoor* this = (EnDoor*)thisx;
if (this->actor.objBankIndex == this->requiredObjBankIndex) {
if (this->actor.objectSlot == this->requiredObjectSlot) {
OPEN_DISPS(play->state.gfxCtx, "../z_en_door.c", 910);
Gfx_SetupDL_25Opa(play->state.gfxCtx);

View File

@ -49,7 +49,7 @@ typedef void (*EnDoorActionFunc)(struct EnDoor*, PlayState*);
typedef struct EnDoor {
/* 0x0000 */ DOOR_ACTOR_BASE;
/* 0x0192 */ u8 unk_192;
/* 0x0193 */ s8 requiredObjBankIndex;
/* 0x0193 */ s8 requiredObjectSlot;
/* 0x0194 */ s8 dListIndex;
/* 0x0196 */ s16 lockTimer;
/* 0x0198 */ Vec3s jointTable[5];

View File

@ -342,15 +342,15 @@ void EnEncount2_DrawEffects(Actor* thisx, PlayState* play) {
EnEncount2Effect* effect = this->effects;
GraphicsContext* gfxCtx = play->state.gfxCtx;
s16 i;
s32 objBankIndex;
s32 objectSlot;
OPEN_DISPS(gfxCtx, "../z_en_encount2.c", 642);
objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_EFC_STAR_FIELD);
objectSlot = Object_GetSlot(&play->objectCtx, OBJECT_EFC_STAR_FIELD);
if (objBankIndex >= 0) {
if (objectSlot >= 0) {
gDPPipeSync(POLY_XLU_DISP++);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[objBankIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[objectSlot].segment);
for (i = 0; i < EN_ENCOUNT2_EFFECT_COUNT; effect++, i++) {
if (effect->isAlive) {

View File

@ -60,23 +60,23 @@ void EnExItem_Init(Actor* thisx, PlayState* play) {
// "What will come out?"
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ なにがでるかな? ☆☆☆☆☆ %d\n" VT_RST, this->unusedParam);
this->initPos = this->actor.world.pos;
this->getItemObjId = -1;
this->getItemObjectId = -1;
switch (this->type) {
case EXITEM_BOMB_BAG_BOWLING:
case EXITEM_BOMB_BAG_COUNTER:
this->getItemObjId = OBJECT_GI_BOMBPOUCH;
this->getItemObjectId = OBJECT_GI_BOMBPOUCH;
break;
case EXITEM_HEART_PIECE_BOWLING:
case EXITEM_HEART_PIECE_COUNTER:
this->getItemObjId = OBJECT_GI_HEARTS;
this->getItemObjectId = OBJECT_GI_HEARTS;
break;
case EXITEM_BOMBCHUS_BOWLING:
case EXITEM_BOMBCHUS_COUNTER:
this->getItemObjId = OBJECT_GI_BOMB_2;
this->getItemObjectId = OBJECT_GI_BOMB_2;
break;
case EXITEM_BOMBS_BOWLING:
case EXITEM_BOMBS_COUNTER:
this->getItemObjId = OBJECT_GI_BOMB_1;
this->getItemObjectId = OBJECT_GI_BOMB_1;
break;
case EXITEM_PURPLE_RUPEE_BOWLING:
case EXITEM_PURPLE_RUPEE_COUNTER:
@ -85,7 +85,7 @@ void EnExItem_Init(Actor* thisx, PlayState* play) {
case EXITEM_RED_RUPEE_CHEST:
case EXITEM_13:
case EXITEM_14:
this->getItemObjId = OBJECT_GI_RUPY;
this->getItemObjectId = OBJECT_GI_RUPY;
break;
case EXITEM_SMALL_KEY_CHEST:
this->scale = 0.05f;
@ -96,16 +96,16 @@ void EnExItem_Init(Actor* thisx, PlayState* play) {
case EXITEM_MAGIC_FIRE:
case EXITEM_MAGIC_WIND:
case EXITEM_MAGIC_DARK:
this->getItemObjId = OBJECT_GI_GODDESS;
this->getItemObjectId = OBJECT_GI_GODDESS;
break;
case EXITEM_BULLET_BAG:
this->getItemObjId = OBJECT_GI_DEKUPOUCH;
this->getItemObjectId = OBJECT_GI_DEKUPOUCH;
}
if (this->getItemObjId >= 0) {
this->objectIdx = Object_GetIndex(&play->objectCtx, this->getItemObjId);
if (this->getItemObjectId >= 0) {
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, this->getItemObjectId);
this->actor.draw = NULL;
if (this->objectIdx < 0) {
if (this->requiredObjectSlot < 0) {
Actor_Kill(&this->actor);
// "What?"
osSyncPrintf("なにみの? %d\n", this->actor.params);
@ -120,14 +120,14 @@ void EnExItem_Init(Actor* thisx, PlayState* play) {
void EnExItem_WaitForObject(EnExItem* this, PlayState* play) {
s32 onCounter;
if (Object_IsLoaded(&play->objectCtx, this->objectIdx)) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
// "End of transfer"
osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this);
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this);
osSyncPrintf(VT_FGCOL(BLUE) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this);
osSyncPrintf(VT_FGCOL(MAGENTA) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n" VT_RST, this->actor.params, this);
osSyncPrintf(VT_FGCOL(CYAN) "☆☆☆☆☆ 転送終了 ☆☆☆☆☆ %d\n\n" VT_RST, this->actor.params, this);
this->actor.objBankIndex = this->objectIdx;
this->actor.objectSlot = this->requiredObjectSlot;
this->actor.draw = EnExItem_Draw;
this->stopRotate = false;
onCounter = false;

View File

@ -12,7 +12,7 @@ typedef void (*EnExItemLightFunc)(Actor*, PlayState*, s32);
typedef struct EnExItem {
/* 0x0000 */ Actor actor;
/* 0x014C */ EnExItemActionFunc actionFunc;
/* 0x0150 */ s16 getItemObjId;
/* 0x0150 */ s16 getItemObjectId;
/* 0x0152 */ s16 type;
/* 0x0152 */ s16 unusedParam;
/* 0x0156 */ s16 giDrawId;
@ -23,7 +23,7 @@ typedef struct EnExItem {
/* 0x0160 */ s16 killItem;
/* 0x0164 */ f32 scale;
/* 0x0168 */ f32 unkFloat; // set to the same value as scale, but unused
/* 0x016C */ s8 objectIdx;
/* 0x016C */ s8 requiredObjectSlot;
/* 0x0170 */ Vec3f initPos; // unused
/* 0x017C */ EnExItemLightFunc unk_17C;
/* 0x0180 */ EnExItemLightFunc unk_180;

View File

@ -250,8 +250,8 @@ void EnFr_Init(Actor* thisx, PlayState* play) {
ASSERT(0, "0", "../z_en_fr.c", 372);
}
this->objBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP);
if (this->objBankIndex < 0) {
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GAMEPLAY_FIELD_KEEP);
if (this->requiredObjectSlot < 0) {
Actor_Kill(&this->actor);
osSyncPrintf(VT_COL(RED, WHITE));
// "There is no bank!!"
@ -277,7 +277,7 @@ void EnFr_Update(Actor* thisx, PlayState* play) {
s32 frogIndex;
s32 pad2;
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
this->actor.flags &= ~ACTOR_FLAG_4;
frogIndex = this->actor.params - 1;
sEnFrPointers.frogs[frogIndex] = this;

View File

@ -39,7 +39,7 @@ typedef struct EnFr {
/* 0x0354 */ EnFrActionFunc actionFunc;
/* 0x0358 */ LightNode* lightNode; // Frogs light up during the Frog Song, specifically the frog with the next note.
/* 0x035C */ LightInfo lightInfo;
/* 0x036A */ s8 objBankIndex;
/* 0x036A */ s8 requiredObjectSlot;
/* 0x036C */ s32 jumpCounter; // cyclic clock used to time celebratory frog jumps every 4 frames when child song is played.
/* 0x0370 */ s32 blinkTimer; // blinking timer
/* 0x0374 */ EnFrBlinkFunc blinkFunc; // unique case of using a function pointer for blinking

View File

@ -136,12 +136,12 @@ void EnGSwitch_Init(Actor* thisx, PlayState* play) {
this->actor.scale.y = 0.45f;
this->actor.scale.z = 0.25f;
this->collider.info.bumper.dmgFlags = DMG_ARROW;
this->objId = OBJECT_TSUBO;
this->objIndex = Object_GetIndex(&play->objectCtx, this->objId);
if (this->objIndex < 0) {
this->objectId = OBJECT_TSUBO;
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, this->objectId);
if (this->requiredObjectSlot < 0) {
Actor_Kill(&this->actor);
// "what?"
osSyncPrintf(VT_FGCOL(MAGENTA) " なにみの? %d\n" VT_RST "\n", this->objIndex);
osSyncPrintf(VT_FGCOL(MAGENTA) " なにみの? %d\n" VT_RST "\n", this->requiredObjectSlot);
// "bank is funny"
osSyncPrintf(VT_FGCOL(CYAN) " バンクおかしいしぞ!%d\n" VT_RST "\n", this->actor.params);
}
@ -197,9 +197,9 @@ void EnGSwitch_Break(EnGSwitch* this, PlayState* play) {
}
void EnGSwitch_WaitForObject(EnGSwitch* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->objIndex)) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objIndex].segment);
this->actor.objBankIndex = this->objIndex;
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->requiredObjectSlot].segment);
this->actor.objectSlot = this->requiredObjectSlot;
this->actor.draw = EnGSwitch_DrawPot;
this->actionFunc = EnGSwitch_ArcheryPot;
}

View File

@ -46,7 +46,7 @@ typedef struct EnGSwitch {
/* 0x0158 */ s16 colorIdx;
/* 0x015A */ s16 broken;
/* 0x015C */ s16 numEffects;
/* 0x015E */ s16 objId;
/* 0x015E */ s16 objectId;
/* 0x0160 */ s16 index; // first or second rupee in two-rupee patterns
/* 0x0162 */ s16 delayTimer; // delay between the two blue rupees appearing
/* 0x0164 */ s16 waitTimer; // time rupee waits before retreating
@ -54,7 +54,7 @@ typedef struct EnGSwitch {
/* 0x0168 */ s16 moveState; // Appear or retreat (for blue rupees and the stationary green one)
/* 0x016A */ s16 noteIndex;
/* 0x016C */ Vec3f targetPos;
/* 0x0178 */ s8 objIndex;
/* 0x0178 */ s8 requiredObjectSlot;
/* 0x017C */ ColliderCylinder collider;
/* 0x01C8 */ EnGSwitchEffect effects[EN_GSWITCH_EFFECT_COUNT];
} EnGSwitch; // size = 0x12F8

View File

@ -15,7 +15,7 @@ void EnGirlA_Update(Actor* thisx, PlayState* play);
void EnGirlA_SetItemOutOfStock(PlayState* play, EnGirlA* this);
void EnGirlA_UpdateStockedItem(PlayState* play, EnGirlA* this);
void EnGirlA_InitializeItemAction(EnGirlA* this, PlayState* play);
void EnGirlA_WaitForObject(EnGirlA* this, PlayState* play);
void EnGirlA_Update2(EnGirlA* this, PlayState* play);
void func_80A3C498(Actor* thisx, PlayState* play, s32 flags);
void EnGirlA_Draw(Actor* thisx, PlayState* play);
@ -387,9 +387,9 @@ void EnGirlA_InitItem(EnGirlA* this, PlayState* play) {
return;
}
this->objBankIndex = Object_GetIndex(&play->objectCtx, shopItemEntries[params].objID);
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, shopItemEntries[params].objID);
if (this->objBankIndex < 0) {
if (this->requiredObjectSlot < 0) {
Actor_Kill(&this->actor);
osSyncPrintf(VT_COL(RED, WHITE));
osSyncPrintf("バンクが無いよ!!(%s)\n", sShopItemDescriptions[params]);
@ -399,7 +399,7 @@ void EnGirlA_InitItem(EnGirlA* this, PlayState* play) {
}
this->actor.params = params;
this->actionFunc2 = EnGirlA_InitializeItemAction;
this->actionFunc2 = EnGirlA_WaitForObject;
}
void EnGirlA_Init(Actor* thisx, PlayState* play) {
@ -976,13 +976,13 @@ s32 EnGirlA_TrySetMaskItemDescription(EnGirlA* this, PlayState* play) {
return false;
}
void EnGirlA_InitializeItemAction(EnGirlA* this, PlayState* play) {
void EnGirlA_WaitForObject(EnGirlA* this, PlayState* play) {
s16 params = this->actor.params;
ShopItemEntry* itemEntry = &shopItemEntries[params];
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
this->actor.flags &= ~ACTOR_FLAG_4;
this->actor.objBankIndex = this->objBankIndex;
this->actor.objectSlot = this->requiredObjectSlot;
switch (this->actor.params) {
case SI_KEATON_MASK:
if (GET_ITEMGETINF(ITEMGETINF_38)) {

View File

@ -15,7 +15,7 @@ typedef struct EnGirlA {
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnGirlAActionFunc actionFunc;
/* 0x0194 */ s8 objBankIndex;
/* 0x0194 */ s8 requiredObjectSlot;
/* 0x0198 */ EnGirlAActionFunc actionFunc2;
/* 0x019C */ s32 isInitialized;
/* 0x01A0 */ s16 itemBuyPromptTextId;

View File

@ -70,9 +70,9 @@ void EnGm_Init(Actor* thisx, PlayState* play) {
// "Medi Goron"
osSyncPrintf(VT_FGCOL(GREEN) "%s[%d] : 中ゴロン[%d]" VT_RST "\n", "../z_en_gm.c", 133, this->actor.params);
this->objGmBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_GM);
this->gmObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_GM);
if (this->objGmBankIndex < 0) {
if (this->gmObjectSlot < 0) {
osSyncPrintf(VT_COL(RED, WHITE));
// "There is no model bank! !! (Medi Goron)"
osSyncPrintf("モデル バンクが無いよ!!(中ゴロン)\n");
@ -102,10 +102,10 @@ s32 func_80A3D7C8(void) {
}
void func_80A3D838(EnGm* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->objGmBankIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->gmObjectSlot)) {
this->actor.flags &= ~ACTOR_FLAG_4;
SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, this->jointTable, this->morphTable, 18);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objGmBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->gmObjectSlot].segment);
Animation_Change(&this->skelAnime, &object_gm_Anim_0002B8, 1.0f, 0.0f,
Animation_GetLastFrame(&object_gm_Anim_0002B8), ANIMMODE_LOOP, 0.0f);
this->actor.draw = EnGm_Draw;
@ -274,7 +274,7 @@ void func_80A3DF60(EnGm* this, PlayState* play) {
}
void func_80A3DFBC(EnGm* this, PlayState* play) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objGmBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->gmObjectSlot].segment);
this->timer++;
this->actionFunc(this, play);
this->actor.focus.rot.x = this->actor.world.rot.x;

View File

@ -17,7 +17,7 @@ typedef struct EnGm {
/* 0x0268 */ EnGmUpdateFunc updateFunc;
/* 0x026C */ EnGmActionFunc actionFunc;
/* 0x0270 */ ColliderCylinder collider;
/* 0x02BC */ s8 objGmBankIndex;
/* 0x02BC */ s8 gmObjectSlot;
/* 0x02BE */ s16 timer;
/* 0x02C0 */ s16 blinkTimer;
/* 0x02C2 */ u8 eyeTexIndex;

View File

@ -55,8 +55,8 @@ void EnGuest_Init(Actor* thisx, PlayState* play) {
if (GET_INFTABLE(INFTABLE_76)) {
Actor_Kill(&this->actor);
} else {
this->osAnimeBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME);
if (this->osAnimeBankIndex < 0) {
this->osAnimeObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_OS_ANIME);
if (this->osAnimeObjectSlot < 0) {
osSyncPrintf(VT_COL(RED, WHITE));
// "No such bank!!"
osSyncPrintf("%s[%d] : バンクが無いよ!!\n", "../z_en_guest.c", 129);
@ -76,13 +76,13 @@ void EnGuest_Update(Actor* thisx, PlayState* play) {
EnGuest* this = (EnGuest*)thisx;
s32 pad;
if (Object_IsLoaded(&play->objectCtx, this->osAnimeBankIndex)) {
if (Object_IsLoaded(&play->objectCtx, this->osAnimeObjectSlot)) {
this->actor.flags &= ~ACTOR_FLAG_4;
Actor_ProcessInitChain(&this->actor, sInitChain);
SkelAnime_InitFlex(play, &this->skelAnime, &object_boj_Skel_0000F0, NULL, this->jointTable, this->morphTable,
16);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment);
Animation_Change(&this->skelAnime, &gObjOsAnim_42AC, 1.0f, 0.0f, Animation_GetLastFrame(&gObjOsAnim_42AC),
ANIMMODE_LOOP, 0.0f);
@ -160,7 +160,7 @@ void func_80A505CC(Actor* thisx, PlayState* play) {
func_80034F54(play, this->unk_2CC, this->unk_2EC, 16);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment);
SkelAnime_Update(&this->skelAnime);
Actor_SetFocus(&this->actor, 60.0f);

View File

@ -20,7 +20,7 @@ typedef struct EnGuest {
/* 0x02CA */ s16 unk_2CA;
/* 0x02CC */ s16 unk_2CC[16];
/* 0x02EC */ s16 unk_2EC[16];
/* 0x030C */ s8 osAnimeBankIndex;
/* 0x030C */ s8 osAnimeObjectSlot;
/* 0x030D */ u8 unk_30D;
/* 0x030E */ u8 unk_30E;
} EnGuest; // size = 0x0310

View File

@ -838,7 +838,7 @@ void EnHeishi2_DrawKingGuard(Actor* thisx, PlayState* play) {
void EnHeishi2_Draw(Actor* thisx, PlayState* play) {
EnHeishi2* this = (EnHeishi2*)thisx;
Mtx* mtx;
s32 linkObjBankIndex;
s32 linkChildObjectSlot;
OPEN_DISPS(play->state.gfxCtx, "../z_en_heishi2.c", 1792);
@ -847,17 +847,17 @@ void EnHeishi2_Draw(Actor* thisx, PlayState* play) {
SkelAnime_DrawOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, EnHeishi2_OverrideLimbDraw,
EnHeishi2_PostLimbDraw, this);
if ((this->type == 5) && GET_INFTABLE(INFTABLE_77)) {
linkObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD);
if (linkObjBankIndex >= 0) {
linkChildObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_LINK_CHILD);
if (linkChildObjectSlot >= 0) {
Matrix_Put(&this->mtxf_330);
Matrix_Translate(-570.0f, 0.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateZ(DEG_TO_RAD(70), MTXMODE_APPLY);
mtx = Matrix_NewMtx(play->state.gfxCtx, "../z_en_heishi2.c", 1820) - 7;
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[linkObjBankIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[linkChildObjectSlot].segment);
gSPSegment(POLY_OPA_DISP++, 0x0D, mtx);
gSPDisplayList(POLY_OPA_DISP++, gLinkChildKeatonMaskDL);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment);
}
}

View File

@ -757,15 +757,15 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) {
this->actor.params &= ~0x8000;
this->type = HORSE_HNI;
if ((this->bankIndex = Object_GetIndex(&play->objectCtx, OBJECT_HNI)) < 0) {
if ((this->hniObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_HNI)) < 0) {
Actor_Kill(&this->actor);
return;
}
do {
} while (!Object_IsLoaded(&play->objectCtx, this->bankIndex));
} while (!Object_IsLoaded(&play->objectCtx, this->hniObjectSlot));
this->actor.objBankIndex = this->bankIndex;
this->actor.objectSlot = this->hniObjectSlot;
Actor_SetObjectDependency(play, &this->actor);
this->boostSpeed = 12;
} else {

View File

@ -97,7 +97,7 @@ typedef struct EnHorse {
/* 0x0150 */ s32 noInputTimer;
/* 0x0154 */ s32 noInputTimerMax;
/* 0x0158 */ s32 type;
/* 0x015C */ s8 bankIndex;
/* 0x015C */ s8 hniObjectSlot;
/* 0x0160 */ Skin skin;
/* 0x01F0 */ u32 stateFlags;
/* 0x01F4 */ Vec3f lastPos;

View File

@ -207,9 +207,9 @@ static AnimationInfo sAnimationInfo[] = {
typedef struct {
/* 0x00 */ u8 headInfoIndex; // EnHyHeadIndex
/* 0x01 */ u8 skelInfoIndex2; // EnHySkeletonIndex, see EnHy.objBankIndexSkel2
/* 0x01 */ u8 skelInfoIndex2; // EnHySkeletonIndex, see EnHy.objectSlotSkel2
/* 0x02 */ Color_RGBA8 envColorSeg8;
/* 0x06 */ u8 skelInfoIndex1; // EnHySkeletonIndex, see EnHy.objBankIndexSkel1
/* 0x06 */ u8 skelInfoIndex1; // EnHySkeletonIndex, see EnHy.objectSlotSkel1
/* 0x07 */ Color_RGBA8 envColorSeg9;
/* 0x0B */ u8 animInfoIndex; // EnHyAnimationIndex
} EnHyModelInfo; // size = 0xC
@ -356,18 +356,18 @@ s32 EnHy_FindSkelAndHeadObjects(EnHy* this, PlayState* play) {
u8 skelInfoIndex2 = sModelInfo[this->actor.params & 0x7F].skelInfoIndex2;
u8 skelInfoIndex1 = sModelInfo[this->actor.params & 0x7F].skelInfoIndex1;
this->objBankIndexSkel1 = Object_GetIndex(&play->objectCtx, sSkeletonInfo[skelInfoIndex1].objectId);
if (this->objBankIndexSkel1 < 0) {
this->objectSlotSkel1 = Object_GetSlot(&play->objectCtx, sSkeletonInfo[skelInfoIndex1].objectId);
if (this->objectSlotSkel1 < 0) {
return false;
}
this->objBankIndexSkel2 = Object_GetIndex(&play->objectCtx, sSkeletonInfo[skelInfoIndex2].objectId);
if (this->objBankIndexSkel2 < 0) {
this->objectSlotSkel2 = Object_GetSlot(&play->objectCtx, sSkeletonInfo[skelInfoIndex2].objectId);
if (this->objectSlotSkel2 < 0) {
return false;
}
this->objBankIndexHead = Object_GetIndex(&play->objectCtx, sHeadInfo[headInfoIndex].objectId);
if (this->objBankIndexHead < 0) {
this->objectSlotHead = Object_GetSlot(&play->objectCtx, sHeadInfo[headInfoIndex].objectId);
if (this->objectSlotHead < 0) {
return false;
}
@ -375,15 +375,15 @@ s32 EnHy_FindSkelAndHeadObjects(EnHy* this, PlayState* play) {
}
s32 EnHy_AreSkelAndHeadObjectsLoaded(EnHy* this, PlayState* play) {
if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexSkel1)) {
if (!Object_IsLoaded(&play->objectCtx, this->objectSlotSkel1)) {
return false;
}
if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexSkel2)) {
if (!Object_IsLoaded(&play->objectCtx, this->objectSlotSkel2)) {
return false;
}
if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexHead)) {
if (!Object_IsLoaded(&play->objectCtx, this->objectSlotHead)) {
return false;
}
@ -391,9 +391,9 @@ s32 EnHy_AreSkelAndHeadObjectsLoaded(EnHy* this, PlayState* play) {
}
s32 EnHy_FindOsAnimeObject(EnHy* this, PlayState* play) {
this->objBankIndexOsAnime = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME);
this->objectSlotOsAnime = Object_GetSlot(&play->objectCtx, OBJECT_OS_ANIME);
if (this->objBankIndexOsAnime < 0) {
if (this->objectSlotOsAnime < 0) {
return false;
}
@ -401,7 +401,7 @@ s32 EnHy_FindOsAnimeObject(EnHy* this, PlayState* play) {
}
s32 EnHy_IsOsAnimeObjectLoaded(EnHy* this, PlayState* play) {
if (!Object_IsLoaded(&play->objectCtx, this->objBankIndexOsAnime)) {
if (!Object_IsLoaded(&play->objectCtx, this->objectSlotOsAnime)) {
return false;
}
@ -898,13 +898,13 @@ void EnHy_Destroy(Actor* thisx, PlayState* play) {
void EnHy_InitImpl(EnHy* this, PlayState* play) {
if (EnHy_IsOsAnimeObjectLoaded(this, play) && EnHy_AreSkelAndHeadObjectsLoaded(this, play)) {
this->actor.objBankIndex = this->objBankIndexSkel1;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->actor.objBankIndex].segment);
this->actor.objectSlot = this->objectSlotSkel1;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment);
SkelAnime_InitFlex(play, &this->skelAnime,
sSkeletonInfo[sModelInfo[this->actor.params & 0x7F].skelInfoIndex1].skeleton, NULL,
this->jointTable, this->morphTable, 16);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 0.0f);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexOsAnime].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sColCylInit);
EnHy_InitCollider(this);
@ -1082,7 +1082,7 @@ void EnHy_Update(Actor* thisx, PlayState* play) {
EnHy* this = (EnHy*)thisx;
if (this->actionFunc != EnHy_InitImpl) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexOsAnime].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotOsAnime].segment);
SkelAnime_Update(&this->skelAnime);
EnHy_UpdateEyes(this);
@ -1110,8 +1110,8 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
OPEN_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2170);
if (limbIndex == 15) {
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objBankIndexHead].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexHead].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlotHead].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotHead].segment);
i = sModelInfo[this->actor.params & 0x7F].headInfoIndex;
*dList = sHeadInfo[i].headDList;
@ -1120,7 +1120,7 @@ s32 EnHy_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(ptr));
}
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexSkel1].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotSkel1].segment);
}
if (limbIndex == 15) {
@ -1155,8 +1155,8 @@ void EnHy_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
OPEN_DISPS(play->state.gfxCtx, "../z_en_hy.c", 2255);
if (limbIndex == 7) {
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objBankIndexSkel2].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndexSkel2].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlotSkel2].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlotSkel2].segment);
}
if ((this->actor.params & 0x7F) == ENHY_TYPE_BOJ_3 && limbIndex == 8) {

View File

@ -39,10 +39,10 @@ typedef struct EnHy {
/* 0x0190 */ EnHyActionFunc actionFunc;
/* 0x0194 */ char unk_194; // unused
/* 0x0195 */ u8 pathReverse;
/* 0x0196 */ s8 objBankIndexHead;
/* 0x0197 */ s8 objBankIndexSkel2; // 7 < limb < 15 (upper part?) (always same as objBankIndexSkel1)
/* 0x0198 */ s8 objBankIndexSkel1; // sets the object used when drawing the skeleton for limb <= 7 (lower part?)
/* 0x0199 */ s8 objBankIndexOsAnime;
/* 0x0196 */ s8 objectSlotHead;
/* 0x0197 */ s8 objectSlotSkel2; // 7 < limb < 15 (upper part?) (always same as objectSlotSkel1)
/* 0x0198 */ s8 objectSlotSkel1; // sets the object used when drawing the skeleton for limb <= 7 (lower part?)
/* 0x0199 */ s8 objectSlotOsAnime;
/* 0x019C */ ColliderCylinder collider;
/* 0x01E8 */ NpcInteractInfo interactInfo;
/* 0x0210 */ Path* path;

View File

@ -928,7 +928,8 @@ void EnIk_PostLimbDrawEnemy(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s*
if (this->armorStatusFlag & ARMOR_BROKEN) {
BodyBreak_SetInfo(&this->bodyBreak, limbIndex, IRON_KNUCKLE_LIMB_CHEST_ARMOR_FRONT,
IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK, IRON_KNUCKLE_LIMB_TORSO, dList, BODYBREAK_OBJECT_DEFAULT);
IRON_KNUCKLE_LIMB_CHEST_ARMOR_BACK, IRON_KNUCKLE_LIMB_TORSO, dList,
BODYBREAK_OBJECT_SLOT_DEFAULT);
}
if (limbIndex == IRON_KNUCKLE_LIMB_HELMET_ARMOR) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_en_ik_inFight.c", 1217),

View File

@ -9,7 +9,7 @@ void EnIn_Destroy(Actor* thisx, PlayState* play);
void EnIn_Update(Actor* thisx, PlayState* play);
void EnIn_Draw(Actor* thisx, PlayState* play);
void func_80A79FB0(EnIn* this, PlayState* play);
void EnIn_WaitForObject(EnIn* this, PlayState* play);
void func_80A7A304(EnIn* this, PlayState* play);
void func_80A7A4C8(EnIn* this, PlayState* play);
void func_80A7A568(EnIn* this, PlayState* play);
@ -481,8 +481,8 @@ void EnIn_Init(Actor* thisx, PlayState* play) {
RespawnData* respawn = &gSaveContext.respawn[RESPAWN_MODE_DOWN];
Vec3f respawnPos;
this->ingoObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_IN);
if (this->ingoObjBankIndex < 0 && this->actor.params > 0) {
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_IN);
if (this->requiredObjectSlot < 0 && this->actor.params > 0) {
this->actionFunc = NULL;
Actor_Kill(&this->actor);
return;
@ -493,21 +493,23 @@ void EnIn_Init(Actor* thisx, PlayState* play) {
gSaveContext.eventInf[EVENTINF_HORSES_INDEX] = 0;
D_80A7B998 = 1;
}
this->actionFunc = func_80A79FB0;
this->actionFunc = EnIn_WaitForObject;
}
void EnIn_Destroy(Actor* thisx, PlayState* play) {
EnIn* this = (EnIn*)thisx;
if (this->actionFunc != NULL && this->actionFunc != func_80A79FB0) {
if (this->actionFunc != NULL && this->actionFunc != EnIn_WaitForObject) {
Collider_DestroyCylinder(play, &this->collider);
}
}
void func_80A79FB0(EnIn* this, PlayState* play) {
// This function does not actually wait since it waits for OBJECT_IN,
// but the object is already loaded at this point from being set in the ActorInit data
void EnIn_WaitForObject(EnIn* this, PlayState* play) {
s32 sp3C = 0;
if (Object_IsLoaded(&play->objectCtx, this->ingoObjBankIndex) || this->actor.params <= 0) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot) || this->actor.params <= 0) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &gIngoSkel, NULL, this->jointTable, this->morphTable, 20);
Collider_InitCylinder(play, &this->collider);
@ -911,7 +913,7 @@ void EnIn_Update(Actor* thisx, PlayState* play) {
ColliderCylinder* collider;
EnIn* this = (EnIn*)thisx;
if (this->actionFunc == func_80A79FB0) {
if (this->actionFunc == EnIn_WaitForObject) {
this->actionFunc(this, play);
return;
}
@ -1000,7 +1002,7 @@ void EnIn_Draw(Actor* thisx, PlayState* play) {
EnIn* this = (EnIn*)thisx;
OPEN_DISPS(play->state.gfxCtx, "../z_en_in.c", 2384);
if (this->actionFunc != func_80A79FB0) {
if (this->actionFunc != EnIn_WaitForObject) {
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[this->eyeIndex]));
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(gIngoHeadGradient2Tex));

View File

@ -38,7 +38,7 @@ typedef struct EnIn {
/* 0x0190 */ EnInActionFunc actionFunc;
/* 0x0194 */ ColliderCylinder collider;
/* 0x01E0 */ f32 unk_1E0;
/* 0x01E4 */ s8 ingoObjBankIndex;
/* 0x01E4 */ s8 requiredObjectSlot;
/* 0x01E6 */ s16 animationIdx;
/* 0x01E8 */ s16 unk_1E8;
/* 0x01EA */ s16 blinkTimer;

View File

@ -259,46 +259,46 @@ s32 EnKo_AreObjectsAvailable(EnKo* this, PlayState* play) {
u8 bodyId = sModelInfo[ENKO_TYPE].bodyId;
u8 legsId = sModelInfo[ENKO_TYPE].legsId;
this->legsObjectBankIdx = Object_GetIndex(&play->objectCtx, sSkeleton[legsId].objectId);
if (this->legsObjectBankIdx < 0) {
this->legsObjectSlot = Object_GetSlot(&play->objectCtx, sSkeleton[legsId].objectId);
if (this->legsObjectSlot < 0) {
return false;
}
this->bodyObjectBankIdx = Object_GetIndex(&play->objectCtx, sSkeleton[bodyId].objectId);
if (this->bodyObjectBankIdx < 0) {
this->bodyObjectSlot = Object_GetSlot(&play->objectCtx, sSkeleton[bodyId].objectId);
if (this->bodyObjectSlot < 0) {
return false;
}
this->headObjectBankIdx = Object_GetIndex(&play->objectCtx, sHead[headId].objectId);
if (this->headObjectBankIdx < 0) {
this->headObjectSlot = Object_GetSlot(&play->objectCtx, sHead[headId].objectId);
if (this->headObjectSlot < 0) {
return false;
}
return true;
}
s32 EnKo_AreObjectsLoaded(EnKo* this, PlayState* play) {
if (!Object_IsLoaded(&play->objectCtx, this->legsObjectBankIdx)) {
if (!Object_IsLoaded(&play->objectCtx, this->legsObjectSlot)) {
return false;
}
if (!Object_IsLoaded(&play->objectCtx, this->bodyObjectBankIdx)) {
if (!Object_IsLoaded(&play->objectCtx, this->bodyObjectSlot)) {
return false;
}
if (!Object_IsLoaded(&play->objectCtx, this->headObjectBankIdx)) {
if (!Object_IsLoaded(&play->objectCtx, this->headObjectSlot)) {
return false;
}
return true;
}
s32 EnKo_IsOsAnimeAvailable(EnKo* this, PlayState* play) {
this->osAnimeBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME);
if (this->osAnimeBankIndex < 0) {
this->osAnimeObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_OS_ANIME);
if (this->osAnimeObjectSlot < 0) {
return false;
}
return true;
}
s32 EnKo_IsOsAnimeLoaded(EnKo* this, PlayState* play) {
if (!Object_IsLoaded(&play->objectCtx, this->osAnimeBankIndex)) {
if (!Object_IsLoaded(&play->objectCtx, this->osAnimeObjectSlot)) {
return false;
}
return true;
@ -1150,12 +1150,12 @@ void EnKo_Destroy(Actor* thisx, PlayState* play) {
void func_80A99048(EnKo* this, PlayState* play) {
if (EnKo_IsOsAnimeLoaded(this, play) && EnKo_AreObjectsLoaded(this, play)) {
this->actor.flags &= ~ACTOR_FLAG_4;
this->actor.objBankIndex = this->legsObjectBankIdx;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->actor.objBankIndex].segment);
this->actor.objectSlot = this->legsObjectSlot;
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->actor.objectSlot].segment);
SkelAnime_InitFlex(play, &this->skelAnime, sSkeleton[sModelInfo[ENKO_TYPE].legsId].flexSkeletonHeader, NULL,
this->jointTable, this->morphTable, 16);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 18.0f);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
@ -1270,7 +1270,7 @@ void EnKo_Update(Actor* thisx, PlayState* play) {
if (this->actionFunc != func_80A99048) {
if ((s32)this->modelAlpha != 0) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->osAnimeBankIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment);
SkelAnime_Update(&this->skelAnime);
func_80A98DB4(this, play);
EnKo_Blink(this);
@ -1302,8 +1302,8 @@ s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
s32 pad;
if (limbIndex == 15) {
gSPSegment((*gfx)++, 0x06, play->objectCtx.status[this->headObjectBankIdx].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->headObjectBankIdx].segment);
gSPSegment((*gfx)++, 0x06, play->objectCtx.slots[this->headObjectSlot].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->headObjectSlot].segment);
headId = sModelInfo[ENKO_TYPE].headId;
*dList = sHead[headId].dList;
@ -1311,7 +1311,7 @@ s32 EnKo_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
eyeTexture = sHead[headId].eyeTextures[this->eyeTextureIndex];
gSPSegment((*gfx)++, 0x0A, SEGMENTED_TO_VIRTUAL(eyeTexture));
}
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->legsObjectBankIdx].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->legsObjectSlot].segment);
}
if (limbIndex == 8) {
limbRot = this->interactInfo.torsoRot;
@ -1338,8 +1338,8 @@ void EnKo_PostLimbDraw(PlayState* play2, s32 limbIndex, Gfx** dList, Vec3s* rot,
Vec3f D_80A9A774 = { 0.0f, 0.0f, 0.0f };
if (limbIndex == 7) {
gSPSegment((*gfx)++, 0x06, play->objectCtx.status[this->bodyObjectBankIdx].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->bodyObjectBankIdx].segment);
gSPSegment((*gfx)++, 0x06, play->objectCtx.slots[this->bodyObjectSlot].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->bodyObjectSlot].segment);
}
if (limbIndex == 15) {
Matrix_MultVec3f(&D_80A9A774, &this->actor.focus.pos);

View File

@ -12,10 +12,10 @@ typedef struct EnKo {
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ EnKoActionFunc actionFunc;
/* 0x0194 */ s8 headObjectBankIdx;
/* 0x0195 */ s8 bodyObjectBankIdx;
/* 0x0196 */ s8 legsObjectBankIdx;
/* 0x0197 */ s8 osAnimeBankIndex;
/* 0x0194 */ s8 headObjectSlot;
/* 0x0195 */ s8 bodyObjectSlot;
/* 0x0196 */ s8 legsObjectSlot;
/* 0x0197 */ s8 osAnimeObjectSlot;
/* 0x0198 */ ColliderCylinder collider;
/* 0x01E4 */ Path* path;
/* 0x01E8 */ NpcInteractInfo interactInfo;

View File

@ -20,7 +20,7 @@ void EnKusa_Update(Actor* thisx, PlayState* play);
void EnKusa_Draw(Actor* thisx, PlayState* play);
void EnKusa_SetupLiftedUp(EnKusa* this);
void EnKusa_SetupWaitObject(EnKusa* this);
void EnKusa_SetupWaitForObject(EnKusa* this);
void EnKusa_SetupMain(EnKusa* this);
void EnKusa_SetupFall(EnKusa* this);
void EnKusa_SetupCut(EnKusa* this);
@ -28,7 +28,7 @@ void EnKusa_SetupUprootedWaitRegrow(EnKusa* this);
void EnKusa_SetupRegrow(EnKusa* this);
void EnKusa_Fall(EnKusa* this, PlayState* play);
void EnKusa_WaitObject(EnKusa* this, PlayState* play);
void EnKusa_WaitForObject(EnKusa* this, PlayState* play);
void EnKusa_Main(EnKusa* this, PlayState* play);
void EnKusa_LiftedUp(EnKusa* this, PlayState* play);
void EnKusa_CutWaitRegrow(EnKusa* this, PlayState* play);
@ -253,16 +253,16 @@ void EnKusa_Init(Actor* thisx, PlayState* play) {
return;
}
this->objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIds[thisx->params & 3]);
this->requiredObjectSlot = Object_GetSlot(&play->objectCtx, sObjectIds[thisx->params & 3]);
if (this->objBankIndex < 0) {
if (this->requiredObjectSlot < 0) {
// "Bank danger!"
osSyncPrintf("Error : バンク危険! (arg_data 0x%04x)(%s %d)\n", thisx->params, "../z_en_kusa.c", 561);
Actor_Kill(&this->actor);
return;
}
EnKusa_SetupWaitObject(this);
EnKusa_SetupWaitForObject(this);
}
void EnKusa_Destroy(Actor* thisx, PlayState* play2) {
@ -272,12 +272,12 @@ void EnKusa_Destroy(Actor* thisx, PlayState* play2) {
Collider_DestroyCylinder(play, &this->collider);
}
void EnKusa_SetupWaitObject(EnKusa* this) {
EnKusa_SetupAction(this, EnKusa_WaitObject);
void EnKusa_SetupWaitForObject(EnKusa* this) {
EnKusa_SetupAction(this, EnKusa_WaitForObject);
}
void EnKusa_WaitObject(EnKusa* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex)) {
void EnKusa_WaitForObject(EnKusa* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->requiredObjectSlot)) {
if (this->actor.flags & ACTOR_FLAG_ENKUSA_CUT) {
EnKusa_SetupCut(this);
} else {
@ -285,7 +285,7 @@ void EnKusa_WaitObject(EnKusa* this, PlayState* play) {
}
this->actor.draw = EnKusa_Draw;
this->actor.objBankIndex = this->objBankIndex;
this->actor.objectSlot = this->requiredObjectSlot;
this->actor.flags &= ~ACTOR_FLAG_4;
}
}

View File

@ -19,7 +19,7 @@ typedef struct EnKusa {
/* 0x014C */ EnKusaActionFunc actionFunc;
/* 0x0150 */ ColliderCylinder collider;
/* 0x019C */ s16 timer;
/* 0x019E */ s8 objBankIndex;
/* 0x019E */ s8 requiredObjectSlot;
} EnKusa; // size = 0x01A0
#endif

View File

@ -394,7 +394,7 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) {
u16 rectLeft;
u16 rectTop;
gSPSegment(gfx++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment);
gSPSegment(gfx++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment);
Gfx_SetupDL_39Ptr(&gfx);

View File

@ -179,7 +179,7 @@ void EnMm_Init(Actor* thisx, PlayState* play) {
this->actor.targetMode = 2;
this->actor.gravity = -1.0f;
this->speedXZ = 3.0f;
this->unk_204 = this->actor.objBankIndex;
this->unk_204 = this->actor.objectSlot;
if (func_80AADA70() == 1) {
this->mouthTexIndex = RM_MOUTH_OPEN;
@ -524,10 +524,10 @@ void EnMm_Draw(Actor* thisx, PlayState* play) {
EnMm_OverrideLimbDraw, EnMm_PostLimbDraw, this);
if (GET_ITEMGETINF(ITEMGETINF_3B)) {
s32 linkChildObjBankIndex = Object_GetIndex(&play->objectCtx, OBJECT_LINK_CHILD);
s32 linkChildObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_LINK_CHILD);
// Draw Bunny Hood
if (linkChildObjBankIndex >= 0) {
if (linkChildObjectSlot >= 0) {
Mtx* mtx;
Vec3s earRot;
Mtx* mtx2;
@ -537,7 +537,7 @@ void EnMm_Draw(Actor* thisx, PlayState* play) {
Matrix_Put(&this->unk_208);
mtx2 = Matrix_NewMtx(play->state.gfxCtx, "../z_en_mm.c", 1111);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[linkChildObjBankIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[linkChildObjectSlot].segment);
gSPSegment(POLY_OPA_DISP++, 0x0B, mtx);
gSPSegment(POLY_OPA_DISP++, 0x0D, mtx2 - 7);
@ -558,7 +558,7 @@ void EnMm_Draw(Actor* thisx, PlayState* play) {
Matrix_ToMtx(mtx, "../z_en_mm.c", 1131);
gSPDisplayList(POLY_OPA_DISP++, gLinkChildBunnyHoodDL);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->actor.objBankIndex].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->actor.objectSlot].segment);
}
}

View File

@ -70,9 +70,9 @@ void EnNiwLady_Init(Actor* thisx, PlayState* play) {
s32 pad;
EnNiwLady* this = (EnNiwLady*)thisx;
this->objectAneIndex = Object_GetIndex(&play->objectCtx, OBJECT_ANE);
this->objectOsAnimeIndex = Object_GetIndex(&play->objectCtx, OBJECT_OS_ANIME);
if ((this->objectOsAnimeIndex < 0) || (this->objectAneIndex < 0)) {
this->aneObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_ANE);
this->osAnimeObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_OS_ANIME);
if ((this->osAnimeObjectSlot < 0) || (this->aneObjectSlot < 0)) {
Actor_Kill(thisx);
return;
}
@ -153,11 +153,11 @@ void func_80AB9F24(EnNiwLady* this, PlayState* play) {
f32 frames;
s32 pad;
if (Object_IsLoaded(&play->objectCtx, this->objectAneIndex) &&
Object_IsLoaded(&play->objectCtx, this->objectOsAnimeIndex)) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectAneIndex].segment);
if (Object_IsLoaded(&play->objectCtx, this->aneObjectSlot) &&
Object_IsLoaded(&play->objectCtx, this->osAnimeObjectSlot)) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->aneObjectSlot].segment);
SkelAnime_InitFlex(play, &this->skelAnime, &gCuccoLadySkel, NULL, this->jointTable, this->morphTable, 16);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectOsAnimeIndex].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment);
this->unk_27E = 1;
this->actor.gravity = -3.0f;
Actor_SetScale(&this->actor, 0.01f);
@ -507,8 +507,8 @@ void EnNiwLady_Update(Actor* thisx, PlayState* play) {
if (this->unk_276 == 0) {
Math_SmoothStepToS(&this->headRot.y, 0, 5, 3000, 0);
}
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objectOsAnimeIndex].segment);
if (this->objectOsAnimeIndex >= 0) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->osAnimeObjectSlot].segment);
if (this->osAnimeObjectSlot >= 0) {
if (this->unk_27E != 0) {
if (this->unk_26E != 0) {
this->unk_26E--;
@ -517,8 +517,8 @@ void EnNiwLady_Update(Actor* thisx, PlayState* play) {
}
SkelAnime_Update(&this->skelAnime);
}
this->objectAneIndex = Object_GetIndex(&play->objectCtx, OBJECT_ANE);
if (this->objectAneIndex >= 0) {
this->aneObjectSlot = Object_GetSlot(&play->objectCtx, OBJECT_ANE);
if (this->aneObjectSlot >= 0) {
this->actionFunc(this, play);
if (this->unusedTimer2 != 0) {
this->unusedTimer2--;

View File

@ -35,8 +35,8 @@ typedef struct EnNiwLady {
/* 0x027A */ s16 unk_27A;
/* 0x027C */ s16 faceState;
/* 0x027E */ s16 unk_27E;
/* 0x0280 */ s8 objectAneIndex;
/* 0x0281 */ s8 objectOsAnimeIndex;
/* 0x0280 */ s8 aneObjectSlot;
/* 0x0281 */ s8 osAnimeObjectSlot;
/* 0x0284 */ s32 getItemId;
/* 0x0288 */ NpcInteractInfo interactInfo;
/* 0x02B0 */ ColliderCylinder collider;

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

View File

@ -549,20 +549,20 @@ void EnOssan_UpdateCameraDirection(EnOssan* this, PlayState* play, f32 cameraFac
s32 EnOssan_TryGetObjBankIndices(EnOssan* this, PlayState* play, s16* objectIds) {
if (objectIds[1] != OBJECT_ID_MAX) {
this->objBankIndex2 = Object_GetIndex(&play->objectCtx, objectIds[1]);
if (this->objBankIndex2 < 0) {
this->objectSlot2 = Object_GetSlot(&play->objectCtx, objectIds[1]);
if (this->objectSlot2 < 0) {
return false;
}
} else {
this->objBankIndex2 = -1;
this->objectSlot2 = -1;
}
if (objectIds[2] != OBJECT_ID_MAX) {
this->objBankIndex3 = Object_GetIndex(&play->objectCtx, objectIds[2]);
if (this->objBankIndex3 < 0) {
this->objectSlot3 = Object_GetSlot(&play->objectCtx, objectIds[2]);
if (this->objectSlot3 < 0) {
return false;
}
} else {
this->objBankIndex3 = -1;
this->objectSlot3 = -1;
}
return true;
}
@ -604,9 +604,9 @@ void EnOssan_Init(Actor* thisx, PlayState* play) {
}
objectIds = sShopkeeperObjectIds[this->actor.params];
this->objBankIndex1 = Object_GetIndex(&play->objectCtx, objectIds[0]);
this->objectSlot1 = Object_GetSlot(&play->objectCtx, objectIds[0]);
if (this->objBankIndex1 < 0) {
if (this->objectSlot1 < 0) {
Actor_Kill(&this->actor);
osSyncPrintf(VT_COL(RED, WHITE));
osSyncPrintf("バンクが無いよ!!(%s)\n", sShopkeeperPrintName[this->actor.params]);
@ -1970,11 +1970,11 @@ void EnOssan_Blink(EnOssan* this) {
}
s32 EnOssan_AreShopkeeperObjectsLoaded(EnOssan* this, PlayState* play) {
if (Object_IsLoaded(&play->objectCtx, this->objBankIndex1)) {
if (this->objBankIndex2 >= 0 && !Object_IsLoaded(&play->objectCtx, this->objBankIndex2)) {
if (Object_IsLoaded(&play->objectCtx, this->objectSlot1)) {
if (this->objectSlot2 >= 0 && !Object_IsLoaded(&play->objectCtx, this->objectSlot2)) {
return false;
}
if (this->objBankIndex3 >= 0 && !Object_IsLoaded(&play->objectCtx, this->objBankIndex3)) {
if (this->objectSlot3 >= 0 && !Object_IsLoaded(&play->objectCtx, this->objectSlot3)) {
return false;
}
return true;
@ -1990,7 +1990,7 @@ void EnOssan_InitBazaarShopkeeper(EnOssan* this, PlayState* play) {
void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gKm1Skel, NULL, NULL, NULL, 0);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment);
Animation_Change(&this->skelAnime, &object_masterkokiri_Anim_0004A8, 1.0f, 0.0f,
Animation_GetLastFrame(&object_masterkokiri_Anim_0004A8), 0, 0.0f);
this->actor.draw = EnOssan_DrawKokiriShopkeeper;
@ -2001,7 +2001,7 @@ void EnOssan_InitKokiriShopkeeper(EnOssan* this, PlayState* play) {
void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gGoronSkel, NULL, NULL, NULL, 0);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment);
Animation_Change(&this->skelAnime, &gGoronShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGoronShopkeeperAnim),
0, 0.0f);
this->actor.draw = EnOssan_DrawGoronShopkeeper;
@ -2010,7 +2010,7 @@ void EnOssan_InitGoronShopkeeper(EnOssan* this, PlayState* play) {
void EnOssan_InitZoraShopkeeper(EnOssan* this, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelAnime, &gZoraSkel, NULL, NULL, NULL, 0);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment);
Animation_Change(&this->skelAnime, &gZoraShopkeeperAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gZoraShopkeeperAnim),
0, 0.0f);
this->actor.draw = EnOssan_DrawZoraShopkeeper;
@ -2103,7 +2103,7 @@ void EnOssan_InitActionFunc(EnOssan* this, PlayState* play) {
if (EnOssan_AreShopkeeperObjectsLoaded(this, play)) {
this->actor.flags &= ~ACTOR_FLAG_4;
this->actor.objBankIndex = this->objBankIndex1;
this->actor.objectSlot = this->objectSlot1;
Actor_SetObjectDependency(play, &this->actor);
this->shelves = (EnTana*)Actor_Find(&play->actorCtx, ACTOR_EN_TANA, ACTORCAT_PROP);
@ -2193,7 +2193,7 @@ void EnOssan_InitActionFunc(EnOssan* this, PlayState* play) {
}
void EnOssan_Obj3ToSeg6(EnOssan* this, PlayState* play) {
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex3].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot3].segment);
}
void EnOssan_MainActionFunc(EnOssan* this, PlayState* play) {
@ -2360,8 +2360,8 @@ s32 EnOssan_OverrideLimbDrawKokiriShopkeeper(PlayState* play, s32 limbIndex, Gfx
OPEN_DISPS(play->state.gfxCtx, "../z_en_oB1.c", 4354);
if (limbIndex == 15) {
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.status[this->objBankIndex2].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->objBankIndex2].segment);
gSPSegment(POLY_OPA_DISP++, 0x06, play->objectCtx.slots[this->objectSlot2].segment);
gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.slots[this->objectSlot2].segment);
*dList = gKokiriShopkeeperHeadDL;
gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sKokiriShopkeeperEyeTextures[this->eyeTextureIdx]));
}

View File

@ -41,9 +41,9 @@ typedef struct EnOssan {
/* 0x0198 */ ColliderCylinder collider; // unused
/* 0x01E4 */ s16 timer;
/* 0x01E6 */ s16 delayTimer;
/* 0x01E8 */ s8 objBankIndex1;
/* 0x01E9 */ s8 objBankIndex2;
/* 0x01EA */ s8 objBankIndex3;
/* 0x01E8 */ s8 objectSlot1;
/* 0x01E9 */ s8 objectSlot2;
/* 0x01EA */ s8 objectSlot3;
/* 0x01EB */ u8 happyMaskShopState;
/* 0x01EC */ u8 happyMaskShopkeeperEyeIdx;
/* 0x01EE */ s16 headRot;

Some files were not shown because too many files have changed in this diff Show More