From 71c0120fbd7191a6c543b547946573a347bad749 Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Sat, 19 Feb 2022 15:49:36 -0800 Subject: [PATCH] SubS Cutscenes, Flags, Objects, and Angles (#665) * Bring cutscene code over * Document cutscene functions * Bring over flags code * Document flags * Bring Object code over * Document object functions * Better infinite loop comment * Remove Effect_add correction * Bring func_8013D5E8 code over * Document angle helper * ActorFixer * Rename angle helper * Missed gs * Should probably test before commiting * Better angle helper name as well as typo fix * English is hard * Len to num * Fix merge * Fix merge * Format Co-authored-by: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> --- include/functions.h | 14 ++-- include/z64.h | 7 ++ src/code/z_en_hy_code.c | 8 +-- src/code/z_sub_s.c | 69 ++++++++++++++++--- .../ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c | 4 +- .../actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c | 4 +- src/overlays/actors/ovl_En_Al/z_en_al.c | 12 ++-- .../actors/ovl_En_Aob_01/z_en_aob_01.c | 2 +- src/overlays/actors/ovl_En_Baba/z_en_baba.c | 3 +- .../actors/ovl_En_Bba_01/z_en_bba_01.c | 10 +-- .../actors/ovl_En_Bji_01/z_en_bji_01.c | 3 +- .../actors/ovl_En_Cne_01/z_en_cne_01.c | 10 +-- src/overlays/actors/ovl_En_Dai/z_en_dai.c | 6 +- src/overlays/actors/ovl_En_Dnk/z_en_dnk.c | 8 +-- src/overlays/actors/ovl_En_Dnp/z_en_dnp.c | 16 ++--- src/overlays/actors/ovl_En_Dnq/z_en_dnq.c | 14 ++-- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 12 ++-- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 28 ++++---- src/overlays/actors/ovl_En_Go/z_en_go.c | 42 +++++------ src/overlays/actors/ovl_En_Gs/z_en_gs.c | 8 +-- src/overlays/actors/ovl_En_Gs/z_en_gs.h | 3 +- src/overlays/actors/ovl_En_Ig/z_en_ig.c | 14 ++-- src/overlays/actors/ovl_En_In/z_en_in.c | 2 +- src/overlays/actors/ovl_En_Ja/z_en_ja.c | 10 +-- src/overlays/actors/ovl_En_Ot/z_en_ot.c | 12 ++-- src/overlays/actors/ovl_En_Pm/z_en_pm.c | 22 +++--- src/overlays/actors/ovl_En_Rg/z_en_rg.c | 2 +- .../actors/ovl_En_Suttari/z_en_suttari.c | 2 +- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 11 +-- src/overlays/actors/ovl_En_Tru/z_en_tru.c | 18 ++--- src/overlays/actors/ovl_En_Zo/z_en_zo.c | 2 +- tools/actorfixer.py | 6 ++ tools/disasm/functions.txt | 12 ++-- tools/sizes/code_functions.csv | 12 ++-- 34 files changed, 237 insertions(+), 171 deletions(-) diff --git a/include/functions.h b/include/functions.h index c12a4cc37c..ba72e093fe 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2494,7 +2494,7 @@ Gfx* SubS_DrawTransformFlexLimb(GlobalContext* globalCtx, s32 idx, void** skelet Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, s32 dListCount, OverrideLimbDraw overrideLimbDraw, PostLimbDraw postLimbDraw, TransformLimbDraw transformLimbDraw, Actor* actor, Gfx* gfx); s32 func_8013AD6C(GlobalContext* globalCtx); s32 func_8013AD9C(s16 arg0, s16 arg1, Vec3f* arg2, Vec3s* arg3, s32 arg4, s32 arg5); -void func_8013AED4(u16* arg0, u16 arg1, u16 arg2); +void SubS_UpdateFlags(u16* flags, u16 setBits, u16 unsetBits); void func_8013AF00(f32* arg0, s32 arg1, s32 arg2); s32 func_8013B010(f32* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, f32* arg6); void func_8013B0C8(s32 arg0, f32 arg1, s32 arg2, f32* arg3, f32* arg4); @@ -2515,16 +2515,16 @@ void func_8013CD64(Vec3f* arg0, Vec3f* arg1, u8* arg2, f32 arg3, u8 arg4, u8* ar void func_8013CF04(Actor* actor, GraphicsContext** gfxCtxPtr, u8* arg2); s16 func_8013D0E0(s16* arg0, s16 arg1, s16 arg2, f32 arg3, f32 arg4, f32 arg5); s32 func_8013D2E0(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, Vec3s* arg3, Vec3s* arg4, Vec3s* arg5, u16* arg6); -s32 func_8013D5E8(s16 arg0, s16 arg1, s16 arg2); +s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB); Path* func_8013D648(GlobalContext* globalCtx, s16 arg1, s16 arg2); s32 func_8013D68C(Path* path, s32 arg1, Vec3f* arg2); s16 func_8013D720(Vec3f* arg0, Vec3f* arg1, f32* arg2); s32 func_8013D768(Actor* actor, Vec3f* arg1, s16 arg2); s16 func_8013D83C(Path* path, s32 pointIdx, Vec3f* pos, f32* distSq); -s8 func_8013D8DC(s8 arg0, GlobalContext* globalCtx); -s8 func_8013D924(s16 arg0, GlobalContext* globalCtx); +s8 SubS_IsObjectLoaded(s8 index, GlobalContext* globalCtx); +s8 SubS_GetObjectIndex(s16 id, GlobalContext* globalCtx); Actor* SubS_FindActor(GlobalContext* globalCtx, Actor* actorListStart, u8 actorCategory, s16 actorId); -s32 SubS_FillLimbRotTables(GlobalContext* globalCtx, s16* limbRotTableY, s16* limbRotTableZ, s32 limbRotTableLen); +s32 SubS_FillLimbRotTables(GlobalContext* globalCtx, s16* limbRotTableY, s16* limbRotTableZ, s32 numLimbs); s32 func_8013DB90(GlobalContext* globalCtx, Vec3f* arg1, f32 arg2); s32 func_8013DC40(Path* arg0, s32 arg1, s32 arg2, Vec3f* arg3); void func_8013DCE0(GlobalContext* globalCtx, Vec3f* arg1, Actor* arg2, struct_8013DF3C_arg1* arg3, Path* arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8, u8 arg9); @@ -2534,8 +2534,8 @@ s32 func_8013E054(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1); s32 func_8013E07C(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1); s32 func_8013E0A4(GlobalContext* globalCtx, struct_8013DF3C_arg1* arg1); void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* animations, s32 nextIndex, s32* curIndex); -s32 func_8013E2D4(Actor* actor, s16 arg1, s16 arg2, s32 arg3); -s32 func_8013E3B8(Actor* actor, s16 cutscenes[], s16 len); +s32 SubS_StartActorCutscene(Actor* actor, s16 nextCutscene, s16 curCutscene, s32 type); +s32 SubS_FillCutscenesList(Actor* actor, s16 cutscenes[], s16 numCutscenes); void func_8013E4B0(Vec3f* arg0, Vec3f* arg1, Vec3s* arg2, Plane* plane); s32 func_8013E5CC(Vec3f* arg0, Vec3s* arg1, Vec3f* arg2, Vec3f* arg3, Vec3f* arg4, Vec3f* arg5); Actor* SubS_FindActorCustom(GlobalContext* globalCtx, Actor* actor, Actor* actorListStart, u8 actorCategory, s16 actorId, void* verifyData, VerifyActor verifyActor); diff --git a/include/z64.h b/include/z64.h index 1daaeb30fd..610b03d139 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1381,6 +1381,13 @@ typedef struct { /* 0x8 */ s32 unk8; // game script pointer? } struct_80133038_arg2; // size = 0xC + +typedef enum { + /* 0 */ SUBS_CUTSCENE_SET_UNK_LINK_FIELDS, + /* 1 */ SUBS_CUTSCENE_NORMAL, + /* 2 */ SUBS_CUTSCENE_SET_FLAG +} SubSCutsceneType; + typedef s32 (*func_8013E748_arg6)(struct GlobalContext*, Actor*, Vec3s*); typedef s32 (*VerifyActor)(struct GlobalContext*, Actor*, Actor*, void*); diff --git a/src/code/z_en_hy_code.c b/src/code/z_en_hy_code.c index 7b17f78f2e..b803b291ce 100644 --- a/src/code/z_en_hy_code.c +++ b/src/code/z_en_hy_code.c @@ -112,10 +112,10 @@ void EnHy_Blink(EnHy* enHy, s32 eyeTexMaxIndex) { s32 EnHy_Init(EnHy* enHy, GlobalContext* globalCtx, FlexSkeletonHeader* skeletonHeaderSeg, s16 animIndex) { s32 isInitialized = false; - if ((func_8013D8DC(enHy->animObjIndex, globalCtx) == true) && - (func_8013D8DC(enHy->headObjIndex, globalCtx) == true) && - (func_8013D8DC(enHy->skelUpperObjIndex, globalCtx) == true) && - (func_8013D8DC(enHy->skelLowerObjIndex, globalCtx) == true)) { + if ((SubS_IsObjectLoaded(enHy->animObjIndex, globalCtx) == true) && + (SubS_IsObjectLoaded(enHy->headObjIndex, globalCtx) == true) && + (SubS_IsObjectLoaded(enHy->skelUpperObjIndex, globalCtx) == true) && + (SubS_IsObjectLoaded(enHy->skelLowerObjIndex, globalCtx) == true)) { enHy->actor.objBankIndex = enHy->skelLowerObjIndex; isInitialized = true; ActorShape_Init(&enHy->actor.shape, 0.0f, NULL, 0.0f); diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index 2ce355d472..eda9731259 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -154,7 +154,9 @@ Gfx* SubS_DrawTransformFlex(GlobalContext* globalCtx, void** skeleton, Vec3s* jo #pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013AD9C.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013AED4.s") +void SubS_UpdateFlags(u16* flags, u16 setBits, u16 unsetBits) { + *flags = (*flags & ~unsetBits) | setBits; +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013AF00.s") @@ -248,7 +250,9 @@ s32 SubS_ChangeAnimationByInfoS(SkelAnime* skelAnime, AnimationInfoS* animations #pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D2E0.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D5E8.s") +s32 SubS_AngleDiffLessEqual(s16 angleA, s16 threshold, s16 angleB) { + return (ABS_ALT(BINANG_SUB(angleB, angleA)) <= threshold) ? true : false; +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D648.s") @@ -260,9 +264,13 @@ s32 SubS_ChangeAnimationByInfoS(SkelAnime* skelAnime, AnimationInfoS* animations #pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D83C.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D8DC.s") +s8 SubS_IsObjectLoaded(s8 index, GlobalContext* globalCtx) { + return !Object_IsLoaded(&globalCtx->objectCtx, index) ? false : true; +} -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013D924.s") +s8 SubS_GetObjectIndex(s16 id, GlobalContext* globalCtx) { + return Object_GetIndex(&globalCtx->objectCtx, id); +} /** * Finds the first actor instance of a specified Id and category. @@ -281,11 +289,11 @@ Actor* SubS_FindActor(GlobalContext* globalCtx, Actor* actorListStart, u8 actorC return actor; } -s32 SubS_FillLimbRotTables(GlobalContext* globalCtx, s16* limbRotTableY, s16* limbRotTableZ, s32 limbRotTableLen) { +s32 SubS_FillLimbRotTables(GlobalContext* globalCtx, s16* limbRotTableY, s16* limbRotTableZ, s32 numLimbs) { s32 i; u32 frames = globalCtx->gameplayFrames; - for (i = 0; i < limbRotTableLen; i++) { + for (i = 0; i < numLimbs; i++) { limbRotTableY[i] = (i * 50 + 0x814) * frames; limbRotTableZ[i] = (i * 50 + 0x940) * frames; } @@ -340,9 +348,54 @@ void SubS_ChangeAnimationBySpeedInfo(SkelAnime* skelAnime, AnimationSpeedInfo* a *curIndex = nextIndex; } -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E2D4.s") +s32 SubS_StartActorCutscene(Actor* actor, s16 nextCutscene, s16 curCutscene, s32 type) { + s32 isStarted = false; -#pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E3B8.s") + if ((curCutscene != -1) && (ActorCutscene_GetCurrentIndex() == curCutscene)) { + ActorCutscene_Stop(curCutscene); + ActorCutscene_SetIntentToPlay(nextCutscene); + } else if (ActorCutscene_GetCanPlayNext(nextCutscene)) { + switch (type) { + case SUBS_CUTSCENE_SET_UNK_LINK_FIELDS: + ActorCutscene_StartAndSetUnkLinkFields(nextCutscene, actor); + break; + case SUBS_CUTSCENE_NORMAL: + ActorCutscene_Start(nextCutscene, actor); + break; + case SUBS_CUTSCENE_SET_FLAG: + ActorCutscene_StartAndSetFlag(nextCutscene, actor); + break; + } + isStarted = true; + } else { + ActorCutscene_SetIntentToPlay(nextCutscene); + } + + return isStarted; +} + +s32 SubS_FillCutscenesList(Actor* actor, s16 cutscenes[], s16 numCutscenes) { + s16 cs; + s32 i; + + for (i = 0; i < numCutscenes; i++) { + cutscenes[i] = -1; + } + + cs = actor->cutscene; + i = 0; + + while (cs != -1) { + // Note: Infinite loop if numCutscenes is less than possible additional cutscenes + if (i < numCutscenes) { + cutscenes[i] = cs; + cs = ActorCutscene_GetAdditionalCutscene(cs); + i++; + } + } + + return i; +} #pragma GLOBAL_ASM("asm/non_matchings/code/z_sub_s/func_8013E4B0.s") diff --git a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c index b241ae6b9a..3a12f286d1 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Movebg/z_bg_dblue_movebg.c @@ -196,7 +196,7 @@ void BgDblueMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_168 = D_80A2B8DC[this->unk_160]; this->unk_16C = D_80A2B93C[this->unk_160]; - func_8013E3B8(&this->dyna.actor, this->unk_1B6, ARRAY_COUNT(this->unk_1B6)); + SubS_FillCutscenesList(&this->dyna.actor, this->unk_1B6, ARRAY_COUNT(this->unk_1B6)); switch (this->unk_160) { case 1: @@ -723,7 +723,7 @@ void BgDblueMovebg_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); if (this->unk_172 & 8) { - if (func_8013E2D4(&this->dyna.actor, this->unk_1D2, -1, 0)) { + if (SubS_StartActorCutscene(&this->dyna.actor, this->unk_1D2, -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { this->unk_172 &= ~8; } } diff --git a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c index 06ac0520f8..7cb4aab5e2 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c +++ b/src/overlays/actors/ovl_Bg_Haka_Tomb/z_bg_haka_tomb.c @@ -47,7 +47,7 @@ void BgHakaTomb_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, 1); DynaPolyActor_LoadMesh(globalCtx, &this->dyna, &object_haka_obj_Colheader_000EE8); - func_8013E3B8(&this->dyna.actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + SubS_FillCutscenesList(&this->dyna.actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); func_80BD6624(this); } @@ -100,7 +100,7 @@ void func_80BD6754(BgHakaTomb* this) { } void func_80BD6768(BgHakaTomb* this, GlobalContext* globalCtx) { - if (func_8013E2D4(&this->dyna.actor, this->cutscenes[0], -1, 0)) { + if (SubS_StartActorCutscene(&this->dyna.actor, this->cutscenes[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { BgHakaTomb_SetupDoNothing(this); } } diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c index a984af2fa4..6d1d65db26 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -473,7 +473,7 @@ s32 func_80BDEC2C(EnAl* this, GlobalContext* globalCtx) { this->unk_4C2 |= 0x1000; this->unk_4F4 = player->exchangeItemId; } - func_8013AED4(&this->unk_4C2, 0, 7); + SubS_UpdateFlags(&this->unk_4C2, 0, 7); this->unk_4E6 = 0; this->unk_4EC = 0; this->actor.child = this->unk_368; @@ -629,7 +629,7 @@ s32 func_80BDF244(EnAl* this, GlobalContext* globalCtx, struct_80133038_arg2* ar if ((sp20 != NULL) && (sp20->update != NULL) && (temp_v0 != NULL) && (temp_v0->update != NULL)) { func_80BDE27C(this, 0); - func_8013AED4(&this->unk_4C2, 3, 7); + SubS_UpdateFlags(&this->unk_4C2, 3, 7); this->unk_368 = sp20; this->unk_4C2 |= 0x20; ret = true; @@ -638,7 +638,7 @@ s32 func_80BDF244(EnAl* this, GlobalContext* globalCtx, struct_80133038_arg2* ar } s32 func_80BDF308(EnAl* this, GlobalContext* globalCtx, struct_80133038_arg2* arg2) { - func_8013AED4(&this->unk_4C2, 3, 7); + SubS_UpdateFlags(&this->unk_4C2, 3, 7); switch (arg2->unk0) { case 1: @@ -708,9 +708,9 @@ void func_80BDF414(EnAl* this, GlobalContext* globalCtx) { temp_v0 = this->actor.world.rot.y - this->actor.yawTowardsPlayer; if (((this->unk_4EA == 0) && (ABS_ALT(temp_v0) >= 0x5800)) || ((this->unk_4EA == 5) && (ABS_ALT(temp_v0) >= 0x5800)) || (this->unk_4EA == 2)) { - func_8013AED4(&this->unk_4C2, 3, 7); + SubS_UpdateFlags(&this->unk_4C2, 3, 7); } else { - func_8013AED4(&this->unk_4C2, 0, 7); + SubS_UpdateFlags(&this->unk_4C2, 0, 7); } } @@ -753,7 +753,7 @@ void func_80BDF5E8(EnAl* this, GlobalContext* globalCtx) { void func_80BDF6C4(EnAl* this, GlobalContext* globalCtx) { if (func_8010BF58(&this->actor, globalCtx, this->unk_360, this->unk_4EC, &this->unk_364)) { - func_8013AED4(&this->unk_4C2, 3, 7); + SubS_UpdateFlags(&this->unk_4C2, 3, 7); this->unk_4C2 &= ~0x20; this->unk_4C2 |= 0x200; this->actor.child = NULL; diff --git a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c index 89ed13d962..e3e9b35ff3 100644 --- a/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c +++ b/src/overlays/actors/ovl_En_Aob_01/z_en_aob_01.c @@ -471,7 +471,7 @@ void func_809C1EC8(EnAob01* this, GlobalContext* globalCtx) { Vec3f sp30; SkelAnime_Update(&this->skelAnime); - if (func_8013D5E8(this->actor.shape.rot.y, 14000, this->actor.yawTowardsPlayer)) { + if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer)) { sp30.x = player->actor.world.pos.x; sp30.y = player->bodyPartsPos[7].y + 3.0f; sp30.z = player->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Baba/z_en_baba.c b/src/overlays/actors/ovl_En_Baba/z_en_baba.c index 149bd29aec..1afcf51093 100644 --- a/src/overlays/actors/ovl_En_Baba/z_en_baba.c +++ b/src/overlays/actors/ovl_En_Baba/z_en_baba.c @@ -281,7 +281,8 @@ void func_80BA8DF4(EnBaba* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); - if (func_8013D5E8(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer) && !(this->unk_40A & 4)) { + if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer) && + !(this->unk_40A & 4)) { sp30.x = player->actor.world.pos.x; sp30.y = player->bodyPartsPos[7].y + 3.0f; sp30.z = player->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c index 5df543b06f..092595bdc1 100644 --- a/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c +++ b/src/overlays/actors/ovl_En_Bba_01/z_en_bba_01.c @@ -104,7 +104,7 @@ void EnBba01_UpdateModel(EnBba01* this, GlobalContext* globalCtx) { Vec3f focus; EnHy_UpdateSkelAnime(&this->enHy, globalCtx); - if (func_8013D5E8(this->enHy.actor.shape.rot.y, 0x36B0, this->enHy.actor.yawTowardsPlayer)) { + if (SubS_AngleDiffLessEqual(this->enHy.actor.shape.rot.y, 0x36B0, this->enHy.actor.yawTowardsPlayer)) { focus.x = player->actor.world.pos.x; focus.y = player->bodyPartsPos[7].y + 3.0f; focus.z = player->actor.world.pos.z; @@ -206,10 +206,10 @@ void EnBba01_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnBba01* this = THIS; - this->enHy.animObjIndex = func_8013D924(OBJECT_BBA, globalCtx); - this->enHy.headObjIndex = func_8013D924(OBJECT_BBA, globalCtx); - this->enHy.skelUpperObjIndex = func_8013D924(OBJECT_BBA, globalCtx); - this->enHy.skelLowerObjIndex = func_8013D924(OBJECT_BBA, globalCtx); + this->enHy.animObjIndex = SubS_GetObjectIndex(OBJECT_BBA, globalCtx); + this->enHy.headObjIndex = SubS_GetObjectIndex(OBJECT_BBA, globalCtx); + this->enHy.skelUpperObjIndex = SubS_GetObjectIndex(OBJECT_BBA, globalCtx); + this->enHy.skelLowerObjIndex = SubS_GetObjectIndex(OBJECT_BBA, globalCtx); if ((this->enHy.animObjIndex < 0) || (this->enHy.headObjIndex < 0) || (this->enHy.skelUpperObjIndex < 0) || (this->enHy.skelLowerObjIndex < 0)) { diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index 42e50ea62e..fd6c8aae7e 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -341,8 +341,7 @@ void EnBji01_Init(Actor* thisx, GlobalContext* globalCtx) { this->animationIndex = -1; Actor_SetScale(&this->actor, 0.01f); - func_8013E3B8(&this->actor, this->cutscenes, - ARRAY_COUNT(this->cutscenes)); /* initializes all elements of cutscenes to -1 */ + SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); this->moonsTear = (ObjMoonStone*)SubS_FindActor(globalCtx, NULL, ACTORCAT_PROP, ACTOR_OBJ_MOON_STONE); switch (gSaveContext.entranceIndex) { diff --git a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c index 9e4ae11597..1d61df5bc8 100644 --- a/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c +++ b/src/overlays/actors/ovl_En_Cne_01/z_en_cne_01.c @@ -96,7 +96,7 @@ void EnCne01_UpdateModel(EnCne01* this, GlobalContext* globalCtx) { Vec3f focus; EnHy_UpdateSkelAnime(&this->enHy, globalCtx); - if (func_8013D5E8(this->enHy.actor.shape.rot.y, 0x36B0, this->enHy.actor.yawTowardsPlayer)) { + if (SubS_AngleDiffLessEqual(this->enHy.actor.shape.rot.y, 0x36B0, this->enHy.actor.yawTowardsPlayer)) { focus.x = player->actor.world.pos.x; focus.y = player->bodyPartsPos[7].y + 3.0f; focus.z = player->actor.world.pos.z; @@ -196,10 +196,10 @@ void EnCne01_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnCne01* this = THIS; - this->enHy.animObjIndex = func_8013D924(OBJECT_OS_ANIME, globalCtx); - this->enHy.headObjIndex = func_8013D924(OBJECT_CNE, globalCtx); - this->enHy.skelUpperObjIndex = func_8013D924(OBJECT_CNE, globalCtx); - this->enHy.skelLowerObjIndex = func_8013D924(OBJECT_CNE, globalCtx); + this->enHy.animObjIndex = SubS_GetObjectIndex(OBJECT_OS_ANIME, globalCtx); + this->enHy.headObjIndex = SubS_GetObjectIndex(OBJECT_CNE, globalCtx); + this->enHy.skelUpperObjIndex = SubS_GetObjectIndex(OBJECT_CNE, globalCtx); + this->enHy.skelLowerObjIndex = SubS_GetObjectIndex(OBJECT_CNE, globalCtx); if ((this->enHy.animObjIndex < 0) || (this->enHy.headObjIndex < 0) || (this->enHy.skelUpperObjIndex < 0) || (this->enHy.skelLowerObjIndex < 0)) { diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 5bc75eb8f4..82562d45ca 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -206,7 +206,7 @@ s32 func_80B3E7C8(EnDai* this, GlobalContext* globalCtx) { if (this->unk_1CE & 7) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_8013AED4(&this->unk_1CE, 0, 7); + SubS_UpdateFlags(&this->unk_1CE, 0, 7); this->actionFunc = func_80B3EF90; ret = true; } @@ -428,7 +428,7 @@ void func_80B3EEDC(EnDai* this, GlobalContext* globalCtx) { void func_80B3EF90(EnDai* this, GlobalContext* globalCtx) { if (func_8010BF58(&this->actor, globalCtx, D_80B3FC8C, NULL, &this->unk_1D0)) { - func_8013AED4(&this->unk_1CE, 3, 7); + SubS_UpdateFlags(&this->unk_1CE, 3, 7); this->unk_1D0 = 0; this->actionFunc = func_80B3F00C; } else { @@ -527,7 +527,7 @@ void EnDai_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1D6 = 0; if (gSaveContext.weekEventReg[33] & 0x80) { - func_8013AED4(&this->unk_1CE, 3, 7); + SubS_UpdateFlags(&this->unk_1CE, 3, 7); this->unk_1CE |= 0x80; this->unk_1CD = 0xFF; this->actionFunc = func_80B3F00C; diff --git a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c index f144d64c00..3692f4a4a0 100644 --- a/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c +++ b/src/overlays/actors/ovl_En_Dnk/z_en_dnk.c @@ -170,7 +170,7 @@ s32 func_80A515C4(EnDnk* this) { } void func_80A51648(EnDnk* this, GlobalContext* globalCtx) { - if (func_8013D8DC(this->unk_28E, globalCtx) == 1) { + if (SubS_IsObjectLoaded(this->unk_28E, globalCtx) == true) { gSegments[0x06] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[this->unk_28E].segment); this->actor.draw = func_80A52018; this->actor.objBankIndex = this->unk_28E; @@ -227,15 +227,15 @@ void EnDnk_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_28E = -1; switch (ENDNK_GET_3(&this->actor)) { case ENDNK_GET_3_1: - this->unk_28E = func_8013D924(0x12B, globalCtx); + this->unk_28E = SubS_GetObjectIndex(OBJECT_HINTNUTS, globalCtx); break; case ENDNK_GET_3_0: - this->unk_28E = func_8013D924(0x135, globalCtx); + this->unk_28E = SubS_GetObjectIndex(OBJECT_DNK, globalCtx); break; case ENDNK_GET_3_2: - this->unk_28E = func_8013D924(0x40, globalCtx); + this->unk_28E = SubS_GetObjectIndex(OBJECT_DEKUNUTS, globalCtx); break; } diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index 118c984f90..fa3448e04e 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -202,12 +202,12 @@ s32 func_80B3CF60(EnDnp* this, GlobalContext* globalCtx) { s32 ret = false; if ((this->unk_322 & 7) && Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_8013AED4(&this->unk_322, 0, 7); + SubS_UpdateFlags(&this->unk_322, 0, 7); this->unk_322 |= 8; this->actionFunc = func_80B3D3F8; ret = true; } else if (!(gSaveContext.weekEventReg[23] & 0x20) && Actor_HasParent(&this->actor, globalCtx)) { - func_8013AED4(&this->unk_322, 0, 7); + SubS_UpdateFlags(&this->unk_322, 0, 7); this->unk_322 &= ~0x500; this->actor.parent = NULL; this->unk_32E = 0; @@ -227,12 +227,12 @@ s32 func_80B3D044(EnDnp* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_1; this->unk_324 = 0xFF; } - func_8013AED4(&this->unk_322, 0, 7); + SubS_UpdateFlags(&this->unk_322, 0, 7); this->actionFunc = func_80B3D11C; ret = true; } else if (this->unk_322 & 0x200) { this->actor.flags |= ACTOR_FLAG_1; - func_8013AED4(&this->unk_322, 3, 7); + SubS_UpdateFlags(&this->unk_322, 3, 7); this->unk_322 &= ~(0x200 | 0x10); this->actionFunc = func_80B3D2D4; } @@ -311,7 +311,7 @@ void func_80B3D338(EnDnp* this, GlobalContext* globalCtx) { void func_80B3D3F8(EnDnp* this, GlobalContext* globalCtx) { if (func_8010BF58(&this->actor, globalCtx, D_80B3DE58, NULL, &this->unk_328)) { - func_8013AED4(&this->unk_322, 3, 7); + SubS_UpdateFlags(&this->unk_322, 3, 7); this->unk_322 &= ~8; this->actionFunc = func_80B3D2D4; } else { @@ -324,7 +324,7 @@ void func_80B3D47C(EnDnp* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->actor.scale.x, 0.0085f, 0.1f, 0.01f, 0.001f); if ((s32)(this->actor.scale.x * 10000.0f) >= 85) { this->actor.flags |= ACTOR_FLAG_1; - func_8013AED4(&this->unk_322, 3, 7); + SubS_UpdateFlags(&this->unk_322, 3, 7); this->unk_322 &= ~0x10; this->unk_322 |= 0x400; this->actor.scale.x = 0.0085f; @@ -360,7 +360,7 @@ void EnDnp_Init(Actor* thisx, GlobalContext* globalCtx) { if (ENDNP_GET_7(&this->actor) == ENDNP_GET_7_1) { this->actor.flags &= ~ACTOR_FLAG_1; Actor_SetScale(&this->actor, 0.00085000007f); - func_8013AED4(&this->unk_322, 0, 7); + SubS_UpdateFlags(&this->unk_322, 0, 7); this->actor.shape.rot.x = 0; this->actor.world.rot.x = this->actor.shape.rot.x; this->actor.cutscene = 0x10; @@ -369,7 +369,7 @@ void EnDnp_Init(Actor* thisx, GlobalContext* globalCtx) { !(gSaveContext.weekEventReg[23] & 0x20)) || ((ENDNP_GET_7(&this->actor) == ENDNP_GET_7_2) && (gSaveContext.weekEventReg[23] & 0x20))) { Actor_SetScale(&this->actor, 0.0085f); - func_8013AED4(&this->unk_322, 3, 7); + SubS_UpdateFlags(&this->unk_322, 3, 7); this->unk_322 |= 0x400; if ((globalCtx->sceneNum == SCENE_MITURIN) && (gSaveContext.weekEventReg[29] & 0x40)) { this->unk_322 |= 0x20; diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index 3e0606388e..85df3499b6 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -124,14 +124,14 @@ s32 func_80A52648(EnDnq* this, GlobalContext* globalCtx) { this->unk_1DC = 0xFF; this->unk_37C |= 0x20; } - func_8013AED4(&this->unk_37C, 0, 7); + SubS_UpdateFlags(&this->unk_37C, 0, 7); ret = true; } else { if (this->unk_37C & 0x20) { this->actor.flags |= ACTOR_FLAG_1; this->unk_1DC = 0xFF; this->unk_37C &= ~0x20; - func_8013AED4(&this->unk_37C, 3, 7); + SubS_UpdateFlags(&this->unk_37C, 3, 7); } } @@ -321,7 +321,7 @@ s32 func_80A52D44(EnDnq* this, GlobalContext* globalCtx) { s32 ret = false; if ((this->unk_37C & 7) && Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_8013AED4(&this->unk_37C, 0, 7); + SubS_UpdateFlags(&this->unk_37C, 0, 7); this->unk_380 = func_80A52CF8(this, globalCtx); this->actionFunc = func_80A52FB8; ret = true; @@ -335,9 +335,9 @@ void func_80A52DC8(EnDnq* this, GlobalContext* globalCtx) { s16 yaw = this->actor.yawTowardsPlayer - this->actor.world.rot.y; if (yaw <= 0x3800) { - func_8013AED4(&this->unk_37C, 3, 7); + SubS_UpdateFlags(&this->unk_37C, 3, 7); } else { - func_8013AED4(&this->unk_37C, 0, 7); + SubS_UpdateFlags(&this->unk_37C, 0, 7); } if (!(gSaveContext.weekEventReg[23] & 0x20)) { @@ -376,7 +376,7 @@ void func_80A52FB8(EnDnq* this, GlobalContext* globalCtx) { s16 sp2E = this->actor.yawTowardsPlayer; if (func_8010BF58(&this->actor, globalCtx, this->unk_380, NULL, &this->unk_1E0)) { - func_8013AED4(&this->unk_37C, 3, 7); + SubS_UpdateFlags(&this->unk_37C, 3, 7); this->unk_386 = 0; this->actionFunc = func_80A52DC8; } else { @@ -426,7 +426,7 @@ void EnDnq_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 1; this->unk_386 = 0; this->unk_37C = 0; - func_8013AED4(&this->unk_37C, 3, 7); + SubS_UpdateFlags(&this->unk_37C, 3, 7); if (gSaveContext.weekEventReg[9] & 0x80) { this->unk_3A4 = 1; } else { diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index ba01959bc0..9a4562ae29 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -230,7 +230,7 @@ s32 func_8092CAD0(EnDns* this, GlobalContext* globalCtx) { if (this->unk_2C6 & 7) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_8013AED4(&this->unk_2C6, 0, 7); + SubS_UpdateFlags(&this->unk_2C6, 0, 7); this->unk_2C6 &= ~0x10; if (ENDNS_GET_4000(&this->actor)) { this->unk_2F0 = 0.0f; @@ -255,14 +255,14 @@ s32 func_8092CB98(EnDns* this, GlobalContext* globalCtx) { if (!(this->unk_2C6 & 0x80)) { this->unk_2C8 = func_8092CA74(this); this->actor.flags &= ~ACTOR_FLAG_1; - func_8013AED4(&this->unk_2C6, 0, 7); + SubS_UpdateFlags(&this->unk_2C6, 0, 7); this->unk_2C6 |= 0x80; this->unk_1D8 = 0xFF; } phi_v1 = 1; } else if (this->unk_2C6 & 0x80) { this->actor.flags |= ACTOR_FLAG_1; - func_8013AED4(&this->unk_2C6, 3, 7); + SubS_UpdateFlags(&this->unk_2C6, 3, 7); this->unk_2C6 &= ~0x80; } return phi_v1; @@ -402,7 +402,7 @@ void func_8092D1B8(EnDns* this, GlobalContext* globalCtx) { if (!(gSaveContext.weekEventReg[23] & 0x20) && !(gSaveContext.eventInf[1] & 0x20) && func_8092CC68(globalCtx)) { player->stateFlags1 |= 0x20; this->unk_2C6 |= 0x100; - func_8013AED4(&this->unk_2C6, 4, 7); + SubS_UpdateFlags(&this->unk_2C6, 4, 7); play_sound(NA_SE_SY_FOUND); gSaveContext.eventInf[1] |= 0x20; this->unk_2F4 = func_8092CCEC; @@ -455,7 +455,7 @@ void func_8092D4D8(EnDns* this, GlobalContext* globalCtx) { func_8092C63C(this, EN_DNS_ANIMATION_WALK_1); } } else if (func_8010BF58(&this->actor, globalCtx, this->unk_1E0, this->unk_2F4, &this->unk_1DC)) { - func_8013AED4(&this->unk_2C6, 3, 7); + SubS_UpdateFlags(&this->unk_2C6, 3, 7); this->unk_2F4 = NULL; if (ENDNS_GET_4000(&this->actor)) { if (!(gSaveContext.eventInf[1] & 0x20)) { @@ -521,7 +521,7 @@ void EnDns_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.gravity = -0.8f; this->unk_2D2 = 0; this->unk_2C6 = 0; - func_8013AED4(&this->unk_2C6, 3, 7); + SubS_UpdateFlags(&this->unk_2C6, 3, 7); this->unk_2C6 |= (0x40 | 0x10); this->unk_2C6 |= 0x200; if (gSaveContext.weekEventReg[9] & 0x80) { diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 93ca5b2cb4..6d5c2db3f8 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -249,7 +249,7 @@ s32 func_8094E0F8(EnGm* this, GlobalContext* globalCtx) { if ((this->unk_260 != globalCtx->roomCtx.currRoom.num) && (globalCtx->roomCtx.unk31 == 0)) { this->unk_260 = globalCtx->roomCtx.currRoom.num; - this->unk_262 = func_8013D924(0x248, globalCtx); + this->unk_262 = SubS_GetObjectIndex(OBJECT_IN2, globalCtx); this->actor.draw = NULL; this->unk_3FC = 1; } @@ -258,7 +258,7 @@ s32 func_8094E0F8(EnGm* this, GlobalContext* globalCtx) { return false; } - if ((this->unk_262 < 0) || !func_8013D8DC(this->unk_262, globalCtx)) { + if ((this->unk_262 < 0) || !SubS_IsObjectLoaded(this->unk_262, globalCtx)) { ret = true; } else { this->actor.draw = EnGm_Draw; @@ -652,7 +652,7 @@ s32 func_8094EE84(EnGm* this, GlobalContext* globalCtx) { if (this->unk_3A4 & 7) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_8013AED4(&this->unk_3A4, 0, 7); + SubS_UpdateFlags(&this->unk_3A4, 0, 7); this->unk_3E0 = 0; this->unk_3E4 = NULL; this->actor.child = this->unk_268; @@ -999,7 +999,7 @@ s32 func_8094FAC4(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar this->unk_250 = (this->unk_254 / this->unk_24C) + 2; this->unk_3A4 &= ~0x8; this->unk_3A4 &= ~0x10; - func_8013AED4(&this->unk_3A4, 3, 7); + SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_3A4 |= 0x100; this->unk_3A4 |= 0x200; func_8094E054(this, globalCtx, 7); @@ -1016,7 +1016,7 @@ s32 func_8094FCC4(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar if (func_8094F7D0(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_TAB)) { if (this->unk_258 == 0) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80951D90); - func_8013AED4(&this->unk_3A4, 3, 7); + SubS_UpdateFlags(&this->unk_3A4, 3, 7); func_8094E054(this, globalCtx, 0); } else { func_8094E054(this, globalCtx, 9); @@ -1034,7 +1034,7 @@ s32 func_8094FD88(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar if (func_8094F7D0(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_RECEPGIRL)) { func_8094E054(this, globalCtx, 11); - func_8013AED4(&this->unk_3A4, 3, 7); + SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_3A4 |= 0x100; this->unk_3A4 |= 0x200; ret = true; @@ -1049,7 +1049,7 @@ s32 func_8094FE10(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar al = func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_AL); if (func_8094F7D0(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_TOTO) && (al != NULL) && (al->update != NULL)) { func_8094E054(this, globalCtx, 11); - func_8013AED4(&this->unk_3A4, 3, 7); + SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_268 = al; if (!(gSaveContext.weekEventReg[86] & 0x20)) { this->unk_3C8 = 2; @@ -1086,7 +1086,7 @@ s32 func_8094FF04(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar this->actor.world.rot.y = Math_Vec3f_Yaw(&sp3C, &sp30); if (this->unk_258 == 0) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80951D9C); - func_8013AED4(&this->unk_3A4, 3, 7); + SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_3C8 = 4; this->unk_3CA = 4; this->unk_3CC = 8; @@ -1113,7 +1113,7 @@ s32 func_80950088(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar Math_Vec3f_Copy(&this->actor.world.pos, &D_80951DA8); Math_Vec3s_Copy(&this->actor.world.rot, &D_80951DB4); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); - func_8013AED4(&this->unk_3A4, 3, 7); + SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_3A4 |= (0x2000 | 0x100); this->unk_3A4 |= 0x200; func_8094E054(this, globalCtx, 12); @@ -1128,7 +1128,7 @@ s32 func_80950120(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar Math_Vec3f_Copy(&this->actor.world.pos, &D_80951DBC); Math_Vec3s_Copy(&this->actor.world.rot, &D_80951DC8); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); - func_8013AED4(&this->unk_3A4, 3, 7); + SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_3A4 |= (0x800 | 0x100); this->unk_3A4 |= 0x200; func_8094E054(this, globalCtx, 4); @@ -1144,7 +1144,7 @@ s32 func_809501B8(EnGm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar Math_Vec3s_Copy(&this->actor.world.rot, &D_80951DDC); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); this->actor.targetMode = 6; - func_8013AED4(&this->unk_3A4, 3, 7); + SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_3A4 |= (0x1000 | 0x100); this->unk_3A4 |= 0x200; this->unk_3C8 = 3; @@ -1251,7 +1251,7 @@ s32 func_809503F8(EnGm* this, GlobalContext* globalCtx) { if (this->unk_3E8 == 9) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - func_8013AED4(&this->unk_3A4, 3, 7); + SubS_UpdateFlags(&this->unk_3A4, 3, 7); func_8094E054(this, globalCtx, 0); } else { AnimationContext_SetMoveActor(globalCtx, &this->actor, &this->skelAnime, 1.0f); @@ -1283,7 +1283,7 @@ s32 func_80950490(EnGm* this, GlobalContext* globalCtx) { case 9: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { this->actor.shape.shadowDraw = ActorShadow_DrawCircle; - func_8013AED4(&this->unk_3A4, 3, 7); + SubS_UpdateFlags(&this->unk_3A4, 3, 7); this->unk_3C8 = 4; this->unk_3CA = 4; this->unk_3CC = 8; @@ -1518,7 +1518,7 @@ void func_80950DB8(EnGm* this, GlobalContext* globalCtx) { Actor* al; if (func_8010BF58(&this->actor, globalCtx, this->unk_264, this->unk_3E4, &this->unk_25C)) { - func_8013AED4(&this->unk_3A4, 3, 7); + SubS_UpdateFlags(&this->unk_3A4, 3, 7); al = func_8094DEE0(this, globalCtx, ACTORCAT_NPC, ACTOR_EN_AL); if ((this->unk_258 == 2) && (al != NULL) && (al->update != NULL)) { this->unk_268 = al; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 67dea2e9d9..000f5649c6 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -672,7 +672,7 @@ s32 func_80A12774(EnGo* this, GlobalContext* globalCtx) { this->unk_390 |= 0x20; } - func_8013AED4(&this->unk_390, 0, 7); + SubS_UpdateFlags(&this->unk_390, 0, 7); this->unk_3C0 = 0; this->unk_3C4 = 0; this->unk_18C = this->actionFunc; @@ -717,13 +717,13 @@ s32 func_80A12954(EnGo* this, GlobalContext* globalCtx) { this->unk_3F0 = 1; this->unk_18C = this->actionFunc; } - func_8013AED4(&this->unk_390, 0, 7); + SubS_UpdateFlags(&this->unk_390, 0, 7); this->actionFunc = func_80A14FC8; } else if (this->unk_3F0 != 0) { this->actor.flags |= ACTOR_FLAG_1; this->unk_394 = 255; this->unk_3F0 = 0; - func_8013AED4(&this->unk_390, 3, 7); + SubS_UpdateFlags(&this->unk_390, 3, 7); this->actionFunc = this->unk_18C; } @@ -941,20 +941,20 @@ void func_80A132C8(EnGo* this, GlobalContext* globalCtx) { s16 temp_v1 = BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y); if ((fabsf(this->actor.playerHeightRel) > 20.0f) || (this->actor.xzDistToPlayer > 300.0f)) { - func_8013AED4(&this->unk_390, 3, 7); + SubS_UpdateFlags(&this->unk_390, 3, 7); } else if ((player->transformation != PLAYER_FORM_GORON) || (ABS_ALT(temp_v1) >= 0x1C70) || (gSaveContext.weekEventReg[21] & 4) || (gSaveContext.weekEventReg[21] & 8)) { - func_8013AED4(&this->unk_390, 3, 7); + SubS_UpdateFlags(&this->unk_390, 3, 7); } else { - func_8013AED4(&this->unk_390, 4, 7); + SubS_UpdateFlags(&this->unk_390, 4, 7); } } void func_80A133A8(EnGo* this, GlobalContext* globalCtx) { if (gSaveContext.weekEventReg[21] & 8) { - func_8013AED4(&this->unk_390, 3, 7); + SubS_UpdateFlags(&this->unk_390, 3, 7); } else { - func_8013AED4(&this->unk_390, 4, 7); + SubS_UpdateFlags(&this->unk_390, 4, 7); } } @@ -1348,7 +1348,7 @@ void func_80A14324(EnGo* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->unk_3A4); this->unk_390 = 0; this->actor.gravity = -1.0f; - func_8013AED4(&this->unk_390, 3, 7); + SubS_UpdateFlags(&this->unk_390, 3, 7); this->unk_3EC = 0; this->unk_390 |= 0x40; this->unk_3BC = 0; @@ -1362,7 +1362,7 @@ void func_80A143A8(EnGo* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, this->unk_3A4); this->unk_390 = 0; this->actor.gravity = -1.0f; - func_8013AED4(&this->unk_390, 3, 7); + SubS_UpdateFlags(&this->unk_390, 3, 7); this->unk_3EC = 0; this->unk_390 |= 0x40; this->unk_390 |= 0x20; @@ -1441,7 +1441,7 @@ void func_80A146CC(EnGo* this, GlobalContext* globalCtx) { this->actor.targetMode = 3; this->unk_390 = 0; this->actor.gravity = -1.0f; - func_8013AED4(&this->unk_390, 3, 7); + SubS_UpdateFlags(&this->unk_390, 3, 7); this->unk_390 |= 0x40; this->unk_390 |= 0x20; this->unk_3D8 = func_80A13E80; @@ -1451,8 +1451,8 @@ void func_80A146CC(EnGo* this, GlobalContext* globalCtx) { void func_80A14798(EnGo* this, GlobalContext* globalCtx) { s32 sp38[2] = { 0x0000003E, 0x00000F64 }; - if ((this->unk_288 < 0) || func_8013D8DC(this->unk_288, globalCtx) || (this->unk_289 < 0) || - func_8013D8DC(this->unk_289, globalCtx)) { + if ((this->unk_288 < 0) || SubS_IsObjectLoaded(this->unk_288, globalCtx) || (this->unk_289 < 0) || + SubS_IsObjectLoaded(this->unk_289, globalCtx)) { ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); SkelAnime_InitFlex(globalCtx, &this->skelAnime, &object_oF1d_map_Skel_011AC8, NULL, this->jointTable, this->morphTable, 18); @@ -1511,7 +1511,7 @@ void func_80A149B0(EnGo* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_GORON_CHEER - SFX_FLAG); } else if (ENGO_GET_F(&this->actor) != ENGO_F_8) { if (func_80A1222C(this, globalCtx)) { - func_8013AED4(&this->unk_390, 0, 7); + SubS_UpdateFlags(&this->unk_390, 0, 7); this->unk_3EC = 1; this->actionFunc = func_80A14B30; } else if (ENGO_GET_F(&this->actor) == ENGO_F_4) { @@ -1526,9 +1526,9 @@ void func_80A149B0(EnGo* this, GlobalContext* globalCtx) { } } else if (ENGO_GET_F(&this->actor) == ENGO_F_1) { if (ABS_ALT(BINANG_SUB(this->actor.yawTowardsPlayer, this->actor.shape.rot.y)) < 0x3FFC) { - func_8013AED4(&this->unk_390, 3, 7); + SubS_UpdateFlags(&this->unk_390, 3, 7); } else { - func_8013AED4(&this->unk_390, 0, 7); + SubS_UpdateFlags(&this->unk_390, 0, 7); } } } @@ -1579,7 +1579,7 @@ void func_80A14B30(EnGo* this, GlobalContext* globalCtx) { } this->unk_3AE += 0x400; this->actor.shape.yOffset = (this->actor.scale.y / this->unk_3A4) * 14.0f; - func_8013AED4(&this->unk_390, 3, 7); + SubS_UpdateFlags(&this->unk_390, 3, 7); } } else if ((this->actor.xzDistToPlayer >= 240.0f) || (this->actor.playerHeightRel >= 20.0f) || (this->unk_3EC != 0)) { @@ -1621,7 +1621,7 @@ void func_80A14EB0(EnGo* this, GlobalContext* globalCtx) { ActorCutscene_Stop(this->actor.cutscene); func_80A143A8(this, globalCtx); if ((ENGO_GET_F(&this->actor) == ENGO_F_4) && (ENGO_GET_70(&this->actor) == ENGO_70_1)) { - func_8013AED4(&this->unk_390, 4, 7); + SubS_UpdateFlags(&this->unk_390, 4, 7); func_80A143A8(sp24, globalCtx); sp24->actionFunc = func_80A149B0; } @@ -1876,7 +1876,7 @@ void func_80A157C4(EnGo* this, GlobalContext* globalCtx) { } this->unk_390 &= ~0x8; - func_8013AED4(&this->unk_390, 3, 7); + SubS_UpdateFlags(&this->unk_390, 3, 7); this->unk_28C = 0; this->unk_390 |= 0x40; this->actionFunc = this->unk_18C; @@ -1885,8 +1885,8 @@ void func_80A157C4(EnGo* this, GlobalContext* globalCtx) { void EnGo_Init(Actor* thisx, GlobalContext* globalCtx) { EnGo* this = THIS; - this->unk_288 = func_8013D924(OBJECT_TAISOU, globalCtx); - this->unk_289 = func_8013D924(OBJECT_HAKUGIN_DEMO, globalCtx); + this->unk_288 = SubS_GetObjectIndex(OBJECT_TAISOU, globalCtx); + this->unk_289 = SubS_GetObjectIndex(OBJECT_HAKUGIN_DEMO, globalCtx); this->actionFunc = func_80A14798; } diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index a7d0d397fc..7bae831cfa 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -156,7 +156,7 @@ void EnGs_Init(Actor* thisx, GlobalContext* globalCtx) { this->unk_1F4 = this->unk_1FA; Math_Vec3f_Copy(&this->unk_1B0[0], &D_801C5DB0); Math_Vec3f_Copy(&this->unk_1B0[1], &D_801C5DB0); - func_8013E3B8(&this->actor, &this->unk_212, 2); + SubS_FillCutscenesList(&this->actor, this->unk_212, ARRAY_COUNT(this->unk_212)); func_801A5080(0); if (this->actor.params == ENGS_1) { Actor_SetScale(&this->actor, 0.15f); @@ -262,7 +262,7 @@ void func_80997E4C(EnGs* this, GlobalContext* globalCtx) { } void func_80997FF0(EnGs* this, GlobalContext* globalCtx) { - if (func_8013E2D4(&this->actor, globalCtx->unk_1879C[0], -1, 1)) { + if (SubS_StartActorCutscene(&this->actor, globalCtx->unk_1879C[0], -1, SUBS_CUTSCENE_NORMAL)) { func_80998040(this, globalCtx); } } @@ -380,7 +380,7 @@ void func_809985B8(EnGs* this, GlobalContext* globalCtx) { EnGs* gossipStone; Vec3f sp38; - if (func_8013E2D4(&this->actor, this->unk_212, -1, 0)) { + if (SubS_StartActorCutscene(&this->actor, this->unk_212[0], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { Player* player = GET_PLAYER(globalCtx); Matrix_RotateY(this->actor.shape.rot.y, MTXMODE_NEW); @@ -446,7 +446,7 @@ void func_8099874C(EnGs* this, GlobalContext* globalCtx) { if ((this->unk_19C == 5) && (this->unk_194 != 0)) { s32 i; - ActorCutscene_Stop(this->unk_212); + ActorCutscene_Stop(this->unk_212[0]); phi_v0 = 1; for (i = 0; i < 4; i++) { diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.h b/src/overlays/actors/ovl_En_Gs/z_en_gs.h index 8b10cb68dc..c76a0c346f 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.h +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.h @@ -49,8 +49,7 @@ typedef struct EnGs { /* 0x208 */ s32 unk_208; /* 0x20C */ s32 unk_20C; /* 0x210 */ u16 unk_210; - /* 0x212 */ s16 unk_212; - /* 0x214 */ UNK_TYPE1 unk214[2]; + /* 0x212 */ s16 unk_212[2]; /* 0x216 */ s16 unk_216; /* 0x218 */ s16 unk_218; /* 0x21A */ s16 unk_21A; diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index a2a185f3fb..ecb47f3834 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -391,7 +391,7 @@ s32 func_80BF19A0(EnIg* this, GlobalContext* globalCtx) { if (this->unk_3D0 & 7) { if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_8013AED4(&this->unk_3D0, 0, 7); + SubS_UpdateFlags(&this->unk_3D0, 0, 7); this->unk_3F6 = 0; this->unk_3F8 = NULL; this->actor.child = this->unk_2A8; @@ -500,7 +500,7 @@ s32 func_80BF1D78(EnIg* this, GlobalContext* globalCtx, struct_80133038_arg2* ar if (func_80BF1C44(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_AN)) { func_80BF1284(this, 0); - func_8013AED4(&this->unk_3D0, 3, 7); + SubS_UpdateFlags(&this->unk_3D0, 3, 7); this->unk_3D0 |= 0x20; this->unk_3D0 |= 0x100; sp2C = true; @@ -593,7 +593,7 @@ s32 func_80BF1FA8(EnIg* this, GlobalContext* globalCtx, struct_80133038_arg2* ar this->unk_3D0 &= ~0x8; this->unk_3D0 &= ~0x10; - func_8013AED4(&this->unk_3D0, 3, 7); + SubS_UpdateFlags(&this->unk_3D0, 3, 7); this->unk_3D0 |= 0x100; func_80BF1284(this, 2); this->actor.gravity = -1.0f; @@ -629,7 +629,7 @@ s32 func_80BF219C(EnIg* this, GlobalContext* globalCtx, struct_80133038_arg2* ar case 2: this->actor.home.rot.y = this->actor.world.rot.y; this->actor.home.rot.y += 0x8000; - func_8013AED4(&this->unk_3D0, 3, 7); + SubS_UpdateFlags(&this->unk_3D0, 3, 7); this->unk_3D0 |= 0x100; func_80BF1284(this, 1); break; @@ -637,7 +637,7 @@ s32 func_80BF219C(EnIg* this, GlobalContext* globalCtx, struct_80133038_arg2* ar case 4: this->actor.world.rot.y += 0x8000; this->actor.shape.rot.y = this->actor.world.rot.y; - func_8013AED4(&this->unk_3D0, 3, 7); + SubS_UpdateFlags(&this->unk_3D0, 3, 7); this->unk_3D0 |= 0x100; func_80BF1284(this, 8); break; @@ -800,7 +800,7 @@ s32 func_80BF293C(EnIg* this, GlobalContext* globalCtx) { func_80BF1284(this, 7); } } else if ((this->unk_3FC == 7) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - func_8013AED4(&this->unk_3D0, 3, 7); + SubS_UpdateFlags(&this->unk_3D0, 3, 7); func_80BF1284(this, 9); } return true; @@ -865,7 +865,7 @@ void func_80BF2BD4(EnIg* this, GlobalContext* globalCtx) { Vec3f sp2C; if (func_8010BF58(&this->actor, globalCtx, this->unk_298.unk4, this->unk_3F8, &this->unk_298.unk8)) { - func_8013AED4(&this->unk_3D0, 3, 7); + SubS_UpdateFlags(&this->unk_3D0, 3, 7); this->unk_3D0 &= ~0x20; this->unk_3D0 |= 0x200; this->unk_3EE = 20; 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 25d015cfad..a7dfc26ace 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -247,7 +247,7 @@ void func_808F3414(EnIn* this, GlobalContext* globalCtx) { if (this->unk23D == 0) { this->unk494 = SkelAnime_Update(&this->skelAnime); } - if (func_8013D5E8(this->actor.shape.rot.y, 0x2710, this->actor.yawTowardsPlayer)) { + if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x2710, this->actor.yawTowardsPlayer)) { sp30.x = player->actor.world.pos.x; sp30.y = player->bodyPartsPos[7].y + 3.0f; sp30.z = player->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Ja/z_en_ja.c b/src/overlays/actors/ovl_En_Ja/z_en_ja.c index a0160fd08a..340c186ef9 100644 --- a/src/overlays/actors/ovl_En_Ja/z_en_ja.c +++ b/src/overlays/actors/ovl_En_Ja/z_en_ja.c @@ -116,7 +116,7 @@ s32 func_80BC19FC(EnJa* this, GlobalContext* globalCtx) { s32 ret = false; if ((this->unk_340 & 7) && Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_8013AED4(&this->unk_340, 0, 7); + SubS_UpdateFlags(&this->unk_340, 0, 7); this->actionFunc = func_80BC22F4; ret = true; } @@ -235,7 +235,7 @@ s32 func_80BC1FC8(EnJa* this, GlobalContext* globalCtx, struct_80133038_arg2* ar s32 ret = false; if (func_80BC1AE0(this, globalCtx)) { - func_8013AED4(&this->unk_340, 3, 7); + SubS_UpdateFlags(&this->unk_340, 3, 7); this->unk_340 |= 0x10; func_80BC192C(this, 5); func_80BC2EA4(this); @@ -253,7 +253,7 @@ s32 func_80BC203C(EnJa* this, GlobalContext* globalCtx, struct_80133038_arg2* ar } else { func_80BC192C(this, 4); } - func_8013AED4(&this->unk_340, 3, 7); + SubS_UpdateFlags(&this->unk_340, 3, 7); this->actor.shape.shadowDraw = NULL; this->unk_340 |= 0x50; ret = true; @@ -328,7 +328,7 @@ s32* func_80BC2274(EnJa* this, GlobalContext* globalCtx) { void func_80BC22F4(EnJa* this, GlobalContext* globalCtx) { if (func_8010BF58(&this->actor, globalCtx, func_80BC2274(this, globalCtx), this->unk_368, &this->unk_1D8.unk_04)) { this->unk_340 &= ~8; - func_8013AED4(&this->unk_340, 3, 7); + SubS_UpdateFlags(&this->unk_340, 3, 7); this->unk_1D8.unk_04 = 0; this->unk_340 |= 0x10; this->actor.shape.rot.y = this->actor.world.rot.y; @@ -350,7 +350,7 @@ void EnJa_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.targetMode = 0; this->actor.uncullZoneForward = 800.0f; this->actor.gravity = 0.0f; - func_8013AED4(&this->unk_340, 0, 7); + SubS_UpdateFlags(&this->unk_340, 0, 7); this->unk_340 |= 0x10; this->unk_1D8.unk_00 = 0; this->unk_368 = NULL; diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index ea58ac8e04..4781f8828c 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -162,7 +162,7 @@ void EnOt_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.z = 0; this->actor.colChkInfo.mass = MASS_IMMOVABLE; this->actor.gravity = 0.0f; - func_8013E3B8(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 0, &this->animIdx); this->skelAnime.curFrame = Rand_ZeroOne() * this->skelAnime.endFrame; this->lightNode = LightContext_InsertLight(globalCtx, &globalCtx->lightCtx, &this->lightInfo); @@ -301,20 +301,20 @@ void func_80B5BB38(Color_RGB8* arg0, Color_RGB8* arg1, f32 arg2) { void func_80B5BDA8(EnOt* this, GlobalContext* globalCtx) { SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, sAnimations, 1, &this->animIdx); - func_8013E3B8(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); this->actionFunc = func_80B5BE04; } void func_80B5BE04(EnOt* this, GlobalContext* globalCtx) { switch (this->unk_388) { case 0: - if (func_8013E2D4(&this->actor, this->cutscenes[2], -1, 0)) { + if (SubS_StartActorCutscene(&this->actor, this->cutscenes[2], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { func_80B5BF60(this, globalCtx); } break; case 1: - if (func_8013E2D4(&this->actor, this->cutscenes[3], -1, 0)) { + if (SubS_StartActorCutscene(&this->actor, this->cutscenes[3], -1, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { func_80B5BF60(this, globalCtx); } break; @@ -591,7 +591,7 @@ void func_80B5CA30(EnOt* this, GlobalContext* globalCtx) { } void func_80B5CAD0(EnOt* this, GlobalContext* globalCtx) { - func_8013E3B8(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes) / 2); + SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes) / 2); this->actionFunc = func_80B5CB0C; } @@ -626,7 +626,7 @@ void func_80B5CC88(EnOt* this, GlobalContext* globalCtx) { } void func_80B5CCA0(EnOt* this, GlobalContext* globalCtx) { - if (func_8013E2D4(&this->actor, this->cutscenes[0], 0x7C, 1)) { + if (SubS_StartActorCutscene(&this->actor, this->cutscenes[0], 0x7C, SUBS_CUTSCENE_NORMAL)) { Player* player = GET_PLAYER(globalCtx); player->stateFlags2 |= 0x20000000; diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index 00fbaa2b2f..eeec684050 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -702,7 +702,7 @@ s32 func_80AF86F0(EnPm* this, GlobalContext* globalCtx) { s32 ret = false; if ((this->unk_356 & 7) && Actor_ProcessTalkRequest(&this->actor, &globalCtx->state)) { - func_8013AED4(&this->unk_356, 0, 7); + SubS_UpdateFlags(&this->unk_356, 0, 7); this->unk_398 = 0; this->unk_378 = 0; this->unk_37C = NULL; @@ -1041,7 +1041,7 @@ s32 func_80AF91E8(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar break; default: - func_8013AED4(&this->unk_356, 3, 7); + SubS_UpdateFlags(&this->unk_356, 3, 7); func_80AF7E98(this, 0); if (gSaveContext.weekEventReg[90] & 8) { this->unk_356 |= 0x800; @@ -1138,7 +1138,7 @@ s32 func_80AF95E8(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_ROOM_CARTAIN); Flags_SetSwitch(globalCtx, 0); this->unk_36C = 20; - func_8013AED4(&this->unk_356, 3, 7); + SubS_UpdateFlags(&this->unk_356, 3, 7); func_80AF7E98(this, 3); break; @@ -1168,7 +1168,7 @@ s32 func_80AF95E8(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar if (arg2->unk0 == 0x1D) { this->actor.world.rot.y = BINANG_ROT180(this->actor.world.rot.y); } - func_8013AED4(&this->unk_356, 3, 7); + SubS_UpdateFlags(&this->unk_356, 3, 7); this->unk_356 |= 0x9000; func_80AF7E98(this, 3); break; @@ -1197,7 +1197,7 @@ s32 func_80AF992C(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar Math_Vec3f_Copy(&this->actor.world.pos, &D_80AFB8EC); Math_Vec3s_Copy(&this->actor.world.rot, &D_80AFB8F8); Math_Vec3s_Copy(&this->actor.shape.rot, &this->actor.world.rot); - func_8013AED4(&this->unk_356, 3, 7); + SubS_UpdateFlags(&this->unk_356, 3, 7); this->actor.targetMode = 6; this->actor.gravity = -1.0f; this->unk_368 = 80.0f; @@ -1215,7 +1215,7 @@ s32 func_80AF9A0C(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar s32 ret = false; if (func_80AF8ED4(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_AN)) { - func_8013AED4(&this->unk_356, 3, 7); + SubS_UpdateFlags(&this->unk_356, 3, 7); this->unk_356 |= 0x20; this->unk_356 |= 0x9000; if (this->unk_258 != 0) { @@ -1233,7 +1233,7 @@ s32 func_80AF9AB0(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar s32 ret = false; if (func_80AF8ED4(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_TEST3)) { - func_8013AED4(&this->unk_356, 3, 7); + SubS_UpdateFlags(&this->unk_356, 3, 7); this->unk_356 |= 0x20; this->unk_356 |= 0x9000; if (this->unk_258 != 0) { @@ -1251,7 +1251,7 @@ s32 func_80AF9B54(EnPm* this, GlobalContext* globalCtx, struct_80133038_arg2* ar s32 ret = false; if (func_80AF8ED4(this, globalCtx, arg2, ACTORCAT_NPC, ACTOR_EN_AL)) { - func_8013AED4(&this->unk_356, 3, 7); + SubS_UpdateFlags(&this->unk_356, 3, 7); this->unk_356 |= 0x9000; this->unk_356 |= 0x20; if (this->unk_258 != 0) { @@ -1552,9 +1552,9 @@ s32 func_80AFA334(EnPm* this, GlobalContext* globalCtx) { case 24: temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS_ALT(temp_v0) < 0x4000) { - func_8013AED4(&this->unk_356, 3, 7); + SubS_UpdateFlags(&this->unk_356, 3, 7); } else { - func_8013AED4(&this->unk_356, 0, 7); + SubS_UpdateFlags(&this->unk_356, 0, 7); } break; @@ -1723,7 +1723,7 @@ void func_80AFA5FC(EnPm* this, GlobalContext* globalCtx) { Vec3f sp2C; if (func_8010BF58(&this->actor, globalCtx, this->unk_25C, this->unk_37C, &this->unk_264)) { - func_8013AED4(&this->unk_356, 3, 7); + SubS_UpdateFlags(&this->unk_356, 3, 7); this->unk_356 &= ~0x20; this->unk_356 |= 0x200; this->actor.child = NULL; diff --git a/src/overlays/actors/ovl_En_Rg/z_en_rg.c b/src/overlays/actors/ovl_En_Rg/z_en_rg.c index 97f4fd3a5b..f8fd33a271 100644 --- a/src/overlays/actors/ovl_En_Rg/z_en_rg.c +++ b/src/overlays/actors/ovl_En_Rg/z_en_rg.c @@ -757,7 +757,7 @@ void EnRg_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_1; this->unk_310 = 8; this->actor.gravity = -1.0f; - func_8013AED4(&this->unk_310, 3, 7); + SubS_UpdateFlags(&this->unk_310, 3, 7); if (!(gSaveContext.weekEventReg[12] & 2)) { this->unk_318 = Rand_S16Offset(30, 30); 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 4d928a79a9..8dfd6dd355 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -486,7 +486,7 @@ void func_80BAB4F0(EnSuttari* this, GlobalContext* globalCtx) { } SkelAnime_Update(&this->skelAnime); if (!(this->flags1 & 4) && (Player_GetMask(globalCtx) != PLAYER_MASK_STONE)) { - if (func_8013D5E8(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer) != 0) { + if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x36B0, this->actor.yawTowardsPlayer)) { sp30.x = player->actor.world.pos.x; sp30.y = player->bodyPartsPos[7].y + 3.0f; sp30.z = player->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/src/overlays/actors/ovl_En_Tk/z_en_tk.c index b4982b4008..1e7e8f0d16 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -248,7 +248,7 @@ void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.flags |= ACTOR_FLAG_10; SubS_ChangeAnimationBySpeedInfo(&this->skelAnime, D_80AEF868, 0, &this->unk_2D4); - func_8013E3B8(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); + SubS_FillCutscenesList(&this->actor, this->cutscenes, ARRAY_COUNT(this->cutscenes)); switch (this->unk_2B0) { case 4: @@ -711,7 +711,8 @@ void func_80AEDBEC(EnTk* this, GlobalContext* globalCtx) { } void func_80AEDC4C(EnTk* this, GlobalContext* globalCtx) { - if ((this->actor.params >= 0) && func_8013E2D4(&this->actor, this->cutscenes[1], this->actor.params, 0)) { + if ((this->actor.params >= 0) && SubS_StartActorCutscene(&this->actor, this->cutscenes[1], this->actor.params, + SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { this->unk_2E8 = ActorCutscene_GetLength(this->cutscenes[1]); func_80151938(globalCtx, 0x1411); func_80AEDCBC(this, globalCtx); @@ -899,7 +900,7 @@ void func_80AEE2A8(EnTk* this, GlobalContext* globalCtx) { } void func_80AEE2C0(EnTk* this, GlobalContext* globalCtx) { - if (func_8013E2D4(&this->actor, this->cutscenes[0], 0x7C, 0)) { + if (SubS_StartActorCutscene(&this->actor, this->cutscenes[0], 0x7C, SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { func_80AEE374(this, globalCtx); } } @@ -995,12 +996,12 @@ void func_80AEE6B8(EnTk* this, GlobalContext* globalCtx) { ActorCutscene_Stop(this->cutscenes[0]); func_801477B4(globalCtx); func_80AEDBEC(this, globalCtx); - } else if (func_8013E2D4(&this->actor, 0x7C, this->cutscenes[0], 0)) { + } else if (SubS_StartActorCutscene(&this->actor, 0x7C, this->cutscenes[0], SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { this->unk_310 = 3; func_80AEDE10(this, globalCtx); this->unk_2CA &= ~0x20; } - } else if (func_8013E2D4(&this->actor, 0x7C, this->cutscenes[0], 0)) { + } else if (SubS_StartActorCutscene(&this->actor, 0x7C, this->cutscenes[0], SUBS_CUTSCENE_SET_UNK_LINK_FIELDS)) { this->unk_310 = 4; func_80AEDE10(this, globalCtx); } diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index 24b3e21ede..a7658263fe 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -687,7 +687,7 @@ s32 func_80A872AC(EnTru* this, GlobalContext* globalCtx) { this->unk_390 = 0; this->unk_364 = 0; this->unk_354 = func_80A871E0(this, globalCtx); - func_8013AED4(&this->unk_34E, 0, 7); + SubS_UpdateFlags(&this->unk_34E, 0, 7); this->actionFunc = func_80A881E0; ret = true; } @@ -1048,15 +1048,15 @@ void func_80A87FD0(EnTru* this, GlobalContext* globalCtx) { if (this->actor.draw != NULL) { if ((this->unk_34E & 0x80) || (gSaveContext.weekEventReg[16] & 0x10)) { if (func_80A873B8(this)) { - func_8013AED4(&this->unk_34E, 3, 7); + SubS_UpdateFlags(&this->unk_34E, 3, 7); } else { - func_8013AED4(&this->unk_34E, 0, 7); + SubS_UpdateFlags(&this->unk_34E, 0, 7); } } else if (this->unk_34E & 0x40) { if (func_80A873B8(this)) { - func_8013AED4(&this->unk_34E, 3, 7); + SubS_UpdateFlags(&this->unk_34E, 3, 7); } else { - func_8013AED4(&this->unk_34E, 0, 7); + SubS_UpdateFlags(&this->unk_34E, 0, 7); } if ((this->unk_37C == 2) && Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { @@ -1070,13 +1070,13 @@ void func_80A87FD0(EnTru* this, GlobalContext* globalCtx) { } } else if (!(gSaveContext.weekEventReg[16] & 0x10) && (fabsf(this->actor.playerHeightRel) < 10.0f) && (this->actor.xzDistToPlayer < 140.0f)) { - func_8013AED4(&this->unk_34E, 4, 7); + SubS_UpdateFlags(&this->unk_34E, 4, 7); this->unk_34E |= 0x1040; this->unk_362 = Rand_S16Offset(40, 20); } else if (func_80A873B8(this)) { - func_8013AED4(&this->unk_34E, 3, 7); + SubS_UpdateFlags(&this->unk_34E, 3, 7); } else { - func_8013AED4(&this->unk_34E, 0, 7); + SubS_UpdateFlags(&this->unk_34E, 0, 7); } } } @@ -1102,7 +1102,7 @@ void func_80A881E0(EnTru* this, GlobalContext* globalCtx) { func_80A86924(this, 6); } - func_8013AED4(&this->unk_34E, 0, 7); + SubS_UpdateFlags(&this->unk_34E, 0, 7); this->unk_34E &= ~(0x1000 | 0x8); this->unk_34E |= 0x10; this->actor.shape.rot.y = this->actor.world.rot.y; 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 34bff63c22..3a9872406c 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -179,7 +179,7 @@ void EnZo_LookAtPlayer(EnZo* this, GlobalContext* globalCtx) { Vec3f focus; SkelAnime_Update(&this->skelAnime); - if (func_8013D5E8(this->actor.shape.rot.y, 10000, this->actor.yawTowardsPlayer)) { + if (SubS_AngleDiffLessEqual(this->actor.shape.rot.y, 0x2710, this->actor.yawTowardsPlayer)) { focus.x = player->actor.world.pos.x; focus.y = player->bodyPartsPos[7].y + 3.0f; focus.z = player->actor.world.pos.z; diff --git a/tools/actorfixer.py b/tools/actorfixer.py index fc71f78bf2..a94f2b9410 100755 --- a/tools/actorfixer.py +++ b/tools/actorfixer.py @@ -396,6 +396,12 @@ animdict = { "func_80114E90": "Interface_HasEmptyBottle", "func_80114F2C": "Interface_HasItemInBottle", "func_80123C90": "Player_SetEquipmentData", + "func_8013E2D4": "SubS_StartActorCutscene", + "func_8013E3B8": "SubS_FillCutscenesList", + "func_8013AED4": "SubS_UpdateFlags", + "func_8013D8DC": "SubS_IsObjectLoaded", + "func_8013D924": "SubS_GetObjectIndex", + "func_8013D5E8": "SubS_AngleDiffLessEqual", "func_8012F22C": "Inventory_GetSkullTokenCount", # Structs members diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 6e5820303d..73e654dfec 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2660,7 +2660,7 @@ 0x8013AB00:("SubS_DrawTransformFlex",), 0x8013AD6C:("func_8013AD6C",), 0x8013AD9C:("func_8013AD9C",), - 0x8013AED4:("func_8013AED4",), + 0x8013AED4:("SubS_UpdateFlags",), 0x8013AF00:("func_8013AF00",), 0x8013B010:("func_8013B010",), 0x8013B0C8:("func_8013B0C8",), @@ -2681,14 +2681,14 @@ 0x8013CF04:("func_8013CF04",), 0x8013D0E0:("func_8013D0E0",), 0x8013D2E0:("func_8013D2E0",), - 0x8013D5E8:("func_8013D5E8",), + 0x8013D5E8:("SubS_AngleDiffLessEqual",), 0x8013D648:("func_8013D648",), 0x8013D68C:("func_8013D68C",), 0x8013D720:("func_8013D720",), 0x8013D768:("func_8013D768",), 0x8013D83C:("func_8013D83C",), - 0x8013D8DC:("func_8013D8DC",), - 0x8013D924:("func_8013D924",), + 0x8013D8DC:("SubS_IsObjectLoaded",), + 0x8013D924:("SubS_GetObjectIndex",), 0x8013D960:("SubS_FindActor",), 0x8013D9C8:("SubS_FillLimbRotTables",), 0x8013DB90:("func_8013DB90",), @@ -2701,8 +2701,8 @@ 0x8013E07C:("func_8013E07C",), 0x8013E0A4:("func_8013E0A4",), 0x8013E1C8:("SubS_ChangeAnimationBySpeedInfo",), - 0x8013E2D4:("func_8013E2D4",), - 0x8013E3B8:("func_8013E3B8",), + 0x8013E2D4:("SubS_StartActorCutscene",), + 0x8013E3B8:("SubS_FillCutscenesList",), 0x8013E4B0:("func_8013E4B0",), 0x8013E5CC:("func_8013E5CC",), 0x8013E640:("SubS_FindActorCustom",), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index aeea6d9aee..df41d48299 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2174,7 +2174,7 @@ asm/non_matchings/code/z_sub_s/SubS_DrawTransformFlexLimb.s,SubS_DrawTransformFl asm/non_matchings/code/z_sub_s/SubS_DrawTransformFlex.s,SubS_DrawTransformFlex,0x8013AB00,0x9B asm/non_matchings/code/z_sub_s/func_8013AD6C.s,func_8013AD6C,0x8013AD6C,0xC asm/non_matchings/code/z_sub_s/func_8013AD9C.s,func_8013AD9C,0x8013AD9C,0x4E -asm/non_matchings/code/z_sub_s/func_8013AED4.s,func_8013AED4,0x8013AED4,0xB +asm/non_matchings/code/z_sub_s/SubS_UpdateFlags.s,SubS_UpdateFlags,0x8013AED4,0xB asm/non_matchings/code/z_sub_s/func_8013AF00.s,func_8013AF00,0x8013AF00,0x44 asm/non_matchings/code/z_sub_s/func_8013B010.s,func_8013B010,0x8013B010,0x2E asm/non_matchings/code/z_sub_s/func_8013B0C8.s,func_8013B0C8,0x8013B0C8,0xA2 @@ -2195,14 +2195,14 @@ asm/non_matchings/code/z_sub_s/func_8013CD64.s,func_8013CD64,0x8013CD64,0x68 asm/non_matchings/code/z_sub_s/func_8013CF04.s,func_8013CF04,0x8013CF04,0x77 asm/non_matchings/code/z_sub_s/func_8013D0E0.s,func_8013D0E0,0x8013D0E0,0x80 asm/non_matchings/code/z_sub_s/func_8013D2E0.s,func_8013D2E0,0x8013D2E0,0xC2 -asm/non_matchings/code/z_sub_s/func_8013D5E8.s,func_8013D5E8,0x8013D5E8,0x18 +asm/non_matchings/code/z_sub_s/SubS_AngleDiffLessEqual.s,SubS_AngleDiffLessEqual,0x8013D5E8,0x18 asm/non_matchings/code/z_sub_s/func_8013D648.s,func_8013D648,0x8013D648,0x11 asm/non_matchings/code/z_sub_s/func_8013D68C.s,func_8013D68C,0x8013D68C,0x25 asm/non_matchings/code/z_sub_s/func_8013D720.s,func_8013D720,0x8013D720,0x12 asm/non_matchings/code/z_sub_s/func_8013D768.s,func_8013D768,0x8013D768,0x35 asm/non_matchings/code/z_sub_s/func_8013D83C.s,func_8013D83C,0x8013D83C,0x28 -asm/non_matchings/code/z_sub_s/func_8013D8DC.s,func_8013D8DC,0x8013D8DC,0x12 -asm/non_matchings/code/z_sub_s/func_8013D924.s,func_8013D924,0x8013D924,0xF +asm/non_matchings/code/z_sub_s/SubS_IsObjectLoaded.s,SubS_IsObjectLoaded,0x8013D8DC,0x12 +asm/non_matchings/code/z_sub_s/SubS_GetObjectIndex.s,SubS_GetObjectIndex,0x8013D924,0xF asm/non_matchings/code/z_sub_s/SubS_FindActor.s,SubS_FindActor,0x8013D960,0x1A asm/non_matchings/code/z_sub_s/SubS_FillLimbRotTables.s,SubS_FillLimbRotTables,0x8013D9C8,0x72 asm/non_matchings/code/z_sub_s/func_8013DB90.s,func_8013DB90,0x8013DB90,0x2C @@ -2215,8 +2215,8 @@ asm/non_matchings/code/z_sub_s/func_8013E054.s,func_8013E054,0x8013E054,0xA asm/non_matchings/code/z_sub_s/func_8013E07C.s,func_8013E07C,0x8013E07C,0xA asm/non_matchings/code/z_sub_s/func_8013E0A4.s,func_8013E0A4,0x8013E0A4,0x49 asm/non_matchings/code/z_sub_s/SubS_ChangeAnimationBySpeedInfo.s,SubS_ChangeAnimationBySpeedInfo,0x8013E1C8,0x43 -asm/non_matchings/code/z_sub_s/func_8013E2D4.s,func_8013E2D4,0x8013E2D4,0x39 -asm/non_matchings/code/z_sub_s/func_8013E3B8.s,func_8013E3B8,0x8013E3B8,0x3E +asm/non_matchings/code/z_sub_s/SubS_StartActorCutscene.s,SubS_StartActorCutscene,0x8013E2D4,0x39 +asm/non_matchings/code/z_sub_s/SubS_FillCutscenesList.s,SubS_FillCutscenesList,0x8013E3B8,0x3E asm/non_matchings/code/z_sub_s/func_8013E4B0.s,func_8013E4B0,0x8013E4B0,0x47 asm/non_matchings/code/z_sub_s/func_8013E5CC.s,func_8013E5CC,0x8013E5CC,0x1D asm/non_matchings/code/z_sub_s/SubS_FindActorCustom.s,SubS_FindActorCustom,0x8013E640,0x42