diff --git a/assets/xml/objects/object_sa.xml b/assets/xml/objects/object_sa.xml new file mode 100644 index 0000000000..dd44fdde36 --- /dev/null +++ b/assets/xml/objects/object_sa.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spec b/spec index 9c2d1d7889..8715fd6cfa 100644 --- a/spec +++ b/spec @@ -4599,7 +4599,8 @@ endseg beginseg name "object_sa" romalign 0x1000 - include "build/baserom/object_sa.o" + include "build/assets/objects/object_sa/object_sa.o" + number 6 endseg beginseg diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index 77b5967792..e2d64e61f1 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -6,6 +6,7 @@ #include "z_demo_sa.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" +#include "objects/object_sa/object_sa.h" #include "vt.h" @@ -40,16 +41,33 @@ void func_8098FC9C(DemoSa* this, GlobalContext* globalCtx); void func_8098FCD4(DemoSa* this, GlobalContext* globalCtx); void func_8098FD0C(DemoSa* this, GlobalContext* globalCtx); -void func_8098FEA8(DemoSa* this, GlobalContext* globalCtx); -void func_8098FEB4(DemoSa* this, GlobalContext* globalCtx); -void func_8098F1C0(DemoSa* this, GlobalContext* globalCtx); +void DemoSa_DrawNothing(DemoSa* this, GlobalContext* globalCtx); +void DemoSa_DrawOpa(DemoSa* this, GlobalContext* globalCtx); +void DemoSa_DrawXlu(DemoSa* this, GlobalContext* globalCtx); -static UNK_PTR D_809900E0[] = { - 0x06002F48, 0x06003C48, 0x06003848, 0x06004848, 0x06004E48, +typedef enum { + /* 0 */ SARIA_EYE_OPEN, + /* 1 */ SARIA_EYE_HALF, + /* 2 */ SARIA_EYE_CLOSED, + /* 3 */ SARIA_EYE_SUPRISED, + /* 4 */ SARIA_EYE_SAD +} SariaEyeState; + +typedef enum { + /* 0 */ SARIA_MOUTH_CLOSED2, + /* 1 */ SARIA_MOUTH_SUPRISED, + /* 2 */ SARIA_MOUTH_CLOSED, + /* 3 */ SARIA_MOUTH_SMILING_OPEN, + /* 4 */ SARIA_MOUTH_FROWNING +} SariaMouthState; + +static u64* sEyeTextures[] = { + gSariaEyeOpenTex, gSariaEyeHalfTex, gSariaEyeClosedTex, gSariaEyeSuprisedTex, gSariaEyeSadTex, }; -static UNK_PTR D_809900F4[] = { - 0x06003588, 0x06004C48, 0x06003348, 0x06004448, 0x06004648, +static u64* sMouthTextures[] = { + gSariaMouthClosed2Tex, gSariaMouthSuprisedTex, gSariaMouthClosedTex, + gSariaMouthSmilingOpenTex, gSariaMouthFrowningTex, }; static u32 D_80990108 = 0; @@ -63,9 +81,9 @@ static DemoSaActionFunc sActionFuncs[] = { }; static DemoSaDrawFunc sDrawFuncs[] = { - func_8098FEA8, - func_8098FEB4, - func_8098F1C0, + DemoSa_DrawNothing, + DemoSa_DrawOpa, + DemoSa_DrawXlu, }; const ActorInit Demo_Sa_InitVars = { @@ -86,41 +104,27 @@ void DemoSa_Destroy(Actor* thisx, GlobalContext* globalCtx) { SkelAnime_Free(&this->skelAnime, globalCtx); } -extern AnimationHeader D_06001334; -extern AnimationHeader D_060021D8; -extern Gfx D_06007B80[]; -extern FlexSkeletonHeader D_0600B1A0; -extern AnimationHeader D_0600DF80; -extern AnimationHeader D_0600E500; -extern AnimationHeader D_0600F580; -extern AnimationHeader D_0600FCE0; -extern AnimationHeader D_0600FFD4; -extern AnimationHeader D_0601113C; -extern AnimationHeader D_060135EC; -extern AnimationHeader D_06013CD8; -extern AnimationHeader D_060140BC; - void func_8098E480(DemoSa* this) { s32 pad[2]; - s16* unk_190 = &this->unk_190; - s16* unk_192 = &this->unk_192; + s16* eyeIndex = &this->eyeIndex; + s16* blinkTimer = &this->blinkTimer; - if (DECR(*unk_192) == 0) { - *unk_192 = Rand_S16Offset(0x3C, 0x3C); + if (DECR(*blinkTimer) == 0) { + *blinkTimer = Rand_S16Offset(0x3C, 0x3C); } - *unk_190 = *unk_192; - if (*unk_190 >= 3) { - *unk_190 = 0; + *eyeIndex = *blinkTimer; + if (*eyeIndex >= 3) { + *eyeIndex = 0; } } -void func_8098E508(DemoSa* this, s16 arg1) { - this->unk_190 = arg1; +void DemoSa_SetEyeIndex(DemoSa* this, s16 eyeIndex) { + this->eyeIndex = eyeIndex; } -void func_8098E51C(DemoSa* this, s16 arg1) { - this->unk_194 = arg1; +void DemoSa_SetMouthIndex(DemoSa* this, s16 mouthIndex) { + this->mouthIndex = mouthIndex; } void func_8098E530(DemoSa* this) { @@ -212,10 +216,10 @@ void func_8098E76C(DemoSa* this, AnimationHeader* animHeaderSeg, u8 arg2, f32 tr } void func_8098E7FC(DemoSa* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B1A0, &D_060021D8, NULL, NULL, 0); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaWaitArmsToSideAnim, NULL, NULL, 0); this->actor.shape.yOffset = -10000.0f; - func_8098E508(this, 1); - func_8098E51C(this, 0); + DemoSa_SetEyeIndex(this, SARIA_EYE_HALF); + DemoSa_SetMouthIndex(this, SARIA_MOUTH_CLOSED2); } void func_8098E86C(DemoSa* this, GlobalContext* globalCtx) { @@ -282,8 +286,8 @@ void func_8098EA68(DemoSa* this, GlobalContext* globalCtx) { if (globalCtx->csCtx.state != CS_STATE_IDLE) { npcAction = globalCtx->csCtx.npcActions[4]; if ((npcAction != NULL) && (npcAction->action == 3)) { - Animation_Change(&this->skelAnime, &D_0600DF80, 1.0f, 0.0f, Animation_GetLastFrame(&D_0600DF80), - ANIMMODE_ONCE, -4.0f); + Animation_Change(&this->skelAnime, &gSariaGiveForestMedallionAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gSariaGiveForestMedallionAnim), ANIMMODE_ONCE, -4.0f); this->action = 4; } } @@ -291,8 +295,8 @@ void func_8098EA68(DemoSa* this, GlobalContext* globalCtx) { void func_8098EB00(DemoSa* this, s32 arg1) { if (arg1 != 0) { - Animation_Change(&this->skelAnime, &D_0600E500, 1.0f, 0.0f, Animation_GetLastFrame(&D_0600E500), ANIMMODE_LOOP, - 0.0f); + Animation_Change(&this->skelAnime, &gSariaGiveForestMedallionStandAnim, 1.0f, 0.0f, + Animation_GetLastFrame(&gSariaGiveForestMedallionStandAnim), ANIMMODE_LOOP, 0.0f); this->action = 5; } } @@ -348,22 +352,22 @@ void func_8098ECCC(DemoSa* this, GlobalContext* globalCtx) { void func_8098ECF4(DemoSa* this, GlobalContext* globalCtx) { s32 pad[2]; SkelAnime* skelAnime = &this->skelAnime; - f32 frameCount = Animation_GetLastFrame(&D_06001334); + f32 frameCount = Animation_GetLastFrame(&gSariaSealGanonAnim); - SkelAnime_InitFlex(globalCtx, skelAnime, &D_0600B1A0, NULL, NULL, NULL, 0); - Animation_Change(skelAnime, &D_06001334, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); + SkelAnime_InitFlex(globalCtx, skelAnime, &gSariaSkel, NULL, NULL, NULL, 0); + Animation_Change(skelAnime, &gSariaSealGanonAnim, 1.0f, 0.0f, frameCount, ANIMMODE_ONCE, 0.0f); this->action = 7; this->actor.shape.shadowAlpha = 0; - func_8098E508(this, 2); - func_8098E51C(this, 2); + DemoSa_SetEyeIndex(this, SARIA_EYE_CLOSED); + DemoSa_SetMouthIndex(this, SARIA_MOUTH_CLOSED); } void func_8098EDB0(DemoSa* this) { f32 curFrame = this->skelAnime.curFrame; if ((this->skelAnime.mode == 2) && (curFrame >= 32.0f)) { - func_8098E508(this, 1); - func_8098E51C(this, 0); + DemoSa_SetEyeIndex(this, SARIA_EYE_HALF); + DemoSa_SetMouthIndex(this, SARIA_MOUTH_CLOSED2); } } @@ -450,13 +454,13 @@ void func_8098F16C(DemoSa* this, GlobalContext* globalCtx) { func_8098E554(this, globalCtx); } -void func_8098F1C0(DemoSa* this, GlobalContext* globalCtx) { +void DemoSa_DrawXlu(DemoSa* this, GlobalContext* globalCtx) { s32 pad[2]; - s16 unk_190 = this->unk_190; - UNK_PTR sp78 = D_809900E0[unk_190]; - s16 unk_194 = this->unk_194; + s16 eyeIndex = this->eyeIndex; + UNK_PTR sp78 = sEyeTextures[eyeIndex]; + s16 mouthIndex = this->mouthIndex; s32 pad2; - UNK_PTR sp6C = D_809900F4[unk_194]; + UNK_PTR sp6C = sMouthTextures[mouthIndex]; SkelAnime* skelAnime = &this->skelAnime; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa_inKenjyanomaDemo02.c", 296); @@ -476,7 +480,7 @@ void func_8098F1C0(DemoSa* this, GlobalContext* globalCtx) { } void func_8098F390(DemoSa* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B1A0, &D_060021D8, NULL, NULL, 0); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaWaitArmsToSideAnim, NULL, NULL, 0); this->action = 10; this->drawConfig = 1; } @@ -488,7 +492,7 @@ void func_8098F3F0(DemoSa* this, GlobalContext* globalCtx) { } void func_8098F420(DemoSa* this, GlobalContext* globalCtx) { - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B1A0, &D_0600FFD4, NULL, NULL, 0); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaSitting3Anim, NULL, NULL, 0); this->action = 11; this->drawConfig = 0; this->actor.shape.shadowAlpha = 0; @@ -523,18 +527,18 @@ void func_8098F544(DemoSa* this) { } void func_8098F590(DemoSa* this) { - func_8098E76C(this, &D_0600F580, 2, -8.0f, 0); + func_8098E76C(this, &gSariaSitting1Anim, 2, -8.0f, 0); this->action = 14; } void func_8098F5D0(DemoSa* this) { - func_8098E76C(this, &D_0600FCE0, 2, 0.0f, 0); + func_8098E76C(this, &gSariaSitting2Anim, 2, 0.0f, 0); this->action = 15; } void func_8098F610(DemoSa* this, s32 arg1) { if (arg1 != 0) { - func_8098E76C(this, &D_0600FFD4, 0, 0.0f, 0); + func_8098E76C(this, &gSariaSitting3Anim, 0, 0.0f, 0); this->action = 13; } } @@ -604,14 +608,14 @@ void func_8098F7FC(DemoSa* this, GlobalContext* globalCtx) { void func_8098F83C(DemoSa* this, GlobalContext* globalCtx) { Vec3f* thisPos = &this->actor.world.pos; - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B1A0, &D_0601113C, NULL, NULL, 0); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, &gSariaWaitOnBridgeAnim, NULL, NULL, 0); Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, thisPos->x, thisPos->y, thisPos->z, 0, 0, 0, FAIRY_KOKIRI); this->action = 16; this->drawConfig = 0; this->actor.shape.shadowAlpha = 0; - func_8098E508(this, 4); - func_8098E51C(this, 2); + DemoSa_SetEyeIndex(this, SARIA_EYE_SAD); + DemoSa_SetMouthIndex(this, SARIA_MOUTH_CLOSED); } void func_8098F8F8(DemoSa* this) { @@ -643,13 +647,13 @@ void func_8098F998(DemoSa* this, GlobalContext* globalCtx) { this->unk_1B0 = 0; this->actor.shape.shadowAlpha = 0; } else { - func_8098E76C(this, &D_0601113C, 0, 0.0f, 0); + func_8098E76C(this, &gSariaWaitOnBridgeAnim, 0, 0.0f, 0); this->action = 18; this->drawConfig = 1; this->unk_1B0 = 0; this->actor.shape.shadowAlpha = 0xFF; } - func_8098E508(this, 4); + DemoSa_SetEyeIndex(this, SARIA_EYE_SAD); } void func_8098FA2C(DemoSa* this) { @@ -662,16 +666,16 @@ void func_8098FA2C(DemoSa* this) { } void func_8098FA84(DemoSa* this) { - func_8098E76C(this, &D_060140BC, 0, 0.0f, 0); + func_8098E76C(this, &gSariaHoldOcarinaAnim, 0, 0.0f, 0); this->action = 19; this->drawConfig = 1; this->unk_1B0 = 1; this->actor.shape.shadowAlpha = 0xFF; - func_8098E508(this, 2); + DemoSa_SetEyeIndex(this, SARIA_EYE_CLOSED); } void func_8098FAE0(DemoSa* this) { - func_8098E76C(this, &D_060135EC, 2, -8.0f, 0); + func_8098E76C(this, &gSariaGiveLinkOcarinaAnim, 2, -8.0f, 0); this->action = 20; this->drawConfig = 1; this->unk_1B0 = 1; @@ -680,7 +684,7 @@ void func_8098FAE0(DemoSa* this) { void func_8098FB34(DemoSa* this, s32 arg1) { if (arg1 != 0) { - func_8098E76C(this, &D_06013CD8, 0, 0, 0); + func_8098E76C(this, &gSariaHoldOutOcarinaAnim, 0, 0, 0); } } @@ -780,30 +784,30 @@ s32 DemoSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList DemoSa* this = THIS; if ((limbIndex == 15) && (this->unk_1B0 != 0)) { - *dList = D_06007B80; + *dList = gSariaRightHandAndOcarinaDL; } return false; } -void func_8098FEA8(DemoSa* this, GlobalContext* globalCtx) { +void DemoSa_DrawNothing(DemoSa* this, GlobalContext* globalCtx) { } -void func_8098FEB4(DemoSa* this, GlobalContext* globalCtx) { +void DemoSa_DrawOpa(DemoSa* this, GlobalContext* globalCtx) { s32 pad[2]; - s16 unk_190 = this->unk_190; - UNK_PTR sp70 = D_809900E0[unk_190]; + s16 eyeIndex = this->eyeIndex; + UNK_PTR eyeTex = sEyeTextures[eyeIndex]; s32 pad2; - s16 unk_194 = this->unk_194; - UNK_PTR sp64 = D_809900F4[unk_194]; + s16 mouthIndex = this->mouthIndex; + UNK_PTR mouthTex = sMouthTextures[mouthIndex]; SkelAnime* skelAnime = &this->skelAnime; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_demo_sa.c", 602); func_80093D18(globalCtx->state.gfxCtx); - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sp70)); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sp70)); - gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sp64)); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTex)); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(eyeTex)); + gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(mouthTex)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255); gSPSegment(POLY_OPA_DISP++, 0x0C, &D_80116280[2]); diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h index c291d012e2..3d64e53f2b 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.h @@ -12,9 +12,9 @@ typedef void (*DemoSaDrawFunc)(struct DemoSa*, GlobalContext*); typedef struct DemoSa { /* 0x0000 */ Actor actor; /* 0x014C */ SkelAnime skelAnime; - /* 0x0190 */ s16 unk_190; - /* 0x0192 */ s16 unk_192; - /* 0x0194 */ s16 unk_194; + /* 0x0190 */ s16 eyeIndex; + /* 0x0192 */ s16 blinkTimer; + /* 0x0194 */ s16 mouthIndex; /* 0x0198 */ s32 action; /* 0x019C */ s32 drawConfig; /* 0x01A0 */ f32 unk_1A0; diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index d21aaf202c..141f3a034a 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -1,5 +1,6 @@ #include "z_en_sa.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" +#include "objects/object_sa/object_sa.h" #define FLAGS 0x02000019 @@ -16,6 +17,22 @@ void func_80AF683C(EnSa* this, GlobalContext* globalCtx); void func_80AF68E4(EnSa* this, GlobalContext* globalCtx); void func_80AF6B20(EnSa* this, GlobalContext* globalCtx); +typedef enum { + /* 0 */ SARIA_EYE_OPEN, + /* 1 */ SARIA_EYE_HALF, + /* 2 */ SARIA_EYE_CLOSED, + /* 3 */ SARIA_EYE_SUPRISED, + /* 4 */ SARIA_EYE_SAD +} SariaEyeState; + +typedef enum { + /* 0 */ SARIA_MOUTH_CLOSED2, + /* 1 */ SARIA_MOUTH_SUPRISED, + /* 2 */ SARIA_MOUTH_CLOSED, + /* 3 */ SARIA_MOUTH_SMILING_OPEN, + /* 4 */ SARIA_MOUTH_FROWNING +} SariaMouthState; + const ActorInit En_Sa_InitVars = { ACTOR_EN_SA, ACTORCAT_NPC, @@ -53,32 +70,36 @@ static CollisionCheckInfoInit2 sColChkInfoInit = { }; static struct_D_80AA1678 sAnimationInfo[] = { - { 0x060021D8, 1.0f, ANIMMODE_LOOP, 0.0f }, { 0x0600E908, 1.0f, ANIMMODE_ONCE, -10.0f }, - { 0x0600F1D4, 1.0f, ANIMMODE_LOOP, -10.0f }, { 0x0600EBB0, 1.0f, ANIMMODE_LOOP, -10.0f }, - { 0x060021D8, 1.0f, ANIMMODE_LOOP, -10.0f }, { 0x06010C44, 1.0f, ANIMMODE_LOOP, -10.0f }, - { 0x0600BAEC, 1.0f, ANIMMODE_LOOP, -10.0f }, { 0x0600C500, 1.0f, ANIMMODE_ONCE, -10.0f }, - { 0x06001D50, 1.0f, ANIMMODE_ONCE, -10.0f }, { 0x0600CFD8, 1.0f, ANIMMODE_ONCE, -10.0f }, - { 0x0600D7E8, 1.0f, ANIMMODE_ONCE, -10.0f }, { 0x0600BAEC, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gSariaWaitArmsToSideAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, + { &gSariaLookUpArmExtendedAnim, 1.0f, ANIMMODE_ONCE, -10.0f }, + { &gSariaWaveAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, + { &gSariaRunAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, + { &gSariaWaitArmsToSideAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, + { &gSariaLookOverShoulderAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, + { &gSariaPlayingOcarinaAnim, 1.0f, ANIMMODE_LOOP, -10.0f }, + { &gSariaStopPlayingOcarinaAnim, 1.0f, ANIMMODE_ONCE, -10.0f }, + { &gSariaOcarinaToMouthAnim, 1.0f, ANIMMODE_ONCE, -10.0f }, + { &gSariaLinkLearnedSariasSongAnim, 1.0f, ANIMMODE_ONCE, -10.0f }, + { &gSariaReturnToOcarinaAnim, 1.0f, ANIMMODE_ONCE, -10.0f }, + { &gSariaPlayingOcarinaAnim, 1.0f, ANIMMODE_LOOP, 0.0f }, }; static struct_80034EC0_Entry sAnimations[] = { - { 0x0601291C, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { 0x06011580, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -4.0f }, - { 0x06013008, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, { 0x0601186C, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, - { 0x06014470, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, { 0x06014850, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, - { 0x06011C38, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, { 0x06012100, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, - { 0x06015220, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { 0x060021D8, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, + { &gSariaTransitionHandsSideToChestToSideAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, + { &gSariaTransitionHandsSideToBackAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -4.0f }, + { &gSariaRightArmExtendedWaitAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, + { &gSariaHandsOutAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, + { &gSariaStandHandsOnHipsAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, + { &gSariaExtendRightArmAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, + { &gSariaTransitionHandsSideToHipsAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, + { &gSariaHandsBehindBackWaitAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, + { &gSariaHandsOnFaceAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, + { &gSariaWaitArmsToSideAnim, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, }; extern CutsceneData D_02005730[]; extern CutsceneData D_02010E20[]; -extern AnimationHeader D_06001D50; -extern Gfx D_06007B80[]; -extern FlexSkeletonHeader D_0600B1A0; -extern AnimationHeader D_0600BAEC; -extern AnimationHeader D_0600C500; -extern AnimationHeader D_06012100; - s16 func_80AF5560(EnSa* this, GlobalContext* globalCtx) { s16 textState = func_8010BDBC(&globalCtx->msgCtx); @@ -319,7 +340,7 @@ void func_80AF5CE4(EnSa* this) { } } -void func_80AF5D8C(EnSa* this, s32 action) { +void EnSa_ChangeAnim(EnSa* this, s32 action) { Animation_Change(&this->skelAnime, sAnimationInfo[action].animation, 1.0f, 0.0f, Animation_GetLastFrame(sAnimationInfo[action].animation), sAnimationInfo[action].mode, sAnimationInfo[action].transitionRate); @@ -358,14 +379,14 @@ void func_80AF5F34(EnSa* this, GlobalContext* globalCtx) { phi_a3 = (this->actionFunc == func_80AF68E4) ? 1 : 4; } if (globalCtx->sceneNum == SCENE_SPOT05) { - phi_a3 = (this->skelAnime.animation == &D_0600BAEC) ? 1 : 3; + phi_a3 = (this->skelAnime.animation == &gSariaPlayingOcarinaAnim) ? 1 : 3; } if (globalCtx->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF6448 && - this->skelAnime.animation == &D_0600C500) { + this->skelAnime.animation == &gSariaStopPlayingOcarinaAnim) { phi_a3 = 1; } if (globalCtx->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF68E4 && - this->skelAnime.animation == &D_06001D50) { + this->skelAnime.animation == &gSariaOcarinaToMouthAnim) { phi_a3 = 1; } this->unk_1E0.unk_18 = player->actor.world.pos; @@ -374,14 +395,15 @@ void func_80AF5F34(EnSa* this, GlobalContext* globalCtx) { } s32 func_80AF603C(EnSa* this) { - if (this->skelAnime.animation != &D_0600BAEC && this->skelAnime.animation != &D_06001D50) { + if (this->skelAnime.animation != &gSariaPlayingOcarinaAnim && + this->skelAnime.animation != &gSariaOcarinaToMouthAnim) { return 0; } if (this->unk_1E0.unk_00 != 0) { return 0; } this->unk_20E = 0; - if (this->unk_212 != 2) { + if (this->rightEyeIndex != SARIA_EYE_CLOSED) { return 0; } return 1; @@ -398,13 +420,13 @@ void func_80AF609C(EnSa* this) { phi_v1 = this->unk_20E; } if (phi_v1 == 0) { - this->unk_212++; - if (this->unk_212 < 3) { - this->unk_214 = this->unk_212; + this->rightEyeIndex++; + if (this->rightEyeIndex < SARIA_EYE_SUPRISED) { + this->leftEyeIndex = this->rightEyeIndex; } else { this->unk_20E = Rand_S16Offset(30, 30); - this->unk_214 = 0; - this->unk_212 = this->unk_214; + this->leftEyeIndex = SARIA_EYE_OPEN; + this->rightEyeIndex = this->leftEyeIndex; } } } @@ -427,23 +449,23 @@ void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 12.0f); - SkelAnime_InitFlex(globalCtx, &this->skelAnime, &D_0600B1A0, NULL, this->jointTable, this->morphTable, 17); + SkelAnime_InitFlex(globalCtx, &this->skelAnime, &gSariaSkel, NULL, this->jointTable, this->morphTable, 17); Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, NULL, &sColChkInfoInit); switch (func_80AF5DFC(this, globalCtx)) { case 2: - func_80AF5D8C(this, 0xB); + EnSa_ChangeAnim(this, 0xB); this->actionFunc = func_80AF6448; break; case 5: - func_80AF5D8C(this, 0xB); + EnSa_ChangeAnim(this, 0xB); this->actionFunc = func_80AF683C; break; case 1: this->actor.gravity = -1.0f; - func_80AF5D8C(this, 0); + EnSa_ChangeAnim(this, 0); this->actionFunc = func_80AF6448; break; case 4: @@ -451,13 +473,13 @@ void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -1.0f; globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(D_02010E20); gSaveContext.cutsceneTrigger = 1; - func_80AF5D8C(this, 4); + EnSa_ChangeAnim(this, 4); this->actionFunc = func_80AF68E4; break; case 3: this->unk_210 = 0; this->actor.gravity = -1.0f; - func_80AF5D8C(this, 0); + EnSa_ChangeAnim(this, 0); this->actionFunc = func_80AF68E4; break; case 0: @@ -489,14 +511,14 @@ void func_80AF6448(EnSa* this, GlobalContext* globalCtx) { case 0x1002: if (this->unk_208 == 0 && this->unk_20B != 1) { func_80AF5CD4(this, 1); - this->unk_216 = 1; + this->mouthIndex = 1; } if (this->unk_208 == 2 && this->unk_20B != 2) { func_80AF5CD4(this, 2); - this->unk_216 = 1; + this->mouthIndex = 1; } if (this->unk_208 == 5) { - this->unk_216 = 0; + this->mouthIndex = 0; } break; case 0x1003: @@ -505,21 +527,23 @@ void func_80AF6448(EnSa* this, GlobalContext* globalCtx) { } break; case 0x1031: - if (this->unk_208 == 0 && this->unk_20B != 4 && this->skelAnime.animation == &D_06012100) { + if (this->unk_208 == 0 && this->unk_20B != 4 && + this->skelAnime.animation == &gSariaHandsBehindBackWaitAnim) { func_80AF5CD4(this, 4); - this->unk_216 = 3; + this->mouthIndex = 3; } if (this->unk_208 == 2 && this->unk_20B != 5) { func_80AF5CD4(this, 5); - this->unk_216 = 2; + this->mouthIndex = 2; } if (this->unk_208 == 4 && this->unk_20B != 6) { func_80AF5CD4(this, 6); - this->unk_216 = 0; + this->mouthIndex = 0; } break; case 0x1032: - if (this->unk_208 == 0 && this->unk_20B != 4 && this->skelAnime.animation == &D_06012100) { + if (this->unk_208 == 0 && this->unk_20B != 4 && + this->skelAnime.animation == &gSariaHandsBehindBackWaitAnim) { func_80AF5CD4(this, 4); } break; @@ -544,21 +568,21 @@ void func_80AF6448(EnSa* this, GlobalContext* globalCtx) { } func_80AF5CE4(this); } - if (this->skelAnime.animation == &D_0600C500) { + if (this->skelAnime.animation == &gSariaStopPlayingOcarinaAnim) { this->skelAnime.playSpeed = -1.0f; if ((s32)this->skelAnime.curFrame == 0) { - func_80AF5D8C(this, 6); + EnSa_ChangeAnim(this, 6); } } if (this->unk_1E0.unk_00 != 0 && globalCtx->sceneNum == SCENE_SPOT05) { - Animation_Change(&this->skelAnime, &D_0600C500, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -10.0f); + Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 1.0f, 0.0f, 10.0f, ANIMMODE_ONCE, -10.0f); this->actionFunc = func_80AF67D0; } } void func_80AF67D0(EnSa* this, GlobalContext* globalCtx) { if (this->unk_1E0.unk_00 == 0) { - Animation_Change(&this->skelAnime, &D_0600C500, 0.0f, 10.0f, 0.0f, ANIMMODE_ONCE, -10.0f); + Animation_Change(&this->skelAnime, &gSariaStopPlayingOcarinaAnim, 0.0f, 10.0f, 0.0f, ANIMMODE_ONCE, -10.0f); this->actionFunc = func_80AF6448; } } @@ -597,16 +621,16 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { if (this->unk_210 != csAction->action) { switch (csAction->action) { case 2: - this->unk_216 = 1; + this->mouthIndex = 1; break; case 9: - this->unk_216 = 1; + this->mouthIndex = 1; break; default: - this->unk_216 = 0; + this->mouthIndex = 0; break; } - func_80AF5D8C(this, csAction->action); + EnSa_ChangeAnim(this, csAction->action); this->unk_210 = csAction->action; } if (phi_v0) {} @@ -648,14 +672,14 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { void func_80AF6B20(EnSa* this, GlobalContext* globalCtx) { if (globalCtx->sceneNum == SCENE_SPOT05) { Item_Give(globalCtx, ITEM_SONG_SARIA); - func_80AF5D8C(this, 6); + EnSa_ChangeAnim(this, 6); } if (globalCtx->sceneNum == SCENE_SPOT04) { - func_80AF5D8C(this, 4); + EnSa_ChangeAnim(this, 4); this->actor.world.pos = this->actor.home.pos; this->actor.world.rot = this->unk_21A; - this->unk_216 = 0; + this->mouthIndex = 0; gSaveContext.infTable[0] |= 1; } @@ -670,8 +694,9 @@ void EnSa_Update(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); SkelAnime_Update(&this->skelAnime); - if (this->skelAnime.animation == &D_06001D50 && this->skelAnime.curFrame >= Animation_GetLastFrame(&D_06001D50)) { - func_80AF5D8C(this, 6); + if (this->skelAnime.animation == &gSariaOcarinaToMouthAnim && + this->skelAnime.curFrame >= Animation_GetLastFrame(&gSariaOcarinaToMouthAnim)) { + EnSa_ChangeAnim(this, 6); } if (this->actionFunc != func_80AF68E4) { @@ -721,7 +746,7 @@ s32 EnSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, } if (globalCtx->sceneNum == SCENE_SPOT05 && limbIndex == 15) { - *dList = D_06007B80; + *dList = gSariaRightHandAndOcarinaDL; } return 0; @@ -737,22 +762,24 @@ void EnSa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec } void EnSa_Draw(Actor* thisx, GlobalContext* globalCtx) { - static UNK_PTR D_80AF7460[] = { 0x06003588, 0x06004448, 0x06004648, 0x06004C48, 0x06003348 }; - static UNK_PTR D_80AF7474[] = { 0x06002F48, 0x06003C48, 0x06003848, 0x06004848, 0x06004E48 }; + static u64* sMouthTextures[] = { gSariaMouthClosed2Tex, gSariaMouthSmilingOpenTex, gSariaMouthFrowningTex, + gSariaMouthSuprisedTex, gSariaMouthClosedTex }; + static u64* sEyeTextures[] = { gSariaEyeOpenTex, gSariaEyeHalfTex, gSariaEyeClosedTex, gSariaEyeSuprisedTex, + gSariaEyeSadTex }; EnSa* this = THIS; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_sa.c", 1444); if (this->alpha == 255) { - gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80AF7474[this->unk_212])); - gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(D_80AF7474[this->unk_214])); - gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(D_80AF7460[this->unk_216])); + gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->rightEyeIndex])); + gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->leftEyeIndex])); + gSPSegment(POLY_OPA_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex])); func_80034BA0(globalCtx, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); } else if (this->alpha != 0) { - gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(D_80AF7474[this->unk_212])); - gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(D_80AF7474[this->unk_214])); - gSPSegment(POLY_XLU_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(D_80AF7460[this->unk_216])); + gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->rightEyeIndex])); + gSPSegment(POLY_XLU_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sEyeTextures[this->leftEyeIndex])); + gSPSegment(POLY_XLU_DISP++, 0x0A, SEGMENTED_TO_VIRTUAL(sMouthTextures[this->mouthIndex])); func_80034CC4(globalCtx, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); } diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.h b/src/overlays/actors/ovl_En_Sa/z_en_sa.h index a11ea87fca..fc50ae083d 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.h +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.h @@ -21,9 +21,9 @@ typedef struct EnSa { /* 0x020C */ s16 unk_20C; /* 0x020E */ s16 unk_20E; /* 0x0210 */ s16 unk_210; - /* 0x0212 */ s16 unk_212; - /* 0x0214 */ s16 unk_214; - /* 0x0216 */ s16 unk_216; + /* 0x0212 */ s16 rightEyeIndex; + /* 0x0214 */ s16 leftEyeIndex; + /* 0x0216 */ s16 mouthIndex; /* 0x0218 */ s16 alpha; /* 0x021A */ Vec3s unk_21A; /* 0x0220 */ Vec3s jointTable[17]; diff --git a/undefined_syms.txt b/undefined_syms.txt index 06fab4d5f1..17327dfb34 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -501,21 +501,6 @@ D_0601182C = 0x0601182C; D_06011C08 = 0x06011C08; D_06012218 = 0x06012218; -// z_demo_sa -D_06001334 = 0x06001334; -D_060021D8 = 0x060021D8; -D_06007B80 = 0x06007B80; -D_0600B1A0 = 0x0600B1A0; -D_0600DF80 = 0x0600DF80; -D_0600E500 = 0x0600E500; -D_0600F580 = 0x0600F580; -D_0600FCE0 = 0x0600FCE0; -D_0600FFD4 = 0x0600FFD4; -D_0601113C = 0x0601113C; -D_060135EC = 0x060135EC; -D_06013CD8 = 0x06013CD8; -D_060140BC = 0x060140BC; - // z_demo_ec D_06013B88 = 0x06013B88; D_060048F4 = 0x060048F4; @@ -2189,12 +2174,6 @@ D_06001C80 = 0x06001C80; // z_en_sa D_02005730 = 0x02005730; D_02010E20 = 0x02010E20; -D_06001D50 = 0x06001D50; -D_06007B80 = 0x06007B80; -D_0600B1A0 = 0x0600B1A0; -D_0600BAEC = 0x0600BAEC; -D_0600C500 = 0x0600C500; -D_06012100 = 0x06012100; // z_en_shopnuts D_060001EC = 0x060001EC;