summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNuss <67802335+hack-nuss@users.noreply.github.com>2023-10-07 03:40:59 +0200
committerGitHub <noreply@github.com>2023-10-07 12:40:59 +1100
commita980067bd8b0bb96e9b05537ff2aedb1a9771eb4 (patch)
treea98774874338a00be8036bdb15ebece5edd4e7ab /src
parent16bc54b63b985ef47a6da2f3aac148bde44108c9 (diff)
ovl_En_Takaraya decompiled (#1409)
* EnTakaraya_Destroy * some matching * some matching * some matching * matched func_80ADF7CC * func_80ADEF74 wrong arg * data * clean up * improvements * actionFunc pointer * fake * improvements * improvements * naming for the bool * function naming * improvements * improvements * GET_PLAYER_FORM macro * macro
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c410
-rw-r--r--src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h15
2 files changed, 392 insertions, 33 deletions
diff --git a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c
index a2c39f16b..692651860 100644
--- a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c
+++ b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c
@@ -15,7 +15,25 @@ void EnTakaraya_Destroy(Actor* thisx, PlayState* play);
void EnTakaraya_Update(Actor* thisx, PlayState* play);
void EnTakaraya_Draw(Actor* thisx, PlayState* play);
-#if 0
+void EnTakaraya_Blink(EnTakaraya* this);
+void EnTakaraya_SetupWait(EnTakaraya* this);
+void EnTakaraya_Wait(EnTakaraya* this, PlayState* play);
+void EnTakaraya_SpawnWalls(EnTakaraya* this, PlayState* play);
+void EnTakaraya_SetupTalk(EnTakaraya* this);
+void EnTakaraya_Talk(EnTakaraya* this, PlayState* play);
+void func_80ADF2D4(EnTakaraya* this);
+void func_80ADF338(EnTakaraya* this, PlayState* play);
+void func_80ADF4E0(EnTakaraya* this);
+void func_80ADF520(EnTakaraya* this, PlayState* play);
+void func_80ADF608(EnTakaraya* this, PlayState* play);
+void func_80ADF654(EnTakaraya* this, PlayState* play);
+void func_80ADF6DC(EnTakaraya* this);
+void func_80ADF730(EnTakaraya* this, PlayState* play);
+void func_80ADF7B8(EnTakaraya* this);
+void func_80ADF7CC(EnTakaraya* this, PlayState* play);
+s32 EnTakaraya_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx);
+void EnTakaraya_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx);
+
ActorInit En_Takaraya_InitVars = {
ACTOR_EN_TAKARAYA,
ACTORCAT_NPC,
@@ -28,61 +46,391 @@ ActorInit En_Takaraya_InitVars = {
(ActorFunc)EnTakaraya_Draw,
};
-// static InitChainEntry sInitChain[] = {
-static InitChainEntry D_80ADFB20[] = {
+TexturePtr sEyesUpTextures[] = {
+ gTreasureChestShopGalEyeOpenUpTex,
+ gTreasureChestShopGalEyeHalfUpTex,
+ gTreasureChestShopGalEyeClosedTex,
+ gTreasureChestShopGalEyeHalfUpTex,
+};
+
+TexturePtr sEyesDownTextures[] = {
+ gTreasureChestShopGalEyeOpenDownTex,
+ gTreasureChestShopGalEyeHalfDownTex,
+ gTreasureChestShopGalEyeClosedTex,
+ gTreasureChestShopGalEyeHalfDownTex,
+};
+
+static InitChainEntry sInitChain[] = {
ICHAIN_U8(targetMode, TARGET_MODE_6, ICHAIN_CONTINUE),
ICHAIN_F32(targetArrowOffset, 1000, ICHAIN_STOP),
};
-#endif
+u32 sTexturesDesegmented = false;
+
+u16 D_80ADFB2C[PLAYER_FORM_MAX] = {
+ 0x76D, // PLAYER_FORM_FIERCE_DEITY
+ 0x76E, // PLAYER_FORM_GORON
+ 0x76F, // PLAYER_FORM_ZORA
+ 0x76C, // PLAYER_FORM_DEKU
+ 0x76D, // PLAYER_FORM_HUMAN
+};
+
+u8 D_80ADFB38[PLAYER_FORM_MAX][2] = {
+ { 5, 5 }, // PLAYER_FORM_FIERCE_DEITY
+ { 12, 5 }, // PLAYER_FORM_GORON
+ { 4, 4 }, // PLAYER_FORM_ZORA
+ { 42, 41 }, // PLAYER_FORM_DEKU
+ { 5, 5 }, // PLAYER_FORM_HUMAN
+};
+
+u16 D_80ADFB44[PLAYER_FORM_MAX] = {
+ 0x775, // PLAYER_FORM_FIERCE_DEITY
+ 0x776, // PLAYER_FORM_GORON
+ 0x777, // PLAYER_FORM_ZORA
+ 0x774, // PLAYER_FORM_DEKU
+ 0x775, // PLAYER_FORM_HUMAN
+};
+
+u16 D_80ADFB50[PLAYER_FORM_MAX] = {
+ 0x771, // PLAYER_FORM_FIERCE_DEITY
+ 0x772, // PLAYER_FORM_GORON
+ 0x773, // PLAYER_FORM_ZORA
+ 0x770, // PLAYER_FORM_DEKU
+ 0x771, // PLAYER_FORM_HUMAN
+};
+
+void EnTakaraya_Init(Actor* thisx, PlayState* play) {
+ EnTakaraya* this = THIS;
+ s32 i;
+
+ Actor_ProcessInitChain(&this->actor, sInitChain);
+ ActorShape_Init(&this->actor.shape, -60.0f, NULL, 0.0f);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gTreasureChestShopGalSkel, &object_bg_Anim_009890, this->jointTable,
+ this->morphTable, TREASURE_CHEST_SHOP_GAL_LIMB_MAX);
+ this->switchFlag = EN_TAKARAYA_GET_SWITCH_FLAG(thisx);
+ thisx->params &= 0xFF;
+ if (!sTexturesDesegmented) {
+ for (i = 0; i < ARRAY_COUNT(sEyesDownTextures); i++) {
+ sEyesUpTextures[i] = Lib_SegmentedToVirtual(sEyesUpTextures[i]);
+ sEyesDownTextures[i] = Lib_SegmentedToVirtual(sEyesDownTextures[i]);
+ }
+ sTexturesDesegmented = true;
+ }
+ this->eyeTexIndex = 2;
+ if (gSaveContext.save.entrance == ENTRANCE(TREASURE_CHEST_SHOP, 1)) {
+ Audio_StopSubBgm();
+ if (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] == TIMER_STATE_6) {
+ this->actor.textId = 0x77A;
+ gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
+ func_80ADF6DC(this);
+ } else {
+ this->actor.textId = 0x77C;
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) {
+ CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT);
+ CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED);
+ EnTakaraya_SetupWait(this);
+ } else {
+ func_80ADF6DC(this);
+ }
+ }
+ } else {
+ EnTakaraya_SetupWait(this);
+ }
+}
+
+void EnTakaraya_Destroy(Actor* thisx, PlayState* play) {
+ EnTakaraya* this = THIS;
+
+ Flags_UnsetSwitch(play, 5);
+ if (!this->unk2AD) {
+ CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT);
+ gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
+ }
+}
+
+void EnTakaraya_Blink(EnTakaraya* this) {
+ if (this->eyeTexIndex != 0) {
+ this->eyeTexIndex++;
+ if (this->eyeTexIndex == 4) {
+ this->eyeTexIndex = 0;
+ }
+ } else if (Rand_ZeroOne() < 0.02f) {
+ this->eyeTexIndex++;
+ }
+}
+
+void EnTakaraya_SetupWait(EnTakaraya* this) {
+ if (this->skelAnime.animation == &object_bg_Anim_001384) {
+ Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 5.0f);
+ }
+ this->actionFunc = EnTakaraya_Wait;
+}
+
+void EnTakaraya_Wait(EnTakaraya* this, PlayState* play) {
+ if (SkelAnime_Update(&this->skelAnime)) {
+ if (this->skelAnime.animation == &object_bg_Anim_00A280) {
+ Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 5.0f);
+ } else {
+ Animation_MorphToLoop(&this->skelAnime, &object_bg_Anim_009890, -4.0f);
+ }
+ }
+ if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
+ if (Text_GetFaceReaction(play, FACE_REACTION_SET_TREASURE_CHEST_SHOP_GAL) == 0) {
+ Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00A280, -4.0f);
+ }
+ EnTakaraya_SetupTalk(this);
+ } else if (Actor_IsFacingPlayer(&this->actor, 0x2000)) {
+ this->actor.textId = Text_GetFaceReaction(play, FACE_REACTION_SET_TREASURE_CHEST_SHOP_GAL);
+ if (this->actor.textId == 0) {
+ this->actor.textId = D_80ADFB2C[GET_PLAYER_FORM];
+ }
+ this->formSwitchFlag = GET_PLAYER_FORM + this->switchFlag;
+ Actor_OfferTalk(&this->actor, play, 120.0f);
+ }
+}
+
+void EnTakaraya_SpawnWalls(EnTakaraya* this, PlayState* play) {
+ u8 var_v1;
+
+ if (Flags_GetSwitch(play, this->formSwitchFlag)) {
+ var_v1 = D_80ADFB38[GET_PLAYER_FORM][1];
+ } else {
+ var_v1 = D_80ADFB38[GET_PLAYER_FORM][0];
+ }
+ Actor_SpawnAsChildAndCutscene(&play->actorCtx, play, ACTOR_OBJ_TAKARAYA_WALL, 0.0f, 0.0f, 0.0f, 0, 0, 5,
+ ((var_v1 << 5) + this->actor.params) + 0xB000, this->actor.csId, HALFDAYBIT_ALL,
+ NULL);
+}
+
+void EnTakaraya_SetupTalk(EnTakaraya* this) {
+ this->actionFunc = EnTakaraya_Talk;
+}
-extern InitChainEntry D_80ADFB20[];
+void EnTakaraya_Talk(EnTakaraya* this, PlayState* play) {
+ u8 talkState;
-extern UNK_TYPE D_06001384;
-extern UNK_TYPE D_06009890;
-extern UNK_TYPE D_0600A280;
-extern UNK_TYPE D_0600AD98;
+ if (SkelAnime_Update(&this->skelAnime)) {
+ if (this->skelAnime.animation == &object_bg_Anim_00AD98) {
+ Animation_PlayOnce(&this->skelAnime, &object_bg_Anim_000968);
+ } else if (this->skelAnime.animation == &object_bg_Anim_00A280) {
+ Animation_PlayLoop(&this->skelAnime, &object_bg_Anim_001384);
+ } else {
+ Animation_PlayLoop(&this->skelAnime, &object_bg_Anim_009890);
+ }
+ }
+ talkState = Message_GetState(&play->msgCtx);
+ if ((talkState == TEXT_STATE_CLOSING) || (talkState == TEXT_STATE_DONE)) {
+ if (this->actor.textId == 0x778) {
+ func_80ADF2D4(this);
+ } else {
+ CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT);
+ CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED);
+ EnTakaraya_SetupWait(this);
+ }
+ } else if ((talkState == TEXT_STATE_1) && (this->actor.textId != 0x778)) {
+ if (Message_ShouldAdvance(play)) {
+ Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 5.0f);
+ }
+ } else if ((talkState == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) {
+ if (play->msgCtx.choiceIndex == 0) {
+ if (gSaveContext.save.saveInfo.playerData.rupees < play->msgCtx.unk1206C) {
+ this->actor.textId = 0x77B;
+ if (this->skelAnime.animation == &object_bg_Anim_009890) {
+ Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_000968, 5.0f);
+ }
+ Audio_PlaySfx(NA_SE_SY_ERROR);
+ } else {
+ Audio_PlaySfx_MessageDecide();
+ Rupees_ChangeBy(-play->msgCtx.unk1206C);
+ EnTakaraya_SpawnWalls(this, play);
+ this->actor.textId = 0x778;
+ if (this->skelAnime.animation != &object_bg_Anim_009890) {
+ Animation_MorphToLoop(&this->skelAnime, &object_bg_Anim_009890, 5.0f);
+ }
+ }
+ } else {
+ Audio_PlaySfx_MessageCancel();
+ this->actor.textId = D_80ADFB44[GET_PLAYER_FORM];
+ if (this->skelAnime.animation == &object_bg_Anim_009890) {
+ Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_000968, 5.0f);
+ }
+ }
+ Message_ContinueTextbox(play, this->actor.textId);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/EnTakaraya_Init.s")
+void func_80ADF2D4(EnTakaraya* this) {
+ Actor_PlaySfx_FlaggedCentered2(&this->actor, NA_SE_SY_FOUND);
+ Audio_PlaySubBgm(NA_BGM_TIMED_MINI_GAME);
+ this->timer = 145;
+ SET_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT);
+ CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED);
+ this->actionFunc = func_80ADF338;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/EnTakaraya_Destroy.s")
+void func_80ADF338(EnTakaraya* this, PlayState* play) {
+ Actor* chest = play->actorCtx.actorLists[ACTORCAT_CHEST].first;
+ Player* player = GET_PLAYER(play);
+ Vec3f subCamEye;
+ Vec3f subCamAt;
+ f32 sp2C;
+ s16 subCamId;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADED8C.s")
+ SkelAnime_Update(&this->skelAnime);
+ if ((CutsceneManager_GetCurrentCsId() == this->actor.csId) && (chest != NULL)) {
+ this->timer--;
+ subCamId = CutsceneManager_GetCurrentSubCamId(this->actor.csId);
+ if (this->timer >= 26) {
+ sp2C = 250.0f;
+ } else {
+ sp2C = ((chest->xzDistToPlayer - 250.0f) * (25 - this->timer) * 0.04f) + 250.0f;
+ }
+ subCamEye.x = (Math_SinS(chest->yawTowardsPlayer) * sp2C) + chest->world.pos.x;
+ subCamEye.y = player->actor.world.pos.y + 120.0f;
+ subCamEye.z = (Math_CosS(chest->yawTowardsPlayer) * sp2C) + chest->world.pos.z;
+ subCamAt.x = subCamEye.x - (Math_SinS(chest->yawTowardsPlayer) * 250.0f);
+ subCamAt.y = subCamEye.y - 90.0f;
+ subCamAt.z = subCamEye.z - (Math_CosS(chest->yawTowardsPlayer) * 250.0f);
+ Play_SetCameraAtEye(play, subCamId, &subCamAt, &subCamEye);
+ } else if (this->timer < 145) {
+ func_80ADF4E0(this);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADEDF8.s")
+void func_80ADF4E0(EnTakaraya* this) {
+ Interface_StartTimer(TIMER_ID_MINIGAME_2, 45);
+ this->timer = 1;
+ this->actionFunc = func_80ADF520;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADEE4C.s")
+void func_80ADF520(EnTakaraya* this, PlayState* play) {
+ SkelAnime_Update(&this->skelAnime);
+ if (!Play_InCsMode(play)) {
+ if (Flags_GetTreasure(play, this->actor.params)) {
+ Flags_SetSwitch(play, this->formSwitchFlag);
+ play->actorCtx.sceneFlags.chest &= ~TAKARAYA_GET_TREASURE_FLAG(&this->actor);
+ this->timer = 0;
+ gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_6;
+ func_80ADF608(this, play);
+ } else if (gSaveContext.timerCurTimes[TIMER_ID_MINIGAME_2] == TIMER_STATE_OFF) {
+ this->timer = 50;
+ Message_StartTextbox(play, 0x77D, &this->actor);
+ gSaveContext.timerStates[TIMER_ID_MINIGAME_2] = TIMER_STATE_STOP;
+ func_80ADF608(this, play);
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADEF74.s")
+void func_80ADF608(EnTakaraya* this, PlayState* play) {
+ func_800B7298(play, &this->actor, PLAYER_CSMODE_WAIT);
+ this->unk2AD = true;
+ this->actionFunc = func_80ADF654;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF03C.s")
+void func_80ADF654(EnTakaraya* this, PlayState* play) {
+ if (this->timer > 0) {
+ this->timer--;
+ } else {
+ if (gSaveContext.timerStates[TIMER_ID_MINIGAME_2] == TIMER_STATE_6) {
+ play->transitionType = TRANS_TYPE_80;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
+ } else {
+ play->transitionType = TRANS_TYPE_64;
+ gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;
+ }
+ gSaveContext.nextCutsceneIndex = 0;
+ play->nextEntrance = ENTRANCE(TREASURE_CHEST_SHOP, 1);
+ play->transitionTrigger = TRANS_TRIGGER_START;
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF050.s")
+void func_80ADF6DC(EnTakaraya* this) {
+ Animation_PlayLoop(&this->skelAnime, &object_bg_Anim_001384);
+ this->eyeTexIndex = 0;
+ this->actor.flags |= ACTOR_FLAG_10000;
+ this->actionFunc = func_80ADF730;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF2D4.s")
+void func_80ADF730(EnTakaraya* this, PlayState* play) {
+ SkelAnime_Update(&this->skelAnime);
+ if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
+ this->actor.flags &= ~ACTOR_FLAG_10000;
+ func_80ADF7B8(this);
+ } else {
+ this->formSwitchFlag = GET_PLAYER_FORM + this->switchFlag;
+ Actor_OfferTalk(&this->actor, play, 120.0f);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF338.s")
+void func_80ADF7B8(EnTakaraya* this) {
+ this->actionFunc = func_80ADF7CC;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF4E0.s")
+void func_80ADF7CC(EnTakaraya* this, PlayState* play) {
+ SkelAnime_Update(&this->skelAnime);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF520.s")
+ if ((Message_GetState(&play->msgCtx) == TEXT_STATE_5) && Message_ShouldAdvance(play)) {
+ if (this->actor.textId == 0x77A) {
+ if (CHECK_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED)) {
+ Message_CloseTextbox(play);
+ CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_WAIT);
+ CLEAR_WEEKEVENTREG(WEEKEVENTREG_KICKOUT_TIME_PASSED);
+ EnTakaraya_SetupWait(this);
+ } else {
+ this->actor.textId = 0x77C;
+ Message_ContinueTextbox(play, this->actor.textId);
+ }
+ } else {
+ this->actor.textId = D_80ADFB50[GET_PLAYER_FORM];
+ Message_ContinueTextbox(play, this->actor.textId);
+ Animation_MorphToPlayOnce(&this->skelAnime, &object_bg_Anim_00AD98, 5.0f);
+ EnTakaraya_SetupTalk(this);
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF608.s")
+void EnTakaraya_Update(Actor* thisx, PlayState* play) {
+ EnTakaraya* this = THIS;
+ s32 pad;
+ Vec3s torsoRot;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF654.s")
+ this->actionFunc(this, play);
+ Actor_TrackPlayer(play, &this->actor, &this->headRot, &torsoRot, this->actor.focus.pos);
+ EnTakaraya_Blink(this);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF6DC.s")
+s32 EnTakaraya_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) {
+ EnTakaraya* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF730.s")
+ if (limbIndex == TREASURE_CHEST_SHOP_GAL_LIMB_HEAD) {
+ rot->x += this->headRot.y;
+ }
+ return false;
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF7B8.s")
+void EnTakaraya_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) {
+ EnTakaraya* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF7CC.s")
+ if (limbIndex == TREASURE_CHEST_SHOP_GAL_LIMB_HEAD) {
+ Matrix_RotateYS(0x400 - this->headRot.x, MTXMODE_APPLY);
+ Matrix_MultVecX(500.0f, &thisx->focus.pos);
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/EnTakaraya_Update.s")
+void EnTakaraya_Draw(Actor* thisx, PlayState* play) {
+ EnTakaraya* this = THIS;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF94C.s")
+ OPEN_DISPS(play->state.gfxCtx);
+ Gfx_SetupDL25_Opa(play->state.gfxCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/func_80ADF984.s")
+ if ((GET_PLAYER_FORM == PLAYER_FORM_DEKU) || (GET_PLAYER_FORM == PLAYER_FORM_HUMAN)) {
+ gSPSegment(POLY_OPA_DISP++, 0x08, sEyesDownTextures[this->eyeTexIndex]);
+ } else {
+ gSPSegment(POLY_OPA_DISP++, 0x08, sEyesUpTextures[this->eyeTexIndex]);
+ }
+ SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable,
+ this->skelAnime.dListCount, EnTakaraya_OverrideLimbDraw, NULL,
+ EnTakaraya_TransformLimbDraw, &this->actor);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Takaraya/EnTakaraya_Draw.s")
+ CLOSE_DISPS(play->state.gfxCtx);
+}
diff --git a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h
index cfa37125e..3124097de 100644
--- a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h
+++ b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.h
@@ -2,16 +2,27 @@
#define Z_EN_TAKARAYA_H
#include "global.h"
+#include "objects/object_bg/object_bg.h"
struct EnTakaraya;
typedef void (*EnTakarayaActionFunc)(struct EnTakaraya*, PlayState*);
+#define EN_TAKARAYA_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 0x8) & 0xFF)
+#define TAKARAYA_GET_TREASURE_FLAG(thisx) (1 << (thisx)->params)
+
typedef struct EnTakaraya {
/* 0x000 */ Actor actor;
- /* 0x144 */ char unk_144[0x164];
+ /* 0x144 */ SkelAnime skelAnime;
+ /* 0x188 */ Vec3s jointTable[TREASURE_CHEST_SHOP_GAL_LIMB_MAX];
+ /* 0x218 */ Vec3s morphTable[TREASURE_CHEST_SHOP_GAL_LIMB_MAX];
/* 0x2A8 */ EnTakarayaActionFunc actionFunc;
- /* 0x2AC */ char unk_2AC[0x10];
+ /* 0x2AC */ u8 eyeTexIndex;
+ /* 0x2AD */ u8 unk2AD;
+ /* 0x2AE */ s16 timer;
+ /* 0x2B0 */ s16 formSwitchFlag;
+ /* 0x2B2 */ s16 switchFlag;
+ /* 0x2B4 */ Vec3s headRot;
} EnTakaraya; // size = 0x2BC
#endif // Z_EN_TAKARAYA_H