From 018b9b7c6383824b3a26e656291e948b68a7e077 Mon Sep 17 00:00:00 2001 From: Synray <31429825+Synray@users.noreply.github.com> Date: Wed, 9 Aug 2023 22:27:31 -0700 Subject: [PATCH 1/2] Bg_Danpei_Movebg OK --- spec | 3 +- .../ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c | 194 ++++++++++++++++-- .../ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h | 6 +- 3 files changed, 182 insertions(+), 21 deletions(-) diff --git a/spec b/spec index 3e7b86be0..631426029 100644 --- a/spec +++ b/spec @@ -3466,8 +3466,7 @@ beginseg name "ovl_Bg_Danpei_Movebg" compress include "build/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.o" - include "build/data/ovl_Bg_Danpei_Movebg/ovl_Bg_Danpei_Movebg.data.o" - include "build/data/ovl_Bg_Danpei_Movebg/ovl_Bg_Danpei_Movebg.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Danpei_Movebg/ovl_Bg_Danpei_Movebg_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c b/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c index a5d01fe65..a18aa958a 100644 --- a/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c +++ b/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c @@ -5,6 +5,7 @@ */ #include "z_bg_danpei_movebg.h" +#include "objects/object_d_lift/object_d_lift.h" #define FLAGS (ACTOR_FLAG_10) @@ -14,7 +15,6 @@ void BgDanpeiMovebg_Init(Actor* thisx, PlayState* play); void BgDanpeiMovebg_Destroy(Actor* thisx, PlayState* play); void BgDanpeiMovebg_Update(Actor* thisx, PlayState* play); -#if 0 ActorInit Bg_Danpei_Movebg_InitVars = { ACTOR_BG_DANPEI_MOVEBG, ACTORCAT_BG, @@ -27,38 +27,198 @@ ActorInit Bg_Danpei_Movebg_InitVars = { (ActorFunc)NULL, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80AF753C[] = { +static u16 D_80AF7530[] = { OBJECT_D_LIFT, OBJECT_DANPEI_OBJECT }; + +static Gfx* D_80AF7534[] = { gDampeGraveBrownElevatorDL }; + +static CollisionHeader* D_80AF7538[] = { &gDampeGraveBrownElevatorCol }; + +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneScale, 1500, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 1100, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneForward, 1000, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -#endif +s32 func_80AF6DE0(PlayState* this, ActorPathing* actorPathing) { + Actor* actor; + s32 res; -extern InitChainEntry D_80AF753C[]; + actor = actorPathing->actor; + res = 0; + if (actorPathing->distSqToCurPoint < actor->speed * actor->speed) { + res = 1; + } else { + actor->world.rot.x = actorPathing->rotToCurPoint.x; + actor->world.rot.y = actorPathing->rotToCurPoint.y; + } + return res; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Danpei_Movebg/func_80AF6DE0.s") +void func_80AF6EA8(BgDanpeiMovebg*, PlayState*); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Danpei_Movebg/BgDanpeiMovebg_Init.s") +void BgDanpeiMovebg_Init(Actor* thisx, PlayState* play) { + BgDanpeiMovebg* this = THIS; + DynaPolyActor_Init(&this->dyna, 1); + this->bankIdx = SubS_GetObjectIndex(D_80AF7530[(this->dyna.actor.params >> 0xE) & 0x3], play); + if (this->bankIdx < 0) { + Actor_Kill(&this->dyna.actor); + } + this->actionFunc = func_80AF6EA8; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Danpei_Movebg/func_80AF6EA8.s") +void func_80AF70FC(BgDanpeiMovebg* this, PlayState* play); +void func_80AF74CC(Actor* thisx, PlayState* play); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Danpei_Movebg/BgDanpeiMovebg_Destroy.s") +void func_80AF6EA8(BgDanpeiMovebg* this, PlayState* play) { + Actor* thisx = (Actor*)this; + if (SubS_IsObjectLoaded(this->bankIdx, play)) { + gSegments[6] = VIRTUAL_TO_PHYSICAL(play->objectCtx.status[this->bankIdx].segment); + this->dyna.actor.objBankIndex = this->bankIdx; + this->dyna.actor.draw = func_80AF74CC; + Actor_ProcessInitChain(thisx, sInitChain); + DynaPolyActor_LoadMesh(play, &this->dyna, D_80AF7538[(thisx->params >> 0xE) & 0x3]); + this->unk_1D0 = D_80AF7534[((thisx->params >> 0xE) & 0x3)]; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Danpei_Movebg/BgDanpeiMovebg_Update.s") + /* If D_LIFT */ + if (((thisx->params >> 0xE) & 0x3) == 0) { + this->dyna.actor.gravity = 0.0f; + this->dyna.actor.speed = 1.0f; + SubS_ActorPathing_Init(play, &thisx->world.pos, thisx, &this->actorPath, play->setupPathList, + thisx->params & 0x7F, 0, 0, 0, 0); + this->actionFunc = func_80AF70FC; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Danpei_Movebg/func_80AF705C.s") +void BgDanpeiMovebg_Destroy(Actor* thisx, PlayState* play) { + BgDanpeiMovebg* this = THIS; + DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Danpei_Movebg/func_80AF70FC.s") +void BgDanpeiMovebg_Update(Actor* thisx, PlayState* play) { + BgDanpeiMovebg* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Danpei_Movebg/func_80AF71FC.s") + this->actionFunc(this, play); + this->unk_1CE = this->unk_1CC; + this->unk_1CC &= ~1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Danpei_Movebg/func_80AF72F8.s") +u16 func_80AF705C(BgDanpeiMovebg* this, u16 unk_1CC) { + u16 v1 = unk_1CC & ~0x1C; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Danpei_Movebg/func_80AF7354.s") + if (DynaPolyActor_IsActorOnTop(&this->dyna) && (this->unk_1CC & 1)) { + v1 |= 4; + } + if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { + if (gSaveContext.save.playerForm == 3) { + v1 |= 8; + } else { + v1 |= 0x10; + } + } + return v1; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Danpei_Movebg/func_80AF746C.s") +u16 func_80AF705C(BgDanpeiMovebg*, u16); +void func_80AF71FC(BgDanpeiMovebg*, PlayState*); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Danpei_Movebg/func_80AF74CC.s") +void func_80AF70FC(BgDanpeiMovebg* this, PlayState* play) { + this->unk_1CC = func_80AF705C(this, this->unk_1CC); + if (this->unk_1CC & 0xC) { + if (this->unk_1CC & 4) { + this->unk_1CC |= 2; + } + this->actionFunc = func_80AF71FC; + return; + } + if (this->unk_1CC & 0x10) { + if (!(this->unk_1CE & 0x10)) { + Actor_PlaySfx(&this->dyna.actor, 0x2979U); + } + Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 8.0f, 1.0f, 2.0f, 0.01f); + return; + } + if (this->unk_1CE & 0x10) { + Actor_PlaySfx(&this->dyna.actor, 0x297AU); + } + Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f, 2.0f, 0.01f); +} + +s32 func_80AF6DE0(PlayState*, ActorPathing*); +void func_80AF72F8(BgDanpeiMovebg*, PlayState*); +void func_80AF7354(BgDanpeiMovebg*, PlayState*); +void func_80AF746C(BgDanpeiMovebg*, PlayState*); + +void func_80AF71FC(BgDanpeiMovebg* this, PlayState* play) { + SubS_ActorPathing_Update(play, &this->actorPath, SubS_ActorPathing_ComputePointInfo, func_80AF6DE0, + SubS_ActorPathing_MoveWithoutGravityReverse, SubS_ActorPathing_SetNextPoint); + Actor_PlaySfx_Flagged(&this->dyna.actor, 0x2103U); + if (this->actorPath.flags & 0x80) { + if (this->unk_1CC & 2) { + this->unk_1CC &= ~0x2; + } + this->actionFunc = func_80AF72F8; + return; + } + this->unk_1CC = func_80AF705C(this, this->unk_1CC); + if ((this->unk_1CC & 0x10) || ((this->unk_1CC & 0xC) == 0xC)) { + this->actionFunc = func_80AF746C; + return; + } + if (!(this->unk_1CC & 0x1C)) { + this->actorPath.flags |= 8; + this->dyna.actor.speed = 2.0f; + this->actionFunc = func_80AF7354; + } +} + +void func_80AF72F8(BgDanpeiMovebg* this, PlayState* play) { + this->unk_1CC = func_80AF705C(this, this->unk_1CC); + if (!(this->unk_1CC & 0x1C)) { + this->actorPath.flags |= 8; + this->dyna.actor.speed = 2.0f; + this->actionFunc = func_80AF7354; + } +} + +void func_80AF7354(BgDanpeiMovebg* this, PlayState* play) { + Actor_PlaySfx_Flagged(&this->dyna.actor, 0x2103U); + this->unk_1CC = func_80AF705C(this, this->unk_1CC); + SubS_ActorPathing_Update(play, &this->actorPath, SubS_ActorPathing_ComputePointInfo, func_80AF6DE0, + SubS_ActorPathing_MoveWithoutGravityReverse, SubS_ActorPathing_SetNextPoint); + if ((this->unk_1CC & 0x10) || (this->unk_1CC & 0xC) == 0xC) { + this->actionFunc = func_80AF746C; + } else if ((this->unk_1CC & 0xC) && (this->unk_1CC & 0xC) != 0xC) { + this->actorPath.flags &= 0xFFF7; + this->dyna.actor.speed = 1.0f; + if (this->unk_1CC & 4) { + this->unk_1CC = this->unk_1CC | 2; + } + this->actionFunc = func_80AF71FC; + } + if (this->actorPath.flags & 0x80) { + this->actorPath.flags = this->actorPath.flags & 0xFFF7; + this->unk_1CC &= 0xFFFD; + this->dyna.actor.speed = 1.0f; + this->actionFunc = func_80AF70FC; + } +} + +void func_80AF746C(BgDanpeiMovebg* this, PlayState* arg1) { + this->unk_1CC = func_80AF705C(this, this->unk_1CC); + if (!(this->unk_1CC & 0x18)) { + if (this->actorPath.flags & 8) { + this->actionFunc = func_80AF7354; + } else { + this->actionFunc = func_80AF71FC; + } + } +} + +void func_80AF74CC(Actor* thisx, PlayState* play) { + BgDanpeiMovebg* this = THIS; + if (this->unk_1D0 != NULL) { + Gfx_DrawDListOpa(play, this->unk_1D0); + } +} diff --git a/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h b/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h index c99bb813f..7719bb518 100644 --- a/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h +++ b/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h @@ -10,9 +10,11 @@ typedef void (*BgDanpeiMovebgActionFunc)(struct BgDanpeiMovebg*, PlayState*); typedef struct BgDanpeiMovebg { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ BgDanpeiMovebgActionFunc actionFunc; - /* 0x160 */ char unk_160[0x6C]; + /* 0x160 */ ActorPathing actorPath; /* 0x1CC */ u16 unk_1CC; - /* 0x1CE */ char unk_1CE[0xA]; + /* 0x1CE */ u16 unk_1CE; + /* 0x1D0 */ Gfx* unk_1D0; + /* 0x1D4 */ s8 bankIdx; } BgDanpeiMovebg; // size = 0x1D8 #endif // Z_BG_DANPEI_MOVEBG_H From 2ae90ab393e8d953e45ff8f8d6c69e90407f7dc1 Mon Sep 17 00:00:00 2001 From: Synray <31429825+Synray@users.noreply.github.com> Date: Thu, 10 Aug 2023 16:33:47 -0700 Subject: [PATCH 2/2] Cleanup --- .../ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c | 142 +++++++++--------- .../ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h | 9 +- src/overlays/actors/ovl_En_Tk/z_en_tk.c | 4 +- 3 files changed, 75 insertions(+), 80 deletions(-) diff --git a/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c b/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c index a18aa958a..109b9c4db 100644 --- a/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c +++ b/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.c @@ -15,6 +15,15 @@ void BgDanpeiMovebg_Init(Actor* thisx, PlayState* play); void BgDanpeiMovebg_Destroy(Actor* thisx, PlayState* play); void BgDanpeiMovebg_Update(Actor* thisx, PlayState* play); +void func_80AF6EA8(BgDanpeiMovebg* this, PlayState* play); +void func_80AF70FC(BgDanpeiMovebg* this, PlayState* play); +void func_80AF74CC(Actor* thisx, PlayState* play); +u16 func_80AF705C(BgDanpeiMovebg* this, u16 flags); +void func_80AF71FC(BgDanpeiMovebg* this, PlayState* play); +void func_80AF72F8(BgDanpeiMovebg* this, PlayState* play); +void func_80AF7354(BgDanpeiMovebg* this, PlayState* play); +void func_80AF746C(BgDanpeiMovebg* this, PlayState* play); + ActorInit Bg_Danpei_Movebg_InitVars = { ACTOR_BG_DANPEI_MOVEBG, ACTORCAT_BG, @@ -55,21 +64,16 @@ s32 func_80AF6DE0(PlayState* this, ActorPathing* actorPathing) { return res; } -void func_80AF6EA8(BgDanpeiMovebg*, PlayState*); - void BgDanpeiMovebg_Init(Actor* thisx, PlayState* play) { BgDanpeiMovebg* this = THIS; DynaPolyActor_Init(&this->dyna, 1); - this->bankIdx = SubS_GetObjectIndex(D_80AF7530[(this->dyna.actor.params >> 0xE) & 0x3], play); + this->bankIdx = SubS_GetObjectIndex(D_80AF7530[BGDANPEIMOVEBG_GET_TYPE(thisx)], play); if (this->bankIdx < 0) { Actor_Kill(&this->dyna.actor); } this->actionFunc = func_80AF6EA8; } -void func_80AF70FC(BgDanpeiMovebg* this, PlayState* play); -void func_80AF74CC(Actor* thisx, PlayState* play); - void func_80AF6EA8(BgDanpeiMovebg* this, PlayState* play) { Actor* thisx = (Actor*)this; if (SubS_IsObjectLoaded(this->bankIdx, play)) { @@ -77,15 +81,15 @@ void func_80AF6EA8(BgDanpeiMovebg* this, PlayState* play) { this->dyna.actor.objBankIndex = this->bankIdx; this->dyna.actor.draw = func_80AF74CC; Actor_ProcessInitChain(thisx, sInitChain); - DynaPolyActor_LoadMesh(play, &this->dyna, D_80AF7538[(thisx->params >> 0xE) & 0x3]); - this->unk_1D0 = D_80AF7534[((thisx->params >> 0xE) & 0x3)]; + DynaPolyActor_LoadMesh(play, &this->dyna, D_80AF7538[BGDANPEIMOVEBG_GET_TYPE(thisx)]); + this->dList = D_80AF7534[BGDANPEIMOVEBG_GET_TYPE(thisx)]; /* If D_LIFT */ - if (((thisx->params >> 0xE) & 0x3) == 0) { + if (BGDANPEIMOVEBG_GET_TYPE(thisx) == 0) { this->dyna.actor.gravity = 0.0f; this->dyna.actor.speed = 1.0f; SubS_ActorPathing_Init(play, &thisx->world.pos, thisx, &this->actorPath, play->setupPathList, - thisx->params & 0x7F, 0, 0, 0, 0); + BGDANPEIMOVEBG_GET_PATH_INDEX(thisx), 0, 0, 0, 0); this->actionFunc = func_80AF70FC; } } @@ -100,115 +104,103 @@ void BgDanpeiMovebg_Update(Actor* thisx, PlayState* play) { BgDanpeiMovebg* this = THIS; this->actionFunc(this, play); - this->unk_1CE = this->unk_1CC; - this->unk_1CC &= ~1; + this->prevFlags = this->flags; + this->flags &= ~1; } -u16 func_80AF705C(BgDanpeiMovebg* this, u16 unk_1CC) { - u16 v1 = unk_1CC & ~0x1C; +u16 func_80AF705C(BgDanpeiMovebg* this, u16 flags) { + u16 newFlags = flags & ~0x1C; - if (DynaPolyActor_IsActorOnTop(&this->dyna) && (this->unk_1CC & 1)) { - v1 |= 4; + if (DynaPolyActor_IsActorOnTop(&this->dyna) && (this->flags & 1)) { + newFlags |= 4; } if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { - if (gSaveContext.save.playerForm == 3) { - v1 |= 8; + if (gSaveContext.save.playerForm == PLAYER_FORM_DEKU) { + newFlags |= 8; } else { - v1 |= 0x10; + newFlags |= 0x10; } } - return v1; + return newFlags; } -u16 func_80AF705C(BgDanpeiMovebg*, u16); -void func_80AF71FC(BgDanpeiMovebg*, PlayState*); - void func_80AF70FC(BgDanpeiMovebg* this, PlayState* play) { - this->unk_1CC = func_80AF705C(this, this->unk_1CC); - if (this->unk_1CC & 0xC) { - if (this->unk_1CC & 4) { - this->unk_1CC |= 2; + this->flags = func_80AF705C(this, this->flags); + if (this->flags & 0xC) { + if (this->flags & 4) { + this->flags |= 2; } this->actionFunc = func_80AF71FC; - return; - } - if (this->unk_1CC & 0x10) { - if (!(this->unk_1CE & 0x10)) { - Actor_PlaySfx(&this->dyna.actor, 0x2979U); + } else if (this->flags & 0x10) { + if (!(this->prevFlags & 0x10)) { + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_SINK_WOOD_FLOOR); } Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y - 8.0f, 1.0f, 2.0f, 0.01f); - return; + } else { + if (this->prevFlags & 0x10) { + Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_REBOUND_WOOD_FLOOR); + } + Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f, 2.0f, 0.01f); } - if (this->unk_1CE & 0x10) { - Actor_PlaySfx(&this->dyna.actor, 0x297AU); - } - Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 1.0f, 2.0f, 0.01f); } -s32 func_80AF6DE0(PlayState*, ActorPathing*); -void func_80AF72F8(BgDanpeiMovebg*, PlayState*); -void func_80AF7354(BgDanpeiMovebg*, PlayState*); -void func_80AF746C(BgDanpeiMovebg*, PlayState*); - void func_80AF71FC(BgDanpeiMovebg* this, PlayState* play) { SubS_ActorPathing_Update(play, &this->actorPath, SubS_ActorPathing_ComputePointInfo, func_80AF6DE0, SubS_ActorPathing_MoveWithoutGravityReverse, SubS_ActorPathing_SetNextPoint); - Actor_PlaySfx_Flagged(&this->dyna.actor, 0x2103U); - if (this->actorPath.flags & 0x80) { - if (this->unk_1CC & 2) { - this->unk_1CC &= ~0x2; + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); + if (this->actorPath.flags & ACTOR_PATHING_REACHED_END_TEMPORARY) { + if (this->flags & 2) { + this->flags &= ~0x2; } this->actionFunc = func_80AF72F8; - return; - } - this->unk_1CC = func_80AF705C(this, this->unk_1CC); - if ((this->unk_1CC & 0x10) || ((this->unk_1CC & 0xC) == 0xC)) { - this->actionFunc = func_80AF746C; - return; - } - if (!(this->unk_1CC & 0x1C)) { - this->actorPath.flags |= 8; - this->dyna.actor.speed = 2.0f; - this->actionFunc = func_80AF7354; + } else { + this->flags = func_80AF705C(this, this->flags); + if ((this->flags & 0x10) || (this->flags & 0xC) == 0xC) { + this->actionFunc = func_80AF746C; + } else if ((this->flags & 0x1C) == 0) { + this->actorPath.flags |= ACTOR_PATHING_MOVE_BACKWARDS; + this->dyna.actor.speed = 2.0f; + this->actionFunc = func_80AF7354; + } } } void func_80AF72F8(BgDanpeiMovebg* this, PlayState* play) { - this->unk_1CC = func_80AF705C(this, this->unk_1CC); - if (!(this->unk_1CC & 0x1C)) { - this->actorPath.flags |= 8; + this->flags = func_80AF705C(this, this->flags); + if (!(this->flags & 0x1C)) { + this->actorPath.flags |= ACTOR_PATHING_MOVE_BACKWARDS; this->dyna.actor.speed = 2.0f; this->actionFunc = func_80AF7354; } } void func_80AF7354(BgDanpeiMovebg* this, PlayState* play) { - Actor_PlaySfx_Flagged(&this->dyna.actor, 0x2103U); - this->unk_1CC = func_80AF705C(this, this->unk_1CC); + Actor_PlaySfx_Flagged(&this->dyna.actor, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); + this->flags = func_80AF705C(this, this->flags); SubS_ActorPathing_Update(play, &this->actorPath, SubS_ActorPathing_ComputePointInfo, func_80AF6DE0, SubS_ActorPathing_MoveWithoutGravityReverse, SubS_ActorPathing_SetNextPoint); - if ((this->unk_1CC & 0x10) || (this->unk_1CC & 0xC) == 0xC) { + if ((this->flags & 0x10) || (this->flags & 0xC) == 0xC) { this->actionFunc = func_80AF746C; - } else if ((this->unk_1CC & 0xC) && (this->unk_1CC & 0xC) != 0xC) { - this->actorPath.flags &= 0xFFF7; + } else if ((this->flags & 0xC) && (this->flags & 0xC) != 0xC) { + this->actorPath.flags &= ~ACTOR_PATHING_MOVE_BACKWARDS; this->dyna.actor.speed = 1.0f; - if (this->unk_1CC & 4) { - this->unk_1CC = this->unk_1CC | 2; + if (this->flags & 4) { + this->flags |= 2; } this->actionFunc = func_80AF71FC; } - if (this->actorPath.flags & 0x80) { - this->actorPath.flags = this->actorPath.flags & 0xFFF7; - this->unk_1CC &= 0xFFFD; + if (this->actorPath.flags & ACTOR_PATHING_REACHED_END_TEMPORARY) { + this->actorPath.flags &= ~ACTOR_PATHING_MOVE_BACKWARDS; + this->flags &= ~2; this->dyna.actor.speed = 1.0f; this->actionFunc = func_80AF70FC; } } void func_80AF746C(BgDanpeiMovebg* this, PlayState* arg1) { - this->unk_1CC = func_80AF705C(this, this->unk_1CC); - if (!(this->unk_1CC & 0x18)) { - if (this->actorPath.flags & 8) { + this->flags = func_80AF705C(this, this->flags); + if (!(this->flags & 0x18)) { + if (this->actorPath.flags & ACTOR_PATHING_MOVE_BACKWARDS) { this->actionFunc = func_80AF7354; } else { this->actionFunc = func_80AF71FC; @@ -218,7 +210,7 @@ void func_80AF746C(BgDanpeiMovebg* this, PlayState* arg1) { void func_80AF74CC(Actor* thisx, PlayState* play) { BgDanpeiMovebg* this = THIS; - if (this->unk_1D0 != NULL) { - Gfx_DrawDListOpa(play, this->unk_1D0); + if (this->dList != NULL) { + Gfx_DrawDListOpa(play, this->dList); } } diff --git a/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h b/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h index 7719bb518..bd57a4822 100644 --- a/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h +++ b/src/overlays/actors/ovl_Bg_Danpei_Movebg/z_bg_danpei_movebg.h @@ -7,13 +7,16 @@ struct BgDanpeiMovebg; typedef void (*BgDanpeiMovebgActionFunc)(struct BgDanpeiMovebg*, PlayState*); +#define BGDANPEIMOVEBG_GET_PATH_INDEX(thisx) ((thisx)->params & 0x7F) +#define BGDANPEIMOVEBG_GET_TYPE(thisx) (((thisx)->params >> 0xE) & 3) + typedef struct BgDanpeiMovebg { /* 0x000 */ DynaPolyActor dyna; /* 0x15C */ BgDanpeiMovebgActionFunc actionFunc; /* 0x160 */ ActorPathing actorPath; - /* 0x1CC */ u16 unk_1CC; - /* 0x1CE */ u16 unk_1CE; - /* 0x1D0 */ Gfx* unk_1D0; + /* 0x1CC */ u16 flags; + /* 0x1CE */ u16 prevFlags; + /* 0x1D0 */ Gfx* dList; /* 0x1D4 */ s8 bankIdx; } BgDanpeiMovebg; // size = 0x1D8 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 ccc5e4489..17b7c853d 100644 --- a/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -1297,8 +1297,8 @@ void EnTk_Update(Actor* thisx, PlayState* play) { if (platform != NULL) { if (platform->dyna.actor.id == ACTOR_BG_DANPEI_MOVEBG) { - platform->unk_1CC |= 1; - if (platform->unk_1CC & 2) { + platform->flags |= 1; + if (platform->flags & 2) { this->unk_2CA |= 1; } }