diff options
| author | Tharo <17233964+Thar0@users.noreply.github.com> | 2021-01-31 19:35:58 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-31 14:35:58 -0500 |
| commit | 3e322f5d35a1012b483ffa6f438347ea2a82b4bb (patch) | |
| tree | ec087f62f96b307bdb6d200569a2fb373b207152 /src | |
| parent | 31b0ea2db876fe450984487dcb47db2161d570f5 (diff) | |
ovl_En_Sa (#625)
* Decompiled
* Add missing sfx id name
Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
Co-authored-by: Thar0 <maximilianc64@gmail.com>
Co-authored-by: Roman971 <32455037+Roman971@users.noreply.github.com>
Co-authored-by: Fig02 <fig02srl@gmail.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/code/z_actor.c | 14 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Dog/z_en_dog.c | 12 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Fd/z_en_fd.c | 8 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Fw/z_en_fw.c | 6 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_In/z_en_in.c | 11 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Kz/z_en_kz.c | 6 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 10 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Ma2/z_en_ma2.c | 7 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 7 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Md/z_en_md.c | 14 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Sa/z_en_sa.c | 783 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Sa/z_en_sa.h | 21 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_St/z_en_st.c | 12 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Zo/z_en_zo.c | 8 |
14 files changed, 797 insertions, 122 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c index c4661629a..f6ba831dd 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3859,19 +3859,19 @@ s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) { return arg2; } -void func_80034EC0(SkelAnime* skelAnime, struct_80034EC0_Entry* arg1, s32 arg2) { +void func_80034EC0(SkelAnime* skelAnime, struct_80034EC0_Entry* animations, s32 index) { f32 frameCount; - arg1 += arg2; + animations += index; - if (arg1->frameCount > 0.0f) { - frameCount = arg1->frameCount; + if (animations->frameCount > 0.0f) { + frameCount = animations->frameCount; } else { - frameCount = Animation_GetLastFrame(arg1->animation); + frameCount = Animation_GetLastFrame(animations->animation); } - Animation_Change(skelAnime, arg1->animation, arg1->playbackSpeed, arg1->unk_08, frameCount, arg1->unk_10, - arg1->transitionRate); + Animation_Change(skelAnime, animations->animation, animations->playbackSpeed, animations->startFrame, frameCount, + animations->mode, animations->transitionRate); } void func_80034F54(GlobalContext* globalCtx, s16* arg1, s16* arg2, s32 arg3) { diff --git a/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/src/overlays/actors/ovl_En_Dog/z_en_dog.c index 7d4e47ce0..0264d9adb 100644 --- a/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -57,10 +57,14 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, 50 }; static struct_80034EC0_Entry sAnimations[] = { - { 0x06001368, 1.0f, 0.0f, -1.0f, 0x00, 0.0f }, { 0x06001368, 1.0f, 0.0f, -1.0f, 0x00, -6.0f }, - { 0x06000D78, 1.0f, 0.0f, -1.0f, 0x00, -6.0f }, { 0x06000278, 1.0f, 0.0f, -1.0f, 0x00, -6.0f }, - { 0x06001150, 1.0f, 0.0f, 4.0f, 0x02, -6.0f }, { 0x06001150, 1.0f, 5.0f, 25.0f, 0x04, -6.0f }, - { 0x06000928, 1.0f, 0.0f, 6.0f, 0x02, -6.0f }, { 0x06000C28, 1.0f, 0.0f, -1.0f, 0x00, -6.0f }, + { 0x06001368, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, + { 0x06001368, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -6.0f }, + { 0x06000D78, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -6.0f }, + { 0x06000278, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -6.0f }, + { 0x06001150, 1.0f, 0.0f, 4.0f, ANIMMODE_ONCE, -6.0f }, + { 0x06001150, 1.0f, 5.0f, 25.0f, ANIMMODE_LOOP_PARTIAL, -6.0f }, + { 0x06000928, 1.0f, 0.0f, 6.0f, ANIMMODE_ONCE, -6.0f }, + { 0x06000C28, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -6.0f }, }; typedef enum { diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index 03dea3370..2a4e12f1d 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -194,9 +194,11 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit2 sColChkInit = { 24, 2, 25, 25, MASS_IMMOVABLE }; static struct_80034EC0_Entry sAnimations[] = { - { 0x060010B4, 1.0f, 0.0f, -1.0f, 0x03, 0.0f }, { 0x06005C64, 1.0f, 0.0f, -1.0f, 0x03, -10.0f }, - { 0x06006044, 0.0f, 0.0f, -1.0f, 0x03, -10.0f }, { 0x06006A18, 1.0f, 0.0f, -1.0f, 0x01, -10.0f }, - { 0x06006B64, 0.0f, 0.0f, -1.0f, 0x03, -10.0f }, + { 0x060010B4, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, 0.0f }, + { 0x06005C64, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -10.0f }, + { 0x06006044, 0.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -10.0f }, + { 0x06006A18, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP_INTERP, -10.0f }, + { 0x06006B64, 0.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -10.0f }, }; s32 EnFd_SpawnCore(EnFd* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index 69031c56a..dfe76fa91 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -61,9 +61,9 @@ static ColliderJntSphInit sJntSphInit = { static CollisionCheckInfoInit2 D_80A1FB94 = { 8, 2, 25, 25, MASS_IMMOVABLE }; static struct_80034EC0_Entry D_80A1FBA0[] = { - { 0x06006CF8, 0.0f, 0.0f, -1.0f, 0x03, 0.0f }, - { 0x06007CD0, 1.0f, 0.0f, -1.0f, 0x03, -8.0f }, - { 0x06007DC8, 1.0f, 0.0f, -1.0f, 0x01, -8.0f }, + { 0x06006CF8, 0.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, 0.0f }, + { 0x06007CD0, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -8.0f }, + { 0x06007DC8, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP_INTERP, -8.0f }, }; extern FlexSkeletonHeader D_06007C30; diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 1a42e0f51..a24a6668f 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -62,10 +62,11 @@ static CollisionCheckInfoInit2 sColChkInfoInit = { }; static struct_D_80AA1678 sAnimationInfo[] = { - { 0x06001CC0, 1.0f, 0, 0.0f }, { 0x06001CC0, 1.0f, 0, -10.0f }, { 0x06013C6C, 1.0f, 0, 0.0f }, - { 0x06013C6C, 1.0f, 0, -10.0f }, { 0x06000CB0, 1.0f, 0, 0.0f }, { 0x060003B4, 1.0f, 0, -10.0f }, - { 0x06001BE0, 1.0f, 0, 0.0f }, { 0x06013D60, 1.0f, 0, 0.0f }, { 0x0601431C, 1.0f, 0, 0.0f }, - { 0x06014CA8, 1.0f, 0, 0.0f }, + { 0x06001CC0, 1.0f, ANIMMODE_LOOP, 0.0f }, { 0x06001CC0, 1.0f, ANIMMODE_LOOP, -10.0f }, + { 0x06013C6C, 1.0f, ANIMMODE_LOOP, 0.0f }, { 0x06013C6C, 1.0f, ANIMMODE_LOOP, -10.0f }, + { 0x06000CB0, 1.0f, ANIMMODE_LOOP, 0.0f }, { 0x060003B4, 1.0f, ANIMMODE_LOOP, -10.0f }, + { 0x06001BE0, 1.0f, ANIMMODE_LOOP, 0.0f }, { 0x06013D60, 1.0f, ANIMMODE_LOOP, 0.0f }, + { 0x0601431C, 1.0f, ANIMMODE_LOOP, 0.0f }, { 0x06014CA8, 1.0f, ANIMMODE_LOOP, 0.0f }, }; static AnimationHeader* D_80A7B918[] = { @@ -325,7 +326,7 @@ void func_80A79690(SkelAnime* skelAnime, EnIn* this, GlobalContext* globalCtx) { void func_80A796EC(EnIn* this, s32 arg1) { Animation_Change(&this->skelAnime, sAnimationInfo[arg1].animation, 1.0f, 0.0f, - Animation_GetLastFrame(sAnimationInfo[arg1].animation), sAnimationInfo[arg1].unk_08, + Animation_GetLastFrame(sAnimationInfo[arg1].animation), sAnimationInfo[arg1].mode, sAnimationInfo[arg1].transitionRate); } diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index 5ffa2be80..732105902 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -58,9 +58,9 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; static struct_80034EC0_Entry sAnimations[] = { - { 0x0600075C, 1.0f, 0.0f, -1.0f, 0x00, 0.0f }, - { 0x0600075C, 1.0f, 0.0f, -1.0f, 0x00, -10.0f }, - { 0x0600046C, 1.0f, 0.0f, -1.0f, 0x00, -10.0f }, + { 0x0600075C, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, + { 0x0600075C, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, + { 0x0600046C, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, }; extern FlexSkeletonHeader D_060086D0; diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index d3429e056..cc7f9da85 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -62,10 +62,10 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; static struct_D_80AA1678 D_80AA1678[] = { - { 0x06000820, 1.0f, 0x00, 0.0f }, - { 0x06000820, 1.0f, 0x00, -10.0f }, - { 0x06008D64, 1.0f, 0x00, 0.0f }, - { 0x06008D64, 1.0f, 0x00, -10.0f }, + { 0x06000820, 1.0f, ANIMMODE_LOOP, 0.0f }, + { 0x06000820, 1.0f, ANIMMODE_LOOP, -10.0f }, + { 0x06008D64, 1.0f, ANIMMODE_LOOP, 0.0f }, + { 0x06008D64, 1.0f, ANIMMODE_LOOP, -10.0f }, }; static Vec3f D_80AA16B8 = { 800.0f, 0.0f, 0.0f }; @@ -220,7 +220,7 @@ void func_80AA0A0C(EnMa1* this) { void func_80AA0A84(EnMa1* this, UNK_TYPE idx) { f32 frameCount = Animation_GetLastFrame(D_80AA1678[idx].animation); - Animation_Change(&this->skelAnime, D_80AA1678[idx].animation, 1.0f, 0.0f, frameCount, D_80AA1678[idx].unk_08, + Animation_Change(&this->skelAnime, D_80AA1678[idx].animation, 1.0f, 0.0f, frameCount, D_80AA1678[idx].mode, D_80AA1678[idx].transitionRate); } diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index ff5549595..a3ecbf1af 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -56,8 +56,9 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; static struct_D_80AA1678 D_80AA2858[] = { - { 0x060007D4, 1.0f, 0x00, 0.0f }, { 0x060007D4, 1.0f, 0x00, -10.0f }, { 0x060093BC, 1.0f, 0x00, 0.0f }, - { 0x06009EE0, 1.0f, 0x00, 0.0f }, { 0x06009EE0, 1.0f, 0x00, -10.0f }, + { 0x060007D4, 1.0f, ANIMMODE_LOOP, 0.0f }, { 0x060007D4, 1.0f, ANIMMODE_LOOP, -10.0f }, + { 0x060093BC, 1.0f, ANIMMODE_LOOP, 0.0f }, { 0x06009EE0, 1.0f, ANIMMODE_LOOP, 0.0f }, + { 0x06009EE0, 1.0f, ANIMMODE_LOOP, -10.0f }, }; static Vec3f D_80AA28A8 = { 900.0f, 0.0f, 0.0f }; @@ -199,7 +200,7 @@ void func_80AA1CC0(EnMa2* this) { void func_80AA1D44(EnMa2* this, s32 idx) { f32 frameCount = Animation_GetLastFrame(D_80AA2858[idx].animation); - Animation_Change(&this->skelAnime, D_80AA2858[idx].animation, 1.0f, 0.0f, frameCount, D_80AA2858[idx].unk_08, + Animation_Change(&this->skelAnime, D_80AA2858[idx].animation, 1.0f, 0.0f, frameCount, D_80AA2858[idx].mode, D_80AA2858[idx].transitionRate); } diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index e14d4c5b9..fd15eac41 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -60,8 +60,9 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; static struct_D_80AA1678 D_80AA3848[] = { - { 0x060007D4, 1.0f, 0x00, 0.0f }, { 0x060007D4, 1.0f, 0x00, -10.0f }, { 0x060093BC, 1.0f, 0x00, 0.0f }, - { 0x06009EE0, 1.0f, 0x00, 0.0f }, { 0x06009EE0, 1.0f, 0x00, -10.0f }, + { 0x060007D4, 1.0f, ANIMMODE_LOOP, 0.0f }, { 0x060007D4, 1.0f, ANIMMODE_LOOP, -10.0f }, + { 0x060093BC, 1.0f, ANIMMODE_LOOP, 0.0f }, { 0x06009EE0, 1.0f, ANIMMODE_LOOP, 0.0f }, + { 0x06009EE0, 1.0f, ANIMMODE_LOOP, -10.0f }, }; static Vec3f D_80AA3898 = { 900.0f, 0.0f, 0.0f }; @@ -246,7 +247,7 @@ void func_80AA2F80(EnMa3* this) { void func_80AA3004(EnMa3* this, s32 idx) { f32 frameCount = Animation_GetLastFrame(D_80AA3848[idx].animation); - Animation_Change(&this->skelAnime, D_80AA3848[idx].animation, 1.0f, 0.0f, frameCount, D_80AA3848[idx].unk_08, + Animation_Change(&this->skelAnime, D_80AA3848[idx].animation, 1.0f, 0.0f, frameCount, D_80AA3848[idx].mode, D_80AA3848[idx].transitionRate); } diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 2a8be4b84..98dabfb84 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -57,13 +57,13 @@ static ColliderCylinderInit sCylinderInit = { static CollisionCheckInfoInit2 sColChkInfoInit = { 0, 0, 0, 0, MASS_IMMOVABLE }; static struct_80034EC0_Entry sAnimations[] = { - { 0x060002C8, 0.0f, 0.0f, -1.0f, 0x00, 0.0f }, { 0x060002C8, 0.0f, 0.0f, -1.0f, 0x00, -10.0f }, - { 0x0600917C, 1.0f, 0.0f, -1.0f, 0x02, -1.0f }, { 0x06009E68, 1.0f, 0.0f, -1.0f, 0x00, -1.0f }, - { 0x06009B1C, 1.0f, 0.0f, -1.0f, 0x02, -1.0f }, { 0x06008E84, 1.0f, 0.0f, -1.0f, 0x00, -1.0f }, - { 0x060097F0, 1.0f, 0.0f, -1.0f, 0x00, -1.0f }, { 0x060092B0, 1.0f, 0.0f, -1.0f, 0x02, -1.0f }, - { 0x0600A138, 1.0f, 0.0f, -1.0f, 0x00, -1.0f }, { 0x06008FC0, 1.0f, 0.0f, -1.0f, 0x02, -1.0f }, - { 0x060002C8, 0.0f, 0.0f, -1.0f, 0x00, -8.0f }, { 0x06008510, 1.0f, 0.0f, -1.0f, 0x00, -1.0f }, - { 0x060095BC, 1.0f, 0.0f, -1.0f, 0x02, -1.0f }, { 0x06008738, 1.0f, 0.0f, -1.0f, 0x00, -1.0f }, + { 0x060002C8, 0.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, { 0x060002C8, 0.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -10.0f }, + { 0x0600917C, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { 0x06009E68, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, + { 0x06009B1C, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { 0x06008E84, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, + { 0x060097F0, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, { 0x060092B0, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, + { 0x0600A138, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, { 0x06008FC0, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, + { 0x060002C8, 0.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, { 0x06008510, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, + { 0x060095BC, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE, -1.0f }, { 0x06008738, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -1.0f }, }; extern AnimationHeader D_060002C8; 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 3f6958bbc..050a2517f 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -1,4 +1,5 @@ #include "z_en_sa.h" +#include "overlays/actors/ovl_En_Elf/z_en_elf.h" #define FLAGS 0x02000019 @@ -9,16 +10,12 @@ void EnSa_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnSa_Update(Actor* thisx, GlobalContext* globalCtx); void EnSa_Draw(Actor* thisx, GlobalContext* globalCtx); -extern UNK_TYPE D_02005730; -extern UNK_TYPE D_02010E20; -extern UNK_TYPE D_06001D50; -extern UNK_TYPE D_06007B80; -extern UNK_TYPE D_0600B1A0; -extern UNK_TYPE D_0600BAEC; -extern UNK_TYPE D_0600C500; -extern UNK_TYPE D_06012100; +void func_80AF6448(EnSa* this, GlobalContext* globalCtx); +void func_80AF67D0(EnSa* this, GlobalContext* globalCtx); +void func_80AF683C(EnSa* this, GlobalContext* globalCtx); +void func_80AF68E4(EnSa* this, GlobalContext* globalCtx); +void func_80AF6B20(EnSa* this, GlobalContext* globalCtx); -/* const ActorInit En_Sa_InitVars = { ACTOR_EN_SA, ACTORCAT_NPC, @@ -31,7 +28,7 @@ const ActorInit En_Sa_InitVars = { (ActorFunc)EnSa_Draw, }; -static ColliderCylinderInit D_80AF7260 = { +static ColliderCylinderInit sCylinderInit = { { COLTYPE_NONE, AT_NONE, @@ -50,67 +47,713 @@ static ColliderCylinderInit D_80AF7260 = { }, { 20, 46, 0, { 0, 0, 0 } }, }; -*/ -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF5560.s") -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF55E0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF56F4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF57D8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF5894.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF58B8.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF594C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF59E0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF5A74.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF5B10.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF5BA4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF5C40.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF5CD4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF5CE4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF5D8C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF5DFC.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF5F34.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF603C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF609C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF6130.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF6170.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/EnSa_Init.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/EnSa_Destroy.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF6448.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF67D0.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF683C.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF68E4.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF6B20.s") - -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/EnSa_Update.s") +static CollisionCheckInfoInit2 sColChkInfoInit = { + 0, 0, 0, 0, MASS_IMMOVABLE, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF6D6C.s") +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 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/func_80AF6F0C.s") +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 }, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Sa/EnSa_Draw.s") +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); + + if (this->unk_209 == 10 || this->unk_209 == 5 || this->unk_209 == 2 || this->unk_209 == 1) { + if (textState != this->unk_209) { + this->unk_208++; + } + } + this->unk_209 = textState; + return textState; +} + +u16 func_80AF55E0(GlobalContext* globalCtx, Actor* thisx) { + EnSa* this = THIS; + u16 reaction = Text_GetFaceReaction(globalCtx, 0x10); + + if (reaction != 0) { + return reaction; + } + if (CHECK_QUEST_ITEM(QUEST_SONG_SARIA)) { + return 0x10AD; + } + if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) { + this->unk_208 = 0; + this->unk_209 = 0; + if (gSaveContext.infTable[0] & 0x20) { + return 0x1048; + } else { + return 0x1047; + } + } + if (gSaveContext.eventChkInf[0] & 4) { + this->unk_208 = 0; + this->unk_209 = 0; + if (gSaveContext.infTable[0] & 8) { + return 0x1032; + } else { + return 0x1031; + } + } + if (gSaveContext.infTable[0] & 1) { + this->unk_208 = 0; + this->unk_209 = 0; + if (gSaveContext.infTable[0] & 2) { + return 0x1003; + } else { + return 0x1002; + } + } + return 0x1001; +} + +s16 func_80AF56F4(GlobalContext* globalCtx, Actor* thisx) { + s16 ret = 1; + EnSa* this = THIS; + + switch (func_80AF5560(this, globalCtx)) { + case 2: + switch (this->actor.textId) { + case 0x1002: + gSaveContext.infTable[0] |= 2; + ret = 0; + break; + case 0x1031: + gSaveContext.eventChkInf[0] |= 8; + gSaveContext.infTable[0] |= 8; + ret = 0; + break; + case 0x1047: + gSaveContext.infTable[0] |= 0x20; + ret = 0; + break; + default: + ret = 0; + break; + } + break; + case 0: + case 1: + case 3: + case 4: + case 5: + case 7: + case 8: + case 9: + break; + } + return ret; +} + +void func_80AF57D8(EnSa* this, GlobalContext* globalCtx) { + if (globalCtx->sceneNum != SCENE_SPOT05 || + ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) < 0x1555 || this->unk_1E0.unk_00 != 0) { + func_800343CC(globalCtx, &this->actor, &this->unk_1E0.unk_00, this->collider.dim.radius + 30.0f, func_80AF55E0, + func_80AF56F4); + } +} + +f32 func_80AF5894(EnSa* this) { + f32 endFrame = this->skelAnime.endFrame; + f32 startFrame = this->skelAnime.startFrame; + + this->skelAnime.startFrame = endFrame; + this->skelAnime.curFrame = endFrame; + this->skelAnime.endFrame = startFrame; + this->skelAnime.playSpeed = -1.0f; + return startFrame; +} + +void func_80AF58B8(EnSa* this) { + switch (this->unk_20A) { + case 0: + func_80034EC0(&this->skelAnime, sAnimations, 3); + this->unk_20A++; + case 1: + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + func_80034EC0(&this->skelAnime, sAnimations, 2); + this->unk_20A++; + } + break; + } +} + +void func_80AF594C(EnSa* this) { + switch (this->unk_20A) { + case 0: + func_80034EC0(&this->skelAnime, sAnimations, 8); + this->unk_20A++; + case 1: + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + func_80034EC0(&this->skelAnime, sAnimations, 9); + this->unk_20A++; + } + break; + } +} + +void func_80AF59E0(EnSa* this) { + switch (this->unk_20A) { + case 0: + func_80034EC0(&this->skelAnime, sAnimations, 1); + this->unk_20A++; + case 1: + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + func_80034EC0(&this->skelAnime, sAnimations, 7); + this->unk_20A++; + } + break; + } +} + +void func_80AF5A74(EnSa* this) { + switch (this->unk_20A) { + case 0: + func_80034EC0(&this->skelAnime, sAnimations, 1); + func_80AF5894(this); + this->unk_20A++; + case 1: + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + func_80034EC0(&this->skelAnime, sAnimations, 9); + this->unk_20A++; + } + break; + } +} + +void func_80AF5B10(EnSa* this) { + switch (this->unk_20A) { + case 0: + func_80034EC0(&this->skelAnime, sAnimations, 6); + this->unk_20A++; + case 1: + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + func_80034EC0(&this->skelAnime, sAnimations, 4); + this->unk_20A++; + } + break; + } +} + +void func_80AF5BA4(EnSa* this) { + switch (this->unk_20A) { + case 0: + func_80034EC0(&this->skelAnime, sAnimations, 6); + func_80AF5894(this); + this->unk_20A++; + case 1: + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + func_80034EC0(&this->skelAnime, sAnimations, 9); + this->unk_20A++; + } + break; + } +} + +void func_80AF5C40(EnSa* this) { + switch (this->unk_20A) { + case 0: + func_80034EC0(&this->skelAnime, sAnimations, 5); + this->unk_20A++; + case 1: + if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { + func_80034EC0(&this->skelAnime, sAnimations, 0); + this->unk_20A++; + } + break; + } +} + +void func_80AF5CD4(EnSa* this, u8 arg1) { + this->unk_20B = arg1; + this->unk_20A = 0; +} + +void func_80AF5CE4(EnSa* this) { + switch (this->unk_20B) { + case 1: + func_80AF58B8(this); + break; + case 2: + func_80AF594C(this); + break; + case 3: + func_80AF59E0(this); + break; + case 4: + func_80AF5A74(this); + break; + case 5: + func_80AF5B10(this); + break; + case 6: + func_80AF5BA4(this); + break; + case 7: + func_80AF5C40(this); + break; + } +} + +void func_80AF5D8C(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); +} + +s32 func_80AF5DFC(EnSa* this, GlobalContext* globalCtx) { + if (gSaveContext.cutsceneIndex >= 0xFFF0 && gSaveContext.cutsceneIndex != 0xFFFD) { + if (globalCtx->sceneNum == SCENE_SPOT04) { + return 4; + } + if (globalCtx->sceneNum == SCENE_SPOT05) { + return 5; + } + } + if (globalCtx->sceneNum == SCENE_KOKIRI_HOME5 && LINK_IS_CHILD && + INV_CONTENT(ITEM_OCARINA_FAIRY) == ITEM_OCARINA_FAIRY && !(gSaveContext.eventChkInf[4] & 1)) { + return 1; + } + if (globalCtx->sceneNum == SCENE_SPOT05 && (gSaveContext.eventChkInf[4] & 1)) { + return (CHECK_QUEST_ITEM(QUEST_SONG_SARIA)) ? 2 : 5; + } + if (globalCtx->sceneNum == SCENE_SPOT04 && !CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD)) { + if (gSaveContext.infTable[0] & 1) { + return 1; + } + return 4; + } + return 0; +} + +void func_80AF5F34(EnSa* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + s16 phi_a3 = 0; + + if (globalCtx->sceneNum == SCENE_SPOT04) { + phi_a3 = (this->actionFunc == func_80AF68E4) ? 1 : 4; + } + if (globalCtx->sceneNum == SCENE_SPOT05) { + phi_a3 = (this->skelAnime.animation == &D_0600BAEC) ? 1 : 3; + } + if (globalCtx->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF6448 && + this->skelAnime.animation == &D_0600C500) { + phi_a3 = 1; + } + if (globalCtx->sceneNum == SCENE_SPOT05 && this->actionFunc == func_80AF68E4 && + this->skelAnime.animation == &D_06001D50) { + phi_a3 = 1; + } + this->unk_1E0.unk_18 = player->actor.world.pos; + this->unk_1E0.unk_14 = 4.0f; + func_80034A14(&this->actor, &this->unk_1E0, 2, phi_a3); +} + +s32 func_80AF603C(EnSa* this) { + if (this->skelAnime.animation != &D_0600BAEC && this->skelAnime.animation != &D_06001D50) { + return 0; + } + if (this->unk_1E0.unk_00 != 0) { + return 0; + } + this->unk_20E = 0; + if (this->unk_212 != 2) { + return 0; + } + return 1; +} + +void func_80AF609C(EnSa* this) { + s16 phi_v1; + + if (func_80AF603C(this) == 0) { + if (this->unk_20E == 0) { + phi_v1 = 0; + } else { + this->unk_20E--; + phi_v1 = this->unk_20E; + } + if (phi_v1 == 0) { + this->unk_212++; + if (this->unk_212 < 3) { + this->unk_214 = this->unk_212; + } else { + this->unk_20E = Rand_S16Offset(30, 30); + this->unk_214 = 0; + this->unk_212 = this->unk_214; + } + } + } +} + +void func_80AF6130(CsCmdActorAction* csAction, Vec3f* dst) { + dst->x = csAction->startPos.x; + dst->y = csAction->startPos.y; + dst->z = csAction->startPos.z; +} + +void func_80AF6170(CsCmdActorAction* csAction, Vec3f* dst) { + dst->x = csAction->endPos.x; + dst->y = csAction->endPos.y; + dst->z = csAction->endPos.z; +} + +void EnSa_Init(Actor* thisx, GlobalContext* globalCtx) { + EnSa* this = THIS; + 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); + 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); + this->actionFunc = func_80AF6448; + break; + case 5: + func_80AF5D8C(this, 0xB); + this->actionFunc = func_80AF683C; + break; + case 1: + this->actor.gravity = -1.0f; + func_80AF5D8C(this, 0); + this->actionFunc = func_80AF6448; + break; + case 4: + this->unk_210 = 0; + this->actor.gravity = -1.0f; + globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(D_02010E20); + gSaveContext.cutsceneTrigger = 1; + func_80AF5D8C(this, 4); + this->actionFunc = func_80AF68E4; + break; + case 3: + this->unk_210 = 0; + this->actor.gravity = -1.0f; + func_80AF5D8C(this, 0); + this->actionFunc = func_80AF68E4; + break; + case 0: + Actor_Kill(&this->actor); + return; + } + + Actor_SetScale(&this->actor, 0.01f); + + this->actor.targetMode = 6; + this->unk_1E0.unk_00 = 0; + this->alpha = 255; + this->unk_21A = this->actor.shape.rot; + + Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ELF, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, FAIRY_KOKIRI); +} + +void EnSa_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnSa* this = THIS; + + Collider_DestroyCylinder(globalCtx, &this->collider); +} + +void func_80AF6448(EnSa* this, GlobalContext* globalCtx) { + if (globalCtx->sceneNum == SCENE_SPOT04) { + if (this->unk_1E0.unk_00 != 0) { + switch (this->actor.textId) { + case 0x1002: + if (this->unk_208 == 0 && this->unk_20B != 1) { + func_80AF5CD4(this, 1); + this->unk_216 = 1; + } + if (this->unk_208 == 2 && this->unk_20B != 2) { + func_80AF5CD4(this, 2); + this->unk_216 = 1; + } + if (this->unk_208 == 5) { + this->unk_216 = 0; + } + break; + case 0x1003: + if (this->unk_208 == 0 && this->unk_20B != 4) { + func_80AF5CD4(this, 4); + } + break; + case 0x1031: + if (this->unk_208 == 0 && this->unk_20B != 4 && this->skelAnime.animation == &D_06012100) { + func_80AF5CD4(this, 4); + this->unk_216 = 3; + } + if (this->unk_208 == 2 && this->unk_20B != 5) { + func_80AF5CD4(this, 5); + this->unk_216 = 2; + } + if (this->unk_208 == 4 && this->unk_20B != 6) { + func_80AF5CD4(this, 6); + this->unk_216 = 0; + } + break; + case 0x1032: + if (this->unk_208 == 0 && this->unk_20B != 4 && this->skelAnime.animation == &D_06012100) { + func_80AF5CD4(this, 4); + } + break; + case 0x1047: + if (this->unk_208 == 1 && this->unk_20B != 7) { + func_80AF5CD4(this, 7); + } + break; + case 0x1048: + if (this->unk_208 == 0 && this->unk_20B != 7) { + func_80AF5CD4(this, 7); + } + break; + } + } else if (!CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && + ((gSaveContext.infTable[0] & 2) || (gSaveContext.infTable[0] & 8))) { + if (this->unk_20B != 3) { + func_80AF5CD4(this, 3); + } + } else { + func_80AF5CD4(this, 0); + } + func_80AF5CE4(this); + } + if (this->skelAnime.animation == &D_0600C500) { + this->skelAnime.playSpeed = -1.0f; + if ((s32)this->skelAnime.curFrame == 0) { + func_80AF5D8C(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); + 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); + this->actionFunc = func_80AF6448; + } +} + +void func_80AF683C(EnSa* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + + if (!(player->actor.world.pos.z >= -2220.0f) && !Gameplay_InCsMode(globalCtx)) { + globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(D_02005730); + gSaveContext.cutsceneTrigger = 1; + this->actionFunc = func_80AF68E4; + } +} + +void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { + s16 phi_v0; + Vec3f startPos; + Vec3f endPos; + Vec3f D_80AF7448 = { 0.0f, 0.0f, 0.0f }; + CsCmdActorAction* csAction; + f32 temp_f0; + f32 gravity; + + if (globalCtx->csCtx.state == 0) { + this->actionFunc = func_80AF6B20; + return; + } + csAction = globalCtx->csCtx.npcActions[1]; + if (csAction != NULL) { + func_80AF6130(csAction, &startPos); + func_80AF6170(csAction, &endPos); + + if (this->unk_210 == 0) { + this->actor.world.pos = startPos; + } + if (this->unk_210 != csAction->action) { + switch (csAction->action) { + case 2: + this->unk_216 = 1; + break; + case 9: + this->unk_216 = 1; + break; + default: + this->unk_216 = 0; + break; + } + func_80AF5D8C(this, csAction->action); + this->unk_210 = csAction->action; + } + if (phi_v0) {} + if (csAction->action == 3) { + if (this->unk_20C == 0) { + phi_v0 = 0; + } else { + this->unk_20C--; + phi_v0 = this->unk_20C; + } + if (phi_v0 == 0) { + Audio_PlaySoundGeneral(NA_SE_PL_WALK_GROUND, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); + this->unk_20C = 8; + } + } + this->actor.shape.rot.x = csAction->urot.x; + this->actor.shape.rot.y = csAction->urot.y; + this->actor.shape.rot.z = csAction->urot.z; + this->actor.velocity = D_80AF7448; + + if (globalCtx->csCtx.frames < csAction->endFrame) { + temp_f0 = csAction->endFrame - csAction->startFrame; + this->actor.velocity.x = (endPos.x - startPos.x) / temp_f0; + this->actor.velocity.y = (endPos.y - startPos.y) / temp_f0; + gravity = this->actor.gravity; + if (globalCtx->sceneNum == SCENE_SPOT05) { + gravity = 0.0f; + } + this->actor.velocity.y += gravity; + if (this->actor.velocity.y < this->actor.minVelocityY) { + this->actor.velocity.y = this->actor.minVelocityY; + } + this->actor.velocity.z = (endPos.z - startPos.z) / temp_f0; + } + } +} + +void func_80AF6B20(EnSa* this, GlobalContext* globalCtx) { + if (globalCtx->sceneNum == SCENE_SPOT05) { + Item_Give(globalCtx, ITEM_SONG_SARIA); + func_80AF5D8C(this, 6); + } + + if (globalCtx->sceneNum == SCENE_SPOT04) { + func_80AF5D8C(this, 4); + this->actor.world.pos = this->actor.home.pos; + this->actor.world.rot = this->unk_21A; + this->unk_216 = 0; + gSaveContext.infTable[0] |= 1; + } + + this->actionFunc = func_80AF6448; +} + +void EnSa_Update(Actor* thisx, GlobalContext* globalCtx) { + EnSa* this = THIS; + s32 pad; + + Collider_UpdateCylinder(&this->actor, &this->collider); + 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->actionFunc != func_80AF68E4) { + this->alpha = func_80034DD4(&this->actor, globalCtx, this->alpha, 400.0f); + } else { + this->alpha = 255; + } + + this->actor.shape.shadowAlpha = this->alpha; + + if (this->actionFunc == func_80AF68E4) { + this->actor.world.pos.x += this->actor.velocity.x; + this->actor.world.pos.y += this->actor.velocity.y; + this->actor.world.pos.z += this->actor.velocity.z; + } else { + func_8002D7EC(&this->actor); + } + + if (globalCtx->sceneNum != SCENE_SPOT05) { + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 0.0f, 0.0f, 0.0f, 4); + } + + func_80AF609C(this); + this->actionFunc(this, globalCtx); + func_80AF57D8(this, globalCtx); + func_80AF5F34(this, globalCtx); +} + +s32 EnSa_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx, + Gfx** gfx) { + EnSa* this = THIS; + s32 pad; + Vec3s sp18; + + if (limbIndex == 16) { + Matrix_Translate(900.0f, 0.0f, 0.0f, MTXMODE_APPLY); + sp18 = this->unk_1E0.unk_08; + Matrix_RotateX(BINANG_TO_RAD(sp18.y), MTXMODE_APPLY); + Matrix_RotateZ(BINANG_TO_RAD(sp18.x), MTXMODE_APPLY); + Matrix_Translate(-900.0f, 0.0f, 0.0f, MTXMODE_APPLY); + } + + if (limbIndex == 9) { + sp18 = this->unk_1E0.unk_0E; + Matrix_RotateY(BINANG_TO_RAD(sp18.y), MTXMODE_APPLY); + Matrix_RotateX(BINANG_TO_RAD(sp18.x), MTXMODE_APPLY); + } + + if (globalCtx->sceneNum == SCENE_SPOT05 && limbIndex == 15) { + *dList = D_06007B80; + } + + return 0; +} + +void EnSa_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx, Gfx** gfx) { + EnSa* this = THIS; + Vec3f D_80AF7454 = { 400.0, 0.0f, 0.0f }; + + if (limbIndex == 16) { + Matrix_MultVec3f(&D_80AF7454, &this->actor.focus.pos); + } +} + +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 }; + + 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])); + 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])); + func_80034CC4(globalCtx, &this->skelAnime, EnSa_OverrideLimbDraw, EnSa_PostLimbDraw, &this->actor, this->alpha); + } + + CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_en_sa.c", 1497); +} 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 568e3204c..a11ea87fc 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.h +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.h @@ -6,9 +6,28 @@ struct EnSa; +typedef void (*EnSaActionFunc)(struct EnSa*, GlobalContext*); + typedef struct EnSa { /* 0x0000 */ Actor actor; - /* 0x014C */ char unk_14C[0x1A0]; + /* 0x014C */ SkelAnime skelAnime; + /* 0x0190 */ EnSaActionFunc actionFunc; + /* 0x0194 */ ColliderCylinder collider; + /* 0x01E0 */ struct_80034A14_arg1 unk_1E0; + /* 0x0208 */ u8 unk_208; + /* 0x0209 */ u8 unk_209; + /* 0x020A */ u8 unk_20A; + /* 0x020B */ u8 unk_20B; + /* 0x020C */ s16 unk_20C; + /* 0x020E */ s16 unk_20E; + /* 0x0210 */ s16 unk_210; + /* 0x0212 */ s16 unk_212; + /* 0x0214 */ s16 unk_214; + /* 0x0216 */ s16 unk_216; + /* 0x0218 */ s16 alpha; + /* 0x021A */ Vec3s unk_21A; + /* 0x0220 */ Vec3s jointTable[17]; + /* 0x0286 */ Vec3s morphTable[17]; } EnSa; // size = 0x02EC extern const ActorInit En_Sa_InitVars; diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index d864bb209..57a2cb054 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -124,10 +124,14 @@ extern AnimationHeader D_060055A8; extern AnimationHeader D_060055A8; struct_80034EC0_Entry sAnimations[] = { - { &D_06000304, 1.0f, 0.0f, -1.0f, 0x01, 0.0f }, { &D_06005B98, 1.0f, 0.0f, -1.0f, 0x03, -8.0f }, - { &D_06000304, 4.0f, 0.0f, -1.0f, 0x03, -8.0f }, { &D_06000304, 1.0f, 0.0f, -1.0f, 0x01, -8.0f }, - { &D_060055A8, 1.0f, 0.0f, -1.0f, 0x03, -8.0f }, { &D_06000304, 8.0f, 0.0f, -1.0f, 0x01, -8.0f }, - { &D_06000304, 6.0f, 0.0f, -1.0f, 0x01, -8.0f }, { &D_06005B98, 2.0f, 0.0f, -1.0f, 0x01, -8.0f }, + { &D_06000304, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP_INTERP, 0.0f }, + { &D_06005B98, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -8.0f }, + { &D_06000304, 4.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -8.0f }, + { &D_06000304, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP_INTERP, -8.0f }, + { &D_060055A8, 1.0f, 0.0f, -1.0f, ANIMMODE_ONCE_INTERP, -8.0f }, + { &D_06000304, 8.0f, 0.0f, -1.0f, ANIMMODE_LOOP_INTERP, -8.0f }, + { &D_06000304, 6.0f, 0.0f, -1.0f, ANIMMODE_LOOP_INTERP, -8.0f }, + { &D_06005B98, 2.0f, 0.0f, -1.0f, ANIMMODE_LOOP_INTERP, -8.0f }, }; void EnSt_SetupAction(EnSt* this, EnStActionFunc actionFunc) { 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 c425bc156..f20426a09 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -326,10 +326,10 @@ const ActorInit En_Zo_InitVars = { }; static struct_80034EC0_Entry sAnimations[] = { - { &D_06002FE8, 1.0f, 0.0f, -1.0f, 0, -8.0f }, { &D_06002FE8, 1.0f, 0.0f, -1.0f, 0, 0.0f }, - { &D_06002F10, 0.0f, 1.0f, 1.0f, 2, 0.0f }, { &D_06002F10, 1.0f, 1.0f, -1.0f, 0, -8.0f }, - { &D_06002F10, 1.0f, 8.0f, -1.0f, 0, -8.0f }, { &D_0600219C, 1.0f, 0.0f, -1.0f, 0, -8.0f }, - { &D_06000598, 1.0f, 0.0f, -1.0f, 0, -8.0f }, { &D_06000D48, 1.0f, 0.0f, -1.0f, 0, -8.0f }, + { &D_06002FE8, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, { &D_06002FE8, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, 0.0f }, + { &D_06002F10, 0.0f, 1.0f, 1.0f, ANIMMODE_ONCE, 0.0f }, { &D_06002F10, 1.0f, 1.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, + { &D_06002F10, 1.0f, 8.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, { &D_0600219C, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, + { &D_06000598, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, { &D_06000D48, 1.0f, 0.0f, -1.0f, ANIMMODE_LOOP, -8.0f }, }; void EnZo_SpawnSplashes(EnZo* this) { |
