Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc/Cleanup pass on object handling #1227

Merged
merged 64 commits into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
38ef5fb
`Object_InitBank` -> `Object_InitContext`
Dragorn421 May 16, 2022
272127b
Add and use `OBJECT_SPACE_SIZE_BASE`
Dragorn421 May 16, 2022
7c27866
Remove `OBJECT_EXCHANGE_BANK_MAX` -> use `ARRAY_COUNT()` instead
Dragorn421 May 16, 2022
f11e94c
"object status" -> "object load entry"
Dragorn421 May 16, 2022
a754da8
Misc. cleanup/renames
Dragorn421 May 16, 2022
9c68dd7
Partial docs and way too much batch renaming and cleanup for a single…
Dragorn421 May 16, 2022
9a61426
Merge commit '154f44b6da6e0b9be69886ec8d8a5a8ea2f4791e' into doc_obje…
Dragorn421 May 21, 2022
9dbb69a
ctrl shift h
Dragorn421 May 21, 2022
f50eb25
format
Dragorn421 May 21, 2022
5a8536f
Merge branch 'master' into doc_object_handling (hopefully correctly)
Dragorn421 May 22, 2022
6c082ee
format clang-11.1
Dragorn421 May 22, 2022
acd71e1
fix regressions
Dragorn421 May 22, 2022
7f88470
Improve a `@bug` comment
Dragorn421 May 22, 2022
61ffd1a
Merge branch 'master' into doc_object_handling
Dragorn421 Jun 7, 2022
a978eb5
Move `OBJECT_SPACE_SIZE_BASE` from header to near `Object_InitContext`
Dragorn421 Jun 7, 2022
64ed3a5
"objectID" -> "objectId"
Dragorn421 Jun 7, 2022
834fa9e
Revert iterator index to `i` in `Actor_KillActorsWithUnloadedObject`
Dragorn421 Jun 7, 2022
e60fe06
"object load entry index" -> "object entry"
Dragorn421 Jun 7, 2022
42fee45
`Object_UpdateLoadEntries` -> `Object_UpdateEntries`
Dragorn421 Jun 7, 2022
dee477d
Run format.sh
Dragorn421 Jun 7, 2022
3b0bb51
"object entry" -> "object slot" (except internal usage)
Dragorn421 Jun 9, 2022
30a2d60
Proper `Object_SpawnPersistent` doc
Dragorn421 Jun 9, 2022
3f1026e
fixup one comment "object bank index" -> "object slot"
Dragorn421 Jun 9, 2022
45439d1
Amend `Object_SpawnPersistent` comment to mention running out of free…
Dragorn421 Jun 9, 2022
f7911c9
`Actor_KillActorsWithUnloadedObject` -> `Actor_KillAllWithMissingObject`
Dragorn421 Jun 9, 2022
f0ef19c
Remove useless mention of what uses `Object_SpawnPersistent`
Dragorn421 Jun 9, 2022
14165de
Merge branch 'master' into doc_object_handling
Dragorn421 Jun 9, 2022
87834ad
Merge branch 'master' into doc_object_handling
Dragorn421 Jun 15, 2022
9b5a847
Fix mistake on `Object_SpawnPersistent` doing sync dma, not async
Dragorn421 Jun 16, 2022
0966905
Merge branch 'master' into doc_object_handling
Dragorn421 Jun 16, 2022
6e0a412
Merge branch 'master' into doc_object_handling
Dragorn421 Jul 30, 2022
7aa086b
run formatter
Dragorn421 Jul 30, 2022
ba32856
Merge branch 'master' into doc_object_handling
Dragorn421 Jul 31, 2022
167ba84
Merge branch 'master' into doc_object_handling
Dragorn421 Aug 2, 2022
f9b350e
Merge branch 'master' into doc_object_handling
Dragorn421 Aug 21, 2022
4d062f4
`Object_InitContext` -> `Object_Init`
Dragorn421 Aug 21, 2022
2c754d8
`waitObjectSlot` -> `requiredObjectSlot`
Dragorn421 Aug 21, 2022
9e9a97a
Merge branch 'master' into doc_object_handling
Dragorn421 Aug 30, 2022
edef882
Merge branch 'master' into doc_object_handling
Dragorn421 Aug 30, 2022
903c4d6
Merge branch 'master' into doc_object_handling
Dragorn421 Aug 31, 2022
4f763b2
`Object_Init` -> `func_80097DD8`
Dragorn421 Sep 1, 2022
a2035c4
Merge branch 'master' into doc_object_handling
Dragorn421 Sep 1, 2022
39532ce
Merge branch 'master' into doc_object_handling
Dragorn421 Sep 4, 2022
dcbbe7e
Merge branch 'master' into doc_object_handling
Dragorn421 Oct 4, 2022
1a411a1
Merge branch 'master' into doc_object_handling
Dragorn421 Oct 11, 2022
4a41b85
Merge branch 'master' into doc_object_handling
Dragorn421 Oct 15, 2022
26c26f9
Merge branch 'master' into doc_object_handling
Dragorn421 Oct 23, 2022
189581d
Merge branch 'master' into doc_object_handling
Dragorn421 Oct 28, 2022
b336b99
one objectIndex -> objectSlot
Dragorn421 Oct 28, 2022
c091c61
Merge branch 'master' into doc_object_handling
Dragorn421 Nov 14, 2022
ebbcdad
Merge branch 'master' into doc_object_handling
Dragorn421 Nov 17, 2022
263b69a
Remove `OBJECT_SPACE_SIZE_BASE`
Dragorn421 Nov 17, 2022
1350749
Merge branch 'master' into doc_object_handling
Dragorn421 Nov 30, 2022
9e274f7
Merge branch 'master' into doc_object_handling
Dragorn421 Dec 8, 2022
55ec21b
Merge branch 'master' into doc_object_handling
Dragorn421 Dec 11, 2022
580e568
Merge branch 'master' into doc_object_handling
Dragorn421 Dec 13, 2022
255d156
Merge branch 'master' into doc_object_handling
Dragorn421 Dec 19, 2022
6f5eaca
Merge branch 'master' into doc_object_handling
Dragorn421 Dec 26, 2022
ab34e59
Merge branch 'master' into doc_object_handling
Dragorn421 Dec 30, 2022
1f1c73d
Merge branch 'master' into doc_object_handling
Dragorn421 Jan 13, 2023
b6036bb
Merge branch 'master' into doc_object_handling
Dragorn421 Aug 15, 2023
686c980
Merge branch 'master' into doc_object_handling
Dragorn421 Sep 19, 2023
3262185
light fix on the merge (rm OBJECT_EXCHANGE_BANK_MAX)
Dragorn421 Sep 19, 2023
8d1a1ea
`func_80097DD8` -> `Object_InitContext`
Dragorn421 Sep 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ void func_800304DC(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEnt
void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx);
s32 func_800314D4(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3);
void func_800315AC(PlayState* play, ActorContext* actorCtx);
void func_80031A28(PlayState* play, ActorContext* actorCtx);
void Actor_KillActorsWithUnloadedObject(PlayState* play, ActorContext* actorCtx);
Dragorn421 marked this conversation as resolved.
Show resolved Hide resolved
void func_80031B14(PlayState* play, ActorContext* actorCtx);
void func_80031C3C(ActorContext* actorCtx, PlayState* play);
Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ,
Expand Down Expand Up @@ -1175,11 +1175,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);
Expand Down
12 changes: 6 additions & 6 deletions include/z64.h
Original file line number Diff line number Diff line change
Expand Up @@ -828,16 +828,16 @@ typedef struct {
/* 0x08 */ DmaRequest dmaRequest;
/* 0x28 */ OSMesgQueue loadQueue;
/* 0x40 */ OSMesg loadMsg;
} ObjectStatus; // size = 0x44
} 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];
/* 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

typedef struct {
Expand Down
6 changes: 3 additions & 3 deletions include/z64actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,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. Sound plays when value is set, then is cleared the following update cycle
/* 0x024 */ PosRot world; // Position/rotation in the world
Expand Down Expand Up @@ -228,14 +228,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

Expand Down
2 changes: 1 addition & 1 deletion include/z64effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions include/z64object.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
#ifndef Z64OBJECT_H
#define Z64OBJECT_H

#define OBJECT_EXCHANGE_BANK_MAX 19

#define DEFINE_OBJECT(_0, enum) enum,
#define DEFINE_OBJECT_NULL(_0, enum) enum,
#define DEFINE_OBJECT_UNSET(enum) enum,

typedef enum {
#include "tables/object_table.h"
/* 0x0192 */ OBJECT_ID_MAX
} ObjectID;
} ObjectId;

#undef DEFINE_OBJECT
#undef DEFINE_OBJECT_NULL
Expand Down
60 changes: 30 additions & 30 deletions src/code/z_actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,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) {
Expand All @@ -817,7 +817,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;
Expand Down Expand Up @@ -2066,13 +2066,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 ((unkFlag && !(actor->flags & unkFlag)) ||
Expand Down Expand Up @@ -2194,8 +2194,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 };
Expand Down Expand Up @@ -2482,14 +2482,14 @@ void func_800315AC(PlayState* play, ActorContext* actorCtx) {
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 6563);
}

void func_80031A28(PlayState* play, ActorContext* actorCtx) {
void Actor_KillActorsWithUnloadedObject(PlayState* play, ActorContext* actorCtx) {
Actor* actor;
s32 i;

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;
Expand Down Expand Up @@ -2661,7 +2661,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos
s32 pad;
Actor* actor;
ActorInit* actorInit;
s32 objBankIndex;
s32 objectSlot;
ActorOverlay* overlayEntry;
u32 temp;
char* name;
Expand Down Expand Up @@ -2740,13 +2740,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;
}
Expand Down Expand Up @@ -2776,10 +2776,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;
Expand Down Expand Up @@ -3067,7 +3067,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);
Expand All @@ -3077,13 +3077,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;
}
Expand All @@ -3098,20 +3098,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++;
}

Expand All @@ -3131,7 +3131,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;
Expand All @@ -3143,17 +3143,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);
Expand All @@ -3168,7 +3168,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;
}
Expand Down Expand Up @@ -4146,7 +4146,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.speedXZ = arg3[0];
Expand Down
6 changes: 3 additions & 3 deletions src/code/z_effect_soft_sprite_old_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) {
MtxF mfTrans11DA0;
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);

Expand All @@ -58,8 +58,8 @@ void EffectSs_DrawGEffect(PlayState* play, EffectSs* this, void* texture) {
SkinMatrix_SetScale(&mfScale, scale, scale, scale);
SkinMatrix_MtxFMtxFMult(&mfTrans, &play->billboardMtxF, &mfTrans11DA0);
SkinMatrix_MtxFMtxFMult(&mfTrans11DA0, &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);

Expand Down
12 changes: 6 additions & 6 deletions src/code/z_en_item00.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -763,10 +763,10 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) {
case ITEM00_HEART:
if (this->unk_15A < 0) {
if (this->unk_15A == -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->unk_15A = -2;
}
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_kankyo.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 unused)
play->csCtx.npcActions[i] = 0;
}

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);
Expand Down
Loading