From 298f93ca2d1a55f96202352b53885087e21b07fd Mon Sep 17 00:00:00 2001 From: isghj Date: Tue, 26 Mar 2024 12:59:28 -0700 Subject: [PATCH 01/24] Kaizoku: some docs --- assets/xml/objects/object_kz.xml | 2 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 288 +++++++++--------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 18 +- tools/disasm/functions.txt | 6 +- 4 files changed, 157 insertions(+), 157 deletions(-) diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index 6295d7b1d26..8f5a56738e4 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -61,7 +61,7 @@ - + diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index ad878e8e3c8..b49767e0198 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -29,7 +29,7 @@ void func_80B8760C(EnKaizoku* this, PlayState* play); void func_80B87900(EnKaizoku* this); void func_80B8798C(EnKaizoku* this, PlayState* play); void func_80B87C7C(EnKaizoku* this); -void func_80B87CF8(PlayState* play, Vec3f* pos); +void EnKaizoku_SpawnFootDust(PlayState* play, Vec3f* pos); void func_80B87D3C(EnKaizoku* this, PlayState* play); void func_80B87E28(EnKaizoku* this); void func_80B87E9C(EnKaizoku* this, PlayState* play); @@ -45,7 +45,7 @@ void func_80B88910(EnKaizoku* this); void func_80B88964(EnKaizoku* this, PlayState* play); void func_80B88CD8(EnKaizoku* this); void func_80B88D6C(EnKaizoku* this, PlayState* play); -void func_80B89280(EnKaizoku* this, PlayState* play); +void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play); void func_80B894C0(EnKaizoku* this, PlayState* play); void func_80B8971C(EnKaizoku* this, PlayState* play); @@ -69,6 +69,7 @@ typedef enum EnKaizokuAction { /* 16 */ KAIZOKU_ACTION_16 } EnKaizokuAction; +// text Ids u16 D_80B8A8D0[] = { 0x11A4, 0x11A5, 0x11A6, 0x11A7, 0x11A8, 0x11A9, 0x11AA, 0x11AB, 0x11AC, 0x11AD, }; @@ -91,16 +92,18 @@ Vec3f D_80B8AA04[] = { { 470.0f, 30.0f, 140.0f }, { 410.0f, 80.0f, 130.0f }, { 410.0f, 80.0f, 130.0f }, { 0.0f, 0.0f, 0.0f }, }; -Color_RGBA8 D_80B8AB24[] = { - { 255, 255, 90, 255 }, - { 55, 25, 80, 255 }, - { 5, 195, 110, 255 }, +// assumption: lipstick color, as this is only for her face dl +Color_RGBA8 sKaizokuLipstickColors[] = { + { 255, 255, 90, 255 }, // yellow + { 55, 25, 80, 255 }, // dark purple + { 5, 195, 110, 255 }, // seagreen (between aqua and green) }; -Color_RGBA8 D_80B8AB30[] = { - { 255, 130, 10, 255 }, - { 185, 130, 210, 255 }, - { 135, 195, 80, 255 }, +static Color_RGBA8 sKaizokuOutfitColors[] = { + + { 255, 130, 10, 255 }, // orange + { 185, 130, 210, 255 }, // lavender + { 135, 195, 80, 255 }, // pale green }; typedef enum EnKaizokuDamageEffect { @@ -256,19 +259,20 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { this->picto.actor.targetMode = TARGET_MODE_3; this->picto.actor.colChkInfo.mass = 80; ActorShape_Init(&this->picto.actor.shape, 0.0f, ActorShadow_DrawFeet, 0.0f); - this->unk_2CA = this->picto.actor.world.rot.z; + this->textId = KAIZOKU_GET_TYPE(this); this->picto.actor.colChkInfo.health = 8; this->exitIndex = KAIZOKU_GET_EXIT_INDEX(&this->picto.actor); this->switchFlag = KAIZOKU_GET_SWITCH_FLAG(&this->picto.actor); - if (this->unk_2CA >= 2) { - this->unk_2CA = 0; - } else if (this->unk_2CA == 2) { - this->unk_2CA = 0; + if (this->textId >= 2) { + this->textId = 0; + } else if (this->textId == 2) { + this->textId = 0; } - this->unk_2EC = this->picto.actor.world.rot.z; - this->picto.actor.world.rot.z = 0; + this->colorType = KAIZOKU_GET_TYPE(this); + //this->picto.actor.world.rot.z = 0; + KAIZOKU_GET_TYPE(this) = 0; this->picto.actor.colChkInfo.damageTable = &sDamageTable; SkelAnime_InitFlex(play, &this->skelAnime, &gKaizokuSkel, &object_kz_Anim_0058B8, this->jointTable, this->morphTable, KAIZOKU_LIMB_MAX); @@ -459,7 +463,7 @@ s32 EnKaizoku_ValidatePictograph(PlayState* play, Actor* actor) { void func_80B85F48(EnKaizoku* this) { Math_Vec3f_Copy(&this->unk_2F8, &gZeroVec3f); Math_Vec3f_Copy(&this->unk_304, &gZeroVec3f); - this->unk_2D8 = 1; + this->bool2D8 = true; this->action = KAIZOKU_ACTION_0; this->actionFunc = func_80B85FA8; } @@ -469,7 +473,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; s32 sp54; - switch (this->unk_59C) { + switch (this->escapeCsState) { case 0: if (!(this->picto.actor.xzDistToPlayer < 200.0f)) { break; @@ -485,8 +489,8 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - sp54 = (this->unk_2CA * 4) + this->unk_2C8; - if (this->unk_2EC != 2) { + sp54 = (this->textId * 4) + this->unk_2C8; + if (this->colorType != 2) { player->actor.world.pos.x = this->picto.actor.home.pos.x + 90.0f; player->actor.world.pos.z = this->picto.actor.home.pos.z + 30.0f; } else { @@ -508,14 +512,14 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->picto.actor.draw = EnKaizoku_Draw; this->unk_598 = 0; Audio_SetMainBgmVolume(0, 0xA); - this->unk_59C++; + this->escapeCsState++; // fallthrough case 1: player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - if (this->unk_2EC != 2) { + if (this->colorType != 2) { player->actor.world.pos.x = this->picto.actor.home.pos.x + 90.0f; player->actor.world.pos.z = this->picto.actor.home.pos.z + 30.0f; } else { @@ -527,15 +531,15 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { Message_CloseTextbox(play); EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_11); this->unk_598 = 0; - this->unk_59C++; + this->escapeCsState++; this->picto.actor.gravity = -2.0f; } break; case 2: if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - if (this->unk_2D8 != 0) { - this->unk_2D8 = 0; + if (this->bool2D8 != false) { + this->bool2D8 = false; this->picto.actor.world.pos.y = this->picto.actor.floorHeight; this->picto.actor.velocity.y = 0.0f; Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_4); @@ -545,7 +549,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { } if (curFrame >= 11.0f) { - this->unk_59C++; + this->escapeCsState++; this->unk_598 = 0; this->subCamUp.x = 0.0f; } @@ -554,7 +558,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { case 3: if (curFrame >= this->animEndFrame) { - sp54 = this->unk_2CA * 4 + this->unk_2C8; + sp54 = this->textId * 4 + this->unk_2C8; if (Player_GetMask(play) == PLAYER_MASK_STONE) { if (D_80B8A8D0[sp54] == 0x11A5) { sp54 = 8; @@ -567,7 +571,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_12); this->unk_2C8++; this->unk_598 = 0; - this->unk_59C++; + this->escapeCsState++; } break; @@ -575,7 +579,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); this->unk_598 = 0; - this->unk_59C++; + this->escapeCsState++; Audio_SetMainBgmVolume(0x7F, 0); Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_13); @@ -589,7 +593,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { } if (curFrame >= 30.0f) { this->unk_598 = 0; - this->unk_59C++; + this->escapeCsState++; } break; @@ -598,7 +602,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { if (curFrame >= this->animEndFrame) { this->unk_598 = 7; this->unk_2F8.x = 1.0f; - this->unk_59C++; + this->escapeCsState++; this->unk_2F8.y = 1.0f; this->unk_2F8.z = 1.0f; this->unk_304.x = 1.0f; @@ -611,7 +615,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { if (this->unk_598 == 0) { Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csId); - this->unk_59C = 0; + this->escapeCsState = 0; this->subCamId = SUB_CAM_ID_DONE; this->picto.actor.flags &= ~ACTOR_FLAG_100000; this->picto.actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; @@ -621,10 +625,10 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { break; } - if (this->unk_59C < 7) { - s32 temp_v0_3 = this->unk_2EC * 8; + if (this->escapeCsState < 7) { + s32 temp_v0_3 = this->colorType * 8; - temp_v0_3 += this->unk_59C; + temp_v0_3 += this->escapeCsState; this->unk_5C8.x = D_80B8A8E4[temp_v0_3].x + this->picto.actor.home.pos.x; this->unk_5C8.y = D_80B8A8E4[temp_v0_3].y + player->actor.world.pos.y; this->unk_5C8.z = D_80B8A8E4[temp_v0_3].z + this->picto.actor.home.pos.z; @@ -634,7 +638,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->unk_5D4.z = D_80B8AA04[temp_v0_3].z + this->picto.actor.home.pos.z; } - if (this->unk_59C >= 5) { + if (this->escapeCsState >= 5) { if (curFrame >= 6.0f) { Math_ApproachF(&this->unk_2F8.x, 1.0f, 0.3f, 0.3f); this->unk_2F8.z = this->unk_2F8.y = this->unk_2F8.x; @@ -646,7 +650,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { } } - if (this->unk_59C >= 5) { + if (this->escapeCsState >= 5) { Math_ApproachF(&this->subCamEye.x, this->unk_5C8.x, 0.5f, this->unk_5E0); Math_ApproachF(&this->subCamEye.y, this->unk_5C8.y, 0.5f, this->unk_5E0); Math_ApproachF(&this->subCamEye.z, this->unk_5C8.z, 0.5f, this->unk_5E0); @@ -676,11 +680,11 @@ void func_80B86804(EnKaizoku* this, PlayState* play) { Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_96); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); - this->unk_2B2 = 30; + this->timer2B2 = 30; this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_598 = 0; - this->unk_59C = 0; - this->unk_2D8 = 0; + this->escapeCsState = 0; + this->bool2D8 = false; this->action = KAIZOKU_ACTION_0; this->actionFunc = func_80B868B8; this->picto.actor.speed = 0.0f; @@ -698,13 +702,13 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { this->subCamAt.y = this->picto.actor.world.pos.y + 30.0f; this->subCamAt.z = Math_CosS(this->picto.actor.yawTowardsPlayer) * 11.0f + this->picto.actor.world.pos.z; - switch (this->unk_59C) { + switch (this->escapeCsState) { case 0: if (curFrame >= this->animEndFrame) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_14); this->unk_2C8 = 3; this->unk_598 = 0; - this->unk_59C++; + this->escapeCsState++; } break; @@ -713,11 +717,11 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { s32 textId; EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_15); - textId = this->unk_2CA * 4 + this->unk_2C8; + textId = this->textId * 4 + this->unk_2C8; Message_StartTextbox(play, D_80B8A8D0[textId], &this->picto.actor); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_LAST2_SHOUT); this->unk_598 = 0; - this->unk_59C++; + this->escapeCsState++; } break; @@ -731,7 +735,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { gSaveContext.nextCutsceneIndex = 0; Scene_SetExitFade(play); play->transitionTrigger = TRANS_TRIGGER_START; - this->unk_59C++; + this->escapeCsState++; this->action = KAIZOKU_ACTION_16; } break; @@ -749,7 +753,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { } void func_80B86B58(EnKaizoku* this) { - this->unk_2D8 = 0; + this->bool2D8 = 0; this->action = KAIZOKU_ACTION_0; this->actionFunc = func_80B86B74; } @@ -759,7 +763,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { s32 textId; f32 curFrame = this->skelAnime.curFrame; - if (this->unk_59C < 2) { + if (this->escapeCsState < 2) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); player->actor.world.pos.x = this->picto.actor.home.pos.x + 90.0f; player->actor.world.pos.z = this->picto.actor.home.pos.z + 30.0f; @@ -775,15 +779,15 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); - switch (this->unk_59C) { + switch (this->escapeCsState) { case 0: EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_17); this->unk_2C8 = 2; - textId = this->unk_2CA * 4 + this->unk_2C8; + textId = this->textId * 4 + this->unk_2C8; Message_StartTextbox(play, D_80B8A8D0[textId], &this->picto.actor); this->unk_2D9 = 0; this->unk_598 = 0; - this->unk_59C++; + this->escapeCsState++; break; case 1: @@ -802,7 +806,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_133); this->unk_5A0 = 0; this->unk_598 = 0; - this->unk_59C++; + this->escapeCsState++; } break; @@ -848,7 +852,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { this->unk_598 = 10; Math_Vec3f_Copy(&this->unk_2F8, &gZeroVec3f); Math_Vec3f_Copy(&this->unk_304, &gZeroVec3f); - this->unk_59C++; + this->escapeCsState++; } break; @@ -863,7 +867,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { play->envCtx.screenFillColor[2] = 0; play->envCtx.screenFillColor[3] = 0; play->envCtx.fillScreen = false; - this->unk_59C = 0; + this->escapeCsState = 0; this->subCamId = SUB_CAM_ID_DONE; Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csId); @@ -894,6 +898,8 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { } } + +// this is the start-combat actionfunction after cutscene, but do we want to start immediately with an attack? is there a standing version we could start with? void func_80B872A4(EnKaizoku* this) { this->picto.actor.speed = 0.0f; EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_0); @@ -947,7 +953,7 @@ void func_80B874D8(EnKaizoku* this, PlayState* play) { this->skelAnime.playSpeed = 1.0f; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; - this->unk_2B2 = 6; + this->timer2B2 = 6; this->action = KAIZOKU_ACTION_2; this->unk_2E0 = 0.0f; this->actionFunc = func_80B8760C; @@ -1005,7 +1011,7 @@ void func_80B8760C(EnKaizoku* this, PlayState* play) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } - if (this->unk_2B2 == 0) { + if (this->timer2B2 == 0) { this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; if (!func_80B85858(this, play)) { if (this->picto.actor.xzDistToPlayer <= 70.0f) { @@ -1027,9 +1033,9 @@ void func_80B87900(EnKaizoku* this) { if (this->swordState != 0) { this->swordState = -1; } - this->unk_2D8 = 0; + this->bool2D8 = false; this->picto.actor.speed = 0.0f; - this->unk_2B2 = Rand_S16Offset(10, 10); + this->timer2B2 = Rand_S16Offset(10, 10); this->bodyCollider.base.acFlags |= AC_HARD; this->lookTimer = 12; this->action = KAIZOKU_ACTION_12; @@ -1040,12 +1046,12 @@ void func_80B8798C(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 temp_v0; - this->unk_2D8 = 1; - if (this->unk_2B2 == 0) { + this->bool2D8 = true; + if (this->timer2B2 == 0) { this->skelAnime.playSpeed = 1.0f; } if (this->lookTimer == 0) { - this->unk_2D8 = 0; + this->bool2D8 = false; temp_v0 = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; if ((ABS_ALT(temp_v0) <= 0x4000) && (this->picto.actor.xzDistToPlayer < 40.0f) && (fabsf(this->picto.actor.playerHeightRel) < 50.0f)) { @@ -1073,7 +1079,7 @@ void func_80B8798C(EnKaizoku* this, PlayState* play) { this->bodyCollider.base.acFlags &= ~AC_HARD; func_80B88CD8(this); } - } else if ((this->unk_2B2 == 0) && + } else if ((this->timer2B2 == 0) && func_800BE184(play, &this->picto.actor, 100.0f, 10000, 0x4000, this->picto.actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { this->bodyCollider.base.acFlags &= ~AC_HARD; @@ -1107,13 +1113,14 @@ void func_80B87C7C(EnKaizoku* this) { this->actionFunc = func_80B87D3C; } -Color_RGBA8 D_80B8AC58 = { 200, 160, 120, 255 }; -Color_RGBA8 D_80B8AC5C = { 130, 90, 50, 255 }; +Color_RGBA8 D_80B8AC58 = { 200, 160, 120, 255 }; // light brown +Color_RGBA8 D_80B8AC5C = { 130, 90, 50, 255 }; // darker brown Vec3f D_80B8AC60 = { 0.0f, -1.5f, 0.0f }; Vec3f D_80B8AC6C = { 0.0f, -0.2f, 0.0f }; -void func_80B87CF8(PlayState* play, Vec3f* pos) { +void EnKaizoku_SpawnFootDust(PlayState* play, Vec3f* pos) { + // reusing sparkles instead of the actual dust effect? is this left over from OOT? EffectSsKirakira_SpawnSmall(play, pos, &D_80B8AC60, &D_80B8AC6C, &D_80B8AC58, &D_80B8AC5C); } @@ -1122,11 +1129,11 @@ void func_80B87D3C(EnKaizoku* this, PlayState* play) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); if (this->picto.actor.velocity.y >= 5.0f) { - func_80B87CF8(play, &this->leftFootPos); - func_80B87CF8(play, &this->rightFootPos); + EnKaizoku_SpawnFootDust(play, &this->leftFootPos); + EnKaizoku_SpawnFootDust(play, &this->rightFootPos); } - this->unk_2D8 = 0; + this->bool2D8 = false; if ((curFrame >= this->animEndFrame) && (this->picto.actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { this->bodyCollider.info.elemType = ELEMTYPE_UNK1; @@ -1156,7 +1163,7 @@ void func_80B87E28(EnKaizoku* this) { void func_80B87E9C(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - this->unk_2D8 = 0; + this->bool2D8 = false; if (curFrame >= this->animEndFrame) { if ((this->picto.actor.xzDistToPlayer < 170.0f) && (this->picto.actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) { @@ -1206,7 +1213,7 @@ void func_80B87FDC(EnKaizoku* this, PlayState* play2) { return; } - this->unk_2D8 = 0; + this->bool2D8 = 0; if (curFrame >= this->animEndFrame) { if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { func_80B872A4(this); @@ -1240,7 +1247,7 @@ void func_80B87FDC(EnKaizoku* this, PlayState* play2) { void func_80B88214(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_8); - this->unk_2B2 = 0; + this->timer2B2 = 0; this->picto.actor.speed = 10.0f; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; Actor_PlaySfx(&this->picto.actor, NA_SE_EN_TEKU_JUMP); @@ -1251,12 +1258,12 @@ void func_80B88214(EnKaizoku* this) { void func_80B88278(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - this->unk_2D8 = 0; + this->bool2D8 = 0; if (curFrame >= this->animEndFrame) { this->picto.actor.speed = 0.0f; if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { func_80B872A4(this); - this->unk_2B2 = Rand_ZeroOne() * 5.0f + 5.0f; + this->timer2B2 = Rand_ZeroOne() * 5.0f + 5.0f; } else { func_80B87F70(this); } @@ -1351,17 +1358,17 @@ void func_80B88770(EnKaizoku* this) { } void func_80B887AC(EnKaizoku* this, PlayState* play) { - s16 temp_v0; - s16 var_a2; + s16 yawDiff; + s16 yawAdjustment; if (!func_80B85858(this, play) && !func_80B85A00(this, play, false)) { - temp_v0 = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; - if (temp_v0 > 0) { - var_a2 = TRUNCF_BINANG(temp_v0 * 0.25f) + 0x7D0; + yawDiff = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; + if (yawDiff > 0) { + yawAdjustment = TRUNCF_BINANG(yawDiff * 0.25f) + 0x7D0; } else { - var_a2 = TRUNCF_BINANG(temp_v0 * 0.25f) - 0x7D0; + yawAdjustment = TRUNCF_BINANG(yawDiff * 0.25f) - 0x7D0; } - this->picto.actor.shape.rot.y += var_a2; + this->picto.actor.shape.rot.y += yawAdjustment; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; this->skelAnime.playSpeed = 1.0f; @@ -1378,6 +1385,7 @@ void func_80B887AC(EnKaizoku* this, PlayState* play) { } } +// long roundhouse jump attack void func_80B88910(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_10); this->swordCollider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); @@ -1416,11 +1424,11 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { this->swordState = -1; } - this->unk_2D8 = 0; + this->bool2D8 = 0; if ((curFrame >= this->animEndFrame) && (this->unk_2D0 < 2)) { if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { func_80B872A4(this); - this->unk_2B2 = Rand_ZeroOne() * 5.0f + 5.0f; + this->timer2B2 = Rand_ZeroOne() * 5.0f + 5.0f; this->lookTimer = 46; return; } @@ -1432,7 +1440,7 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { if ((Rand_ZeroOne() > 0.7f) || (this->picto.actor.xzDistToPlayer >= 120.0f)) { func_80B872A4(this); - this->unk_2B2 = Rand_ZeroOne() * 5.0f + 5.0f; + this->timer2B2 = Rand_ZeroOne() * 5.0f + 5.0f; return; } @@ -1463,7 +1471,7 @@ void func_80B88CD8(EnKaizoku* this) { this->picto.actor.speed = Rand_CenteredFloat(12.0f); this->skelAnime.playSpeed = 1.0f; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; - this->unk_2B2 = Rand_ZeroOne() * 30.0f + 30.0f; + this->timer2B2 = Rand_ZeroOne() * 30.0f + 30.0f; this->action = KAIZOKU_ACTION_3; this->actionFunc = func_80B88D6C; this->unk_2E0 = 0.0f; @@ -1545,7 +1553,7 @@ void func_80B88D6C(EnKaizoku* this, PlayState* play) { if (this->picto.actor.xzDistToPlayer <= 65.0f) { func_80B87F70(this); - } else if (this->unk_2B2 == 0) { + } else if (this->timer2B2 == 0) { if (Actor_OtherIsTargeted(play, &this->picto.actor) && (Rand_ZeroOne() > 0.5f)) { func_80B87E28(this); } else { @@ -1556,7 +1564,7 @@ void func_80B88D6C(EnKaizoku* this, PlayState* play) { } // EnKaizoku_SetupStunned -void func_80B891B8(EnKaizoku* this) { +void EnKaizoku_SetupStunned(EnKaizoku* this) { if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->picto.actor.speed = 0.0f; } @@ -1567,13 +1575,13 @@ void func_80B891B8(EnKaizoku* this) { if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && - (this->unk_2B8 == 0)) { - this->unk_2B8 = 0; + (this->colorFilterTimer == 0)) { + this->colorFilterTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } Actor_PlaySfx(&this->picto.actor, NA_SE_EN_COMMON_FREEZE); - this->unk_2D8 = 1; + this->bool2D8 = 1; if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { @@ -1581,13 +1589,12 @@ void func_80B891B8(EnKaizoku* this) { } this->action = KAIZOKU_ACTION_13; - this->actionFunc = func_80B89280; + this->actionFunc = EnKaizoku_Stunned; } -// EnKaizoku_Stunned -void func_80B89280(EnKaizoku* this, PlayState* play) { +void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) { - if ((this->unk_2B8 != 0) && (this->unk_2B8 < 60)) { + if ((this->colorFilterTimer != 0) && (this->colorFilterTimer < 60)) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; } } @@ -1602,15 +1609,15 @@ void func_80B89280(EnKaizoku* this, PlayState* play) { } } - if ((this->unk_2B6 == 0) && (this->unk_2B8 == 0) && !CHECK_FLAG_ALL(this->picto.actor.flags, ACTOR_FLAG_2000) && + if ((this->unk_2B6 == 0) && (this->colorFilterTimer == 0) && !CHECK_FLAG_ALL(this->picto.actor.flags, ACTOR_FLAG_2000) && (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - this->unk_2D8 = 0; + this->bool2D8 = 0; func_80B85A00(this, play, true); if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); - this->unk_2B8 = 0; + this->colorFilterTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->picto.actor.flags |= ACTOR_FLAG_400; } @@ -1624,15 +1631,15 @@ void func_80B893CC(EnKaizoku* this, PlayState* play) { Matrix_MultVecZ(-10.0f, &sp34); Math_Vec3f_Copy(&this->unk_3C4, &sp34); this->lookTimer = 0; - this->unk_2D8 = 0; + this->bool2D8 = 0; this->picto.actor.speed = 0.0f; EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_5); if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && - (this->unk_2B8 != 0)) { + (this->colorFilterTimer != 0)) { Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); - this->unk_2B8 = 0; + this->colorFilterTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->picto.actor.flags |= ACTOR_FLAG_400; } @@ -1676,11 +1683,11 @@ void func_80B8960C(EnKaizoku* this, PlayState* play) { if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && - (this->unk_2B8 == 0)) { + (this->colorFilterTimer == 0)) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } this->picto.actor.speed = 0.0f; - this->unk_2D8 = 1; + this->bool2D8 = 1; Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_123); Enemy_StartFinishingBlow(play, &this->picto.actor); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DEAD); @@ -1688,7 +1695,7 @@ void func_80B8960C(EnKaizoku* this, PlayState* play) { this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->picto.actor.flags &= ~ACTOR_FLAG_400; this->unk_598 = 0; - this->unk_59C = 0; + this->escapeCsState = 0; this->action = KAIZOKU_ACTION_15; this->actionFunc = func_80B8971C; } @@ -1707,11 +1714,11 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { - if (this->unk_2B8 == 0) { + if (this->colorFilterTimer == 0) { return; } Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); - this->unk_2B8 = 0; + this->colorFilterTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -1754,7 +1761,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); SkelAnime_Update(&this->skelAnime); if (curFrame >= this->animEndFrame) { - this->unk_2D8 = 0; + this->bool2D8 = 0; func_80B86B58(this); } else if (Animation_OnFrame(&this->skelAnime, 10.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_DOWN); @@ -1808,6 +1815,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { } } + // HUH? they are never in a room with a barrel? did they plan a special fight mechanic? if (this->swordCollider.base.at->id == ACTOR_OBJ_TARU) { this->swordCollider.base.at->home.rot.z = 1; } @@ -1829,21 +1837,21 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { case KAIZOKU_DMGEFF_5: if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || - (this->unk_2B8 == 0)) { - this->unk_2B8 = 40; + (this->colorFilterTimer == 0)) { + this->colorFilterTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_MEDIUM; } // fallthrough case KAIZOKU_DMGEFF_1: if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || - this->unk_2B8 == 0) { + this->colorFilterTimer == 0) { Actor_SetColorFilter(&this->picto.actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); this->bodyCollider.info.elemType = ELEMTYPE_UNK1; this->bodyCollider.base.colType = COLTYPE_HIT3; this->swordCollider.info.elemType = ELEMTYPE_UNK2; - func_80B891B8(this); + EnKaizoku_SetupStunned(this); } break; @@ -1869,7 +1877,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { case KAIZOKU_DMGEFF_2: if ((this->action != KAIZOKU_ACTION_5) && (this->action != KAIZOKU_ACTION_7) && (this->action < KAIZOKU_ACTION_14)) { - this->unk_2B8 = 40; + this->colorFilterTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; sp64 = 1; } @@ -1878,12 +1886,12 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { case KAIZOKU_DMGEFF_FREEZE: if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || - (this->unk_2B8 == 0)) { + (this->colorFilterTimer == 0)) { Actor_ApplyDamage(&this->picto.actor); this->bodyCollider.info.elemType = ELEMTYPE_UNK1; this->bodyCollider.base.colType = COLTYPE_HIT3; this->swordCollider.info.elemType = ELEMTYPE_UNK4; - this->unk_2B8 = 80; + this->colorFilterTimer = 80; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_SFX; this->drawDmgEffScale = 0.0f; this->drawDmgEffFrozenSteamScale = 1.5f; @@ -1891,7 +1899,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { if (this->picto.actor.colChkInfo.health <= 0) { func_80B8960C(this, play); } else { - func_80B891B8(this); + EnKaizoku_SetupStunned(this); } } break; @@ -1899,8 +1907,8 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { case KAIZOKU_DMGEFF_4: if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || - (this->unk_2B8 == 0)) { - this->unk_2B8 = 20; + (this->colorFilterTimer == 0)) { + this->colorFilterTimer = 20; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->picto.actor.focus.pos.x, this->picto.actor.focus.pos.y, this->picto.actor.focus.pos.z, 0, 0, 0, @@ -1975,10 +1983,8 @@ static TexturePtr sEyeTextures[] = { void EnKaizoku_Update(Actor* thisx, PlayState* play2) { EnKaizoku* this = THIS; PlayState* play = play2; - Vec3f sp34; - s32 pad; - if (this->unk_2D8 == 0) { + if (! this->bool2D8) { SkelAnime_Update(&this->skelAnime); } @@ -1986,24 +1992,12 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { func_80B85900(this); } - if (this->blinkTimer != 0) { - this->blinkTimer--; - } - if (this->unk_2B2 != 0) { - this->unk_2B2--; - } - if (this->lookTimer != 0) { - this->lookTimer--; - } - if (this->unk_2B6 != 0) { - this->unk_2B6--; - } - if (this->unk_598 != 0) { - this->unk_598--; - } - if (this->unk_2B8 != 0) { - this->unk_2B8--; - } + DECR (this->blinkTimer); + DECR (this->timer2B2); + DECR (this->lookTimer); + DECR (this->unk_2B6); + DECR (this->unk_598); + DECR (this->colorFilterTimer); this->actionFunc(this, play); Actor_MoveWithGravity(&this->picto.actor); @@ -2024,6 +2018,9 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { } if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { + Vec3f sp34; + s32 pad; + Matrix_RotateYS(this->picto.actor.shape.rot.y + this->unk_2F4, MTXMODE_NEW); Matrix_MultVecZ(this->unk_2F0, &sp34); this->picto.actor.world.pos.x += this->unk_3C4.x + sp34.x; @@ -2051,22 +2048,23 @@ s32 EnKaizoku_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 OPEN_DISPS(play->state.gfxCtx); - if (limbIndex == KAIZOKU_LIMB_05) { + // disabled because left over from OOT, and dev wanted us to see lipstick + if (limbIndex == KAIZOKU_LIMB_VEIL) { *dList = NULL; } - if (limbIndex == KAIZOKU_LIMB_03) { + if (limbIndex == KAIZOKU_LIMB_03) { // head root node rot->z += this->headRot.x; rot->x += this->headRot.y; rot->y += this->headRot.z; - } else if (limbIndex == KAIZOKU_LIMB_06) { + } else if (limbIndex == KAIZOKU_LIMB_06) { // face?? her face has a color?? gDPPipeSync(POLY_OPA_DISP++); - gDPSetEnvColor(POLY_OPA_DISP++, D_80B8AB24[this->unk_2EC].r, D_80B8AB24[this->unk_2EC].g, - D_80B8AB24[this->unk_2EC].b, 255); + gDPSetEnvColor(POLY_OPA_DISP++, sKaizokuLipstickColors[this->colorType].r, sKaizokuLipstickColors[this->colorType].g, + sKaizokuLipstickColors[this->colorType].b, 255); } else { gDPPipeSync(POLY_OPA_DISP++); - gDPSetEnvColor(POLY_OPA_DISP++, D_80B8AB30[this->unk_2EC].r, D_80B8AB30[this->unk_2EC].g, - D_80B8AB30[this->unk_2EC].b, 255); + gDPSetEnvColor(POLY_OPA_DISP++, sKaizokuOutfitColors[this->colorType].r, sKaizokuOutfitColors[this->colorType].g, + sKaizokuOutfitColors[this->colorType].b, 255); } CLOSE_DISPS(play->state.gfxCtx); @@ -2147,8 +2145,8 @@ void EnKaizoku_Draw(Actor* thisx, PlayState* play) { this->skelAnime.dListCount, EnKaizoku_OverrideLimbDraw, EnKaizoku_PostLimbDraw, EnKaizoku_TransformLimbDraw, &this->picto.actor); - if (this->unk_2B8 != 0) { - drawDmgEffAlpha = this->unk_2B8 * 0.05f; + if (this->colorFilterTimer != 0) { + drawDmgEffAlpha = this->colorFilterTimer * 0.05f; if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index 15562ee2e92..32b93dae7f1 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -12,6 +12,8 @@ typedef void (*EnKaizokuActionFunc)(struct EnKaizoku*, PlayState*); #define KAIZOKU_GET_EXIT_INDEX(thisx) ((thisx)->params & 0x3F) #define KAIZOKU_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 6) & 0x7F) +#define KAIZOKU_GET_TYPE(this) ((this)->picto.actor.world.rot.z) + #define KAIZOKU_SWITCH_FLAG_NONE 0x7F typedef enum EnKaizokuAnimation { @@ -63,30 +65,30 @@ typedef struct EnKaizoku { /* 0x21C */ Vec3s morphTable[KAIZOKU_LIMB_MAX]; /* 0x2AC */ EnKaizokuActionFunc actionFunc; /* 0x2B0 */ s16 action; - /* 0x2B2 */ s16 unk_2B2; + /* 0x2B2 */ s16 timer2B2; // unk timer /* 0x2B4 */ s16 lookTimer; - /* 0x2B6 */ s16 unk_2B6; - /* 0x2B8 */ s16 unk_2B8; + /* 0x2B6 */ s16 unk_2B6; // timer + /* 0x2B8 */ s16 colorFilterTimer; // name taken from oot, actor is damaged flashing red /* 0x2BA */ s16 drawDmgEffType; /* 0x2BC */ s16 switchFlag; /* 0x2BE */ s16 unk_2BE; /* 0x2C0 */ f32 drawDmgEffScale; /* 0x2C4 */ f32 drawDmgEffFrozenSteamScale; /* 0x2C8 */ s16 unk_2C8; - /* 0x2CA */ s16 unk_2CA; + /* 0x2CA */ s16 textId; /* 0x2CC */ s16 eyeIndex; /* 0x2CE */ s16 blinkTimer; /* 0x2D0 */ s16 unk_2D0; /* 0x2D2 */ s16 swordState; /* 0x2D4 */ s16 exitIndex; /* 0x2D6 */ s16 csId; - /* 0x2D8 */ u8 unk_2D8; + /* 0x2D8 */ u8 bool2D8; // bool /* 0x2D9 */ u8 unk_2D9; /* 0x2DC */ f32 animEndFrame; /* 0x2E0 */ f32 unk_2E0; /* 0x2E4 */ EnKaizokuAnimation animIndex; /* 0x2E8 */ s32 bodyPartIndex; - /* 0x2EC */ s32 unk_2EC; + /* 0x2EC */ s32 colorType; /* 0x2F0 */ f32 unk_2F0; /* 0x2F4 */ s16 unk_2F4; /* 0x2F8 */ Vec3f unk_2F8; @@ -101,8 +103,8 @@ typedef struct EnKaizoku { /* 0x578 */ Vec3s headRot; /* 0x580 */ Vec3f rightFootPos; /* 0x58C */ Vec3f leftFootPos; - /* 0x598 */ s32 unk_598; - /* 0x59C */ s16 unk_59C; + /* 0x598 */ s32 unk_598; // timer?? why is it double len? + /* 0x59C */ s16 escapeCsState; /* 0x59E */ s16 subCamId; /* 0x5A0 */ s16 unk_5A0; /* 0x5A2 */ s16 unk_5A2; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 5362e5e49ad..c5dbf56bd98 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -14674,7 +14674,7 @@ 0x80B87900:("func_80B87900",), 0x80B8798C:("func_80B8798C",), 0x80B87C7C:("func_80B87C7C",), - 0x80B87CF8:("func_80B87CF8",), + 0x80B87CF8:("EnKaizoku_SpawnFootDust",), 0x80B87D3C:("func_80B87D3C",), 0x80B87E28:("func_80B87E28",), 0x80B87E9C:("func_80B87E9C",), @@ -14690,8 +14690,8 @@ 0x80B88964:("func_80B88964",), 0x80B88CD8:("func_80B88CD8",), 0x80B88D6C:("func_80B88D6C",), - 0x80B891B8:("func_80B891B8",), - 0x80B89280:("func_80B89280",), + 0x80B891B8:("EnKaizoku_SetupStunned",), + 0x80B89280:("EnKaizoku_Stunned",), 0x80B893CC:("func_80B893CC",), 0x80B894C0:("func_80B894C0",), 0x80B8960C:("func_80B8960C",), From ce25d1ad93de65193d7a22d52087e53721571e01 Mon Sep 17 00:00:00 2001 From: isghj Date: Thu, 9 Jan 2025 16:41:18 -0800 Subject: [PATCH 02/24] Kaizoku: more docs --- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 122 ++++++++++-------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 8 +- tools/disasm/functions.txt | 4 +- tools/disasm/variables.txt | 2 +- 4 files changed, 72 insertions(+), 64 deletions(-) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index b49767e0198..4d0065c6b1e 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -17,8 +17,8 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2); void EnKaizoku_Draw(Actor* thisx, PlayState* play); s32 EnKaizoku_ValidatePictograph(PlayState* play, Actor* actor); -void func_80B85F48(EnKaizoku* this); -void func_80B85FA8(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupWaitForApproach(EnKaizoku* this); +void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play); void func_80B868B8(EnKaizoku* this, PlayState* play); void func_80B86B58(EnKaizoku* this); void func_80B86B74(EnKaizoku* this, PlayState* play); @@ -69,9 +69,18 @@ typedef enum EnKaizokuAction { /* 16 */ KAIZOKU_ACTION_16 } EnKaizokuAction; -// text Ids -u16 D_80B8A8D0[] = { - 0x11A4, 0x11A5, 0x11A6, 0x11A7, 0x11A8, 0x11A9, 0x11AA, 0x11AB, 0x11AC, 0x11AD, +// text Ids +static u16 sKaizokuTextIds[] = { + 0x11A4, // (intro) halt + 0x11A5, // you must have courage, going to love doing this to you + 0x11A6, // (win) ouch, dont think this is the end + 0x11A7, // (loss) you're nothing to talk about + 0x11A8, // (intro) you go no further + 0x11A9, // you wont get past here + 0x11AA, // (win) not bad, but this isnt the end + 0x11AB, // (loss) hmph, we're not fools + 0x11AC, // (stone mask) we aren't fooled by that mask + 0x11AD, // (stone mask) did you think that mask would work? }; Vec3f D_80B8A8E4[] = { @@ -259,19 +268,18 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { this->picto.actor.targetMode = TARGET_MODE_3; this->picto.actor.colChkInfo.mass = 80; ActorShape_Init(&this->picto.actor.shape, 0.0f, ActorShadow_DrawFeet, 0.0f); - this->textId = KAIZOKU_GET_TYPE(this); + this->textType = KAIZOKU_GET_TYPE(this); this->picto.actor.colChkInfo.health = 8; this->exitIndex = KAIZOKU_GET_EXIT_INDEX(&this->picto.actor); this->switchFlag = KAIZOKU_GET_SWITCH_FLAG(&this->picto.actor); - if (this->textId >= 2) { - this->textId = 0; - } else if (this->textId == 2) { - this->textId = 0; + if (this->textType >= 2) { + this->textType = 0; + } else if (this->textType == 2) { // @Bug: '2' also matches '>= 2' + this->textType = 0; } - this->colorType = KAIZOKU_GET_TYPE(this); - //this->picto.actor.world.rot.z = 0; + this->colorType = KAIZOKU_GET_TYPE(this); KAIZOKU_GET_TYPE(this) = 0; this->picto.actor.colChkInfo.damageTable = &sDamageTable; SkelAnime_InitFlex(play, &this->skelAnime, &gKaizokuSkel, &object_kz_Anim_0058B8, this->jointTable, @@ -307,7 +315,7 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { this->picto.actor.world.pos.y = player->actor.world.pos.y + 160.0f; this->picto.validationFunc = EnKaizoku_ValidatePictograph; this->picto.actor.flags |= ACTOR_FLAG_400; - func_80B85F48(this); + EnKaizoku_SetupWaitForApproach(this); } void EnKaizoku_Destroy(Actor* thisx, PlayState* play) { @@ -460,21 +468,21 @@ s32 EnKaizoku_ValidatePictograph(PlayState* play, Actor* actor) { return ret; } -void func_80B85F48(EnKaizoku* this) { +void EnKaizoku_SetupWaitForApproach(EnKaizoku* this) { Math_Vec3f_Copy(&this->unk_2F8, &gZeroVec3f); Math_Vec3f_Copy(&this->unk_304, &gZeroVec3f); this->bool2D8 = true; this->action = KAIZOKU_ACTION_0; - this->actionFunc = func_80B85FA8; + this->actionFunc = EnKaizoku_WaitForApproach; } -void func_80B85FA8(EnKaizoku* this, PlayState* play) { +void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; s32 sp54; - switch (this->escapeCsState) { - case 0: + switch (this->cutsceneState) { + case 0: // waiting if (!(this->picto.actor.xzDistToPlayer < 200.0f)) { break; } @@ -489,7 +497,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - sp54 = (this->textId * 4) + this->unk_2C8; + sp54 = (this->textType * 4) + this->textidOffset; if (this->colorType != 2) { player->actor.world.pos.x = this->picto.actor.home.pos.x + 90.0f; player->actor.world.pos.z = this->picto.actor.home.pos.z + 30.0f; @@ -501,8 +509,8 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { player->actor.speed = 0.0f; this->picto.actor.world.pos.x = this->picto.actor.home.pos.x; this->picto.actor.world.pos.z = this->picto.actor.home.pos.z; - Message_StartTextbox(play, D_80B8A8D0[sp54], &this->picto.actor); - this->unk_2C8++; + Message_StartTextbox(play, sKaizokuTextIds[sp54], &this->picto.actor); + this->textidOffset++; this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); @@ -512,7 +520,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->picto.actor.draw = EnKaizoku_Draw; this->unk_598 = 0; Audio_SetMainBgmVolume(0, 0xA); - this->escapeCsState++; + this->cutsceneState++; // fallthrough case 1: player->actor.shape.rot.y = player->actor.world.rot.y = @@ -531,7 +539,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { Message_CloseTextbox(play); EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_11); this->unk_598 = 0; - this->escapeCsState++; + this->cutsceneState++; this->picto.actor.gravity = -2.0f; } break; @@ -549,7 +557,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { } if (curFrame >= 11.0f) { - this->escapeCsState++; + this->cutsceneState++; this->unk_598 = 0; this->subCamUp.x = 0.0f; } @@ -558,20 +566,20 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { case 3: if (curFrame >= this->animEndFrame) { - sp54 = this->textId * 4 + this->unk_2C8; + sp54 = this->textType * 4 + this->textidOffset; if (Player_GetMask(play) == PLAYER_MASK_STONE) { - if (D_80B8A8D0[sp54] == 0x11A5) { + if (sKaizokuTextIds[sp54] == 0x11A5) { sp54 = 8; - } else if (D_80B8A8D0[sp54] == 0x11A9) { + } else if (sKaizokuTextIds[sp54] == 0x11A9) { sp54 = 9; } } - Message_StartTextbox(play, D_80B8A8D0[sp54], &this->picto.actor); + Message_StartTextbox(play, sKaizokuTextIds[sp54], &this->picto.actor); EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_12); - this->unk_2C8++; + this->textidOffset++; this->unk_598 = 0; - this->escapeCsState++; + this->cutsceneState++; } break; @@ -579,7 +587,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); this->unk_598 = 0; - this->escapeCsState++; + this->cutsceneState++; Audio_SetMainBgmVolume(0x7F, 0); Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_13); @@ -593,7 +601,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { } if (curFrame >= 30.0f) { this->unk_598 = 0; - this->escapeCsState++; + this->cutsceneState++; } break; @@ -602,7 +610,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { if (curFrame >= this->animEndFrame) { this->unk_598 = 7; this->unk_2F8.x = 1.0f; - this->escapeCsState++; + this->cutsceneState++; this->unk_2F8.y = 1.0f; this->unk_2F8.z = 1.0f; this->unk_304.x = 1.0f; @@ -615,7 +623,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { if (this->unk_598 == 0) { Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csId); - this->escapeCsState = 0; + this->cutsceneState = 0; this->subCamId = SUB_CAM_ID_DONE; this->picto.actor.flags &= ~ACTOR_FLAG_100000; this->picto.actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; @@ -625,10 +633,10 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { break; } - if (this->escapeCsState < 7) { + if (this->cutsceneState < 7) { s32 temp_v0_3 = this->colorType * 8; - temp_v0_3 += this->escapeCsState; + temp_v0_3 += this->cutsceneState; this->unk_5C8.x = D_80B8A8E4[temp_v0_3].x + this->picto.actor.home.pos.x; this->unk_5C8.y = D_80B8A8E4[temp_v0_3].y + player->actor.world.pos.y; this->unk_5C8.z = D_80B8A8E4[temp_v0_3].z + this->picto.actor.home.pos.z; @@ -638,7 +646,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { this->unk_5D4.z = D_80B8AA04[temp_v0_3].z + this->picto.actor.home.pos.z; } - if (this->escapeCsState >= 5) { + if (this->cutsceneState >= 5) { if (curFrame >= 6.0f) { Math_ApproachF(&this->unk_2F8.x, 1.0f, 0.3f, 0.3f); this->unk_2F8.z = this->unk_2F8.y = this->unk_2F8.x; @@ -650,7 +658,7 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { } } - if (this->escapeCsState >= 5) { + if (this->cutsceneState >= 5) { Math_ApproachF(&this->subCamEye.x, this->unk_5C8.x, 0.5f, this->unk_5E0); Math_ApproachF(&this->subCamEye.y, this->unk_5C8.y, 0.5f, this->unk_5E0); Math_ApproachF(&this->subCamEye.z, this->unk_5C8.z, 0.5f, this->unk_5E0); @@ -683,7 +691,7 @@ void func_80B86804(EnKaizoku* this, PlayState* play) { this->timer2B2 = 30; this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->unk_598 = 0; - this->escapeCsState = 0; + this->cutsceneState = 0; this->bool2D8 = false; this->action = KAIZOKU_ACTION_0; this->actionFunc = func_80B868B8; @@ -702,13 +710,13 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { this->subCamAt.y = this->picto.actor.world.pos.y + 30.0f; this->subCamAt.z = Math_CosS(this->picto.actor.yawTowardsPlayer) * 11.0f + this->picto.actor.world.pos.z; - switch (this->escapeCsState) { + switch (this->cutsceneState) { case 0: if (curFrame >= this->animEndFrame) { EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_14); - this->unk_2C8 = 3; + this->textidOffset = 3; this->unk_598 = 0; - this->escapeCsState++; + this->cutsceneState++; } break; @@ -717,11 +725,11 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { s32 textId; EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_15); - textId = this->textId * 4 + this->unk_2C8; - Message_StartTextbox(play, D_80B8A8D0[textId], &this->picto.actor); + textId = this->textType * 4 + this->textidOffset; + Message_StartTextbox(play, sKaizokuTextIds[textId], &this->picto.actor); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_LAST2_SHOUT); this->unk_598 = 0; - this->escapeCsState++; + this->cutsceneState++; } break; @@ -735,7 +743,7 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { gSaveContext.nextCutsceneIndex = 0; Scene_SetExitFade(play); play->transitionTrigger = TRANS_TRIGGER_START; - this->escapeCsState++; + this->cutsceneState++; this->action = KAIZOKU_ACTION_16; } break; @@ -763,7 +771,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { s32 textId; f32 curFrame = this->skelAnime.curFrame; - if (this->escapeCsState < 2) { + if (this->cutsceneState < 2) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); player->actor.world.pos.x = this->picto.actor.home.pos.x + 90.0f; player->actor.world.pos.z = this->picto.actor.home.pos.z + 30.0f; @@ -779,15 +787,15 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); - switch (this->escapeCsState) { + switch (this->cutsceneState) { case 0: EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_17); - this->unk_2C8 = 2; - textId = this->textId * 4 + this->unk_2C8; - Message_StartTextbox(play, D_80B8A8D0[textId], &this->picto.actor); + this->textidOffset = 2; + textId = this->textType * 4 + this->textidOffset; + Message_StartTextbox(play, sKaizokuTextIds[textId], &this->picto.actor); this->unk_2D9 = 0; this->unk_598 = 0; - this->escapeCsState++; + this->cutsceneState++; break; case 1: @@ -806,7 +814,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_133); this->unk_5A0 = 0; this->unk_598 = 0; - this->escapeCsState++; + this->cutsceneState++; } break; @@ -852,7 +860,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { this->unk_598 = 10; Math_Vec3f_Copy(&this->unk_2F8, &gZeroVec3f); Math_Vec3f_Copy(&this->unk_304, &gZeroVec3f); - this->escapeCsState++; + this->cutsceneState++; } break; @@ -867,7 +875,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { play->envCtx.screenFillColor[2] = 0; play->envCtx.screenFillColor[3] = 0; play->envCtx.fillScreen = false; - this->escapeCsState = 0; + this->cutsceneState = 0; this->subCamId = SUB_CAM_ID_DONE; Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csId); @@ -1563,7 +1571,7 @@ void func_80B88D6C(EnKaizoku* this, PlayState* play) { } } -// EnKaizoku_SetupStunned +// not convinced these are the right function name void EnKaizoku_SetupStunned(EnKaizoku* this) { if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->picto.actor.speed = 0.0f; @@ -1695,7 +1703,7 @@ void func_80B8960C(EnKaizoku* this, PlayState* play) { this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->picto.actor.flags &= ~ACTOR_FLAG_400; this->unk_598 = 0; - this->escapeCsState = 0; + this->cutsceneState = 0; this->action = KAIZOKU_ACTION_15; this->actionFunc = func_80B8971C; } diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index 32b93dae7f1..204a038684f 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -74,8 +74,8 @@ typedef struct EnKaizoku { /* 0x2BE */ s16 unk_2BE; /* 0x2C0 */ f32 drawDmgEffScale; /* 0x2C4 */ f32 drawDmgEffFrozenSteamScale; - /* 0x2C8 */ s16 unk_2C8; - /* 0x2CA */ s16 textId; + /* 0x2C8 */ s16 textidOffset; // which of the 4 default states of text this cutscene pertains to + /* 0x2CA */ s16 textType; /* 0x2CC */ s16 eyeIndex; /* 0x2CE */ s16 blinkTimer; /* 0x2D0 */ s16 unk_2D0; @@ -83,7 +83,7 @@ typedef struct EnKaizoku { /* 0x2D4 */ s16 exitIndex; /* 0x2D6 */ s16 csId; /* 0x2D8 */ u8 bool2D8; // bool - /* 0x2D9 */ u8 unk_2D9; + /* 0x2D9 */ u8 unk_2D9; // flag if sfx has played /* 0x2DC */ f32 animEndFrame; /* 0x2E0 */ f32 unk_2E0; /* 0x2E4 */ EnKaizokuAnimation animIndex; @@ -104,7 +104,7 @@ typedef struct EnKaizoku { /* 0x580 */ Vec3f rightFootPos; /* 0x58C */ Vec3f leftFootPos; /* 0x598 */ s32 unk_598; // timer?? why is it double len? - /* 0x59C */ s16 escapeCsState; + /* 0x59C */ s16 cutsceneState; /* 0x59E */ s16 subCamId; /* 0x5A0 */ s16 unk_5A0; /* 0x5A2 */ s16 unk_5A2; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index c5dbf56bd98..7f8626f5a53 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -14661,8 +14661,8 @@ 0x80B85A00:("func_80B85A00",), 0x80B85E18:("EnKaizoku_ChangeAnim",), 0x80B85EA0:("EnKaizoku_ValidatePictograph",), - 0x80B85F48:("func_80B85F48",), - 0x80B85FA8:("func_80B85FA8",), + 0x80B85F48:("EnKaizoku_SetupWaitForApproach",), + 0x80B85FA8:("EnKaizoku_WaitForApproach",), 0x80B86804:("func_80B86804",), 0x80B868B8:("func_80B868B8",), 0x80B86B58:("func_80B86B58",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 188ff2c1d84..d6d3b454469 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -14929,7 +14929,7 @@ 0x80B853F8:("D_80B853F8","f32","",0x4), 0x80B853FC:("D_80B853FC","f32","",0x4), 0x80B85400:("D_80B85400","f32","",0x4), - 0x80B8A8D0:("D_80B8A8D0","UNK_TYPE1","",0x1), + 0x80B8A8D0:("sKaizokuTextIds","UNK_TYPE1","",0x1), 0x80B8A8E4:("D_80B8A8E4","UNK_TYPE4","",0x4), 0x80B8AA04:("D_80B8AA04","UNK_TYPE4","",0x4), 0x80B8AB24:("D_80B8AB24","UNK_TYPE1","",0x1), From 771eab646fbc1e90249d101e3dfa4ebb699d74c4 Mon Sep 17 00:00:00 2001 From: isghj Date: Thu, 9 Jan 2025 21:02:41 -0800 Subject: [PATCH 03/24] Kaizoku: more docs --- assets/xml/objects/object_kz.xml | 73 ++++++++++--------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 41 +++++------ 2 files changed, 59 insertions(+), 55 deletions(-) diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index 8f5a56738e4..78c42629f5c 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -1,26 +1,28 @@  - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - + + + + + + + + @@ -35,16 +37,16 @@ - + - - - + + + - - - - + + + + @@ -82,12 +84,15 @@ - - - - - - - + + + + + + + + + + diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 4d0065c6b1e..940642645da 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -101,7 +101,6 @@ Vec3f D_80B8AA04[] = { { 470.0f, 30.0f, 140.0f }, { 410.0f, 80.0f, 130.0f }, { 410.0f, 80.0f, 130.0f }, { 0.0f, 0.0f, 0.0f }, }; -// assumption: lipstick color, as this is only for her face dl Color_RGBA8 sKaizokuLipstickColors[] = { { 255, 255, 90, 255 }, // yellow { 55, 25, 80, 255 }, // dark purple @@ -215,25 +214,25 @@ static ColliderQuadInit sQuadInit = { }; static AnimationHeader* sAnimations[EN_KAIZOKU_ANIM_MAX] = { - &object_kz_Anim_00F8E4, // EN_KAIZOKU_ANIM_0 - &object_kz_Anim_00EF9C, // EN_KAIZOKU_ANIM_1 - &object_kz_Anim_00E1C8, // EN_KAIZOKU_ANIM_2 - &object_kz_Anim_00DBE4, // EN_KAIZOKU_ANIM_3 - &object_kz_Anim_0058B8, // EN_KAIZOKU_ANIM_4 - &object_kz_Anim_004860, // EN_KAIZOKU_ANIM_5 - &object_kz_Anim_002730, // EN_KAIZOKU_ANIM_6 - &object_kz_Anim_001578, // EN_KAIZOKU_ANIM_7 - &object_kz_Anim_001390, // EN_KAIZOKU_ANIM_8 - &object_kz_Anim_0003CC, // EN_KAIZOKU_ANIM_9 - &object_kz_Anim_000F5C, // EN_KAIZOKU_ANIM_10 - &object_kz_Anim_00E8BC, // EN_KAIZOKU_ANIM_11 - &object_kz_Anim_00ED1C, // EN_KAIZOKU_ANIM_12 - &object_kz_Anim_005644, // EN_KAIZOKU_ANIM_13 - &object_kz_Anim_00F288, // EN_KAIZOKU_ANIM_14 - &object_kz_Anim_0043E4, // EN_KAIZOKU_ANIM_15 - &object_kz_Anim_003A3C, // EN_KAIZOKU_ANIM_16 - &object_kz_Anim_002BA0, // EN_KAIZOKU_ANIM_17 - &object_kz_Anim_001E9C, // EN_KAIZOKU_ANIM_18 + &gKaizokuFightingIdleAnim, // EN_KAIZOKU_ANIM_0 + &gKaizokuOOTConversationAnim, // EN_KAIZOKU_ANIM_1 + &gKaizokuOOTJumpAnim, // EN_KAIZOKU_ANIM_2 + &gKaizokuSidestepAnim, // EN_KAIZOKU_ANIM_3 + &gKaizokuWalkAnim, // EN_KAIZOKU_ANIM_4 + &gKaizokuDamageAnim, // EN_KAIZOKU_ANIM_5 + &gKaizokuDefeatOldAnim, // EN_KAIZOKU_ANIM_6 + &gKaizokuBlockAnim, // EN_KAIZOKU_ANIM_7 + &gKaizokuFlipAnim, // EN_KAIZOKU_ANIM_8 + &gKaizokuSlashAnim, // EN_KAIZOKU_ANIM_9 + &gKaizokuSpinAttackAnim, // EN_KAIZOKU_ANIM_10 + &gKaizokuLandAnim, // EN_KAIZOKU_ANIM_11 + &gKaizokuChallengeTalkAnim, // EN_KAIZOKU_ANIM_12 + &gKaizokuUnsheatheAnim, // EN_KAIZOKU_ANIM_13 + &gKaizokuLowerWeaponsAnim, // EN_KAIZOKU_ANIM_14 + &gKaizokuDemonstrativeSwordSwingAnim, // EN_KAIZOKU_ANIM_15 + &gKaizokuDefeatAnim, // EN_KAIZOKU_ANIM_16 + &gKaizokuDefeatIdleAnim, // EN_KAIZOKU_ANIM_17 + &gKaizokuThrowFlashAnim, // EN_KAIZOKU_ANIM_18 }; static u8 sAnimationModes[EN_KAIZOKU_ANIM_MAX] = { @@ -282,7 +281,7 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { this->colorType = KAIZOKU_GET_TYPE(this); KAIZOKU_GET_TYPE(this) = 0; this->picto.actor.colChkInfo.damageTable = &sDamageTable; - SkelAnime_InitFlex(play, &this->skelAnime, &gKaizokuSkel, &object_kz_Anim_0058B8, this->jointTable, + SkelAnime_InitFlex(play, &this->skelAnime, &gKaizokuSkel, &gKaizokuWalkAnim, this->jointTable, this->morphTable, KAIZOKU_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->bodyCollider, &this->picto.actor, &sCylinderInit); Collider_InitAndSetQuad(play, &this->swordCollider, &this->picto.actor, &sQuadInit); From 17bc8986c6a675262ed3df28bd2cf8622d927ecb Mon Sep 17 00:00:00 2001 From: isghj Date: Thu, 9 Jan 2025 22:16:59 -0800 Subject: [PATCH 04/24] Kaizoku: all object labeled --- assets/xml/objects/object_kz.xml | 92 ++++++++++--------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 18 +++- 2 files changed, 60 insertions(+), 50 deletions(-) diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index 78c42629f5c..2dcedbbc878 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -24,24 +24,24 @@ - - - - - - - - - - + + + + + + + + + + - - + --> + - + @@ -49,39 +49,41 @@ - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 940642645da..ea0c3c58b24 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -2060,11 +2060,11 @@ s32 EnKaizoku_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 *dList = NULL; } - if (limbIndex == KAIZOKU_LIMB_03) { // head root node + if (limbIndex == KAIZOKU_LIMB_NECK) { rot->z += this->headRot.x; rot->x += this->headRot.y; rot->y += this->headRot.z; - } else if (limbIndex == KAIZOKU_LIMB_06) { // face?? her face has a color?? + } else if (limbIndex == KAIZOKU_LIMB_HEAD) { gDPPipeSync(POLY_OPA_DISP++); gDPSetEnvColor(POLY_OPA_DISP++, sKaizokuLipstickColors[this->colorType].r, sKaizokuLipstickColors[this->colorType].g, sKaizokuLipstickColors[this->colorType].b, 255); @@ -2112,13 +2112,21 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVec3f(&sFootOffset, &this->rightFootPos); } - if ((limbIndex == KAIZOKU_LIMB_02) || (limbIndex == KAIZOKU_LIMB_06) || (limbIndex == KAIZOKU_LIMB_07) || + /* + if ((limbIndex == KAIZOKU_LIMB_02) || (limbIndex == KAIZOKU_LIMB_06) || (limbIndex == KAIZOKU_LIMB_07) || (limbIndex == KAIZOKU_LIMB_08) || (limbIndex == KAIZOKU_LIMB_0A) || (limbIndex == KAIZOKU_LIMB_0C) || (limbIndex == KAIZOKU_LIMB_0D) || (limbIndex == KAIZOKU_LIMB_0F) || (limbIndex == KAIZOKU_LIMB_11) || (limbIndex == KAIZOKU_LIMB_12) || (limbIndex == KAIZOKU_LIMB_L_FOOT) || (limbIndex == KAIZOKU_LIMB_14) || (limbIndex == KAIZOKU_LIMB_15) || (limbIndex == KAIZOKU_LIMB_R_FOOT) || (limbIndex == KAIZOKU_LIMB_17)) { - Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); + // */ + + if ((limbIndex == KAIZOKU_LIMB_TORSO) || (limbIndex == KAIZOKU_LIMB_HEAD) || (limbIndex == KAIZOKU_LIMB_R_UPPER_ARM) || + (limbIndex == KAIZOKU_LIMB_R_FOREARM) || (limbIndex == KAIZOKU_LIMB_R_HAND) || (limbIndex == KAIZOKU_LIMB_L_UPPER_ARM) || + (limbIndex == KAIZOKU_LIMB_L_FOREARM) || (limbIndex == KAIZOKU_LIMB_L_HAND) || (limbIndex == KAIZOKU_LIMB_L_THIGH) || + (limbIndex == KAIZOKU_LIMB_L_SHIN) || (limbIndex == KAIZOKU_LIMB_L_FOOT) || (limbIndex == KAIZOKU_LIMB_R_THIGH) || + (limbIndex == KAIZOKU_LIMB_R_SHIN) || (limbIndex == KAIZOKU_LIMB_R_FOOT) || (limbIndex == KAIZOKU_LIMB_WAIST)) { + Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); this->bodyPartIndex++; if (this->bodyPartIndex >= KAIZOKU_BODYPART_MAX) { this->bodyPartIndex = 0; @@ -2132,7 +2140,7 @@ void EnKaizoku_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { if (limbIndex == KAIZOKU_LIMB_R_SWORD) { Matrix_Scale(this->unk_2F8.x, this->unk_2F8.y, this->unk_2F8.z, MTXMODE_APPLY); } - if (limbIndex == KAIZOKU_LIMB_10) { + if (limbIndex == KAIZOKU_LIMB_L_SWORD) { Matrix_Scale(this->unk_304.x, this->unk_304.y, this->unk_304.z, MTXMODE_APPLY); } } From 71cefd797f4727f4017081bf51397d480541d164 Mon Sep 17 00:00:00 2001 From: isghj Date: Thu, 9 Jan 2025 23:27:20 -0800 Subject: [PATCH 05/24] Kaizoku: more docs --- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 252 +++++++++--------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 61 +++-- tools/disasm/functions.txt | 8 +- 3 files changed, 169 insertions(+), 152 deletions(-) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index ea0c3c58b24..42968cf83ee 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -6,6 +6,7 @@ #include "z_en_kaizoku.h" #include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" +#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY | ACTOR_FLAG_10 | ACTOR_FLAG_100000) @@ -19,9 +20,9 @@ void EnKaizoku_Draw(Actor* thisx, PlayState* play); s32 EnKaizoku_ValidatePictograph(PlayState* play, Actor* actor); void EnKaizoku_SetupWaitForApproach(EnKaizoku* this); void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play); -void func_80B868B8(EnKaizoku* this, PlayState* play); -void func_80B86B58(EnKaizoku* this); -void func_80B86B74(EnKaizoku* this, PlayState* play); +void EnKaizoku_Loss(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupWin(EnKaizoku* this); +void EnKaizoku_Win(EnKaizoku* this, PlayState* play); void func_80B872A4(EnKaizoku* this); void func_80B872F4(EnKaizoku* this, PlayState* play); void func_80B874D8(EnKaizoku* this, PlayState* play); @@ -71,12 +72,12 @@ typedef enum EnKaizokuAction { // text Ids static u16 sKaizokuTextIds[] = { - 0x11A4, // (intro) halt - 0x11A5, // you must have courage, going to love doing this to you + 0x11A4, // (intro.1) halt + 0x11A5, // (intro.2) you must have courage, going to love doing this to you 0x11A6, // (win) ouch, dont think this is the end 0x11A7, // (loss) you're nothing to talk about - 0x11A8, // (intro) you go no further - 0x11A9, // you wont get past here + 0x11A8, // (intro.1) go no further + 0x11A9, // (intro.2) you wont get past here 0x11AA, // (win) not bad, but this isnt the end 0x11AB, // (loss) hmph, we're not fools 0x11AC, // (stone mask) we aren't fooled by that mask @@ -214,47 +215,47 @@ static ColliderQuadInit sQuadInit = { }; static AnimationHeader* sAnimations[EN_KAIZOKU_ANIM_MAX] = { - &gKaizokuFightingIdleAnim, // EN_KAIZOKU_ANIM_0 + &gKaizokuFightingIdleAnim, // KAIZOKU_ANIM_FIGHTING_IDLE &gKaizokuOOTConversationAnim, // EN_KAIZOKU_ANIM_1 &gKaizokuOOTJumpAnim, // EN_KAIZOKU_ANIM_2 - &gKaizokuSidestepAnim, // EN_KAIZOKU_ANIM_3 - &gKaizokuWalkAnim, // EN_KAIZOKU_ANIM_4 - &gKaizokuDamageAnim, // EN_KAIZOKU_ANIM_5 + &gKaizokuSidestepAnim, // KAIZOKU_ANIM_SIDESTEP + &gKaizokuWalkAnim, // KAIZOKU_ANIM_WALK + &gKaizokuDamageAnim, // KAIZOKU_ANIM_DAMAGE &gKaizokuDefeatOldAnim, // EN_KAIZOKU_ANIM_6 - &gKaizokuBlockAnim, // EN_KAIZOKU_ANIM_7 - &gKaizokuFlipAnim, // EN_KAIZOKU_ANIM_8 - &gKaizokuSlashAnim, // EN_KAIZOKU_ANIM_9 - &gKaizokuSpinAttackAnim, // EN_KAIZOKU_ANIM_10 - &gKaizokuLandAnim, // EN_KAIZOKU_ANIM_11 - &gKaizokuChallengeTalkAnim, // EN_KAIZOKU_ANIM_12 - &gKaizokuUnsheatheAnim, // EN_KAIZOKU_ANIM_13 - &gKaizokuLowerWeaponsAnim, // EN_KAIZOKU_ANIM_14 - &gKaizokuDemonstrativeSwordSwingAnim, // EN_KAIZOKU_ANIM_15 - &gKaizokuDefeatAnim, // EN_KAIZOKU_ANIM_16 - &gKaizokuDefeatIdleAnim, // EN_KAIZOKU_ANIM_17 - &gKaizokuThrowFlashAnim, // EN_KAIZOKU_ANIM_18 + &gKaizokuBlockAnim, // KAIZOKU_ANIM_BLOCK + &gKaizokuFlipAnim, // KAIZOKU_ANIM_FLIP + &gKaizokuSlashAnim, // KAIZOKU_ANIM_SLASH_ATTCK + &gKaizokuSpinAttackAnim, // KAIZOKU_ANIM_SPIN_ATTACK + &gKaizokuLandAnim, // KAIZOKU_ANIM_LAND + &gKaizokuChallengeTalkAnim, // KAIZOKU_ANIM_CHALLENGE + &gKaizokuUnsheatheAnim, // KAIZOKU_ANIM_UNSHEATHE + &gKaizokuLowerWeaponsAnim, // KAIZOKU_ANIM_LOWER_WEAPONS + &gKaizokuDemonstrativeSwordSwingAnim, // KAIZOKU_ANIM_DEMONSTRATIVE_SWORD_SWING + &gKaizokuDefeatAnim, // KAIZOKU_ANIM_DEFEAT + &gKaizokuDefeatIdleAnim, // KAIZOKU_ANIM_DEFEAT_IDLE + &gKaizokuThrowFlashAnim, // KAIZOKU_ANIM_THROW_FLASH }; static u8 sAnimationModes[EN_KAIZOKU_ANIM_MAX] = { - ANIMMODE_LOOP, // EN_KAIZOKU_ANIM_0 + ANIMMODE_LOOP, // KAIZOKU_ANIM_FIGHTING_IDLE ANIMMODE_LOOP, // EN_KAIZOKU_ANIM_1 ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_2 - ANIMMODE_LOOP, // EN_KAIZOKU_ANIM_3 - ANIMMODE_LOOP, // EN_KAIZOKU_ANIM_4 - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_5 + ANIMMODE_LOOP, // KAIZOKU_ANIM_SIDESTEP + ANIMMODE_LOOP, // KAIZOKU_ANIM_WALK + ANIMMODE_ONCE, // KAIZOKU_ANIM_DAMAGE ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_6 - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_7 - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_8 - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_9 - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_10 - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_11 - ANIMMODE_LOOP, // EN_KAIZOKU_ANIM_12 - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_13 - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_14 - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_15 - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_16 - ANIMMODE_LOOP, // EN_KAIZOKU_ANIM_17 - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_18 + ANIMMODE_ONCE, // KAIZOKU_ANIM_BLOCK + ANIMMODE_ONCE, // KAIZOKU_ANIM_FLIP + ANIMMODE_ONCE, // KAIZOKU_ANIM_SLASH_ATTCK + ANIMMODE_ONCE, // KAIZOKU_ANIM_SPIN_ATTACK + ANIMMODE_ONCE, // KAIZOKU_ANIM_LAND + ANIMMODE_LOOP, // KAIZOKU_ANIM_CHALLENGE + ANIMMODE_ONCE, // KAIZOKU_ANIM_UNSHEATHE + ANIMMODE_ONCE, // KAIZOKU_ANIM_LOWER_WEAPONS + ANIMMODE_ONCE, // KAIZOKU_ANIM_DEMONSTRATIVE_SWORD_SWING + ANIMMODE_ONCE, // KAIZOKU_ANIM_DEFEAT + ANIMMODE_LOOP, // KAIZOKU_ANIM_DEFEAT_IDLE + ANIMMODE_ONCE, // KAIZOKU_ANIM_THROW_FLASH }; void EnKaizoku_Init(Actor* thisx, PlayState* play) { @@ -478,7 +479,7 @@ void EnKaizoku_SetupWaitForApproach(EnKaizoku* this) { void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; - s32 sp54; + s32 nextTextId; switch (this->cutsceneState) { case 0: // waiting @@ -496,7 +497,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - sp54 = (this->textType * 4) + this->textidOffset; + nextTextId = (this->textType * 4) + this->textidOffset; if (this->colorType != 2) { player->actor.world.pos.x = this->picto.actor.home.pos.x + 90.0f; player->actor.world.pos.z = this->picto.actor.home.pos.z + 30.0f; @@ -508,8 +509,8 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { player->actor.speed = 0.0f; this->picto.actor.world.pos.x = this->picto.actor.home.pos.x; this->picto.actor.world.pos.z = this->picto.actor.home.pos.z; - Message_StartTextbox(play, sKaizokuTextIds[sp54], &this->picto.actor); - this->textidOffset++; + Message_StartTextbox(play, sKaizokuTextIds[nextTextId], &this->picto.actor); + this->textidOffset++; // KAIZOKU_COVERSATION_INTRO_2 this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); @@ -517,7 +518,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { Math_Vec3f_Copy(&this->subCamAt, &this->unk_5D4); this->subCamUp.x = -0.11f; this->picto.actor.draw = EnKaizoku_Draw; - this->unk_598 = 0; + this->cutsceneTimer = 0; Audio_SetMainBgmVolume(0, 0xA); this->cutsceneState++; // fallthrough @@ -536,8 +537,8 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_11); - this->unk_598 = 0; + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_LAND); + this->cutsceneTimer = 0; this->cutsceneState++; this->picto.actor.gravity = -2.0f; } @@ -557,7 +558,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { if (curFrame >= 11.0f) { this->cutsceneState++; - this->unk_598 = 0; + this->cutsceneTimer = 0; this->subCamUp.x = 0.0f; } } @@ -565,19 +566,20 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { case 3: if (curFrame >= this->animEndFrame) { - sp54 = this->textType * 4 + this->textidOffset; + nextTextId = this->textType * 4 + this->textidOffset; if (Player_GetMask(play) == PLAYER_MASK_STONE) { - if (sKaizokuTextIds[sp54] == 0x11A5) { - sp54 = 8; - } else if (sKaizokuTextIds[sp54] == 0x11A9) { - sp54 = 9; + // adjust textIds to mention the mask + if (sKaizokuTextIds[nextTextId] == 0x11A5) { + nextTextId = 8; + } else if (sKaizokuTextIds[nextTextId] == 0x11A9) { + nextTextId = 9; } } - Message_StartTextbox(play, sKaizokuTextIds[sp54], &this->picto.actor); - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_12); - this->textidOffset++; - this->unk_598 = 0; + Message_StartTextbox(play, sKaizokuTextIds[nextTextId], &this->picto.actor); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_CHALLENGE); + this->textidOffset++; // KAIZOKU_COVERSATION_INTRO_WIN, although that gets set directly later + this->cutsceneTimer = 0; this->cutsceneState++; } break; @@ -585,11 +587,11 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { case 4: if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->unk_598 = 0; + this->cutsceneTimer = 0; this->cutsceneState++; Audio_SetMainBgmVolume(0x7F, 0); Audio_PlayBgm_StorePrevBgm(NA_BGM_MINI_BOSS); - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_13); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_UNSHEATHE); } break; @@ -599,7 +601,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_BOSU_SWORD); } if (curFrame >= 30.0f) { - this->unk_598 = 0; + this->cutsceneTimer = 0; this->cutsceneState++; } break; @@ -607,7 +609,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { case 6: Math_ApproachF(&this->unk_5E0, 5.0f, 0.3f, 1.0f); if (curFrame >= this->animEndFrame) { - this->unk_598 = 7; + this->cutsceneTimer = 7; this->unk_2F8.x = 1.0f; this->cutsceneState++; this->unk_2F8.y = 1.0f; @@ -619,7 +621,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { break; case 7: - if (this->unk_598 == 0) { + if (this->cutsceneTimer == 0) { Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csId); this->cutsceneState = 0; @@ -676,7 +678,8 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } } -void func_80B86804(EnKaizoku* this, PlayState* play) { + +void EnKaizoku_SetupLoss(EnKaizoku* this, PlayState* play) { if (this->subCamId == SUB_CAM_ID_DONE) { if (!CutsceneManager_IsNext(this->csId)) { CutsceneManager_Queue(this->csId); @@ -689,15 +692,15 @@ void func_80B86804(EnKaizoku* this, PlayState* play) { this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->timer2B2 = 30; this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; - this->unk_598 = 0; + this->cutsceneTimer = 0; this->cutsceneState = 0; this->bool2D8 = false; this->action = KAIZOKU_ACTION_0; - this->actionFunc = func_80B868B8; + this->actionFunc = EnKaizoku_Loss; this->picto.actor.speed = 0.0f; } -void func_80B868B8(EnKaizoku* this, PlayState* play) { +void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); @@ -712,9 +715,9 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { switch (this->cutsceneState) { case 0: if (curFrame >= this->animEndFrame) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_14); - this->textidOffset = 3; - this->unk_598 = 0; + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_LOWER_WEAPONS); + this->textidOffset = KAIZOKU_COVERSATION_LOSS; + this->cutsceneTimer = 0; this->cutsceneState++; } break; @@ -723,11 +726,11 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { if (curFrame >= this->animEndFrame) { s32 textId; - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_15); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DEMONSTRATIVE_SWORD_SWING); textId = this->textType * 4 + this->textidOffset; Message_StartTextbox(play, sKaizokuTextIds[textId], &this->picto.actor); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_LAST2_SHOUT); - this->unk_598 = 0; + this->cutsceneTimer = 0; this->cutsceneState++; } break; @@ -759,13 +762,13 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { } } -void func_80B86B58(EnKaizoku* this) { +void EnKaizoku_SetupWin(EnKaizoku* this) { this->bool2D8 = 0; this->action = KAIZOKU_ACTION_0; - this->actionFunc = func_80B86B74; + this->actionFunc = EnKaizoku_Win; } -void func_80B86B74(EnKaizoku* this, PlayState* play) { +void EnKaizoku_Win(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 textId; f32 curFrame = this->skelAnime.curFrame; @@ -788,20 +791,20 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); switch (this->cutsceneState) { case 0: - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_17); - this->textidOffset = 2; + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DEFEAT_IDLE); + this->textidOffset = KAIZOKU_COVERSATION_WIN; textId = this->textType * 4 + this->textidOffset; Message_StartTextbox(play, sKaizokuTextIds[textId], &this->picto.actor); - this->unk_2D9 = 0; - this->unk_598 = 0; + this->defeatBreathingStarted = 0; + this->cutsceneTimer = 0; this->cutsceneState++; break; case 1: if (curFrame >= this->animEndFrame) { - if (this->unk_2D9 == 0) { + if (this->defeatBreathingStarted == 0) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DAMM_BREATH); - this->unk_2D9 = 1; + this->defeatBreathingStarted = 1; } else { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } @@ -809,10 +812,10 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_18); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_THROW_FLASH); Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_133); - this->unk_5A0 = 0; - this->unk_598 = 0; + this->flashTimer = 0; + this->cutsceneTimer = 0; this->cutsceneState++; } break; @@ -825,38 +828,41 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { this->unk_5D4.x = player->actor.world.pos.x - 110.0f; this->unk_5D4.y = player->actor.world.pos.y; this->unk_5D4.z = player->actor.world.pos.z + 30.0f; - this->unk_5A0++; + this->flashTimer++; if (curFrame >= 1.0f) { Math_ApproachZeroF(&this->unk_2F8.x, 0.3f, 0.3f); Math_ApproachZeroF(&this->unk_304.x, 0.3f, 0.3f); this->unk_2F8.z = this->unk_2F8.y = this->unk_2F8.x; this->unk_304.z = this->unk_304.y = this->unk_304.x; } - if (this->unk_5A0 == 0x12) { - Actor* temp_v0_2; + if (this->flashTimer == 0x12) { + Actor* dekuNut; Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_SHOUT); - temp_v0_2 = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, this->picto.actor.world.pos.x, - this->picto.actor.world.pos.y + 10.0f, this->picto.actor.world.pos.z, - this->picto.actor.shape.rot.x, this->picto.actor.shape.rot.y, - this->picto.actor.shape.rot.z, -8); - if (temp_v0_2 != NULL) { - temp_v0_2->gravity = -10.0f; + // oddly, instead of just playing the sfx and spawning an effect + // they spawn a real nut + dekuNut = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, + this->picto.actor.world.pos.x, this->picto.actor.world.pos.y + 10.0f, this->picto.actor.world.pos.z, + this->picto.actor.shape.rot.x, this->picto.actor.shape.rot.y, this->picto.actor.shape.rot.z, + -ARROW_TYPE_DEKU_NUT); + + if (dekuNut != NULL) { + dekuNut->gravity = -10.0f; play->envCtx.fillScreen = true; } } - if (this->unk_5A0 >= 0x12) { - Math_ApproachF(&this->unk_5EC, 60.0f, 1.0f, 20.0f); - this->unk_5E8 = this->unk_5EC / 60.0f; - play->envCtx.screenFillColor[3] = this->unk_5E8 * 255.0f; + if (this->flashTimer >= 0x12) { + Math_ApproachF(&this->flashScreenAlphaTarget, 60.0f, 1.0f, 20.0f); + this->flashScreenAlpha = this->flashScreenAlphaTarget / 60.0f; + play->envCtx.screenFillColor[3] = this->flashScreenAlpha * 255.0f; play->envCtx.screenFillColor[0] = play->envCtx.screenFillColor[1] = play->envCtx.screenFillColor[2] = 255; } - if ((curFrame >= this->animEndFrame) && (this->unk_5A0 >= 0x28)) { + if ((curFrame >= this->animEndFrame) && (this->flashTimer >= 0x28)) { this->picto.actor.draw = NULL; - this->unk_598 = 10; + this->cutsceneTimer = 10; Math_Vec3f_Copy(&this->unk_2F8, &gZeroVec3f); Math_Vec3f_Copy(&this->unk_304, &gZeroVec3f); this->cutsceneState++; @@ -864,10 +870,10 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { break; case 3: - if (this->unk_598 == 0) { - Math_ApproachZeroF(&this->unk_5EC, 0.5f, 10.0f); - this->unk_5E8 = this->unk_5EC / 60.0f; - play->envCtx.screenFillColor[3] = this->unk_5E8 * 255.0f; + if (this->cutsceneTimer == 0) { + Math_ApproachZeroF(&this->flashScreenAlphaTarget, 0.5f, 10.0f); + this->flashScreenAlpha = this->flashScreenAlphaTarget / 60.0f; + play->envCtx.screenFillColor[3] = this->flashScreenAlpha * 255.0f; if (play->envCtx.screenFillColor[3] < 10) { play->envCtx.screenFillColor[0] = 0; play->envCtx.screenFillColor[1] = 0; @@ -909,7 +915,7 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { // this is the start-combat actionfunction after cutscene, but do we want to start immediately with an attack? is there a standing version we could start with? void func_80B872A4(EnKaizoku* this) { this->picto.actor.speed = 0.0f; - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_0); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FIGHTING_IDLE); this->action = KAIZOKU_ACTION_1; this->actionFunc = func_80B872F4; this->picto.actor.shape.shadowScale = 90.0f; @@ -947,7 +953,7 @@ void func_80B872F4(EnKaizoku* this, PlayState* play) { void func_80B874D8(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_3); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SIDESTEP); if (Math_SinS(player->actor.shape.rot.y - this->picto.actor.shape.rot.y) > 0.0f) { this->picto.actor.speed = -10.0f; } else if (Math_SinS(player->actor.shape.rot.y - this->picto.actor.shape.rot.y) < 0.0f) { @@ -1035,7 +1041,7 @@ void func_80B8760C(EnKaizoku* this, PlayState* play) { } void func_80B87900(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_7); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_BLOCK); if (this->swordState != 0) { this->swordState = -1; @@ -1108,7 +1114,7 @@ void func_80B8798C(EnKaizoku* this, PlayState* play) { } void func_80B87C7C(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_8); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FLIP); this->picto.actor.speed = 6.5f; this->picto.actor.velocity.y = 15.0f; Actor_PlaySfx(&this->picto.actor, NA_SE_EN_TEKU_JUMP); @@ -1156,7 +1162,7 @@ void func_80B87D3C(EnKaizoku* this, PlayState* play) { } void func_80B87E28(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_8); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FLIP); this->picto.actor.speed = -8.0f; Actor_PlaySfx(&this->picto.actor, NA_SE_EN_TEKU_JUMP); this->bodyCollider.info.elemType = ELEMTYPE_UNK4; @@ -1185,7 +1191,7 @@ void func_80B87E9C(EnKaizoku* this, PlayState* play) { } void func_80B87F70(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_9); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SLASH_ATTCK); this->unk_2D0 = 0; this->swordCollider.base.atFlags &= ~AT_BOUNCED; this->picto.actor.speed = 0.0f; @@ -1253,7 +1259,7 @@ void func_80B87FDC(EnKaizoku* this, PlayState* play2) { } void func_80B88214(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_8); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FLIP); this->timer2B2 = 0; this->picto.actor.speed = 10.0f; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; @@ -1281,7 +1287,7 @@ void func_80B88278(EnKaizoku* this, PlayState* play) { } void func_80B8833C(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_4); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_WALK); this->action = KAIZOKU_ACTION_4; this->actionFunc = func_80B88378; } @@ -1359,7 +1365,7 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { } void func_80B88770(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_3); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SIDESTEP); this->action = KAIZOKU_ACTION_10; this->actionFunc = func_80B887AC; } @@ -1394,7 +1400,7 @@ void func_80B887AC(EnKaizoku* this, PlayState* play) { // long roundhouse jump attack void func_80B88910(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_10); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SPIN_ATTACK); this->swordCollider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); this->unk_2D0 = 0; this->action = KAIZOKU_ACTION_11; @@ -1474,7 +1480,7 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { } void func_80B88CD8(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_3); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SIDESTEP); this->picto.actor.speed = Rand_CenteredFloat(12.0f); this->skelAnime.playSpeed = 1.0f; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; @@ -1577,7 +1583,7 @@ void EnKaizoku_SetupStunned(EnKaizoku* this) { } if (this->action == KAIZOKU_ACTION_11) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_5); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DAMAGE); } if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || @@ -1640,7 +1646,7 @@ void func_80B893CC(EnKaizoku* this, PlayState* play) { this->lookTimer = 0; this->bool2D8 = 0; this->picto.actor.speed = 0.0f; - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_5); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DAMAGE); if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && @@ -1686,7 +1692,7 @@ void func_80B8960C(EnKaizoku* this, PlayState* play) { Matrix_RotateYS(this->picto.actor.yawTowardsPlayer, MTXMODE_NEW); Matrix_MultVecZ(-10.0f, &sp24); Math_Vec3f_Copy(&this->unk_3C4, &sp24); - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_16); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DEFEAT); if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && @@ -1701,7 +1707,7 @@ void func_80B8960C(EnKaizoku* this, PlayState* play) { this->picto.actor.flags |= ACTOR_FLAG_CANT_LOCK_ON; this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->picto.actor.flags &= ~ACTOR_FLAG_400; - this->unk_598 = 0; + this->cutsceneTimer = 0; this->cutsceneState = 0; this->action = KAIZOKU_ACTION_15; this->actionFunc = func_80B8971C; @@ -1769,12 +1775,14 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (curFrame >= this->animEndFrame) { this->bool2D8 = 0; - func_80B86B58(this); + EnKaizoku_SetupWin(this); } else if (Animation_OnFrame(&this->skelAnime, 10.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_DOWN); } } + +// handle damage to player and from player void func_80B89A08(EnKaizoku* this, PlayState* play) { s32 sp64 = 0; Vec3f sp58; @@ -1794,11 +1802,11 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { if (!CutsceneManager_IsNext(this->csId)) { CutsceneManager_Queue(this->csId); - this->actionFunc = func_80B86804; + this->actionFunc = EnKaizoku_SetupLoss; } else { CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); - this->actionFunc = func_80B86804; + this->actionFunc = EnKaizoku_SetupLoss; } return; } else if ((this->action == KAIZOKU_ACTION_11) && (this->swordCollider.base.at == &GET_PLAYER(play)->actor)) { @@ -1812,11 +1820,11 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { if (!CutsceneManager_IsNext(this->csId)) { CutsceneManager_Queue(this->csId); - this->actionFunc = func_80B86804; + this->actionFunc = EnKaizoku_SetupLoss; } else { CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); - this->actionFunc = func_80B86804; + this->actionFunc = EnKaizoku_SetupLoss; } return; } @@ -2003,7 +2011,7 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { DECR (this->timer2B2); DECR (this->lookTimer); DECR (this->unk_2B6); - DECR (this->unk_598); + DECR (this->cutsceneTimer); DECR (this->colorFilterTimer); this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index 204a038684f..9a7c4d8e025 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -16,26 +16,27 @@ typedef void (*EnKaizokuActionFunc)(struct EnKaizoku*, PlayState*); #define KAIZOKU_SWITCH_FLAG_NONE 0x7F +// todo name these typedef enum EnKaizokuAnimation { - /* 0 */ EN_KAIZOKU_ANIM_0, + /* 0 */ KAIZOKU_ANIM_FIGHTING_IDLE, /* 1 */ EN_KAIZOKU_ANIM_1, /* 2 */ EN_KAIZOKU_ANIM_2, - /* 3 */ EN_KAIZOKU_ANIM_3, - /* 4 */ EN_KAIZOKU_ANIM_4, - /* 5 */ EN_KAIZOKU_ANIM_5, + /* 3 */ KAIZOKU_ANIM_SIDESTEP, + /* 4 */ KAIZOKU_ANIM_WALK, + /* 5 */ KAIZOKU_ANIM_DAMAGE, /* 6 */ EN_KAIZOKU_ANIM_6, - /* 7 */ EN_KAIZOKU_ANIM_7, - /* 8 */ EN_KAIZOKU_ANIM_8, - /* 9 */ EN_KAIZOKU_ANIM_9, - /* 10 */ EN_KAIZOKU_ANIM_10, - /* 11 */ EN_KAIZOKU_ANIM_11, - /* 12 */ EN_KAIZOKU_ANIM_12, - /* 13 */ EN_KAIZOKU_ANIM_13, - /* 14 */ EN_KAIZOKU_ANIM_14, - /* 15 */ EN_KAIZOKU_ANIM_15, - /* 16 */ EN_KAIZOKU_ANIM_16, - /* 17 */ EN_KAIZOKU_ANIM_17, - /* 18 */ EN_KAIZOKU_ANIM_18, + /* 7 */ KAIZOKU_ANIM_BLOCK, + /* 8 */ KAIZOKU_ANIM_FLIP, + /* 9 */ KAIZOKU_ANIM_SLASH_ATTCK, + /* 10 */ KAIZOKU_ANIM_SPIN_ATTACK, + /* 11 */ KAIZOKU_ANIM_LAND, + /* 12 */ KAIZOKU_ANIM_CHALLENGE, + /* 13 */ KAIZOKU_ANIM_UNSHEATHE, + /* 14 */ KAIZOKU_ANIM_LOWER_WEAPONS, + /* 15 */ KAIZOKU_ANIM_DEMONSTRATIVE_SWORD_SWING, + /* 16 */ KAIZOKU_ANIM_DEFEAT, + /* 17 */ KAIZOKU_ANIM_DEFEAT_IDLE, + /* 18 */ KAIZOKU_ANIM_THROW_FLASH, /* 19 */ EN_KAIZOKU_ANIM_MAX } EnKaizokuAnimation; @@ -58,6 +59,14 @@ typedef enum EnKaizokuBodyPart { /* 15 */ KAIZOKU_BODYPART_MAX } EnKaizokuBodyPart; +typedef enum KaizokuTextOffset{ + /* 0 */ KAIZOKU_COVERSATION_INTRO_1, + /* 1 */ KAIZOKU_COVERSATION_INTRO_2, + /* 2 */ KAIZOKU_COVERSATION_WIN, + /* 3 */ KAIZOKU_COVERSATION_LOSS, +} KaizokuTextOffset; + + typedef struct EnKaizoku { /* 0x000 */ PictoActor picto; /* 0x148 */ SkelAnime skelAnime; @@ -68,13 +77,13 @@ typedef struct EnKaizoku { /* 0x2B2 */ s16 timer2B2; // unk timer /* 0x2B4 */ s16 lookTimer; /* 0x2B6 */ s16 unk_2B6; // timer - /* 0x2B8 */ s16 colorFilterTimer; // name taken from oot, actor is damaged flashing red + /* 0x2B8 */ s16 colorFilterTimer; // name taken from oot, damaged flashing red /* 0x2BA */ s16 drawDmgEffType; /* 0x2BC */ s16 switchFlag; /* 0x2BE */ s16 unk_2BE; /* 0x2C0 */ f32 drawDmgEffScale; /* 0x2C4 */ f32 drawDmgEffFrozenSteamScale; - /* 0x2C8 */ s16 textidOffset; // which of the 4 default states of text this cutscene pertains to + /* 0x2C8 */ s16 textidOffset; // which of the 4 text states during interaction /* 0x2CA */ s16 textType; /* 0x2CC */ s16 eyeIndex; /* 0x2CE */ s16 blinkTimer; @@ -83,9 +92,9 @@ typedef struct EnKaizoku { /* 0x2D4 */ s16 exitIndex; /* 0x2D6 */ s16 csId; /* 0x2D8 */ u8 bool2D8; // bool - /* 0x2D9 */ u8 unk_2D9; // flag if sfx has played + /* 0x2D9 */ u8 defeatBreathingStarted; /* 0x2DC */ f32 animEndFrame; - /* 0x2E0 */ f32 unk_2E0; + /* 0x2E0 */ f32 unk_2E0; // walking vector magnitude? /* 0x2E4 */ EnKaizokuAnimation animIndex; /* 0x2E8 */ s32 bodyPartIndex; /* 0x2EC */ s32 colorType; @@ -103,20 +112,20 @@ typedef struct EnKaizoku { /* 0x578 */ Vec3s headRot; /* 0x580 */ Vec3f rightFootPos; /* 0x58C */ Vec3f leftFootPos; - /* 0x598 */ s32 unk_598; // timer?? why is it double len? + /* 0x598 */ s32 cutsceneTimer; // why is it double len? /* 0x59C */ s16 cutsceneState; /* 0x59E */ s16 subCamId; - /* 0x5A0 */ s16 unk_5A0; - /* 0x5A2 */ s16 unk_5A2; + /* 0x5A0 */ s16 flashTimer; + /* 0x5A2 */ s16 unused5A2; // never referenced in code? /* 0x5A4 */ Vec3f subCamEye; /* 0x5B0 */ Vec3f subCamAt; /* 0x5BC */ Vec3f subCamUp; /* 0x5C8 */ Vec3f unk_5C8; /* 0x5D4 */ Vec3f unk_5D4; - /* 0x5E0 */ f32 unk_5E0; + /* 0x5E0 */ f32 unk_5E0; // manual cutscene camera control? /* 0x5E4 */ f32 unk_5E4; - /* 0x5E8 */ f32 unk_5E8; - /* 0x5EC */ f32 unk_5EC; + /* 0x5E8 */ f32 flashScreenAlpha; + /* 0x5EC */ f32 flashScreenAlphaTarget; } EnKaizoku; // size = 0x5F0 #endif // Z_EN_KAIZOKU_H diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 7f8626f5a53..7caa3a2812c 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -14663,10 +14663,10 @@ 0x80B85EA0:("EnKaizoku_ValidatePictograph",), 0x80B85F48:("EnKaizoku_SetupWaitForApproach",), 0x80B85FA8:("EnKaizoku_WaitForApproach",), - 0x80B86804:("func_80B86804",), - 0x80B868B8:("func_80B868B8",), - 0x80B86B58:("func_80B86B58",), - 0x80B86B74:("func_80B86B74",), + 0x80B86804:("EnKaizoku_SetupLoss",), + 0x80B868B8:("EnKaizoku_Loss",), + 0x80B86B58:("EnKaizoku_SetupWin",), + 0x80B86B74:("EnKaizoku_Win",), 0x80B872A4:("func_80B872A4",), 0x80B872F4:("func_80B872F4",), 0x80B874D8:("func_80B874D8",), From 4dc770d79197915c3ef0c93f6fcf0ad078c9de60 Mon Sep 17 00:00:00 2001 From: isghj Date: Fri, 10 Jan 2025 00:16:26 -0800 Subject: [PATCH 06/24] More docs --- assets/xml/objects/object_kz.xml | 43 +++++++++++-------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 20 ++++----- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index 2dcedbbc878..e4cb5e68f63 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -14,15 +14,16 @@ - - - - - - - - - + + + + + + + + + + @@ -35,18 +36,22 @@ - --> - - + + + + + - - - + + + - - - - + + + + + + diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 42968cf83ee..9534c19ecc1 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -84,7 +84,7 @@ static u16 sKaizokuTextIds[] = { 0x11AD, // (stone mask) did you think that mask would work? }; -Vec3f D_80B8A8E4[] = { +static Vec3f sCutsceneCameraPositions[] = { { -70.0f, 9.0f, 30.0f }, { -70.0f, 9.0f, 30.0f }, { -70.0f, 9.0f, 30.0f }, { 41.0f, 55.0f, 11.0f }, { 41.0f, 55.0f, 11.0f }, { 70.0f, 45.0f, 35.0f }, { 80.0f, 45.0f, 25.0f }, { 0.0f, 0.0f, 0.0f }, { -70.0f, 9.0f, 30.0f }, { -70.0f, 9.0f, 30.0f }, { -70.0f, 9.0f, 30.0f }, { 41.0f, 55.0f, 11.0f }, @@ -93,7 +93,7 @@ Vec3f D_80B8A8E4[] = { { -41.0f, 55.0f, -11.0f }, { -70.0f, 45.0f, -25.0f }, { -80.0f, 45.0f, -25.0f }, { 0.0f, 0.0f, 0.0f }, }; -Vec3f D_80B8AA04[] = { +Vec3f sCutsceneCameraTargetPositions[] = { { 120.0f, 60.0f, -20.0f }, { 120.0f, 60.0f, -20.0f }, { 120.0f, 60.0f, -20.0f }, { -470.0f, 30.0f, -140.0f }, { -470.0f, 30.0f, -140.0f }, { -410.0f, 80.0f, -130.0f }, { -410.0f, 80.0f, -130.0f }, { 0.0f, 0.0f, 0.0f }, { 120.0f, 60.0f, -20.0f }, { 120.0f, 60.0f, -20.0f }, { 120.0f, 60.0f, -20.0f }, { -470.0f, 30.0f, -140.0f }, @@ -635,16 +635,16 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } if (this->cutsceneState < 7) { - s32 temp_v0_3 = this->colorType * 8; + s32 typeCameraOffset = this->colorType * 8; - temp_v0_3 += this->cutsceneState; - this->unk_5C8.x = D_80B8A8E4[temp_v0_3].x + this->picto.actor.home.pos.x; - this->unk_5C8.y = D_80B8A8E4[temp_v0_3].y + player->actor.world.pos.y; - this->unk_5C8.z = D_80B8A8E4[temp_v0_3].z + this->picto.actor.home.pos.z; + typeCameraOffset += this->cutsceneState; + this->unk_5C8.x = sCutsceneCameraPositions[typeCameraOffset].x + this->picto.actor.home.pos.x; + this->unk_5C8.y = sCutsceneCameraPositions[typeCameraOffset].y + player->actor.world.pos.y; + this->unk_5C8.z = sCutsceneCameraPositions[typeCameraOffset].z + this->picto.actor.home.pos.z; - this->unk_5D4.x = D_80B8AA04[temp_v0_3].x + this->picto.actor.home.pos.x; - this->unk_5D4.y = D_80B8AA04[temp_v0_3].y + player->actor.world.pos.y; - this->unk_5D4.z = D_80B8AA04[temp_v0_3].z + this->picto.actor.home.pos.z; + this->unk_5D4.x = sCutsceneCameraTargetPositions[typeCameraOffset].x + this->picto.actor.home.pos.x; + this->unk_5D4.y = sCutsceneCameraTargetPositions[typeCameraOffset].y + player->actor.world.pos.y; + this->unk_5D4.z = sCutsceneCameraTargetPositions[typeCameraOffset].z + this->picto.actor.home.pos.z; } if (this->cutsceneState >= 5) { From 7283dcc5834f9f7351145bce6074375d4dd5092e Mon Sep 17 00:00:00 2001 From: isghj Date: Sat, 11 Jan 2025 13:49:48 -0800 Subject: [PATCH 07/24] Kaizoku: more docs --- assets/xml/objects/object_kz.xml | 16 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 189 +++++++++--------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 24 +-- 3 files changed, 113 insertions(+), 116 deletions(-) diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index e4cb5e68f63..5631322b74b 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -5,19 +5,20 @@ - + - + - + - - + + + @@ -36,8 +37,7 @@ - - + @@ -50,7 +50,7 @@ - + diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 9534c19ecc1..bb67f51f081 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -221,7 +221,7 @@ static AnimationHeader* sAnimations[EN_KAIZOKU_ANIM_MAX] = { &gKaizokuSidestepAnim, // KAIZOKU_ANIM_SIDESTEP &gKaizokuWalkAnim, // KAIZOKU_ANIM_WALK &gKaizokuDamageAnim, // KAIZOKU_ANIM_DAMAGE - &gKaizokuDefeatOldAnim, // EN_KAIZOKU_ANIM_6 + &gKaizokuOOTDefeatAnim, // EN_KAIZOKU_ANIM_6 &gKaizokuBlockAnim, // KAIZOKU_ANIM_BLOCK &gKaizokuFlipAnim, // KAIZOKU_ANIM_FLIP &gKaizokuSlashAnim, // KAIZOKU_ANIM_SLASH_ATTCK @@ -469,8 +469,8 @@ s32 EnKaizoku_ValidatePictograph(PlayState* play, Actor* actor) { } void EnKaizoku_SetupWaitForApproach(EnKaizoku* this) { - Math_Vec3f_Copy(&this->unk_2F8, &gZeroVec3f); - Math_Vec3f_Copy(&this->unk_304, &gZeroVec3f); + Math_Vec3f_Copy(&this->swordScaleRight, &gZeroVec3f); + Math_Vec3f_Copy(&this->swordScaleLeft, &gZeroVec3f); this->bool2D8 = true; this->action = KAIZOKU_ACTION_0; this->actionFunc = EnKaizoku_WaitForApproach; @@ -514,8 +514,8 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); - Math_Vec3f_Copy(&this->subCamEye, &this->unk_5C8); - Math_Vec3f_Copy(&this->subCamAt, &this->unk_5D4); + Math_Vec3f_Copy(&this->subCamEye, &this->subCamEyeTarget); + Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtTarget); this->subCamUp.x = -0.11f; this->picto.actor.draw = EnKaizoku_Draw; this->cutsceneTimer = 0; @@ -596,7 +596,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { break; case 5: - Math_ApproachF(&this->unk_5E0, 2.0f, 0.2f, 1.0f); + Math_ApproachF(&this->subCamVelocity, 2.0f, 0.2f, 1.0f); if (Animation_OnFrame(&this->skelAnime, 20.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_BOSU_SWORD); } @@ -607,16 +607,16 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { break; case 6: - Math_ApproachF(&this->unk_5E0, 5.0f, 0.3f, 1.0f); + Math_ApproachF(&this->subCamVelocity, 5.0f, 0.3f, 1.0f); if (curFrame >= this->animEndFrame) { this->cutsceneTimer = 7; - this->unk_2F8.x = 1.0f; + this->swordScaleRight.x = 1.0f; this->cutsceneState++; - this->unk_2F8.y = 1.0f; - this->unk_2F8.z = 1.0f; - this->unk_304.x = 1.0f; - this->unk_304.y = 1.0f; - this->unk_304.z = 1.0f; + this->swordScaleRight.y = 1.0f; + this->swordScaleRight.z = 1.0f; + this->swordScaleLeft.x = 1.0f; + this->swordScaleLeft.y = 1.0f; + this->swordScaleLeft.z = 1.0f; } break; @@ -635,40 +635,40 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } if (this->cutsceneState < 7) { - s32 typeCameraOffset = this->colorType * 8; + s32 cameraIndex = this->colorType * 8; - typeCameraOffset += this->cutsceneState; - this->unk_5C8.x = sCutsceneCameraPositions[typeCameraOffset].x + this->picto.actor.home.pos.x; - this->unk_5C8.y = sCutsceneCameraPositions[typeCameraOffset].y + player->actor.world.pos.y; - this->unk_5C8.z = sCutsceneCameraPositions[typeCameraOffset].z + this->picto.actor.home.pos.z; + cameraIndex += this->cutsceneState; + this->subCamEyeTarget.x = sCutsceneCameraPositions[cameraIndex].x + this->picto.actor.home.pos.x; + this->subCamEyeTarget.y = sCutsceneCameraPositions[cameraIndex].y + player->actor.world.pos.y; + this->subCamEyeTarget.z = sCutsceneCameraPositions[cameraIndex].z + this->picto.actor.home.pos.z; - this->unk_5D4.x = sCutsceneCameraTargetPositions[typeCameraOffset].x + this->picto.actor.home.pos.x; - this->unk_5D4.y = sCutsceneCameraTargetPositions[typeCameraOffset].y + player->actor.world.pos.y; - this->unk_5D4.z = sCutsceneCameraTargetPositions[typeCameraOffset].z + this->picto.actor.home.pos.z; + this->subCamAtTarget.x = sCutsceneCameraTargetPositions[cameraIndex].x + this->picto.actor.home.pos.x; + this->subCamAtTarget.y = sCutsceneCameraTargetPositions[cameraIndex].y + player->actor.world.pos.y; + this->subCamAtTarget.z = sCutsceneCameraTargetPositions[cameraIndex].z + this->picto.actor.home.pos.z; } if (this->cutsceneState >= 5) { if (curFrame >= 6.0f) { - Math_ApproachF(&this->unk_2F8.x, 1.0f, 0.3f, 0.3f); - this->unk_2F8.z = this->unk_2F8.y = this->unk_2F8.x; + Math_ApproachF(&this->swordScaleRight.x, 1.0f, 0.3f, 0.3f); + this->swordScaleRight.z = this->swordScaleRight.y = this->swordScaleRight.x; } if (curFrame >= 22.0f) { - Math_ApproachF(&this->unk_304.x, 1.0f, 0.3f, 0.3f); - this->unk_304.z = this->unk_304.y = this->unk_304.x; + Math_ApproachF(&this->swordScaleLeft.x, 1.0f, 0.3f, 0.3f); + this->swordScaleLeft.z = this->swordScaleLeft.y = this->swordScaleLeft.x; } } if (this->cutsceneState >= 5) { - Math_ApproachF(&this->subCamEye.x, this->unk_5C8.x, 0.5f, this->unk_5E0); - Math_ApproachF(&this->subCamEye.y, this->unk_5C8.y, 0.5f, this->unk_5E0); - Math_ApproachF(&this->subCamEye.z, this->unk_5C8.z, 0.5f, this->unk_5E0); - Math_ApproachF(&this->subCamAt.x, this->unk_5D4.x, 0.5f, this->unk_5E0); - Math_ApproachF(&this->subCamAt.y, this->unk_5D4.y, 0.5f, this->unk_5E0); - Math_ApproachF(&this->subCamAt.z, this->unk_5D4.z, 0.5f, this->unk_5E0); + Math_ApproachF(&this->subCamEye.x, this->subCamEyeTarget.x, 0.5f, this->subCamVelocity); + Math_ApproachF(&this->subCamEye.y, this->subCamEyeTarget.y, 0.5f, this->subCamVelocity); + Math_ApproachF(&this->subCamEye.z, this->subCamEyeTarget.z, 0.5f, this->subCamVelocity); + Math_ApproachF(&this->subCamAt.x, this->subCamAtTarget.x, 0.5f, this->subCamVelocity); + Math_ApproachF(&this->subCamAt.y, this->subCamAtTarget.y, 0.5f, this->subCamVelocity); + Math_ApproachF(&this->subCamAt.z, this->subCamAtTarget.z, 0.5f, this->subCamVelocity); } else { - Math_Vec3f_Copy(&this->subCamEye, &this->unk_5C8); - Math_Vec3f_Copy(&this->subCamAt, &this->unk_5D4); + Math_Vec3f_Copy(&this->subCamEye, &this->subCamEyeTarget); + Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtTarget); } if (this->subCamId != SUB_CAM_ID_DONE) { @@ -700,6 +700,7 @@ void EnKaizoku_SetupLoss(EnKaizoku* this, PlayState* play) { this->picto.actor.speed = 0.0f; } +// Player has lost the fight void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; @@ -762,6 +763,7 @@ void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { } } +// Player has won the fight void EnKaizoku_SetupWin(EnKaizoku* this) { this->bool2D8 = 0; this->action = KAIZOKU_ACTION_0; @@ -779,12 +781,12 @@ void EnKaizoku_Win(EnKaizoku* this, PlayState* play) { player->actor.world.pos.z = this->picto.actor.home.pos.z + 30.0f; this->picto.actor.world.pos.x = this->picto.actor.home.pos.x; this->picto.actor.world.pos.z = this->picto.actor.home.pos.z; - this->unk_5C8.x = player->actor.world.pos.x + 39.0f; - this->unk_5C8.y = player->actor.world.pos.y + 4.0f; - this->unk_5C8.z = player->actor.world.pos.z - 41.0f; - this->unk_5D4.x = player->actor.world.pos.x - 150.0f; - this->unk_5D4.y = player->actor.world.pos.y + 60.0f; - this->unk_5D4.z = player->actor.world.pos.z + 50.0f; + this->subCamEyeTarget.x = player->actor.world.pos.x + 39.0f; + this->subCamEyeTarget.y = player->actor.world.pos.y + 4.0f; + this->subCamEyeTarget.z = player->actor.world.pos.z - 41.0f; + this->subCamAtTarget.x = player->actor.world.pos.x - 150.0f; + this->subCamAtTarget.y = player->actor.world.pos.y + 60.0f; + this->subCamAtTarget.z = player->actor.world.pos.z + 50.0f; } player->actor.shape.rot.y = player->actor.world.rot.y = @@ -821,19 +823,19 @@ void EnKaizoku_Win(EnKaizoku* this, PlayState* play) { break; case 2: - this->unk_5C8.x = player->actor.world.pos.x + 77.0f; - this->unk_5C8.y = player->actor.world.pos.y + 84.0f; - this->unk_5C8.z = player->actor.world.pos.z - 71.0f; + this->subCamEyeTarget.x = player->actor.world.pos.x + 77.0f; + this->subCamEyeTarget.y = player->actor.world.pos.y + 84.0f; + this->subCamEyeTarget.z = player->actor.world.pos.z - 71.0f; - this->unk_5D4.x = player->actor.world.pos.x - 110.0f; - this->unk_5D4.y = player->actor.world.pos.y; - this->unk_5D4.z = player->actor.world.pos.z + 30.0f; + this->subCamAtTarget.x = player->actor.world.pos.x - 110.0f; + this->subCamAtTarget.y = player->actor.world.pos.y; + this->subCamAtTarget.z = player->actor.world.pos.z + 30.0f; this->flashTimer++; if (curFrame >= 1.0f) { - Math_ApproachZeroF(&this->unk_2F8.x, 0.3f, 0.3f); - Math_ApproachZeroF(&this->unk_304.x, 0.3f, 0.3f); - this->unk_2F8.z = this->unk_2F8.y = this->unk_2F8.x; - this->unk_304.z = this->unk_304.y = this->unk_304.x; + Math_ApproachZeroF(&this->swordScaleRight.x, 0.3f, 0.3f); + Math_ApproachZeroF(&this->swordScaleLeft.x, 0.3f, 0.3f); + this->swordScaleRight.z = this->swordScaleRight.y = this->swordScaleRight.x; + this->swordScaleLeft.z = this->swordScaleLeft.y = this->swordScaleLeft.x; } if (this->flashTimer == 0x12) { Actor* dekuNut; @@ -863,8 +865,8 @@ void EnKaizoku_Win(EnKaizoku* this, PlayState* play) { if ((curFrame >= this->animEndFrame) && (this->flashTimer >= 0x28)) { this->picto.actor.draw = NULL; this->cutsceneTimer = 10; - Math_Vec3f_Copy(&this->unk_2F8, &gZeroVec3f); - Math_Vec3f_Copy(&this->unk_304, &gZeroVec3f); + Math_Vec3f_Copy(&this->swordScaleRight, &gZeroVec3f); + Math_Vec3f_Copy(&this->swordScaleLeft, &gZeroVec3f); this->cutsceneState++; } break; @@ -895,13 +897,13 @@ void EnKaizoku_Win(EnKaizoku* this, PlayState* play) { default: break; } - Math_ApproachF(&this->subCamEye.x, this->unk_5C8.x, 0.5f, this->unk_5E0); - Math_ApproachF(&this->subCamEye.y, this->unk_5C8.y, 0.5f, this->unk_5E0); - Math_ApproachF(&this->subCamEye.z, this->unk_5C8.z, 0.5f, this->unk_5E0); - Math_ApproachF(&this->subCamAt.x, this->unk_5D4.x, 0.5f, this->unk_5E0); - Math_ApproachF(&this->subCamAt.y, this->unk_5D4.y, 0.5f, this->unk_5E0); - Math_ApproachF(&this->subCamAt.z, this->unk_5D4.z, 0.5f, this->unk_5E0); - Math_ApproachF(&this->unk_5E0, 10.0f, 0.5f, 100.0f); + Math_ApproachF(&this->subCamEye.x, this->subCamEyeTarget.x, 0.5f, this->subCamVelocity); + Math_ApproachF(&this->subCamEye.y, this->subCamEyeTarget.y, 0.5f, this->subCamVelocity); + Math_ApproachF(&this->subCamEye.z, this->subCamEyeTarget.z, 0.5f, this->subCamVelocity); + Math_ApproachF(&this->subCamAt.x, this->subCamAtTarget.x, 0.5f, this->subCamVelocity); + Math_ApproachF(&this->subCamAt.y, this->subCamAtTarget.y, 0.5f, this->subCamVelocity); + Math_ApproachF(&this->subCamAt.z, this->subCamAtTarget.z, 0.5f, this->subCamVelocity); + Math_ApproachF(&this->subCamVelocity, 10.0f, 0.5f, 100.0f); if (this->subCamId != SUB_CAM_ID_DONE) { this->subCamUp.x = 0.0f; @@ -1192,7 +1194,7 @@ void func_80B87E9C(EnKaizoku* this, PlayState* play) { void func_80B87F70(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SLASH_ATTCK); - this->unk_2D0 = 0; + this->spinAttackState = 0; this->swordCollider.base.atFlags &= ~AT_BOUNCED; this->picto.actor.speed = 0.0f; AudioSfx_StopByPosAndId(&this->picto.actor.projectedPos, NA_SE_EN_PIRATE_BREATH); @@ -1402,7 +1404,7 @@ void func_80B887AC(EnKaizoku* this, PlayState* play) { void func_80B88910(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SPIN_ATTACK); this->swordCollider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); - this->unk_2D0 = 0; + this->spinAttackState = 0; this->action = KAIZOKU_ACTION_11; this->actionFunc = func_80B88964; this->picto.actor.speed = 0.0f; @@ -1415,10 +1417,10 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { s16 a0; s32 pad; - if (this->unk_2D0 < 2) { + if (this->spinAttackState < 2) { if (this->swordCollider.base.atFlags & AT_BOUNCED) { this->swordCollider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); - this->unk_2D0 = 1; + this->spinAttackState = 1; this->skelAnime.playSpeed = 1.0f; } } @@ -1438,7 +1440,7 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { } this->bool2D8 = 0; - if ((curFrame >= this->animEndFrame) && (this->unk_2D0 < 2)) { + if ((curFrame >= this->animEndFrame) && (this->spinAttackState < 2)) { if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { func_80B872A4(this); this->timer2B2 = Rand_ZeroOne() * 5.0f + 5.0f; @@ -1446,7 +1448,7 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { return; } - if (this->unk_2D0 != 0) { + if (this->spinAttackState != 0) { func_80B87E28(this); return; } @@ -1685,6 +1687,8 @@ void func_80B894C0(EnKaizoku* this, PlayState* play) { } } + +// trigger win void func_80B8960C(EnKaizoku* this, PlayState* play) { Vec3f sp24; @@ -1752,13 +1756,13 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { this->picto.actor.world.pos.x = this->picto.actor.home.pos.x; this->picto.actor.world.pos.z = this->picto.actor.home.pos.z; - this->subCamEye.x = this->unk_5C8.x = player->actor.world.pos.x + 39.0f; - this->subCamEye.y = this->unk_5C8.y = player->actor.world.pos.y + 4.0f; - this->subCamEye.z = this->unk_5C8.z = player->actor.world.pos.z - 41.0f; + this->subCamEye.x = this->subCamEyeTarget.x = player->actor.world.pos.x + 39.0f; + this->subCamEye.y = this->subCamEyeTarget.y = player->actor.world.pos.y + 4.0f; + this->subCamEye.z = this->subCamEyeTarget.z = player->actor.world.pos.z - 41.0f; - this->subCamAt.x = this->unk_5D4.x = player->actor.world.pos.x - 150.0f; - this->subCamAt.y = this->unk_5D4.y = player->actor.world.pos.y + 60.0f; - this->subCamAt.z = this->unk_5D4.z = player->actor.world.pos.z + 50.0f; + this->subCamAt.x = this->subCamAtTarget.x = player->actor.world.pos.x - 150.0f; + this->subCamAt.y = this->subCamAtTarget.y = player->actor.world.pos.y + 60.0f; + this->subCamAt.z = this->subCamAtTarget.z = player->actor.world.pos.z + 50.0f; player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); @@ -1784,9 +1788,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { // handle damage to player and from player void func_80B89A08(EnKaizoku* this, PlayState* play) { - s32 sp64 = 0; - Vec3f sp58; - s32 i; + s32 wasHit = false; if (gSaveContext.save.saveInfo.playerData.health <= 0x10) { this->swordCollider.info.toucher.damage = 0; @@ -1796,7 +1798,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { if (!(this->swordCollider.base.atFlags & AT_BOUNCED) && (this->swordCollider.base.atFlags & AT_HIT)) { if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_16)) { - this->unk_2D0 = 2; + this->spinAttackState = 2; this->subCamId = SUB_CAM_ID_DONE; this->picto.actor.flags |= ACTOR_FLAG_100000; @@ -1814,7 +1816,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { Health_ChangeBy(play, -0xC); if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_16)) { Health_ChangeBy(play, 0x10); - this->unk_2D0 = 2; + this->spinAttackState = 2; this->subCamId = SUB_CAM_ID_DONE; this->picto.actor.flags |= ACTOR_FLAG_100000; @@ -1842,7 +1844,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { func_80B87F70(this); } - if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action > KAIZOKU_ACTION_0) && (this->unk_2D0 < 2) && + if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action > KAIZOKU_ACTION_0) && (this->spinAttackState < 2) && (this->action != KAIZOKU_ACTION_6) && (this->action != KAIZOKU_ACTION_12) && (this->action != KAIZOKU_ACTION_14) && (this->action != KAIZOKU_ACTION_15)) { Actor_SetDropFlag(&this->picto.actor, &this->bodyCollider.info); @@ -1873,17 +1875,17 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { case KAIZOKU_DMGEFF_F: if ((this->action != KAIZOKU_ACTION_5) && (this->action != KAIZOKU_ACTION_7) && (this->action < KAIZOKU_ACTION_14)) { - sp64 = 1; + wasHit = true; } break; case KAIZOKU_DMGEFF_E: - sp64 = 1; + wasHit = true; break; case KAIZOKU_DMGEFF_D: if (this->action == KAIZOKU_ACTION_13) { - sp64 = 1; + wasHit = true; } else if (this->action != KAIZOKU_ACTION_6) { func_80B87C7C(this); } @@ -1894,7 +1896,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { (this->action < KAIZOKU_ACTION_14)) { this->colorFilterTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; - sp64 = 1; + wasHit = true; } break; @@ -1928,7 +1930,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->picto.actor.focus.pos.x, this->picto.actor.focus.pos.y, this->picto.actor.focus.pos.z, 0, 0, 0, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); - sp64 = 1; + wasHit = true; } break; @@ -1936,7 +1938,10 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { break; } - if (sp64) { + if (wasHit) { + Vec3f bloodPos; + s32 i; + Actor_SetColorFilter(&this->picto.actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_ApplyDamage(&this->picto.actor); if (this->picto.actor.colChkInfo.health <= 0) { @@ -1947,10 +1952,10 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { this->bodyCollider.info.elemType = ELEMTYPE_UNK1; this->bodyCollider.base.colType = COLTYPE_HIT3; this->swordCollider.info.elemType = ELEMTYPE_UNK4; - Math_Vec3f_Copy(&sp58, &this->picto.actor.focus.pos); + Math_Vec3f_Copy(&bloodPos, &this->picto.actor.focus.pos); for (i = 0; i < 3; i++) { - sp58.y += Rand_ZeroFloat(20.0f); - CollisionCheck_BlueBlood(play, NULL, &sp58); + bloodPos.y += Rand_ZeroFloat(20.0f); + CollisionCheck_BlueBlood(play, NULL, &bloodPos); } func_80B893CC(this, play); @@ -2050,7 +2055,7 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); Collider_UpdateCylinder(&this->picto.actor, &this->bodyCollider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); - if ((this->unk_2D0 < 2) && (this->action != KAIZOKU_ACTION_0)) { + if ((this->spinAttackState < 2) && (this->action != KAIZOKU_ACTION_0)) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } if (this->swordState > 0) { @@ -2120,14 +2125,6 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVec3f(&sFootOffset, &this->rightFootPos); } - /* - if ((limbIndex == KAIZOKU_LIMB_02) || (limbIndex == KAIZOKU_LIMB_06) || (limbIndex == KAIZOKU_LIMB_07) || - (limbIndex == KAIZOKU_LIMB_08) || (limbIndex == KAIZOKU_LIMB_0A) || (limbIndex == KAIZOKU_LIMB_0C) || - (limbIndex == KAIZOKU_LIMB_0D) || (limbIndex == KAIZOKU_LIMB_0F) || (limbIndex == KAIZOKU_LIMB_11) || - (limbIndex == KAIZOKU_LIMB_12) || (limbIndex == KAIZOKU_LIMB_L_FOOT) || (limbIndex == KAIZOKU_LIMB_14) || - (limbIndex == KAIZOKU_LIMB_15) || (limbIndex == KAIZOKU_LIMB_R_FOOT) || (limbIndex == KAIZOKU_LIMB_17)) { - // */ - if ((limbIndex == KAIZOKU_LIMB_TORSO) || (limbIndex == KAIZOKU_LIMB_HEAD) || (limbIndex == KAIZOKU_LIMB_R_UPPER_ARM) || (limbIndex == KAIZOKU_LIMB_R_FOREARM) || (limbIndex == KAIZOKU_LIMB_R_HAND) || (limbIndex == KAIZOKU_LIMB_L_UPPER_ARM) || (limbIndex == KAIZOKU_LIMB_L_FOREARM) || (limbIndex == KAIZOKU_LIMB_L_HAND) || (limbIndex == KAIZOKU_LIMB_L_THIGH) || @@ -2146,10 +2143,10 @@ void EnKaizoku_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnKaizoku* this = THIS; if (limbIndex == KAIZOKU_LIMB_R_SWORD) { - Matrix_Scale(this->unk_2F8.x, this->unk_2F8.y, this->unk_2F8.z, MTXMODE_APPLY); + Matrix_Scale(this->swordScaleRight.x, this->swordScaleRight.y, this->swordScaleRight.z, MTXMODE_APPLY); } if (limbIndex == KAIZOKU_LIMB_L_SWORD) { - Matrix_Scale(this->unk_304.x, this->unk_304.y, this->unk_304.z, MTXMODE_APPLY); + Matrix_Scale(this->swordScaleLeft.x, this->swordScaleLeft.y, this->swordScaleLeft.z, MTXMODE_APPLY); } } diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index 9a7c4d8e025..c347f0a9567 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -63,7 +63,7 @@ typedef enum KaizokuTextOffset{ /* 0 */ KAIZOKU_COVERSATION_INTRO_1, /* 1 */ KAIZOKU_COVERSATION_INTRO_2, /* 2 */ KAIZOKU_COVERSATION_WIN, - /* 3 */ KAIZOKU_COVERSATION_LOSS, + /* 3 */ KAIZOKU_COVERSATION_LOSS } KaizokuTextOffset; @@ -87,7 +87,7 @@ typedef struct EnKaizoku { /* 0x2CA */ s16 textType; /* 0x2CC */ s16 eyeIndex; /* 0x2CE */ s16 blinkTimer; - /* 0x2D0 */ s16 unk_2D0; + /* 0x2D0 */ s16 spinAttackState; /* 0x2D2 */ s16 swordState; /* 0x2D4 */ s16 exitIndex; /* 0x2D6 */ s16 csId; @@ -98,12 +98,12 @@ typedef struct EnKaizoku { /* 0x2E4 */ EnKaizokuAnimation animIndex; /* 0x2E8 */ s32 bodyPartIndex; /* 0x2EC */ s32 colorType; - /* 0x2F0 */ f32 unk_2F0; - /* 0x2F4 */ s16 unk_2F4; - /* 0x2F8 */ Vec3f unk_2F8; - /* 0x304 */ Vec3f unk_304; + /* 0x2F0 */ f32 unk_2F0; // modfified in Update, but not read/used? + /* 0x2F4 */ s16 unk_2F4; // read but never set? + /* 0x2F8 */ Vec3f swordScaleRight; + /* 0x304 */ Vec3f swordScaleLeft; /* 0x310 */ Vec3f bodyPartsPos[KAIZOKU_BODYPART_MAX]; - /* 0x3C4 */ Vec3f unk_3C4; + /* 0x3C4 */ Vec3f unk_3C4; // momentum? /* 0x3D0 */ s32 blureIndex; /* 0x3D4 */ ColliderCylinder bodyCollider; /* 0x420 */ ColliderQuad swordCollider; @@ -116,14 +116,14 @@ typedef struct EnKaizoku { /* 0x59C */ s16 cutsceneState; /* 0x59E */ s16 subCamId; /* 0x5A0 */ s16 flashTimer; - /* 0x5A2 */ s16 unused5A2; // never referenced in code? + /* 0x5A2 */ s16 unused5A2; /* 0x5A4 */ Vec3f subCamEye; /* 0x5B0 */ Vec3f subCamAt; /* 0x5BC */ Vec3f subCamUp; - /* 0x5C8 */ Vec3f unk_5C8; - /* 0x5D4 */ Vec3f unk_5D4; - /* 0x5E0 */ f32 unk_5E0; // manual cutscene camera control? - /* 0x5E4 */ f32 unk_5E4; + /* 0x5C8 */ Vec3f subCamEyeTarget; + /* 0x5D4 */ Vec3f subCamAtTarget; + /* 0x5E0 */ f32 subCamVelocity; + /* 0x5E4 */ f32 unused5E4; /* 0x5E8 */ f32 flashScreenAlpha; /* 0x5EC */ f32 flashScreenAlphaTarget; } EnKaizoku; // size = 0x5F0 From 3aa6e016ddc519c061d409b2692647b1e5910913 Mon Sep 17 00:00:00 2001 From: isghj Date: Sat, 11 Jan 2025 15:20:10 -0800 Subject: [PATCH 08/24] Kaizoku: more docs --- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 407 +++++++++--------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 28 +- tools/disasm/functions.txt | 30 +- 3 files changed, 236 insertions(+), 229 deletions(-) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index bb67f51f081..87f9d56dd35 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -23,19 +23,19 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play); void EnKaizoku_Loss(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupWin(EnKaizoku* this); void EnKaizoku_Win(EnKaizoku* this, PlayState* play); -void func_80B872A4(EnKaizoku* this); -void func_80B872F4(EnKaizoku* this, PlayState* play); -void func_80B874D8(EnKaizoku* this, PlayState* play); -void func_80B8760C(EnKaizoku* this, PlayState* play); -void func_80B87900(EnKaizoku* this); -void func_80B8798C(EnKaizoku* this, PlayState* play); -void func_80B87C7C(EnKaizoku* this); +void EnKaizoku_SetupReady(EnKaizoku* this); +void EnKaizoku_Ready(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupSpinDodge(EnKaizoku* this, PlayState* play); +void EnKaizoku_SpinDodge(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupBlock(EnKaizoku* this); +void EnKaizoku_Block(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupFlip(EnKaizoku* this); void EnKaizoku_SpawnFootDust(PlayState* play, Vec3f* pos); -void func_80B87D3C(EnKaizoku* this, PlayState* play); +void EnKaizoku_Flip(EnKaizoku* this, PlayState* play); void func_80B87E28(EnKaizoku* this); void func_80B87E9C(EnKaizoku* this, PlayState* play); -void func_80B87F70(EnKaizoku* this); -void func_80B87FDC(EnKaizoku* this, PlayState* play2); +void EnKaizoku_SetupSlash(EnKaizoku* this); +void EnKaizoku_Slash(EnKaizoku* this, PlayState* play2); void func_80B88214(EnKaizoku* this); void func_80B88278(EnKaizoku* this, PlayState* play); void func_80B8833C(EnKaizoku* this); @@ -44,17 +44,17 @@ void func_80B88770(EnKaizoku* this); void func_80B887AC(EnKaizoku* this, PlayState* play); void func_80B88910(EnKaizoku* this); void func_80B88964(EnKaizoku* this, PlayState* play); -void func_80B88CD8(EnKaizoku* this); -void func_80B88D6C(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupCircle(EnKaizoku* this); +void EnKaizoku_Circle(EnKaizoku* this, PlayState* play); void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play); -void func_80B894C0(EnKaizoku* this, PlayState* play); +void EnKaizoku_Damaged(EnKaizoku* this, PlayState* play); void func_80B8971C(EnKaizoku* this, PlayState* play); typedef enum EnKaizokuAction { /* 0 */ KAIZOKU_ACTION_0, - /* 1 */ KAIZOKU_ACTION_1, - /* 2 */ KAIZOKU_ACTION_2, - /* 3 */ KAIZOKU_ACTION_3, + /* 1 */ KAIZOKU_ACTION_READY, + /* 2 */ KAIZOKU_ACTION_SPIN_DODGE, + /* 3 */ KAIZOKU_ACTION_SIDESTEP, /* 4 */ KAIZOKU_ACTION_4, /* 5 */ KAIZOKU_ACTION_5, /* 6 */ KAIZOKU_ACTION_6, @@ -214,14 +214,14 @@ static ColliderQuadInit sQuadInit = { { { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } }, }; -static AnimationHeader* sAnimations[EN_KAIZOKU_ANIM_MAX] = { +static AnimationHeader* sAnimations[KAIZOKU_ANIM_MAX] = { &gKaizokuFightingIdleAnim, // KAIZOKU_ANIM_FIGHTING_IDLE - &gKaizokuOOTConversationAnim, // EN_KAIZOKU_ANIM_1 - &gKaizokuOOTJumpAnim, // EN_KAIZOKU_ANIM_2 + &gKaizokuOOTConversationAnim, // KAIZOKU_ANIM_OOT_CONVERSATION + &gKaizokuOOTJumpAnim, // KAIZOKU_ANIM_OOT_JUMP &gKaizokuSidestepAnim, // KAIZOKU_ANIM_SIDESTEP &gKaizokuWalkAnim, // KAIZOKU_ANIM_WALK &gKaizokuDamageAnim, // KAIZOKU_ANIM_DAMAGE - &gKaizokuOOTDefeatAnim, // EN_KAIZOKU_ANIM_6 + &gKaizokuOOTDefeatAnim, // KAIZOKU_ANIM_OOT_DEFEAT &gKaizokuBlockAnim, // KAIZOKU_ANIM_BLOCK &gKaizokuFlipAnim, // KAIZOKU_ANIM_FLIP &gKaizokuSlashAnim, // KAIZOKU_ANIM_SLASH_ATTCK @@ -236,14 +236,14 @@ static AnimationHeader* sAnimations[EN_KAIZOKU_ANIM_MAX] = { &gKaizokuThrowFlashAnim, // KAIZOKU_ANIM_THROW_FLASH }; -static u8 sAnimationModes[EN_KAIZOKU_ANIM_MAX] = { +static u8 sAnimationModes[KAIZOKU_ANIM_MAX] = { ANIMMODE_LOOP, // KAIZOKU_ANIM_FIGHTING_IDLE - ANIMMODE_LOOP, // EN_KAIZOKU_ANIM_1 - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_2 + ANIMMODE_LOOP, // KAIZOKU_ANIM_OOT_CONVERSATION + ANIMMODE_ONCE, // KAIZOKU_ANIM_OOT_JUMP ANIMMODE_LOOP, // KAIZOKU_ANIM_SIDESTEP ANIMMODE_LOOP, // KAIZOKU_ANIM_WALK ANIMMODE_ONCE, // KAIZOKU_ANIM_DAMAGE - ANIMMODE_ONCE, // EN_KAIZOKU_ANIM_6 + ANIMMODE_ONCE, // KAIZOKU_ANIM_OOT_DEFEAT ANIMMODE_ONCE, // KAIZOKU_ANIM_BLOCK ANIMMODE_ONCE, // KAIZOKU_ANIM_FLIP ANIMMODE_ONCE, // KAIZOKU_ANIM_SLASH_ATTCK @@ -327,7 +327,7 @@ void EnKaizoku_Destroy(Actor* thisx, PlayState* play) { Audio_RestorePrevBgm(); } -s32 func_80B85858(EnKaizoku* this, PlayState* play) { +s32 EnKaizoku_DodgeRanged(EnKaizoku* this, PlayState* play) { Actor* itemAction; Player* player = GET_PLAYER(play); s16 prevAction = this->action; @@ -340,7 +340,7 @@ s32 func_80B85858(EnKaizoku* this, PlayState* play) { if (((itemAction->id != ACTOR_ARMS_HOOK) || (this->action != KAIZOKU_ACTION_13)) && (this->action != KAIZOKU_ACTION_6)) { - func_80B87C7C(this); + EnKaizoku_SetupFlip(this); } break; } @@ -353,7 +353,7 @@ s32 func_80B85858(EnKaizoku* this, PlayState* play) { } void func_80B85900(EnKaizoku* this) { - if (this->action == KAIZOKU_ACTION_1) { + if (this->action == KAIZOKU_ACTION_READY) { this->headRot.y = Math_SinS(this->lookTimer * 0x1068) * 0x22D8; } else if (this->action != KAIZOKU_ACTION_13) { if ((this->action == KAIZOKU_ACTION_9) || (this->action == KAIZOKU_ACTION_11)) { @@ -366,36 +366,38 @@ void func_80B85900(EnKaizoku* this) { } } + +// react to player from oot? s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) { Player* player = GET_PLAYER(play); - s16 sp32 = ABS_ALT(this->picto.actor.wallYaw - this->picto.actor.shape.rot.y); - s16 sp30 = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); + s16 angleToWall = ABS_ALT(this->picto.actor.wallYaw - this->picto.actor.shape.rot.y); + s16 angleToLink = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); Actor* explosiveActor; if (func_800BE184(play, &this->picto.actor, 100.0f, 0x2710, 0x4000, this->picto.actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - if (this->action != KAIZOKU_ACTION_2) { - func_80B874D8(this, play); + if (this->action != KAIZOKU_ACTION_SPIN_DODGE) { + EnKaizoku_SetupSpinDodge(this, play); } return true; } else { - func_80B87900(this); + EnKaizoku_SetupBlock(this); return true; } } else if (func_800BE184(play, &this->picto.actor, 100.0f, 0x5DC0, 0x2AA8, this->picto.actor.shape.rot.y)) { this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - if ((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS_ALT(sp32) < 0x2EE0) && + if ((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS_ALT(angleToWall) < 0x2EE0) && (this->picto.actor.xzDistToPlayer < 90.0f)) { if (this->action != KAIZOKU_ACTION_6) { - func_80B87C7C(this); + EnKaizoku_SetupFlip(this); } return true; } else if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { - if (this->action != KAIZOKU_ACTION_2) { - func_80B874D8(this, play); + if (this->action != KAIZOKU_ACTION_SPIN_DODGE) { + EnKaizoku_SetupSpinDodge(this, play); } } else if (this->picto.actor.xzDistToPlayer < BREG(11) + 180.0f) { - func_80B87900(this); + EnKaizoku_SetupBlock(this); } else if (this->action != KAIZOKU_ACTION_7) { func_80B87E28(this); } @@ -406,16 +408,16 @@ s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) { if (explosiveActor != NULL) { this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - if (((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) && (sp32 < 0x2EE0)) || + if (((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) && (angleToWall < 0x2EE0)) || (explosiveActor->id == ACTOR_EN_BOM_CHU)) { if ((explosiveActor->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(&this->picto.actor, explosiveActor) < 80.0f) && (BINANG_ADD(this->picto.actor.shape.rot.y - explosiveActor->world.rot.y, 0x8000) < 0x4000)) { if (this->action != KAIZOKU_ACTION_6) { - func_80B87C7C(this); + EnKaizoku_SetupFlip(this); } } else { - func_80B87900(this); + EnKaizoku_SetupBlock(this); } return true; @@ -428,22 +430,23 @@ s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) { } if (arg2) { - s16 sp2A; + s16 angleToFacingLink; //! FAKE: label:; - if (sp30 >= 10000) { - func_80B87900(this); + if (angleToLink >= 10000) { + // in OOT this was sidestep instead of block + EnKaizoku_SetupBlock(this); } else { - sp2A = player->actor.shape.rot.y - this->picto.actor.shape.rot.y; + angleToFacingLink = player->actor.shape.rot.y - this->picto.actor.shape.rot.y; if ((this->picto.actor.xzDistToPlayer <= 65.0f) && !Actor_OtherIsTargeted(play, &this->picto.actor) && - (ABS_ALT(sp2A) < 0x5000)) { + (ABS_ALT(angleToFacingLink) < 0x5000)) { if (this->action != KAIZOKU_ACTION_9) { - func_80B87F70(this); + EnKaizoku_SetupSlash(this); return 1; } - } else if (this->action != KAIZOKU_ACTION_3) { - func_80B88CD8(this); + } else if (this->action != KAIZOKU_ACTION_SIDESTEP) { + EnKaizoku_SetupCircle(this); } } return true; @@ -471,7 +474,7 @@ s32 EnKaizoku_ValidatePictograph(PlayState* play, Actor* actor) { void EnKaizoku_SetupWaitForApproach(EnKaizoku* this) { Math_Vec3f_Copy(&this->swordScaleRight, &gZeroVec3f); Math_Vec3f_Copy(&this->swordScaleLeft, &gZeroVec3f); - this->bool2D8 = true; + this->dontUpdateSkel = true; this->action = KAIZOKU_ACTION_0; this->actionFunc = EnKaizoku_WaitForApproach; } @@ -522,7 +525,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { Audio_SetMainBgmVolume(0, 0xA); this->cutsceneState++; // fallthrough - case 1: + case 1: // start falling player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; @@ -544,10 +547,10 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } break; - case 2: + case 2: // waiting for landing if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - if (this->bool2D8 != false) { - this->bool2D8 = false; + if (this->dontUpdateSkel != false) { + this->dontUpdateSkel = false; this->picto.actor.world.pos.y = this->picto.actor.floorHeight; this->picto.actor.velocity.y = 0.0f; Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_4); @@ -564,7 +567,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } break; - case 3: + case 3: // talking after landing if (curFrame >= this->animEndFrame) { nextTextId = this->textType * 4 + this->textidOffset; if (Player_GetMask(play) == PLAYER_MASK_STONE) { @@ -584,7 +587,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } break; - case 4: + case 4: // intro 2 dialogue if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); this->cutsceneTimer = 0; @@ -595,7 +598,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } break; - case 5: + case 5: // start pulling out swords Math_ApproachF(&this->subCamVelocity, 2.0f, 0.2f, 1.0f); if (Animation_OnFrame(&this->skelAnime, 20.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_BOSU_SWORD); @@ -606,7 +609,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } break; - case 6: + case 6: // finish pulling swords Math_ApproachF(&this->subCamVelocity, 5.0f, 0.3f, 1.0f); if (curFrame >= this->animEndFrame) { this->cutsceneTimer = 7; @@ -620,7 +623,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } break; - case 7: + case 7: // wait for cutscene timer, then finish if (this->cutsceneTimer == 0) { Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csId); @@ -629,7 +632,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { this->picto.actor.flags &= ~ACTOR_FLAG_100000; this->picto.actor.flags &= ~ACTOR_FLAG_CANT_LOCK_ON; this->picto.actor.flags |= ACTOR_FLAG_TARGETABLE; - func_80B872A4(this); + EnKaizoku_SetupReady(this); } break; } @@ -690,11 +693,11 @@ void EnKaizoku_SetupLoss(EnKaizoku* this, PlayState* play) { Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_96); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); - this->timer2B2 = 30; + this->combatTimer = 30; this->picto.actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->cutsceneTimer = 0; this->cutsceneState = 0; - this->bool2D8 = false; + this->dontUpdateSkel = false; this->action = KAIZOKU_ACTION_0; this->actionFunc = EnKaizoku_Loss; this->picto.actor.speed = 0.0f; @@ -765,7 +768,7 @@ void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { // Player has won the fight void EnKaizoku_SetupWin(EnKaizoku* this) { - this->bool2D8 = 0; + this->dontUpdateSkel = false; this->action = KAIZOKU_ACTION_0; this->actionFunc = EnKaizoku_Win; } @@ -914,25 +917,24 @@ void EnKaizoku_Win(EnKaizoku* this, PlayState* play) { } -// this is the start-combat actionfunction after cutscene, but do we want to start immediately with an attack? is there a standing version we could start with? -void func_80B872A4(EnKaizoku* this) { +void EnKaizoku_SetupReady(EnKaizoku* this) { this->picto.actor.speed = 0.0f; EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FIGHTING_IDLE); - this->action = KAIZOKU_ACTION_1; - this->actionFunc = func_80B872F4; + this->action = KAIZOKU_ACTION_READY; + this->actionFunc = EnKaizoku_Ready; this->picto.actor.shape.shadowScale = 90.0f; } -void func_80B872F4(EnKaizoku* this, PlayState* play) { +void EnKaizoku_Ready(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((this->lookTimer == 0) && !func_80B85858(this, play) && !func_80B85A00(this, play, false)) { + if ((this->lookTimer == 0) && !EnKaizoku_DodgeRanged(this, play) && !func_80B85A00(this, play, false)) { s16 yawDiff = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; if ((this->picto.actor.xzDistToPlayer < 100.0f) && (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) && (yawDiff >= 0x1F40)) { this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } else if (Actor_IsFacingPlayer(&this->picto.actor, 0xBB8)) { if ((this->picto.actor.xzDistToPlayer < 400.0f && this->picto.actor.xzDistToPlayer > 150.0f) && (Rand_ZeroOne() < 0.7f)) { @@ -944,7 +946,7 @@ void func_80B872F4(EnKaizoku* this, PlayState* play) { } else if (Rand_ZeroOne() > 0.1f) { func_80B8833C(this); } else { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } } else { func_80B88770(this); @@ -952,7 +954,7 @@ void func_80B872F4(EnKaizoku* this, PlayState* play) { } } -void func_80B874D8(EnKaizoku* this, PlayState* play) { +void EnKaizoku_SetupSpinDodge(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SIDESTEP); @@ -968,13 +970,13 @@ void func_80B874D8(EnKaizoku* this, PlayState* play) { this->skelAnime.playSpeed = 1.0f; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; - this->timer2B2 = 6; - this->action = KAIZOKU_ACTION_2; - this->unk_2E0 = 0.0f; - this->actionFunc = func_80B8760C; + this->combatTimer = 6; + this->action = KAIZOKU_ACTION_SPIN_DODGE; + this->approachRate = 0.0f; + this->actionFunc = EnKaizoku_SpinDodge; } -void func_80B8760C(EnKaizoku* this, PlayState* play) { +void EnKaizoku_SpinDodge(EnKaizoku* this, PlayState* play) { s16 var_v0; s32 temp_ft0; s32 temp_ft1; @@ -996,22 +998,22 @@ void func_80B8760C(EnKaizoku* this, PlayState* play) { } if (ABS_ALT(var_v0) > 0x4000) { - func_80B87C7C(this); + EnKaizoku_SetupFlip(this); return; } } if (this->picto.actor.xzDistToPlayer <= 65.0f) { - Math_ApproachF(&this->unk_2E0, -4.0f, 1.0f, 1.5f); + Math_ApproachF(&this->approachRate, -4.0f, 1.0f, 1.5f); } else if (this->picto.actor.xzDistToPlayer > 40.0f) { - Math_ApproachF(&this->unk_2E0, 4.0f, 1.0f, 1.5f); + Math_ApproachF(&this->approachRate, 4.0f, 1.0f, 1.5f); } else { - Math_ApproachZeroF(&this->unk_2E0, 1.0f, 6.65f); + Math_ApproachZeroF(&this->approachRate, 1.0f, 6.65f); } - if (this->unk_2E0 != 0.0f) { - this->picto.actor.world.pos.x += Math_SinS(this->picto.actor.yawTowardsPlayer) * this->unk_2E0; - this->picto.actor.world.pos.z += Math_CosS(this->picto.actor.yawTowardsPlayer) * this->unk_2E0; + if (this->approachRate != 0.0f) { + this->picto.actor.world.pos.x += Math_SinS(this->picto.actor.yawTowardsPlayer) * this->approachRate; + this->picto.actor.world.pos.z += Math_CosS(this->picto.actor.yawTowardsPlayer) * this->approachRate; } this->skelAnime.playSpeed = 1.0f; @@ -1026,11 +1028,11 @@ void func_80B8760C(EnKaizoku* this, PlayState* play) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } - if (this->timer2B2 == 0) { + if (this->combatTimer == 0) { this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; - if (!func_80B85858(this, play)) { + if (!EnKaizoku_DodgeRanged(this, play)) { if (this->picto.actor.xzDistToPlayer <= 70.0f) { - func_80B87F70(this); + EnKaizoku_SetupSlash(this); } else { func_80B87E28(this); } @@ -1042,40 +1044,40 @@ void func_80B8760C(EnKaizoku* this, PlayState* play) { } } -void func_80B87900(EnKaizoku* this) { +void EnKaizoku_SetupBlock(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_BLOCK); if (this->swordState != 0) { this->swordState = -1; } - this->bool2D8 = false; + this->dontUpdateSkel = false; this->picto.actor.speed = 0.0f; - this->timer2B2 = Rand_S16Offset(10, 10); + this->combatTimer = Rand_S16Offset(10, 10); this->bodyCollider.base.acFlags |= AC_HARD; this->lookTimer = 12; this->action = KAIZOKU_ACTION_12; - this->actionFunc = func_80B8798C; + this->actionFunc = EnKaizoku_Block; } -void func_80B8798C(EnKaizoku* this, PlayState* play) { +void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); s16 temp_v0; - this->bool2D8 = true; - if (this->timer2B2 == 0) { + this->dontUpdateSkel = true; + if (this->combatTimer == 0) { this->skelAnime.playSpeed = 1.0f; } if (this->lookTimer == 0) { - this->bool2D8 = false; + this->dontUpdateSkel = false; temp_v0 = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; if ((ABS_ALT(temp_v0) <= 0x4000) && (this->picto.actor.xzDistToPlayer < 40.0f) && (fabsf(this->picto.actor.playerHeightRel) < 50.0f)) { if (func_800BE184(play, &this->picto.actor, 100.0f, 10000, 0x4000, this->picto.actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { this->bodyCollider.base.acFlags &= ~AC_HARD; - func_80B874D8(this, play); + EnKaizoku_SetupSpinDodge(this, play); } else if (!(play->gameplayFrames & 1)) { - func_80B87900(this); + EnKaizoku_SetupBlock(this); } else { this->bodyCollider.base.acFlags &= ~AC_HARD; func_80B87E28(this); @@ -1084,38 +1086,39 @@ void func_80B8798C(EnKaizoku* this, PlayState* play) { temp_v0 = player->actor.shape.rot.y - this->picto.actor.shape.rot.y; if (ABS_ALT(temp_v0) < 0x4000) { this->bodyCollider.base.acFlags &= ~AC_HARD; - func_80B87F70(this); + EnKaizoku_SetupSlash(this); } else { this->bodyCollider.base.acFlags &= ~AC_HARD; - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } } } else { this->bodyCollider.base.acFlags &= ~AC_HARD; - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } - } else if ((this->timer2B2 == 0) && + } else if ((this->combatTimer == 0) && func_800BE184(play, &this->picto.actor, 100.0f, 10000, 0x4000, this->picto.actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { this->bodyCollider.base.acFlags &= ~AC_HARD; - func_80B874D8(this, play); - } else if (!func_80B85858(this, play)) { + EnKaizoku_SetupSpinDodge(this, play); + } else if (!EnKaizoku_DodgeRanged(this, play)) { if (!(play->gameplayFrames & 1)) { if (this->picto.actor.xzDistToPlayer < 100.0f && Rand_ZeroOne() > 0.7f) { this->bodyCollider.base.acFlags &= ~AC_HARD; - func_80B87C7C(this); + EnKaizoku_SetupFlip(this); } else { this->bodyCollider.base.acFlags &= ~AC_HARD; func_80B87E28(this); } } else { - func_80B87900(this); + EnKaizoku_SetupBlock(this); } } } } -void func_80B87C7C(EnKaizoku* this) { +// this might be JUMP not flip +void EnKaizoku_SetupFlip(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FLIP); this->picto.actor.speed = 6.5f; this->picto.actor.velocity.y = 15.0f; @@ -1125,21 +1128,21 @@ void func_80B87C7C(EnKaizoku* this) { this->bodyCollider.base.colType = COLTYPE_NONE; this->swordCollider.info.elemType = ELEMTYPE_UNK4; this->action = KAIZOKU_ACTION_6; - this->actionFunc = func_80B87D3C; + this->actionFunc = EnKaizoku_Flip; } -Color_RGBA8 D_80B8AC58 = { 200, 160, 120, 255 }; // light brown -Color_RGBA8 D_80B8AC5C = { 130, 90, 50, 255 }; // darker brown +static Color_RGBA8 sKaizokuDustPrimColor = { 200, 160, 120, 255 }; // light brown +static Color_RGBA8 sKaizokuDustEnvColor = { 130, 90, 50, 255 }; // darker brown -Vec3f D_80B8AC60 = { 0.0f, -1.5f, 0.0f }; -Vec3f D_80B8AC6C = { 0.0f, -0.2f, 0.0f }; +static Vec3f sKaizokuDustVelocity = { 0.0f, -1.5f, 0.0f }; +static Vec3f sKaizokuDustAccel = { 0.0f, -0.2f, 0.0f }; void EnKaizoku_SpawnFootDust(PlayState* play, Vec3f* pos) { // reusing sparkles instead of the actual dust effect? is this left over from OOT? - EffectSsKirakira_SpawnSmall(play, pos, &D_80B8AC60, &D_80B8AC6C, &D_80B8AC58, &D_80B8AC5C); + EffectSsKirakira_SpawnSmall(play, pos, &sKaizokuDustVelocity, &sKaizokuDustAccel, &sKaizokuDustPrimColor, &sKaizokuDustEnvColor); } -void func_80B87D3C(EnKaizoku* this, PlayState* play) { +void EnKaizoku_Flip(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); @@ -1148,7 +1151,7 @@ void func_80B87D3C(EnKaizoku* this, PlayState* play) { EnKaizoku_SpawnFootDust(play, &this->rightFootPos); } - this->bool2D8 = false; + this->dontUpdateSkel = false; if ((curFrame >= this->animEndFrame) && (this->picto.actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { this->bodyCollider.info.elemType = ELEMTYPE_UNK1; @@ -1159,7 +1162,7 @@ void func_80B87D3C(EnKaizoku* this, PlayState* play) { this->picto.actor.speed = 0.0f; this->picto.actor.velocity.y = 0.0f; this->picto.actor.world.pos.y = this->picto.actor.floorHeight; - func_80B87F70(this); + EnKaizoku_SetupSlash(this); } } @@ -1178,13 +1181,13 @@ void func_80B87E28(EnKaizoku* this) { void func_80B87E9C(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - this->bool2D8 = false; + this->dontUpdateSkel = false; if (curFrame >= this->animEndFrame) { if ((this->picto.actor.xzDistToPlayer < 170.0f) && (this->picto.actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) { func_80B88910(this); } else { - func_80B87900(this); + EnKaizoku_SetupBlock(this); } } if (!(play->state.frames & 0x5F)) { @@ -1192,26 +1195,27 @@ void func_80B87E9C(EnKaizoku* this, PlayState* play) { } } -void func_80B87F70(EnKaizoku* this) { +void EnKaizoku_SetupSlash(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SLASH_ATTCK); this->spinAttackState = 0; this->swordCollider.base.atFlags &= ~AT_BOUNCED; this->picto.actor.speed = 0.0f; AudioSfx_StopByPosAndId(&this->picto.actor.projectedPos, NA_SE_EN_PIRATE_BREATH); this->action = KAIZOKU_ACTION_9; - this->actionFunc = func_80B87FDC; + this->actionFunc = EnKaizoku_Slash; } -void func_80B87FDC(EnKaizoku* this, PlayState* play2) { +void EnKaizoku_Slash(EnKaizoku* this, PlayState* play2) { PlayState* play = play2; f32 curFrame; - s16 sp2E; - s16 sp2C; + s16 rotYDelta; + s16 rotYDelta2; Player* player = GET_PLAYER(play2); curFrame = this->skelAnime.curFrame; - sp2E = ABS_ALT(player->actor.shape.rot.y - this->picto.actor.shape.rot.y); - sp2C = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); + // one is left and one is right, but y rotation is counter clockwise, this hurts my head + rotYDelta = ABS_ALT(player->actor.shape.rot.y - this->picto.actor.shape.rot.y); + rotYDelta2 = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); this->picto.actor.speed = 0.0f; if (Animation_OnFrame(&this->skelAnime, 1.0f)) { @@ -1228,33 +1232,33 @@ void func_80B87FDC(EnKaizoku* this, PlayState* play2) { return; } - this->bool2D8 = 0; + this->dontUpdateSkel = false; if (curFrame >= this->animEndFrame) { if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { - func_80B872A4(this); + EnKaizoku_SetupReady(this); - if (sp2C > 0x4000) { + if (rotYDelta2 > 0x4000) { this->lookTimer = 20; } } else { if (Rand_ZeroOne() > 0.7f || this->picto.actor.xzDistToPlayer >= 120.0f) { - func_80B872A4(this); + EnKaizoku_SetupReady(this); return; } this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; if (BREG(12) * 0.1f + 0.01f * 40.0f < Rand_ZeroOne()) { - func_80B87900(this); - } else if (sp2E <= 0x2710) { - if (sp2C > 0x4000) { + EnKaizoku_SetupBlock(this); + } else if (rotYDelta <= 0x2710) { + if (rotYDelta2 > 0x4000) { this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } else { func_80B85A00(this, play, true); } } else { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } } } @@ -1262,7 +1266,7 @@ void func_80B87FDC(EnKaizoku* this, PlayState* play2) { void func_80B88214(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FLIP); - this->timer2B2 = 0; + this->combatTimer = 0; this->picto.actor.speed = 10.0f; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; Actor_PlaySfx(&this->picto.actor, NA_SE_EN_TEKU_JUMP); @@ -1273,14 +1277,14 @@ void func_80B88214(EnKaizoku* this) { void func_80B88278(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - this->bool2D8 = 0; + this->dontUpdateSkel = false; if (curFrame >= this->animEndFrame) { this->picto.actor.speed = 0.0f; if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { - func_80B872A4(this); - this->timer2B2 = Rand_ZeroOne() * 5.0f + 5.0f; + EnKaizoku_SetupReady(this); + this->combatTimer = Rand_ZeroOne() * 5.0f + 5.0f; } else { - func_80B87F70(this); + EnKaizoku_SetupSlash(this); } } if (!(play->gameplayFrames & 0x5F)) { @@ -1300,7 +1304,7 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { s32 sp2C; s16 sp2A; - if (!func_80B85858(this, play)) { + if (!EnKaizoku_DodgeRanged(this, play)) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0x2EE, 0); this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; if (this->picto.actor.xzDistToPlayer <= 40.0f) { @@ -1317,7 +1321,7 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { (sp2A >= 0x2000)) { this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); return; } } @@ -1326,17 +1330,17 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { sp2C = this->skelAnime.curFrame + this->skelAnime.playSpeed; if (!Actor_IsFacingPlayer(&this->picto.actor, 0x11C7)) { if (Rand_ZeroOne() > 0.5f) { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } else { - func_80B872A4(this); + EnKaizoku_SetupReady(this); } } else if (this->picto.actor.xzDistToPlayer < 90.0f) { if ((Rand_ZeroOne() > 0.03f) || ((this->picto.actor.xzDistToPlayer <= 65.0f) && (sp2A < 0x4000))) { - func_80B87F70(this); + EnKaizoku_SetupSlash(this); } else if (Actor_OtherIsTargeted(play, &this->picto.actor) && (Rand_ZeroOne() > 0.5f)) { func_80B87E28(this); } else { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } } @@ -1350,7 +1354,7 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { func_80B88910(this); } } else { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); return; } } @@ -1365,7 +1369,8 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { } } } - + +// wait there are multiple side steps?? void func_80B88770(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SIDESTEP); this->action = KAIZOKU_ACTION_10; @@ -1376,7 +1381,7 @@ void func_80B887AC(EnKaizoku* this, PlayState* play) { s16 yawDiff; s16 yawAdjustment; - if (!func_80B85858(this, play) && !func_80B85A00(this, play, false)) { + if (!EnKaizoku_DodgeRanged(this, play) && !func_80B85A00(this, play, false)) { yawDiff = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; if (yawDiff > 0) { yawAdjustment = TRUNCF_BINANG(yawDiff * 0.25f) + 0x7D0; @@ -1389,7 +1394,7 @@ void func_80B887AC(EnKaizoku* this, PlayState* play) { if (Actor_IsFacingPlayer(&this->picto.actor, 0x1388)) { if (Rand_ZeroOne() > 0.8f) { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } else { func_80B8833C(this); } @@ -1439,11 +1444,11 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { this->swordState = -1; } - this->bool2D8 = 0; + this->dontUpdateSkel = false; if ((curFrame >= this->animEndFrame) && (this->spinAttackState < 2)) { if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { - func_80B872A4(this); - this->timer2B2 = Rand_ZeroOne() * 5.0f + 5.0f; + EnKaizoku_SetupReady(this); + this->combatTimer = Rand_ZeroOne() * 5.0f + 5.0f; this->lookTimer = 46; return; } @@ -1454,14 +1459,14 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { } if ((Rand_ZeroOne() > 0.7f) || (this->picto.actor.xzDistToPlayer >= 120.0f)) { - func_80B872A4(this); - this->timer2B2 = Rand_ZeroOne() * 5.0f + 5.0f; + EnKaizoku_SetupReady(this); + this->combatTimer = Rand_ZeroOne() * 5.0f + 5.0f; return; } this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; if (BREG(12) * 0.1f + 0.01f * 40.0f < Rand_ZeroOne()) { - func_80B87900(this); + EnKaizoku_SetupBlock(this); return; } @@ -1471,44 +1476,44 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { a0 = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); if (a0 > 0x4000) { this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } else { func_80B85A00(this, play, true); } } else { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } } } -void func_80B88CD8(EnKaizoku* this) { +void EnKaizoku_SetupCircle(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SIDESTEP); this->picto.actor.speed = Rand_CenteredFloat(12.0f); this->skelAnime.playSpeed = 1.0f; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; - this->timer2B2 = Rand_ZeroOne() * 30.0f + 30.0f; - this->action = KAIZOKU_ACTION_3; - this->actionFunc = func_80B88D6C; - this->unk_2E0 = 0.0f; + this->combatTimer = Rand_ZeroOne() * 30.0f + 30.0f; + this->action = KAIZOKU_ACTION_SIDESTEP; + this->actionFunc = EnKaizoku_Circle; + this->approachRate = 0.0f; } -void func_80B88D6C(EnKaizoku* this, PlayState* play) { +void EnKaizoku_Circle(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 sp2A; - s32 temp_ft4; - s32 temp_ft5; + s16 angleBehindLink; + s32 beforeCurFrame; + s32 afterCurFrame; s16 yaw; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); - if (!func_80B85858(this, play) && !func_80B85A00(this, play, false)) { + if (!EnKaizoku_DodgeRanged(this, play) && !func_80B85A00(this, play, false)) { this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y + 0x4000; - sp2A = player->actor.shape.rot.y + 0x8000; - if (Math_SinS(sp2A - this->picto.actor.shape.rot.y) >= 0.0f) { + angleBehindLink = player->actor.shape.rot.y + 0x8000; + if (Math_SinS(angleBehindLink - this->picto.actor.shape.rot.y) >= 0.0f) { this->picto.actor.speed -= 0.25f; if (this->picto.actor.speed < -8.0f) { this->picto.actor.speed = -8.0f; } - } else if (Math_SinS(sp2A - this->picto.actor.shape.rot.y) < 0.0f) { + } else if (Math_SinS(angleBehindLink - this->picto.actor.shape.rot.y) < 0.0f) { this->picto.actor.speed += 0.25f; if (this->picto.actor.speed > 8.0f) { this->picto.actor.speed = 8.0f; @@ -1542,22 +1547,22 @@ void func_80B88D6C(EnKaizoku* this, PlayState* play) { } if (this->picto.actor.xzDistToPlayer <= 65.0f) { - Math_ApproachF(&this->unk_2E0, -4.0f, 1.0f, 1.5f); + Math_ApproachF(&this->approachRate, -4.0f, 1.0f, 1.5f); } else if (this->picto.actor.xzDistToPlayer > 40.0f) { - Math_ApproachF(&this->unk_2E0, 4.0f, 1.0f, 1.5f); + Math_ApproachF(&this->approachRate, 4.0f, 1.0f, 1.5f); } else { - Math_ApproachZeroF(&this->unk_2E0, 1.0f, 6.65f); + Math_ApproachZeroF(&this->approachRate, 1.0f, 6.65f); } - if (this->unk_2E0 != 0.0f) { - this->picto.actor.world.pos.x += Math_SinS(this->picto.actor.shape.rot.y) * this->unk_2E0; - this->picto.actor.world.pos.z += Math_CosS(this->picto.actor.shape.rot.y) * this->unk_2E0; + if (this->approachRate != 0.0f) { + this->picto.actor.world.pos.x += Math_SinS(this->picto.actor.shape.rot.y) * this->approachRate; + this->picto.actor.world.pos.z += Math_CosS(this->picto.actor.shape.rot.y) * this->approachRate; } - temp_ft4 = this->skelAnime.curFrame - this->skelAnime.playSpeed; - temp_ft5 = this->skelAnime.curFrame + this->skelAnime.playSpeed; + beforeCurFrame = this->skelAnime.curFrame - this->skelAnime.playSpeed; + afterCurFrame = this->skelAnime.curFrame + this->skelAnime.playSpeed; if (this->skelAnime.curFrame != 0.0f) { - if ((((temp_ft4 < 0) && (temp_ft5 > 0)) || ((temp_ft4 < 5) && (temp_ft5 > 5)))) { + if ((((beforeCurFrame < 0) && (afterCurFrame > 0)) || ((beforeCurFrame < 5) && (afterCurFrame > 5)))) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_WALK); } } @@ -1567,12 +1572,12 @@ void func_80B88D6C(EnKaizoku* this, PlayState* play) { } if (this->picto.actor.xzDistToPlayer <= 65.0f) { - func_80B87F70(this); - } else if (this->timer2B2 == 0) { + EnKaizoku_SetupSlash(this); + } else if (this->combatTimer == 0) { if (Actor_OtherIsTargeted(play, &this->picto.actor) && (Rand_ZeroOne() > 0.5f)) { func_80B87E28(this); } else { - func_80B872A4(this); + EnKaizoku_SetupReady(this); } } } @@ -1596,11 +1601,11 @@ void EnKaizoku_SetupStunned(EnKaizoku* this) { } Actor_PlaySfx(&this->picto.actor, NA_SE_EN_COMMON_FREEZE); - this->bool2D8 = 1; + this->dontUpdateSkel = true; if ((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { - this->unk_2B6 = 40; + this->iceTimer = 40; } this->action = KAIZOKU_ACTION_13; @@ -1624,9 +1629,9 @@ void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play) { } } - if ((this->unk_2B6 == 0) && (this->colorFilterTimer == 0) && !CHECK_FLAG_ALL(this->picto.actor.flags, ACTOR_FLAG_2000) && + if ((this->iceTimer == 0) && (this->colorFilterTimer == 0) && !CHECK_FLAG_ALL(this->picto.actor.flags, ACTOR_FLAG_2000) && (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - this->bool2D8 = 0; + this->dontUpdateSkel = 0; func_80B85A00(this, play, true); if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || @@ -1639,14 +1644,14 @@ void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play) { } } -void func_80B893CC(EnKaizoku* this, PlayState* play) { +void EnKaizoku_SetupDamaged(EnKaizoku* this, PlayState* play) { Vec3f sp34; Matrix_RotateYS(this->picto.actor.yawTowardsPlayer, MTXMODE_NEW); Matrix_MultVecZ(-10.0f, &sp34); Math_Vec3f_Copy(&this->unk_3C4, &sp34); this->lookTimer = 0; - this->bool2D8 = 0; + this->dontUpdateSkel = 0; this->picto.actor.speed = 0.0f; EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DAMAGE); @@ -1661,26 +1666,26 @@ void func_80B893CC(EnKaizoku* this, PlayState* play) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DAMAGE); this->action = KAIZOKU_ACTION_14; - this->actionFunc = func_80B894C0; + this->actionFunc = EnKaizoku_Damaged; } -void func_80B894C0(EnKaizoku* this, PlayState* play) { +void EnKaizoku_Damaged(EnKaizoku* this, PlayState* play) { s16 temp_v0; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0x1194, 0); - if (!func_80B85858(this, play) && !func_80B85A00(this, play, false) && (this->unk_3C4.x < 1.0f) && + if (!EnKaizoku_DodgeRanged(this, play) && !func_80B85A00(this, play, false) && (this->unk_3C4.x < 1.0f) && (this->unk_3C4.z < 1.0f)) { temp_v0 = this->picto.actor.wallYaw - this->picto.actor.shape.rot.y; if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (ABS_ALT(temp_v0) < 0x3000 && (this->picto.actor.xzDistToPlayer < 90.0f)) { - func_80B87C7C(this); + EnKaizoku_SetupFlip(this); return; } } if ((this->picto.actor.xzDistToPlayer <= 65.0f) && ((play->gameplayFrames % 8) != 0)) { this->swordCollider.info.elemType = ELEMTYPE_UNK2; - func_80B87F70(this); + EnKaizoku_SetupSlash(this); } else { func_80B87E28(this); } @@ -1704,7 +1709,7 @@ void func_80B8960C(EnKaizoku* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } this->picto.actor.speed = 0.0f; - this->bool2D8 = 1; + this->dontUpdateSkel = 1; Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_123); Enemy_StartFinishingBlow(play, &this->picto.actor); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DEAD); @@ -1778,7 +1783,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); SkelAnime_Update(&this->skelAnime); if (curFrame >= this->animEndFrame) { - this->bool2D8 = 0; + this->dontUpdateSkel = 0; EnKaizoku_SetupWin(this); } else if (Animation_OnFrame(&this->skelAnime, 10.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_DOWN); @@ -1839,9 +1844,9 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { } if ((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->picto.actor.wallBgId != BG_ACTOR_MAX) && - ((this->action == KAIZOKU_ACTION_2) || (this->action == KAIZOKU_ACTION_3) || - (this->action == KAIZOKU_ACTION_4) || (this->action == KAIZOKU_ACTION_1))) { - func_80B87F70(this); + ((this->action == KAIZOKU_ACTION_SPIN_DODGE) || (this->action == KAIZOKU_ACTION_SIDESTEP) || + (this->action == KAIZOKU_ACTION_4) || (this->action == KAIZOKU_ACTION_READY))) { + EnKaizoku_SetupSlash(this); } if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action > KAIZOKU_ACTION_0) && (this->spinAttackState < 2) && @@ -1887,7 +1892,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { if (this->action == KAIZOKU_ACTION_13) { wasHit = true; } else if (this->action != KAIZOKU_ACTION_6) { - func_80B87C7C(this); + EnKaizoku_SetupFlip(this); } break; @@ -1958,7 +1963,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { CollisionCheck_BlueBlood(play, NULL, &bloodPos); } - func_80B893CC(this, play); + EnKaizoku_SetupDamaged(this, play); } } else if (this->bodyCollider.base.acFlags & AC_HIT) { if ((this->action != KAIZOKU_ACTION_6) && (this->action != KAIZOKU_ACTION_14) && @@ -2004,7 +2009,7 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { EnKaizoku* this = THIS; PlayState* play = play2; - if (! this->bool2D8) { + if (! this->dontUpdateSkel) { SkelAnime_Update(&this->skelAnime); } @@ -2013,9 +2018,9 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { } DECR (this->blinkTimer); - DECR (this->timer2B2); + DECR (this->combatTimer); DECR (this->lookTimer); - DECR (this->unk_2B6); + DECR (this->iceTimer); DECR (this->cutsceneTimer); DECR (this->colorFilterTimer); diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index c347f0a9567..ff807e71d8c 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -12,6 +12,7 @@ typedef void (*EnKaizokuActionFunc)(struct EnKaizoku*, PlayState*); #define KAIZOKU_GET_EXIT_INDEX(thisx) ((thisx)->params & 0x3F) #define KAIZOKU_GET_SWITCH_FLAG(thisx) (((thisx)->params >> 6) & 0x7F) +// used for text and for outfit color #define KAIZOKU_GET_TYPE(this) ((this)->picto.actor.world.rot.z) #define KAIZOKU_SWITCH_FLAG_NONE 0x7F @@ -19,12 +20,12 @@ typedef void (*EnKaizokuActionFunc)(struct EnKaizoku*, PlayState*); // todo name these typedef enum EnKaizokuAnimation { /* 0 */ KAIZOKU_ANIM_FIGHTING_IDLE, - /* 1 */ EN_KAIZOKU_ANIM_1, - /* 2 */ EN_KAIZOKU_ANIM_2, + /* 1 */ KAIZOKU_ANIM_OOT_CONVERSATION, // giving player membership card? + /* 2 */ KAIZOKU_ANIM_OOT_JUMP, // replaced with _LAND /* 3 */ KAIZOKU_ANIM_SIDESTEP, /* 4 */ KAIZOKU_ANIM_WALK, /* 5 */ KAIZOKU_ANIM_DAMAGE, - /* 6 */ EN_KAIZOKU_ANIM_6, + /* 6 */ KAIZOKU_ANIM_OOT_DEFEAT, // replaced with _DEFEAT /* 7 */ KAIZOKU_ANIM_BLOCK, /* 8 */ KAIZOKU_ANIM_FLIP, /* 9 */ KAIZOKU_ANIM_SLASH_ATTCK, @@ -37,9 +38,10 @@ typedef enum EnKaizokuAnimation { /* 16 */ KAIZOKU_ANIM_DEFEAT, /* 17 */ KAIZOKU_ANIM_DEFEAT_IDLE, /* 18 */ KAIZOKU_ANIM_THROW_FLASH, - /* 19 */ EN_KAIZOKU_ANIM_MAX + /* 19 */ KAIZOKU_ANIM_MAX } EnKaizokuAnimation; +// this predates actor object xml enums right? typedef enum EnKaizokuBodyPart { /* 0 */ KAIZOKU_BODYPART_0, /* 1 */ KAIZOKU_BODYPART_1, @@ -60,10 +62,10 @@ typedef enum EnKaizokuBodyPart { } EnKaizokuBodyPart; typedef enum KaizokuTextOffset{ - /* 0 */ KAIZOKU_COVERSATION_INTRO_1, - /* 1 */ KAIZOKU_COVERSATION_INTRO_2, - /* 2 */ KAIZOKU_COVERSATION_WIN, - /* 3 */ KAIZOKU_COVERSATION_LOSS + /* 0 */ KAIZOKU_COVERSATION_INTRO_1, // shout before landing + /* 1 */ KAIZOKU_COVERSATION_INTRO_2, // after landing + /* 2 */ KAIZOKU_COVERSATION_WIN, // after losing to player + /* 3 */ KAIZOKU_COVERSATION_LOSS // after defeating player } KaizokuTextOffset; @@ -74,13 +76,13 @@ typedef struct EnKaizoku { /* 0x21C */ Vec3s morphTable[KAIZOKU_LIMB_MAX]; /* 0x2AC */ EnKaizokuActionFunc actionFunc; /* 0x2B0 */ s16 action; - /* 0x2B2 */ s16 timer2B2; // unk timer + /* 0x2B2 */ s16 combatTimer; /* 0x2B4 */ s16 lookTimer; - /* 0x2B6 */ s16 unk_2B6; // timer + /* 0x2B6 */ s16 iceTimer; /* 0x2B8 */ s16 colorFilterTimer; // name taken from oot, damaged flashing red /* 0x2BA */ s16 drawDmgEffType; /* 0x2BC */ s16 switchFlag; - /* 0x2BE */ s16 unk_2BE; + /* 0x2BE */ s16 unused2BE; /* 0x2C0 */ f32 drawDmgEffScale; /* 0x2C4 */ f32 drawDmgEffFrozenSteamScale; /* 0x2C8 */ s16 textidOffset; // which of the 4 text states during interaction @@ -91,10 +93,10 @@ typedef struct EnKaizoku { /* 0x2D2 */ s16 swordState; /* 0x2D4 */ s16 exitIndex; /* 0x2D6 */ s16 csId; - /* 0x2D8 */ u8 bool2D8; // bool + /* 0x2D8 */ u8 dontUpdateSkel; /* 0x2D9 */ u8 defeatBreathingStarted; /* 0x2DC */ f32 animEndFrame; - /* 0x2E0 */ f32 unk_2E0; // walking vector magnitude? + /* 0x2E0 */ f32 approachRate; /* 0x2E4 */ EnKaizokuAnimation animIndex; /* 0x2E8 */ s32 bodyPartIndex; /* 0x2EC */ s32 colorType; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 7caa3a2812c..99644faf1ee 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -14656,7 +14656,7 @@ 0x80B8504C:("BgDblueWaterfall_Draw",), 0x80B85590:("EnKaizoku_Init",), 0x80B85800:("EnKaizoku_Destroy",), - 0x80B85858:("func_80B85858",), + 0x80B85858:("EnKaizoku_DodgeRanged",), 0x80B85900:("func_80B85900",), 0x80B85A00:("func_80B85A00",), 0x80B85E18:("EnKaizoku_ChangeAnim",), @@ -14667,19 +14667,19 @@ 0x80B868B8:("EnKaizoku_Loss",), 0x80B86B58:("EnKaizoku_SetupWin",), 0x80B86B74:("EnKaizoku_Win",), - 0x80B872A4:("func_80B872A4",), - 0x80B872F4:("func_80B872F4",), - 0x80B874D8:("func_80B874D8",), - 0x80B8760C:("func_80B8760C",), - 0x80B87900:("func_80B87900",), - 0x80B8798C:("func_80B8798C",), - 0x80B87C7C:("func_80B87C7C",), + 0x80B872A4:("EnKaizoku_SetupReady",), + 0x80B872F4:("EnKaizoku_Ready",), + 0x80B874D8:("EnKaizoku_SetupSpinDodge",), + 0x80B8760C:("EnKaizoku_SpinDodge",), + 0x80B87900:("EnKaizoku_SetupBlock",), + 0x80B8798C:("EnKaizoku_Block",), + 0x80B87C7C:("EnKaizoku_SetupFlip",), 0x80B87CF8:("EnKaizoku_SpawnFootDust",), - 0x80B87D3C:("func_80B87D3C",), + 0x80B87D3C:("EnKaizoku_Flip",), 0x80B87E28:("func_80B87E28",), 0x80B87E9C:("func_80B87E9C",), - 0x80B87F70:("func_80B87F70",), - 0x80B87FDC:("func_80B87FDC",), + 0x80B87F70:("EnKaizoku_SetupSlash",), + 0x80B87FDC:("EnKaizoku_Slash",), 0x80B88214:("func_80B88214",), 0x80B88278:("func_80B88278",), 0x80B8833C:("func_80B8833C",), @@ -14688,12 +14688,12 @@ 0x80B887AC:("func_80B887AC",), 0x80B88910:("func_80B88910",), 0x80B88964:("func_80B88964",), - 0x80B88CD8:("func_80B88CD8",), - 0x80B88D6C:("func_80B88D6C",), + 0x80B88CD8:("EnKaizoku_SetupCircle",), + 0x80B88D6C:("EnKaizoku_Circle",), 0x80B891B8:("EnKaizoku_SetupStunned",), 0x80B89280:("EnKaizoku_Stunned",), - 0x80B893CC:("func_80B893CC",), - 0x80B894C0:("func_80B894C0",), + 0x80B893CC:("EnKaizoku_SetupDamaged",), + 0x80B894C0:("EnKaizoku_Damaged",), 0x80B8960C:("func_80B8960C",), 0x80B8971C:("func_80B8971C",), 0x80B89A08:("func_80B89A08",), From 2c85671d81f0d31275b2499c8e4499c9648d97b1 Mon Sep 17 00:00:00 2001 From: isghj Date: Sat, 11 Jan 2025 16:05:17 -0800 Subject: [PATCH 09/24] Kaizoku: more docs --- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 222 +++++++++--------- tools/disasm/functions.txt | 24 +- 2 files changed, 122 insertions(+), 124 deletions(-) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 87f9d56dd35..5eb7c52093d 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -32,18 +32,18 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupFlip(EnKaizoku* this); void EnKaizoku_SpawnFootDust(PlayState* play, Vec3f* pos); void EnKaizoku_Flip(EnKaizoku* this, PlayState* play); -void func_80B87E28(EnKaizoku* this); -void func_80B87E9C(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupRollBack(EnKaizoku* this); +void EnKaizoku_RollBack(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupSlash(EnKaizoku* this); void EnKaizoku_Slash(EnKaizoku* this, PlayState* play2); -void func_80B88214(EnKaizoku* this); -void func_80B88278(EnKaizoku* this, PlayState* play); -void func_80B8833C(EnKaizoku* this); -void func_80B88378(EnKaizoku* this, PlayState* play); -void func_80B88770(EnKaizoku* this); -void func_80B887AC(EnKaizoku* this, PlayState* play); -void func_80B88910(EnKaizoku* this); -void func_80B88964(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupRollForward(EnKaizoku* this); +void EnKaizoku_RollForward(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupAdvance(EnKaizoku* this); +void EnKaizoku_Advance(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupPivot(EnKaizoku* this); +void EnKaizoku_Pivot(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupSpinAttack(EnKaizoku* this); +void EnKaizoku_SpinAttack(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupCircle(EnKaizoku* this); void EnKaizoku_Circle(EnKaizoku* this, PlayState* play); void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play); @@ -51,18 +51,18 @@ void EnKaizoku_Damaged(EnKaizoku* this, PlayState* play); void func_80B8971C(EnKaizoku* this, PlayState* play); typedef enum EnKaizokuAction { - /* 0 */ KAIZOKU_ACTION_0, + /* 0 */ KAIZOKU_ACTION_HIDDEN, /* 1 */ KAIZOKU_ACTION_READY, /* 2 */ KAIZOKU_ACTION_SPIN_DODGE, /* 3 */ KAIZOKU_ACTION_SIDESTEP, - /* 4 */ KAIZOKU_ACTION_4, - /* 5 */ KAIZOKU_ACTION_5, + /* 4 */ KAIZOKU_ACTION_ADVANCE, + /* 5 */ KAIZOKU_ACTION_ROLL_FORWARD, /* 6 */ KAIZOKU_ACTION_6, /* 7 */ KAIZOKU_ACTION_7, /* 8 */ KAIZOKU_ACTION_8, /* 9 */ KAIZOKU_ACTION_9, /* 10 */ KAIZOKU_ACTION_10, - /* 11 */ KAIZOKU_ACTION_11, + /* 11 */ KAIZOKU_ACTION_SPIN_ATTACK, /* 12 */ KAIZOKU_ACTION_12, /* 13 */ KAIZOKU_ACTION_13, /* 14 */ KAIZOKU_ACTION_14, @@ -352,11 +352,11 @@ s32 EnKaizoku_DodgeRanged(EnKaizoku* this, PlayState* play) { } } -void func_80B85900(EnKaizoku* this) { +void EnKaizoku_TurnHead(EnKaizoku* this) { if (this->action == KAIZOKU_ACTION_READY) { this->headRot.y = Math_SinS(this->lookTimer * 0x1068) * 0x22D8; } else if (this->action != KAIZOKU_ACTION_13) { - if ((this->action == KAIZOKU_ACTION_9) || (this->action == KAIZOKU_ACTION_11)) { + if ((this->action == KAIZOKU_ACTION_9) || (this->action == KAIZOKU_ACTION_SPIN_ATTACK)) { Math_SmoothStepToS(&this->headRot.y, this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y, 1, 500, 0); this->headRot.y = CLAMP(this->headRot.y, -0x256F, 0x256F); @@ -366,9 +366,7 @@ void func_80B85900(EnKaizoku* this) { } } - -// react to player from oot? -s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) { +s32 EnKaizoku_ReactToPlayer(EnKaizoku* this, PlayState* play, s16 arg2) { Player* player = GET_PLAYER(play); s16 angleToWall = ABS_ALT(this->picto.actor.wallYaw - this->picto.actor.shape.rot.y); s16 angleToLink = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); @@ -399,7 +397,7 @@ s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) { } else if (this->picto.actor.xzDistToPlayer < BREG(11) + 180.0f) { EnKaizoku_SetupBlock(this); } else if (this->action != KAIZOKU_ACTION_7) { - func_80B87E28(this); + EnKaizoku_SetupRollBack(this); } return true; } @@ -424,7 +422,7 @@ s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) { } if (this->action != KAIZOKU_ACTION_7) { - func_80B87E28(this); + EnKaizoku_SetupRollBack(this); } return true; } @@ -475,7 +473,7 @@ void EnKaizoku_SetupWaitForApproach(EnKaizoku* this) { Math_Vec3f_Copy(&this->swordScaleRight, &gZeroVec3f); Math_Vec3f_Copy(&this->swordScaleLeft, &gZeroVec3f); this->dontUpdateSkel = true; - this->action = KAIZOKU_ACTION_0; + this->action = KAIZOKU_ACTION_HIDDEN; this->actionFunc = EnKaizoku_WaitForApproach; } @@ -698,7 +696,7 @@ void EnKaizoku_SetupLoss(EnKaizoku* this, PlayState* play) { this->cutsceneTimer = 0; this->cutsceneState = 0; this->dontUpdateSkel = false; - this->action = KAIZOKU_ACTION_0; + this->action = KAIZOKU_ACTION_HIDDEN; this->actionFunc = EnKaizoku_Loss; this->picto.actor.speed = 0.0f; } @@ -769,7 +767,7 @@ void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { // Player has won the fight void EnKaizoku_SetupWin(EnKaizoku* this) { this->dontUpdateSkel = false; - this->action = KAIZOKU_ACTION_0; + this->action = KAIZOKU_ACTION_HIDDEN; this->actionFunc = EnKaizoku_Win; } @@ -928,28 +926,28 @@ void EnKaizoku_SetupReady(EnKaizoku* this) { void EnKaizoku_Ready(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((this->lookTimer == 0) && !EnKaizoku_DodgeRanged(this, play) && !func_80B85A00(this, play, false)) { - s16 yawDiff = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; + if ((this->lookTimer == 0) && !EnKaizoku_DodgeRanged(this, play) && !EnKaizoku_ReactToPlayer(this, play, false)) { + s16 angleToLink = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; if ((this->picto.actor.xzDistToPlayer < 100.0f) && (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) && - (yawDiff >= 0x1F40)) { + (angleToLink >= 0x1F40)) { this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; EnKaizoku_SetupCircle(this); } else if (Actor_IsFacingPlayer(&this->picto.actor, 0xBB8)) { if ((this->picto.actor.xzDistToPlayer < 400.0f && this->picto.actor.xzDistToPlayer > 150.0f) && (Rand_ZeroOne() < 0.7f)) { - if ((Rand_ZeroOne() > 0.5f) || (ABS_ALT(yawDiff) < 0x3000)) { - func_80B88214(this); + if ((Rand_ZeroOne() > 0.5f) || (ABS_ALT(angleToLink) < 0x3000)) { + EnKaizoku_SetupRollForward(this); } else { - func_80B88910(this); + EnKaizoku_SetupSpinAttack(this); } } else if (Rand_ZeroOne() > 0.1f) { - func_80B8833C(this); + EnKaizoku_SetupAdvance(this); } else { EnKaizoku_SetupCircle(this); } } else { - func_80B88770(this); + EnKaizoku_SetupPivot(this); } } } @@ -1034,7 +1032,7 @@ void EnKaizoku_SpinDodge(EnKaizoku* this, PlayState* play) { if (this->picto.actor.xzDistToPlayer <= 70.0f) { EnKaizoku_SetupSlash(this); } else { - func_80B87E28(this); + EnKaizoku_SetupRollBack(this); } } } else if (this->picto.actor.speed >= 0.0f) { @@ -1080,7 +1078,7 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { EnKaizoku_SetupBlock(this); } else { this->bodyCollider.base.acFlags &= ~AC_HARD; - func_80B87E28(this); + EnKaizoku_SetupRollBack(this); } } else { temp_v0 = player->actor.shape.rot.y - this->picto.actor.shape.rot.y; @@ -1108,7 +1106,7 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { EnKaizoku_SetupFlip(this); } else { this->bodyCollider.base.acFlags &= ~AC_HARD; - func_80B87E28(this); + EnKaizoku_SetupRollBack(this); } } else { EnKaizoku_SetupBlock(this); @@ -1166,7 +1164,7 @@ void EnKaizoku_Flip(EnKaizoku* this, PlayState* play) { } } -void func_80B87E28(EnKaizoku* this) { +void EnKaizoku_SetupRollBack(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FLIP); this->picto.actor.speed = -8.0f; Actor_PlaySfx(&this->picto.actor, NA_SE_EN_TEKU_JUMP); @@ -1174,18 +1172,18 @@ void func_80B87E28(EnKaizoku* this) { this->bodyCollider.base.colType = COLTYPE_NONE; this->swordCollider.info.elemType = ELEMTYPE_UNK4; this->action = KAIZOKU_ACTION_7; - this->actionFunc = func_80B87E9C; + this->actionFunc = EnKaizoku_RollBack; this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; } -void func_80B87E9C(EnKaizoku* this, PlayState* play) { +void EnKaizoku_RollBack(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; this->dontUpdateSkel = false; if (curFrame >= this->animEndFrame) { if ((this->picto.actor.xzDistToPlayer < 170.0f) && (this->picto.actor.xzDistToPlayer > 140.0f) && (Rand_ZeroOne() < 0.2f)) { - func_80B88910(this); + EnKaizoku_SetupSpinAttack(this); } else { EnKaizoku_SetupBlock(this); } @@ -1228,7 +1226,7 @@ void EnKaizoku_Slash(EnKaizoku* this, PlayState* play2) { if (this->swordCollider.base.atFlags & AT_BOUNCED) { this->swordState = -1; this->swordCollider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); - func_80B87E28(this); + EnKaizoku_SetupRollBack(this); return; } @@ -1255,7 +1253,7 @@ void EnKaizoku_Slash(EnKaizoku* this, PlayState* play2) { this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; EnKaizoku_SetupCircle(this); } else { - func_80B85A00(this, play, true); + EnKaizoku_ReactToPlayer(this, play, true); } } else { EnKaizoku_SetupCircle(this); @@ -1264,17 +1262,17 @@ void EnKaizoku_Slash(EnKaizoku* this, PlayState* play2) { } } -void func_80B88214(EnKaizoku* this) { +void EnKaizoku_SetupRollForward(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FLIP); this->combatTimer = 0; this->picto.actor.speed = 10.0f; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y = this->picto.actor.yawTowardsPlayer; Actor_PlaySfx(&this->picto.actor, NA_SE_EN_TEKU_JUMP); - this->action = KAIZOKU_ACTION_5; - this->actionFunc = func_80B88278; + this->action = KAIZOKU_ACTION_ROLL_FORWARD; + this->actionFunc = EnKaizoku_RollForward; } -void func_80B88278(EnKaizoku* this, PlayState* play) { +void EnKaizoku_RollForward(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; this->dontUpdateSkel = false; @@ -1292,17 +1290,17 @@ void func_80B88278(EnKaizoku* this, PlayState* play) { } } -void func_80B8833C(EnKaizoku* this) { +void EnKaizoku_SetupAdvance(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_WALK); - this->action = KAIZOKU_ACTION_4; - this->actionFunc = func_80B88378; + this->action = KAIZOKU_ACTION_ADVANCE; + this->actionFunc = EnKaizoku_Advance; } -void func_80B88378(EnKaizoku* this, PlayState* play) { +void EnKaizoku_Advance(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); - s32 sp30; - s32 sp2C; - s16 sp2A; + s32 beforeCurFrame; + s32 afterCurFrame; + s16 facingAngleToLink; if (!EnKaizoku_DodgeRanged(this, play)) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0x2EE, 0); @@ -1316,9 +1314,9 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { } this->skelAnime.playSpeed = 1.0f; - sp2A = ABS_ALT(player->actor.shape.rot.y - this->picto.actor.shape.rot.y); + facingAngleToLink = ABS_ALT(player->actor.shape.rot.y - this->picto.actor.shape.rot.y); if ((this->picto.actor.xzDistToPlayer < 150.0f) && (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) && - (sp2A >= 0x2000)) { + (facingAngleToLink >= 0x2000)) { this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; if (Rand_ZeroOne() > 0.7f) { EnKaizoku_SetupCircle(this); @@ -1326,8 +1324,8 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { } } - sp30 = this->skelAnime.curFrame - this->skelAnime.playSpeed; - sp2C = this->skelAnime.curFrame + this->skelAnime.playSpeed; + beforeCurFrame = this->skelAnime.curFrame - this->skelAnime.playSpeed; + afterCurFrame = this->skelAnime.curFrame + this->skelAnime.playSpeed; if (!Actor_IsFacingPlayer(&this->picto.actor, 0x11C7)) { if (Rand_ZeroOne() > 0.5f) { EnKaizoku_SetupCircle(this); @@ -1335,23 +1333,23 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { EnKaizoku_SetupReady(this); } } else if (this->picto.actor.xzDistToPlayer < 90.0f) { - if ((Rand_ZeroOne() > 0.03f) || ((this->picto.actor.xzDistToPlayer <= 65.0f) && (sp2A < 0x4000))) { + if ((Rand_ZeroOne() > 0.03f) || ((this->picto.actor.xzDistToPlayer <= 65.0f) && (facingAngleToLink < 0x4000))) { EnKaizoku_SetupSlash(this); } else if (Actor_OtherIsTargeted(play, &this->picto.actor) && (Rand_ZeroOne() > 0.5f)) { - func_80B87E28(this); + EnKaizoku_SetupRollBack(this); } else { EnKaizoku_SetupCircle(this); } } - if (!func_80B85A00(this, play, false)) { + if (!EnKaizoku_ReactToPlayer(this, play, false)) { if ((this->picto.actor.xzDistToPlayer < 210.0f) && (this->picto.actor.xzDistToPlayer > 150.0f) && Actor_IsFacingPlayer(&this->picto.actor, 0x1388)) { if (Actor_IsTargeted(play, &this->picto.actor)) { if (Rand_ZeroOne() > 0.5f) { - func_80B88214(this); + EnKaizoku_SetupRollForward(this); } else { - func_80B88910(this); + EnKaizoku_SetupSpinAttack(this); } } else { EnKaizoku_SetupCircle(this); @@ -1363,32 +1361,31 @@ void func_80B88378(EnKaizoku* this, PlayState* play) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } - if ((this->skelAnime.curFrame != 0.0f) && (((sp30 < 0) && (sp2C > 0)) || ((sp30 < 4) && (sp2C >= 5)))) { + if ((this->skelAnime.curFrame != 0.0f) && (((beforeCurFrame < 0) && (afterCurFrame > 0)) || ((beforeCurFrame < 4) && (afterCurFrame >= 5)))) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_WALK); } } } } -// wait there are multiple side steps?? -void func_80B88770(EnKaizoku* this) { +void EnKaizoku_SetupPivot(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SIDESTEP); this->action = KAIZOKU_ACTION_10; - this->actionFunc = func_80B887AC; + this->actionFunc = EnKaizoku_Pivot; } -void func_80B887AC(EnKaizoku* this, PlayState* play) { - s16 yawDiff; - s16 yawAdjustment; +void EnKaizoku_Pivot(EnKaizoku* this, PlayState* play) { + s16 angleToLink; + s16 turnRate; - if (!EnKaizoku_DodgeRanged(this, play) && !func_80B85A00(this, play, false)) { - yawDiff = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; - if (yawDiff > 0) { - yawAdjustment = TRUNCF_BINANG(yawDiff * 0.25f) + 0x7D0; + if (!EnKaizoku_DodgeRanged(this, play) && !EnKaizoku_ReactToPlayer(this, play, false)) { + angleToLink = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; + if (angleToLink > 0) { + turnRate = TRUNCF_BINANG(angleToLink * 0.25f) + 0x7D0; } else { - yawAdjustment = TRUNCF_BINANG(yawDiff * 0.25f) - 0x7D0; + turnRate = TRUNCF_BINANG(angleToLink * 0.25f) - 0x7D0; } - this->picto.actor.shape.rot.y += yawAdjustment; + this->picto.actor.shape.rot.y += turnRate; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; this->skelAnime.playSpeed = 1.0f; @@ -1396,7 +1393,7 @@ void func_80B887AC(EnKaizoku* this, PlayState* play) { if (Rand_ZeroOne() > 0.8f) { EnKaizoku_SetupCircle(this); } else { - func_80B8833C(this); + EnKaizoku_SetupAdvance(this); } } if (!(play->gameplayFrames & 0x5F)) { @@ -1405,21 +1402,20 @@ void func_80B887AC(EnKaizoku* this, PlayState* play) { } } -// long roundhouse jump attack -void func_80B88910(EnKaizoku* this) { +void EnKaizoku_SetupSpinAttack(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SPIN_ATTACK); this->swordCollider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); this->spinAttackState = 0; - this->action = KAIZOKU_ACTION_11; - this->actionFunc = func_80B88964; + this->action = KAIZOKU_ACTION_SPIN_ATTACK; + this->actionFunc = EnKaizoku_SpinAttack; this->picto.actor.speed = 0.0f; } -void func_80B88964(EnKaizoku* this, PlayState* play) { +void EnKaizoku_SpinAttack(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; - s16 v1; - s16 a0; + s16 angleFacingLink; + s16 angleToLink; s32 pad; if (this->spinAttackState < 2) { @@ -1428,6 +1424,7 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { this->spinAttackState = 1; this->skelAnime.playSpeed = 1.0f; } + // in OOT, player-getting-caught, laughing, cutscene code was here } if (this->skelAnime.curFrame <= 8.0f) { @@ -1454,7 +1451,7 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { } if (this->spinAttackState != 0) { - func_80B87E28(this); + EnKaizoku_SetupRollBack(this); return; } @@ -1466,19 +1463,19 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; if (BREG(12) * 0.1f + 0.01f * 40.0f < Rand_ZeroOne()) { - EnKaizoku_SetupBlock(this); + // dev seemed unsatisfied with randomized behavior + EnKaizoku_SetupBlock(this); // in OOT this was sidestep return; } - v1 = ABS_ALT(player->actor.shape.rot.y - this->picto.actor.shape.rot.y); - if (v1 <= 0x2710) { - - a0 = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); - if (a0 > 0x4000) { + angleFacingLink = ABS_ALT(player->actor.shape.rot.y - this->picto.actor.shape.rot.y); + if (angleFacingLink <= 0x2710) { + angleToLink = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); + if (angleToLink > 0x4000) { this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; EnKaizoku_SetupCircle(this); } else { - func_80B85A00(this, play, true); + EnKaizoku_ReactToPlayer(this, play, true); } } else { EnKaizoku_SetupCircle(this); @@ -1505,7 +1502,7 @@ void EnKaizoku_Circle(EnKaizoku* this, PlayState* play) { s16 yaw; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); - if (!EnKaizoku_DodgeRanged(this, play) && !func_80B85A00(this, play, false)) { + if (!EnKaizoku_DodgeRanged(this, play) && !EnKaizoku_ReactToPlayer(this, play, false)) { this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y + 0x4000; angleBehindLink = player->actor.shape.rot.y + 0x8000; if (Math_SinS(angleBehindLink - this->picto.actor.shape.rot.y) >= 0.0f) { @@ -1575,7 +1572,7 @@ void EnKaizoku_Circle(EnKaizoku* this, PlayState* play) { EnKaizoku_SetupSlash(this); } else if (this->combatTimer == 0) { if (Actor_OtherIsTargeted(play, &this->picto.actor) && (Rand_ZeroOne() > 0.5f)) { - func_80B87E28(this); + EnKaizoku_SetupRollBack(this); } else { EnKaizoku_SetupReady(this); } @@ -1589,7 +1586,7 @@ void EnKaizoku_SetupStunned(EnKaizoku* this) { this->picto.actor.speed = 0.0f; } - if (this->action == KAIZOKU_ACTION_11) { + if (this->action == KAIZOKU_ACTION_SPIN_ATTACK) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DAMAGE); } @@ -1631,8 +1628,8 @@ void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play) { if ((this->iceTimer == 0) && (this->colorFilterTimer == 0) && !CHECK_FLAG_ALL(this->picto.actor.flags, ACTOR_FLAG_2000) && (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { - this->dontUpdateSkel = 0; - func_80B85A00(this, play, true); + this->dontUpdateSkel = false; + EnKaizoku_ReactToPlayer(this, play, true); if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { @@ -1651,7 +1648,7 @@ void EnKaizoku_SetupDamaged(EnKaizoku* this, PlayState* play) { Matrix_MultVecZ(-10.0f, &sp34); Math_Vec3f_Copy(&this->unk_3C4, &sp34); this->lookTimer = 0; - this->dontUpdateSkel = 0; + this->dontUpdateSkel = false; this->picto.actor.speed = 0.0f; EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DAMAGE); @@ -1673,7 +1670,7 @@ void EnKaizoku_Damaged(EnKaizoku* this, PlayState* play) { s16 temp_v0; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0x1194, 0); - if (!EnKaizoku_DodgeRanged(this, play) && !func_80B85A00(this, play, false) && (this->unk_3C4.x < 1.0f) && + if (!EnKaizoku_DodgeRanged(this, play) && !EnKaizoku_ReactToPlayer(this, play, false) && (this->unk_3C4.x < 1.0f) && (this->unk_3C4.z < 1.0f)) { temp_v0 = this->picto.actor.wallYaw - this->picto.actor.shape.rot.y; if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) { @@ -1687,7 +1684,7 @@ void EnKaizoku_Damaged(EnKaizoku* this, PlayState* play) { this->swordCollider.info.elemType = ELEMTYPE_UNK2; EnKaizoku_SetupSlash(this); } else { - func_80B87E28(this); + EnKaizoku_SetupRollBack(this); } } } @@ -1709,7 +1706,7 @@ void func_80B8960C(EnKaizoku* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } this->picto.actor.speed = 0.0f; - this->dontUpdateSkel = 1; + this->dontUpdateSkel = true; Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_123); Enemy_StartFinishingBlow(play, &this->picto.actor); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DEAD); @@ -1783,7 +1780,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); SkelAnime_Update(&this->skelAnime); if (curFrame >= this->animEndFrame) { - this->dontUpdateSkel = 0; + this->dontUpdateSkel = false; EnKaizoku_SetupWin(this); } else if (Animation_OnFrame(&this->skelAnime, 10.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_DOWN); @@ -1816,7 +1813,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { this->actionFunc = EnKaizoku_SetupLoss; } return; - } else if ((this->action == KAIZOKU_ACTION_11) && (this->swordCollider.base.at == &GET_PLAYER(play)->actor)) { + } else if ((this->action == KAIZOKU_ACTION_SPIN_ATTACK) && (this->swordCollider.base.at == &GET_PLAYER(play)->actor)) { func_800B8D98(play, &this->picto.actor, 3.0f, this->picto.actor.yawTowardsPlayer, 1.0f); Health_ChangeBy(play, -0xC); if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_16)) { @@ -1837,7 +1834,8 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { } } - // HUH? they are never in a room with a barrel? did they plan a special fight mechanic? + // HUH? they are never in a room with a barrel or plank? + // did they plan a special fight mechanic? if (this->swordCollider.base.at->id == ACTOR_OBJ_TARU) { this->swordCollider.base.at->home.rot.z = 1; } @@ -1845,11 +1843,11 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { if ((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) && (this->picto.actor.wallBgId != BG_ACTOR_MAX) && ((this->action == KAIZOKU_ACTION_SPIN_DODGE) || (this->action == KAIZOKU_ACTION_SIDESTEP) || - (this->action == KAIZOKU_ACTION_4) || (this->action == KAIZOKU_ACTION_READY))) { + (this->action == KAIZOKU_ACTION_ADVANCE) || (this->action == KAIZOKU_ACTION_READY))) { EnKaizoku_SetupSlash(this); } - if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action > KAIZOKU_ACTION_0) && (this->spinAttackState < 2) && + if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action > KAIZOKU_ACTION_HIDDEN) && (this->spinAttackState < 2) && (this->action != KAIZOKU_ACTION_6) && (this->action != KAIZOKU_ACTION_12) && (this->action != KAIZOKU_ACTION_14) && (this->action != KAIZOKU_ACTION_15)) { Actor_SetDropFlag(&this->picto.actor, &this->bodyCollider.info); @@ -1878,7 +1876,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { break; case KAIZOKU_DMGEFF_F: - if ((this->action != KAIZOKU_ACTION_5) && (this->action != KAIZOKU_ACTION_7) && + if ((this->action != KAIZOKU_ACTION_ROLL_FORWARD) && (this->action != KAIZOKU_ACTION_7) && (this->action < KAIZOKU_ACTION_14)) { wasHit = true; } @@ -1897,7 +1895,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { break; case KAIZOKU_DMGEFF_2: - if ((this->action != KAIZOKU_ACTION_5) && (this->action != KAIZOKU_ACTION_7) && + if ((this->action != KAIZOKU_ACTION_ROLL_FORWARD) && (this->action != KAIZOKU_ACTION_7) && (this->action < KAIZOKU_ACTION_14)) { this->colorFilterTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; @@ -2013,8 +2011,8 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { SkelAnime_Update(&this->skelAnime); } - if (this->action != KAIZOKU_ACTION_0) { - func_80B85900(this); + if (this->action != KAIZOKU_ACTION_HIDDEN) { + EnKaizoku_TurnHead(this); } DECR (this->blinkTimer); @@ -2026,10 +2024,10 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->picto.actor); - if (this->action != KAIZOKU_ACTION_0) { + if (this->action != KAIZOKU_ACTION_HIDDEN) { func_80B89A08(this, play); } - if (this->action != KAIZOKU_ACTION_0) { + if (this->action != KAIZOKU_ACTION_HIDDEN) { Actor_SetFocus(&this->picto.actor, 60.0f); } @@ -2060,7 +2058,7 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10); Collider_UpdateCylinder(&this->picto.actor, &this->bodyCollider); CollisionCheck_SetOC(play, &play->colChkCtx, &this->bodyCollider.base); - if ((this->spinAttackState < 2) && (this->action != KAIZOKU_ACTION_0)) { + if ((this->spinAttackState < 2) && (this->action != KAIZOKU_ACTION_HIDDEN)) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } if (this->swordState > 0) { @@ -2113,7 +2111,7 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVec3f(&sSwordTipOffset, &swordTip); Matrix_MultVec3f(&sSwordHiltOffset, &swordHilt); - if ((this->swordState == 1) && ((this->action == KAIZOKU_ACTION_9) || (this->action == KAIZOKU_ACTION_11))) { + if ((this->swordState == 1) && ((this->action == KAIZOKU_ACTION_9) || (this->action == KAIZOKU_ACTION_SPIN_ATTACK))) { EffectBlure_AddVertex(Effect_GetByIndex(this->blureIndex), &swordTip, &swordHilt); } else if (this->swordState != 0) { EffectBlure_AddSpace(Effect_GetByIndex(this->blureIndex)); diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 99644faf1ee..7cd7b8f20ef 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -14657,8 +14657,8 @@ 0x80B85590:("EnKaizoku_Init",), 0x80B85800:("EnKaizoku_Destroy",), 0x80B85858:("EnKaizoku_DodgeRanged",), - 0x80B85900:("func_80B85900",), - 0x80B85A00:("func_80B85A00",), + 0x80B85900:("EnKaizoku_TurnHead",), + 0x80B85A00:("EnKaizoku_ReactToPlayer",), 0x80B85E18:("EnKaizoku_ChangeAnim",), 0x80B85EA0:("EnKaizoku_ValidatePictograph",), 0x80B85F48:("EnKaizoku_SetupWaitForApproach",), @@ -14676,18 +14676,18 @@ 0x80B87C7C:("EnKaizoku_SetupFlip",), 0x80B87CF8:("EnKaizoku_SpawnFootDust",), 0x80B87D3C:("EnKaizoku_Flip",), - 0x80B87E28:("func_80B87E28",), - 0x80B87E9C:("func_80B87E9C",), + 0x80B87E28:("EnKaizoku_SetupRollBack",), + 0x80B87E9C:("EnKaizoku_RollBack",), 0x80B87F70:("EnKaizoku_SetupSlash",), 0x80B87FDC:("EnKaizoku_Slash",), - 0x80B88214:("func_80B88214",), - 0x80B88278:("func_80B88278",), - 0x80B8833C:("func_80B8833C",), - 0x80B88378:("func_80B88378",), - 0x80B88770:("func_80B88770",), - 0x80B887AC:("func_80B887AC",), - 0x80B88910:("func_80B88910",), - 0x80B88964:("func_80B88964",), + 0x80B88214:("EnKaizoku_SetupRollForward",), + 0x80B88278:("EnKaizoku_RollForward",), + 0x80B8833C:("EnKaizoku_SetupAdvance",), + 0x80B88378:("EnKaizoku_Advance",), + 0x80B88770:("EnKaizoku_SetupPivot",), + 0x80B887AC:("EnKaizoku_Pivot",), + 0x80B88910:("EnKaizoku_SetupSpinAttack",), + 0x80B88964:("EnKaizoku_SpinAttack",), 0x80B88CD8:("EnKaizoku_SetupCircle",), 0x80B88D6C:("EnKaizoku_Circle",), 0x80B891B8:("EnKaizoku_SetupStunned",), From 84d586c2f4c22c03e36eea421447a0004bf1856a Mon Sep 17 00:00:00 2001 From: isghj Date: Sun, 12 Jan 2025 00:10:18 -0800 Subject: [PATCH 10/24] Kaizoku: first pass complete --- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 297 +++++++++--------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 2 +- tools/disasm/functions.txt | 14 +- 3 files changed, 154 insertions(+), 159 deletions(-) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 5eb7c52093d..afc86b78b6e 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -1,7 +1,7 @@ /* * File: z_en_kaizoku.c * Overlay: ovl_En_Kaizoku - * Description: Fighter pirate + * Description: Fighter pirate, the miniboss guarding the eggs inside pirates fortress */ #include "z_en_kaizoku.h" @@ -21,17 +21,17 @@ s32 EnKaizoku_ValidatePictograph(PlayState* play, Actor* actor); void EnKaizoku_SetupWaitForApproach(EnKaizoku* this); void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play); void EnKaizoku_Loss(EnKaizoku* this, PlayState* play); -void EnKaizoku_SetupWin(EnKaizoku* this); -void EnKaizoku_Win(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupWinCutscene(EnKaizoku* this); +void EnKaizoku_WinCutscene(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupReady(EnKaizoku* this); void EnKaizoku_Ready(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupSpinDodge(EnKaizoku* this, PlayState* play); void EnKaizoku_SpinDodge(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupBlock(EnKaizoku* this); void EnKaizoku_Block(EnKaizoku* this, PlayState* play); -void EnKaizoku_SetupFlip(EnKaizoku* this); +void EnKaizoku_SetupJump(EnKaizoku* this); void EnKaizoku_SpawnFootDust(PlayState* play, Vec3f* pos); -void EnKaizoku_Flip(EnKaizoku* this, PlayState* play); +void EnKaizoku_Jump(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupRollBack(EnKaizoku* this); void EnKaizoku_RollBack(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupSlash(EnKaizoku* this); @@ -48,7 +48,7 @@ void EnKaizoku_SetupCircle(EnKaizoku* this); void EnKaizoku_Circle(EnKaizoku* this, PlayState* play); void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play); void EnKaizoku_Damaged(EnKaizoku* this, PlayState* play); -void func_80B8971C(EnKaizoku* this, PlayState* play); +void EnKaizoku_DefeatKnockdown(EnKaizoku* this, PlayState* play); typedef enum EnKaizokuAction { /* 0 */ KAIZOKU_ACTION_HIDDEN, @@ -57,20 +57,20 @@ typedef enum EnKaizokuAction { /* 3 */ KAIZOKU_ACTION_SIDESTEP, /* 4 */ KAIZOKU_ACTION_ADVANCE, /* 5 */ KAIZOKU_ACTION_ROLL_FORWARD, - /* 6 */ KAIZOKU_ACTION_6, - /* 7 */ KAIZOKU_ACTION_7, - /* 8 */ KAIZOKU_ACTION_8, - /* 9 */ KAIZOKU_ACTION_9, - /* 10 */ KAIZOKU_ACTION_10, + /* 6 */ KAIZOKU_ACTION_JUMP, + /* 7 */ KAIZOKU_ACTION_ROLL_BACK, + /* 8 */ KAIZOKU_ACTION_UNUSED_8, + /* 9 */ KAIZOKU_ACTION_SLASH, + /* 10 */ KAIZOKU_ACTION_PIVOT, /* 11 */ KAIZOKU_ACTION_SPIN_ATTACK, - /* 12 */ KAIZOKU_ACTION_12, - /* 13 */ KAIZOKU_ACTION_13, - /* 14 */ KAIZOKU_ACTION_14, - /* 15 */ KAIZOKU_ACTION_15, - /* 16 */ KAIZOKU_ACTION_16 + /* 12 */ KAIZOKU_ACTION_BLOCK, + /* 13 */ KAIZOKU_ACTION_STUNNED, + /* 14 */ KAIZOKU_ACTION_DAMAGED, + /* 15 */ KAIZOKU_ACTION_KNOCK_DOWN, + /* 16 */ KAIZOKU_ACTION_SCENE_FADE } EnKaizokuAction; -// text Ids +// text Ids, grouped into two batches of 4, and two mask values static u16 sKaizokuTextIds[] = { 0x11A4, // (intro.1) halt 0x11A5, // (intro.2) you must have courage, going to love doing this to you @@ -117,41 +117,41 @@ static Color_RGBA8 sKaizokuOutfitColors[] = { typedef enum EnKaizokuDamageEffect { /* 0x0 */ KAIZOKU_DMGEFF_NONE, - /* 0x1 */ KAIZOKU_DMGEFF_1, - /* 0x2 */ KAIZOKU_DMGEFF_2, + /* 0x1 */ KAIZOKU_DMGEFF_STUNNED, + /* 0x2 */ KAIZOKU_DMGEFF_FIRE_ARROW, /* 0x3 */ KAIZOKU_DMGEFF_FREEZE, - /* 0x4 */ KAIZOKU_DMGEFF_4, - /* 0x5 */ KAIZOKU_DMGEFF_5, - /* 0xD */ KAIZOKU_DMGEFF_D = 0xD, - /* 0xE */ KAIZOKU_DMGEFF_E, - /* 0xF */ KAIZOKU_DMGEFF_F + /* 0x4 */ KAIZOKU_DMGEFF_LIGHT_ARROW, + /* 0x5 */ KAIZOKU_DMGEFF_ZORA_SHIELD, + /* 0xD */ KAIZOKU_DMGEFF_D = 0xD, // smashed? it checks stun first? + /* 0xE */ KAIZOKU_DMGEFF_ALWAYS_HIT, + /* 0xF */ KAIZOKU_DMGEFF_IFRAME_PROTECTED // can only hit while kaizoku has no iframe from rolling } EnKaizokuDamageEffect; static DamageTable sDamageTable = { - /* Deku Nut */ DMG_ENTRY(0, KAIZOKU_DMGEFF_1), - /* Deku Stick */ DMG_ENTRY(1, KAIZOKU_DMGEFF_F), + /* Deku Nut */ DMG_ENTRY(0, KAIZOKU_DMGEFF_STUNNED), + /* Deku Stick */ DMG_ENTRY(1, KAIZOKU_DMGEFF_IFRAME_PROTECTED), /* Horse trample */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), - /* Explosives */ DMG_ENTRY(1, KAIZOKU_DMGEFF_F), - /* Zora boomerang */ DMG_ENTRY(0, KAIZOKU_DMGEFF_1), - /* Normal arrow */ DMG_ENTRY(1, KAIZOKU_DMGEFF_F), + /* Explosives */ DMG_ENTRY(1, KAIZOKU_DMGEFF_IFRAME_PROTECTED), + /* Zora boomerang */ DMG_ENTRY(0, KAIZOKU_DMGEFF_STUNNED), + /* Normal arrow */ DMG_ENTRY(1, KAIZOKU_DMGEFF_IFRAME_PROTECTED), /* UNK_DMG_0x06 */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), - /* Hookshot */ DMG_ENTRY(0, KAIZOKU_DMGEFF_1), - /* Goron punch */ DMG_ENTRY(1, KAIZOKU_DMGEFF_E), - /* Sword */ DMG_ENTRY(1, KAIZOKU_DMGEFF_E), + /* Hookshot */ DMG_ENTRY(0, KAIZOKU_DMGEFF_STUNNED), + /* Goron punch */ DMG_ENTRY(1, KAIZOKU_DMGEFF_ALWAYS_HIT), + /* Sword */ DMG_ENTRY(1, KAIZOKU_DMGEFF_ALWAYS_HIT), /* Goron pound */ DMG_ENTRY(0, KAIZOKU_DMGEFF_D), - /* Fire arrow */ DMG_ENTRY(2, KAIZOKU_DMGEFF_2), + /* Fire arrow */ DMG_ENTRY(2, KAIZOKU_DMGEFF_FIRE_ARROW), /* Ice arrow */ DMG_ENTRY(2, KAIZOKU_DMGEFF_FREEZE), - /* Light arrow */ DMG_ENTRY(2, KAIZOKU_DMGEFF_4), - /* Goron spikes */ DMG_ENTRY(1, KAIZOKU_DMGEFF_E), - /* Deku spin */ DMG_ENTRY(0, KAIZOKU_DMGEFF_1), - /* Deku bubble */ DMG_ENTRY(1, KAIZOKU_DMGEFF_E), - /* Deku launch */ DMG_ENTRY(2, KAIZOKU_DMGEFF_E), - /* UNK_DMG_0x12 */ DMG_ENTRY(0, KAIZOKU_DMGEFF_1), - /* Zora barrier */ DMG_ENTRY(0, KAIZOKU_DMGEFF_5), + /* Light arrow */ DMG_ENTRY(2, KAIZOKU_DMGEFF_LIGHT_ARROW), + /* Goron spikes */ DMG_ENTRY(1, KAIZOKU_DMGEFF_ALWAYS_HIT), + /* Deku spin */ DMG_ENTRY(0, KAIZOKU_DMGEFF_STUNNED), + /* Deku bubble */ DMG_ENTRY(1, KAIZOKU_DMGEFF_ALWAYS_HIT), + /* Deku launch */ DMG_ENTRY(2, KAIZOKU_DMGEFF_ALWAYS_HIT), + /* UNK_DMG_0x12 */ DMG_ENTRY(0, KAIZOKU_DMGEFF_STUNNED), + /* Zora barrier */ DMG_ENTRY(0, KAIZOKU_DMGEFF_ZORA_SHIELD), /* Normal shield */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), /* Light ray */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), - /* Thrown object */ DMG_ENTRY(1, KAIZOKU_DMGEFF_E), - /* Zora punch */ DMG_ENTRY(1, KAIZOKU_DMGEFF_E), + /* Thrown object */ DMG_ENTRY(1, KAIZOKU_DMGEFF_ALWAYS_HIT), + /* Zora punch */ DMG_ENTRY(1, KAIZOKU_DMGEFF_ALWAYS_HIT), /* Spin attack */ DMG_ENTRY(1, KAIZOKU_DMGEFF_D), /* Sword beam */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), /* Normal Roll */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), @@ -159,7 +159,7 @@ static DamageTable sDamageTable = { /* UNK_DMG_0x1C */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), /* Unblockable */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), /* UNK_DMG_0x1E */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), - /* Powder Keg */ DMG_ENTRY(1, KAIZOKU_DMGEFF_E), + /* Powder Keg */ DMG_ENTRY(1, KAIZOKU_DMGEFF_ALWAYS_HIT), }; ActorInit En_Kaizoku_InitVars = { @@ -338,9 +338,9 @@ s32 EnKaizoku_DodgeRanged(EnKaizoku* this, PlayState* play) { continue; } - if (((itemAction->id != ACTOR_ARMS_HOOK) || (this->action != KAIZOKU_ACTION_13)) && - (this->action != KAIZOKU_ACTION_6)) { - EnKaizoku_SetupFlip(this); + if (((itemAction->id != ACTOR_ARMS_HOOK) || (this->action != KAIZOKU_ACTION_STUNNED)) && + (this->action != KAIZOKU_ACTION_JUMP)) { + EnKaizoku_SetupJump(this); } break; } @@ -355,8 +355,8 @@ s32 EnKaizoku_DodgeRanged(EnKaizoku* this, PlayState* play) { void EnKaizoku_TurnHead(EnKaizoku* this) { if (this->action == KAIZOKU_ACTION_READY) { this->headRot.y = Math_SinS(this->lookTimer * 0x1068) * 0x22D8; - } else if (this->action != KAIZOKU_ACTION_13) { - if ((this->action == KAIZOKU_ACTION_9) || (this->action == KAIZOKU_ACTION_SPIN_ATTACK)) { + } else if (this->action != KAIZOKU_ACTION_STUNNED) { + if ((this->action == KAIZOKU_ACTION_SLASH) || (this->action == KAIZOKU_ACTION_SPIN_ATTACK)) { Math_SmoothStepToS(&this->headRot.y, this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y, 1, 500, 0); this->headRot.y = CLAMP(this->headRot.y, -0x256F, 0x256F); @@ -386,8 +386,8 @@ s32 EnKaizoku_ReactToPlayer(EnKaizoku* this, PlayState* play, s16 arg2) { this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; if ((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) && (ABS_ALT(angleToWall) < 0x2EE0) && (this->picto.actor.xzDistToPlayer < 90.0f)) { - if (this->action != KAIZOKU_ACTION_6) { - EnKaizoku_SetupFlip(this); + if (this->action != KAIZOKU_ACTION_JUMP) { + EnKaizoku_SetupJump(this); } return true; } else if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { @@ -396,7 +396,7 @@ s32 EnKaizoku_ReactToPlayer(EnKaizoku* this, PlayState* play, s16 arg2) { } } else if (this->picto.actor.xzDistToPlayer < BREG(11) + 180.0f) { EnKaizoku_SetupBlock(this); - } else if (this->action != KAIZOKU_ACTION_7) { + } else if (this->action != KAIZOKU_ACTION_ROLL_BACK) { EnKaizoku_SetupRollBack(this); } return true; @@ -411,8 +411,8 @@ s32 EnKaizoku_ReactToPlayer(EnKaizoku* this, PlayState* play, s16 arg2) { if ((explosiveActor->id == ACTOR_EN_BOM_CHU) && (Actor_WorldDistXYZToActor(&this->picto.actor, explosiveActor) < 80.0f) && (BINANG_ADD(this->picto.actor.shape.rot.y - explosiveActor->world.rot.y, 0x8000) < 0x4000)) { - if (this->action != KAIZOKU_ACTION_6) { - EnKaizoku_SetupFlip(this); + if (this->action != KAIZOKU_ACTION_JUMP) { + EnKaizoku_SetupJump(this); } } else { EnKaizoku_SetupBlock(this); @@ -421,7 +421,7 @@ s32 EnKaizoku_ReactToPlayer(EnKaizoku* this, PlayState* play, s16 arg2) { return true; } - if (this->action != KAIZOKU_ACTION_7) { + if (this->action != KAIZOKU_ACTION_ROLL_BACK) { EnKaizoku_SetupRollBack(this); } return true; @@ -439,7 +439,7 @@ s32 EnKaizoku_ReactToPlayer(EnKaizoku* this, PlayState* play, s16 arg2) { angleToFacingLink = player->actor.shape.rot.y - this->picto.actor.shape.rot.y; if ((this->picto.actor.xzDistToPlayer <= 65.0f) && !Actor_OtherIsTargeted(play, &this->picto.actor) && (ABS_ALT(angleToFacingLink) < 0x5000)) { - if (this->action != KAIZOKU_ACTION_9) { + if (this->action != KAIZOKU_ACTION_SLASH) { EnKaizoku_SetupSlash(this); return 1; } @@ -523,7 +523,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { Audio_SetMainBgmVolume(0, 0xA); this->cutsceneState++; // fallthrough - case 1: // start falling + case 1: // try message lock to player player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; @@ -679,7 +679,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } } - +// Player has lost the fight void EnKaizoku_SetupLoss(EnKaizoku* this, PlayState* play) { if (this->subCamId == SUB_CAM_ID_DONE) { if (!CutsceneManager_IsNext(this->csId)) { @@ -701,7 +701,6 @@ void EnKaizoku_SetupLoss(EnKaizoku* this, PlayState* play) { this->picto.actor.speed = 0.0f; } -// Player has lost the fight void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; @@ -715,7 +714,7 @@ void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { this->subCamAt.z = Math_CosS(this->picto.actor.yawTowardsPlayer) * 11.0f + this->picto.actor.world.pos.z; switch (this->cutsceneState) { - case 0: + case 0: // waiting for animation to change if (curFrame >= this->animEndFrame) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_LOWER_WEAPONS); this->textidOffset = KAIZOKU_COVERSATION_LOSS; @@ -724,7 +723,7 @@ void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { } break; - case 1: + case 1: // wait for weapons to finish lowering if (curFrame >= this->animEndFrame) { s32 textId; @@ -737,7 +736,7 @@ void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { } break; - case 2: + case 2: // wait for text to finish if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_END); @@ -748,7 +747,7 @@ void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { Scene_SetExitFade(play); play->transitionTrigger = TRANS_TRIGGER_START; this->cutsceneState++; - this->action = KAIZOKU_ACTION_16; + this->action = KAIZOKU_ACTION_SCENE_FADE; } break; @@ -765,13 +764,13 @@ void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { } // Player has won the fight -void EnKaizoku_SetupWin(EnKaizoku* this) { +void EnKaizoku_SetupWinCutscene(EnKaizoku* this) { this->dontUpdateSkel = false; this->action = KAIZOKU_ACTION_HIDDEN; - this->actionFunc = EnKaizoku_Win; + this->actionFunc = EnKaizoku_WinCutscene; } -void EnKaizoku_Win(EnKaizoku* this, PlayState* play) { +void EnKaizoku_WinCutscene(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 textId; f32 curFrame = this->skelAnime.curFrame; @@ -793,21 +792,21 @@ void EnKaizoku_Win(EnKaizoku* this, PlayState* play) { player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); switch (this->cutsceneState) { - case 0: + case 0: // start: change animation and start talking EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DEFEAT_IDLE); this->textidOffset = KAIZOKU_COVERSATION_WIN; textId = this->textType * 4 + this->textidOffset; Message_StartTextbox(play, sKaizokuTextIds[textId], &this->picto.actor); - this->defeatBreathingStarted = 0; + this->defeatBreathingStarted = false; this->cutsceneTimer = 0; this->cutsceneState++; break; - case 1: + case 1: // talking if (curFrame >= this->animEndFrame) { - if (this->defeatBreathingStarted == 0) { + if (this->defeatBreathingStarted == false) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DAMM_BREATH); - this->defeatBreathingStarted = 1; + this->defeatBreathingStarted = true; } else { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } @@ -823,7 +822,7 @@ void EnKaizoku_Win(EnKaizoku* this, PlayState* play) { } break; - case 2: + case 2: // throwing a nut to escape this->subCamEyeTarget.x = player->actor.world.pos.x + 77.0f; this->subCamEyeTarget.y = player->actor.world.pos.y + 84.0f; this->subCamEyeTarget.z = player->actor.world.pos.z - 71.0f; @@ -872,7 +871,7 @@ void EnKaizoku_Win(EnKaizoku* this, PlayState* play) { } break; - case 3: + case 3: // nut flash is dissapearing if (this->cutsceneTimer == 0) { Math_ApproachZeroF(&this->flashScreenAlphaTarget, 0.5f, 10.0f); this->flashScreenAlpha = this->flashScreenAlphaTarget / 60.0f; @@ -914,7 +913,7 @@ void EnKaizoku_Win(EnKaizoku* this, PlayState* play) { } } - +// Combat idle void EnKaizoku_SetupReady(EnKaizoku* this) { this->picto.actor.speed = 0.0f; EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FIGHTING_IDLE); @@ -975,9 +974,9 @@ void EnKaizoku_SetupSpinDodge(EnKaizoku* this, PlayState* play) { } void EnKaizoku_SpinDodge(EnKaizoku* this, PlayState* play) { - s16 var_v0; - s32 temp_ft0; - s32 temp_ft1; + s16 wallAngle; + s32 beforeCurFrame; + s32 afterCurFrame; this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer + 0x3A98; if ((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) || @@ -985,18 +984,18 @@ void EnKaizoku_SpinDodge(EnKaizoku* this, PlayState* play) { this->picto.actor.shape.rot.y + 0x4000)) { if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (this->picto.actor.speed >= 0.0f) { - var_v0 = this->picto.actor.shape.rot.y + 0x4000; + wallAngle = this->picto.actor.shape.rot.y + 0x4000; } else { - var_v0 = this->picto.actor.shape.rot.y - 0x4000; + wallAngle = this->picto.actor.shape.rot.y - 0x4000; } - var_v0 = this->picto.actor.wallYaw - var_v0; + wallAngle = this->picto.actor.wallYaw - wallAngle; } else { this->picto.actor.speed *= -0.8f; - var_v0 = 0; + wallAngle = 0; } - if (ABS_ALT(var_v0) > 0x4000) { - EnKaizoku_SetupFlip(this); + if (ABS_ALT(wallAngle) > 0x4000) { + EnKaizoku_SetupJump(this); return; } } @@ -1015,10 +1014,10 @@ void EnKaizoku_SpinDodge(EnKaizoku* this, PlayState* play) { } this->skelAnime.playSpeed = 1.0f; - temp_ft0 = this->skelAnime.curFrame - this->skelAnime.playSpeed; - temp_ft1 = this->skelAnime.curFrame + this->skelAnime.playSpeed; + beforeCurFrame = this->skelAnime.curFrame - this->skelAnime.playSpeed; + afterCurFrame = this->skelAnime.curFrame + this->skelAnime.playSpeed; if ((this->skelAnime.curFrame != 0.0f) && - (((temp_ft0 < 0) && (temp_ft1 > 0)) || ((temp_ft0 < 5) && (temp_ft1 >= 6)))) { + (((beforeCurFrame < 0) && (afterCurFrame > 0)) || ((beforeCurFrame < 5) && (afterCurFrame >= 6)))) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_WALK); } @@ -1053,13 +1052,13 @@ void EnKaizoku_SetupBlock(EnKaizoku* this) { this->combatTimer = Rand_S16Offset(10, 10); this->bodyCollider.base.acFlags |= AC_HARD; this->lookTimer = 12; - this->action = KAIZOKU_ACTION_12; + this->action = KAIZOKU_ACTION_BLOCK; this->actionFunc = EnKaizoku_Block; } void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 temp_v0; + s16 angleToLink; this->dontUpdateSkel = true; if (this->combatTimer == 0) { @@ -1067,8 +1066,8 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { } if (this->lookTimer == 0) { this->dontUpdateSkel = false; - temp_v0 = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; - if ((ABS_ALT(temp_v0) <= 0x4000) && (this->picto.actor.xzDistToPlayer < 40.0f) && + angleToLink = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; + if ((ABS_ALT(angleToLink) <= 0x4000) && (this->picto.actor.xzDistToPlayer < 40.0f) && (fabsf(this->picto.actor.playerHeightRel) < 50.0f)) { if (func_800BE184(play, &this->picto.actor, 100.0f, 10000, 0x4000, this->picto.actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { @@ -1081,8 +1080,8 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { EnKaizoku_SetupRollBack(this); } } else { - temp_v0 = player->actor.shape.rot.y - this->picto.actor.shape.rot.y; - if (ABS_ALT(temp_v0) < 0x4000) { + angleToLink = player->actor.shape.rot.y - this->picto.actor.shape.rot.y; + if (ABS_ALT(angleToLink) < 0x4000) { this->bodyCollider.base.acFlags &= ~AC_HARD; EnKaizoku_SetupSlash(this); } else { @@ -1094,8 +1093,7 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { this->bodyCollider.base.acFlags &= ~AC_HARD; EnKaizoku_SetupCircle(this); } - } else if ((this->combatTimer == 0) && - func_800BE184(play, &this->picto.actor, 100.0f, 10000, 0x4000, this->picto.actor.shape.rot.y)) { + } else if ((this->combatTimer == 0) && func_800BE184(play, &this->picto.actor, 100.0f, 10000, 0x4000, this->picto.actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { this->bodyCollider.base.acFlags &= ~AC_HARD; EnKaizoku_SetupSpinDodge(this, play); @@ -1103,7 +1101,7 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { if (!(play->gameplayFrames & 1)) { if (this->picto.actor.xzDistToPlayer < 100.0f && Rand_ZeroOne() > 0.7f) { this->bodyCollider.base.acFlags &= ~AC_HARD; - EnKaizoku_SetupFlip(this); + EnKaizoku_SetupJump(this); } else { this->bodyCollider.base.acFlags &= ~AC_HARD; EnKaizoku_SetupRollBack(this); @@ -1116,7 +1114,7 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { } // this might be JUMP not flip -void EnKaizoku_SetupFlip(EnKaizoku* this) { +void EnKaizoku_SetupJump(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FLIP); this->picto.actor.speed = 6.5f; this->picto.actor.velocity.y = 15.0f; @@ -1125,8 +1123,8 @@ void EnKaizoku_SetupFlip(EnKaizoku* this) { this->bodyCollider.info.elemType = ELEMTYPE_UNK4; this->bodyCollider.base.colType = COLTYPE_NONE; this->swordCollider.info.elemType = ELEMTYPE_UNK4; - this->action = KAIZOKU_ACTION_6; - this->actionFunc = EnKaizoku_Flip; + this->action = KAIZOKU_ACTION_JUMP; + this->actionFunc = EnKaizoku_Jump; } static Color_RGBA8 sKaizokuDustPrimColor = { 200, 160, 120, 255 }; // light brown @@ -1140,7 +1138,7 @@ void EnKaizoku_SpawnFootDust(PlayState* play, Vec3f* pos) { EffectSsKirakira_SpawnSmall(play, pos, &sKaizokuDustVelocity, &sKaizokuDustAccel, &sKaizokuDustPrimColor, &sKaizokuDustEnvColor); } -void EnKaizoku_Flip(EnKaizoku* this, PlayState* play) { +void EnKaizoku_Jump(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); @@ -1171,7 +1169,7 @@ void EnKaizoku_SetupRollBack(EnKaizoku* this) { this->bodyCollider.info.elemType = ELEMTYPE_UNK4; this->bodyCollider.base.colType = COLTYPE_NONE; this->swordCollider.info.elemType = ELEMTYPE_UNK4; - this->action = KAIZOKU_ACTION_7; + this->action = KAIZOKU_ACTION_ROLL_BACK; this->actionFunc = EnKaizoku_RollBack; this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; } @@ -1199,7 +1197,7 @@ void EnKaizoku_SetupSlash(EnKaizoku* this) { this->swordCollider.base.atFlags &= ~AT_BOUNCED; this->picto.actor.speed = 0.0f; AudioSfx_StopByPosAndId(&this->picto.actor.projectedPos, NA_SE_EN_PIRATE_BREATH); - this->action = KAIZOKU_ACTION_9; + this->action = KAIZOKU_ACTION_SLASH; this->actionFunc = EnKaizoku_Slash; } @@ -1370,7 +1368,7 @@ void EnKaizoku_Advance(EnKaizoku* this, PlayState* play) { void EnKaizoku_SetupPivot(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SIDESTEP); - this->action = KAIZOKU_ACTION_10; + this->action = KAIZOKU_ACTION_PIVOT; this->actionFunc = EnKaizoku_Pivot; } @@ -1580,7 +1578,6 @@ void EnKaizoku_Circle(EnKaizoku* this, PlayState* play) { } } -// not convinced these are the right function name void EnKaizoku_SetupStunned(EnKaizoku* this) { if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->picto.actor.speed = 0.0f; @@ -1605,7 +1602,7 @@ void EnKaizoku_SetupStunned(EnKaizoku* this) { this->iceTimer = 40; } - this->action = KAIZOKU_ACTION_13; + this->action = KAIZOKU_ACTION_STUNNED; this->actionFunc = EnKaizoku_Stunned; } @@ -1646,7 +1643,7 @@ void EnKaizoku_SetupDamaged(EnKaizoku* this, PlayState* play) { Matrix_RotateYS(this->picto.actor.yawTowardsPlayer, MTXMODE_NEW); Matrix_MultVecZ(-10.0f, &sp34); - Math_Vec3f_Copy(&this->unk_3C4, &sp34); + Math_Vec3f_Copy(&this->velocity, &sp34); this->lookTimer = 0; this->dontUpdateSkel = false; this->picto.actor.speed = 0.0f; @@ -1662,20 +1659,20 @@ void EnKaizoku_SetupDamaged(EnKaizoku* this, PlayState* play) { } Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DAMAGE); - this->action = KAIZOKU_ACTION_14; + this->action = KAIZOKU_ACTION_DAMAGED; this->actionFunc = EnKaizoku_Damaged; } void EnKaizoku_Damaged(EnKaizoku* this, PlayState* play) { - s16 temp_v0; + s16 angleToWall; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0x1194, 0); - if (!EnKaizoku_DodgeRanged(this, play) && !EnKaizoku_ReactToPlayer(this, play, false) && (this->unk_3C4.x < 1.0f) && - (this->unk_3C4.z < 1.0f)) { - temp_v0 = this->picto.actor.wallYaw - this->picto.actor.shape.rot.y; + if (!EnKaizoku_DodgeRanged(this, play) && !EnKaizoku_ReactToPlayer(this, play, false) && (this->velocity.x < 1.0f) && + (this->velocity.z < 1.0f)) { + angleToWall = this->picto.actor.wallYaw - this->picto.actor.shape.rot.y; if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) { - if (ABS_ALT(temp_v0) < 0x3000 && (this->picto.actor.xzDistToPlayer < 90.0f)) { - EnKaizoku_SetupFlip(this); + if (ABS_ALT(angleToWall) < 0x3000 && (this->picto.actor.xzDistToPlayer < 90.0f)) { + EnKaizoku_SetupJump(this); return; } } @@ -1689,15 +1686,13 @@ void EnKaizoku_Damaged(EnKaizoku* this, PlayState* play) { } } - -// trigger win -void func_80B8960C(EnKaizoku* this, PlayState* play) { +void EnKaizoku_SetupDefeatKnockdown(EnKaizoku* this, PlayState* play) { Vec3f sp24; this->picto.actor.flags |= ACTOR_FLAG_100000; Matrix_RotateYS(this->picto.actor.yawTowardsPlayer, MTXMODE_NEW); Matrix_MultVecZ(-10.0f, &sp24); - Math_Vec3f_Copy(&this->unk_3C4, &sp24); + Math_Vec3f_Copy(&this->velocity, &sp24); EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DEFEAT); if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || @@ -1715,11 +1710,11 @@ void func_80B8960C(EnKaizoku* this, PlayState* play) { this->picto.actor.flags &= ~ACTOR_FLAG_400; this->cutsceneTimer = 0; this->cutsceneState = 0; - this->action = KAIZOKU_ACTION_15; - this->actionFunc = func_80B8971C; + this->action = KAIZOKU_ACTION_KNOCK_DOWN; + this->actionFunc = EnKaizoku_DefeatKnockdown; } -void func_80B8971C(EnKaizoku* this, PlayState* play) { +void EnKaizoku_DefeatKnockdown(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; Player* player; @@ -1752,7 +1747,7 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); } - Math_Vec3f_Copy(&this->unk_3C4, &gZeroVec3f); + Math_Vec3f_Copy(&this->velocity, &gZeroVec3f); player->actor.world.pos.x = this->picto.actor.home.pos.x + 90.0f; player->actor.world.pos.z = this->picto.actor.home.pos.z + 30.0f; this->picto.actor.world.pos.x = this->picto.actor.home.pos.x; @@ -1781,15 +1776,14 @@ void func_80B8971C(EnKaizoku* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (curFrame >= this->animEndFrame) { this->dontUpdateSkel = false; - EnKaizoku_SetupWin(this); + EnKaizoku_SetupWinCutscene(this); } else if (Animation_OnFrame(&this->skelAnime, 10.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_DOWN); } } - -// handle damage to player and from player -void func_80B89A08(EnKaizoku* this, PlayState* play) { +// Handle damage to player and from player +void EnKaizoku_UpdateDamage(EnKaizoku* this, PlayState* play) { s32 wasHit = false; if (gSaveContext.save.saveInfo.playerData.health <= 0x10) { @@ -1799,7 +1793,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { } if (!(this->swordCollider.base.atFlags & AT_BOUNCED) && (this->swordCollider.base.atFlags & AT_HIT)) { - if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_16)) { + if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_SCENE_FADE)) { this->spinAttackState = 2; this->subCamId = SUB_CAM_ID_DONE; this->picto.actor.flags |= ACTOR_FLAG_100000; @@ -1816,7 +1810,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { } else if ((this->action == KAIZOKU_ACTION_SPIN_ATTACK) && (this->swordCollider.base.at == &GET_PLAYER(play)->actor)) { func_800B8D98(play, &this->picto.actor, 3.0f, this->picto.actor.yawTowardsPlayer, 1.0f); Health_ChangeBy(play, -0xC); - if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_16)) { + if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_SCENE_FADE)) { Health_ChangeBy(play, 0x10); this->spinAttackState = 2; this->subCamId = SUB_CAM_ID_DONE; @@ -1834,7 +1828,8 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { } } - // HUH? they are never in a room with a barrel or plank? + // Unused: all three rooms with all three of them only contain themselves and 2 torches for actors + // they are never in a room with a barrel or a wooden plank // did they plan a special fight mechanic? if (this->swordCollider.base.at->id == ACTOR_OBJ_TARU) { this->swordCollider.base.at->home.rot.z = 1; @@ -1848,13 +1843,13 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { } if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action > KAIZOKU_ACTION_HIDDEN) && (this->spinAttackState < 2) && - (this->action != KAIZOKU_ACTION_6) && (this->action != KAIZOKU_ACTION_12) && - (this->action != KAIZOKU_ACTION_14) && (this->action != KAIZOKU_ACTION_15)) { + (this->action != KAIZOKU_ACTION_JUMP) && (this->action != KAIZOKU_ACTION_BLOCK) && + (this->action != KAIZOKU_ACTION_DAMAGED) && (this->action != KAIZOKU_ACTION_KNOCK_DOWN)) { Actor_SetDropFlag(&this->picto.actor, &this->bodyCollider.info); AudioSfx_StopByPosAndId(&this->picto.actor.projectedPos, NA_SE_EN_PIRATE_BREATH); switch (this->picto.actor.colChkInfo.damageEffect) { - case KAIZOKU_DMGEFF_5: + case KAIZOKU_DMGEFF_ZORA_SHIELD: if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || (this->colorFilterTimer == 0)) { @@ -1862,7 +1857,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_MEDIUM; } // fallthrough - case KAIZOKU_DMGEFF_1: + case KAIZOKU_DMGEFF_STUNNED: if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || this->colorFilterTimer == 0) { @@ -1875,28 +1870,28 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { } break; - case KAIZOKU_DMGEFF_F: - if ((this->action != KAIZOKU_ACTION_ROLL_FORWARD) && (this->action != KAIZOKU_ACTION_7) && - (this->action < KAIZOKU_ACTION_14)) { + case KAIZOKU_DMGEFF_IFRAME_PROTECTED: + if ((this->action != KAIZOKU_ACTION_ROLL_FORWARD) && (this->action != KAIZOKU_ACTION_ROLL_BACK) && + (this->action < KAIZOKU_ACTION_DAMAGED)) { wasHit = true; } break; - case KAIZOKU_DMGEFF_E: + case KAIZOKU_DMGEFF_ALWAYS_HIT: wasHit = true; break; case KAIZOKU_DMGEFF_D: - if (this->action == KAIZOKU_ACTION_13) { + if (this->action == KAIZOKU_ACTION_STUNNED) { wasHit = true; - } else if (this->action != KAIZOKU_ACTION_6) { - EnKaizoku_SetupFlip(this); + } else if (this->action != KAIZOKU_ACTION_JUMP) { + EnKaizoku_SetupJump(this); } break; - case KAIZOKU_DMGEFF_2: - if ((this->action != KAIZOKU_ACTION_ROLL_FORWARD) && (this->action != KAIZOKU_ACTION_7) && - (this->action < KAIZOKU_ACTION_14)) { + case KAIZOKU_DMGEFF_FIRE_ARROW: + if ((this->action != KAIZOKU_ACTION_ROLL_FORWARD) && (this->action != KAIZOKU_ACTION_ROLL_BACK) && + (this->action < KAIZOKU_ACTION_DAMAGED)) { this->colorFilterTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; wasHit = true; @@ -1917,14 +1912,14 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { this->drawDmgEffFrozenSteamScale = 1.5f; this->picto.actor.flags &= ~ACTOR_FLAG_400; if (this->picto.actor.colChkInfo.health <= 0) { - func_80B8960C(this, play); + EnKaizoku_SetupDefeatKnockdown(this, play); } else { EnKaizoku_SetupStunned(this); } } break; - case KAIZOKU_DMGEFF_4: + case KAIZOKU_DMGEFF_LIGHT_ARROW: if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || (this->colorFilterTimer == 0)) { @@ -1948,7 +1943,7 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { Actor_SetColorFilter(&this->picto.actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_ApplyDamage(&this->picto.actor); if (this->picto.actor.colChkInfo.health <= 0) { - func_80B8960C(this, play); + EnKaizoku_SetupDefeatKnockdown(this, play); return; } @@ -1964,8 +1959,8 @@ void func_80B89A08(EnKaizoku* this, PlayState* play) { EnKaizoku_SetupDamaged(this, play); } } else if (this->bodyCollider.base.acFlags & AC_HIT) { - if ((this->action != KAIZOKU_ACTION_6) && (this->action != KAIZOKU_ACTION_14) && - (this->action != KAIZOKU_ACTION_15)) { + if ((this->action != KAIZOKU_ACTION_JUMP) && (this->action != KAIZOKU_ACTION_DAMAGED) && + (this->action != KAIZOKU_ACTION_KNOCK_DOWN)) { Vec3f pos; Player* player = GET_PLAYER(play); @@ -2025,7 +2020,7 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { this->actionFunc(this, play); Actor_MoveWithGravity(&this->picto.actor); if (this->action != KAIZOKU_ACTION_HIDDEN) { - func_80B89A08(this, play); + EnKaizoku_UpdateDamage(this, play); } if (this->action != KAIZOKU_ACTION_HIDDEN) { Actor_SetFocus(&this->picto.actor, 60.0f); @@ -2046,10 +2041,10 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { Matrix_RotateYS(this->picto.actor.shape.rot.y + this->unk_2F4, MTXMODE_NEW); Matrix_MultVecZ(this->unk_2F0, &sp34); - this->picto.actor.world.pos.x += this->unk_3C4.x + sp34.x; - this->picto.actor.world.pos.z += this->unk_3C4.z + sp34.z; - Math_ApproachZeroF(&this->unk_3C4.x, 1.0f, 2.0f); - Math_ApproachZeroF(&this->unk_3C4.z, 1.0f, 2.0f); + this->picto.actor.world.pos.x += this->velocity.x + sp34.x; + this->picto.actor.world.pos.z += this->velocity.z + sp34.z; + Math_ApproachZeroF(&this->velocity.x, 1.0f, 2.0f); + Math_ApproachZeroF(&this->velocity.z, 1.0f, 2.0f); Math_ApproachZeroF(&this->unk_2F0, 1.0f, 5.0f); } @@ -2111,7 +2106,7 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVec3f(&sSwordTipOffset, &swordTip); Matrix_MultVec3f(&sSwordHiltOffset, &swordHilt); - if ((this->swordState == 1) && ((this->action == KAIZOKU_ACTION_9) || (this->action == KAIZOKU_ACTION_SPIN_ATTACK))) { + if ((this->swordState == 1) && ((this->action == KAIZOKU_ACTION_SLASH) || (this->action == KAIZOKU_ACTION_SPIN_ATTACK))) { EffectBlure_AddVertex(Effect_GetByIndex(this->blureIndex), &swordTip, &swordHilt); } else if (this->swordState != 0) { EffectBlure_AddSpace(Effect_GetByIndex(this->blureIndex)); diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index ff807e71d8c..c3a5736562a 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -105,7 +105,7 @@ typedef struct EnKaizoku { /* 0x2F8 */ Vec3f swordScaleRight; /* 0x304 */ Vec3f swordScaleLeft; /* 0x310 */ Vec3f bodyPartsPos[KAIZOKU_BODYPART_MAX]; - /* 0x3C4 */ Vec3f unk_3C4; // momentum? + /* 0x3C4 */ Vec3f velocity; /* 0x3D0 */ s32 blureIndex; /* 0x3D4 */ ColliderCylinder bodyCollider; /* 0x420 */ ColliderQuad swordCollider; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 7cd7b8f20ef..16085b9e94a 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -14665,17 +14665,17 @@ 0x80B85FA8:("EnKaizoku_WaitForApproach",), 0x80B86804:("EnKaizoku_SetupLoss",), 0x80B868B8:("EnKaizoku_Loss",), - 0x80B86B58:("EnKaizoku_SetupWin",), - 0x80B86B74:("EnKaizoku_Win",), + 0x80B86B58:("EnKaizoku_SetupWinCutscene",), + 0x80B86B74:("EnKaizoku_WinCutscene",), 0x80B872A4:("EnKaizoku_SetupReady",), 0x80B872F4:("EnKaizoku_Ready",), 0x80B874D8:("EnKaizoku_SetupSpinDodge",), 0x80B8760C:("EnKaizoku_SpinDodge",), 0x80B87900:("EnKaizoku_SetupBlock",), 0x80B8798C:("EnKaizoku_Block",), - 0x80B87C7C:("EnKaizoku_SetupFlip",), + 0x80B87C7C:("EnKaizoku_SetupJump",), 0x80B87CF8:("EnKaizoku_SpawnFootDust",), - 0x80B87D3C:("EnKaizoku_Flip",), + 0x80B87D3C:("EnKaizoku_Jump",), 0x80B87E28:("EnKaizoku_SetupRollBack",), 0x80B87E9C:("EnKaizoku_RollBack",), 0x80B87F70:("EnKaizoku_SetupSlash",), @@ -14694,9 +14694,9 @@ 0x80B89280:("EnKaizoku_Stunned",), 0x80B893CC:("EnKaizoku_SetupDamaged",), 0x80B894C0:("EnKaizoku_Damaged",), - 0x80B8960C:("func_80B8960C",), - 0x80B8971C:("func_80B8971C",), - 0x80B89A08:("func_80B89A08",), + 0x80B8960C:("EnKaizoku_SetupDefeatKnockdown",), + 0x80B8971C:("EnKaizoku_DefeatKnockdown",), + 0x80B89A08:("EnKaizoku_UpdateDamage",), 0x80B8A0A0:("EnKaizoku_Update",), 0x80B8A318:("EnKaizoku_OverrideLimbDraw",), 0x80B8A468:("EnKaizoku_PostLimbDraw",), From f61991043c8352f97383a7713f93910122ce008f Mon Sep 17 00:00:00 2001 From: isghj Date: Sun, 12 Jan 2025 01:27:51 -0800 Subject: [PATCH 11/24] format --- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 138 ++++++++++-------- 1 file changed, 74 insertions(+), 64 deletions(-) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 6a03ba079c1..2e4dd66bddd 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -74,16 +74,16 @@ typedef enum EnKaizokuAction { // text Ids, grouped into two batches of 4, and two mask values static u16 sKaizokuTextIds[] = { - 0x11A4, // (intro.1) halt - 0x11A5, // (intro.2) you must have courage, going to love doing this to you - 0x11A6, // (win) ouch, dont think this is the end - 0x11A7, // (loss) you're nothing to talk about - 0x11A8, // (intro.1) go no further - 0x11A9, // (intro.2) you wont get past here - 0x11AA, // (win) not bad, but this isnt the end - 0x11AB, // (loss) hmph, we're not fools - 0x11AC, // (stone mask) we aren't fooled by that mask - 0x11AD, // (stone mask) did you think that mask would work? + 0x11A4, // (intro.1) halt + 0x11A5, // (intro.2) you must have courage, going to love doing this to you + 0x11A6, // (win) ouch, dont think this is the end + 0x11A7, // (loss) you're nothing to talk about + 0x11A8, // (intro.1) go no further + 0x11A9, // (intro.2) you wont get past here + 0x11AA, // (win) not bad, but this isnt the end + 0x11AB, // (loss) hmph, we're not fools + 0x11AC, // (stone mask) we aren't fooled by that mask + 0x11AD, // (stone mask) did you think that mask would work? }; static Vec3f sCutsceneCameraPositions[] = { @@ -217,25 +217,25 @@ static ColliderQuadInit sQuadInit = { }; static AnimationHeader* sAnimations[KAIZOKU_ANIM_MAX] = { - &gKaizokuFightingIdleAnim, // KAIZOKU_ANIM_FIGHTING_IDLE - &gKaizokuOOTConversationAnim, // KAIZOKU_ANIM_OOT_CONVERSATION - &gKaizokuOOTJumpAnim, // KAIZOKU_ANIM_OOT_JUMP - &gKaizokuSidestepAnim, // KAIZOKU_ANIM_SIDESTEP - &gKaizokuWalkAnim, // KAIZOKU_ANIM_WALK - &gKaizokuDamageAnim, // KAIZOKU_ANIM_DAMAGE - &gKaizokuOOTDefeatAnim, // KAIZOKU_ANIM_OOT_DEFEAT - &gKaizokuBlockAnim, // KAIZOKU_ANIM_BLOCK - &gKaizokuFlipAnim, // KAIZOKU_ANIM_FLIP - &gKaizokuSlashAnim, // KAIZOKU_ANIM_SLASH_ATTCK - &gKaizokuSpinAttackAnim, // KAIZOKU_ANIM_SPIN_ATTACK - &gKaizokuLandAnim, // KAIZOKU_ANIM_LAND - &gKaizokuChallengeTalkAnim, // KAIZOKU_ANIM_CHALLENGE - &gKaizokuUnsheatheAnim, // KAIZOKU_ANIM_UNSHEATHE - &gKaizokuLowerWeaponsAnim, // KAIZOKU_ANIM_LOWER_WEAPONS + &gKaizokuFightingIdleAnim, // KAIZOKU_ANIM_FIGHTING_IDLE + &gKaizokuOOTConversationAnim, // KAIZOKU_ANIM_OOT_CONVERSATION + &gKaizokuOOTJumpAnim, // KAIZOKU_ANIM_OOT_JUMP + &gKaizokuSidestepAnim, // KAIZOKU_ANIM_SIDESTEP + &gKaizokuWalkAnim, // KAIZOKU_ANIM_WALK + &gKaizokuDamageAnim, // KAIZOKU_ANIM_DAMAGE + &gKaizokuOOTDefeatAnim, // KAIZOKU_ANIM_OOT_DEFEAT + &gKaizokuBlockAnim, // KAIZOKU_ANIM_BLOCK + &gKaizokuFlipAnim, // KAIZOKU_ANIM_FLIP + &gKaizokuSlashAnim, // KAIZOKU_ANIM_SLASH_ATTCK + &gKaizokuSpinAttackAnim, // KAIZOKU_ANIM_SPIN_ATTACK + &gKaizokuLandAnim, // KAIZOKU_ANIM_LAND + &gKaizokuChallengeTalkAnim, // KAIZOKU_ANIM_CHALLENGE + &gKaizokuUnsheatheAnim, // KAIZOKU_ANIM_UNSHEATHE + &gKaizokuLowerWeaponsAnim, // KAIZOKU_ANIM_LOWER_WEAPONS &gKaizokuDemonstrativeSwordSwingAnim, // KAIZOKU_ANIM_DEMONSTRATIVE_SWORD_SWING - &gKaizokuDefeatAnim, // KAIZOKU_ANIM_DEFEAT - &gKaizokuDefeatIdleAnim, // KAIZOKU_ANIM_DEFEAT_IDLE - &gKaizokuThrowFlashAnim, // KAIZOKU_ANIM_THROW_FLASH + &gKaizokuDefeatAnim, // KAIZOKU_ANIM_DEFEAT + &gKaizokuDefeatIdleAnim, // KAIZOKU_ANIM_DEFEAT_IDLE + &gKaizokuThrowFlashAnim, // KAIZOKU_ANIM_THROW_FLASH }; static u8 sAnimationModes[KAIZOKU_ANIM_MAX] = { @@ -284,8 +284,8 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { this->colorType = KAIZOKU_GET_TYPE(this); KAIZOKU_GET_TYPE(this) = 0; this->picto.actor.colChkInfo.damageTable = &sDamageTable; - SkelAnime_InitFlex(play, &this->skelAnime, &gKaizokuSkel, &gKaizokuWalkAnim, this->jointTable, - this->morphTable, KAIZOKU_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gKaizokuSkel, &gKaizokuWalkAnim, this->jointTable, this->morphTable, + KAIZOKU_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->bodyCollider, &this->picto.actor, &sCylinderInit); Collider_InitAndSetQuad(play, &this->swordCollider, &this->picto.actor, &sQuadInit); blureInit.p1StartColor[0] = blureInit.p1StartColor[1] = blureInit.p1StartColor[2] = blureInit.p1StartColor[3] = @@ -845,11 +845,11 @@ void EnKaizoku_WinCutscene(EnKaizoku* this, PlayState* play) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_SHOUT); // oddly, instead of just playing the sfx and spawning an effect // they spawn a real nut - dekuNut = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, - this->picto.actor.world.pos.x, this->picto.actor.world.pos.y + 10.0f, this->picto.actor.world.pos.z, - this->picto.actor.shape.rot.x, this->picto.actor.shape.rot.y, this->picto.actor.shape.rot.z, - -ARROW_TYPE_DEKU_NUT); - + dekuNut = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, this->picto.actor.world.pos.x, + this->picto.actor.world.pos.y + 10.0f, this->picto.actor.world.pos.z, + this->picto.actor.shape.rot.x, this->picto.actor.shape.rot.y, + this->picto.actor.shape.rot.z, -ARROW_TYPE_DEKU_NUT); + if (dekuNut != NULL) { dekuNut->gravity = -10.0f; play->envCtx.fillScreen = true; @@ -1095,7 +1095,8 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { this->bodyCollider.base.acFlags &= ~AC_HARD; EnKaizoku_SetupCircle(this); } - } else if ((this->combatTimer == 0) && func_800BE184(play, &this->picto.actor, 100.0f, 10000, 0x4000, this->picto.actor.shape.rot.y)) { + } else if ((this->combatTimer == 0) && + func_800BE184(play, &this->picto.actor, 100.0f, 10000, 0x4000, this->picto.actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { this->bodyCollider.base.acFlags &= ~AC_HARD; EnKaizoku_SetupSpinDodge(this, play); @@ -1130,14 +1131,15 @@ void EnKaizoku_SetupJump(EnKaizoku* this) { } static Color_RGBA8 sKaizokuDustPrimColor = { 200, 160, 120, 255 }; // light brown -static Color_RGBA8 sKaizokuDustEnvColor = { 130, 90, 50, 255 }; // darker brown +static Color_RGBA8 sKaizokuDustEnvColor = { 130, 90, 50, 255 }; // darker brown static Vec3f sKaizokuDustVelocity = { 0.0f, -1.5f, 0.0f }; static Vec3f sKaizokuDustAccel = { 0.0f, -0.2f, 0.0f }; void EnKaizoku_SpawnFootDust(PlayState* play, Vec3f* pos) { // reusing sparkles instead of the actual dust effect? is this left over from OOT? - EffectSsKirakira_SpawnSmall(play, pos, &sKaizokuDustVelocity, &sKaizokuDustAccel, &sKaizokuDustPrimColor, &sKaizokuDustEnvColor); + EffectSsKirakira_SpawnSmall(play, pos, &sKaizokuDustVelocity, &sKaizokuDustAccel, &sKaizokuDustPrimColor, + &sKaizokuDustEnvColor); } void EnKaizoku_Jump(EnKaizoku* this, PlayState* play) { @@ -1333,7 +1335,8 @@ void EnKaizoku_Advance(EnKaizoku* this, PlayState* play) { EnKaizoku_SetupReady(this); } } else if (this->picto.actor.xzDistToPlayer < 90.0f) { - if ((Rand_ZeroOne() > 0.03f) || ((this->picto.actor.xzDistToPlayer <= 65.0f) && (facingAngleToLink < 0x4000))) { + if ((Rand_ZeroOne() > 0.03f) || + ((this->picto.actor.xzDistToPlayer <= 65.0f) && (facingAngleToLink < 0x4000))) { EnKaizoku_SetupSlash(this); } else if (Actor_OtherIsTargeted(play, &this->picto.actor) && (Rand_ZeroOne() > 0.5f)) { EnKaizoku_SetupRollBack(this); @@ -1361,13 +1364,14 @@ void EnKaizoku_Advance(EnKaizoku* this, PlayState* play) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } - if ((this->skelAnime.curFrame != 0.0f) && (((beforeCurFrame < 0) && (afterCurFrame > 0)) || ((beforeCurFrame < 4) && (afterCurFrame >= 5)))) { + if ((this->skelAnime.curFrame != 0.0f) && + (((beforeCurFrame < 0) && (afterCurFrame > 0)) || ((beforeCurFrame < 4) && (afterCurFrame >= 5)))) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_WALK); } } } } - + void EnKaizoku_SetupPivot(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SIDESTEP); this->action = KAIZOKU_ACTION_PIVOT; @@ -1625,7 +1629,8 @@ void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play) { } } - if ((this->iceTimer == 0) && (this->colorFilterTimer == 0) && !CHECK_FLAG_ALL(this->picto.actor.flags, ACTOR_FLAG_2000) && + if ((this->iceTimer == 0) && (this->colorFilterTimer == 0) && + !CHECK_FLAG_ALL(this->picto.actor.flags, ACTOR_FLAG_2000) && (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->dontUpdateSkel = false; EnKaizoku_ReactToPlayer(this, play, true); @@ -1669,8 +1674,8 @@ void EnKaizoku_Damaged(EnKaizoku* this, PlayState* play) { s16 angleToWall; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0x1194, 0); - if (!EnKaizoku_DodgeRanged(this, play) && !EnKaizoku_ReactToPlayer(this, play, false) && (this->velocity.x < 1.0f) && - (this->velocity.z < 1.0f)) { + if (!EnKaizoku_DodgeRanged(this, play) && !EnKaizoku_ReactToPlayer(this, play, false) && + (this->velocity.x < 1.0f) && (this->velocity.z < 1.0f)) { angleToWall = this->picto.actor.wallYaw - this->picto.actor.shape.rot.y; if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) { if (ABS_ALT(angleToWall) < 0x3000 && (this->picto.actor.xzDistToPlayer < 90.0f)) { @@ -1809,7 +1814,8 @@ void EnKaizoku_UpdateDamage(EnKaizoku* this, PlayState* play) { this->actionFunc = EnKaizoku_SetupLoss; } return; - } else if ((this->action == KAIZOKU_ACTION_SPIN_ATTACK) && (this->swordCollider.base.at == &GET_PLAYER(play)->actor)) { + } else if ((this->action == KAIZOKU_ACTION_SPIN_ATTACK) && + (this->swordCollider.base.at == &GET_PLAYER(play)->actor)) { func_800B8D98(play, &this->picto.actor, 3.0f, this->picto.actor.yawTowardsPlayer, 1.0f); Health_ChangeBy(play, -0xC); if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_SCENE_FADE)) { @@ -1844,9 +1850,10 @@ void EnKaizoku_UpdateDamage(EnKaizoku* this, PlayState* play) { EnKaizoku_SetupSlash(this); } - if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action > KAIZOKU_ACTION_HIDDEN) && (this->spinAttackState < 2) && - (this->action != KAIZOKU_ACTION_JUMP) && (this->action != KAIZOKU_ACTION_BLOCK) && - (this->action != KAIZOKU_ACTION_DAMAGED) && (this->action != KAIZOKU_ACTION_KNOCK_DOWN)) { + if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action > KAIZOKU_ACTION_HIDDEN) && + (this->spinAttackState < 2) && (this->action != KAIZOKU_ACTION_JUMP) && + (this->action != KAIZOKU_ACTION_BLOCK) && (this->action != KAIZOKU_ACTION_DAMAGED) && + (this->action != KAIZOKU_ACTION_KNOCK_DOWN)) { Actor_SetDropFlag(&this->picto.actor, &this->bodyCollider.elem); AudioSfx_StopByPosAndId(&this->picto.actor.projectedPos, NA_SE_EN_PIRATE_BREATH); @@ -2004,7 +2011,7 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { EnKaizoku* this = THIS; PlayState* play = play2; - if (! this->dontUpdateSkel) { + if (!this->dontUpdateSkel) { SkelAnime_Update(&this->skelAnime); } @@ -2012,12 +2019,12 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { EnKaizoku_TurnHead(this); } - DECR (this->blinkTimer); - DECR (this->combatTimer); - DECR (this->lookTimer); - DECR (this->iceTimer); - DECR (this->cutsceneTimer); - DECR (this->colorFilterTimer); + DECR(this->blinkTimer); + DECR(this->combatTimer); + DECR(this->lookTimer); + DECR(this->iceTimer); + DECR(this->cutsceneTimer); + DECR(this->colorFilterTimer); this->actionFunc(this, play); Actor_MoveWithGravity(&this->picto.actor); @@ -2079,12 +2086,12 @@ s32 EnKaizoku_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3 rot->y += this->headRot.z; } else if (limbIndex == KAIZOKU_LIMB_HEAD) { gDPPipeSync(POLY_OPA_DISP++); - gDPSetEnvColor(POLY_OPA_DISP++, sKaizokuLipstickColors[this->colorType].r, sKaizokuLipstickColors[this->colorType].g, - sKaizokuLipstickColors[this->colorType].b, 255); + gDPSetEnvColor(POLY_OPA_DISP++, sKaizokuLipstickColors[this->colorType].r, + sKaizokuLipstickColors[this->colorType].g, sKaizokuLipstickColors[this->colorType].b, 255); } else { gDPPipeSync(POLY_OPA_DISP++); - gDPSetEnvColor(POLY_OPA_DISP++, sKaizokuOutfitColors[this->colorType].r, sKaizokuOutfitColors[this->colorType].g, - sKaizokuOutfitColors[this->colorType].b, 255); + gDPSetEnvColor(POLY_OPA_DISP++, sKaizokuOutfitColors[this->colorType].r, + sKaizokuOutfitColors[this->colorType].g, sKaizokuOutfitColors[this->colorType].b, 255); } CLOSE_DISPS(play->state.gfxCtx); @@ -2108,7 +2115,8 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVec3f(&sSwordTipOffset, &swordTip); Matrix_MultVec3f(&sSwordHiltOffset, &swordHilt); - if ((this->swordState == 1) && ((this->action == KAIZOKU_ACTION_SLASH) || (this->action == KAIZOKU_ACTION_SPIN_ATTACK))) { + if ((this->swordState == 1) && + ((this->action == KAIZOKU_ACTION_SLASH) || (this->action == KAIZOKU_ACTION_SPIN_ATTACK))) { EffectBlure_AddVertex(Effect_GetByIndex(this->blureIndex), &swordTip, &swordHilt); } else if (this->swordState != 0) { EffectBlure_AddSpace(Effect_GetByIndex(this->blureIndex)); @@ -2125,10 +2133,12 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Matrix_MultVec3f(&sFootOffset, &this->rightFootPos); } - if ((limbIndex == KAIZOKU_LIMB_TORSO) || (limbIndex == KAIZOKU_LIMB_HEAD) || (limbIndex == KAIZOKU_LIMB_R_UPPER_ARM) || - (limbIndex == KAIZOKU_LIMB_R_FOREARM) || (limbIndex == KAIZOKU_LIMB_R_HAND) || (limbIndex == KAIZOKU_LIMB_L_UPPER_ARM) || - (limbIndex == KAIZOKU_LIMB_L_FOREARM) || (limbIndex == KAIZOKU_LIMB_L_HAND) || (limbIndex == KAIZOKU_LIMB_L_THIGH) || - (limbIndex == KAIZOKU_LIMB_L_SHIN) || (limbIndex == KAIZOKU_LIMB_L_FOOT) || (limbIndex == KAIZOKU_LIMB_R_THIGH) || + if ((limbIndex == KAIZOKU_LIMB_TORSO) || (limbIndex == KAIZOKU_LIMB_HEAD) || + (limbIndex == KAIZOKU_LIMB_R_UPPER_ARM) || (limbIndex == KAIZOKU_LIMB_R_FOREARM) || + (limbIndex == KAIZOKU_LIMB_R_HAND) || (limbIndex == KAIZOKU_LIMB_L_UPPER_ARM) || + (limbIndex == KAIZOKU_LIMB_L_FOREARM) || (limbIndex == KAIZOKU_LIMB_L_HAND) || + (limbIndex == KAIZOKU_LIMB_L_THIGH) || (limbIndex == KAIZOKU_LIMB_L_SHIN) || + (limbIndex == KAIZOKU_LIMB_L_FOOT) || (limbIndex == KAIZOKU_LIMB_R_THIGH) || (limbIndex == KAIZOKU_LIMB_R_SHIN) || (limbIndex == KAIZOKU_LIMB_R_FOOT) || (limbIndex == KAIZOKU_LIMB_WAIST)) { Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); From 3d789b9a258778de559fe17a1b1bbc55e70b6177 Mon Sep 17 00:00:00 2001 From: isghj Date: Sun, 12 Jan 2025 14:39:32 -0800 Subject: [PATCH 12/24] Kaizoku: minor tweaks --- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 28 +++++++++---------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 3 +- tools/disasm/functions.txt | 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index d1db505d462..25e733e167c 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -32,7 +32,7 @@ void EnKaizoku_SpinDodge(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupBlock(EnKaizoku* this); void EnKaizoku_Block(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupJump(EnKaizoku* this); -void EnKaizoku_SpawnFootDust(PlayState* play, Vec3f* pos); +void EnKaizoku_SpawnVerticalFootDust(PlayState* play, Vec3f* pos); void EnKaizoku_Jump(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupRollBack(EnKaizoku* this); void EnKaizoku_RollBack(EnKaizoku* this, PlayState* play); @@ -111,7 +111,6 @@ Color_RGBA8 sKaizokuLipstickColors[] = { }; static Color_RGBA8 sKaizokuOutfitColors[] = { - { 255, 130, 10, 255 }, // orange { 185, 130, 210, 255 }, // lavender { 135, 195, 80, 255 }, // pale green @@ -275,14 +274,16 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { this->exitIndex = KAIZOKU_GET_EXIT_INDEX(&this->picto.actor); this->switchFlag = KAIZOKU_GET_SWITCH_FLAG(&this->picto.actor); + // There are three spawns (0,1,2) + // they decided to re-align 2 into 0 instead of making a third text combination if (this->textType >= 2) { this->textType = 0; - } else if (this->textType == 2) { // @Bug: '2' also matches '>= 2' + } else if (this->textType == 2) { // @Bug: '== 2' also matches '>= 2' this->textType = 0; } this->colorType = KAIZOKU_GET_TYPE(this); - KAIZOKU_GET_TYPE(this) = 0; + KAIZOKU_GET_TYPE(this) = 0; // clear param, which was rot.z, resets skew this->picto.actor.colChkInfo.damageTable = &sDamageTable; SkelAnime_InitFlex(play, &this->skelAnime, &gKaizokuSkel, &gKaizokuWalkAnim, this->jointTable, this->morphTable, KAIZOKU_LIMB_MAX); @@ -485,7 +486,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { s32 nextTextId; switch (this->cutsceneState) { - case 0: // waiting + case 0: // waiting for proximity if (!(this->picto.actor.xzDistToPlayer < 200.0f)) { break; } @@ -525,7 +526,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { Audio_SetMainBgmVolume(0, 0xA); this->cutsceneState++; FALLTHROUGH; - case 1: // try message lock to player + case 1: // waiting for (intro1) text advance player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; @@ -547,7 +548,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } break; - case 2: // waiting for landing + case 2: // waiting for fall to land if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { if (this->dontUpdateSkel != false) { this->dontUpdateSkel = false; @@ -613,8 +614,8 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { Math_ApproachF(&this->subCamVelocity, 5.0f, 0.3f, 1.0f); if (curFrame >= this->animEndFrame) { this->cutsceneTimer = 7; - this->swordScaleRight.x = 1.0f; this->cutsceneState++; + this->swordScaleRight.x = 1.0f; this->swordScaleRight.y = 1.0f; this->swordScaleRight.z = 1.0f; this->swordScaleLeft.x = 1.0f; @@ -623,7 +624,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } break; - case 7: // wait for cutscene timer, then finish + case 7: // wait for cutscene timer, then start fight if (this->cutsceneTimer == 0) { Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csId); @@ -1116,7 +1117,6 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { } } -// this might be JUMP not flip void EnKaizoku_SetupJump(EnKaizoku* this) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FLIP); this->picto.actor.speed = 6.5f; @@ -1136,8 +1136,8 @@ static Color_RGBA8 sKaizokuDustEnvColor = { 130, 90, 50, 255 }; // darker bro static Vec3f sKaizokuDustVelocity = { 0.0f, -1.5f, 0.0f }; static Vec3f sKaizokuDustAccel = { 0.0f, -0.2f, 0.0f }; -void EnKaizoku_SpawnFootDust(PlayState* play, Vec3f* pos) { - // reusing sparkles instead of the actual dust effect? is this left over from OOT? +// Used for backflip +void EnKaizoku_SpawnVerticalFootDust(PlayState* play, Vec3f* pos) { EffectSsKirakira_SpawnSmall(play, pos, &sKaizokuDustVelocity, &sKaizokuDustAccel, &sKaizokuDustPrimColor, &sKaizokuDustEnvColor); } @@ -1147,8 +1147,8 @@ void EnKaizoku_Jump(EnKaizoku* this, PlayState* play) { Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); if (this->picto.actor.velocity.y >= 5.0f) { - EnKaizoku_SpawnFootDust(play, &this->leftFootPos); - EnKaizoku_SpawnFootDust(play, &this->rightFootPos); + EnKaizoku_SpawnVerticalFootDust(play, &this->leftFootPos); + EnKaizoku_SpawnVerticalFootDust(play, &this->rightFootPos); } this->dontUpdateSkel = false; diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index 8e22c3194a2..67204c35f9f 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -41,7 +41,7 @@ typedef enum EnKaizokuAnimation { /* 19 */ KAIZOKU_ANIM_MAX } EnKaizokuAnimation; -// this predates actor object xml enums right? +// this is a different size than limb enum in object..? typedef enum EnKaizokuBodyPart { /* 0 */ KAIZOKU_BODYPART_0, /* 1 */ KAIZOKU_BODYPART_1, @@ -68,7 +68,6 @@ typedef enum KaizokuTextOffset{ /* 3 */ KAIZOKU_COVERSATION_LOSS // after defeating player } KaizokuTextOffset; - typedef struct EnKaizoku { /* 0x000 */ PictoActor picto; /* 0x148 */ SkelAnime skelAnime; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 5f1b4700295..46c99c20257 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -14674,7 +14674,7 @@ 0x80B87900:("EnKaizoku_SetupBlock",), 0x80B8798C:("EnKaizoku_Block",), 0x80B87C7C:("EnKaizoku_SetupJump",), - 0x80B87CF8:("EnKaizoku_SpawnFootDust",), + 0x80B87CF8:("EnKaizoku_SpawnVerticalFootDust",), 0x80B87D3C:("EnKaizoku_Jump",), 0x80B87E28:("EnKaizoku_SetupRollBack",), 0x80B87E9C:("EnKaizoku_RollBack",), From e466f18e4a738320cdf21fdcb77d2231e153c9d4 Mon Sep 17 00:00:00 2001 From: isghj Date: Mon, 13 Jan 2025 10:26:44 -0800 Subject: [PATCH 13/24] Kaizoku: Anghelos requested changes pass1 --- assets/xml/objects/object_kz.xml | 42 +++++++++---------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 24 +++++------ .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 8 +--- src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c | 4 +- 4 files changed, 37 insertions(+), 41 deletions(-) diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index 5631322b74b..d5efe07f3e3 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -14,7 +14,7 @@ - + @@ -26,18 +26,18 @@ - - - - - - - - - - + + + + + + + + + + - + @@ -54,15 +54,15 @@ - - - - - - - - - + + + + + + + + + diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 25e733e167c..3071e62b983 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -357,7 +357,7 @@ s32 EnKaizoku_DodgeRanged(EnKaizoku* this, PlayState* play) { void EnKaizoku_TurnHead(EnKaizoku* this) { if (this->action == KAIZOKU_ACTION_READY) { - this->headRot.y = Math_SinS(this->lookTimer * 0x1068) * 0x22D8; + this->headRot.y = Math_SinS(this->lookTimer * 4200) * 8920; } else if (this->action != KAIZOKU_ACTION_STUNNED) { if ((this->action == KAIZOKU_ACTION_SLASH) || (this->action == KAIZOKU_ACTION_SPIN_ATTACK)) { Math_SmoothStepToS(&this->headRot.y, this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y, 1, @@ -444,7 +444,7 @@ s32 EnKaizoku_ReactToPlayer(EnKaizoku* this, PlayState* play, s16 arg2) { (ABS_ALT(angleToFacingLink) < 0x5000)) { if (this->action != KAIZOKU_ACTION_SLASH) { EnKaizoku_SetupSlash(this); - return 1; + return true; } } else if (this->action != KAIZOKU_ACTION_SIDESTEP) { EnKaizoku_SetupCircle(this); @@ -840,7 +840,7 @@ void EnKaizoku_WinCutscene(EnKaizoku* this, PlayState* play) { this->swordScaleRight.z = this->swordScaleRight.y = this->swordScaleRight.x; this->swordScaleLeft.z = this->swordScaleLeft.y = this->swordScaleLeft.x; } - if (this->flashTimer == 0x12) { + if (this->flashTimer == 18) { Actor* dekuNut; Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_SHOUT); @@ -857,7 +857,7 @@ void EnKaizoku_WinCutscene(EnKaizoku* this, PlayState* play) { } } - if (this->flashTimer >= 0x12) { + if (this->flashTimer >= 18) { Math_ApproachF(&this->flashScreenAlphaTarget, 60.0f, 1.0f, 20.0f); this->flashScreenAlpha = this->flashScreenAlphaTarget / 60.0f; play->envCtx.screenFillColor[3] = this->flashScreenAlpha * 255.0f; @@ -865,7 +865,7 @@ void EnKaizoku_WinCutscene(EnKaizoku* this, PlayState* play) { 255; } - if ((curFrame >= this->animEndFrame) && (this->flashTimer >= 0x28)) { + if ((curFrame >= this->animEndFrame) && (this->flashTimer >= 40)) { this->picto.actor.draw = NULL; this->cutsceneTimer = 10; Math_Vec3f_Copy(&this->swordScaleRight, &gZeroVec3f); @@ -1076,7 +1076,7 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { this->bodyCollider.base.acFlags &= ~AC_HARD; EnKaizoku_SetupSpinDodge(this, play); - } else if (!(play->gameplayFrames & 1)) { + } else if (!(play->gameplayFrames % 2)) { EnKaizoku_SetupBlock(this); } else { this->bodyCollider.base.acFlags &= ~AC_HARD; @@ -2045,16 +2045,16 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { } if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - Vec3f sp34; + Vec3f bounceVelocity; s32 pad; - Matrix_RotateYS(this->picto.actor.shape.rot.y + this->unk_2F4, MTXMODE_NEW); - Matrix_MultVecZ(this->unk_2F0, &sp34); - this->picto.actor.world.pos.x += this->velocity.x + sp34.x; - this->picto.actor.world.pos.z += this->velocity.z + sp34.z; + Matrix_RotateYS(this->picto.actor.shape.rot.y + this->boyoBounceAngle, MTXMODE_NEW); + Matrix_MultVecZ(this->boyoBounceVelocity, &bounceVelocity); + this->picto.actor.world.pos.x += this->velocity.x + bounceVelocity.x; + this->picto.actor.world.pos.z += this->velocity.z + bounceVelocity.z; Math_ApproachZeroF(&this->velocity.x, 1.0f, 2.0f); Math_ApproachZeroF(&this->velocity.z, 1.0f, 2.0f); - Math_ApproachZeroF(&this->unk_2F0, 1.0f, 5.0f); + Math_ApproachZeroF(&this->boyoBounceVelocity, 1.0f, 5.0f); } Actor_UpdateBgCheckInfo(play, &this->picto.actor, 35.0f, 40.0f, 35.0f, diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index 67204c35f9f..de141230d82 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -17,7 +17,6 @@ typedef void (*EnKaizokuActionFunc)(struct EnKaizoku*, PlayState*); #define KAIZOKU_SWITCH_FLAG_NONE 0x7F -// todo name these typedef enum EnKaizokuAnimation { /* 0 */ KAIZOKU_ANIM_FIGHTING_IDLE, /* 1 */ KAIZOKU_ANIM_OOT_CONVERSATION, // giving player membership card? @@ -41,7 +40,6 @@ typedef enum EnKaizokuAnimation { /* 19 */ KAIZOKU_ANIM_MAX } EnKaizokuAnimation; -// this is a different size than limb enum in object..? typedef enum EnKaizokuBodyPart { /* 0 */ KAIZOKU_BODYPART_0, /* 1 */ KAIZOKU_BODYPART_1, @@ -81,7 +79,6 @@ typedef struct EnKaizoku { /* 0x2B8 */ s16 colorFilterTimer; // name taken from oot, damaged flashing red /* 0x2BA */ s16 drawDmgEffType; /* 0x2BC */ s16 switchFlag; - /* 0x2BE */ s16 unused2BE; /* 0x2C0 */ f32 drawDmgEffScale; /* 0x2C4 */ f32 drawDmgEffFrozenSteamScale; /* 0x2C8 */ s16 textidOffset; // which of the 4 text states during interaction @@ -99,8 +96,8 @@ typedef struct EnKaizoku { /* 0x2E4 */ EnKaizokuAnimation animIndex; /* 0x2E8 */ s32 bodyPartIndex; /* 0x2EC */ s32 colorType; - /* 0x2F0 */ f32 unk_2F0; // modfified in Update, but not read/used? - /* 0x2F4 */ s16 unk_2F4; // read but never set? + /* 0x2F0 */ f32 boyoBounceVelocity; + /* 0x2F4 */ s16 boyoBounceAngle; /* 0x2F8 */ Vec3f swordScaleRight; /* 0x304 */ Vec3f swordScaleLeft; /* 0x310 */ Vec3f bodyPartsPos[KAIZOKU_BODYPART_MAX]; @@ -117,7 +114,6 @@ typedef struct EnKaizoku { /* 0x59C */ s16 cutsceneState; /* 0x59E */ s16 subCamId; /* 0x5A0 */ s16 flashTimer; - /* 0x5A2 */ s16 unused5A2; /* 0x5A4 */ Vec3f subCamEye; /* 0x5B0 */ Vec3f subCamAt; /* 0x5BC */ Vec3f subCamUp; diff --git a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c index 039e618f4a2..ae77d36db55 100644 --- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c +++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c @@ -100,8 +100,8 @@ void ObjBoyo_PushPlayer(ObjBoyo* this, Actor* actor) { void ObjBoyo_PushPirate(ObjBoyo* this, Actor* actor) { EnKaizoku* kaizoku = (EnKaizoku*)actor; - kaizoku->unk_2F0 = 30.0f; - kaizoku->unk_2F4 = Actor_WorldYawTowardActor(&this->actor, &kaizoku->picto.actor); + kaizoku->boyoBounceVelocity = 30.0f; + kaizoku->boyoBounceAngle = Actor_WorldYawTowardActor(&this->actor, &kaizoku->picto.actor); } void ObjBoyo_ExplodeBomb(ObjBoyo* this, Actor* actor) { From 94753855d9ef2a669f2a58f19e2dfcc1e87a0b40 Mon Sep 17 00:00:00 2001 From: isghj Date: Tue, 14 Jan 2025 12:33:58 -0800 Subject: [PATCH 14/24] Kaizoku: minor docs --- assets/xml/objects/object_kz.xml | 9 +++++---- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 20 +++++++++---------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 6 +++--- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index d5efe07f3e3..c176321dc55 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -5,7 +5,8 @@ - + + @@ -92,11 +93,11 @@ - - + + - + diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 3071e62b983..adc08f01ade 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -123,7 +123,7 @@ typedef enum EnKaizokuDamageEffect { /* 0x3 */ KAIZOKU_DMGEFF_FREEZE, /* 0x4 */ KAIZOKU_DMGEFF_LIGHT_ARROW, /* 0x5 */ KAIZOKU_DMGEFF_ZORA_SHIELD, - /* 0xD */ KAIZOKU_DMGEFF_D = 0xD, // smashed? it checks stun first? + /* 0xD */ KAIZOKU_DMGEFF_STUNNED_ONLY = 0xD, // smashed? it checks stun first? /* 0xE */ KAIZOKU_DMGEFF_ALWAYS_HIT, /* 0xF */ KAIZOKU_DMGEFF_IFRAME_PROTECTED // can only hit while kaizoku has no iframe from rolling } EnKaizokuDamageEffect; @@ -139,7 +139,7 @@ static DamageTable sDamageTable = { /* Hookshot */ DMG_ENTRY(0, KAIZOKU_DMGEFF_STUNNED), /* Goron punch */ DMG_ENTRY(1, KAIZOKU_DMGEFF_ALWAYS_HIT), /* Sword */ DMG_ENTRY(1, KAIZOKU_DMGEFF_ALWAYS_HIT), - /* Goron pound */ DMG_ENTRY(0, KAIZOKU_DMGEFF_D), + /* Goron pound */ DMG_ENTRY(0, KAIZOKU_DMGEFF_STUNNED_ONLY), /* Fire arrow */ DMG_ENTRY(2, KAIZOKU_DMGEFF_FIRE_ARROW), /* Ice arrow */ DMG_ENTRY(2, KAIZOKU_DMGEFF_FREEZE), /* Light arrow */ DMG_ENTRY(2, KAIZOKU_DMGEFF_LIGHT_ARROW), @@ -153,7 +153,7 @@ static DamageTable sDamageTable = { /* Light ray */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), /* Thrown object */ DMG_ENTRY(1, KAIZOKU_DMGEFF_ALWAYS_HIT), /* Zora punch */ DMG_ENTRY(1, KAIZOKU_DMGEFF_ALWAYS_HIT), - /* Spin attack */ DMG_ENTRY(1, KAIZOKU_DMGEFF_D), + /* Spin attack */ DMG_ENTRY(1, KAIZOKU_DMGEFF_STUNNED_ONLY), /* Sword beam */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), /* Normal Roll */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), /* UNK_DMG_0x1B */ DMG_ENTRY(0, KAIZOKU_DMGEFF_NONE), @@ -217,12 +217,12 @@ static ColliderQuadInit sQuadInit = { static AnimationHeader* sAnimations[KAIZOKU_ANIM_MAX] = { &gKaizokuFightingIdleAnim, // KAIZOKU_ANIM_FIGHTING_IDLE - &gKaizokuOOTConversationAnim, // KAIZOKU_ANIM_OOT_CONVERSATION - &gKaizokuOOTJumpAnim, // KAIZOKU_ANIM_OOT_JUMP + &gKaizokuUnusedConversationAnim, // KAIZOKU_ANIM_UNUSED_CONVERSATION + &gKaizokuUnusedJumpAnim, // KAIZOKU_ANIM_UNUSED_JUMP &gKaizokuSidestepAnim, // KAIZOKU_ANIM_SIDESTEP &gKaizokuWalkAnim, // KAIZOKU_ANIM_WALK &gKaizokuDamageAnim, // KAIZOKU_ANIM_DAMAGE - &gKaizokuOOTDefeatAnim, // KAIZOKU_ANIM_OOT_DEFEAT + &gKaizokuUnusedDefeatAnim, // KAIZOKU_ANIM_UNUSED_DEFEAT &gKaizokuBlockAnim, // KAIZOKU_ANIM_BLOCK &gKaizokuFlipAnim, // KAIZOKU_ANIM_FLIP &gKaizokuSlashAnim, // KAIZOKU_ANIM_SLASH_ATTCK @@ -239,12 +239,12 @@ static AnimationHeader* sAnimations[KAIZOKU_ANIM_MAX] = { static u8 sAnimationModes[KAIZOKU_ANIM_MAX] = { ANIMMODE_LOOP, // KAIZOKU_ANIM_FIGHTING_IDLE - ANIMMODE_LOOP, // KAIZOKU_ANIM_OOT_CONVERSATION - ANIMMODE_ONCE, // KAIZOKU_ANIM_OOT_JUMP + ANIMMODE_LOOP, // KAIZOKU_ANIM_UNUSED_CONVERSATION + ANIMMODE_ONCE, // KAIZOKU_ANIM_UNUSED_JUMP ANIMMODE_LOOP, // KAIZOKU_ANIM_SIDESTEP ANIMMODE_LOOP, // KAIZOKU_ANIM_WALK ANIMMODE_ONCE, // KAIZOKU_ANIM_DAMAGE - ANIMMODE_ONCE, // KAIZOKU_ANIM_OOT_DEFEAT + ANIMMODE_ONCE, // KAIZOKU_ANIM_UNUSED_DEFEAT ANIMMODE_ONCE, // KAIZOKU_ANIM_BLOCK ANIMMODE_ONCE, // KAIZOKU_ANIM_FLIP ANIMMODE_ONCE, // KAIZOKU_ANIM_SLASH_ATTCK @@ -1890,7 +1890,7 @@ void EnKaizoku_UpdateDamage(EnKaizoku* this, PlayState* play) { wasHit = true; break; - case KAIZOKU_DMGEFF_D: + case KAIZOKU_DMGEFF_STUNNED_ONLY: if (this->action == KAIZOKU_ACTION_STUNNED) { wasHit = true; } else if (this->action != KAIZOKU_ACTION_JUMP) { diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index de141230d82..df046ed3e3c 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -19,12 +19,12 @@ typedef void (*EnKaizokuActionFunc)(struct EnKaizoku*, PlayState*); typedef enum EnKaizokuAnimation { /* 0 */ KAIZOKU_ANIM_FIGHTING_IDLE, - /* 1 */ KAIZOKU_ANIM_OOT_CONVERSATION, // giving player membership card? - /* 2 */ KAIZOKU_ANIM_OOT_JUMP, // replaced with _LAND + /* 1 */ KAIZOKU_ANIM_UNUSED_CONVERSATION, // from OOT: giving player membership card? + /* 2 */ KAIZOKU_ANIM_UNUSED_JUMP, // from OOT: replaced with _LAND /* 3 */ KAIZOKU_ANIM_SIDESTEP, /* 4 */ KAIZOKU_ANIM_WALK, /* 5 */ KAIZOKU_ANIM_DAMAGE, - /* 6 */ KAIZOKU_ANIM_OOT_DEFEAT, // replaced with _DEFEAT + /* 6 */ KAIZOKU_ANIM_UNUSED_DEFEAT, // from OOT: replaced with _DEFEAT /* 7 */ KAIZOKU_ANIM_BLOCK, /* 8 */ KAIZOKU_ANIM_FLIP, /* 9 */ KAIZOKU_ANIM_SLASH_ATTCK, From 2b4ebed6e734b2c379e60fa7a91cb3e7f8ad1476 Mon Sep 17 00:00:00 2001 From: isghj Date: Wed, 15 Jan 2025 00:56:20 -0800 Subject: [PATCH 15/24] Kaizoku: get'n't --- src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index adc08f01ade..0c0383d051f 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -283,7 +283,7 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { } this->colorType = KAIZOKU_GET_TYPE(this); - KAIZOKU_GET_TYPE(this) = 0; // clear param, which was rot.z, resets skew + this->picto.actor.rot.z = 0; // clear TYPE param, which was rot.z, as we dont want skew this->picto.actor.colChkInfo.damageTable = &sDamageTable; SkelAnime_InitFlex(play, &this->skelAnime, &gKaizokuSkel, &gKaizokuWalkAnim, this->jointTable, this->morphTable, KAIZOKU_LIMB_MAX); From f997c1945247867c72f195d9ae7fcfd8f2597bf5 Mon Sep 17 00:00:00 2001 From: isghj Date: Wed, 15 Jan 2025 17:02:03 -0800 Subject: [PATCH 16/24] Kaizoku: format --- src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 0c0383d051f..f652cb8657e 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -283,7 +283,7 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { } this->colorType = KAIZOKU_GET_TYPE(this); - this->picto.actor.rot.z = 0; // clear TYPE param, which was rot.z, as we dont want skew + this->picto.actor.world.rot.z = 0; // clear TYPE param, which was rot.z, as we dont want skew this->picto.actor.colChkInfo.damageTable = &sDamageTable; SkelAnime_InitFlex(play, &this->skelAnime, &gKaizokuSkel, &gKaizokuWalkAnim, this->jointTable, this->morphTable, KAIZOKU_LIMB_MAX); From 962f79f11b4321f408b824465f9c8194aa3f08d3 Mon Sep 17 00:00:00 2001 From: Isghj <42048411+isghj5@users.noreply.github.com> Date: Sat, 25 Jan 2025 11:07:15 -0800 Subject: [PATCH 17/24] Apply suggestions from code review Co-authored-by: Derek Hensley --- src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c | 8 ++++---- src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index f652cb8657e..ed082c44230 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -278,7 +278,7 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { // they decided to re-align 2 into 0 instead of making a third text combination if (this->textType >= 2) { this->textType = 0; - } else if (this->textType == 2) { // @Bug: '== 2' also matches '>= 2' + } else if (this->textType == 2) { //! @Bug: '== 2' also matches '>= 2' this->textType = 0; } @@ -372,7 +372,7 @@ void EnKaizoku_TurnHead(EnKaizoku* this) { s32 EnKaizoku_ReactToPlayer(EnKaizoku* this, PlayState* play, s16 arg2) { Player* player = GET_PLAYER(play); s16 angleToWall = ABS_ALT(this->picto.actor.wallYaw - this->picto.actor.shape.rot.y); - s16 angleToLink = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); + s16 angleToPlayer = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); Actor* explosiveActor; if (func_800BE184(play, &this->picto.actor, 100.0f, 0x2710, 0x4000, this->picto.actor.shape.rot.y)) { @@ -550,7 +550,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { case 2: // waiting for fall to land if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - if (this->dontUpdateSkel != false) { + if (this->dontUpdateSkel) { this->dontUpdateSkel = false; this->picto.actor.world.pos.y = this->picto.actor.floorHeight; this->picto.actor.velocity.y = 0.0f; @@ -1076,7 +1076,7 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { this->bodyCollider.base.acFlags &= ~AC_HARD; EnKaizoku_SetupSpinDodge(this, play); - } else if (!(play->gameplayFrames % 2)) { + } else if ((play->gameplayFrames % 2) == 0) { EnKaizoku_SetupBlock(this); } else { this->bodyCollider.base.acFlags &= ~AC_HARD; diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index df046ed3e3c..3cd252f5bb8 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -59,7 +59,7 @@ typedef enum EnKaizokuBodyPart { /* 15 */ KAIZOKU_BODYPART_MAX } EnKaizokuBodyPart; -typedef enum KaizokuTextOffset{ +typedef enum KaizokuTextOffset { /* 0 */ KAIZOKU_COVERSATION_INTRO_1, // shout before landing /* 1 */ KAIZOKU_COVERSATION_INTRO_2, // after landing /* 2 */ KAIZOKU_COVERSATION_WIN, // after losing to player @@ -81,7 +81,7 @@ typedef struct EnKaizoku { /* 0x2BC */ s16 switchFlag; /* 0x2C0 */ f32 drawDmgEffScale; /* 0x2C4 */ f32 drawDmgEffFrozenSteamScale; - /* 0x2C8 */ s16 textidOffset; // which of the 4 text states during interaction + /* 0x2C8 */ s16 textIdOffset; // which of the 4 text states during interaction /* 0x2CA */ s16 textType; /* 0x2CC */ s16 eyeIndex; /* 0x2CE */ s16 blinkTimer; From 22c569a787f9a333571dcf0e86b41d46e5dddbbc Mon Sep 17 00:00:00 2001 From: isghj Date: Sat, 25 Jan 2025 11:09:13 -0800 Subject: [PATCH 18/24] Kaizoku: back to OK --- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index ed082c44230..ab3d9edff83 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -435,7 +435,7 @@ s32 EnKaizoku_ReactToPlayer(EnKaizoku* this, PlayState* play, s16 arg2) { //! FAKE: label:; - if (angleToLink >= 10000) { + if (angleToPlayer >= 10000) { // in OOT this was sidestep instead of block EnKaizoku_SetupBlock(this); } else { @@ -501,7 +501,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; - nextTextId = (this->textType * 4) + this->textidOffset; + nextTextId = (this->textType * 4) + this->textIdOffset; if (this->colorType != 2) { player->actor.world.pos.x = this->picto.actor.home.pos.x + 90.0f; player->actor.world.pos.z = this->picto.actor.home.pos.z + 30.0f; @@ -514,7 +514,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { this->picto.actor.world.pos.x = this->picto.actor.home.pos.x; this->picto.actor.world.pos.z = this->picto.actor.home.pos.z; Message_StartTextbox(play, sKaizokuTextIds[nextTextId], &this->picto.actor); - this->textidOffset++; // KAIZOKU_COVERSATION_INTRO_2 + this->textIdOffset++; // KAIZOKU_COVERSATION_INTRO_2 this->picto.actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); @@ -570,7 +570,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { case 3: // talking after landing if (curFrame >= this->animEndFrame) { - nextTextId = this->textType * 4 + this->textidOffset; + nextTextId = this->textType * 4 + this->textIdOffset; if (Player_GetMask(play) == PLAYER_MASK_STONE) { // adjust textIds to mention the mask if (sKaizokuTextIds[nextTextId] == 0x11A5) { @@ -582,7 +582,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { Message_StartTextbox(play, sKaizokuTextIds[nextTextId], &this->picto.actor); EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_CHALLENGE); - this->textidOffset++; // KAIZOKU_COVERSATION_INTRO_WIN, although that gets set directly later + this->textIdOffset++; // KAIZOKU_COVERSATION_INTRO_WIN, although that gets set directly later this->cutsceneTimer = 0; this->cutsceneState++; } @@ -720,7 +720,7 @@ void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { case 0: // waiting for animation to change if (curFrame >= this->animEndFrame) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_LOWER_WEAPONS); - this->textidOffset = KAIZOKU_COVERSATION_LOSS; + this->textIdOffset = KAIZOKU_COVERSATION_LOSS; this->cutsceneTimer = 0; this->cutsceneState++; } @@ -731,7 +731,7 @@ void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { s32 textId; EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DEMONSTRATIVE_SWORD_SWING); - textId = this->textType * 4 + this->textidOffset; + textId = this->textType * 4 + this->textIdOffset; Message_StartTextbox(play, sKaizokuTextIds[textId], &this->picto.actor); Actor_PlaySfx(&this->picto.actor, NA_SE_EN_LAST2_SHOUT); this->cutsceneTimer = 0; @@ -797,8 +797,8 @@ void EnKaizoku_WinCutscene(EnKaizoku* this, PlayState* play) { switch (this->cutsceneState) { case 0: // start: change animation and start talking EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DEFEAT_IDLE); - this->textidOffset = KAIZOKU_COVERSATION_WIN; - textId = this->textType * 4 + this->textidOffset; + this->textIdOffset = KAIZOKU_COVERSATION_WIN; + textId = this->textType * 4 + this->textIdOffset; Message_StartTextbox(play, sKaizokuTextIds[textId], &this->picto.actor); this->defeatBreathingStarted = false; this->cutsceneTimer = 0; @@ -929,16 +929,16 @@ void EnKaizoku_Ready(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); if ((this->lookTimer == 0) && !EnKaizoku_DodgeRanged(this, play) && !EnKaizoku_ReactToPlayer(this, play, false)) { - s16 angleToLink = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; + s16 angleToPlayer = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; if ((this->picto.actor.xzDistToPlayer < 100.0f) && (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) && - (angleToLink >= 0x1F40)) { + (angleToPlayer >= 0x1F40)) { this->picto.actor.shape.rot.y = this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; EnKaizoku_SetupCircle(this); } else if (Actor_IsFacingPlayer(&this->picto.actor, 0xBB8)) { if ((this->picto.actor.xzDistToPlayer < 400.0f) && (this->picto.actor.xzDistToPlayer > 150.0f) && (Rand_ZeroOne() < 0.7f)) { - if ((Rand_ZeroOne() > 0.5f) || (ABS_ALT(angleToLink) < 0x3000)) { + if ((Rand_ZeroOne() > 0.5f) || (ABS_ALT(angleToPlayer) < 0x3000)) { EnKaizoku_SetupRollForward(this); } else { EnKaizoku_SetupSpinAttack(this); @@ -1061,7 +1061,7 @@ void EnKaizoku_SetupBlock(EnKaizoku* this) { void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); - s16 angleToLink; + s16 angleToPlayer; this->dontUpdateSkel = true; if (this->combatTimer == 0) { @@ -1069,8 +1069,8 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { } if (this->lookTimer == 0) { this->dontUpdateSkel = false; - angleToLink = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; - if ((ABS_ALT(angleToLink) <= 0x4000) && (this->picto.actor.xzDistToPlayer < 40.0f) && + angleToPlayer = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; + if ((ABS_ALT(angleToPlayer) <= 0x4000) && (this->picto.actor.xzDistToPlayer < 40.0f) && (fabsf(this->picto.actor.playerHeightRel) < 50.0f)) { if (func_800BE184(play, &this->picto.actor, 100.0f, 10000, 0x4000, this->picto.actor.shape.rot.y)) { if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) { @@ -1083,8 +1083,8 @@ void EnKaizoku_Block(EnKaizoku* this, PlayState* play) { EnKaizoku_SetupRollBack(this); } } else { - angleToLink = player->actor.shape.rot.y - this->picto.actor.shape.rot.y; - if (ABS_ALT(angleToLink) < 0x4000) { + angleToPlayer = player->actor.shape.rot.y - this->picto.actor.shape.rot.y; + if (ABS_ALT(angleToPlayer) < 0x4000) { this->bodyCollider.base.acFlags &= ~AC_HARD; EnKaizoku_SetupSlash(this); } else { @@ -1379,15 +1379,15 @@ void EnKaizoku_SetupPivot(EnKaizoku* this) { } void EnKaizoku_Pivot(EnKaizoku* this, PlayState* play) { - s16 angleToLink; + s16 angleToPlayer; s16 turnRate; if (!EnKaizoku_DodgeRanged(this, play) && !EnKaizoku_ReactToPlayer(this, play, false)) { - angleToLink = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; - if (angleToLink > 0) { - turnRate = TRUNCF_BINANG(angleToLink * 0.25f) + 0x7D0; + angleToPlayer = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; + if (angleToPlayer > 0) { + turnRate = TRUNCF_BINANG(angleToPlayer * 0.25f) + 0x7D0; } else { - turnRate = TRUNCF_BINANG(angleToLink * 0.25f) - 0x7D0; + turnRate = TRUNCF_BINANG(angleToPlayer * 0.25f) - 0x7D0; } this->picto.actor.shape.rot.y += turnRate; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; @@ -1419,7 +1419,7 @@ void EnKaizoku_SpinAttack(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; s16 angleFacingLink; - s16 angleToLink; + s16 angleToPlayer; s32 pad; if (this->spinAttackState < 2) { @@ -1474,8 +1474,8 @@ void EnKaizoku_SpinAttack(EnKaizoku* this, PlayState* play) { angleFacingLink = ABS_ALT(player->actor.shape.rot.y - this->picto.actor.shape.rot.y); if (angleFacingLink <= 0x2710) { - angleToLink = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); - if (angleToLink > 0x4000) { + angleToPlayer = ABS_ALT(this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y); + if (angleToPlayer > 0x4000) { this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer; EnKaizoku_SetupCircle(this); } else { From 04a667c1c9e288ee28f38a009d9aaac7c8ccc31f Mon Sep 17 00:00:00 2001 From: isghj Date: Sat, 25 Jan 2025 11:25:15 -0800 Subject: [PATCH 19/24] Kaizoku: more requested changes --- assets/xml/objects/object_kz.xml | 22 +++++++-------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 28 +++++++++---------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 2 +- tools/disasm/functions.txt | 8 +++--- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index c176321dc55..ef799d18cbf 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -15,13 +15,13 @@ - + - - + + - + @@ -38,22 +38,22 @@ - + - + - - + + - + - + - + diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index ab3d9edff83..40239c476a5 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -22,9 +22,9 @@ void EnKaizoku_Draw(Actor* thisx, PlayState* play); s32 EnKaizoku_ValidatePictograph(PlayState* play, Actor* actor); void EnKaizoku_SetupWaitForApproach(EnKaizoku* this); void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play); -void EnKaizoku_Loss(EnKaizoku* this, PlayState* play); -void EnKaizoku_SetupWinCutscene(EnKaizoku* this); -void EnKaizoku_WinCutscene(EnKaizoku* this, PlayState* play); +void EnKaizoku_PlayerLoss(EnKaizoku* this, PlayState* play); +void EnKaizoku_SetupPlayerWinCutscene(EnKaizoku* this); +void EnKaizoku_PlayerWinCutscene(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupReady(EnKaizoku* this); void EnKaizoku_Ready(EnKaizoku* this, PlayState* play); void EnKaizoku_SetupSpinDodge(EnKaizoku* this, PlayState* play); @@ -683,7 +683,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { } // Player has lost the fight -void EnKaizoku_SetupLoss(EnKaizoku* this, PlayState* play) { +void EnKaizoku_SetupPlayerLoss(EnKaizoku* this, PlayState* play) { if (this->subCamId == SUB_CAM_ID_DONE) { if (!CutsceneManager_IsNext(this->csId)) { CutsceneManager_Queue(this->csId); @@ -700,11 +700,11 @@ void EnKaizoku_SetupLoss(EnKaizoku* this, PlayState* play) { this->cutsceneState = 0; this->dontUpdateSkel = false; this->action = KAIZOKU_ACTION_HIDDEN; - this->actionFunc = EnKaizoku_Loss; + this->actionFunc = EnKaizoku_PlayerLoss; this->picto.actor.speed = 0.0f; } -void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { +void EnKaizoku_PlayerLoss(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; Math_SmoothStepToS(&this->picto.actor.shape.rot.y, this->picto.actor.yawTowardsPlayer, 1, 0xFA0, 1); @@ -767,13 +767,13 @@ void EnKaizoku_Loss(EnKaizoku* this, PlayState* play) { } // Player has won the fight -void EnKaizoku_SetupWinCutscene(EnKaizoku* this) { +void EnKaizoku_SetupPlayerWinCutscene(EnKaizoku* this) { this->dontUpdateSkel = false; this->action = KAIZOKU_ACTION_HIDDEN; - this->actionFunc = EnKaizoku_WinCutscene; + this->actionFunc = EnKaizoku_PlayerWinCutscene; } -void EnKaizoku_WinCutscene(EnKaizoku* this, PlayState* play) { +void EnKaizoku_PlayerWinCutscene(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 textId; f32 curFrame = this->skelAnime.curFrame; @@ -1783,7 +1783,7 @@ void EnKaizoku_DefeatKnockdown(EnKaizoku* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (curFrame >= this->animEndFrame) { this->dontUpdateSkel = false; - EnKaizoku_SetupWinCutscene(this); + EnKaizoku_SetupPlayerWinCutscene(this); } else if (Animation_OnFrame(&this->skelAnime, 10.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_DOWN); } @@ -1807,11 +1807,11 @@ void EnKaizoku_UpdateDamage(EnKaizoku* this, PlayState* play) { if (!CutsceneManager_IsNext(this->csId)) { CutsceneManager_Queue(this->csId); - this->actionFunc = EnKaizoku_SetupLoss; + this->actionFunc = EnKaizoku_SetupPlayerLoss; } else { CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); - this->actionFunc = EnKaizoku_SetupLoss; + this->actionFunc = EnKaizoku_SetupPlayerLoss; } return; } else if ((this->action == KAIZOKU_ACTION_SPIN_ATTACK) && @@ -1826,11 +1826,11 @@ void EnKaizoku_UpdateDamage(EnKaizoku* this, PlayState* play) { if (!CutsceneManager_IsNext(this->csId)) { CutsceneManager_Queue(this->csId); - this->actionFunc = EnKaizoku_SetupLoss; + this->actionFunc = EnKaizoku_SetupPlayerLoss; } else { CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); - this->actionFunc = EnKaizoku_SetupLoss; + this->actionFunc = EnKaizoku_SetupPlayerLoss; } return; } diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index 3cd252f5bb8..9945f9d34c7 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -110,7 +110,7 @@ typedef struct EnKaizoku { /* 0x578 */ Vec3s headRot; /* 0x580 */ Vec3f rightFootPos; /* 0x58C */ Vec3f leftFootPos; - /* 0x598 */ s32 cutsceneTimer; // why is it double len? + /* 0x598 */ s32 cutsceneTimer; /* 0x59C */ s16 cutsceneState; /* 0x59E */ s16 subCamId; /* 0x5A0 */ s16 flashTimer; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 46c99c20257..157d38bfb93 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -14663,10 +14663,10 @@ 0x80B85EA0:("EnKaizoku_ValidatePictograph",), 0x80B85F48:("EnKaizoku_SetupWaitForApproach",), 0x80B85FA8:("EnKaizoku_WaitForApproach",), - 0x80B86804:("EnKaizoku_SetupLoss",), - 0x80B868B8:("EnKaizoku_Loss",), - 0x80B86B58:("EnKaizoku_SetupWinCutscene",), - 0x80B86B74:("EnKaizoku_WinCutscene",), + 0x80B86804:("EnKaizoku_SetupPlayerLoss",), + 0x80B868B8:("EnKaizoku_PlayerLoss",), + 0x80B86B58:("EnKaizoku_SetupPlayerWinCutscene",), + 0x80B86B74:("EnKaizoku_PlayerWinCutscene",), 0x80B872A4:("EnKaizoku_SetupReady",), 0x80B872F4:("EnKaizoku_Ready",), 0x80B874D8:("EnKaizoku_SetupSpinDodge",), From a97f40bd433bb78de30b052cc961cc332107fc33 Mon Sep 17 00:00:00 2001 From: isghj Date: Sat, 25 Jan 2025 11:32:15 -0800 Subject: [PATCH 20/24] Kaizoku: outfit and lipstick color enums --- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 40239c476a5..7a459d727f7 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -52,7 +52,7 @@ void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play); void EnKaizoku_Damaged(EnKaizoku* this, PlayState* play); void EnKaizoku_DefeatKnockdown(EnKaizoku* this, PlayState* play); -typedef enum EnKaizokuAction { +typedef enum KaizokuAction { /* 0 */ KAIZOKU_ACTION_HIDDEN, /* 1 */ KAIZOKU_ACTION_READY, /* 2 */ KAIZOKU_ACTION_SPIN_DODGE, @@ -70,7 +70,7 @@ typedef enum EnKaizokuAction { /* 14 */ KAIZOKU_ACTION_DAMAGED, /* 15 */ KAIZOKU_ACTION_KNOCK_DOWN, /* 16 */ KAIZOKU_ACTION_SCENE_FADE -} EnKaizokuAction; +} KaizokuAction; // text Ids, grouped into two batches of 4, and two mask values static u16 sKaizokuTextIds[] = { @@ -104,19 +104,31 @@ Vec3f sCutsceneCameraTargetPositions[] = { { 470.0f, 30.0f, 140.0f }, { 410.0f, 80.0f, 130.0f }, { 410.0f, 80.0f, 130.0f }, { 0.0f, 0.0f, 0.0f }, }; +typedef enum KaizokuLipstickColors { + /* 0x0 */ KAIZOKU_LIPSTICK_YELLOW, + /* 0x1 */ KAIZOKU_LIPSTICK_PURPLE, + /* 0x2 */ KAIZOKU_LIPSTICK_SEAGREEN, // (between aqua and green) +} KaizokuLipstickColors; + Color_RGBA8 sKaizokuLipstickColors[] = { - { 255, 255, 90, 255 }, // yellow - { 55, 25, 80, 255 }, // dark purple - { 5, 195, 110, 255 }, // seagreen (between aqua and green) + { 255, 255, 90, 255 }, // KAIZOKU_LIPSTICK_YELLOW + { 55, 25, 80, 255 }, // KAIZOKU_LIPSTICK_PURPLE + { 5, 195, 110, 255 }, // KAIZOKU_LIPSTICK_SEAGREEN }; +typedef enum KaizokuOutfitColors { + /* 0x0 */ KAIZOKU_OUTFIT_ORANGE, + /* 0x1 */ KAIZOKU_OUTFIT_LAVENDER, + /* 0x2 */ KAIZOKU_OUTFIT_GREEN, +} KaizokuOutfitColors; + static Color_RGBA8 sKaizokuOutfitColors[] = { - { 255, 130, 10, 255 }, // orange - { 185, 130, 210, 255 }, // lavender - { 135, 195, 80, 255 }, // pale green + { 255, 130, 10, 255 }, // KAIZOKU_OUTFIT_ORANGE + { 185, 130, 210, 255 }, // KAIZOKU_OUTFIT_LAVENDER + { 135, 195, 80, 255 }, // KAIZOKU_OUTFIT_GREEN }; -typedef enum EnKaizokuDamageEffect { +typedef enum KaizokuDamageEffect { /* 0x0 */ KAIZOKU_DMGEFF_NONE, /* 0x1 */ KAIZOKU_DMGEFF_STUNNED, /* 0x2 */ KAIZOKU_DMGEFF_FIRE_ARROW, @@ -126,7 +138,7 @@ typedef enum EnKaizokuDamageEffect { /* 0xD */ KAIZOKU_DMGEFF_STUNNED_ONLY = 0xD, // smashed? it checks stun first? /* 0xE */ KAIZOKU_DMGEFF_ALWAYS_HIT, /* 0xF */ KAIZOKU_DMGEFF_IFRAME_PROTECTED // can only hit while kaizoku has no iframe from rolling -} EnKaizokuDamageEffect; +} KaizokuDamageEffect; static DamageTable sDamageTable = { /* Deku Nut */ DMG_ENTRY(0, KAIZOKU_DMGEFF_STUNNED), From aa1330ebdc18ef69480e76e0ed13e6cd0c06f6cc Mon Sep 17 00:00:00 2001 From: isghj Date: Wed, 29 Jan 2025 12:30:09 -0800 Subject: [PATCH 21/24] Kaizoku: rename object assets from gKaizoku to gFighterPirate --- assets/xml/objects/object_kz.xml | 166 +++++++++--------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 50 +++--- 2 files changed, 108 insertions(+), 108 deletions(-) diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index ef799d18cbf..33554a07ea9 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -1,106 +1,106 @@  - - - - - + + + + + - - - + + + - - - - + + + + - + - - + + - - - - + + + + - + - - - - - - - - - - + + + + + + + + + + - + - - - - - - - + + + + + + + - - - + + + - - + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - + - + - - - - + + + + - + - + diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index 7a459d727f7..c7bc11bb0e6 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -228,25 +228,25 @@ static ColliderQuadInit sQuadInit = { }; static AnimationHeader* sAnimations[KAIZOKU_ANIM_MAX] = { - &gKaizokuFightingIdleAnim, // KAIZOKU_ANIM_FIGHTING_IDLE - &gKaizokuUnusedConversationAnim, // KAIZOKU_ANIM_UNUSED_CONVERSATION - &gKaizokuUnusedJumpAnim, // KAIZOKU_ANIM_UNUSED_JUMP - &gKaizokuSidestepAnim, // KAIZOKU_ANIM_SIDESTEP - &gKaizokuWalkAnim, // KAIZOKU_ANIM_WALK - &gKaizokuDamageAnim, // KAIZOKU_ANIM_DAMAGE - &gKaizokuUnusedDefeatAnim, // KAIZOKU_ANIM_UNUSED_DEFEAT - &gKaizokuBlockAnim, // KAIZOKU_ANIM_BLOCK - &gKaizokuFlipAnim, // KAIZOKU_ANIM_FLIP - &gKaizokuSlashAnim, // KAIZOKU_ANIM_SLASH_ATTCK - &gKaizokuSpinAttackAnim, // KAIZOKU_ANIM_SPIN_ATTACK - &gKaizokuLandAnim, // KAIZOKU_ANIM_LAND - &gKaizokuChallengeTalkAnim, // KAIZOKU_ANIM_CHALLENGE - &gKaizokuUnsheatheAnim, // KAIZOKU_ANIM_UNSHEATHE - &gKaizokuLowerWeaponsAnim, // KAIZOKU_ANIM_LOWER_WEAPONS - &gKaizokuDemonstrativeSwordSwingAnim, // KAIZOKU_ANIM_DEMONSTRATIVE_SWORD_SWING - &gKaizokuDefeatAnim, // KAIZOKU_ANIM_DEFEAT - &gKaizokuDefeatIdleAnim, // KAIZOKU_ANIM_DEFEAT_IDLE - &gKaizokuThrowFlashAnim, // KAIZOKU_ANIM_THROW_FLASH + &gFighterPirateFightingIdleAnim, // KAIZOKU_ANIM_FIGHTING_IDLE + &gFighterPirateUnusedConversationAnim, // KAIZOKU_ANIM_UNUSED_CONVERSATION + &gFighterPirateUnusedJumpAnim, // KAIZOKU_ANIM_UNUSED_JUMP + &gFighterPirateSidestepAnim, // KAIZOKU_ANIM_SIDESTEP + &gFighterPirateWalkAnim, // KAIZOKU_ANIM_WALK + &gFighterPirateDamageAnim, // KAIZOKU_ANIM_DAMAGE + &gFighterPirateUnusedDefeatAnim, // KAIZOKU_ANIM_UNUSED_DEFEAT + &gFighterPirateBlockAnim, // KAIZOKU_ANIM_BLOCK + &gFighterPirateFlipAnim, // KAIZOKU_ANIM_FLIP + &gFighterPirateSlashAnim, // KAIZOKU_ANIM_SLASH_ATTCK + &gFighterPirateSpinAttackAnim, // KAIZOKU_ANIM_SPIN_ATTACK + &gFighterPirateLandAnim, // KAIZOKU_ANIM_LAND + &gFighterPirateChallengeTalkAnim, // KAIZOKU_ANIM_CHALLENGE + &gFighterPirateUnsheatheAnim, // KAIZOKU_ANIM_UNSHEATHE + &gFighterPirateLowerWeaponsAnim, // KAIZOKU_ANIM_LOWER_WEAPONS + &gFighterPirateDemonstrativeSwordSwingAnim, // KAIZOKU_ANIM_DEMONSTRATIVE_SWORD_SWING + &gFighterPirateDefeatAnim, // KAIZOKU_ANIM_DEFEAT + &gFighterPirateDefeatIdleAnim, // KAIZOKU_ANIM_DEFEAT_IDLE + &gFighterPirateThrowFlashAnim, // KAIZOKU_ANIM_THROW_FLASH }; static u8 sAnimationModes[KAIZOKU_ANIM_MAX] = { @@ -297,8 +297,8 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { this->colorType = KAIZOKU_GET_TYPE(this); this->picto.actor.world.rot.z = 0; // clear TYPE param, which was rot.z, as we dont want skew this->picto.actor.colChkInfo.damageTable = &sDamageTable; - SkelAnime_InitFlex(play, &this->skelAnime, &gKaizokuSkel, &gKaizokuWalkAnim, this->jointTable, this->morphTable, - KAIZOKU_LIMB_MAX); + SkelAnime_InitFlex(play, &this->skelAnime, &gFighterPirateSkel, &gFighterPirateWalkAnim, this->jointTable, + this->morphTable, KAIZOKU_LIMB_MAX); Collider_InitAndSetCylinder(play, &this->bodyCollider, &this->picto.actor, &sCylinderInit); Collider_InitAndSetQuad(play, &this->swordCollider, &this->picto.actor, &sQuadInit); blureInit.p1StartColor[0] = blureInit.p1StartColor[1] = blureInit.p1StartColor[2] = blureInit.p1StartColor[3] = @@ -2013,10 +2013,10 @@ static Vec3f sSwordQuadOffset3 = { -3000.0f, -2000.0f, -1300.0f }; static Vec3f sSwordQuadOffset2 = { 1000.0f, 1000.0f, 0.0f }; static TexturePtr sEyeTextures[] = { - gKaizokuEyeOpenTex, - gKaizokuEyeHalfTex, - gKaizokuEyeClosedTex, - gKaizokuEyeHalfTex, + gFighterPirateEyeOpenTex, + gFighterPirateEyeHalfTex, + gFighterPirateEyeClosedTex, + gFighterPirateEyeHalfTex, }; void EnKaizoku_Update(Actor* thisx, PlayState* play2) { From 852b3269d3ecd62bfea0faa5fcb968acb94b17cb Mon Sep 17 00:00:00 2001 From: isghj Date: Wed, 29 Jan 2025 12:40:52 -0800 Subject: [PATCH 22/24] Kaizoku: LIMB_FULL --- assets/xml/objects/object_kz.xml | 38 +++++++++---------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 24 ++++++------ 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index 33554a07ea9..802ec42fb51 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -29,9 +29,9 @@ - + - + @@ -65,28 +65,28 @@ - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index c7bc11bb0e6..a6392c4baa6 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -2116,7 +2116,7 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* Vec3f swordHilt; EnKaizoku* this = (EnKaizoku*)thisx; - if (limbIndex == KAIZOKU_LIMB_R_SWORD) { + if (limbIndex == KAIZOKU_LIMB_RIGHT_SWORD) { Matrix_MultVec3f(&sSwordQuadOffset1, &this->swordCollider.dim.quad[1]); Matrix_MultVec3f(&sSwordQuadOffset0, &this->swordCollider.dim.quad[0]); Matrix_MultVec3f(&sSwordQuadOffset3, &this->swordCollider.dim.quad[3]); @@ -2135,23 +2135,23 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* this->swordState = 0; } } else { - Actor_SetFeetPos(&this->picto.actor, limbIndex, KAIZOKU_LIMB_L_FOOT, &sFootOffset, KAIZOKU_LIMB_R_FOOT, + Actor_SetFeetPos(&this->picto.actor, limbIndex, KAIZOKU_LIMB_LEFT_FOOT, &sFootOffset, KAIZOKU_LIMB_RIGHT_FOOT, &sFootOffset); } - if (limbIndex == KAIZOKU_LIMB_L_FOOT) { + if (limbIndex == KAIZOKU_LIMB_LEFT_FOOT) { Matrix_MultVec3f(&sFootOffset, &this->leftFootPos); - } else if (limbIndex == KAIZOKU_LIMB_R_FOOT) { + } else if (limbIndex == KAIZOKU_LIMB_RIGHT_FOOT) { Matrix_MultVec3f(&sFootOffset, &this->rightFootPos); } if ((limbIndex == KAIZOKU_LIMB_TORSO) || (limbIndex == KAIZOKU_LIMB_HEAD) || - (limbIndex == KAIZOKU_LIMB_R_UPPER_ARM) || (limbIndex == KAIZOKU_LIMB_R_FOREARM) || - (limbIndex == KAIZOKU_LIMB_R_HAND) || (limbIndex == KAIZOKU_LIMB_L_UPPER_ARM) || - (limbIndex == KAIZOKU_LIMB_L_FOREARM) || (limbIndex == KAIZOKU_LIMB_L_HAND) || - (limbIndex == KAIZOKU_LIMB_L_THIGH) || (limbIndex == KAIZOKU_LIMB_L_SHIN) || - (limbIndex == KAIZOKU_LIMB_L_FOOT) || (limbIndex == KAIZOKU_LIMB_R_THIGH) || - (limbIndex == KAIZOKU_LIMB_R_SHIN) || (limbIndex == KAIZOKU_LIMB_R_FOOT) || (limbIndex == KAIZOKU_LIMB_WAIST)) { + (limbIndex == KAIZOKU_LIMB_RIGHT_UPPER_ARM) || (limbIndex == KAIZOKU_LIMB_RIGHT_FOREARM) || + (limbIndex == KAIZOKU_LIMB_RIGHT_HAND) || (limbIndex == KAIZOKU_LIMB_LEFT_UPPER_ARM) || + (limbIndex == KAIZOKU_LIMB_LEFT_FOREARM) || (limbIndex == KAIZOKU_LIMB_LEFT_HAND) || + (limbIndex == KAIZOKU_LIMB_LEFT_THIGH) || (limbIndex == KAIZOKU_LIMB_LEFT_SHIN) || + (limbIndex == KAIZOKU_LIMB_LEFT_FOOT) || (limbIndex == KAIZOKU_LIMB_RIGHT_THIGH) || + (limbIndex == KAIZOKU_LIMB_RIGHT_SHIN) || (limbIndex == KAIZOKU_LIMB_RIGHT_FOOT) || (limbIndex == KAIZOKU_LIMB_WAIST)) { Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); this->bodyPartIndex++; @@ -2164,10 +2164,10 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* void EnKaizoku_TransformLimbDraw(PlayState* play, s32 limbIndex, Actor* thisx) { EnKaizoku* this = (EnKaizoku*)thisx; - if (limbIndex == KAIZOKU_LIMB_R_SWORD) { + if (limbIndex == KAIZOKU_LIMB_RIGHT_SWORD) { Matrix_Scale(this->swordScaleRight.x, this->swordScaleRight.y, this->swordScaleRight.z, MTXMODE_APPLY); } - if (limbIndex == KAIZOKU_LIMB_L_SWORD) { + if (limbIndex == KAIZOKU_LIMB_LEFT_SWORD) { Matrix_Scale(this->swordScaleLeft.x, this->swordScaleLeft.y, this->swordScaleLeft.z, MTXMODE_APPLY); } } From 8b50c18cfd2eb0995f9c04f974c1dd8f05033276 Mon Sep 17 00:00:00 2001 From: isghj Date: Wed, 29 Jan 2025 13:16:28 -0800 Subject: [PATCH 23/24] Kaizoku: some requested changes --- assets/xml/objects/object_kz.xml | 7 +- .../actors/ovl_En_Kaizoku/z_en_kaizoku.c | 77 ++++++++++--------- .../actors/ovl_En_Kaizoku/z_en_kaizoku.h | 12 +-- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index 802ec42fb51..fe054db8a6f 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -93,12 +93,11 @@ - + - - - + + diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index a6392c4baa6..ce1924caaaa 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -229,7 +229,7 @@ static ColliderQuadInit sQuadInit = { static AnimationHeader* sAnimations[KAIZOKU_ANIM_MAX] = { &gFighterPirateFightingIdleAnim, // KAIZOKU_ANIM_FIGHTING_IDLE - &gFighterPirateUnusedConversationAnim, // KAIZOKU_ANIM_UNUSED_CONVERSATION + &gFighterPirateUnusedTalkAnim, // KAIZOKU_ANIM_UNUSED_CONVERSATION &gFighterPirateUnusedJumpAnim, // KAIZOKU_ANIM_UNUSED_JUMP &gFighterPirateSidestepAnim, // KAIZOKU_ANIM_SIDESTEP &gFighterPirateWalkAnim, // KAIZOKU_ANIM_WALK @@ -240,7 +240,7 @@ static AnimationHeader* sAnimations[KAIZOKU_ANIM_MAX] = { &gFighterPirateSlashAnim, // KAIZOKU_ANIM_SLASH_ATTCK &gFighterPirateSpinAttackAnim, // KAIZOKU_ANIM_SPIN_ATTACK &gFighterPirateLandAnim, // KAIZOKU_ANIM_LAND - &gFighterPirateChallengeTalkAnim, // KAIZOKU_ANIM_CHALLENGE + &gFighterPirateLandTalkAnim, // KAIZOKU_ANIM_CHALLENGE &gFighterPirateUnsheatheAnim, // KAIZOKU_ANIM_UNSHEATHE &gFighterPirateLowerWeaponsAnim, // KAIZOKU_ANIM_LOWER_WEAPONS &gFighterPirateDemonstrativeSwordSwingAnim, // KAIZOKU_ANIM_DEMONSTRATIVE_SWORD_SWING @@ -984,7 +984,7 @@ void EnKaizoku_SetupSpinDodge(EnKaizoku* this, PlayState* play) { this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; this->combatTimer = 6; this->action = KAIZOKU_ACTION_SPIN_DODGE; - this->approachRate = 0.0f; + this->circlingRate = 0.0f; this->actionFunc = EnKaizoku_SpinDodge; } @@ -1016,16 +1016,16 @@ void EnKaizoku_SpinDodge(EnKaizoku* this, PlayState* play) { } if (this->picto.actor.xzDistToPlayer <= 65.0f) { - Math_ApproachF(&this->approachRate, -4.0f, 1.0f, 1.5f); + Math_ApproachF(&this->circlingRate, -4.0f, 1.0f, 1.5f); } else if (this->picto.actor.xzDistToPlayer > 40.0f) { - Math_ApproachF(&this->approachRate, 4.0f, 1.0f, 1.5f); + Math_ApproachF(&this->circlingRate, 4.0f, 1.0f, 1.5f); } else { - Math_ApproachZeroF(&this->approachRate, 1.0f, 6.65f); + Math_ApproachZeroF(&this->circlingRate, 1.0f, 6.65f); } - if (this->approachRate != 0.0f) { - this->picto.actor.world.pos.x += Math_SinS(this->picto.actor.yawTowardsPlayer) * this->approachRate; - this->picto.actor.world.pos.z += Math_CosS(this->picto.actor.yawTowardsPlayer) * this->approachRate; + if (this->circlingRate != 0.0f) { + this->picto.actor.world.pos.x += Math_SinS(this->picto.actor.yawTowardsPlayer) * this->circlingRate; + this->picto.actor.world.pos.z += Math_CosS(this->picto.actor.yawTowardsPlayer) * this->circlingRate; } this->skelAnime.playSpeed = 1.0f; @@ -1507,7 +1507,7 @@ void EnKaizoku_SetupCircle(EnKaizoku* this) { this->combatTimer = Rand_ZeroOne() * 30.0f + 30.0f; this->action = KAIZOKU_ACTION_SIDESTEP; this->actionFunc = EnKaizoku_Circle; - this->approachRate = 0.0f; + this->circlingRate = 0.0f; } void EnKaizoku_Circle(EnKaizoku* this, PlayState* play) { @@ -1560,16 +1560,16 @@ void EnKaizoku_Circle(EnKaizoku* this, PlayState* play) { } if (this->picto.actor.xzDistToPlayer <= 65.0f) { - Math_ApproachF(&this->approachRate, -4.0f, 1.0f, 1.5f); + Math_ApproachF(&this->circlingRate, -4.0f, 1.0f, 1.5f); } else if (this->picto.actor.xzDistToPlayer > 40.0f) { - Math_ApproachF(&this->approachRate, 4.0f, 1.0f, 1.5f); + Math_ApproachF(&this->circlingRate, 4.0f, 1.0f, 1.5f); } else { - Math_ApproachZeroF(&this->approachRate, 1.0f, 6.65f); + Math_ApproachZeroF(&this->circlingRate, 1.0f, 6.65f); } - if (this->approachRate != 0.0f) { - this->picto.actor.world.pos.x += Math_SinS(this->picto.actor.shape.rot.y) * this->approachRate; - this->picto.actor.world.pos.z += Math_CosS(this->picto.actor.shape.rot.y) * this->approachRate; + if (this->circlingRate != 0.0f) { + this->picto.actor.world.pos.x += Math_SinS(this->picto.actor.shape.rot.y) * this->circlingRate; + this->picto.actor.world.pos.z += Math_CosS(this->picto.actor.shape.rot.y) * this->circlingRate; } beforeCurFrame = this->skelAnime.curFrame - this->skelAnime.playSpeed; @@ -1607,8 +1607,8 @@ void EnKaizoku_SetupStunned(EnKaizoku* this) { if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && - (this->colorFilterTimer == 0)) { - this->colorFilterTimer = 0; + (this->drawDmgEffTimer == 0)) { + this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -1626,7 +1626,7 @@ void EnKaizoku_SetupStunned(EnKaizoku* this) { void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play) { if (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) { - if ((this->colorFilterTimer != 0) && (this->colorFilterTimer < 60)) { + if ((this->drawDmgEffTimer != 0) && (this->drawDmgEffTimer < 60)) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; } } @@ -1641,7 +1641,7 @@ void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play) { } } - if ((this->iceTimer == 0) && (this->colorFilterTimer == 0) && + if ((this->iceTimer == 0) && (this->drawDmgEffTimer == 0) && !CHECK_FLAG_ALL(this->picto.actor.flags, ACTOR_FLAG_HOOKSHOT_ATTACHED) && (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { this->dontUpdateSkel = false; @@ -1650,7 +1650,7 @@ void EnKaizoku_Stunned(EnKaizoku* this, PlayState* play) { if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); - this->colorFilterTimer = 0; + this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->picto.actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; } @@ -1670,9 +1670,9 @@ void EnKaizoku_SetupDamaged(EnKaizoku* this, PlayState* play) { if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && - (this->colorFilterTimer != 0)) { + (this->drawDmgEffTimer != 0)) { Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); - this->colorFilterTimer = 0; + this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->picto.actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; } @@ -1716,7 +1716,7 @@ void EnKaizoku_SetupDefeatKnockdown(EnKaizoku* this, PlayState* play) { if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && - (this->colorFilterTimer == 0)) { + (this->drawDmgEffTimer == 0)) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } this->picto.actor.speed = 0.0f; @@ -1747,11 +1747,11 @@ void EnKaizoku_DefeatKnockdown(EnKaizoku* this, PlayState* play) { if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { - if (this->colorFilterTimer == 0) { + if (this->drawDmgEffTimer == 0) { return; } Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); - this->colorFilterTimer = 0; + this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -1873,15 +1873,15 @@ void EnKaizoku_UpdateDamage(EnKaizoku* this, PlayState* play) { case KAIZOKU_DMGEFF_ZORA_SHIELD: if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || - (this->colorFilterTimer == 0)) { - this->colorFilterTimer = 40; + (this->drawDmgEffTimer == 0)) { + this->drawDmgEffTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_ELECTRIC_SPARKS_MEDIUM; } FALLTHROUGH; case KAIZOKU_DMGEFF_STUNNED: if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || - this->colorFilterTimer == 0) { + this->drawDmgEffTimer == 0) { Actor_SetColorFilter(&this->picto.actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); this->bodyCollider.elem.elemMaterial = ELEM_MATERIAL_UNK1; @@ -1913,7 +1913,7 @@ void EnKaizoku_UpdateDamage(EnKaizoku* this, PlayState* play) { case KAIZOKU_DMGEFF_FIRE_ARROW: if ((this->action != KAIZOKU_ACTION_ROLL_FORWARD) && (this->action != KAIZOKU_ACTION_ROLL_BACK) && (this->action < KAIZOKU_ACTION_DAMAGED)) { - this->colorFilterTimer = 40; + this->drawDmgEffTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; wasHit = true; } @@ -1922,12 +1922,12 @@ void EnKaizoku_UpdateDamage(EnKaizoku* this, PlayState* play) { case KAIZOKU_DMGEFF_FREEZE: if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || - (this->colorFilterTimer == 0)) { + (this->drawDmgEffTimer == 0)) { Actor_ApplyDamage(&this->picto.actor); this->bodyCollider.elem.elemMaterial = ELEM_MATERIAL_UNK1; this->bodyCollider.base.colMaterial = COL_MATERIAL_HIT3; this->swordCollider.elem.elemMaterial = ELEM_MATERIAL_UNK4; - this->colorFilterTimer = 80; + this->drawDmgEffTimer = 80; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_SFX; this->drawDmgEffScale = 0.0f; this->drawDmgEffFrozenSteamScale = 1.5f; @@ -1943,8 +1943,8 @@ void EnKaizoku_UpdateDamage(EnKaizoku* this, PlayState* play) { case KAIZOKU_DMGEFF_LIGHT_ARROW: if (((this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_SFX) && (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) || - (this->colorFilterTimer == 0)) { - this->colorFilterTimer = 20; + (this->drawDmgEffTimer == 0)) { + this->drawDmgEffTimer = 20; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_LIGHT_ORBS; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, this->picto.actor.focus.pos.x, this->picto.actor.focus.pos.y, this->picto.actor.focus.pos.z, 0, 0, 0, @@ -2036,7 +2036,7 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { DECR(this->lookTimer); DECR(this->iceTimer); DECR(this->cutsceneTimer); - DECR(this->colorFilterTimer); + DECR(this->drawDmgEffTimer); this->actionFunc(this, play); Actor_MoveWithGravity(&this->picto.actor); @@ -2151,7 +2151,8 @@ void EnKaizoku_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* (limbIndex == KAIZOKU_LIMB_LEFT_FOREARM) || (limbIndex == KAIZOKU_LIMB_LEFT_HAND) || (limbIndex == KAIZOKU_LIMB_LEFT_THIGH) || (limbIndex == KAIZOKU_LIMB_LEFT_SHIN) || (limbIndex == KAIZOKU_LIMB_LEFT_FOOT) || (limbIndex == KAIZOKU_LIMB_RIGHT_THIGH) || - (limbIndex == KAIZOKU_LIMB_RIGHT_SHIN) || (limbIndex == KAIZOKU_LIMB_RIGHT_FOOT) || (limbIndex == KAIZOKU_LIMB_WAIST)) { + (limbIndex == KAIZOKU_LIMB_RIGHT_SHIN) || (limbIndex == KAIZOKU_LIMB_RIGHT_FOOT) || + (limbIndex == KAIZOKU_LIMB_WAIST)) { Matrix_MultZero(&this->bodyPartsPos[this->bodyPartIndex]); this->bodyPartIndex++; @@ -2187,8 +2188,8 @@ void EnKaizoku_Draw(Actor* thisx, PlayState* play) { this->skelAnime.dListCount, EnKaizoku_OverrideLimbDraw, EnKaizoku_PostLimbDraw, EnKaizoku_TransformLimbDraw, &this->picto.actor); - if (this->colorFilterTimer != 0) { - drawDmgEffAlpha = this->colorFilterTimer * 0.05f; + if (this->drawDmgEffTimer != 0) { + drawDmgEffAlpha = this->drawDmgEffTimer * 0.05f; if ((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) { diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index 9945f9d34c7..09ee0dba431 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -19,12 +19,12 @@ typedef void (*EnKaizokuActionFunc)(struct EnKaizoku*, PlayState*); typedef enum EnKaizokuAnimation { /* 0 */ KAIZOKU_ANIM_FIGHTING_IDLE, - /* 1 */ KAIZOKU_ANIM_UNUSED_CONVERSATION, // from OOT: giving player membership card? - /* 2 */ KAIZOKU_ANIM_UNUSED_JUMP, // from OOT: replaced with _LAND + /* 1 */ KAIZOKU_ANIM_UNUSED_CONVERSATION, // from OOT: giving player membership card + /* 2 */ KAIZOKU_ANIM_UNUSED_JUMP, // from OOT: replaced with KAIZOKU_ANIM_LAND /* 3 */ KAIZOKU_ANIM_SIDESTEP, /* 4 */ KAIZOKU_ANIM_WALK, /* 5 */ KAIZOKU_ANIM_DAMAGE, - /* 6 */ KAIZOKU_ANIM_UNUSED_DEFEAT, // from OOT: replaced with _DEFEAT + /* 6 */ KAIZOKU_ANIM_UNUSED_DEFEAT, // from OOT: replaced with KAIZOKU_ANIM_DEFEAT /* 7 */ KAIZOKU_ANIM_BLOCK, /* 8 */ KAIZOKU_ANIM_FLIP, /* 9 */ KAIZOKU_ANIM_SLASH_ATTCK, @@ -76,7 +76,7 @@ typedef struct EnKaizoku { /* 0x2B2 */ s16 combatTimer; /* 0x2B4 */ s16 lookTimer; /* 0x2B6 */ s16 iceTimer; - /* 0x2B8 */ s16 colorFilterTimer; // name taken from oot, damaged flashing red + /* 0x2B8 */ s16 drawDmgEffTimer; /* 0x2BA */ s16 drawDmgEffType; /* 0x2BC */ s16 switchFlag; /* 0x2C0 */ f32 drawDmgEffScale; @@ -92,7 +92,7 @@ typedef struct EnKaizoku { /* 0x2D8 */ u8 dontUpdateSkel; /* 0x2D9 */ u8 defeatBreathingStarted; /* 0x2DC */ f32 animEndFrame; - /* 0x2E0 */ f32 approachRate; + /* 0x2E0 */ f32 circlingRate; /* 0x2E4 */ EnKaizokuAnimation animIndex; /* 0x2E8 */ s32 bodyPartIndex; /* 0x2EC */ s32 colorType; @@ -120,7 +120,7 @@ typedef struct EnKaizoku { /* 0x5C8 */ Vec3f subCamEyeTarget; /* 0x5D4 */ Vec3f subCamAtTarget; /* 0x5E0 */ f32 subCamVelocity; - /* 0x5E4 */ f32 unused5E4; + /* 0x5E4 */ f32 unk_5E4; // unused /* 0x5E8 */ f32 flashScreenAlpha; /* 0x5EC */ f32 flashScreenAlphaTarget; } EnKaizoku; // size = 0x5F0 From 87af7ea91358636f8184de4c35aeb90b30df6455 Mon Sep 17 00:00:00 2001 From: isghj Date: Wed, 29 Jan 2025 13:34:18 -0800 Subject: [PATCH 24/24] Kaizoku: more requested changes --- assets/xml/objects/object_kz.xml | 1 - src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c | 8 ++++---- src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h | 10 +++++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index fe054db8a6f..33f994c8593 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -99,7 +99,6 @@ - diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c index ce1924caaaa..7af48421e3b 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -526,7 +526,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { this->picto.actor.world.pos.x = this->picto.actor.home.pos.x; this->picto.actor.world.pos.z = this->picto.actor.home.pos.z; Message_StartTextbox(play, sKaizokuTextIds[nextTextId], &this->picto.actor); - this->textIdOffset++; // KAIZOKU_COVERSATION_INTRO_2 + this->textIdOffset++; // KAIZOKU_TALK_INTRO, after landing this->picto.actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; player->actor.shape.rot.y = player->actor.world.rot.y = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); @@ -594,7 +594,7 @@ void EnKaizoku_WaitForApproach(EnKaizoku* this, PlayState* play) { Message_StartTextbox(play, sKaizokuTextIds[nextTextId], &this->picto.actor); EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_CHALLENGE); - this->textIdOffset++; // KAIZOKU_COVERSATION_INTRO_WIN, although that gets set directly later + this->textIdOffset++; // KAIZOKU_TALK_PLAYER_VICTORY, although that gets set directly later this->cutsceneTimer = 0; this->cutsceneState++; } @@ -732,7 +732,7 @@ void EnKaizoku_PlayerLoss(EnKaizoku* this, PlayState* play) { case 0: // waiting for animation to change if (curFrame >= this->animEndFrame) { EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_LOWER_WEAPONS); - this->textIdOffset = KAIZOKU_COVERSATION_LOSS; + this->textIdOffset = KAIZOKU_TALK_PLAYER_DEFEAT; this->cutsceneTimer = 0; this->cutsceneState++; } @@ -809,7 +809,7 @@ void EnKaizoku_PlayerWinCutscene(EnKaizoku* this, PlayState* play) { switch (this->cutsceneState) { case 0: // start: change animation and start talking EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DEFEAT_IDLE); - this->textIdOffset = KAIZOKU_COVERSATION_WIN; + this->textIdOffset = KAIZOKU_TALK_PLAYER_VICTORY; textId = this->textType * 4 + this->textIdOffset; Message_StartTextbox(play, sKaizokuTextIds[textId], &this->picto.actor); this->defeatBreathingStarted = false; diff --git a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h index 09ee0dba431..eab21b78790 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -20,7 +20,7 @@ typedef void (*EnKaizokuActionFunc)(struct EnKaizoku*, PlayState*); typedef enum EnKaizokuAnimation { /* 0 */ KAIZOKU_ANIM_FIGHTING_IDLE, /* 1 */ KAIZOKU_ANIM_UNUSED_CONVERSATION, // from OOT: giving player membership card - /* 2 */ KAIZOKU_ANIM_UNUSED_JUMP, // from OOT: replaced with KAIZOKU_ANIM_LAND + /* 2 */ KAIZOKU_ANIM_UNUSED_JUMP, // from OOT: when the enemy would escape by jumping up /* 3 */ KAIZOKU_ANIM_SIDESTEP, /* 4 */ KAIZOKU_ANIM_WALK, /* 5 */ KAIZOKU_ANIM_DAMAGE, @@ -60,10 +60,10 @@ typedef enum EnKaizokuBodyPart { } EnKaizokuBodyPart; typedef enum KaizokuTextOffset { - /* 0 */ KAIZOKU_COVERSATION_INTRO_1, // shout before landing - /* 1 */ KAIZOKU_COVERSATION_INTRO_2, // after landing - /* 2 */ KAIZOKU_COVERSATION_WIN, // after losing to player - /* 3 */ KAIZOKU_COVERSATION_LOSS // after defeating player + /* 0 */ KAIZOKU_TALK_SHOUT_FROM_ABOVE, // shout before landing + /* 1 */ KAIZOKU_TALK_INTRO, // after landing + /* 2 */ KAIZOKU_TALK_PLAYER_VICTORY, // after losing to player + /* 3 */ KAIZOKU_TALK_PLAYER_DEFEAT // after defeating player } KaizokuTextOffset; typedef struct EnKaizoku {