summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTharo <17233964+Thar0@users.noreply.github.com>2021-02-12 22:37:13 +0000
committerGitHub <noreply@github.com>2021-02-12 17:37:13 -0500
commit61dacd08820da0cb16edb65d12ebbc59cca6df9e (patch)
tree33bc45830279b96bdf81953fdbb1a1226d3a1dfb /src
parent0b2a4e9d7fd5448c5f7939714f177cc0c2faafef (diff)
Ovl_En_Gb OK (#691)
* Progress * Matched * Cleanup, some names Co-authored-by: Thar0 <maximilianc64@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_En_Gb/z_en_gb.c525
-rw-r--r--src/overlays/actors/ovl_En_Gb/z_en_gb.h39
2 files changed, 524 insertions, 40 deletions
diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/src/overlays/actors/ovl_En_Gb/z_en_gb.c
index e303b7f59..b700966a7 100644
--- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c
+++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c
@@ -9,13 +9,18 @@ void EnGb_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnGb_Update(Actor* thisx, GlobalContext* globalCtx);
void EnGb_Draw(Actor* thisx, GlobalContext* globalCtx);
-extern UNK_TYPE D_0600049C;
-extern UNK_TYPE D_0600C0B0;
-extern UNK_TYPE D_0600C220;
-extern UNK_TYPE D_0600C2D0;
-extern UNK_TYPE D_0600C8EC;
+void func_80A2F83C(EnGb* this, GlobalContext* globalCtx);
+void func_80A2FC70(EnGb* this, GlobalContext* globalCtx);
+void func_80A2FA50(EnGb* this, GlobalContext* globalCtx);
+void func_80A2F9C0(EnGb* this, GlobalContext* globalCtx);
+void func_80A2F94C(EnGb* this, GlobalContext* globalCtx);
+void func_80A2FB40(EnGb* this, GlobalContext* globalCtx);
+void func_80A2FBB0(EnGb* this, GlobalContext* globalCtx);
+void func_80A2FC0C(EnGb* this, GlobalContext* globalCtx);
+
+void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx);
+void EnGb_UpdateCagedSouls(EnGb* this, GlobalContext* globalCtx);
-/*
const ActorInit En_Gb_InitVars = {
ACTOR_EN_GB,
ACTORCAT_NPC,
@@ -28,6 +33,12 @@ const ActorInit En_Gb_InitVars = {
(ActorFunc)EnGb_Draw,
};
+static EnGbCagedSoulInfo sCagedSoulInfo[] = {
+ { { 255, 255, 170, 255 }, { 255, 200, 0, 255 }, 0x0600A870, -15 },
+ { { 255, 255, 170, 255 }, { 0, 150, 0, 255 }, 0x0600B070, -12 },
+ { { 255, 170, 255, 255 }, { 100, 0, 150, 255 }, 0x0600B870, -8 },
+};
+
static ColliderCylinderInitType1 sCylinderInit = {
{
COLTYPE_NONE,
@@ -47,57 +58,495 @@ static ColliderCylinderInitType1 sCylinderInit = {
{ 40, 75, 0, { 0, 0, 0 } },
};
-static ColliderCylinderInitType1 sCylinderInit = {
+static ColliderCylinderInitType1 sBottlesCylindersInit[] = {
{
- COLTYPE_NONE,
- AT_NONE,
- AC_NONE,
- OC1_ON | OC1_TYPE_ALL,
- COLSHAPE_CYLINDER,
+ {
+ COLTYPE_NONE,
+ AT_NONE,
+ AC_NONE,
+ OC1_ON | OC1_TYPE_ALL,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0x00000000, 0x00, 0x00 },
+ { 0x00000000, 0x00, 0x00 },
+ TOUCH_NONE,
+ BUMP_NONE,
+ OCELEM_ON,
+ },
+ { 4, 20, 0, { 0, 0, 0 } },
},
{
- ELEMTYPE_UNK0,
- { 0x00000000, 0x00, 0x00 },
- { 0x00000000, 0x00, 0x00 },
- TOUCH_NONE,
- BUMP_NONE,
- OCELEM_ON,
+ {
+ COLTYPE_NONE,
+ AT_NONE,
+ AC_NONE,
+ OC1_ON | OC1_TYPE_ALL,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0x00000000, 0x00, 0x00 },
+ { 0x00000000, 0x00, 0x00 },
+ TOUCH_NONE,
+ BUMP_NONE,
+ OCELEM_ON,
+ },
+ { 4, 20, 0, { 0, 0, 0 } },
+ },
+ {
+ {
+ COLTYPE_NONE,
+ AT_NONE,
+ AC_NONE,
+ OC1_ON | OC1_TYPE_ALL,
+ COLSHAPE_CYLINDER,
+ },
+ {
+ ELEMTYPE_UNK0,
+ { 0x00000000, 0x00, 0x00 },
+ { 0x00000000, 0x00, 0x00 },
+ TOUCH_NONE,
+ BUMP_NONE,
+ OCELEM_ON,
+ },
+ { 10, 20, 0, { 0, 0, 0 } },
},
- { 4, 20, 0, { 0, 0, 0 } },
};
-*/
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2F180.s")
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/EnGb_Init.s")
+static InitChainEntry sInitChain[] = {
+ ICHAIN_U8(targetMode, 6, ICHAIN_CONTINUE),
+ ICHAIN_F32(targetArrowOffset, 2200, ICHAIN_STOP),
+};
+
+// relative positions of poe souls
+static Vec3f sCagedSoulPositions[] = {
+ { -8.0f, 112.0f, -8.0f },
+ { -3.0f, 112.0f, 29.0f },
+ { 31.0f, 112.0f, 29.0f },
+ { 31.0f, 112.0f, -8.0f },
+};
+
+// relative positions of bottles
+static Vec3f sBottlesPositions[] = {
+ { -48.0f, 0.0f, 34.0f },
+ { -55.0f, 0.0f, 49.0f },
+ { -48.0f, 0.0f, 60.0f },
+};
+
+extern AnimationHeader D_0600049C;
+extern Gfx D_0600C0B0[];
+extern FlexSkeletonHeader D_0600C220;
+extern CollisionHeader D_0600C2D0;
+extern AnimationHeader D_0600C8EC;
+
+void func_80A2F180(EnGb* this) {
+ if (gSaveContext.infTable[0xB] & 0x40) {
+ this->textId = 0x70F5;
+ } else {
+ this->textId = 0x70F4;
+ }
+}
+
+void EnGb_Init(Actor* thisx, GlobalContext* globalCtx) {
+ EnGb* this = THIS;
+ s32 pad;
+ CollisionHeader* colHeader = NULL;
+ s32 i;
+ f32 rand;
+ Vec3f focusOffset;
+
+ Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
+ DynaPolyActor_Init(&this->dyna, DPM_UNK);
+ CollisionHeader_GetVirtual(&D_0600C2D0, &colHeader);
+ this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
+ SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600C220, &D_0600049C, this->jointTable, this->morphTable, 12);
+ Collider_InitCylinder(globalCtx, &this->collider);
+ Collider_SetCylinderType1(globalCtx, &this->collider, &this->dyna.actor, &sCylinderInit);
+
+ for (i = 0; i < ARRAY_COUNT(sBottlesCylindersInit); i++) {
+ Collider_InitCylinder(globalCtx, &this->bottlesColliders[i]);
+ Collider_SetCylinderType1(globalCtx, &this->bottlesColliders[i], &this->dyna.actor, &sBottlesCylindersInit[i]);
+ }
+
+ this->light = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo);
+ Lights_PointNoGlowSetInfo(&this->lightInfo, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y,
+ this->dyna.actor.home.pos.z, 255, 255, 255, 200);
+
+ ActorShape_Init(&this->dyna.actor.shape, 0.0f, ActorShadow_DrawCircle, 35.0f);
+ Actor_SetScale(&this->dyna.actor, 0.01f);
+ this->dyna.actor.colChkInfo.mass = 0xFF;
+ this->dyna.actor.speedXZ = 0.0f;
+ this->dyna.actor.velocity.y = 0.0f;
+ this->dyna.actor.gravity = -1.0f;
+ this->actionTimer = (s16)Rand_ZeroFloat(100.0f) + 100;
+
+ for (i = 0; i < ARRAY_COUNT(sCagedSoulPositions); i++) {
+ this->cagedSouls[i].unk_0 = (s32)Rand_ZeroFloat(30.0f) % 3;
+ this->cagedSouls[i].unk_14.x = this->cagedSouls[i].translation.x =
+ sCagedSoulPositions[i].x + this->dyna.actor.world.pos.x;
+ this->cagedSouls[i].unk_14.y = this->cagedSouls[i].translation.y =
+ sCagedSoulPositions[i].y + this->dyna.actor.world.pos.y;
+ this->cagedSouls[i].unk_14.z = this->cagedSouls[i].translation.z =
+ sCagedSoulPositions[i].z + this->dyna.actor.world.pos.z;
+ this->cagedSouls[i].unk_1 = 1;
+ this->cagedSouls[i].unk_3 = this->cagedSouls[i].unk_2 = 0;
+ this->cagedSouls[i].unk_20 = this->cagedSouls[i].unk_24 = 0.0f;
+ this->cagedSouls[i].unk_6 = Rand_ZeroFloat(40.0f);
+ this->cagedSouls[i].rotate180 = this->cagedSouls[i].unk_6 & 1;
+ this->cagedSouls[i].unk_28 = 0.2f;
+ }
+
+ rand = Rand_ZeroOne();
+ this->lightColor.r = (s8)(rand * 30.0f) + 225;
+ this->lightColor.g = (s8)(rand * 100.0f) + 155;
+ this->lightColor.b = (s8)(rand * 160.0f) + 95;
+ this->lightColor.a = 200;
+ Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z,
+ MTXMODE_NEW);
+ Matrix_RotateRPY(this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z,
+ MTXMODE_APPLY);
+ focusOffset.x = focusOffset.y = 0.0f;
+ focusOffset.z = 44.0f;
+ Matrix_MultVec3f(&focusOffset, &this->dyna.actor.focus.pos);
+ this->dyna.actor.focus.pos.y += 62.5f;
+ func_80A2F180(this);
+ this->actionFunc = func_80A2F83C;
+}
+
+void EnGb_Destroy(Actor* thisx, GlobalContext* globalCtx) {
+ EnGb* this = THIS;
+
+ Collider_DestroyCylinder(globalCtx, &this->collider);
+ LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->light);
+ DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
+}
+
+void func_80A2F608(EnGb* this) {
+ s32 i;
+ Vec3f sp48;
+ Vec3f sp3C;
+
+ Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z,
+ MTXMODE_NEW);
+ Matrix_RotateRPY(this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z,
+ MTXMODE_APPLY);
+ sp48.x = sp48.y = 0.0f;
+ sp48.z = 25.0f;
+ Matrix_MultVec3f(&sp48, &sp3C);
+ this->collider.dim.pos.x = sp3C.x;
+ this->collider.dim.pos.y = sp3C.y;
+ this->collider.dim.pos.z = sp3C.z;
+
+ for (i = 0; i < ARRAY_COUNT(sBottlesPositions); i++) {
+ Matrix_Translate(this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z,
+ MTXMODE_NEW);
+ Matrix_RotateRPY(this->dyna.actor.world.rot.x, this->dyna.actor.world.rot.y, this->dyna.actor.world.rot.z,
+ MTXMODE_APPLY);
+ Matrix_MultVec3f(&sBottlesPositions[i], &sp3C);
+ this->bottlesColliders[i].dim.pos.x = sp3C.x;
+ this->bottlesColliders[i].dim.pos.y = sp3C.y;
+ this->bottlesColliders[i].dim.pos.z = sp3C.z;
+ }
+}
+
+s32 func_80A2F760(EnGb* this) {
+ s32 i;
+ for (i = 0; i < ARRAY_COUNT(this->cagedSouls); i++) {
+ if (this->cagedSouls[i].unk_3) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
+void func_80A2F7C0(EnGb* this) {
+ Animation_Change(&this->skelAnime, &D_0600C8EC, 1.0f, 0.0f, Animation_GetLastFrame(&D_0600C8EC), ANIMMODE_ONCE,
+ 0.0f);
+ Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_NALE_MAGIC);
+ this->actionFunc = func_80A2FC70;
+}
+
+void func_80A2F83C(EnGb* this, GlobalContext* globalCtx) {
+ Player* player = PLAYER;
+
+ if (!func_80A2F760(this)) {
+ if (this->actionTimer != 0) {
+ this->actionTimer--;
+ } else {
+ func_80A2F7C0(this);
+ return;
+ }
+ }
+ if (func_8002F194(&this->dyna.actor, globalCtx)) {
+ switch (func_8002F368(globalCtx)) {
+ case EXCH_ITEM_NONE:
+ func_80A2F180(this);
+ this->actionFunc = func_80A2F94C;
+ break;
+ case EXCH_ITEM_POE:
+ player->actor.textId = 0x70F6;
+ this->actionFunc = func_80A2F9C0;
+ break;
+ case EXCH_ITEM_BIG_POE:
+ player->actor.textId = 0x70F7;
+ this->actionFunc = func_80A2FA50;
+ break;
+ }
+ return;
+ }
+ if (this->dyna.actor.xzDistToPlayer < 100.0f) {
+ func_8002F298(&this->dyna.actor, globalCtx, 100.0f, EXCH_ITEM_POE);
+ }
+}
+
+void func_80A2F94C(EnGb* this, GlobalContext* globalCtx) {
+ if (func_8010BDBC(&globalCtx->msgCtx) == 6 && func_80106BC8(globalCtx)) {
+ if (!(gSaveContext.infTable[0xB] & 0x40)) {
+ gSaveContext.infTable[0xB] |= 0x40;
+ }
+ func_80A2F180(this);
+ this->actionFunc = func_80A2F83C;
+ }
+}
+
+void func_80A2F9C0(EnGb* this, GlobalContext* globalCtx) {
+ if (func_8010BDBC(&globalCtx->msgCtx) == 6 && func_80106BC8(globalCtx)) {
+ if (!(gSaveContext.infTable[0xB] & 0x40)) {
+ gSaveContext.infTable[0xB] |= 0x40;
+ }
+ func_80A2F180(this);
+ Player_UpdateBottleHeld(globalCtx, PLAYER, ITEM_BOTTLE, PLAYER_AP_BOTTLE);
+ Rupees_ChangeBy(10);
+ this->actionFunc = func_80A2F83C;
+ }
+}
+
+void func_80A2FA50(EnGb* this, GlobalContext* globalCtx) {
+ if (func_8010BDBC(&globalCtx->msgCtx) == 6 && func_80106BC8(globalCtx)) {
+ if (!(gSaveContext.infTable[0xB] & 0x40)) {
+ gSaveContext.infTable[0xB] |= 0x40;
+ }
+ func_80A2F180(this);
+ Player_UpdateBottleHeld(globalCtx, PLAYER, ITEM_BOTTLE, PLAYER_AP_BOTTLE);
+ Rupees_ChangeBy(50);
+ HIGH_SCORE(HS_POE_POINTS) += 100;
+ if (HIGH_SCORE(HS_POE_POINTS) != 1000) {
+ if (HIGH_SCORE(HS_POE_POINTS) > 1100) {
+ HIGH_SCORE(HS_POE_POINTS) = 1100;
+ }
+ this->actionFunc = func_80A2F83C;
+ } else {
+ Player* player = PLAYER;
+
+ player->exchangeItemId = EXCH_ITEM_NONE;
+ this->textId = 0x70F8;
+ func_8010B720(globalCtx, this->textId);
+ this->actionFunc = func_80A2FB40;
+ }
+ }
+}
+
+void func_80A2FB40(EnGb* this, GlobalContext* globalCtx) {
+ if (func_8010BDBC(&globalCtx->msgCtx) == 6 && func_80106BC8(globalCtx)) {
+ func_8002F434(&this->dyna.actor, globalCtx, GI_BOTTLE, 100.0f, 10.0f);
+ this->actionFunc = func_80A2FBB0;
+ }
+}
+
+void func_80A2FBB0(EnGb* this, GlobalContext* globalCtx) {
+ if (Actor_HasParent(&this->dyna.actor, globalCtx)) {
+ this->dyna.actor.parent = NULL;
+ this->actionFunc = func_80A2FC0C;
+ } else {
+ func_8002F434(&this->dyna.actor, globalCtx, GI_BOTTLE, 100.0f, 10.0f);
+ }
+}
+
+void func_80A2FC0C(EnGb* this, GlobalContext* globalCtx) {
+ if (func_8010BDBC(&globalCtx->msgCtx) == 6 && func_80106BC8(globalCtx)) {
+ func_8002F194(&this->dyna.actor, globalCtx);
+ func_80A2F180(this);
+ this->actionFunc = func_80A2F83C;
+ }
+}
+
+void func_80A2FC70(EnGb* this, GlobalContext* globalCtx) {
+ if (this->skelAnime.curFrame == Animation_GetLastFrame(&D_0600C8EC)) {
+ Animation_Change(&this->skelAnime, &D_0600049C, 1.0f, 0.0f, Animation_GetLastFrame(&D_0600049C), 0, 0.0f);
+ this->actionFunc = func_80A2F83C;
+ } else if (this->skelAnime.curFrame == 18.0f) {
+ this->cagedSouls[1].unk_1 = 3;
+ this->cagedSouls[1].unk_3 = 1;
+ this->cagedSouls[2].unk_1 = 3;
+ this->cagedSouls[2].unk_3 = 1;
+ this->cagedSouls[3].unk_1 = 3;
+ this->cagedSouls[3].unk_3 = 1;
+ if (this->actionFunc) {} // these ifs cannot just contain a constant
+ this->cagedSouls[0].unk_1 = 3;
+ this->cagedSouls[0].unk_3 = 1;
+ if (this->actionFunc) {}
+ this->actionTimer = (s16)Rand_ZeroFloat(600.0f) + 600;
+ Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_WOOD_HIT);
+ }
+}
+
+void EnGb_Update(Actor* thisx, GlobalContext* globalCtx) {
+ EnGb* this = THIS;
+ GlobalContext* globalCtx2 = globalCtx;
+ s32 i;
+ f32 rand;
+
+ this->frameTimer++;
+ SkelAnime_Update(&this->skelAnime);
+ this->actionFunc(this, globalCtx2);
+ this->dyna.actor.textId = this->textId;
+ func_80A2F608(this);
+ CollisionCheck_SetOC(globalCtx2, &globalCtx2->colChkCtx, &this->collider.base);
+
+ for (i = 0; i < ARRAY_COUNT(this->bottlesColliders); i++) {
+ CollisionCheck_SetOC(globalCtx2, &globalCtx2->colChkCtx, &this->bottlesColliders[i].base);
+ }
+
+ rand = Rand_ZeroOne();
+ this->lightColor.r = (s8)(rand * 30.0f) + 225;
+ this->lightColor.g = (s8)(rand * 100.0f) + 155;
+ this->lightColor.b = (s8)(rand * 160.0f) + 95;
+ this->lightColor.a = 200;
+ EnGb_UpdateCagedSouls(this, globalCtx2);
+}
+
+void EnGb_Draw(Actor* thisx, GlobalContext* globalCtx) {
+ EnGb* this = THIS;
+ s32 pad;
+
+ OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_gb.c", 763);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/EnGb_Destroy.s")
+ func_80093D18(globalCtx->state.gfxCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2F608.s")
+ gDPPipeSync(POLY_OPA_DISP++);
+ gDPSetEnvColor(POLY_OPA_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, 255);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2F760.s")
+ Lights_PointNoGlowSetInfo(&this->lightInfo, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y,
+ this->dyna.actor.world.pos.z, this->lightColor.r, this->lightColor.g, this->lightColor.b,
+ this->lightColor.a);
+ SkelAnime_DrawFlexOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount,
+ NULL, NULL, &this->dyna.actor);
+ EnGb_DrawCagedSouls(this, globalCtx);
+ CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_gb.c", 796);
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2F7C0.s")
+void EnGb_UpdateCagedSouls(EnGb* this, GlobalContext* globalCtx) {
+ f32 temp_f20;
+ s16 rot;
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2F83C.s")
+ for (i = 0; i < 4; i++) {
+ switch (this->cagedSouls[i].unk_1) {
+ case 0:
+ Math_ApproachF(&this->cagedSouls[i].unk_20, 1.0f, 0.02f, this->cagedSouls[i].unk_24);
+ Math_ApproachF(&this->cagedSouls[i].unk_24, 1.0f, 0.001f, 1.0f);
+ if ((this->cagedSouls[i].unk_28 - .01f) <= this->cagedSouls[i].unk_20) {
+ this->cagedSouls[i].unk_20 = this->cagedSouls[i].unk_28;
+ this->cagedSouls[i].unk_24 = 0.0f;
+ this->cagedSouls[i].unk_1 = 1;
+ this->cagedSouls[i].unk_2 = 2;
+ this->cagedSouls[i].unk_6 = 0;
+ }
+ break;
+ case 1:
+ if (this->cagedSouls[i].unk_6 != 0) {
+ this->cagedSouls[i].unk_6--;
+ } else {
+ this->cagedSouls[i].unk_3 = 0;
+ this->cagedSouls[i].unk_24 = 0.0f;
+ this->cagedSouls[i].unk_1 = this->cagedSouls[i].unk_2;
+ }
+ break;
+ case 2:
+ Math_ApproachF(&this->cagedSouls[i].unk_20, 0.0f, 0.02f, this->cagedSouls[i].unk_24);
+ Math_ApproachF(&this->cagedSouls[i].unk_24, 1.0f, 0.001f, 1.0f);
+ if (this->cagedSouls[i].unk_20 <= 0.01f) {
+ this->cagedSouls[i].unk_28 = this->cagedSouls[i].unk_28 + 0.2f;
+ if (this->cagedSouls[i].unk_28 > 1.0f) {
+ this->cagedSouls[i].unk_28 = 1.0f;
+ }
+ this->cagedSouls[i].unk_20 = 0.0f;
+ this->cagedSouls[i].unk_24 = 0.0f;
+ this->cagedSouls[i].unk_1 = 1;
+ this->cagedSouls[i].unk_2 = 0;
+ this->cagedSouls[i].unk_6 = 0;
+ }
+ break;
+ case 3:
+ Math_ApproachF(&this->cagedSouls[i].unk_20, 0.0f, 0.5f, 1.0f);
+ if (this->cagedSouls[i].unk_20 <= 0.01f) {
+ this->cagedSouls[i].unk_28 = 0.2f;
+ this->cagedSouls[i].unk_20 = 0.0f;
+ this->cagedSouls[i].unk_24 = 0.0f;
+ this->cagedSouls[i].unk_1 = 1;
+ this->cagedSouls[i].unk_2 = 0;
+ this->cagedSouls[i].unk_6 = (s16)Rand_ZeroFloat(60.0f) + 60;
+ }
+ break;
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2F94C.s")
+ temp_f20 = this->cagedSouls[i].unk_20 * 60.0f;
+ if ((i == 0) || (i == 3)) {
+ this->cagedSouls[i].translation.x = this->cagedSouls[i].unk_14.x;
+ this->cagedSouls[i].translation.y = this->cagedSouls[i].unk_14.y + temp_f20;
+ this->cagedSouls[i].translation.z = this->cagedSouls[i].unk_14.z;
+ } else if (i == 1) {
+ rot = this->dyna.actor.world.rot.y - 0x4000;
+ this->cagedSouls[i].translation.x = this->cagedSouls[i].unk_14.x + Math_SinS(rot) * temp_f20;
+ this->cagedSouls[i].translation.z = this->cagedSouls[i].unk_14.z + Math_CosS(rot) * temp_f20;
+ this->cagedSouls[i].translation.y = this->cagedSouls[i].unk_14.y;
+ } else {
+ rot = this->dyna.actor.world.rot.y + 0x4000;
+ this->cagedSouls[i].translation.x = this->cagedSouls[i].unk_14.x + Math_SinS(rot) * temp_f20;
+ this->cagedSouls[i].translation.z = this->cagedSouls[i].unk_14.z + Math_CosS(rot) * temp_f20;
+ this->cagedSouls[i].translation.y = this->cagedSouls[i].unk_14.y;
+ }
+ }
+}
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2F9C0.s")
+void EnGb_DrawCagedSouls(EnGb* this, GlobalContext* globalCtx) {
+ s32 pad;
+ s32 i;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2FA50.s")
+ OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_gb.c", 914);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2FB40.s")
+ func_80093D84(globalCtx->state.gfxCtx);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2FBB0.s")
+ for (i = 0; i < 4; i++) {
+ s32 idx = this->cagedSouls[i].unk_0;
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2FC0C.s")
+ gSPSegment(POLY_XLU_DISP++, 0x08,
+ Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 32, 64, 1, 0,
+ (u32)(sCagedSoulInfo[idx].unk_C * this->frameTimer) % 512, 32, 128));
+ gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sCagedSoulInfo[idx].unk_8));
+ gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, sCagedSoulInfo[idx].prim.r, sCagedSoulInfo[idx].prim.g,
+ sCagedSoulInfo[idx].prim.b, sCagedSoulInfo[idx].prim.a);
+ gDPSetEnvColor(POLY_XLU_DISP++, sCagedSoulInfo[idx].env.r, sCagedSoulInfo[idx].env.g, sCagedSoulInfo[idx].env.b,
+ sCagedSoulInfo[idx].env.a);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2FC70.s")
+ Matrix_Push();
+ Matrix_Translate(this->cagedSouls[i].translation.x, this->cagedSouls[i].translation.y,
+ this->cagedSouls[i].translation.z, MTXMODE_NEW);
+ func_800D1FD4(&globalCtx->mf_11DA0);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/EnGb_Update.s")
+ if (this->cagedSouls[i].rotate180) {
+ Matrix_RotateRPY(0, -0x8000, 0, MTXMODE_APPLY);
+ }
+ Matrix_Scale(0.007f, 0.007f, 1.0f, MTXMODE_APPLY);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/EnGb_Draw.s")
+ gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_gb.c", 955),
+ G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
+ gSPDisplayList(POLY_XLU_DISP++, D_0600C0B0);
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A2FFFC.s")
+ Matrix_Pull();
+ }
-#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Gb/func_80A30350.s")
+ CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_gb.c", 962);
+}
diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.h b/src/overlays/actors/ovl_En_Gb/z_en_gb.h
index 902dddf30..8d3779b97 100644
--- a/src/overlays/actors/ovl_En_Gb/z_en_gb.h
+++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.h
@@ -6,9 +6,44 @@
struct EnGb;
+typedef void (*EnGbActionFunc)(struct EnGb*, GlobalContext*);
+
+typedef struct {
+ /* 0x00 */ Color_RGBA8 prim;
+ /* 0x04 */ Color_RGBA8 env;
+ /* 0x08 */ UNK_TYPE unk_8;
+ /* 0x0C */ s16 unk_C;
+} EnGbCagedSoulInfo; // size = 0x10
+
+typedef struct {
+ /* 0x00 */ u8 unk_0;
+ /* 0x01 */ u8 unk_1;
+ /* 0x02 */ u8 unk_2;
+ /* 0x03 */ u8 unk_3;
+ /* 0x04 */ u8 rotate180;
+ /* 0x06 */ s16 unk_6;
+ /* 0x08 */ Vec3f translation;
+ /* 0x14 */ Vec3f unk_14;
+ /* 0x20 */ f32 unk_20;
+ /* 0x24 */ f32 unk_24;
+ /* 0x28 */ f32 unk_28;
+} EnGbCagedSoul; // size = 0x2C
+
typedef struct EnGb {
- /* 0x0000 */ Actor actor;
- /* 0x014C */ char unk_14C[0x2EC];
+ /* 0x0000 */ DynaPolyActor dyna;
+ /* 0x0164 */ SkelAnime skelAnime;
+ /* 0x01A8 */ Vec3s jointTable[12];
+ /* 0x01F0 */ Vec3s morphTable[12];
+ /* 0x0238 */ EnGbActionFunc actionFunc;
+ /* 0x023C */ ColliderCylinder collider;
+ /* 0x0288 */ ColliderCylinder bottlesColliders[3];
+ /* 0x036C */ LightNode* light;
+ /* 0x0370 */ LightInfo lightInfo;
+ /* 0x037E */ u16 textId;
+ /* 0x0380 */ s16 frameTimer;
+ /* 0x0382 */ s16 actionTimer;
+ /* 0x0384 */ Color_RGBA8 lightColor;
+ /* 0x0388 */ EnGbCagedSoul cagedSouls[4];
} EnGb; // size = 0x0438
extern const ActorInit En_Gb_InitVars;