diff options
| author | Jordan Longstaff <JordanLongstaff@users.noreply.github.com> | 2026-04-26 09:59:30 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-26 09:59:30 -0400 |
| commit | 354a8637e1f0eba371ec39b135e1e09f7b7bfb93 (patch) | |
| tree | 328594e94afdfe8ad5ba69574eb22576ef0d3ecf /src | |
| parent | 57e41795f53f8d43d67e94f89b1b532e30cf8aec (diff) | |
Bombers Part 2: Guard (#1848)
* Bombers Part 2: Guard
* Fix errors
* Re-rename functions
Diffstat (limited to 'src')
| -rw-r--r-- | src/code/z_elf_message.c | 2 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c | 161 | ||||
| -rw-r--r-- | src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h | 20 |
3 files changed, 94 insertions, 89 deletions
diff --git a/src/code/z_elf_message.c b/src/code/z_elf_message.c index cd486a8a4..22b99a30c 100644 --- a/src/code/z_elf_message.c +++ b/src/code/z_elf_message.c @@ -90,7 +90,7 @@ u16 QuestHint_GetTatlTextId(PlayState* play) { return 0x241; } - if (CHECK_WEEKEVENTREG(WEEKEVENTREG_86_02) || CHECK_WEEKEVENTREG(WEEKEVENTREG_73_40)) { + if (CHECK_WEEKEVENTREG(WEEKEVENTREG_TALKED_TO_BOMBERS_GUARD) || CHECK_WEEKEVENTREG(WEEKEVENTREG_73_40)) { return 0x23F; } diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c index e5c15c55c..b51c1e2af 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.c @@ -6,6 +6,12 @@ #include "z_en_bombers2.h" +typedef enum { + /* 0 */ ENBOMBERS2_ACTION_WAITING, + /* 1 */ ENBOMBERS2_ACTION_TALKING, + /* 2 */ ENBOMBERS2_ACTION_WALKING +} EnBombers2Action; + #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY) void EnBombers2_Init(Actor* thisx, PlayState* play); @@ -13,12 +19,12 @@ void EnBombers2_Destroy(Actor* thisx, PlayState* play); void EnBombers2_Update(Actor* thisx, PlayState* play); void EnBombers2_Draw(Actor* thisx, PlayState* play); -void func_80C04BA0(EnBombers2* this, PlayState* play); -void func_80C04D8C(EnBombers2* this, PlayState* play); -void func_80C0520C(EnBombers2* this, PlayState* play); -void func_80C04B40(EnBombers2* this); -void func_80C04D00(EnBombers2* this); -void func_80C050B8(EnBombers2* this, PlayState* play); +void EnBombers2_AwaitTalk(EnBombers2* this, PlayState* play); +void EnBombers2_Talking(EnBombers2* this, PlayState* play); +void EnBombers2_Walking(EnBombers2* this, PlayState* play); +void EnBombers2_SetupAwaitTalk(EnBombers2* this); +void EnBombers2_SetupTalking(EnBombers2* this); +void EnBombers2_StartWalking(EnBombers2* this, PlayState* play); ActorProfile En_Bombers2_Profile = { /**/ ACTOR_EN_BOMBERS2, @@ -118,14 +124,14 @@ void EnBombers2_Init(Actor* thisx, PlayState* play) { (gSaveContext.save.entrance == ENTRANCE(EAST_CLOCK_TOWN, 2))) { this->actor.world.pos.x += Math_SinS(this->actor.home.rot.y + 0xC100) * 50.0f; cos = Math_CosS(this->actor.home.rot.y + 0xC100) * 50.0f; - this->unk_2AC = true; + this->hasMovedAside = true; this->actor.world.pos.z += cos; } this->csId = this->actor.csId; if (this->csId == 0) { Actor_Kill(&this->actor); } - func_80C04B40(this); + EnBombers2_SetupAwaitTalk(this); } void EnBombers2_Destroy(Actor* thisx, PlayState* play) { @@ -144,17 +150,17 @@ void EnBombers2_ChangeAnim(EnBombers2* this, s32 animIndex, f32 playSpeed) { sAnimationModes[this->animIndex], -10.0f); } -void func_80C04B40(EnBombers2* this) { - if (!this->unk_2AC) { +void EnBombers2_SetupAwaitTalk(EnBombers2* this) { + if (!this->hasMovedAside) { EnBombers2_ChangeAnim(this, ENBOMBERS2_ANIM_TAUNT, 1.0f); } else { EnBombers2_ChangeAnim(this, ENBOMBERS2_ANIM_IDLE, 1.0f); } - this->unk_2C0 = 0; - this->actionFunc = func_80C04BA0; + this->action = ENBOMBERS2_ACTION_WAITING; + this->actionFunc = EnBombers2_AwaitTalk; } -void func_80C04BA0(EnBombers2* this, PlayState* play) { +void EnBombers2_AwaitTalk(EnBombers2* this, PlayState* play) { s32 yawDiffAbs; s16 yawDiff; Player* player; @@ -179,7 +185,7 @@ void func_80C04BA0(EnBombers2* this, PlayState* play) { default: break; } - if (this->unk_2AC) { + if (this->hasMovedAside) { this->textIdIndex = 7; } this->actor.textId = sTextIds[this->textIdIndex]; @@ -189,9 +195,9 @@ void func_80C04BA0(EnBombers2* this, PlayState* play) { } if (Actor_TalkOfferAccepted(&this->actor, &play->state)) { - this->unk_2B6 = this->actor.world.rot.y; - SET_WEEKEVENTREG(WEEKEVENTREG_86_02); - func_80C04D00(this); + this->bodyRotTargetAngle = this->actor.world.rot.y; + SET_WEEKEVENTREG(WEEKEVENTREG_TALKED_TO_BOMBERS_GUARD); + EnBombers2_SetupTalking(this); return; } if (yawDiffAbs < 0x3BB5) { @@ -199,42 +205,42 @@ void func_80C04BA0(EnBombers2* this, PlayState* play) { } } -void func_80C04D00(EnBombers2* this) { +void EnBombers2_SetupTalking(EnBombers2* this) { if ((this->textIdIndex == 0) || (this->textIdIndex == 1)) { EnBombers2_ChangeAnim(this, ENBOMBERS2_ANIM_ARM_SWIPE, 1.0f); } else { EnBombers2_ChangeAnim(this, ENBOMBERS2_ANIM_TALK_HANDS_ON_HIPS, 1.0f); } - this->unk_2A8 = 0; - if (this->unk_2AC) { + this->animPhase = 0; + if (this->hasMovedAside) { EnBombers2_ChangeAnim(this, ENBOMBERS2_ANIM_SALUTE, 1.0f); } - this->unk_2C0 = 1; - this->actionFunc = func_80C04D8C; + this->action = ENBOMBERS2_ACTION_TALKING; + this->actionFunc = EnBombers2_Talking; } -void func_80C04D8C(EnBombers2* this, PlayState* play) { +void EnBombers2_Talking(EnBombers2* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; - if (!this->unk_2AC && (curFrame >= this->lastAnimFrame)) { - if (!(this->unk_2A8 & 1)) { + if (!this->hasMovedAside && (curFrame >= this->lastAnimFrame)) { + if (!(this->animPhase & 1)) { EnBombers2_ChangeAnim(this, ENBOMBERS2_ANIM_TALK_HANDS_ON_HIPS, 1.0f); } else { EnBombers2_ChangeAnim(this, ENBOMBERS2_ANIM_ARM_SWIPE, 1.0f); } - this->unk_2A8++; - this->unk_2A8 &= 1; + this->animPhase++; + this->animPhase &= 1; } switch (player->transformation) { case PLAYER_FORM_HUMAN: - this->unk_28E = -0xFA0; + this->headRotTargetZ = -0xFA0; break; case PLAYER_FORM_GORON: case PLAYER_FORM_ZORA: - this->unk_28E = -0x1770; + this->headRotTargetZ = -0x1770; break; default: @@ -267,9 +273,9 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { } } if (Text_GetFaceReaction(play, FACE_REACTION_SET_BOMBERS_HIDEOUT_GUARD) != 0) { - this->unk_28E = 0; + this->headRotTargetZ = 0; Message_CloseTextbox(play); - func_80C04B40(this); + EnBombers2_SetupAwaitTalk(this); } else { s32 j; @@ -278,9 +284,9 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { case 1: case 5: case 7: - this->unk_28E = 0; + this->headRotTargetZ = 0; Message_CloseTextbox(play); - func_80C04B40(this); + EnBombers2_SetupAwaitTalk(this); break; case 2: @@ -310,7 +316,7 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { case 6: play->msgCtx.msgLength = 0; - func_80C050B8(this, play); + EnBombers2_StartWalking(this, play); break; default: @@ -320,28 +326,28 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) { } } -void func_80C050B8(EnBombers2* this, PlayState* play) { +void EnBombers2_StartWalking(EnBombers2* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 homeYawToPlayer; EnBombers2_ChangeAnim(this, ENBOMBERS2_ANIM_WALK, 1.0f); - this->unk_2A8 = 0; + this->animPhase = 0; homeYawToPlayer = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); - Math_Vec3f_Copy(&this->unk_29C, &this->actor.world.pos); + Math_Vec3f_Copy(&this->walkTarget, &this->actor.world.pos); if (this->actor.home.rot.y < homeYawToPlayer) { - this->unk_29C.x += Math_SinS(this->actor.home.rot.y + 0xC100) * 50.0f; - this->unk_29C.z += Math_CosS(this->actor.home.rot.y + 0xC100) * 50.0f; + this->walkTarget.x += Math_SinS(this->actor.home.rot.y + 0xC100) * 50.0f; + this->walkTarget.z += Math_CosS(this->actor.home.rot.y + 0xC100) * 50.0f; } else { - this->unk_29C.x += Math_SinS(this->actor.home.rot.y + 0x3F00) * 50.0f; - this->unk_29C.z += Math_CosS(this->actor.home.rot.y + 0x3F00) * 50.0f; + this->walkTarget.x += Math_SinS(this->actor.home.rot.y + 0x3F00) * 50.0f; + this->walkTarget.z += Math_CosS(this->actor.home.rot.y + 0x3F00) * 50.0f; } - this->unk_2B6 = Math_Vec3f_Yaw(&this->actor.home.pos, &this->unk_29C); - this->unk_2C0 = 2; - this->actionFunc = func_80C0520C; + this->bodyRotTargetAngle = Math_Vec3f_Yaw(&this->actor.home.pos, &this->walkTarget); + this->action = ENBOMBERS2_ACTION_WALKING; + this->actionFunc = EnBombers2_Walking; } -void func_80C0520C(EnBombers2* this, PlayState* play) { - if (this->unk_2A8 == 0) { +void EnBombers2_Walking(EnBombers2* this, PlayState* play) { + if (this->animPhase == 0) { if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) { CutsceneManager_Stop(CS_ID_GLOBAL_TALK); CutsceneManager_Queue(this->csId); @@ -349,31 +355,31 @@ void func_80C0520C(EnBombers2* this, PlayState* play) { CutsceneManager_Queue(this->csId); } else { CutsceneManager_StartWithPlayerCs(this->csId, &this->actor); - this->unk_2A8 = 1; + this->animPhase = 1; } } else { - Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_2B6, 1, 0xBB8, 0); - if ((fabsf(this->unk_29C.x - this->actor.world.pos.x) < 3.0f) && - (fabsf(this->unk_29C.z - this->actor.world.pos.z) < 3.0f)) { - this->unk_2B6 = this->actor.yawTowardsPlayer; + Math_SmoothStepToS(&this->actor.world.rot.y, this->bodyRotTargetAngle, 1, 0xBB8, 0); + if ((fabsf(this->walkTarget.x - this->actor.world.pos.x) < 3.0f) && + (fabsf(this->walkTarget.z - this->actor.world.pos.z) < 3.0f)) { + this->bodyRotTargetAngle = this->actor.yawTowardsPlayer; this->actor.speed = 0.0f; if (fabsf(this->actor.world.rot.y - this->actor.yawTowardsPlayer) < 100.0f) { Message_CloseTextbox(play); this->talkState = TEXT_STATE_EVENT; this->textIdIndex = 7; EnBombers2_ChangeAnim(this, ENBOMBERS2_ANIM_SALUTE, 1.0f); - this->unk_2A8 = 0; - this->unk_2C0 = 1; + this->animPhase = 0; + this->action = ENBOMBERS2_ACTION_TALKING; SET_WEEKEVENTREG(WEEKEVENTREG_ENTERED_BOMBERS_CODE); CutsceneManager_Stop(this->csId); - this->unk_2AC = true; + this->hasMovedAside = true; this->actor.textId = sTextIds[this->textIdIndex]; Message_StartTextbox(play, this->actor.textId, &this->actor); - this->actionFunc = func_80C04D8C; + this->actionFunc = EnBombers2_Talking; } } else { - Math_ApproachF(&this->actor.world.pos.x, this->unk_29C.x, 0.3f, 1.0f); - Math_ApproachF(&this->actor.world.pos.z, this->unk_29C.z, 0.3f, 1.0f); + Math_ApproachF(&this->actor.world.pos.x, this->walkTarget.x, 0.3f, 1.0f); + Math_ApproachF(&this->actor.world.pos.z, this->walkTarget.z, 0.3f, 1.0f); } } } @@ -381,7 +387,7 @@ void func_80C0520C(EnBombers2* this, PlayState* play) { void EnBombers2_Update(Actor* thisx, PlayState* play) { s32 pad; EnBombers2* this = (EnBombers2*)thisx; - Vec3f sp34; + Vec3f tempPos; s32 yawDiffAbs; SkelAnime_Update(&this->skelAnime); @@ -394,16 +400,15 @@ void EnBombers2_Update(Actor* thisx, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EV_BOMBERS_WALK); } this->actor.shape.rot.y = this->actor.world.rot.y; - if (this->unk_2C0 != 2) { - + if (this->action != ENBOMBERS2_ACTION_WALKING) { yawDiffAbs = ABS_ALT((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y)); - this->unk_290 = 0; + this->headRotTargetX = 0; if (yawDiffAbs < 0x3A98) { - this->unk_290 = this->actor.yawTowardsPlayer - this->actor.world.rot.y; - if (this->unk_290 >= 0x2711) { - this->unk_290 = 0x2710; - } else if (this->unk_290 < -0x2710) { - this->unk_290 = -0x2710; + this->headRotTargetX = this->actor.yawTowardsPlayer - this->actor.world.rot.y; + if (this->headRotTargetX >= 0x2711) { + this->headRotTargetX = 0x2710; + } else if (this->headRotTargetX < -0x2710) { + this->headRotTargetX = -0x2710; } } } @@ -411,19 +416,19 @@ void EnBombers2_Update(Actor* thisx, PlayState* play) { Actor_SetScale(&this->actor, 0.008f); this->actionFunc(this, play); Actor_MoveWithGravity(&this->actor); - Math_SmoothStepToS(&this->unk_28A, this->unk_290, 1, 0xBB8, 0); - Math_SmoothStepToS(&this->unk_288, this->unk_28E, 1, 0xBB8, 0); - if (this->unk_2BE == 0) { + Math_SmoothStepToS(&this->headRotX, this->headRotTargetX, 1, 0xBB8, 0); + Math_SmoothStepToS(&this->headRotZ, this->headRotTargetZ, 1, 0xBB8, 0); + if (this->blinkTimer == 0) { this->eyeIndex += 1; if (this->eyeIndex >= 3) { this->eyeIndex = 0; - this->unk_2BE = TRUNCF_BINANG(Rand_ZeroFloat(60.0f)) + 0x14; + this->blinkTimer = TRUNCF_BINANG(Rand_ZeroFloat(60.0f)) + 0x14; } } - Math_Vec3f_Copy(&sp34, &this->actor.world.pos); - if (!this->unk_2AC) { - this->actor.world.pos.x = sp34.x + Math_SinS(this->actor.world.rot.y + 0x8000) * 26.0f; - this->actor.world.pos.z = sp34.z + Math_CosS(this->actor.world.rot.y + 0x8000) * 26.0f; + Math_Vec3f_Copy(&tempPos, &this->actor.world.pos); + if (!this->hasMovedAside) { + this->actor.world.pos.x = tempPos.x + Math_SinS(this->actor.world.rot.y + 0x8000) * 26.0f; + this->actor.world.pos.z = tempPos.z + Math_CosS(this->actor.world.rot.y + 0x8000) * 26.0f; this->collider.dim.radius = 35; this->collider.dim.height = 30; } else { @@ -432,12 +437,12 @@ void EnBombers2_Update(Actor* thisx, PlayState* play) { } Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); - if (!this->unk_2AC) { + if (!this->hasMovedAside) { Actor_UpdateBgCheckInfo(play, &this->actor, 20.0f, 20.0f, 50.0f, UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); } - Math_Vec3f_Copy(&this->actor.world.pos, &sp34); + Math_Vec3f_Copy(&this->actor.world.pos, &tempPos); } s32 EnBombers2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, Actor* thisx) { @@ -447,8 +452,8 @@ s32 EnBombers2_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec rot->x += this->unk_296; } if (limbIndex == OBJECT_CS_LIMB_11) { - rot->x += this->unk_28A; - rot->z += this->unk_288; + rot->x += this->headRotX; + rot->z += this->headRotZ; } if ((limbIndex == OBJECT_CS_LIMB_0F) || (limbIndex == OBJECT_CS_LIMB_13) || (limbIndex == OBJECT_CS_LIMB_14)) { *dList = NULL; diff --git a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h index 438ee827f..b15f7029a 100644 --- a/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h +++ b/src/overlays/actors/ovl_En_Bombers2/z_en_bombers2.h @@ -14,26 +14,26 @@ typedef struct EnBombers2 { /* 0x188 */ Vec3s jointTable[OBJECT_CS_LIMB_MAX]; /* 0x206 */ Vec3s morphTable[OBJECT_CS_LIMB_MAX]; /* 0x284 */ EnBombers2ActionFunc actionFunc; - /* 0x288 */ s16 unk_288; - /* 0x28A */ s16 unk_28A; + /* 0x288 */ s16 headRotZ; + /* 0x28A */ s16 headRotX; /* 0x28C */ UNK_TYPE1 pad_28C[2]; - /* 0x28E */ s16 unk_28E; - /* 0x290 */ s16 unk_290; + /* 0x28E */ s16 headRotTargetZ; + /* 0x290 */ s16 headRotTargetX; /* 0x292 */ UNK_TYPE1 pad_292[4]; /* 0x296 */ s16 unk_296; /* 0x298 */ UNK_TYPE1 pad_298[4]; - /* 0x29C */ Vec3f unk_29C; - /* 0x2A8 */ s32 unk_2A8; - /* 0x2AC */ u8 unk_2AC; + /* 0x29C */ Vec3f walkTarget; + /* 0x2A8 */ s32 animPhase; + /* 0x2AC */ u8 hasMovedAside; /* 0x2AE */ s16 animIndex; /* 0x2B0 */ s16 csId; /* 0x2B2 */ s16 unk_2B2; /* 0x2B4 */ s16 unk_2B4; - /* 0x2B6 */ s16 unk_2B6; + /* 0x2B6 */ s16 bodyRotTargetAngle; /* 0x2B8 */ f32 lastAnimFrame; /* 0x2BC */ s16 eyeIndex; - /* 0x2BE */ s16 unk_2BE; - /* 0x2C0 */ s16 unk_2C0; + /* 0x2BE */ s16 blinkTimer; + /* 0x2C0 */ s16 action; /* 0x2C2 */ s16 textIdIndex; /* 0x2C4 */ s16 correctDigitSlots[5]; /* 0x2CE */ s16 talkState; |
