diff --git a/assets/xml/objects/object_box.xml b/assets/xml/objects/object_box.xml index 39d21765f7..6312622f7c 100644 --- a/assets/xml/objects/object_box.xml +++ b/assets/xml/objects/object_box.xml @@ -1,29 +1,29 @@  - - + + - - - - - - - - - - - - + + + + + + + + + + + + - + - + @@ -43,10 +43,10 @@ - - - + + + - + diff --git a/include/functions.h b/include/functions.h index 3c20bca11c..0277ead11b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -798,7 +798,7 @@ void func_800BE3D0(Actor* actor, s16 angle, Vec3s* arg2); void func_800BE504(Actor* actor, ColliderCylinder* collider); void func_800BE568(Actor* actor, ColliderSphere* collider); void func_800BE5CC(Actor* actor, ColliderJntSph* collider, s32 colliderIndex); -s32 func_800BE63C(struct EnBox* chest); +s32 Actor_IsSmallChest(struct EnBox* chest); void func_800BE680(GlobalContext* globalCtx, Actor* actor, Vec3f limbPos[], s16 arg3, f32 effectScale, f32 steamScale, f32 effectAlpha, u8 mode); void Actor_SpawnIceEffects(GlobalContext* globalCtx, Actor* actor, Vec3f limbPos[], s32 limbPosCount, s32 effectsPerLimb, f32 scale, f32 scaleRange); diff --git a/include/z64item.h b/include/z64item.h index 8b436bbf10..d7c802d70e 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -278,6 +278,7 @@ typedef enum { /* 0x0A */ GI_RECOVERY_HEART, /* 0x0C */ GI_HEART_PIECE = 0x0C, /* 0x0D */ GI_HEART_CONTAINER, + /* 0x11 */ GI_STRAY_FAIRY = 0x11, /* 0x16 */ GI_BOMBS_10 = 0x16, /* 0x19 */ GI_STICKS_1 = 0x19, /* 0x1A */ GI_BOMBCHUS_10, @@ -297,22 +298,24 @@ typedef enum { /* 0x33 */ GI_SHIELD_MIRROR, /* 0x35 */ GI_MAGIC_BEANS = 0x35, /* 0x3C */ GI_KEY_SMALL = 0x3C, - /* 0x3E */ GI_MAP = 0x3E, + /* 0x3D */ GI_KEY_BOSS, + /* 0x3E */ GI_MAP, /* 0x3F */ GI_COMPASS, /* 0x52 */ GI_SCALE_GOLD = 0x52, // Assumed, used in En_Fishing /* 0x59 */ GI_BOTTLE_POTION_RED = 0x59, - /* 0x5A */ GI_5A, - /* 0x5B */ GI_POTION_RED = 0x5B, + /* 0x5A */ GI_BOTTLE, + /* 0x5B */ GI_POTION_RED, /* 0x5C */ GI_POTION_GREEN, /* 0x5D */ GI_POTION_BLUE, /* 0x5E */ GI_FAIRY, /* 0x60 */ GI_MILK_BOTTLE = 0x60, + /* 0x76 */ GI_ICE_TRAP = 0x76, /* 0x78 */ GI_MASK_DEKU = 0x78, /* 0x79 */ GI_MASK_GORON, /* 0x7A */ GI_MASK_ZORA, /* 0x7B */ GI_MASK_FIERCE_DEITY, - /* 0x7C */ GI_MASK_TRUTH, - /* 0x7D */ GI_MASK_KAFEIS_MASK, + /* 0x7C */ GI_MASK_CAPTAIN, + /* 0x7D */ GI_MASK_GIANT, /* 0x7E */ GI_MASK_ALL_NIGHT, /* 0x7F */ GI_MASK_BUNNY, /* 0x80 */ GI_MASK_KEATON, @@ -325,26 +328,31 @@ typedef enum { /* 0x87 */ GI_MASK_GIBDO, /* 0x88 */ GI_MASK_DON_GERO, /* 0x89 */ GI_MASK_KAMARO, - /* 0x8A */ GI_MASK_CAPTAIN, + /* 0x8A */ GI_MASK_TRUTH, /* 0x8B */ GI_MASK_STONE, /* 0x8C */ GI_MASK_BREMEN, /* 0x8D */ GI_MASK_BLAST, /* 0x8E */ GI_MASK_SCENTS, - /* 0x8F */ GI_MASK_GIANT, - /* 0x92 */ GI_MILK = 0x92, - /* 0x96 */ GI_MOON_TEAR = 0x96, + /* 0x8F */ GI_MASK_KAFEIS_MASK, + /* 0x91 */ GI_CHATEAU = 0x91, + /* 0x92 */ GI_MILK, + /* 0x93 */ GI_GOLD_DUST, + /* 0x94 */ GI_EEL, //Unused bottled eel + /* 0x95 */ GI_SEAHORSE, + /* 0x96 */ GI_MOON_TEAR, /* 0x97 */ GI_DEED_LAND, /* 0x98 */ GI_DEED_SWAMP, /* 0x99 */ GI_DEED_MOUNTAIN, /* 0x9A */ GI_DEED_OCEAN, - /* 0x9B */ GI_SWORD_GREAT_FAIRY = 0x9B, + /* 0x9B */ GI_SWORD_GREAT_FAIRY, /* 0x9C */ GI_SWORD_KOKIRI, /* 0x9D */ GI_SWORD_RAZOR, /* 0x9E */ GI_SWORD_GILDED, /* 0x9F */ GI_SHIELD_HERO_2, // Code that treats this as hero's shield is unused, so take with a grain of salt /* 0xA1 */ GI_LETTER_TO_MAMA = 0xA1, - /* 0xA9 */ GI_BOTTLE = 0xA9, - /* 0xAB */ GI_PENDANT_OF_MEMORIES = 0xAB, + /* 0xA9 */ GI_BOTTLE_STOLEN = 0xA9, // buy back stolen bottle + /* 0xAA */ GI_LETTER_TO_KAFEI, + /* 0xAB */ GI_PENDANT_OF_MEMORIES, /* 0xBA */ GI_MAX = 0xBA } GetItemID; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 80e4ed697e..751562a82a 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2003,11 +2003,11 @@ s32 Actor_PickUp(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRa if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { if ((actor->xzDistToPlayer <= xzRange) && (fabsf(actor->playerHeightRel) <= fabsf(yRange))) { - if (((getItemId == GI_MASK_CIRCUS_LEADER) || (getItemId == GI_PENDANT_OF_MEMORIES) || - (getItemId == GI_DEED_LAND) || - (((player->heldActor != NULL) || (actor == player->targetActor)) && + if ((getItemId == GI_MASK_CIRCUS_LEADER || getItemId == GI_PENDANT_OF_MEMORIES || + getItemId == GI_DEED_LAND || + ((player->heldActor != NULL || actor == player->targetActor) && (getItemId > GI_NONE && getItemId < GI_MAX))) || - (!(player->stateFlags1 & 0x20000800))) { + !(player->stateFlags1 & 0x20000800)) { s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y; s32 absYawDiff = ABS_ALT(yawDiff); @@ -4438,9 +4438,10 @@ void func_800BE5CC(Actor* actor, ColliderJntSph* collider, s32 colliderIndex) { } } -s32 func_800BE63C(struct EnBox* chest) { - if (chest->type == 5 || chest->type == 6 || chest->type == 7 || chest->type == 8 || - chest->type == 0xC) { +s32 Actor_IsSmallChest(struct EnBox* chest) { + if (chest->type == ENBOX_TYPE_SMALL || chest->type == ENBOX_TYPE_SMALL_INVISIBLE || + chest->type == ENBOX_TYPE_SMALL_ROOM_CLEAR || chest->type == ENBOX_TYPE_SMALL_SWITCH_FLAG_FALL || + chest->type == ENBOX_TYPE_SMALL_SWITCH_FLAG) { return true; } return false; diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 98e6b06c58..0eb142cfe5 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -79,8 +79,8 @@ typedef struct { EnBox_PlaybackSpeed sPlaybackSpeed = { { 1.5f, 1.0f, 1.5f, 1.0f, 1.5f } }; AnimationHeader* sAnimations[5] = { - &object_box_Anim_00024C, &object_box_Anim_007E54, &object_box_Anim_00024C, - &object_box_Anim_007F30, &object_box_Anim_000128, + &gBoxChestOpenAdultAnim, &gBoxChestOpenGoronAnim, &gBoxChestOpenAdultAnim, + &gBoxChestOpenDekuAnim, &gBoxChestOpenChildAnim, }; void EnBox_SetupAction(EnBox* this, EnBoxActionFunc func) { @@ -98,17 +98,17 @@ void func_80867BDC(func_80867BDC_a0* arg0, GlobalContext* globalCtx, Vec3f* pos) void func_80867C14(func_80867BDC_a0* arg0, GlobalContext* globalCtx) { arg0->unk_18++; - if (arg0->unk_18 > 0x55) { - arg0->unk_18 = 0x55; + if (arg0->unk_18 > 85) { + arg0->unk_18 = 85; } - if (arg0->unk_18 != 0x55) { - arg0->unk_1C = arg0->unk_18 - 0x1C; - if (arg0->unk_18 - 0x1C < 0) { + if (arg0->unk_18 != 85) { + arg0->unk_1C = arg0->unk_18 - 28; + if (arg0->unk_18 - 28 < 0) { arg0->unk_1C = 0; } } else { arg0->unk_1C++; - if (arg0->unk_1C > 0x55) { + if (arg0->unk_1C > 85) { func_80867FE4(arg0, globalCtx); } } @@ -198,16 +198,16 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) { animFrameEnd = Animation_GetLastFrame(&object_box_Anim_00043C); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 0); - CollisionHeader_GetVirtual(&object_box_Colheader_0080E8, &colHeader); + CollisionHeader_GetVirtual(&gBoxChestCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); this->movementFlags = 0; - this->type = (this->dyna.actor.params >> 0xC) & 0xF; + this->type = ENBOX_GET_TYPE(&this->dyna.actor); this->iceSmokeTimer = 0; this->unk_1F3 = 0; this->dyna.actor.gravity = -5.5f; this->dyna.actor.terminalVelocity = -50.0f; - this->switchFlag = this->dyna.actor.world.rot.z; + this->switchFlag = ENBOX_GET_SWITCH_FLAG(&this->dyna.actor); this->dyna.actor.floorHeight = this->dyna.actor.world.pos.y; if (this->dyna.actor.world.rot.x == 180) { this->movementFlags |= ENBOX_MOVE_0x80; @@ -219,15 +219,15 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) { this->dyna.actor.world.rot.x = 0; } thisx->shape.rot.x = this->dyna.actor.world.rot.x; - this->getItem = (thisx->params >> 5) & 0x7F; + this->getItem = ENBOX_GET_ITEM(thisx); - if (Flags_GetTreasure(globalCtx, (this->dyna.actor.params & 0x1F)) || this->getItem == 0) { + if (Flags_GetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor)) || this->getItem == GI_NONE) { this->alpha = 255; this->iceSmokeTimer = 100; EnBox_SetupAction(this, EnBox_Open); this->movementFlags |= ENBOX_MOVE_STICK_TO_GROUND; animFrame = animFrameEnd; - } else if ((this->type == ENBOX_TYPE_SWITCH_FLAG_FALL_BIG || this->type == ENBOX_TYPE_SWITCH_FLAG_FALL_SMALL) && + } else if ((this->type == ENBOX_TYPE_BIG_SWITCH_FLAG_FALL || this->type == ENBOX_TYPE_SMALL_SWITCH_FLAG_FALL) && !Flags_GetSwitch(globalCtx, this->switchFlag)) { func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); if (Rand_ZeroOne() < 0.5f) { @@ -237,8 +237,8 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) { EnBox_SetupAction(this, EnBox_FallOnSwitchFlag); this->alpha = 0; this->movementFlags |= ENBOX_MOVE_IMMOBILE; - this->dyna.actor.flags |= 0x10; - } else if ((this->type == ENBOX_TYPE_ROOM_CLEAR_BIG || this->type == ENBOX_TYPE_ROOM_CLEAR_SMALL) && + this->dyna.actor.flags |= ACTOR_FLAG_10; + } else if ((this->type == ENBOX_TYPE_BIG_ROOM_CLEAR || this->type == ENBOX_TYPE_SMALL_ROOM_CLEAR) && !Flags_GetClear(globalCtx, this->dyna.actor.room)) { EnBox_SetupAction(this, EnBox_AppearOnRoomClear); func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); @@ -249,10 +249,10 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) { } this->alpha = 0; this->movementFlags |= ENBOX_MOVE_IMMOBILE; - this->dyna.actor.flags |= 0x10; - } else if (this->type == ENBOX_TYPE_9 || this->type == ENBOX_TYPE_10) { + this->dyna.actor.flags |= ACTOR_FLAG_10; + } else if (this->type == ENBOX_TYPE_BIG_SONG_ZELDAS_LULLABY || this->type == ENBOX_TYPE_BIG_SONG_SUNS) { - } else if ((this->type == ENBOX_TYPE_SWITCH_FLAG_BIG || this->type == ENBOX_TYPE_12) && + } else if ((this->type == ENBOX_TYPE_BIG_SWITCH_FLAG || this->type == ENBOX_TYPE_SMALL_SWITCH_FLAG) && !Flags_GetSwitch(globalCtx, this->switchFlag)) { EnBox_SetupAction(this, EnBox_AppearSwitchFlag); func_800C62BC(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); @@ -263,27 +263,27 @@ void EnBox_Init(Actor* thisx, GlobalContext* globalCtx) { } this->alpha = 0; this->movementFlags |= ENBOX_MOVE_IMMOBILE; - this->dyna.actor.flags |= 0x10; + this->dyna.actor.flags |= ACTOR_FLAG_10; } else { - if (this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6) { - this->dyna.actor.flags |= 0x80; + if (this->type == ENBOX_TYPE_BIG_INVISIBLE || this->type == ENBOX_TYPE_SMALL_INVISIBLE) { + this->dyna.actor.flags |= ACTOR_FLAG_80; } EnBox_SetupAction(this, EnBox_WaitOpen); this->movementFlags |= ENBOX_MOVE_IMMOBILE; this->movementFlags |= ENBOX_MOVE_STICK_TO_GROUND; } - if (this->getItem == 0x11 && !Flags_GetTreasure(globalCtx, this->dyna.actor.params & 0x1F)) { - this->dyna.actor.flags |= 0x10; + if (this->getItem == GI_STRAY_FAIRY && !Flags_GetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { + this->dyna.actor.flags |= ACTOR_FLAG_10; } this->dyna.actor.shape.rot.y += 0x8000; this->dyna.actor.home.rot.z = this->dyna.actor.world.rot.z = this->dyna.actor.shape.rot.z = 0; - SkelAnime_Init(globalCtx, &this->skelAnime, &object_box_Skel_0066A0, &object_box_Anim_00043C, this->jointTable, + SkelAnime_Init(globalCtx, &this->skelAnime, &gBoxChestSkel, &object_box_Anim_00043C, this->jointTable, this->morphTable, 5); Animation_Change(&this->skelAnime, &object_box_Anim_00043C, 1.5f, animFrame, animFrameEnd, 2, 0.0f); - if (func_800BE63C(this) != 0) { + if (Actor_IsSmallChest(this)) { Actor_SetScale(&this->dyna.actor, 0.0075f); Actor_SetFocus(&this->dyna.actor, 20.0f); } else { @@ -353,7 +353,7 @@ void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) { } else { this->movementFlags |= ENBOX_MOVE_FALL_ANGLE_SIDE; } - if (this->type == ENBOX_TYPE_SWITCH_FLAG_FALL_BIG) { + if (this->type == ENBOX_TYPE_BIG_SWITCH_FLAG_FALL) { this->dyna.actor.velocity.y = -this->dyna.actor.velocity.y * 0.55f; } else { this->dyna.actor.velocity.y = -this->dyna.actor.velocity.y * 0.65f; @@ -485,32 +485,32 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { func_801A3098(0x2B | 0x900); } - if (this->getItem == 0x11) { + if (this->getItem == GI_STRAY_FAIRY) { this->movementFlags |= ENBOX_MOVE_0x20; } else { - if (this->getItem == GI_HEART_PIECE || this->getItem == GI_5A) { + if (this->getItem == GI_HEART_PIECE || this->getItem == GI_BOTTLE) { Flags_SetCollectible(globalCtx, this->collectableFlag); } - Flags_SetTreasure(globalCtx, this->dyna.actor.params & 0x1F); + Flags_SetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor)); } } else { player = GET_PLAYER(globalCtx); Actor_OffsetOfPointInActorCoords(&this->dyna.actor, &offset, &player->actor.world.pos); if (offset.z > -50.0f && offset.z < 0.0f && fabsf(offset.y) < 10.0f && fabsf(offset.x) < 20.0f && Player_IsFacingActor(&this->dyna.actor, 0x3000, globalCtx)) { - if ((this->getItem == GI_HEART_PIECE || this->getItem == GI_5A) && + if ((this->getItem == GI_HEART_PIECE || this->getItem == GI_BOTTLE) && Flags_GetCollectible(globalCtx, this->collectableFlag)) { this->getItem = GI_RECOVERY_HEART; } - if (this->getItem == 0x7C && INV_CONTENT(ITEM_MASK_CAPTAIN) == ITEM_MASK_CAPTAIN) { + if (this->getItem == GI_MASK_CAPTAIN && INV_CONTENT(ITEM_MASK_CAPTAIN) == ITEM_MASK_CAPTAIN) { this->getItem = GI_RECOVERY_HEART; } - if (this->getItem == 0x7D && INV_CONTENT(ITEM_MASK_GIANT) == ITEM_MASK_GIANT) { + if (this->getItem == GI_MASK_GIANT && INV_CONTENT(ITEM_MASK_GIANT) == ITEM_MASK_GIANT) { this->getItem = GI_RECOVERY_HEART; } Actor_PickUpNearby(&this->dyna.actor, globalCtx, -this->getItem); } - if (Flags_GetTreasure(globalCtx, this->dyna.actor.params & 0x1F)) { + if (Flags_GetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { EnBox_SetupAction(this, EnBox_Open); } } @@ -519,7 +519,7 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { void EnBox_Open(EnBox* this, GlobalContext* globalCtx) { s32 pad; - this->dyna.actor.flags &= ~0x80; + this->dyna.actor.flags &= ~ACTOR_FLAG_80; if (SkelAnime_Update(&this->skelAnime) != 0) { if (this->unk_1EC > 0) { @@ -538,7 +538,7 @@ void EnBox_Open(EnBox* this, GlobalContext* globalCtx) { Actor_SpawnAsChild(&globalCtx->actorCtx, &this->dyna.actor, globalCtx, ACTOR_EN_ELFORG, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z, - (((this->dyna.actor.params & 0x1F) & 0x7F) << 9) | STRAY_FAIRY_TYPE_CHEST); + ((ENBOX_GET_CHEST_FLAG(&this->dyna.actor) & 0x7F) << 9) | STRAY_FAIRY_TYPE_CHEST); } else if (this->movementFlags & ENBOX_MOVE_0x40) { this->movementFlags &= ~ENBOX_MOVE_0x40; } @@ -602,7 +602,7 @@ void EnBox_Update(Actor* thisx, GlobalContext* globalCtx) { this->movementFlags &= ~ENBOX_MOVE_STICK_TO_GROUND; EnBox_ClipToGround(this, globalCtx); } - if (this->getItem == 0x11 && !Flags_GetTreasure(globalCtx, this->dyna.actor.params & 0x1F)) { + if (this->getItem == GI_STRAY_FAIRY && !Flags_GetTreasure(globalCtx, ENBOX_GET_CHEST_FLAG(&this->dyna.actor))) { globalCtx->actorCtx.unk5 |= 8; } this->actionFunc(this, globalCtx); @@ -614,7 +614,7 @@ void EnBox_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 0x1C); } Actor_SetFocus(&this->dyna.actor, 40.0f); - if (this->getItem == 0x76 && this->actionFunc == EnBox_Open && this->skelAnime.curFrame > 45.0f && + if (this->getItem == GI_ICE_TRAP && this->actionFunc == EnBox_Open && this->skelAnime.curFrame > 45.0f && this->iceSmokeTimer < 100) { EnBox_SpawnIceSmoke(this, globalCtx); } @@ -629,29 +629,29 @@ void EnBox_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve if (limbIndex == 1) { gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (this->type == ENBOX_TYPE_DECORATED_BIG) { - gSPDisplayList((*gfx)++, &object_box_DL_000DB0); - } else if (func_800BE63C(this) != 0) { - if (this->getItem == 0x3C) { - gSPDisplayList((*gfx)++, &object_box_DL_000A50); + if (this->type == ENBOX_TYPE_BIG_ORNATE) { + gSPDisplayList((*gfx)++, &gBoxChestBaseOrnateDL); + } else if (Actor_IsSmallChest(this)) { + if (this->getItem == GI_KEY_SMALL) { + gSPDisplayList((*gfx)++, &gBoxChestBaseGildedDL); } else { - gSPDisplayList((*gfx)++, &object_box_DL_0006F0); + gSPDisplayList((*gfx)++, &gBoxChestBaseDL); } } else { - gSPDisplayList((*gfx)++, &object_box_DL_000A50); + gSPDisplayList((*gfx)++, &gBoxChestBaseGildedDL); } } else if (limbIndex == 3) { gSPMatrix((*gfx)++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (this->type == ENBOX_TYPE_DECORATED_BIG) { - gSPDisplayList((*gfx)++, &object_box_DL_001D58); - } else if (func_800BE63C(this) != 0) { - if (this->getItem == 0x3C) { - gSPDisplayList((*gfx)++, &object_box_DL_001850); + if (this->type == ENBOX_TYPE_BIG_ORNATE) { + gSPDisplayList((*gfx)++, &gBoxChestLidOrnateDL); + } else if (Actor_IsSmallChest(this)) { + if (this->getItem == GI_KEY_SMALL) { + gSPDisplayList((*gfx)++, &gBoxChestLidGildedDL); } else { - gSPDisplayList((*gfx)++, &object_box_DL_0012E8); + gSPDisplayList((*gfx)++, &gBoxChestLidDL); } } else { - gSPDisplayList((*gfx)++, &object_box_DL_001850); + gSPDisplayList((*gfx)++, &gBoxChestLidGildedDL); } } } @@ -693,8 +693,9 @@ void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_1F4.unk_10 != NULL) { this->unk_1F4.unk_10(&this->unk_1F4, globalCtx); } - if ((this->alpha == 255 && this->type != ENBOX_TYPE_4 && this->type != ENBOX_TYPE_6) || - ((this->dyna.actor.flags & 0x80) != 0x80 && (this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6))) { + if ((this->alpha == 255 && this->type != ENBOX_TYPE_BIG_INVISIBLE && this->type != ENBOX_TYPE_SMALL_INVISIBLE) || + (!CHECK_FLAG_ALL(this->dyna.actor.flags, ACTOR_FLAG_80) && + (this->type == ENBOX_TYPE_BIG_INVISIBLE || this->type == ENBOX_TYPE_SMALL_INVISIBLE))) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x08, EnBox_SetRenderMode1(globalCtx->state.gfxCtx)); @@ -705,7 +706,7 @@ void EnBox_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); func_8012C2DC(globalCtx->state.gfxCtx); gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, this->alpha); - if (this->type == ENBOX_TYPE_4 || this->type == ENBOX_TYPE_6) { + if (this->type == ENBOX_TYPE_BIG_INVISIBLE || this->type == ENBOX_TYPE_SMALL_INVISIBLE) { gSPSegment(POLY_XLU_DISP++, 0x08, EnBox_SetRenderMode3(globalCtx->state.gfxCtx)); } else { gSPSegment(POLY_XLU_DISP++, 0x08, EnBox_SetRenderMode2(globalCtx->state.gfxCtx)); diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.h b/src/overlays/actors/ovl_En_Box/z_en_box.h index 1f5e2d60ef..27a6eea99d 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.h +++ b/src/overlays/actors/ovl_En_Box/z_en_box.h @@ -20,22 +20,19 @@ typedef struct func_80867BDC_a0 { } func_80867BDC_a0; //size 0x24 typedef enum { - /* - only values 1-12 are used explicitly, other values (like 0) default to another separate behavior - */ - /* 0 */ ENBOX_TYPE_BIG_DEFAULT, - /* 1 */ ENBOX_TYPE_ROOM_CLEAR_BIG, // appear on room clear, store temp clear as permanent clear - /* 2 */ ENBOX_TYPE_DECORATED_BIG, // boss key chest, different look, same as ENBOX_TYPE_BIG_DEFAULT otherwise - /* 3 */ ENBOX_TYPE_SWITCH_FLAG_FALL_BIG, // falling, appear on switch flag set - /* 4 */ ENBOX_TYPE_4, // big, drawn differently - /* 5 */ ENBOX_TYPE_SMALL, // same as ENBOX_TYPE_BIG_DEFAULT but small - /* 6 */ ENBOX_TYPE_6, // small, drawn differently - /* 7 */ ENBOX_TYPE_ROOM_CLEAR_SMALL, // use room clear, store temp clear as perm clear - /* 8 */ ENBOX_TYPE_SWITCH_FLAG_FALL_SMALL, // falling, appear on switch flag set - /* 9 */ ENBOX_TYPE_9, // big, has something more to do with player and message context? - /* 10 */ ENBOX_TYPE_10, // like 9 - /* 11 */ ENBOX_TYPE_SWITCH_FLAG_BIG, // big, appear on switch flag set - /* 12 */ ENBOX_TYPE_12 + /* 0 */ ENBOX_TYPE_BIG, // big + /* 1 */ ENBOX_TYPE_BIG_ROOM_CLEAR, // appear on room clear, store temp clear as permanent clear + /* 2 */ ENBOX_TYPE_BIG_ORNATE, // boss key chest + /* 3 */ ENBOX_TYPE_BIG_SWITCH_FLAG_FALL, // falling, appear on switch flag set + /* 4 */ ENBOX_TYPE_BIG_INVISIBLE, // big, revealed with lens of truth or when opened + /* 5 */ ENBOX_TYPE_SMALL, // small + /* 6 */ ENBOX_TYPE_SMALL_INVISIBLE, // small, revealed with lens of truth or when opened + /* 7 */ ENBOX_TYPE_SMALL_ROOM_CLEAR, // use room clear, store temp clear as perm clear + /* 8 */ ENBOX_TYPE_SMALL_SWITCH_FLAG_FALL, // falling, appear on switch flag set + /* 9 */ ENBOX_TYPE_BIG_SONG_ZELDAS_LULLABY,// NOT IMPLEMENTED, behaves like big chest + /* 10 */ ENBOX_TYPE_BIG_SONG_SUNS, // NOT IMPLEMENTED, behaves like big chest + /* 11 */ ENBOX_TYPE_BIG_SWITCH_FLAG, // big, appear on switch flag set + /* 12 */ ENBOX_TYPE_SMALL_SWITCH_FLAG // small, appear on switch flag set } EnBoxType; typedef struct EnBox { @@ -63,4 +60,9 @@ typedef struct EnBox { extern const ActorInit En_Box_InitVars; +#define ENBOX_GET_TYPE(thisx) (((thisx)->params >> 12) & 0xF) +#define ENBOX_GET_ITEM(thisx) (((thisx)->params >> 5) & 0x7F) +#define ENBOX_GET_CHEST_FLAG(thisx) ((thisx)->params & 0x1F) +#define ENBOX_GET_SWITCH_FLAG(thisx) ((thisx)->world.rot.z) + #endif // Z_EN_BOX_H diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 7e88356aa8..72d21b5bc0 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -892,7 +892,7 @@ 0x800BE504:("func_800BE504",), 0x800BE568:("func_800BE568",), 0x800BE5CC:("func_800BE5CC",), - 0x800BE63C:("func_800BE63C",), + 0x800BE63C:("Actor_IsSmallChest",), 0x800BE680:("func_800BE680",), 0x800BF7CC:("Actor_SpawnIceEffects",), 0x800BF9A0:("ActorOverlayTable_FaultPrint",),