diff --git a/assets/xml/objects/object_zo.xml b/assets/xml/objects/object_zo.xml index ce520c475b..f0926dd2b1 100644 --- a/assets/xml/objects/object_zo.xml +++ b/assets/xml/objects/object_zo.xml @@ -1,67 +1,67 @@  - - - - - + + + + + - + - + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spec b/spec index f288eee045..b41af9254d 100644 --- a/spec +++ b/spec @@ -2223,8 +2223,7 @@ beginseg name "ovl_En_Zo" compress include "build/src/overlays/actors/ovl_En_Zo/z_en_zo.o" - include "build/data/ovl_En_Zo/ovl_En_Zo.data.o" - include "build/data/ovl_En_Zo/ovl_En_Zo.reloc.o" + include "build/src/overlays/actors/ovl_En_Zo/ovl_En_Zo_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index 10d6c168ac..1c747400e1 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -1320,8 +1320,7 @@ s32 EnSob1_AreObjectsLoaded(EnSob1* this, GlobalContext* globalCtx) { } void EnSob1_InitZoraShopkeeper(EnSob1* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_zo_Skel_00D208, NULL, this->jointTable, this->morphTable, - 20); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, 20); gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->objIndices[2]].segment); Animation_Change(&this->skelAnime, &object_masterzoora_Anim_00078C, 1.0f, 0.0f, Animation_GetLastFrame(&object_masterzoora_Anim_00078C), 0, 0.0f); @@ -1623,8 +1622,7 @@ Gfx* EnSob1_EndDList(GraphicsContext* gfxCtx) { } void EnSob1_DrawZoraShopkeeper(Actor* thisx, GlobalContext* globalCtx) { - static TexturePtr sZoraShopkeeperEyeTextures[] = { object_zo_Tex_0050A0, object_zo_Tex_0058A0, - object_zo_Tex_0060A0 }; + static TexturePtr sZoraShopkeeperEyeTextures[] = { gZoraEyeOpenTex, gZoraEyeHalfTex, gZoraEyeClosedTex }; EnSob1* this = THIS; s32 pad; s32 i; diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 730bcf10ba..432fbec9d9 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -1,10 +1,11 @@ /* * File: z_en_zo.c * Overlay: ovl_En_Zo - * Description: Zoras + * Description: Zoras (unused) */ #include "z_en_zo.h" +#include "objects/object_zo/object_zo.h" #define FLAGS 0x00000019 @@ -15,12 +16,12 @@ void EnZo_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnZo_Update(Actor* thisx, GlobalContext* globalCtx); void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_8099EBD8(EnZo* this, GlobalContext* globalCtx); -void func_8099EC50(EnZo* this, GlobalContext* globalCtx); -void func_8099ED4C(EnZo* this, GlobalContext* globalCtx); -void func_8099EE24(EnZo* this, GlobalContext* globalCtx); +void EnZo_FollowPath(EnZo* this, GlobalContext* globalCtx); +void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx); +void EnZo_DoNothing(EnZo* this, GlobalContext* globalCtx); + +typedef enum { ZO_DMG_EFF_NONE } EnZoDamageEffect; -#if 0 const ActorInit En_Zo_InitVars = { ACTOR_EN_ZO, ACTORCAT_NPC, @@ -33,86 +34,333 @@ const ActorInit En_Zo_InitVars = { (ActorFunc)EnZo_Draw, }; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_8099F4B0 = { - { COLTYPE_HIT0, AT_NONE, AC_ON | AC_TYPE_PLAYER, OC1_ON | OC1_TYPE_ALL, OC2_TYPE_1, COLSHAPE_CYLINDER, }, - { ELEMTYPE_UNK1, { 0x00000000, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_ON, OCELEM_ON, }, +static ColliderCylinderInit sCylinderInit = { + { + COLTYPE_HIT0, + AT_NONE, + AC_ON | AC_TYPE_PLAYER, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, + }, + { + ELEMTYPE_UNK1, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, + }, { 18, 64, 0, { 0, 0, 0 } }, }; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_8099F4DC = { 0, 0, 0, 0, MASS_IMMOVABLE }; +static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; -// static DamageTable sDamageTable = { -static DamageTable D_8099F4E8 = { - /* Deku Nut */ DMG_ENTRY(0, 0x0), - /* Deku Stick */ DMG_ENTRY(0, 0x0), - /* Horse trample */ DMG_ENTRY(0, 0x0), - /* Explosives */ DMG_ENTRY(0, 0x0), - /* Zora boomerang */ DMG_ENTRY(0, 0x0), - /* Normal arrow */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x06 */ DMG_ENTRY(0, 0x0), - /* Hookshot */ DMG_ENTRY(0, 0x0), - /* Goron punch */ DMG_ENTRY(0, 0x0), - /* Sword */ DMG_ENTRY(0, 0x0), - /* Goron pound */ DMG_ENTRY(0, 0x0), - /* Fire arrow */ DMG_ENTRY(0, 0x0), - /* Ice arrow */ DMG_ENTRY(0, 0x0), - /* Light arrow */ DMG_ENTRY(0, 0x0), - /* Goron spikes */ DMG_ENTRY(0, 0x0), - /* Deku spin */ DMG_ENTRY(0, 0x0), - /* Deku bubble */ DMG_ENTRY(0, 0x0), - /* Deku launch */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, 0x0), - /* Zora barrier */ DMG_ENTRY(0, 0x0), - /* Normal shield */ DMG_ENTRY(0, 0x0), - /* Light ray */ DMG_ENTRY(0, 0x0), - /* Thrown object */ DMG_ENTRY(0, 0x0), - /* Zora punch */ DMG_ENTRY(0, 0x0), - /* Spin attack */ DMG_ENTRY(0, 0x0), - /* Sword beam */ DMG_ENTRY(0, 0x0), - /* Normal Roll */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1B */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1C */ DMG_ENTRY(0, 0x0), - /* Unblockable */ DMG_ENTRY(0, 0x0), - /* UNK_DMG_0x1E */ DMG_ENTRY(0, 0x0), - /* Powder Keg */ DMG_ENTRY(0, 0x0), +static DamageTable sDamageTable = { + /* Deku Nut */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Deku Stick */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Horse trample */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Explosives */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Zora boomerang */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Normal arrow */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* UNK_DMG_0x06 */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Hookshot */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Goron punch */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Sword */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Goron pound */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Fire arrow */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Ice arrow */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Light arrow */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Goron spikes */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Deku spin */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Deku bubble */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Deku launch */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Zora barrier */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Normal shield */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Light ray */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Thrown object */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Zora punch */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Spin attack */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Sword beam */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Normal Roll */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* UNK_DMG_0x1B */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* UNK_DMG_0x1C */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Unblockable */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* UNK_DMG_0x1E */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), + /* Powder Keg */ DMG_ENTRY(0, ZO_DMG_EFF_NONE), }; -#endif +static ActorAnimationEntryS sAnimations[] = { + { &gZoraIdleAnim, 1.0f, 0, -1, 0, 0 }, { &gZoraIdleAnim, 1.0f, 0, -1, 0, -4 }, + { &gZoraSurfacingAnim, 1.0f, 0, -1, 0, -4 }, { &gZoraHandsOnHipsTappingFootAnim, 1.0f, 0, -1, 0, -4 }, + { &gZoraArmsOpenAnim, 1.0f, 0, -1, 0, -4 }, { &gZoraThrowRupeeAnim, 1.0f, 0, -1, 0, -4 }, + { &gZoraWalkAnim, 1.0f, 0, -1, 0, -4 }, +}; -extern ColliderCylinderInit D_8099F4B0; -extern CollisionCheckInfoInit2 D_8099F4DC; -extern DamageTable D_8099F4E8; +s8 D_8099F578[] = { -1, 1, 12, 13, 14, 9, 10, 11, 0, 6, 7, 8, 3, 4, 5, 2, -1, -1, -1, -1 }; +s8 D_8099F58C[] = { 0, 0, 0, 0, 3, 4, 0, 6, 7, 0, 9, 10, 0, 12, 13 }; +u8 D_8099F59C[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -extern UNK_TYPE D_0600D208; +s32 EnZo_SetAnimation(SkelAnime* skelAnime, s16 index) { + s16 frameCount; + s32 didChange = false; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099E790.s") + if ((index >= 0) && (index < ARRAY_COUNT(sAnimations))) { + didChange = true; + frameCount = sAnimations[index].frameCount; + if (frameCount < 0) { + frameCount = Animation_GetLastFrame(sAnimations[index].animationSeg); + } + Animation_Change(skelAnime, sAnimations[index].animationSeg, sAnimations[index].playbackSpeed, + sAnimations[index].frame, frameCount, sAnimations[index].mode, + sAnimations[index].transitionRate); + } + return didChange; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099E858.s") +s32 EnZo_PlayWalkingSound(EnZo* this, GlobalContext* globalCtx) { + u8 leftWasGrounded; + u8 rightWasGrounded; + s32 waterSfxId; + u16 sfxId; + u8 isFootGrounded; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099E96C.s") + leftWasGrounded = this->isLeftFootGrounded; + rightWasGrounded = this->isRightFootGrounded; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099E9E0.s") + if (this->actor.bgCheckFlags & 0x20) { + if (this->actor.depthInWater < 20.0f) { + waterSfxId = NA_SE_PL_WALK_WATER0 - SFX_FLAG; + } else { + waterSfxId = NA_SE_PL_WALK_WATER1 - SFX_FLAG; + } + sfxId = waterSfxId + SFX_FLAG; + } else { + sfxId = SurfaceType_GetSfx(&globalCtx->colCtx, this->actor.floorPoly, this->actor.floorBgId) + SFX_FLAG; + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099EA60.s") + this->isLeftFootGrounded = isFootGrounded = func_8013DB90(globalCtx, &this->leftFootPos, -6.0f); + if ((this->isLeftFootGrounded) && (!leftWasGrounded) && (isFootGrounded)) { + Actor_PlaySfxAtPos(&this->actor, sfxId); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099EBD8.s") + this->isRightFootGrounded = isFootGrounded = func_8013DB90(globalCtx, &this->rightFootPos, -6.0f); + if ((this->isRightFootGrounded) && (!rightWasGrounded) && (isFootGrounded)) { + Actor_PlaySfxAtPos(&this->actor, sfxId); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099EC50.s") + return 0; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099ED4C.s") +void EnZo_Blink(EnZo* this, s32 maxEyeIndex) { + if (DECR(this->blinkTimer) == 0) { + this->eyeIndex++; + if (this->eyeIndex >= maxEyeIndex) { + this->eyeIndex = 0; + this->blinkTimer = Rand_S16Offset(30, 30); + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099EE24.s") +void EnZo_UpdateCollider(EnZo* this, GlobalContext* globalCtx) { + this->collider.dim.pos.x = this->actor.world.pos.x; + this->collider.dim.pos.y = this->actor.world.pos.y; + this->collider.dim.pos.z = this->actor.world.pos.z; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/EnZo_Init.s") + CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); + CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/EnZo_Destroy.s") +void EnZo_LookAtPlayer(EnZo* this, GlobalContext* globalCtx) { + static u16 D_8099F5AC[] = { 4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6 }; + Player* player = GET_PLAYER(globalCtx); + Vec3f focus; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/EnZo_Update.s") + SkelAnime_Update(&this->skelAnime); + if (func_8013D5E8(this->actor.shape.rot.y, 10000, this->actor.yawTowardsPlayer)) { + focus.x = player->actor.world.pos.x; + focus.y = player->bodyPartsPos[7].y + 3.0f; + focus.z = player->actor.world.pos.z; + func_8013D2E0(&focus, &this->actor.focus.pos, &this->actor.shape.rot, &this->headRotTarget, &this->headRot, + &this->upperBodyRot, D_8099F5AC); + } else { + Math_SmoothStepToS(&this->headRotTarget.x, 0, 4, 1000, 1); + Math_SmoothStepToS(&this->headRotTarget.y, 0, 4, 1000, 1); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099EFF4.s") + Math_SmoothStepToS(&this->headRot.x, 0, 4, 1000, 1); + Math_SmoothStepToS(&this->headRot.y, 0, 4, 1000, 1); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/func_8099F15C.s") + Math_SmoothStepToS(&this->upperBodyRot.x, 0, 4, 1000, 1); + Math_SmoothStepToS(&this->upperBodyRot.y, 0, 4, 1000, 1); + } -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Zo/EnZo_Draw.s") + EnZo_Blink(this, 3); + func_8013D9C8(globalCtx, this->limbRotY, this->limbRotZ, 20); +} + +void EnZo_Walk(EnZo* this, GlobalContext* globalCtx) { + if (ENZO_GET_PATH(&this->actor) != ENZO_NO_PATH) { + EnZo_SetAnimation(&this->skelAnime, 6); + } + + if (ENZO_GET_PATH(&this->actor) != ENZO_NO_PATH) { + this->actionFunc = EnZo_FollowPath; + } else { + this->actionFunc = EnZo_DoNothing; + } +} + +void EnZo_FollowPath(EnZo* this, GlobalContext* globalCtx) { + s16 speed; + Vec3f pos; + + Math_SmoothStepToF(&this->actor.speedXZ, 1.0f, 0.4f, 1000.0f, 0.0f); + speed = this->actor.speedXZ * 400.0f; + if (func_8013D68C(this->path, this->waypoint, &pos) && func_8013D768(&this->actor, &pos, speed)) { + this->waypoint++; + if (this->waypoint >= this->path->count) { + this->waypoint = 0; + } + } + + if (this->actor.depthInWater > 60.0f) { + EnZo_SetAnimation(&this->skelAnime, 1); + this->actionFunc = EnZo_TreadWater; + this->actor.gravity = 0.0f; + this->actor.speedXZ = 0.0f; + } +} + +void EnZo_TreadWater(EnZo* this, GlobalContext* globalCtx) { + f32 targetYVel; + + if (this->actor.depthInWater < (sREG(0) + 50.0f)) { + targetYVel = -1.0f; + } else { + targetYVel = 1.0f; + } + Math_ApproachF(&this->actor.velocity.y, targetYVel, (sREG(1) + 18.0f) * 0.01f, (sREG(2) + 12.0f) * 0.01f); +} + +void EnZo_DoNothing(EnZo* this, GlobalContext* globalCtx) { +} + +void EnZo_Init(Actor* thisx, GlobalContext* globalCtx) { + EnZo* this = THIS; + s32 pad; + + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, NULL, this->jointTable, this->morphTable, 20); + EnZo_SetAnimation(&this->skelAnime, 0); + + Collider_InitCylinder(globalCtx, &this->collider); + Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); + + this->path = func_8013D648(globalCtx, ENZO_GET_PATH(&this->actor), ENZO_NO_PATH); + Actor_SetScale(&this->actor, 0.01f); + + this->actionFunc = EnZo_Walk; + this->actor.gravity = -4.0f; +} + +void EnZo_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnZo* this = THIS; + + Collider_DestroyCylinder(globalCtx, &this->collider); +} + +void EnZo_Update(Actor* thisx, GlobalContext* globalCtx) { + EnZo* this = THIS; + + this->actionFunc(this, globalCtx); + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + EnZo_LookAtPlayer(this, globalCtx); + EnZo_PlayWalkingSound(this, globalCtx); + EnZo_UpdateCollider(this, globalCtx); +} + +s32 EnZo_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx, + Gfx** gfx) { + EnZo* this = THIS; + + if (limbIndex == 15) { + Matrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); + Matrix_InsertXRotation_s(this->headRot.y, MTXMODE_APPLY); + Matrix_InsertZRotation_s(-this->headRot.x, MTXMODE_APPLY); + Matrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); + } + + if (limbIndex == 8) { + Matrix_InsertXRotation_s(-this->upperBodyRot.y, MTXMODE_APPLY); + Matrix_InsertZRotation_s(-this->upperBodyRot.x, MTXMODE_APPLY); + } + + if ((limbIndex == 8) || (limbIndex == 9) || (limbIndex == 12)) { + rot->y += (s16)(Math_SinS(this->limbRotY[limbIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->limbRotZ[limbIndex]) * 200.0f); + } + return false; +} + +void EnZo_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx, Gfx** gfx) { + EnZo* this = THIS; + Vec3f sp30 = { 400.0f, 0.0f, 0.0f }; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; + + if (D_8099F578[limbIndex] >= 0) { + Matrix_MultiplyVector3fByState(&zeroVec, &this->unk_364[D_8099F578[limbIndex]]); + } + if (limbIndex == 15) { + Matrix_MultiplyVector3fByState(&sp30, &this->actor.focus.pos); + } + if (limbIndex == 4) { + Matrix_MultiplyVector3fByState(&zeroVec, &this->leftFootPos); + } + if (limbIndex == 7) { + Matrix_MultiplyVector3fByState(&zeroVec, &this->rightFootPos); + } +} + +static Gfx sTransparencyDlist[] = { + gsDPSetRenderMode(AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | + G_RM_FOG_SHADE_A, + AA_EN | Z_CMP | Z_UPD | IM_RD | CLR_ON_CVG | CVG_DST_WRAP | ZMODE_XLU | FORCE_BL | + GBL_c2(G_BL_CLR_IN, G_BL_A_IN, G_BL_CLR_MEM, G_BL_1MA)), + gsDPSetAlphaCompare(G_AC_THRESHOLD), + gsSPEndDisplayList(), +}; + +void EnZo_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnZo* this = THIS; + s32 i; + u8* shadowTex = GRAPH_ALLOC(globalCtx->state.gfxCtx, sizeof(u8) * SQ(64)); + u8* shadowTexIter; + TexturePtr eyeTextures[] = { &gZoraEyeOpenTex, &gZoraEyeHalfTex, &gZoraEyeClosedTex }; + + OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C28C(globalCtx->state.gfxCtx); + + gDPPipeSync(POLY_OPA_DISP++); + gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); + gDPPipeSync(POLY_OPA_DISP++); + gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(eyeTextures[this->eyeIndex])); + gSPSegment(POLY_OPA_DISP++, 0x0C, &sTransparencyDlist[2]); + + POLY_OPA_DISP = + SkelAnime_DrawFlex(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, + EnZo_OverrideLimbDraw, EnZo_PostLimbDraw, &this->actor, POLY_OPA_DISP); + Matrix_InsertXRotation_s(0, 0); + + for (i = 0, shadowTexIter = shadowTex; i < (s32)sizeof(u8) * SQ(64); i++) { + *shadowTexIter = 0; + shadowTexIter++; + } + for (i = 0; i < 5; i++) { + func_8013CD64(this->unk_364, &this->actor.world.pos, shadowTex, i / 5.0f, 15, D_8099F59C, D_8099F58C); + } + + func_8013CF04(&this->actor, &globalCtx->state.gfxCtx, shadowTex); + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.h b/src/overlays/actors/ovl_En_Zo/z_en_zo.h index a823a1ec07..0b9f8dab16 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.h +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.h @@ -7,12 +7,33 @@ struct EnZo; typedef void (*EnZoActionFunc)(struct EnZo*, GlobalContext*); +#define ENZO_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) +#define ENZO_NO_PATH 0x3F + typedef struct EnZo { /* 0x0000 */ Actor actor; /* 0x0144 */ EnZoActionFunc actionFunc; - /* 0x0148 */ char unk_148[0x2DC]; + /* 0x0148 */ SkelAnime skelAnime; + /* 0x0194 */ ColliderCylinder collider; + /* 0x01D8 */ UNK_TYPE1 unk_1D8[0x4]; + /* 0x01DC */ Path* path; + /* 0x01E0 */ s16 waypoint; + /* 0x01E4 */ Vec3f leftFootPos; + /* 0x01F0 */ Vec3f rightFootPos; + /* 0x01FC */ u8 isLeftFootGrounded; + /* 0x01FD */ u8 isRightFootGrounded; + /* 0x01FE */ Vec3s jointTable[20]; + /* 0x0276 */ Vec3s morphTable[20]; + /* 0x02EE */ Vec3s headRotTarget; + /* 0x02F4 */ Vec3s headRot; + /* 0x02FA */ Vec3s upperBodyRot; + /* 0x0300 */ UNK_TYPE1 unk_300[0x12]; + /* 0x0312 */ s16 limbRotY[20]; + /* 0x033A */ s16 limbRotZ[20]; + /* 0x0364 */ Vec3f unk_364[15]; + /* 0x041A */ UNK_TYPE1 unk_41A[0x6]; + /* 0x041E */ s16 eyeIndex; + /* 0x0420 */ s16 blinkTimer; } EnZo; // size = 0x424 -extern const ActorInit En_Zo_InitVars; - #endif // Z_EN_ZO_H diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index d03002dd7d..1526bf0969 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -86,8 +86,7 @@ void EnZot_Init(Actor* thisx, GlobalContext* globalCtx2) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); Actor_SetScale(&this->actor, 0.01f); this->actionFunc = func_80B97100; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_zo_Skel_00D208, &object_zo_Anim_004248, this->jointTable, - this->morphTable, 20); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gZoraSkel, &gZoraIdleAnim, this->jointTable, this->morphTable, 20); Animation_PlayLoop(&this->skelAnime, &object_zo_Anim_00DE20); this->unk_2F0 = 0; Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); @@ -236,7 +235,7 @@ void EnZot_Destroy(Actor* thisx, GlobalContext* globalCtx) { void func_80B96BEC(EnZot* this, s16 arg1, u8 arg2) { static AnimationHeader* sAnimations[] = { - &object_zo_Anim_00DE20, &object_zo_Anim_002898, &object_zo_Anim_00F4E8, &object_zo_Anim_00E400, + &object_zo_Anim_00DE20, &gZoraWalkAnim, &object_zo_Anim_00F4E8, &object_zo_Anim_00E400, &object_zo_Anim_00FDF0, &object_zo_Anim_010B18, &object_zo_Anim_011424, &object_zo_Anim_00EDF0, &object_zo_Anim_00DF54, &object_zo_Anim_00DF54, }; @@ -1386,9 +1385,9 @@ void EnZot_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve void EnZot_Draw(Actor* thisx, GlobalContext* globalCtx) { TexturePtr sp4C[] = { - object_zo_Tex_0050A0, - object_zo_Tex_0058A0, - object_zo_Tex_0060A0, + gZoraEyeOpenTex, + gZoraEyeHalfTex, + gZoraEyeClosedTex, }; EnZot* this = THIS; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index b8ef4b8f78..e6a32baa68 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -8615,20 +8615,20 @@ 0x8099D7DC:("OceffWipe4_Destroy",), 0x8099D810:("OceffWipe4_Update",), 0x8099D870:("OceffWipe4_Draw",), - 0x8099E790:("func_8099E790",), - 0x8099E858:("func_8099E858",), - 0x8099E96C:("func_8099E96C",), - 0x8099E9E0:("func_8099E9E0",), - 0x8099EA60:("func_8099EA60",), - 0x8099EBD8:("func_8099EBD8",), - 0x8099EC50:("func_8099EC50",), - 0x8099ED4C:("func_8099ED4C",), - 0x8099EE24:("func_8099EE24",), + 0x8099E790:("EnZo_SetAnimation",), + 0x8099E858:("EnZo_PlayWalkingSound",), + 0x8099E96C:("EnZo_Blink",), + 0x8099E9E0:("EnZo_UpdateCollider",), + 0x8099EA60:("EnZo_LookAtPlayer",), + 0x8099EBD8:("EnZo_Walk",), + 0x8099EC50:("EnZo_FollowPath",), + 0x8099ED4C:("EnZo_TreadWater",), + 0x8099EE24:("EnZo_DoNothing",), 0x8099EE34:("EnZo_Init",), 0x8099EF40:("EnZo_Destroy",), 0x8099EF6C:("EnZo_Update",), - 0x8099EFF4:("func_8099EFF4",), - 0x8099F15C:("func_8099F15C",), + 0x8099EFF4:("EnZo_OverrideLimbDraw",), + 0x8099F15C:("EnZo_PostLimbDraw",), 0x8099F268:("EnZo_Draw",), 0x8099F730:("EffectSsIceSmoke_Init",), 0x8099F7F4:("EffectSsIceSmoke_Draw",), diff --git a/undefined_syms.txt b/undefined_syms.txt index 8e0d134b06..2881bd48ea 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -2118,10 +2118,6 @@ D_06005F48 = 0x06005F48; D_06013328 = 0x06013328; -// ovl_En_Zo - -D_0600D208 = 0x0600D208; - // ovl_En_Zob D_06006998 = 0x06006998;