diff --git a/include/functions.h b/include/functions.h index 0fae8867d3..d6c20d5d7b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -667,7 +667,8 @@ void EffectSsHitMark_SpawnFixedScale(GlobalContext* globalCtx, s32 type, Vec3f* // void EffectSsHitMark_SpawnCustomScale(void); // void EffectSsFhgFlash_SpawnShock(UNK_TYPE4 uParm1, UNK_TYPE4 uParm2, Vec3f* pzParm3, UNK_TYPE2 uParm4, UNK_TYPE1 param_5); // void EffectSsKFire_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE1 param_6); -// void EffectSsSolderSrchBall_Spawn(UNK_TYPE4 uParm1, Vec3f* pzParm2, Vec3f* pzParm3, Vec3f* pzParm4, UNK_TYPE2 param_5, UNK_TYPE4 param_6, UNK_TYPE2 param_7); +void EffectSsSolderSrchBall_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* accel, s16 unused, + s16* linkDetected, s16 drawFlag); void EffectSsKakera_Spawn(GlobalContext* globalCtx, Vec3f* pos, Vec3f* velocity, Vec3f* arg3, s16 gravity, s16 arg5, s16 arg6, s16 arg7, s16 arg8, s16 scale, s16 arg10, s16 arg11, s32 life, s16 colorIdx, s16 objId, Gfx* dList); @@ -888,7 +889,7 @@ void func_800BBA88(GlobalContext* globalCtx, Actor* actor); void func_800BBB74(s16* arg1, UNK_TYPE1 arg2, UNK_TYPE1 arg3, UNK_TYPE4 arg4); // void func_800BBC20(void); void func_800BBCEC(Actor* actor, GlobalContext* globalCtx, s16 arg2, Gfx** dList); -// void func_800BBDAC(GlobalContext* globalCtx, UNK_PTR param_2, UNK_PTR param_3, f32 param_4, UNK_TYPE4 param_5, f32 param_6, s16 param_7, s16 param_8, u8 param_9); +void func_800BBDAC(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3, UNK_TYPE4 arg4, f32 arg5, s16 arg6, s16 arg7, u8 arg8); void func_800BBFB0(GlobalContext* globalCtx, Vec3f* position, f32 param3, s32 param_4, s16 param_5, s16 param_6, u8 param_7); void func_800BC154(GlobalContext* globalCtx, ActorContext* actorCtx, Actor* actor, u8 actorCategory); // void func_800BC188(void); @@ -898,7 +899,7 @@ Actor* func_800BC270(GlobalContext* globalCtx, Actor* actor, f32 arg2, UNK_TYPE4 // void func_800BC4EC(void); // void func_800BC5B8(void); // void func_800BC5EC(void); -// void func_800BC620(void); +void func_800BC620(Vec3f* arg0, Vec3f* arg1, UNK_TYPE arg2, GlobalContext* globalCtx); // void func_800BC770(void); // void func_800BC7D8(void); // void func_800BC848(void); @@ -916,7 +917,7 @@ void func_800BD888(Actor*, struct_800BD888_arg1*, s16, s16); // This function is // void func_800BD9E0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE2 param_6); // void func_800BDAA0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE2 param_6); // void func_800BDB6C(void); -void func_800BDC5C(SkelAnime* skelAnime, ActorAnimationEntry animation[], s16 index); +void func_800BDC5C(SkelAnime* skelAnime, ActorAnimationEntry animation[], s32 index); // void func_800BDCF4(void); void Actor_Noop(Actor* actor, GlobalContext* globalCtx); void func_800BDFC0(GlobalContext* globalCtx, Gfx* dl); @@ -994,7 +995,7 @@ CollisionHeader* BgCheck_GetActorMeshHeader(CollisionContext* colCtx, s32 index) f32 func_800C3D50(s32 arg0, CollisionContext* colCtx, s32 arg2, CollisionPoly** arg3, s32* arg4, Vec3f* pos, Actor* actor, s32 arg7, f32 arg8, s32 arg9); // void func_800C3F40(void); // void func_800C3FA0(void); -// void func_800C4000(void); +f32 func_800C4000(GlobalContext* globalCtx, CollisionContext* colCtx, Vec3s* arg2, Vec3f* arg3); // void func_800C4058(void); // void func_800C40B4(void); f32 func_800C411C(CollisionContext* colCtx, CollisionPoly** arg1, s32* arg2, Actor* actor, Vec3f* pos); @@ -2555,7 +2556,7 @@ s32 Entrance_GetTransitionFlags(u16 entranceIndex); // void func_80132E9C(void); // void func_80132FDC(void); // void func_80133000(void); -// void func_80133038(void); +s32 func_80133038(GlobalContext* globalCtx, UNK_PTR arg1, struct_80133038_arg2* arg2); void SkelAnime_LodDrawLimb(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex); void SkelAnime_LodDraw(GlobalContext* globalCtx, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, Actor* actor, s32 dListIndex); void SkelAnime_LodDrawLimbSV(GlobalContext* globalCtx, s32 limbIndex, void** skeleton, Vec3s* limbDrawTable, OverrideLimbDrawSV overrideLimbDraw, PostLimbDrawSV postLimbDraw, Actor* actor, s32 dListIndex, RSPMatrix** mtx); @@ -2695,17 +2696,17 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, // void func_8013A7C0(void); // void func_8013A860(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10); // void func_8013AB00(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9); -// void func_8013AD6C(void); +s32 func_8013AD6C(GlobalContext* globalCtx); // void func_8013AD9C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); void func_8013AED4(u16* param_1, u16 param_2, u16 param_3); -// void func_8013AF00(void); +void func_8013AF00(UNK_PTR arg0, UNK_TYPE arg1, UNK_TYPE arg2); // void func_8013B010(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); // void func_8013B0C8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); // void func_8013B350(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); -// void func_8013B6B0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9); -// void func_8013B878(void); -// void func_8013BB34(void); -// void func_8013BB7C(void); +s32 func_8013B6B0(Path* path, UNK_PTR arg1, s32* arg2, s32 arg3, s32 arg4, s32* arg5, UNK_PTR arg6, Vec3f* arg7, s16 arg8); +void func_8013B878(GlobalContext* globalCtx, Path* path, s32 arg2, Vec3f* arg3); +Path* func_8013BB34(GlobalContext* globalCtx, u8 arg1, UNK_TYPE arg2); +Actor* func_8013BB7C(Actor* actor, GlobalContext* globalCtx, s32 actorCategory, s32 actorId); UNK_TYPE func_8013BC6C(SkelAnime* skelAnime, ActorAnimationEntryS* arg1, s32 arg2); // void func_8013BD40(void); // void func_8013BEDC(void); @@ -2719,8 +2720,8 @@ UNK_TYPE func_8013BC6C(SkelAnime* skelAnime, ActorAnimationEntryS* arg1, s32 arg // void func_8013D0E0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6); void func_8013D2E0(Vec3f* arg0, PosRot* arg1, ActorShape* arg2, s16* arg3, s16* arg4, s16* arg5, s16* arg6); UNK_TYPE func_8013D5E8(s16 arg0, UNK_TYPE arg1, s16 arg2); -u8* func_8013D648(GlobalContext *globalCtx, s16 arg1, s32 arg2); -UNK_TYPE func_8013D68C(u8* arg0, s16 arg1, UNK_PTR arg2); +Path* func_8013D648(GlobalContext *globalCtx, s16 arg1, s32 arg2); +UNK_TYPE func_8013D68C(Path* path, s16 arg1, UNK_PTR arg2); // void func_8013D720(void); UNK_TYPE func_8013D768(Actor* actor, UNK_PTR arg1, s16 arg2); // void func_8013D83C(void); @@ -3325,7 +3326,7 @@ u32 func_8017AA0C(Vec3f* param_1, Vec3f* param_2, Vec3f* param_3); u32 func_8017ABBC(Vec3f* param_1, Vec3f* param_2, Vec3f* param_3); // void func_8017AD38(void); // void func_8017B68C(void); -// void func_8017B7F8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); +void func_8017B7F8(Vec3f* arg0, s16 arg1, f32* arg2, f32* arg3, f32* arg4); void Math3D_UnitNormalVector(Vec3f* a, Vec3f* b, Vec3f* c, f32* normX, f32* normY, f32* normZ, f32* param_7); f32 Math3D_SignedDistanceFromPlane(f32 normX, f32 normY, f32 normZ, f32 d, Vec3f* position); // void func_8017B9D8(void); diff --git a/include/z64.h b/include/z64.h index 4048080d5b..b0c0121aaa 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1720,6 +1720,12 @@ typedef struct { /* 0x24 */ s16 unk_24; } struct_800BD888_arg1; // size = 0x28 +typedef struct { + /* 0x0 */ u8 unk0; + /* 0x4 */ s32 unk4; + /* 0x8 */ s32 unk8; +} struct_80133038_arg2; // size = 0xC + typedef struct { /* 0x000 */ Actor base; /* 0x144 */ ColliderQuad unk144; diff --git a/include/z64item.h b/include/z64item.h index 9a7330adc6..9c53e3e7c1 100644 --- a/include/z64item.h +++ b/include/z64item.h @@ -7,7 +7,8 @@ // TODO fill out these enums typedef enum { - /* 0x1 */ EQUIP_SHIELD = 0x1 + /* 0x0 */ EQUIP_SWORD, + /* 0x1 */ EQUIP_SHIELD } EquipmentType; typedef enum { diff --git a/include/z64player.h b/include/z64player.h index 22817042f6..0e25fcd86e 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -209,8 +209,8 @@ typedef struct Player { /* 0xA74 */ u32 stateFlags3; /* 0xA78 */ Actor* unk_A78; /* 0xA7C */ Actor* boomerangActor; - /* 0xA80 */ Actor* naviActor; - /* 0xA84 */ s16 naviTextId; + /* 0xA80 */ Actor* tatlActor; + /* 0xA84 */ s16 tatlTextId; /* 0xA86 */ s8 unk_A86; /* 0xA87 */ s8 unk_A87; /* 0xA88 */ Actor* targetActor; diff --git a/include/z64save.h b/include/z64save.h index 694b7a7fb8..25ec9f72c9 100644 --- a/include/z64save.h +++ b/include/z64save.h @@ -51,8 +51,7 @@ typedef struct { /* 0x000C */ u16 time; // "zelda_time" /* 0x000E */ u16 owlSaveLocation; /* 0x0010 */ s32 isNight; // "asahiru_fg" - /* 0x0014 */ u16 unk_14; // "change_zelda_time" - /* 0x0016 */ u16 unk_16; + /* 0x0014 */ u32 unk_14; // "change_zelda_time" /* 0x0018 */ s32 day; // "totalday" /* 0x001C */ u32 daysElapsed; // "eventday" /* 0x0020 */ u8 playerForm; // "player_character" diff --git a/linker_scripts/code_script.txt b/linker_scripts/code_script.txt index f422280565..47eafe4638 100644 --- a/linker_scripts/code_script.txt +++ b/linker_scripts/code_script.txt @@ -7684,9 +7684,9 @@ SECTIONS ovl_En_Suttari : AT(RomLocation) { build/src/overlays/actors/ovl_En_Suttari/z_en_suttari.o(.text) - build/asm/overlays/ovl_En_Suttari_data.o(.data) + build/src/overlays/actors/ovl_En_Suttari/z_en_suttari.o(.data) build/src/overlays/actors/ovl_En_Suttari/z_en_suttari.o(.rodata) - build/asm/overlays/ovl_En_Suttari_rodata.o(.rodata) + build/src/overlays/actors/ovl_En_Suttari/z_en_suttari_overlay.o(.ovl) } SegmentEnd = .; SegmentSize = SegmentEnd - SegmentStart; diff --git a/linker_scripts/object_script.txt b/linker_scripts/object_script.txt index b7a90c95e6..25c0cc6232 100644 --- a/linker_scripts/object_script.txt +++ b/linker_scripts/object_script.txt @@ -606,6 +606,18 @@ D_06002C8C = 0x06002C8C; D_060000B4 = 0x060000B4; D_06002BF0 = 0x06002BF0; +/* z_en_suttari */ +D_0600C240 = 0x0600C240; +D_0600071C = 0x0600071C; +D_060128F4 = 0x060128F4; +D_06011F84 = 0x06011F84; +D_06012E84 = 0x06012E84; +D_0601139C = 0x0601139C; +D_06011C38 = 0x06011C38; +D_06010BDC = 0x06010BDC; +D_0600AF90 = 0x0600AF90; +D_06013380 = 0x06013380; + /* z_en_torch2 */ D_0401C430 = 0x0401C430; D_04048DF0 = 0x04048DF0; diff --git a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c index 7dec3fcf6a..4813479c4b 100644 --- a/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c +++ b/src/overlays/actors/ovl_Dm_Nb/z_dm_nb.c @@ -31,7 +31,6 @@ extern AnimationHeader D_06000990; extern FlexSkeletonHeader D_06008C40; -// Probably the same struct as ActorAnimationEntryS, need more info from func_8013BC6C static ActorAnimationEntryS D_80C1E200[] = { &D_06000990, 1.0f, 0, -1, 0, 0 }; s32 func_80C1DED0(DmNb* this, s32 arg1) { diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.h b/src/overlays/actors/ovl_En_Elf/z_en_elf.h index ea6dbb23c2..c60e469c01 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.h +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.h @@ -7,7 +7,9 @@ struct EnElf; typedef struct EnElf { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x130]; + /* 0x144 */ char unk_144[0x120]; + /* 0x264 */ u16 unk264; + /* 0x266 */ char unk_266[0xE]; } EnElf; // size = 0x274 extern const ActorInit En_Elf_InitVars; 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 6b44d3c4ee..389028cc5b 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -318,10 +318,10 @@ void EnIn_DoNothing(EnIn* this, GlobalContext* globalCtx) { } void func_808F3618(EnIn* this, GlobalContext* globalCtx) { - if (ENIN_GET_WALKING_FLAG(&this->actor) != 0x3F) { + if (ENIN_GET_PATH(&this->actor) != 0x3F) { func_808F30B0(&this->skelAnime, 9); } - if (ENIN_GET_WALKING_FLAG(&this->actor) != 0x3F) { + if (ENIN_GET_PATH(&this->actor) != 0x3F) { this->actionFunc = func_808F3690; } else { this->actionFunc = EnIn_DoNothing; @@ -334,9 +334,9 @@ void func_808F3690(EnIn* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.speedXZ, 1.0f, 0.4f, 1000.0f, 0.0f); sp36 = this->actor.speedXZ * 400.0f; - if (func_8013D68C(this->unk240, this->unk244, &sp28) && func_8013D768(&this->actor, &sp28, sp36)) { + if (func_8013D68C(this->path, this->unk244, &sp28) && func_8013D768(&this->actor, &sp28, sp36)) { this->unk244++; - if (this->unk244 >= *this->unk240) { + if (this->unk244 >= this->path->count) { this->unk244 = 0; } } @@ -1424,7 +1424,7 @@ void EnIn_Init(Actor* thisx, GlobalContext* globalCtx) { Collider_SetJntSph(globalCtx, &this->colliderJntSph, &this->actor, &sJntSphInit, &this->colliderJntSphElement); Actor_SetScale(&this->actor, 0.01f); this->actor.gravity = -4.0f; - this->unk240 = func_8013D648(globalCtx, ENIN_GET_WALKING_FLAG(&this->actor), 0x3F); + this->path = func_8013D648(globalCtx, ENIN_GET_PATH(&this->actor), 0x3F); this->unk23D = 0; if (type == ENIN_YELLOW_SHIRT || type == ENIN_BLUE_SHIRT) { if ((gSaveContext.weekEventReg[92] & (1 | 2 | 4)) == 2 || diff --git a/src/overlays/actors/ovl_En_In/z_en_in.h b/src/overlays/actors/ovl_En_In/z_en_in.h index 51e9058146..78c3b93400 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.h +++ b/src/overlays/actors/ovl_En_In/z_en_in.h @@ -16,7 +16,7 @@ typedef enum { } EnInType; #define ENIN_GET_TYPE(thisx) ((thisx)->params & 0x1FF) -#define ENIN_GET_WALKING_FLAG(thisx) (((thisx)->params & 0x7E00) >> 9) // Only used with ENIN_UNK_TYPE +#define ENIN_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) // Only used with ENIN_UNK_TYPE typedef struct EnIn { /* 0x000 */ Actor actor; @@ -28,7 +28,7 @@ typedef struct EnIn { /* 0x238 */ char unk238[0x4]; /* 0x23C */ u8 unk23C; /* 0x23D */ u8 unk23D; - /* 0x240 */ u8 *unk240; + /* 0x240 */ Path *path; /* 0x244 */ s16 unk244; /* 0x248 */ Vec3f unk248; /* 0x254 */ Vec3f unk254; diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index dead6d6914..8c8f831f61 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -1,4 +1,12 @@ +/* + * File: z_en_suttari.c + * Overlay: ovl_En_Suttari + * Description: Sakon + */ + #include "z_en_suttari.h" +#include "overlays/actors/ovl_En_Elf/z_en_elf.h" +#include "overlays/actors/ovl_En_Door/z_en_door.h" #define FLAGS 0x00000019 @@ -9,7 +17,36 @@ void EnSuttari_Destroy(Actor* thisx, GlobalContext* globalCtx); void EnSuttari_Update(Actor* thisx, GlobalContext* globalCtx); void EnSuttari_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 +void func_80BACA14(EnSuttari* this, GlobalContext* globalCtx); +void func_80BACEE0(EnSuttari* this, GlobalContext* globalCtx); +void func_80BAD004(EnSuttari* this, GlobalContext* globalCtx); +void func_80BAD5F8(EnSuttari* this, GlobalContext* globalCtx); +void func_80BAD7F8(EnSuttari* this, GlobalContext* globalCtx); +void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx); +void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx); +void func_80BADA9C(EnSuttari* this, GlobalContext* globalCtx); +void func_80BADDB4(EnSuttari* this, GlobalContext* globalCtx); +void func_80BAD130(EnSuttari* this, GlobalContext* globalCtx); +void func_80BACD2C(EnSuttari* this, GlobalContext* globalCtx); +void func_80BACE4C(EnSuttari* this, GlobalContext* globalCtx); +void func_80BADD0C(EnSuttari* this, GlobalContext* globalCtx); +void func_80BADA08(EnSuttari* this, GlobalContext* globalCtx); +void func_80BAD2B4(EnSuttari* this, GlobalContext* globalCtx); +void func_80BADE14(EnSuttari* this, GlobalContext* globalCtx); +void func_80BADE8C(EnSuttari* this, GlobalContext* globalCtx); +void func_80BADF3C(EnSuttari* this, GlobalContext* globalCtx); + +extern FlexSkeletonHeader D_0600C240; +extern AnimationHeader D_0600071C; +extern AnimationHeader D_060128F4; +extern AnimationHeader D_06011F84; +extern AnimationHeader D_06012E84; +extern AnimationHeader D_0601139C; +extern AnimationHeader D_06011C38; +extern AnimationHeader D_06010BDC; +extern Gfx D_0600AF90[]; +extern Gfx D_06013380[]; + const ActorInit En_Suttari_InitVars = { ACTOR_EN_SUTTARI, ACTORCAT_NPC, @@ -22,21 +59,39 @@ const ActorInit En_Suttari_InitVars = { (ActorFunc)EnSuttari_Draw, }; +static ActorAnimationEntry sAnimations[] = { + { &D_0600071C, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &D_060128F4, 1.0f, 0.0f, 0.0f, 0, 0.0f }, + { &D_06011F84, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &D_06012E84, 1.0f, 0.0f, 0.0f, 0, -6.0f }, + { &D_0601139C, 1.0f, 0.0f, 0.0f, 0, 0.0f }, { &D_0600071C, 2.0f, 0.0f, 0.0f, 0, 0.0f }, + { &D_06011F84, 2.0f, 0.0f, 0.0f, 0, 0.0f }, { &D_06011C38, 1.0f, 0.0f, 0.0f, 2, 0.0f }, + { &D_06010BDC, 1.0f, 0.0f, 0.0f, 0, 0.0f }, +}; -// static ColliderCylinderInit sCylinderInit = { -static ColliderCylinderInit D_80BAE7A8 = { - { COLTYPE_NONE, 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_NONE, + 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 } }, }; +static CollisionCheckInfoInit2 sColChkInfoInit2 = { + 0, 18, 64, 0, MASS_IMMOVABLE, +}; -// sColChkInfoInit -static CollisionCheckInfoInit2 D_80BAE7D4 = { 0, 18, 64, 0, MASS_IMMOVABLE }; - - -// static DamageTable sDamageTable = { -static DamageTable D_80BAE7E0 = { +static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(1, 0x0), /* Deku Stick */ DMG_ENTRY(1, 0x0), /* Horse trample */ DMG_ENTRY(1, 0x0), @@ -71,114 +126,1434 @@ static DamageTable D_80BAE7E0 = { /* Powder Keg */ DMG_ENTRY(1, 0xE), }; +static s16 D_80BAE800[] = { + 4000, 4, 1, 3, 6000, 4, 1, 6, 4000, 4, 1, 3, 6000, 4, 1, 6, +}; -extern ColliderCylinderInit D_80BAE7A8; -extern CollisionCheckInfoInit2 D_80BAE7D4; -extern DamageTable D_80BAE7E0; -#endif +static UNK_TYPE D_80BAE820[] = { + 0xC00027C, 0x210877, 0xA006D31, 0x2000000, 0x19250200, 0x19001E19, 0x2010F01, 0x140D0201, 0x14012D01, + 0x50E0114, 0x12D0E0E, 0x10F0114, 0x70E0019, 0x1E060E, 0x19, 0xD0A000D, 0x3D020019, 0x1E3102, + 0x1E002D, 0x2502002D, 0x1001902, 0x100010F, 0xD02010F, 0x1140105, 0xE010F01, 0x14090E01, 0x10F0B, + 0xE002D01, 0x20E00, 0x1E002D0A, 0xE001900, 0x1E080505, 0xC000125, 0xA006E20, 0x2120000, 0x14140200, + 0x14001E08, 0xF001E03, 0x4000405, 0xE001400, 0x1E0F0E12, 0x1403, 0x50C0003, 0x270A0013, 0x22021200, + 0x13001602, 0x13001319, 0xD021319, 0x105, 0xE131900, 0x10400, 0x50E1200, 0x13000C05, 0x5000000, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAA6D0.asm") +static s32 D_80BAE8F8[] = { + -1, -1, -1, -1, -1, -1, 1, 2, 0, 3, 1, 2, 0, 0, 3, 0, +}; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAA848.asm") +void EnSuttari_UpdateCollider(EnSuttari* 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_Suttari_0x80BAA6D0/func_80BAA88C.asm") + if (this->flags1 & 0x40) { + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; + if (this->actor.colChkInfo.damageEffect == 0xF) { + this->flags1 |= 0x100; + this->flags1 &= ~0x40; + func_800BBA88(globalCtx, &this->actor); + } else if (this->actor.colChkInfo.damageEffect == 0xE) { + this->flags1 |= 0x200; + this->flags1 &= ~0x40; + } + } + } -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAA8D0.asm") + 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_Suttari_0x80BAA6D0/func_80BAA904.asm") + if ((this->flags1 & 1) && (this->actionFunc != func_80BADE14)) { + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 35.0f, 30.0f, 30.0f, 5); + } else { + Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 35.0f, 30.0f, 30.0f, 4); + } +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAA9B4.asm") +Actor* EnSuttari_GetActorById(GlobalContext* globalCtx, s16 actorId) { + Actor* actor = globalCtx->actorCtx.actorList[ACTORCAT_NPC].first; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAAA94.asm") + while (actor != NULL) { + if (actor->id == actorId) { + return actor; + } + actor = actor->next; + } + return NULL; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAAB78.asm") +void EnSuttari_SetNextEntrance(GlobalContext* globalCtx, u16 nextEntranceIndex) { + globalCtx->nextEntranceIndex = nextEntranceIndex; + globalCtx->unk_1887F = 0x40; + gSaveContext.nextTransition = 0x40; + globalCtx->sceneLoadFlag = 0x14; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAAF1C.asm") +void EnSuttari_UpdateTime(void) { + u32* unk_14 = &gSaveContext.unk_14; + u16 time = gSaveContext.time; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAAFDC.asm") + gSaveContext.time = (u16)REG(15) + time; + time = gSaveContext.time; + gSaveContext.time = (u16)*unk_14 + time; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAB1A0.asm") +s32 func_80BAA904(EnSuttari* this, GlobalContext* globalCtx) { + Vec3f sp2C; + Vec3s sp24; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAB374.asm") + sp2C.x = (Math_SinS(this->actor.world.rot.y) * 50.0f) + this->actor.world.pos.x; + sp2C.y = this->actor.world.pos.y + 100.0f; + sp2C.z = (Math_CosS(this->actor.world.rot.y) * 50.0f) + this->actor.world.pos.z; + if (func_800C4000(globalCtx, &globalCtx->colCtx, &sp24, &sp2C) > -500.0f) { + return false; + } + return true; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAB434.asm") +void func_80BAA9B4(EnSuttari* this) { + s16 curFrame = this->skelAnime.animCurrentFrame; + s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common); -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAB490.asm") + switch (this->textId) { + case 0x1454: + case 0x1455: + case 0x1456: + case 0x1457: + case 0x1458: + case 0x1459: + case 0x145A: + case 0x145B: + if ((this->animationIdx != 8) && (curFrame == frameCount)) { + this->animationIdx = 8; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + } + break; + default: + if ((this->animationIdx != 1) && (curFrame == frameCount)) { + this->animationIdx = 1; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + } + } +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAB4F0.asm") +void func_80BAAA94(EnSuttari* this) { + switch (this->textId) { + case 0x29E5: + this->animationIdx = 1; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + break; + case 0x29E9: + this->enFsn->flags |= ENFSN_ANGRY; + break; + case 0x29EA: + this->enFsn->flags |= ENFSN_CALM_DOWN; + break; + case 0x29EB: + this->enFsn->flags |= ENFSN_OFFER_FINAL_PRICE; + break; + case 0x29EC: + this->animationIdx = 7; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + break; + case 0x29ED: + this->animationIdx = 1; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + break; + } +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAB698.asm") +void func_80BAAB78(EnSuttari* this, GlobalContext* globalCtx) { + if (this->flags1 & 4) { + switch (this->textId) { + case 0: + this->flags1 |= 0x20; + this->cutsceneIdx = 0; + this->textId = 0x29E5; + break; + case 0x29E5: + ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); + this->cutsceneIdx = 1; + this->textId = 0x29E6; + break; + case 0x29E6: + ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); + this->cutsceneIdx = 0; + this->textId = 0x29E7; + break; + case 0x29E7: + ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); + this->cutsceneIdx = 1; + this->textId = 0x29E8; + break; + case 0x29E8: + ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); + this->cutsceneIdx = 0; + this->textId = 0x29E9; + break; + case 0x29E9: + ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); + this->cutsceneIdx = 1; + this->textId = 0x29EA; + break; + case 0x29EA: + ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); + this->cutsceneIdx = 0; + this->textId = 0x29EB; + break; + case 0x29EB: + ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); + this->cutsceneIdx = 1; + this->textId = 0x29EC; + break; + case 0x29EC: + ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); + this->cutsceneIdx = 0; + this->textId = 0x29ED; + break; + case 0x29ED: + ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); + this->flags1 |= 0x400; + this->cutsceneIdx = 1; + this->textId = 0x29EE; + break; + } + if (ActorCutscene_GetCurrentIndex() == 0x7C) { + ActorCutscene_Stop(0x7C); + } + ActorCutscene_SetIntentToPlay(this->cutscenes[this->cutsceneIdx]); + this->actionFunc = func_80BADD0C; + } else if (this->flags1 & 1) { + switch (this->textId) { + case 0: + if (gSaveContext.weekEventReg[0x51] & 1) { + this->textId = 0x1455; + ((EnElf*)PLAYER->tatlActor)->unk264 |= 8; + this->flags2 |= 1; + } else { + this->textId = 0x1450; + } + break; + case 0x1450: + this->textId = 0x1451; + break; + case 0x1451: + if (this->flags1 & 0x800) { + this->flags1 &= ~0x800; + this->textId = 0x1453; + } else { + this->flags1 |= 0x400; + this->textId = 0x1452; + gSaveContext.weekEventReg[0x51] |= 1; + } + break; + case 0x1453: + this->flags1 |= 0x400; + gSaveContext.weekEventReg[0x51] |= 1; + ((EnElf*)PLAYER->tatlActor)->unk264 |= 8; + this->flags2 |= 1; + this->textId = 0x1454; + break; + case 0x1455: + this->textId = 0x1456; + break; + case 0x1456: + this->textId = 0x1457; + break; + case 0x1457: + this->textId = 0x1458; + break; + case 0x1458: + this->textId = 0x1459; + break; + case 0x1459: + this->textId = 0x145A; + break; + case 0x145A: + this->flags1 |= 0x400; + this->textId = 0x145B; + break; + } + } + func_801518B0(globalCtx, this->textId, &this->actor); +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAB758.asm") +void func_80BAAF1C(EnSuttari* this) { + s16 curFrame = this->skelAnime.animCurrentFrame; + s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common); -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAB8F4.asm") + if (this->animationIdx == 5) { + this->animationIdx = 3; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + } else if ((this->animationIdx == 3) && (curFrame == frameCount)) { + this->animationIdx = 6; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + this->flags1 &= ~0x100; + } +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BABA90.asm") +void func_80BAAFDC(EnSuttari* this, GlobalContext* globalCtx) { + if ((this->actor.xzDistToPlayer < 500.0f) && (this->actor.yDistToPlayer < 100.0f)) { + Vec3f effectVelOffset = { 0.0f, 0.0f, 0.0f }; + Vec3f effectPos; + Vec3f effectVel; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BABB90.asm") + Math_Vec3f_Copy(&effectPos, &this->actor.world.pos); + effectPos.x += Math_SinS(this->actor.world.rot.y + this->unk3F4) * 10.0f; + effectPos.y += 60.0f; + effectPos.z += Math_CosS(this->actor.world.rot.y + this->unk3F4) * 10.0f; + SysMatrix_StatePush(); + Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_NEW); + effectVelOffset.z = 20.0f; + SysMatrix_MultiplyVector3fByState(&effectVelOffset, &effectVel); + SysMatrix_StatePop(); + if (this->unk3F0 == 0) { + EffectSsSolderSrchBall_Spawn(globalCtx, &effectPos, &effectVel, &D_801D15B0, 50, &this->unk3F0, 1); + } + if (this->unk3F0 == 1) { + play_sound(NA_SE_SY_FOUND); + this->unk3F0 = 0; + this->actor.speedXZ = 0.0f; + if (this->unk1F4[0] != 0) { + this->unk1F4[0]--; + } + gSaveContext.weekEventReg[0x3D] |= 8; + this->unk3F6 = 20; + this->actionFunc = func_80BADE8C; + } + } +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BABC48.asm") +void func_80BAB1A0(EnSuttari* this, GlobalContext* globalCtx) { + if ((this->actor.xzDistToPlayer < 500.0f) && (this->actor.yDistToPlayer < 100.0f)) { + Vec3f effectVelOffset = { 0.0f, 0.0f, 0.0f }; + Vec3f effectPos; + Vec3f effectVel; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BABDD8.asm") + Math_Vec3f_Copy(&effectPos, &this->actor.world.pos); + effectPos.x += Math_SinS(this->actor.world.rot.y + this->unk3F4) * 350.0f; + effectPos.y += 60.0f; + effectPos.z += Math_CosS(this->actor.world.rot.y + this->unk3F4) * 350.0f; + SysMatrix_StatePush(); + Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_NEW); + effectVelOffset.z = 20.0f; + SysMatrix_MultiplyVector3fByState(&effectVelOffset, &effectVel); + SysMatrix_StatePop(); + if (this->unk3F0 == 0) { + EffectSsSolderSrchBall_Spawn(globalCtx, &effectPos, &effectVel, &D_801D15B0, 50, &this->unk3F0, 1); + } + if (this->unk3F0 == 1) { + play_sound(NA_SE_SY_FOUND); + this->unk3F0 = 0; + this->actor.speedXZ = 0.0f; + if (this->unk1F4[0] != 0) { + this->unk1F4[0]--; + } + gSaveContext.weekEventReg[0x3D] |= 8; + this->unk3F6 = 20; + this->actionFunc = func_80BADE8C; + } else { + func_80BAAFDC(this, globalCtx); + } + } +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BABF64.asm") +void func_80BAB374(EnSuttari* this, GlobalContext* globalCtx) { + s16 curFrame = this->skelAnime.animCurrentFrame; + Vec3f sp38; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BABFD4.asm") + if ((curFrame % 3) == 0) { + sp38.x = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.x; + sp38.y = this->actor.world.pos.y; + sp38.z = randPlusMinusPoint5Scaled(15.0f) + this->actor.world.pos.z; + func_800BBDAC(globalCtx, &this->actor, &sp38, 10.0f, 0, 2.0f, 0, 0, 0); + } +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAC220.asm") +void func_80BAB434(EnSuttari* this) { + this->unk3F2 = Math_SinS(this->unk3F4) * 60.0f * (0x10000 / 360.0f); + this->unk3F4 += 0x400; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAC2FC.asm") +void EnSuttari_GetPaths(EnSuttari* this, GlobalContext* globalCtx) { + this->paths[0] = func_8013D648(globalCtx, ENSUTTARI_GET_PATH(&this->actor), 0x3F); + this->paths[1] = func_8013D648(globalCtx, this->paths[0]->unk1, 0x3F); +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAC6E8.asm") +void func_80BAB4F0(EnSuttari* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + Vec3f sp30; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BACA14.asm") + if (this->flags1 & 0x80) { + EnSuttari_UpdateCollider(this, globalCtx); + } + SkelAnime_FrameUpdateMatrix(&this->skelAnime); + if (!(this->flags1 & 4) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE_MASK)) { + if (func_8013D5E8(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer) != 0) { + sp30.x = player->actor.world.pos.x; + sp30.y = player->bodyPartsPos[7].y + 3.0f; + sp30.z = player->actor.world.pos.z; + func_8013D2E0(&sp30, &this->actor.focus, &this->actor.shape, &this->unk2D6, &this->unk2DC, &this->unk2E2, + D_80BAE800); + } else { + Math_SmoothStepToS(&this->unk2D6, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->unk2D8, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->unk2DC, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->unk2DE, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->unk2E2, 0, 4, 0x3E8, 1); + Math_SmoothStepToS(&this->unk2E4, 0, 4, 0x3E8, 1); + } + } + func_8013D9C8(globalCtx, this->unk2FA, this->unk31A, 16); +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BACBB0.asm") +s16 func_80BAB698(Path* path, s32 idx, Vec3f* pos, f32* distSQ) { + Vec3s* points; + f32 diffX; + f32 diffZ; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BACD2C.asm") + if (path != NULL) { + points = (Vec3s*)Lib_SegmentedToVirtual(path->points); + points = &points[idx]; + diffX = points->x - pos->x; + diffZ = points->z - pos->z; + } else { + diffX = 0.0f; + diffZ = 0.0f; + } + *distSQ = SQ(diffX) + SQ(diffZ); + return Math_Acot2F(diffZ, diffX) * (0x8000 / M_PI); +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BACE4C.asm") +s32 func_80BAB758(EnSuttari* this, Path* path, s32 arg2) { + Vec3s* sp5C = Lib_SegmentedToVirtual(path->points); + s32 sp58; + f32 sp54; + s32 ret; + s32 pad4C; + f32 sp48; + f32 sp44; + f32 sp40; + f32 sp3C; + Vec3f sp30; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BACEE0.asm") + if (sp5C[arg2].x) {} + sp58 = path->count; + ret = false; + Math_Vec3s_ToVec3f(&sp30, &sp5C[arg2]); + if (arg2 == 0) { + sp54 = sp5C[1].x - sp5C[0].x; + sp48 = sp5C[1].z - sp5C[0].z; + } else if (arg2 == sp58 - 1) { + sp54 = sp5C[sp58 - 1].x - sp5C[sp58 - 2].x; + sp48 = sp5C[sp58 - 1].z - sp5C[sp58 - 2].z; + } else { + sp54 = sp5C[arg2 + 1].x - sp5C[arg2 - 1].x; + sp48 = sp5C[arg2 + 1].z - sp5C[arg2 - 1].z; + } + func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(sp54, sp48)), &sp44, &sp40, &sp3C); + if (((sp44 * this->actor.world.pos.x) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { + ret = true; + } + return ret; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAD004.asm") +s32 func_80BAB8F4(EnSuttari* this, Path* path, s32 arg2) { + Vec3s* sp5C = Lib_SegmentedToVirtual(path->points); + s32 sp58; + f32 sp54; + s32 ret; + s32 pad4C; + f32 sp48; + f32 sp44; + f32 sp40; + f32 sp3C; + Vec3f sp30; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAD130.asm") + if (sp5C[arg2 - 1].x) {} + sp58 = path->count; + ret = false; + Math_Vec3s_ToVec3f(&sp30, &sp5C[arg2]); + if (arg2 == 0) { + sp54 = sp5C[0].x - sp5C[1].x; + sp48 = sp5C[0].z - sp5C[1].z; + } else if (arg2 == sp58 - 1) { + sp54 = sp5C[sp58 - 2].x - sp5C[sp58 - 1].x; + sp48 = sp5C[sp58 - 2].z - sp5C[sp58 - 1].z; + } else { + sp54 = sp5C[arg2 - 1].x - sp5C[arg2 + 1].x; + sp48 = sp5C[arg2 - 1].z - sp5C[arg2 + 1].z; + } + func_8017B7F8(&sp30, RADF_TO_BINANG(func_80086B30(sp54, sp48)), &sp44, &sp40, &sp3C); + if (((sp44 * this->actor.world.pos.x) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { + ret = true; + } + return ret; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAD230.asm") +void func_80BABA90(EnSuttari* this, s32 arg1, u8 arg2) { + s16 target; + f32 dist; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAD2B4.asm") + if (this->paths[arg1] != NULL) { + target = func_80BAB698(this->paths[arg1], this->unk1F4[arg1], &this->actor.world.pos, &dist); + if (this->actor.bgCheckFlags & 8) { + if (arg2 == 2) { + this->unk1F4[arg1] = -0x63; + } else { + target = this->actor.wallYaw; + } + } + Math_SmoothStepToS(&this->actor.world.rot.y, target, 4, 0x3E8, 1); + this->actor.shape.rot.y = this->actor.world.rot.y; + if (func_80BAB758(this, this->paths[arg1], this->unk1F4[arg1])) { + if (this->unk1F4[arg1] >= (this->paths[arg1]->count - 1)) { + if (arg2 == 0) { + this->unk1F4[arg1] = 0; + } else { + this->unk1F4[arg1] = -0x63; + } + } else { + this->unk1F4[arg1]++; + } + } + } +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAD380.asm") +void func_80BABB90(EnSuttari* this, s32 arg1) { + s16 target; + f32 sp30; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAD5F8.asm") + if (this->paths[arg1] != NULL) { + target = func_80BAB698(this->paths[arg1], this->unk1F4[arg1], &this->actor.world.pos, &sp30); + if (this->actor.bgCheckFlags & 8) { + target = this->actor.wallYaw; + } + Math_SmoothStepToS(&this->actor.world.rot.y, target, 1, 0xBB8, 0); + this->actor.shape.rot.y = this->actor.world.rot.y; + if (func_80BAB8F4(this, this->paths[arg1], this->unk1F4[arg1])) { + if (this->unk1F4[arg1] <= 0) { + this->unk1F4[arg1] = -0x63; + } else { + this->unk1F4[arg1]--; + } + } + } +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAD7F8.asm") +s32 func_80BABC48(EnSuttari* this, GlobalContext* globalCtx, struct_80133038_arg2* unkStruct) { + u16 sp26 = gSaveContext.time - 0x3FFC; + u16 pad1; + u8 sp23 = ENSUTTARI_GET_PATH(&this->actor); + u16 pad2; + UNK_TYPE sp1C = D_80BAE8F8[unkStruct->unk0]; + u16 phi_a0; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BADA08.asm") + if (sp1C >= 0) { + this->unk404 = func_8013BB34(globalCtx, sp23, sp1C); + } + if (this->unk404 == NULL) { + return 0; + } + if ((this->unk428 != 0 && this->unk428 < 0xC) && (this->unk42A >= 0)) { + phi_a0 = sp26; + } else { + phi_a0 = unkStruct->unk4; + } + if (unkStruct->unk8 < phi_a0) { + this->unk418 = (phi_a0 - unkStruct->unk8) + 0xFFFF; + } else { + this->unk418 = unkStruct->unk8 - phi_a0; + } + this->unk424 = sp26 - phi_a0; + phi_a0 = this->unk404->count - 2; + this->unk42C = 0; + this->unk41C = this->unk418 / phi_a0; + this->unk420 = (this->unk424 / this->unk41C) + 2; + this->unk430 = 0; + return 1; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BADA9C.asm") +s32 func_80BABDD8(EnSuttari* this, GlobalContext* globalCtx, struct_80133038_arg2* unkStruct) { + s32 pad; + EnDoor* sp48; + u8 sp47; + u16 sp44; + Vec3f sp38; + Vec3f sp2C; + Vec3s* sp28; + UNK_TYPE sp24; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BADD0C.asm") + sp47 = ENSUTTARI_GET_PATH(&this->actor); + sp44 = gSaveContext.time - 0x3FFC; + if (this->unk428 == 10 || this->unk428 == 11 || this->unk428 == 2) { + return 0; + } + sp48 = (EnDoor*)func_8013BB7C(&this->actor, globalCtx, ACTORCAT_DOOR, ACTOR_EN_DOOR); + sp24 = D_80BAE8F8[unkStruct->unk0]; + if ((sp48 != NULL) && (sp24 >= 0)) { + this->unk404 = func_8013BB34(globalCtx, sp47, sp24); + } + if ((sp48 == NULL) || (this->unk404 == NULL)) { + return 0; + } + sp28 = (Vec3s*)Lib_SegmentedToVirtual(this->unk404->points); + Math_Vec3s_ToVec3f(&sp38, &sp28[0]); + Math_Vec3s_ToVec3f(&sp2C, &sp28[1]); + this->unk434 = sp44 - unkStruct->unk4; + this->unk436 = unkStruct->unk8 - unkStruct->unk4; + if (unkStruct->unk0 != 10 && unkStruct->unk0 != 11) { + sp48->unk1A7 = 0x4B; + } + Math_Vec3f_Copy(&this->unk438, &sp38); + Math_Vec3f_Copy(&this->unk444, &sp2C); + this->actor.world.rot.y = Math_Vec3f_Yaw(&sp38, &sp2C); + this->actor.world.pos = sp38; + return 1; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BADDB4.asm") +s32 func_80BABF64(EnSuttari* this, GlobalContext* globalCtx, struct_80133038_arg2* unkStruct) { + s32 ret; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BADE14.asm") + switch (unkStruct->unk0) { + case 15: + case 14: + case 13: + case 12: + ret = func_80BABC48(this, globalCtx, unkStruct); + break; + case 11: + case 10: + case 9: + case 8: + case 7: + case 6: + ret = func_80BABDD8(this, globalCtx, unkStruct); + break; + case 5: + case 4: + case 3: + case 2: + case 1: + ret = 1; + break; + default: + ret = 0; + break; + } + return ret; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BADE8C.asm") +s32 func_80BABFD4(EnSuttari* this, GlobalContext* globalCtx) { + UNK_TYPE1 sp7C[0x424]; + Vec3f sp70; + Vec3f sp64; + Vec3f sp58; + s32 sp54; + s32 sp50; + s32 pad; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BADF3C.asm") + sp54 = 0; + sp50 = 0; + func_8013AF00(&sp7C, 3, this->unk404->count + 3); + if (this->unk42C == 0) { + sp58 = D_801D15B0; + func_8013B6B0(this->unk404, &this->unk414, &this->unk424, this->unk41C, this->unk418, &this->unk420, &sp7C, + &sp58, this->unk42A); + func_8013B878(globalCtx, this->unk404, this->unk420, &sp58); + this->actor.world.pos.y = sp58.y; + this->unk42C = 1; + } else { + sp58 = this->unk408; + } + this->actor.world.pos.x = sp58.x; + this->actor.world.pos.z = sp58.z; + if (func_8013AD6C(globalCtx)) { + sp54 = this->unk424; + sp50 = this->unk420; + sp58 = this->actor.world.pos; + } + this->unk408 = D_801D15B0; + if (func_8013B6B0(this->unk404, &this->unk414, &this->unk424, this->unk41C, this->unk418, &this->unk420, &sp7C, + &this->unk408, this->unk42A)) { + this->unk430 = 1; + } else { + sp70 = this->actor.world.pos; + sp64 = this->unk408; + this->actor.world.rot.y = Math_Vec3f_Yaw(&sp70, &sp64); + } + if (func_8013AD6C(globalCtx)) { + this->unk424 = sp54; + this->unk420 = sp50; + this->unk408 = sp58; + } + return 0; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/EnSuttari_Init.asm") +s32 func_80BAC220(EnSuttari* this, GlobalContext* globalCtx) { + Vec3f sp3C; + Vec3f sp30; + s32 tmp2; + f32 tmp; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/EnSuttari_Destroy.asm") + if (this->unk434 < 0) { + this->unk434 = 0; + } else { + tmp2 = (this->unk436 < this->unk434) ? this->unk436 : this->unk434; + this->unk434 = tmp2; + } + tmp = Math_Vec3f_DistXZ(&this->unk438, &this->unk444) / this->unk436; + sp3C.x = sp3C.y = 0.0f; + sp3C.z = this->unk434 * tmp; + Lib_Vec3f_TranslateAndRotateY(&this->unk438, this->actor.world.rot.y, &sp3C, &sp30); + this->actor.world.pos = sp30; + this->unk434 += this->unk42A; + return 0; +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/EnSuttari_Update.asm") +void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + s16 curFrame = this->skelAnime.animCurrentFrame; + s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common); -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAE250.asm") + switch (this->unk428) { + case 12: + case 13: + this->flags1 |= 0x80; + func_80BABFD4(this, globalCtx); + break; + case 15: + if ((this->animationIdx == 1) && (curFrame == frameCount)) { + this->animationIdx = 2; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + } + if (!(gSaveContext.weekEventReg[0x53] & 4) && !(this->flags1 & 0x1000)) { + if (ActorCutscene_GetCanPlayNext(this->cutscenes[0])) { + ActorCutscene_Start(this->cutscenes[0], &this->actor); + if (!(player->stateFlags1 & 0x10000000)) { + this->flags2 |= 0x10; + player->stateFlags1 |= 0x10000000; + } + this->flags1 |= 0x1000; + this->flags2 |= 2; + } else { + ActorCutscene_SetIntentToPlay(this->cutscenes[0]); + } + } + func_80BABFD4(this, globalCtx); + break; + case 6: + case 8: + this->flags1 |= 0x80; + func_80BAC220(this, globalCtx); + break; + case 10: + this->flags1 |= 0x80; + func_80BAC220(this, globalCtx); + break; + case 9: + case 11: + this->flags1 |= 0x80; + this->flags1 |= 0x20; + this->enFsn->flags &= ~ENFSN_HAGGLE; + if (this->animationIdx != 2) { + this->animationIdx = 2; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + } + func_80BAC220(this, globalCtx); + break; + case 7: + this->flags1 |= 0x20; + this->flags1 |= 0x80; + func_80BAC220(this, globalCtx); + break; + case 14: + this->flags1 |= 0x20; + this->flags1 |= 0x80; + func_80BABFD4(this, globalCtx); + break; + case 1: + Actor_MarkForDeath(&this->actor); + break; + case 2: + if (!(gSaveContext.weekEventReg[0x51] & 4)) { + this->flags1 |= 0x80; + this->actor.world.pos.x = -16.0f; + this->actor.world.pos.z = -16.0f; + this->actor.world.pos.y = 12.0f; + this->enFsn->flags |= ENFSN_HAGGLE; + this->actionFunc = func_80BADA08; + } + break; + case 4: + if (!(gSaveContext.weekEventReg[0x21] & 8)) { + if (this->animationIdx == 2 || this->animationIdx == 1) { + this->animationIdx = 5; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + } + this->flags1 |= 0x10; + if (this->flags2 & 2) { + this->flags2 &= ~2; + } + if (!(player->stateFlags1 & 0x10000000)) { + this->flags2 |= 0x10; + player->stateFlags1 |= 0x10000000; + } + this->textId = 0x2A30; + func_801518B0(globalCtx, this->textId, &this->actor); + this->actionFunc = func_80BAD2B4; + } + break; + } + Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 4, 0x1554); +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAE3C4.asm") +void func_80BAC6E8(EnSuttari* this, GlobalContext* globalCtx) { + ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); + SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_0600C240, &D_0600071C, this->jointTable, this->morphTable, 16); + this->actor.draw = EnSuttari_Draw; + this->actor.flags |= 1; + if (globalCtx->sceneNum == SCENE_IKANA) { + this->flags1 |= 1; + if (gSaveContext.day == 1 || gSaveContext.day == 2) { + this->animationIdx = 2; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + this->flags1 |= 0x80; + this->actionFunc = func_80BACA14; + return; + } else if ((gSaveContext.day == 3) && (gSaveContext.time <= CLOCK_TIME(19, 00)) && + !(gSaveContext.weekEventReg[0x3D] & 8) && !(gSaveContext.weekEventReg[0x21] & 8) && + (gSaveContext.weekEventReg[0x33] & 8)) { + this->animationIdx = 2; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + this->actionFunc = func_80BACEE0; + return; + } + } else if (globalCtx->sceneNum == SCENE_BACKTOWN) { + if (gSaveContext.time >= CLOCK_TIME(0, 20) && gSaveContext.time < CLOCK_TIME(6, 00)) { + Actor_MarkForDeath(&this->actor); + } + if ((gSaveContext.entranceIndex == 0xD670) || (gSaveContext.weekEventReg[0x3A] & 0x40)) { + Actor_MarkForDeath(&this->actor); + } + this->cutscenes[0] = this->actor.cutscene; + this->cutscenes[1] = ActorCutscene_GetAdditionalCutscene(this->cutscenes[0]); + this->flags1 |= 0x80; + this->flags1 |= 8; + this->animationIdx = 1; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + this->actionFunc = func_80BAD004; + return; + } else if (globalCtx->sceneNum == SCENE_ICHIBA) { + if (gSaveContext.weekEventReg[0x21] & 8) { + Actor_MarkForDeath(&this->actor); + return; + } + this->animationIdx = 0; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + this->flags1 |= 2; + this->actionFunc = func_80BAD5F8; + return; + } else if (globalCtx->sceneNum == SCENE_AYASHIISHOP) { + if (gSaveContext.weekEventReg[0x21] & 8) { + Actor_MarkForDeath(&this->actor); + return; + } + this->animationIdx = 0; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + this->cutscenes[0] = this->actor.cutscene; + this->cutscenes[1] = ActorCutscene_GetAdditionalCutscene(this->cutscenes[0]); + this->flags1 |= 4; + this->actionFunc = func_80BAD7F8; + return; + } else { + this->flags1 |= 8; + this->flags1 |= 0x10; + this->actionFunc = func_80BACA14; + return; + } + Actor_MarkForDeath(&this->actor); +} -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/func_80BAE524.asm") +void func_80BACA14(EnSuttari* this, GlobalContext* globalCtx) { + Player* player = PLAYER; -#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Suttari_0x80BAA6D0/EnSuttari_Draw.asm") + if (this->animationIdx == 1 || this->animationIdx == 8) { + this->animationIdx = 2; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + } + func_80BABA90(this, 0, 0); + func_80BAB434(this); + if (player->transformation == PLAYER_FORM_GORON || player->transformation == PLAYER_FORM_ZORA) { + if (this->actor.yDistToPlayer < 60.0f && this->actor.xzDistToPlayer < 500.0f) { + this->unk3F2 = this->unk2DE; + this->actionFunc = func_80BACBB0; + } + } else if ((player->transformation == PLAYER_FORM_HUMAN) && CUR_EQUIP_VALUE_VOID(EQUIP_SWORD) != 0) { + if (func_800B84D0(&this->actor, globalCtx)) { + this->unk3F2 = this->unk2DE; + func_80BAAB78(this, globalCtx); + this->actionFunc = func_80BADA9C; + } else if (this->actor.xzDistToPlayer < 200.0f) { + func_800B8614(&this->actor, globalCtx, 200.0f); + } + } + Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 0.1f); + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); +} + +void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + s16 target; + + this->unk3F2 = this->unk2DE; + if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU) { + this->actionFunc = func_80BACA14; + } + if ((this->actor.yDistToPlayer < 60.0f) && (this->actor.xzDistToPlayer < 500.0f)) { + if (this->actor.bgCheckFlags & 8) { + target = this->actor.wallYaw; + } else if (func_80BAA904(this, globalCtx)) { + target = -this->actor.world.rot.y; + } else { + target = -this->actor.yawTowardsPlayer; + } + Math_SmoothStepToS(&this->actor.world.rot.y, target, 4, 0x3E8, 1); + this->actor.shape.rot.y = this->actor.world.rot.y; + Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 0.1f); + } else { + this->actionFunc = func_80BACD2C; + this->actor.speedXZ = 0.0f; + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + if (!(this->actor.bgCheckFlags & 1)) { + this->actor.world.pos = this->actor.prevPos; + this->actor.world.rot.y = -this->actor.world.rot.y; + this->actionFunc = func_80BACE4C; + } +} + +void func_80BACD2C(EnSuttari* this, GlobalContext* globalCtx) { + Player* player = PLAYER; + + this->unk3F2 = this->unk2DE; + if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU) { + this->actionFunc = func_80BACA14; + } + if ((this->actor.yDistToPlayer < 60.0f) && (this->actor.xzDistToPlayer < 500.0f)) { + this->actionFunc = func_80BACBB0; + Math_ApproachF(&this->actor.speedXZ, 5.0f, 0.2f, 0.1f); + } else { + Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 4, 0x3E8, 1); + this->actor.shape.rot.y = this->actor.world.rot.y; + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + if (!(this->actor.bgCheckFlags & 1)) { + this->actor.world.pos = this->actor.prevPos; + this->actor.world.rot.y = -this->actor.world.rot.y; + this->actionFunc = func_80BACE4C; + } +} + +void func_80BACE4C(EnSuttari* this, GlobalContext* globalCtx) { + if (this->actor.xzDistToPlayer > 100.0f) { + this->actionFunc = func_80BACBB0; + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + if (this->actor.world.pos.y != this->actor.floorHeight) { + this->actor.world.pos = this->actor.prevPos; + this->actor.world.rot.y = -this->actor.world.rot.y; + this->actor.shape.rot.y = this->actor.world.rot.y; + } +} + +void func_80BACEE0(EnSuttari* this, GlobalContext* globalCtx) { + u32* unk_14 = &gSaveContext.unk_14; + struct_80133038_arg2 unkStruct; + + this->unk42A = REG(15) + *unk_14; + if (!func_80133038(globalCtx, D_80BAE820, &unkStruct) || + ((this->unk428 != unkStruct.unk0) && !func_80BABF64(this, globalCtx, &unkStruct))) { + this->actor.flags &= ~1; + unkStruct.unk0 = 0; + } else { + this->actor.flags |= 1; + } + this->unk428 = unkStruct.unk0; + func_80BAC2FC(this, globalCtx); + func_80BAB434(this); + if (this->unk428 == 5) { + gSaveContext.weekEventReg[0x3A] |= 0x80; + this->actionFunc = func_80BADDB4; + this->actor.speedXZ = 0.0f; + } else if (Player_GetMask(globalCtx) != PLAYER_MASK_STONE_MASK) { + func_80BAB1A0(this, globalCtx); + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); +} + +void func_80BAD004(EnSuttari* this, GlobalContext* globalCtx) { + u32* unk_14 = &gSaveContext.unk_14; + struct_80133038_arg2 unkStruct; + + this->unk42A = REG(15) + *unk_14; + if (!func_80133038(globalCtx, D_80BAE820, &unkStruct) || + ((this->unk428 != unkStruct.unk0) && !func_80BABF64(this, globalCtx, &unkStruct))) { + this->actor.flags &= ~1; + unkStruct.unk0 = 0; + } else { + this->actor.flags |= 1; + } + this->unk428 = unkStruct.unk0; + func_80BAC2FC(this, globalCtx); + if (func_800B84D0(&this->actor, globalCtx)) { + func_801518B0(globalCtx, 0x2A3A, &this->actor); + this->actionFunc = func_80BAD130; + } else if ((this->actor.xzDistToPlayer < 200.0f) || this->actor.isTargeted) { + func_800B863C(&this->actor, globalCtx); + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); +} + +void func_80BAD130(EnSuttari* this, GlobalContext* globalCtx) { + u8 talkState = func_80152498(&globalCtx->msgCtx); + + if ((talkState == 5 || talkState == 6) && func_80147624(globalCtx)) { + globalCtx->msgCtx.unk11F22 = 0x43; + globalCtx->msgCtx.unk12023 = 4; + if (this->flags1 & 8) { + this->actionFunc = func_80BAD004; + } else if (this->flags1 & 4) { + this->actionFunc = func_80BAD7F8; + } else if (this->flags1 & 2) { + this->actionFunc = func_80BAD5F8; + } else if (this->flags1 & 1) { + this->unk3F6 = 20; + this->actionFunc = func_80BADF3C; + } + } + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); +} + +void func_80BAD230(EnSuttari* this, GlobalContext* globalCtx) { + if (ActorCutscene_GetCanPlayNext(this->cutscenes[1])) { + ActorCutscene_Start(this->cutscenes[1], &this->actor); + this->textId = 0x2A31; + func_801518B0(globalCtx, this->textId, &this->actor); + this->flags1 |= 0x4000; + func_801A89A8(0x8003); + this->actionFunc = func_80BAD380; + } else { + ActorCutscene_SetIntentToPlay(this->cutscenes[1]); + } +} + +void func_80BAD2B4(EnSuttari* this, GlobalContext* globalCtx) { + if (func_80152498(&globalCtx->msgCtx) == 5 && func_80147624(globalCtx)) { + if (this->textId == 0x2A30) { + ActorCutscene_Stop(this->cutscenes[0]); + ActorCutscene_SetIntentToPlay(this->cutscenes[1]); + this->actionFunc = func_80BAD230; + } else { + ActorCutscene_Stop(this->cutscenes[1]); + globalCtx->msgCtx.unk11F22 = 0x43; + globalCtx->msgCtx.unk12023 = 4; + this->flags1 |= 0x40; + this->actionFunc = func_80BAD380; + } + } + func_80BAB374(this, globalCtx); +} + +void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx) { + u8 talkState = func_80152498(&globalCtx->msgCtx); + Player* player = PLAYER; + + if ((player->stateFlags1 & 0x40) && (globalCtx->msgCtx.unk11F04 != 0x2A31)) { + this->flags1 |= 0x8000; + this->actor.speedXZ = 0.0f; + } else { + this->flags1 &= ~0x8000; + func_80BABA90(this, 1, 1); + if ((this->flags1 & 0x4000) && (talkState == 5) && func_80147624(globalCtx)) { + this->flags2 &= ~0x10; + player->stateFlags1 &= ~0x10000000; + this->flags1 &= ~0x4000; + ActorCutscene_Stop(this->cutscenes[1]); + globalCtx->msgCtx.unk11F22 = 0x43; + globalCtx->msgCtx.unk12023 = 4; + this->flags1 |= 0x40; + } + if (this->flags1 & 0x100) { + this->flags2 |= 8; + func_80BAAF1C(this); + } else if (this->flags1 & 0x200) { + gSaveContext.weekEventReg[0x4F] |= 0x40; + this->flags2 |= 4; + this->actor.speedXZ = 0.0f; + Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, CLEAR_TAG_SMALL_EXPLOSION); + func_800F0568(globalCtx, &this->actor.world.pos, 30, NA_SE_IT_BOMB_EXPLOSION); + Actor_MarkForDeath(&this->actor); + return; + } + if (this->unk1F4[1] == -0x63) { + if (this->flags2 & 8) { + gSaveContext.weekEventReg[0x21] |= 8; + } + this->actor.speedXZ = 0.0f; + func_801A89A8(0x101400FF); + this->flags2 |= 4; + EnSuttari_SetNextEntrance(globalCtx, 0xD670); + } else { + this->unk3F2 = this->unk2DE; + Math_ApproachF(&this->actor.speedXZ, 4.0f, 0.2f, 0.5f); + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + func_80BAB374(this, globalCtx); + } + } +} + +void func_80BAD5F8(EnSuttari* this, GlobalContext* globalCtx) { + u32* unk_14 = &gSaveContext.unk_14; + struct_80133038_arg2 unkStruct; + s16 curFrame = this->skelAnime.animCurrentFrame; + s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common); + + if ((curFrame == frameCount) && (this->animationIdx == 0) && (this->flags1 & 0x20)) { + this->animationIdx = 2; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + } + this->unk42A = REG(15) + *unk_14; + if (!func_80133038(globalCtx, D_80BAE820, &unkStruct) || + ((this->unk428 != unkStruct.unk0) && !func_80BABF64(this, globalCtx, &unkStruct))) { + this->actor.flags &= ~1; + unkStruct.unk0 = 0; + } else { + this->actor.flags |= 1; + } + this->unk428 = unkStruct.unk0; + func_80BAC2FC(this, globalCtx); + if ((this->unk430 == 1) && (this->unk404->unk1 == 0xFF)) { + Actor_MarkForDeath(&this->actor); + return; + } + func_80BAB434(this); + if ((this->flags1 & 0x20) && (this->unk430 == 0) && (unkStruct.unk0 != 7)) { + if (func_800B84D0(&this->actor, globalCtx)) { + func_801518B0(globalCtx, 0x2A02, &this->actor); + this->actionFunc = func_80BAD130; + } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) { + func_800B863C(&this->actor, globalCtx); + } + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); +} + +void func_80BAD7F8(EnSuttari* this, GlobalContext* globalCtx) { + u32* unk_14 = &gSaveContext.unk_14; + struct_80133038_arg2 unkStruct; + s16 curFrame = this->skelAnime.animCurrentFrame; + s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common); + + if (this->enFsn == NULL) { + this->enFsn = (EnFsn*)EnSuttari_GetActorById(globalCtx, ACTOR_EN_FSN); + } else { + if ((this->flags1 & 0x2000) && (this->animationIdx == 1) && (curFrame == frameCount)) { + this->animationIdx = 2; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + } + this->unk42A = REG(15) + *unk_14; + if (!func_80133038(globalCtx, D_80BAE820, &unkStruct) || + ((this->unk428 != unkStruct.unk0) && !func_80BABF64(this, globalCtx, &unkStruct))) { + this->actor.flags &= ~1; + unkStruct.unk0 = 0; + } else { + this->actor.flags |= 1; + } + this->unk428 = unkStruct.unk0; + func_80BAC2FC(this, globalCtx); + if ((this->unk430 == 1) && (this->unk404->unk1 == 0xFF)) { + Actor_MarkForDeath(&this->actor); + return; + } + if ((this->flags1 & 0x20) && (unkStruct.unk0 != 9)) { + if (func_800B84D0(&this->actor, globalCtx)) { + func_801518B0(globalCtx, 0x2A02, &this->actor); + this->actionFunc = func_80BAD130; + } else if ((this->actor.xzDistToPlayer < 100.0f) || this->actor.isTargeted) { + func_800B863C(&this->actor, globalCtx); + } + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); + } +} + +void func_80BADA08(EnSuttari* this, GlobalContext* globalCtx) { + if (func_800B84D0(&this->actor, globalCtx)) { + this->actor.flags &= ~0x10000; + func_80BAAB78(this, globalCtx); + gSaveContext.weekEventReg[0x51] |= 4; + } else if (this->actor.xzDistToPlayer < 500.0f) { + this->actor.flags |= 0x10000; + func_800B8614(&this->actor, globalCtx, 500.0f); + } +} + +void func_80BADA9C(EnSuttari* this, GlobalContext* globalCtx) { + u8 talkstate = func_80152498(&globalCtx->msgCtx); + s16 curFrame = this->skelAnime.animCurrentFrame; + s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common); + + if (this->flags1 & 1) { + this->unk3F2 = this->unk2DE; + func_80BAA9B4(this); + } else if ((this->animationIdx == 7) && (curFrame == frameCount)) { + this->animationIdx = 1; + func_800BDC5C(&this->skelAnime, sAnimations, this->animationIdx); + } + if (talkstate == 5) { + if (func_80147624(globalCtx)) { + if (this->flags1 & 0x400) { + if (this->textId == 0x29EE) { + ActorCutscene_Stop(this->cutscenes[this->cutsceneIdx]); + } + this->flags1 &= ~0x400; + if (this->flags2 & 1) { + ((EnElf*)PLAYER->tatlActor)->unk264 |= 0x10; + this->flags2 &= ~1; + } + globalCtx->msgCtx.unk11F22 = 0x43; + globalCtx->msgCtx.unk12023 = 4; + this->textId = 0; + if (this->flags1 & 1) { + this->actionFunc = func_80BACA14; + } else { + this->actionFunc = func_80BAD7F8; + } + return; + } + func_80BAAB78(this, globalCtx); + } + } else if ((talkstate == 4) && func_80147624(globalCtx)) { + switch (globalCtx->msgCtx.choiceIndex) { + case 0: + func_8019F208(); + this->flags1 |= 0x800; + func_80BAAB78(this, globalCtx); + break; + case 1: + func_8019F230(); + func_80BAAB78(this, globalCtx); + break; + } + } + if (!(this->flags1 & 4)) { + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, 0x1000, 0x100); + this->actor.world.rot.y = this->actor.shape.rot.y; + } +} + +void func_80BADD0C(EnSuttari* this, GlobalContext* globalCtx) { + if (ActorCutscene_GetCanPlayNext(this->cutscenes[this->cutsceneIdx])) { + if (this->cutsceneIdx == 0) { + ActorCutscene_Start(this->cutscenes[this->cutsceneIdx], &this->enFsn->actor); + } else { + ActorCutscene_Start(this->cutscenes[this->cutsceneIdx], &this->actor); + } + func_80BAAA94(this); + this->actionFunc = func_80BADA9C; + } else { + ActorCutscene_SetIntentToPlay(this->cutscenes[this->cutsceneIdx]); + } +} + +void func_80BADDB4(EnSuttari* this, GlobalContext* globalCtx) { + func_80BABA90(this, 1, 1); + func_80BAB434(this); + if (gSaveContext.weekEventReg[0x33] & 0x10) { + this->actionFunc = func_80BADE14; + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); +} + +void func_80BADE14(EnSuttari* this, GlobalContext* globalCtx) { + func_80BABA90(this, 1, 2); + if (this->unk1F4[1] == -0x63) { + this->actor.speedXZ = 0.0f; + } else { + this->unk3F2 = this->unk2DE; + Math_ApproachF(&this->actor.speedXZ, 6.0f, 0.2f, 0.5f); + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); +} + +void func_80BADE8C(EnSuttari* this, GlobalContext* globalCtx) { + this->unk3F2 = this->unk2DE; + Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xBB8, 0); + if (func_800B84D0(&this->actor, globalCtx)) { + this->actor.flags &= ~0x10000; + func_801518B0(globalCtx, 0x2A3A, &this->actor); + this->actionFunc = func_80BAD130; + } else { + this->actor.flags |= 0x10000; + func_800B8614(&this->actor, globalCtx, 500.0f); + } +} + +void func_80BADF3C(EnSuttari* this, GlobalContext* globalCtx) { + func_80BABB90(this, 0); + if (this->unk1F4[0] == -0x63) { + Actor_MarkForDeath(&this->actor); + } + this->unk3F2 = this->unk2DE; + if (DECR(this->unk3F6) == 0) { + Math_ApproachF(&this->actor.speedXZ, 6.0f, 0.2f, 0.5f); + } + Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); +} + +void EnSuttari_Init(Actor* thisx, GlobalContext* globalCtx) { + EnSuttari* this = THIS; + s32 pad; + + if (gSaveContext.weekEventReg[0x4F] & 0x40) { + Actor_MarkForDeath(&this->actor); + return; + } + Collider_InitCylinder(globalCtx, &this->collider); + Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); + this->actor.flags &= ~1; + EnSuttari_GetPaths(this, globalCtx); + Actor_SetScale(&this->actor, 0.01f); + this->actionFunc = func_80BAC6E8; + this->actor.gravity = -4.0f; +} + +void EnSuttari_Destroy(Actor* thisx, GlobalContext* globalCtx) { + EnSuttari* this = THIS; + + if ((globalCtx->sceneNum == SCENE_BACKTOWN) && !(this->flags2 & 4)) { + func_801A89A8(0x101400FF); + } + Collider_DestroyCylinder(globalCtx, &this->collider); +} + +void EnSuttari_Update(Actor* thisx, GlobalContext* globalCtx) { + EnSuttari* this = THIS; + s32 pad; + Player* player = PLAYER; + + this->actionFunc(this, globalCtx); + if ((this->flags1 & 8) && (this->flags2 & 0x10) && (player->stateFlags1 & 0x10000000)) { + player->actor.freezeTimer = 3; + } + if (!(this->flags1 & 0x8000)) { + func_80BAB4F0(this, globalCtx); + } + if (this->flags2 & 2) { + EnSuttari_UpdateTime(); + } + if (this->unk428 != 0) { + if (this->animationIdx == 2 || this->animationIdx == 6) { + if (func_801378B8(&this->skelAnime, 8.0f) || func_801378B8(&this->skelAnime, 16.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EV_PAMERA_WALK); + } + } else if (this->animationIdx == 0 || this->animationIdx == 5) { + if (func_801378B8(&this->skelAnime, 8.0f) || func_801378B8(&this->skelAnime, 17.0f)) { + Audio_PlayActorSound2(&this->actor, NA_SE_EV_PAMERA_WALK); + } + } + } +} + +s32 EnSuttari_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, + Actor* thisx) { + EnSuttari* this = THIS; + + if (limbIndex == 15) { + *dList = D_0600AF90; + if (!(this->flags1 & 4)) { + SysMatrix_InsertTranslation(1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); + SysMatrix_InsertXRotation_s(this->unk3F2, MTXMODE_APPLY); + SysMatrix_InsertZRotation_s(-this->unk2DC, MTXMODE_APPLY); + SysMatrix_InsertTranslation(-1500.0f, 0.0f, 0.0f, MTXMODE_APPLY); + } + } + if (limbIndex == 8) { + SysMatrix_InsertXRotation_s(-this->unk2E4, MTXMODE_APPLY); + SysMatrix_InsertZRotation_s(-this->unk2E2, MTXMODE_APPLY); + } + if (limbIndex == 8 || limbIndex == 9 || limbIndex == 0xC) { + rot->y += (s16)(Math_SinS(this->unk2FA[limbIndex]) * 200.0f); + rot->z += (s16)(Math_CosS(this->unk31A[limbIndex]) * 200.0f); + } + return false; +} + +void EnSuttari_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) { + static Vec3f D_80BAE950 = { 0.0f, 0.0f, 0.0f }; + static Vec3f D_80BAE95C = { 2000.0f, -1000.0f, 0.0f }; + EnSuttari* this = THIS; + s32 pad; + MtxF* curState; + Actor* bombBag; + + if (((this->flags1 & 8) && (this->flags1 & 0x10)) || ((this->flags1 & 2) && !(this->flags1 & 0x20)) || + ((this->flags1 & 4) && !(this->flags1 & 0x20))) { + if (limbIndex == 8) { + curState = SysMatrix_GetCurrentState(); + SysMatrix_MultiplyVector3fByState(&D_80BAE95C, &this->unk3F8); + if (this->actor.child == NULL) { + if (this->flags1 & 0x100) { + bombBag = + Actor_SpawnWithParent(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_NIMOTSU, + curState->mf[3][0], curState->mf[3][1], curState->mf[3][2], 0, 0, 0, -1); + if (bombBag != NULL) { + func_8018219C(curState, &bombBag->shape.rot, 0); + } + } else { + func_8012C28C(globalCtx->state.gfxCtx); + OPEN_DISPS(globalCtx->state.gfxCtx); + gSPDisplayList(POLY_OPA_DISP++, D_06013380); + CLOSE_DISPS(globalCtx->state.gfxCtx); + } + } + } + } + if (limbIndex == 15) { + SysMatrix_MultiplyVector3fByState(&D_80BAE950, &this->actor.focus.pos); + } +} + +void EnSuttari_UnkDraw(GlobalContext* globalCtx, s32 limbIndex, Actor* thisx) { +} + +void EnSuttari_Draw(Actor* thisx, GlobalContext* globalCtx) { + EnSuttari* this = THIS; + s32 pad; + Vec3f sp5C; + Vec3f sp50; + + if (this->flags1 & 0x80) { + OPEN_DISPS(globalCtx->state.gfxCtx); + func_8012C28C(globalCtx->state.gfxCtx); + gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_EnvColor(globalCtx->state.gfxCtx, 255, 255, 255, 0)); + gSPSegment(POLY_OPA_DISP++, 0x09, Gfx_EnvColor(globalCtx->state.gfxCtx, 55, 55, 255, 0)); + gDPPipeSync(POLY_OPA_DISP++); + func_801343C0(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, this->skelAnime.dListCount, + EnSuttari_OverrideLimbDraw, EnSuttari_PostLimbDraw, EnSuttari_UnkDraw, &this->actor); + if (this->flags1 & 0x80) { + func_8012C2DC(globalCtx->state.gfxCtx); + sp5C = this->actor.world.pos; + sp50.x = 0.2f; + sp50.y = 0.2f; + sp50.z = 0.2f; + func_800BC620(&sp5C, &sp50, 0xFF, globalCtx); + } + CLOSE_DISPS(globalCtx->state.gfxCtx); + } +} diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h index 16b58369fe..061ed49f6f 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.h @@ -2,12 +2,68 @@ #define Z_EN_SUTTARI_H #include +#include "overlays/actors/ovl_En_Fsn/z_en_fsn.h" struct EnSuttari; +typedef void (*EnSuttariActionFunc)(struct EnSuttari*, GlobalContext*); + +#define ENSUTTARI_GET_PATH(thisx) (((thisx)->params & 0x7E00) >> 9) + typedef struct EnSuttari { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x318]; + /* 0x144 */ EnFsn* enFsn; + /* 0x148 */ EnSuttariActionFunc actionFunc; + /* 0x14C */ UNK_TYPE1 unk_14C[0x4]; + /* 0x150 */ SkelAnime skelAnime; + /* 0x194 */ UNK_TYPE1 unk_194[0x4]; + /* 0x198 */ ColliderCylinder collider; + /* 0x1E4 */ u16 flags1; + /* 0x1E6 */ u16 flags2; + /* 0x1E8 */ u16 textId; + /* 0x1EA */ UNK_TYPE1 unk_1EA[0x2]; + /* 0x1EC */ Path* paths[2]; + /* 0x1F4 */ s32 unk1F4[2]; + /* 0x1FC */ UNK_TYPE1 unk_1FC[0x1A]; + /* 0x216 */ Vec3s jointTable[16]; + /* 0x276 */ Vec3s morphTable[16]; + /* 0x2D6 */ s16 unk2D6; + /* 0x2D8 */ s16 unk2D8; + /* 0x2DA */ UNK_TYPE1 unk_2DA[0x2]; + /* 0x2DC */ s16 unk2DC; + /* 0x2DE */ s16 unk2DE; + /* 0x2E0 */ UNK_TYPE1 unk_2E0[0x2]; + /* 0x2E2 */ s16 unk2E2; + /* 0x2E4 */ s16 unk2E4; + /* 0x2E6 */ UNK_TYPE1 unk_2E6[0x14]; + /* 0x2FA */ s16 unk2FA[16]; + /* 0x31A */ s16 unk31A[16]; + /* 0x33A */ UNK_TYPE1 unk_33A[0xB6]; + /* 0x3F0 */ s16 unk3F0; + /* 0x3F2 */ s16 unk3F2; + /* 0x3F4 */ s16 unk3F4; + /* 0x3F6 */ s16 unk3F6; + /* 0x3F8 */ Vec3f unk3F8; + /* 0x404 */ Path* unk404; + /* 0x408 */ Vec3f unk408; + /* 0x414 */ s32 unk414; + /* 0x418 */ s32 unk418; + /* 0x41C */ s32 unk41C; + /* 0x420 */ s32 unk420; + /* 0x424 */ s32 unk424; + /* 0x428 */ u8 unk428; + /* 0x429 */ UNK_TYPE1 unk_429[0x1]; + /* 0x42A */ s16 unk42A; + /* 0x42C */ s32 unk42C; + /* 0x430 */ s32 unk430; + /* 0x434 */ s16 unk434; + /* 0x436 */ s16 unk436; + /* 0x438 */ Vec3f unk438; + /* 0x444 */ Vec3f unk444; + /* 0x450 */ s32 animationIdx; + /* 0x454 */ UNK_TYPE1 unk_454[0x2]; + /* 0x456 */ s16 cutscenes[2]; + /* 0x45A */ s16 cutsceneIdx; } EnSuttari; // size = 0x45C extern const ActorInit En_Suttari_InitVars; diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index 4de89490a4..e596066c72 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -465,7 +465,7 @@ s32 func_80BA4204(EnToto* this, GlobalContext* globalCtx) { if (DECR(this->unk2B1) == 0) { if (!ENTOTO_WEEK_EVENT_FLAGS) { temp_v1_2 = &D_80BA50DC[gSaveContext.playerForm - 1]; - func_801518B0(globalCtx, (this->text->unk0 == 6 ? temp_v1_2->unk0 : temp_v1_2->unk4), NULL); + func_801518B0(globalCtx, (this->text->unk0 == 6) ? temp_v1_2->unk0 : temp_v1_2->unk4, NULL); } return 1; } diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 36e49d43b2..5a347da46e 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -485,7 +485,7 @@ void EnWeatherTag_Update(Actor* thisx, GlobalContext* globalCtx) { gSaveContext.time = (u16)REG(0xF) + oldTime; // cast req if (REG(0xF) != 0) { oldTime = gSaveContext.time; - gSaveContext.time = (gSaveContext.unk_16) + oldTime; + gSaveContext.time = (u16)gSaveContext.unk_14 + oldTime; } } } diff --git a/tables/functions.txt b/tables/functions.txt index ca8fa5777f..da6a25bcc1 100644 --- a/tables/functions.txt +++ b/tables/functions.txt @@ -15209,10 +15209,10 @@ 0x80BAA198:("func_80BAA198",), 0x80BAA20C:("func_80BAA20C",), 0x80BAA220:("EnBaba_Draw",), - 0x80BAA6D0:("func_80BAA6D0",), - 0x80BAA848:("func_80BAA848",), - 0x80BAA88C:("func_80BAA88C",), - 0x80BAA8D0:("func_80BAA8D0",), + 0x80BAA6D0:("EnSuttari_UpdateCollider",), + 0x80BAA848:("EnSuttari_GetActorById",), + 0x80BAA88C:("EnSuttari_SetNextEntrance",), + 0x80BAA8D0:("EnSuttari_UpdateTime",), 0x80BAA904:("func_80BAA904",), 0x80BAA9B4:("func_80BAA9B4",), 0x80BAAA94:("func_80BAAA94",), @@ -15222,7 +15222,7 @@ 0x80BAB1A0:("func_80BAB1A0",), 0x80BAB374:("func_80BAB374",), 0x80BAB434:("func_80BAB434",), - 0x80BAB490:("func_80BAB490",), + 0x80BAB490:("EnSuttari_GetPaths",), 0x80BAB4F0:("func_80BAB4F0",), 0x80BAB698:("func_80BAB698",), 0x80BAB758:("func_80BAB758",), @@ -15258,9 +15258,9 @@ 0x80BADFD0:("EnSuttari_Init",), 0x80BAE0A0:("EnSuttari_Destroy",), 0x80BAE108:("EnSuttari_Update",), - 0x80BAE250:("func_80BAE250",), - 0x80BAE3C4:("func_80BAE3C4",), - 0x80BAE524:("func_80BAE524",), + 0x80BAE250:("EnSuttari_OverrideLimbDraw",), + 0x80BAE3C4:("EnSuttari_PostLimbDraw",), + 0x80BAE524:("EnSuttari_UnkDraw",), 0x80BAE538:("EnSuttari_Draw",), 0x80BAEF70:("EnZod_Init",), 0x80BAF1C0:("EnZod_Destroy",), diff --git a/tables/variables.txt b/tables/variables.txt index b5d80f19b1..2ab696c2d7 100644 --- a/tables/variables.txt +++ b/tables/variables.txt @@ -17265,10 +17265,10 @@ 0x80BAA524:("enBabaOverlayRelocations","u32","[106]",0x1a8), 0x80BAA6CC:("enBabaOverlayInfoOffset","u32","",0x4), 0x80BAE6B0:("En_Suttari_InitVars","UNK_TYPE1","",0x1), - 0x80BAE6D0:("D_80BAE6D0","UNK_TYPE4","",0x4), - 0x80BAE7A8:("D_80BAE7A8","UNK_TYPE1","",0x1), - 0x80BAE7D4:("D_80BAE7D4","UNK_TYPE1","",0x1), - 0x80BAE7E0:("D_80BAE7E0","UNK_TYPE1","",0x1), + 0x80BAE6D0:("sAnimations","UNK_TYPE4","",0x4), + 0x80BAE7A8:("sCylinderInit","UNK_TYPE1","",0x1), + 0x80BAE7D4:("sColChkInfoInit2","UNK_TYPE1","",0x1), + 0x80BAE7E0:("sDamageTable","UNK_TYPE1","",0x1), 0x80BAE800:("D_80BAE800","UNK_TYPE1","",0x1), 0x80BAE820:("D_80BAE820","UNK_TYPE1","",0x1), 0x80BAE8F8:("D_80BAE8F8","UNK_TYPE1","",0x1),