diff --git a/assets/xml/objects/object_kz.xml b/assets/xml/objects/object_kz.xml index 275a2791ef..33f994c859 100644 --- a/assets/xml/objects/object_kz.xml +++ b/assets/xml/objects/object_kz.xml @@ -1,93 +1,104 @@  - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + 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 6279bd3051..7af48421e3 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.c @@ -1,12 +1,13 @@ /* * 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" #include "attributes.h" #include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" +#include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" #include "overlays/effects/ovl_Effect_Ss_Hitmark/z_eff_ss_hitmark.h" #define FLAGS \ @@ -19,63 +20,73 @@ 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 func_80B868B8(EnKaizoku* this, PlayState* play); -void func_80B86B58(EnKaizoku* this); -void func_80B86B74(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 func_80B87CF8(PlayState* play, Vec3f* pos); -void func_80B87D3C(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 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 func_80B88CD8(EnKaizoku* this); -void func_80B88D6C(EnKaizoku* this, PlayState* play); -void func_80B89280(EnKaizoku* this, PlayState* play); -void func_80B894C0(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, - /* 4 */ KAIZOKU_ACTION_4, - /* 5 */ KAIZOKU_ACTION_5, - /* 6 */ KAIZOKU_ACTION_6, - /* 7 */ KAIZOKU_ACTION_7, - /* 8 */ KAIZOKU_ACTION_8, - /* 9 */ KAIZOKU_ACTION_9, - /* 10 */ KAIZOKU_ACTION_10, - /* 11 */ KAIZOKU_ACTION_11, - /* 12 */ KAIZOKU_ACTION_12, - /* 13 */ KAIZOKU_ACTION_13, - /* 14 */ KAIZOKU_ACTION_14, - /* 15 */ KAIZOKU_ACTION_15, - /* 16 */ KAIZOKU_ACTION_16 -} EnKaizokuAction; - -u16 D_80B8A8D0[] = { - 0x11A4, 0x11A5, 0x11A6, 0x11A7, 0x11A8, 0x11A9, 0x11AA, 0x11AB, 0x11AC, 0x11AD, +void EnKaizoku_SetupWaitForApproach(EnKaizoku* this); +void EnKaizoku_WaitForApproach(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); +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_SpawnVerticalFootDust(PlayState* play, Vec3f* pos); +void EnKaizoku_Jump(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 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); +void EnKaizoku_Damaged(EnKaizoku* this, PlayState* play); +void EnKaizoku_DefeatKnockdown(EnKaizoku* this, PlayState* play); + +typedef enum KaizokuAction { + /* 0 */ KAIZOKU_ACTION_HIDDEN, + /* 1 */ KAIZOKU_ACTION_READY, + /* 2 */ KAIZOKU_ACTION_SPIN_DODGE, + /* 3 */ KAIZOKU_ACTION_SIDESTEP, + /* 4 */ KAIZOKU_ACTION_ADVANCE, + /* 5 */ KAIZOKU_ACTION_ROLL_FORWARD, + /* 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_BLOCK, + /* 13 */ KAIZOKU_ACTION_STUNNED, + /* 14 */ KAIZOKU_ACTION_DAMAGED, + /* 15 */ KAIZOKU_ACTION_KNOCK_DOWN, + /* 16 */ KAIZOKU_ACTION_SCENE_FADE +} KaizokuAction; + +// 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? }; -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 }, @@ -84,7 +95,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 }, @@ -93,63 +104,75 @@ 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 }, +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 }, // KAIZOKU_LIPSTICK_YELLOW + { 55, 25, 80, 255 }, // KAIZOKU_LIPSTICK_PURPLE + { 5, 195, 110, 255 }, // KAIZOKU_LIPSTICK_SEAGREEN }; -Color_RGBA8 D_80B8AB30[] = { - { 255, 130, 10, 255 }, - { 185, 130, 210, 255 }, - { 135, 195, 80, 255 }, +typedef enum KaizokuOutfitColors { + /* 0x0 */ KAIZOKU_OUTFIT_ORANGE, + /* 0x1 */ KAIZOKU_OUTFIT_LAVENDER, + /* 0x2 */ KAIZOKU_OUTFIT_GREEN, +} KaizokuOutfitColors; + +static Color_RGBA8 sKaizokuOutfitColors[] = { + { 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_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 -} EnKaizokuDamageEffect; + /* 0x4 */ KAIZOKU_DMGEFF_LIGHT_ARROW, + /* 0x5 */ KAIZOKU_DMGEFF_ZORA_SHIELD, + /* 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 +} KaizokuDamageEffect; 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), - /* Goron pound */ DMG_ENTRY(0, KAIZOKU_DMGEFF_D), - /* Fire arrow */ DMG_ENTRY(2, KAIZOKU_DMGEFF_2), + /* 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_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_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), - /* Spin attack */ DMG_ENTRY(1, KAIZOKU_DMGEFF_D), + /* 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_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), /* 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), }; ActorProfile En_Kaizoku_Profile = { @@ -204,48 +227,48 @@ 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] = { - &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 +static AnimationHeader* sAnimations[KAIZOKU_ANIM_MAX] = { + &gFighterPirateFightingIdleAnim, // KAIZOKU_ANIM_FIGHTING_IDLE + &gFighterPirateUnusedTalkAnim, // 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 + &gFighterPirateLandTalkAnim, // 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[EN_KAIZOKU_ANIM_MAX] = { - ANIMMODE_LOOP, // EN_KAIZOKU_ANIM_0 - 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_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 +static u8 sAnimationModes[KAIZOKU_ANIM_MAX] = { + ANIMMODE_LOOP, // KAIZOKU_ANIM_FIGHTING_IDLE + 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_UNUSED_DEFEAT + 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) { @@ -258,21 +281,23 @@ void EnKaizoku_Init(Actor* thisx, PlayState* play) { this->picto.actor.attentionRangeType = ATTENTION_RANGE_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->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->unk_2CA >= 2) { - this->unk_2CA = 0; - } else if (this->unk_2CA == 2) { - this->unk_2CA = 0; + // 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' + this->textType = 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; // clear TYPE param, which was rot.z, as we dont want skew this->picto.actor.colChkInfo.damageTable = &sDamageTable; - SkelAnime_InitFlex(play, &this->skelAnime, &gKaizokuSkel, &object_kz_Anim_0058B8, this->jointTable, + 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); @@ -305,7 +330,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_HOOKSHOT_PULLS_PLAYER; - func_80B85F48(this); + EnKaizoku_SetupWaitForApproach(this); } void EnKaizoku_Destroy(Actor* thisx, PlayState* play) { @@ -317,7 +342,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; @@ -328,9 +353,9 @@ s32 func_80B85858(EnKaizoku* this, PlayState* play) { continue; } - if (((itemAction->id != ACTOR_ARMS_HOOK) || (this->action != KAIZOKU_ACTION_13)) && - (this->action != KAIZOKU_ACTION_6)) { - func_80B87C7C(this); + if (((itemAction->id != ACTOR_ARMS_HOOK) || (this->action != KAIZOKU_ACTION_STUNNED)) && + (this->action != KAIZOKU_ACTION_JUMP)) { + EnKaizoku_SetupJump(this); } break; } @@ -342,11 +367,11 @@ s32 func_80B85858(EnKaizoku* this, PlayState* play) { } } -void func_80B85900(EnKaizoku* this) { - if (this->action == KAIZOKU_ACTION_1) { - 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)) { +void EnKaizoku_TurnHead(EnKaizoku* this) { + if (this->action == KAIZOKU_ACTION_READY) { + 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, 500, 0); this->headRot.y = CLAMP(this->headRot.y, -0x256F, 0x256F); @@ -356,38 +381,38 @@ void func_80B85900(EnKaizoku* this) { } } -s32 func_80B85A00(EnKaizoku* this, PlayState* play, s16 arg2) { +s32 EnKaizoku_ReactToPlayer(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 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)) { 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); + if (this->action != KAIZOKU_ACTION_JUMP) { + EnKaizoku_SetupJump(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); - } else if (this->action != KAIZOKU_ACTION_7) { - func_80B87E28(this); + EnKaizoku_SetupBlock(this); + } else if (this->action != KAIZOKU_ACTION_ROLL_BACK) { + EnKaizoku_SetupRollBack(this); } return true; } @@ -396,44 +421,45 @@ 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); + if (this->action != KAIZOKU_ACTION_JUMP) { + EnKaizoku_SetupJump(this); } } else { - func_80B87900(this); + EnKaizoku_SetupBlock(this); } return true; } - if (this->action != KAIZOKU_ACTION_7) { - func_80B87E28(this); + if (this->action != KAIZOKU_ACTION_ROLL_BACK) { + EnKaizoku_SetupRollBack(this); } return true; } if (arg2) { - s16 sp2A; + s16 angleToFacingLink; //! FAKE: label:; - if (sp30 >= 10000) { - func_80B87900(this); + if (angleToPlayer >= 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)) { - if (this->action != KAIZOKU_ACTION_9) { - func_80B87F70(this); - return 1; + (ABS_ALT(angleToFacingLink) < 0x5000)) { + if (this->action != KAIZOKU_ACTION_SLASH) { + EnKaizoku_SetupSlash(this); + return true; } - } else if (this->action != KAIZOKU_ACTION_3) { - func_80B88CD8(this); + } else if (this->action != KAIZOKU_ACTION_SIDESTEP) { + EnKaizoku_SetupCircle(this); } } return true; @@ -458,21 +484,21 @@ s32 EnKaizoku_ValidatePictograph(PlayState* play, Actor* actor) { return ret; } -void func_80B85F48(EnKaizoku* this) { - Math_Vec3f_Copy(&this->unk_2F8, &gZeroVec3f); - Math_Vec3f_Copy(&this->unk_304, &gZeroVec3f); - this->unk_2D8 = 1; - this->action = KAIZOKU_ACTION_0; - this->actionFunc = func_80B85FA8; +void EnKaizoku_SetupWaitForApproach(EnKaizoku* this) { + Math_Vec3f_Copy(&this->swordScaleRight, &gZeroVec3f); + Math_Vec3f_Copy(&this->swordScaleLeft, &gZeroVec3f); + this->dontUpdateSkel = true; + this->action = KAIZOKU_ACTION_HIDDEN; + 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; + s32 nextTextId; - switch (this->unk_59C) { - case 0: + switch (this->cutsceneState) { + case 0: // waiting for proximity if (!(this->picto.actor.xzDistToPlayer < 200.0f)) { break; } @@ -487,8 +513,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) { + 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; } else { @@ -499,25 +525,25 @@ 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[nextTextId], &this->picto.actor); + 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); - 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->unk_598 = 0; + this->cutsceneTimer = 0; Audio_SetMainBgmVolume(0, 0xA); - this->unk_59C++; + this->cutsceneState++; FALLTHROUGH; - case 1: + 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; - 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,17 +553,17 @@ void func_80B85FA8(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; - this->unk_59C++; + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_LAND); + this->cutsceneTimer = 0; + this->cutsceneState++; this->picto.actor.gravity = -2.0f; } break; - case 2: + case 2: // waiting for fall to land if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - if (this->unk_2D8 != 0) { - this->unk_2D8 = 0; + if (this->dontUpdateSkel) { + 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); @@ -547,117 +573,118 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { } if (curFrame >= 11.0f) { - this->unk_59C++; - this->unk_598 = 0; + this->cutsceneState++; + this->cutsceneTimer = 0; this->subCamUp.x = 0.0f; } } break; - case 3: + case 3: // talking after landing if (curFrame >= this->animEndFrame) { - sp54 = this->unk_2CA * 4 + this->unk_2C8; + nextTextId = this->textType * 4 + this->textIdOffset; if (Player_GetMask(play) == PLAYER_MASK_STONE) { - if (D_80B8A8D0[sp54] == 0x11A5) { - sp54 = 8; - } else if (D_80B8A8D0[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, D_80B8A8D0[sp54], &this->picto.actor); - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_12); - this->unk_2C8++; - this->unk_598 = 0; - this->unk_59C++; + Message_StartTextbox(play, sKaizokuTextIds[nextTextId], &this->picto.actor); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_CHALLENGE); + this->textIdOffset++; // KAIZOKU_TALK_PLAYER_VICTORY, although that gets set directly later + this->cutsceneTimer = 0; + this->cutsceneState++; } break; - case 4: + case 4: // intro 2 dialogue if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) { Message_CloseTextbox(play); - this->unk_598 = 0; - this->unk_59C++; + 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; - case 5: - Math_ApproachF(&this->unk_5E0, 2.0f, 0.2f, 1.0f); + 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); } if (curFrame >= 30.0f) { - this->unk_598 = 0; - this->unk_59C++; + this->cutsceneTimer = 0; + this->cutsceneState++; } break; - case 6: - Math_ApproachF(&this->unk_5E0, 5.0f, 0.3f, 1.0f); + case 6: // finish pulling swords + Math_ApproachF(&this->subCamVelocity, 5.0f, 0.3f, 1.0f); if (curFrame >= this->animEndFrame) { - this->unk_598 = 7; - this->unk_2F8.x = 1.0f; - this->unk_59C++; - 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->cutsceneTimer = 7; + this->cutsceneState++; + this->swordScaleRight.x = 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; - case 7: - if (this->unk_598 == 0) { + 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); - this->unk_59C = 0; + this->cutsceneState = 0; this->subCamId = SUB_CAM_ID_DONE; this->picto.actor.flags &= ~ACTOR_FLAG_FREEZE_EXCEPTION; this->picto.actor.flags &= ~ACTOR_FLAG_LOCK_ON_DISABLED; this->picto.actor.flags |= ACTOR_FLAG_ATTENTION_ENABLED; - func_80B872A4(this); + EnKaizoku_SetupReady(this); } break; } - if (this->unk_59C < 7) { - s32 temp_v0_3 = this->unk_2EC * 8; + if (this->cutsceneState < 7) { + s32 cameraIndex = this->colorType * 8; - temp_v0_3 += this->unk_59C; - 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; + 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 = 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->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->unk_59C >= 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; + 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->unk_59C >= 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); + if (this->cutsceneState >= 5) { + 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) { @@ -667,7 +694,8 @@ void func_80B85FA8(EnKaizoku* this, PlayState* play) { } } -void func_80B86804(EnKaizoku* this, PlayState* play) { +// Player has lost the fight +void EnKaizoku_SetupPlayerLoss(EnKaizoku* this, PlayState* play) { if (this->subCamId == SUB_CAM_ID_DONE) { if (!CutsceneManager_IsNext(this->csId)) { CutsceneManager_Queue(this->csId); @@ -678,17 +706,17 @@ 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->combatTimer = 30; this->picto.actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - this->unk_598 = 0; - this->unk_59C = 0; - this->unk_2D8 = 0; - this->action = KAIZOKU_ACTION_0; - this->actionFunc = func_80B868B8; + this->cutsceneTimer = 0; + this->cutsceneState = 0; + this->dontUpdateSkel = false; + this->action = KAIZOKU_ACTION_HIDDEN; + this->actionFunc = EnKaizoku_PlayerLoss; this->picto.actor.speed = 0.0f; } -void func_80B868B8(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); @@ -700,30 +728,30 @@ 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) { - case 0: + switch (this->cutsceneState) { + case 0: // waiting for animation to change if (curFrame >= this->animEndFrame) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_14); - this->unk_2C8 = 3; - this->unk_598 = 0; - this->unk_59C++; + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_LOWER_WEAPONS); + this->textIdOffset = KAIZOKU_TALK_PLAYER_DEFEAT; + this->cutsceneTimer = 0; + this->cutsceneState++; } break; - case 1: + case 1: // wait for weapons to finish lowering if (curFrame >= this->animEndFrame) { s32 textId; - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_15); - textId = this->unk_2CA * 4 + this->unk_2C8; - Message_StartTextbox(play, D_80B8A8D0[textId], &this->picto.actor); + 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->unk_59C++; + this->cutsceneTimer = 0; + this->cutsceneState++; } 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); @@ -733,8 +761,8 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { gSaveContext.nextCutsceneIndex = 0; Scene_SetExitFade(play); play->transitionTrigger = TRANS_TRIGGER_START; - this->unk_59C++; - this->action = KAIZOKU_ACTION_16; + this->cutsceneState++; + this->action = KAIZOKU_ACTION_SCENE_FADE; } break; @@ -750,49 +778,50 @@ void func_80B868B8(EnKaizoku* this, PlayState* play) { } } -void func_80B86B58(EnKaizoku* this) { - this->unk_2D8 = 0; - this->action = KAIZOKU_ACTION_0; - this->actionFunc = func_80B86B74; +// Player has won the fight +void EnKaizoku_SetupPlayerWinCutscene(EnKaizoku* this) { + this->dontUpdateSkel = false; + this->action = KAIZOKU_ACTION_HIDDEN; + this->actionFunc = EnKaizoku_PlayerWinCutscene; } -void func_80B86B74(EnKaizoku* this, PlayState* play) { +void EnKaizoku_PlayerWinCutscene(EnKaizoku* this, PlayState* play) { Player* player = GET_PLAYER(play); s32 textId; f32 curFrame = this->skelAnime.curFrame; - if (this->unk_59C < 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; 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 = Math_Vec3f_Yaw(&player->actor.world.pos, &this->picto.actor.world.pos); - switch (this->unk_59C) { - case 0: - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_17); - this->unk_2C8 = 2; - textId = this->unk_2CA * 4 + this->unk_2C8; - Message_StartTextbox(play, D_80B8A8D0[textId], &this->picto.actor); - this->unk_2D9 = 0; - this->unk_598 = 0; - this->unk_59C++; + switch (this->cutsceneState) { + case 0: // start: change animation and start talking + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DEFEAT_IDLE); + this->textIdOffset = KAIZOKU_TALK_PLAYER_VICTORY; + textId = this->textType * 4 + this->textIdOffset; + Message_StartTextbox(play, sKaizokuTextIds[textId], &this->picto.actor); + this->defeatBreathingStarted = false; + this->cutsceneTimer = 0; + this->cutsceneState++; break; - case 1: + case 1: // talking if (curFrame >= this->animEndFrame) { - if (this->unk_2D9 == 0) { + if (this->defeatBreathingStarted == false) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DAMM_BREATH); - this->unk_2D9 = 1; + this->defeatBreathingStarted = true; } else { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } @@ -800,72 +829,75 @@ 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->unk_59C++; + this->flashTimer = 0; + this->cutsceneTimer = 0; + this->cutsceneState++; } 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; + 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; - 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->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->unk_5A0 == 0x12) { - Actor* temp_v0_2; + if (this->flashTimer == 18) { + 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 >= 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; 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 >= 40)) { this->picto.actor.draw = NULL; - this->unk_598 = 10; - Math_Vec3f_Copy(&this->unk_2F8, &gZeroVec3f); - Math_Vec3f_Copy(&this->unk_304, &gZeroVec3f); - this->unk_59C++; + this->cutsceneTimer = 10; + Math_Vec3f_Copy(&this->swordScaleRight, &gZeroVec3f); + Math_Vec3f_Copy(&this->swordScaleLeft, &gZeroVec3f); + this->cutsceneState++; } 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; + case 3: // nut flash is dissapearing + 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; play->envCtx.screenFillColor[2] = 0; play->envCtx.screenFillColor[3] = 0; play->envCtx.fillScreen = false; - this->unk_59C = 0; + this->cutsceneState = 0; this->subCamId = SUB_CAM_ID_DONE; Player_SetCsActionWithHaltedActors(play, &this->picto.actor, PLAYER_CSACTION_END); CutsceneManager_Stop(this->csId); @@ -880,13 +912,13 @@ void func_80B86B74(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; @@ -896,47 +928,48 @@ void func_80B86B74(EnKaizoku* this, PlayState* play) { } } -void func_80B872A4(EnKaizoku* this) { +// Combat idle +void EnKaizoku_SetupReady(EnKaizoku* this) { this->picto.actor.speed = 0.0f; - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_0); - this->action = KAIZOKU_ACTION_1; - this->actionFunc = func_80B872F4; + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_FIGHTING_IDLE); + 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)) { - 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 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) && - (yawDiff >= 0x1F40)) { + (angleToPlayer >= 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)) { - if ((Rand_ZeroOne() > 0.5f) || (ABS_ALT(yawDiff) < 0x3000)) { - func_80B88214(this); + if ((Rand_ZeroOne() > 0.5f) || (ABS_ALT(angleToPlayer) < 0x3000)) { + EnKaizoku_SetupRollForward(this); } else { - func_80B88910(this); + EnKaizoku_SetupSpinAttack(this); } } else if (Rand_ZeroOne() > 0.1f) { - func_80B8833C(this); + EnKaizoku_SetupAdvance(this); } else { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } } else { - func_80B88770(this); + EnKaizoku_SetupPivot(this); } } } -void func_80B874D8(EnKaizoku* this, PlayState* play) { +void EnKaizoku_SetupSpinDodge(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) { @@ -949,16 +982,16 @@ 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->action = KAIZOKU_ACTION_2; - this->unk_2E0 = 0.0f; - this->actionFunc = func_80B8760C; + this->combatTimer = 6; + this->action = KAIZOKU_ACTION_SPIN_DODGE; + this->circlingRate = 0.0f; + this->actionFunc = EnKaizoku_SpinDodge; } -void func_80B8760C(EnKaizoku* this, PlayState* play) { - s16 var_v0; - s32 temp_ft0; - s32 temp_ft1; +void EnKaizoku_SpinDodge(EnKaizoku* this, PlayState* play) { + s16 wallAngle; + s32 beforeCurFrame; + s32 afterCurFrame; this->picto.actor.world.rot.y = this->picto.actor.yawTowardsPlayer + 0x3A98; if ((this->picto.actor.bgCheckFlags & BGCHECKFLAG_WALL) || @@ -966,40 +999,40 @@ void func_80B8760C(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) { - func_80B87C7C(this); + if (ABS_ALT(wallAngle) > 0x4000) { + EnKaizoku_SetupJump(this); return; } } if (this->picto.actor.xzDistToPlayer <= 65.0f) { - Math_ApproachF(&this->unk_2E0, -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->unk_2E0, 4.0f, 1.0f, 1.5f); + Math_ApproachF(&this->circlingRate, 4.0f, 1.0f, 1.5f); } else { - Math_ApproachZeroF(&this->unk_2E0, 1.0f, 6.65f); + Math_ApproachZeroF(&this->circlingRate, 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->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; - 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); } @@ -1007,13 +1040,13 @@ void func_80B8760C(EnKaizoku* this, PlayState* play) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_BREATH); } - if (this->unk_2B2 == 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); + EnKaizoku_SetupRollBack(this); } } } else if (this->picto.actor.speed >= 0.0f) { @@ -1023,81 +1056,81 @@ void func_80B8760C(EnKaizoku* this, PlayState* play) { } } -void func_80B87900(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_7); +void EnKaizoku_SetupBlock(EnKaizoku* this) { + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_BLOCK); if (this->swordState != 0) { this->swordState = -1; } - this->unk_2D8 = 0; + this->dontUpdateSkel = false; this->picto.actor.speed = 0.0f; - this->unk_2B2 = 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->action = KAIZOKU_ACTION_BLOCK; + 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; + s16 angleToPlayer; - this->unk_2D8 = 1; - if (this->unk_2B2 == 0) { + this->dontUpdateSkel = true; + if (this->combatTimer == 0) { this->skelAnime.playSpeed = 1.0f; } if (this->lookTimer == 0) { - this->unk_2D8 = 0; - temp_v0 = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; - if ((ABS_ALT(temp_v0) <= 0x4000) && (this->picto.actor.xzDistToPlayer < 40.0f) && + this->dontUpdateSkel = false; + 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) { this->bodyCollider.base.acFlags &= ~AC_HARD; - func_80B874D8(this, play); - } else if (!(play->gameplayFrames & 1)) { - func_80B87900(this); + EnKaizoku_SetupSpinDodge(this, play); + } else if ((play->gameplayFrames % 2) == 0) { + 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; - if (ABS_ALT(temp_v0) < 0x4000) { + angleToPlayer = player->actor.shape.rot.y - this->picto.actor.shape.rot.y; + if (ABS_ALT(angleToPlayer) < 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->unk_2B2 == 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_SetupJump(this); } else { this->bodyCollider.base.acFlags &= ~AC_HARD; - func_80B87E28(this); + EnKaizoku_SetupRollBack(this); } } else { - func_80B87900(this); + EnKaizoku_SetupBlock(this); } } } } -void func_80B87C7C(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_8); +void EnKaizoku_SetupJump(EnKaizoku* this) { + 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); @@ -1105,30 +1138,32 @@ void func_80B87C7C(EnKaizoku* this) { this->bodyCollider.elem.elemMaterial = ELEM_MATERIAL_UNK4; this->bodyCollider.base.colMaterial = COL_MATERIAL_NONE; this->swordCollider.elem.elemMaterial = ELEM_MATERIAL_UNK4; - this->action = KAIZOKU_ACTION_6; - this->actionFunc = func_80B87D3C; + this->action = KAIZOKU_ACTION_JUMP; + this->actionFunc = EnKaizoku_Jump; } -Color_RGBA8 D_80B8AC58 = { 200, 160, 120, 255 }; -Color_RGBA8 D_80B8AC5C = { 130, 90, 50, 255 }; +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 func_80B87CF8(PlayState* play, Vec3f* pos) { - EffectSsKirakira_SpawnSmall(play, pos, &D_80B8AC60, &D_80B8AC6C, &D_80B8AC58, &D_80B8AC5C); +// Used for backflip +void EnKaizoku_SpawnVerticalFootDust(PlayState* play, Vec3f* pos) { + EffectSsKirakira_SpawnSmall(play, pos, &sKaizokuDustVelocity, &sKaizokuDustAccel, &sKaizokuDustPrimColor, + &sKaizokuDustEnvColor); } -void func_80B87D3C(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); if (this->picto.actor.velocity.y >= 5.0f) { - func_80B87CF8(play, &this->leftFootPos); - func_80B87CF8(play, &this->rightFootPos); + EnKaizoku_SpawnVerticalFootDust(play, &this->leftFootPos); + EnKaizoku_SpawnVerticalFootDust(play, &this->rightFootPos); } - this->unk_2D8 = 0; + this->dontUpdateSkel = false; if ((curFrame >= this->animEndFrame) && (this->picto.actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_GROUND_TOUCH))) { this->bodyCollider.elem.elemMaterial = ELEM_MATERIAL_UNK1; @@ -1139,32 +1174,32 @@ 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); } } -void func_80B87E28(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_8); +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); this->bodyCollider.elem.elemMaterial = ELEM_MATERIAL_UNK4; this->bodyCollider.base.colMaterial = COL_MATERIAL_NONE; this->swordCollider.elem.elemMaterial = ELEM_MATERIAL_UNK4; - this->action = KAIZOKU_ACTION_7; - this->actionFunc = func_80B87E9C; + 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; } -void func_80B87E9C(EnKaizoku* this, PlayState* play) { +void EnKaizoku_RollBack(EnKaizoku* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - this->unk_2D8 = 0; + 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 { - func_80B87900(this); + EnKaizoku_SetupBlock(this); } } if (!(play->state.frames & 0x5F)) { @@ -1172,26 +1207,27 @@ void func_80B87E9C(EnKaizoku* this, PlayState* play) { } } -void func_80B87F70(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_9); - this->unk_2D0 = 0; +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->action = KAIZOKU_ACTION_SLASH; + 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)) { @@ -1204,63 +1240,63 @@ void func_80B87FDC(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; } - this->unk_2D8 = 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); + EnKaizoku_ReactToPlayer(this, play, true); } } else { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } } } } -void func_80B88214(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_8); - this->unk_2B2 = 0; +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->unk_2D8 = 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->unk_2B2 = 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)) { @@ -1268,19 +1304,19 @@ void func_80B88278(EnKaizoku* this, PlayState* play) { } } -void func_80B8833C(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_4); - this->action = KAIZOKU_ACTION_4; - this->actionFunc = func_80B88378; +void EnKaizoku_SetupAdvance(EnKaizoku* this) { + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_WALK); + 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 (!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) { @@ -1292,45 +1328,46 @@ 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) { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); return; } } - 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) { - 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); + 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 { - func_80B88CD8(this); + 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 { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); return; } } @@ -1339,39 +1376,40 @@ 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); } } } } -void func_80B88770(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_3); - this->action = KAIZOKU_ACTION_10; - this->actionFunc = func_80B887AC; +void EnKaizoku_SetupPivot(EnKaizoku* this) { + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SIDESTEP); + this->action = KAIZOKU_ACTION_PIVOT; + this->actionFunc = EnKaizoku_Pivot; } -void func_80B887AC(EnKaizoku* this, PlayState* play) { - s16 temp_v0; - s16 var_a2; +void EnKaizoku_Pivot(EnKaizoku* this, PlayState* play) { + s16 angleToPlayer; + s16 turnRate; - 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; + if (!EnKaizoku_DodgeRanged(this, play) && !EnKaizoku_ReactToPlayer(this, play, false)) { + angleToPlayer = this->picto.actor.yawTowardsPlayer - this->picto.actor.shape.rot.y; + if (angleToPlayer > 0) { + turnRate = TRUNCF_BINANG(angleToPlayer * 0.25f) + 0x7D0; } else { - var_a2 = TRUNCF_BINANG(temp_v0 * 0.25f) - 0x7D0; + turnRate = TRUNCF_BINANG(angleToPlayer * 0.25f) - 0x7D0; } - this->picto.actor.shape.rot.y += var_a2; + this->picto.actor.shape.rot.y += turnRate; this->picto.actor.world.rot.y = this->picto.actor.shape.rot.y; this->skelAnime.playSpeed = 1.0f; if (Actor_IsFacingPlayer(&this->picto.actor, 0x1388)) { if (Rand_ZeroOne() > 0.8f) { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } else { - func_80B8833C(this); + EnKaizoku_SetupAdvance(this); } } if (!(play->gameplayFrames & 0x5F)) { @@ -1380,28 +1418,29 @@ void func_80B887AC(EnKaizoku* this, PlayState* play) { } } -void func_80B88910(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_10); +void EnKaizoku_SetupSpinAttack(EnKaizoku* this) { + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_SPIN_ATTACK); this->swordCollider.base.atFlags &= ~(AT_BOUNCED | AT_HIT); - this->unk_2D0 = 0; - this->action = KAIZOKU_ACTION_11; - this->actionFunc = func_80B88964; + this->spinAttackState = 0; + 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 angleToPlayer; 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; } + // in OOT, player-getting-caught, laughing, cutscene code was here } if (this->skelAnime.curFrame <= 8.0f) { @@ -1418,76 +1457,76 @@ void func_80B88964(EnKaizoku* this, PlayState* play) { this->swordState = -1; } - this->unk_2D8 = 0; - if ((curFrame >= this->animEndFrame) && (this->unk_2D0 < 2)) { + this->dontUpdateSkel = false; + if ((curFrame >= this->animEndFrame) && (this->spinAttackState < 2)) { if (!Actor_IsFacingPlayer(&this->picto.actor, 0x1554)) { - func_80B872A4(this); - this->unk_2B2 = Rand_ZeroOne() * 5.0f + 5.0f; + EnKaizoku_SetupReady(this); + this->combatTimer = Rand_ZeroOne() * 5.0f + 5.0f; this->lookTimer = 46; return; } - if (this->unk_2D0 != 0) { - func_80B87E28(this); + if (this->spinAttackState != 0) { + EnKaizoku_SetupRollBack(this); return; } if ((Rand_ZeroOne() > 0.7f) || (this->picto.actor.xzDistToPlayer >= 120.0f)) { - func_80B872A4(this); - this->unk_2B2 = 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); + // 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) { + 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; - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } else { - func_80B85A00(this, play, true); + EnKaizoku_ReactToPlayer(this, play, true); } } else { - func_80B88CD8(this); + EnKaizoku_SetupCircle(this); } } } -void func_80B88CD8(EnKaizoku* this) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_3); +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->unk_2B2 = 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->circlingRate = 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) && !EnKaizoku_ReactToPlayer(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; @@ -1521,22 +1560,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->circlingRate, -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->circlingRate, 4.0f, 1.0f, 1.5f); } else { - Math_ApproachZeroF(&this->unk_2E0, 1.0f, 6.65f); + Math_ApproachZeroF(&this->circlingRate, 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->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; } - 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); } } @@ -1546,50 +1585,48 @@ void func_80B88D6C(EnKaizoku* this, PlayState* play) { } if (this->picto.actor.xzDistToPlayer <= 65.0f) { - func_80B87F70(this); - } else if (this->unk_2B2 == 0) { + 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 { - func_80B872A4(this); + EnKaizoku_SetupReady(this); } } } } -// 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; } - if (this->action == KAIZOKU_ACTION_11) { - EnKaizoku_ChangeAnim(this, EN_KAIZOKU_ANIM_5); + if (this->action == KAIZOKU_ACTION_SPIN_ATTACK) { + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DAMAGE); } 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->drawDmgEffTimer == 0)) { + this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } Actor_PlaySfx(&this->picto.actor, NA_SE_EN_COMMON_FREEZE); - this->unk_2D8 = 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; - this->actionFunc = func_80B89280; + this->action = KAIZOKU_ACTION_STUNNED; + 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->drawDmgEffTimer != 0) && (this->drawDmgEffTimer < 60)) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX; } } @@ -1604,99 +1641,99 @@ void func_80B89280(EnKaizoku* this, PlayState* play) { } } - if ((this->unk_2B6 == 0) && (this->unk_2B8 == 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->unk_2D8 = 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)) { Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); - this->unk_2B8 = 0; + this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->picto.actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; } } } -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); + Math_Vec3f_Copy(&this->velocity, &sp34); this->lookTimer = 0; - this->unk_2D8 = 0; + this->dontUpdateSkel = false; 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)) && - (this->unk_2B8 != 0)) { + (this->drawDmgEffTimer != 0)) { Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); - this->unk_2B8 = 0; + this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; this->picto.actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; } Actor_PlaySfx(&this->picto.actor, NA_SE_EN_PIRATE_DAMAGE); - this->action = KAIZOKU_ACTION_14; - this->actionFunc = func_80B894C0; + this->action = KAIZOKU_ACTION_DAMAGED; + this->actionFunc = EnKaizoku_Damaged; } -void func_80B894C0(EnKaizoku* this, PlayState* play) { - s16 temp_v0; +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 (!func_80B85858(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 (!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)) { - func_80B87C7C(this); + if (ABS_ALT(angleToWall) < 0x3000 && (this->picto.actor.xzDistToPlayer < 90.0f)) { + EnKaizoku_SetupJump(this); return; } } if ((this->picto.actor.xzDistToPlayer <= 65.0f) && ((play->gameplayFrames % 8) != 0)) { this->swordCollider.elem.elemMaterial = ELEM_MATERIAL_UNK2; - func_80B87F70(this); + EnKaizoku_SetupSlash(this); } else { - func_80B87E28(this); + EnKaizoku_SetupRollBack(this); } } } -void func_80B8960C(EnKaizoku* this, PlayState* play) { +void EnKaizoku_SetupDefeatKnockdown(EnKaizoku* this, PlayState* play) { Vec3f sp24; this->picto.actor.flags |= ACTOR_FLAG_FREEZE_EXCEPTION; 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); + Math_Vec3f_Copy(&this->velocity, &sp24); + EnKaizoku_ChangeAnim(this, KAIZOKU_ANIM_DEFEAT); if (((this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_SFX) || (this->drawDmgEffType == ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX)) && - (this->unk_2B8 == 0)) { + (this->drawDmgEffTimer == 0)) { this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } this->picto.actor.speed = 0.0f; - this->unk_2D8 = 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); this->picto.actor.flags |= ACTOR_FLAG_LOCK_ON_DISABLED; this->picto.actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; this->picto.actor.flags &= ~ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; - this->unk_598 = 0; - this->unk_59C = 0; - this->action = KAIZOKU_ACTION_15; - this->actionFunc = func_80B8971C; + this->cutsceneTimer = 0; + this->cutsceneState = 0; + 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; @@ -1710,11 +1747,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->drawDmgEffTimer == 0) { return; } Actor_SpawnIceEffects(play, &this->picto.actor, this->bodyPartsPos, KAIZOKU_BODYPART_MAX, 2, 0.7f, 0.4f); - this->unk_2B8 = 0; + this->drawDmgEffTimer = 0; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; } @@ -1729,19 +1766,19 @@ 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; 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); @@ -1757,17 +1794,16 @@ 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; - func_80B86B58(this); + this->dontUpdateSkel = false; + EnKaizoku_SetupPlayerWinCutscene(this); } else if (Animation_OnFrame(&this->skelAnime, 10.0f)) { Actor_PlaySfx(&this->picto.actor, NA_SE_EN_GERUDOFT_DOWN); } } -void func_80B89A08(EnKaizoku* this, PlayState* play) { - s32 sp64 = 0; - Vec3f sp58; - s32 i; +// Handle damage to player and from player +void EnKaizoku_UpdateDamage(EnKaizoku* this, PlayState* play) { + s32 wasHit = false; if (gSaveContext.save.saveInfo.playerData.health <= 0x10) { this->swordCollider.elem.atDmgInfo.damage = 0; @@ -1776,139 +1812,144 @@ 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; + 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_FREEZE_EXCEPTION; if (!CutsceneManager_IsNext(this->csId)) { CutsceneManager_Queue(this->csId); - this->actionFunc = func_80B86804; + this->actionFunc = EnKaizoku_SetupPlayerLoss; } else { CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); - this->actionFunc = func_80B86804; + this->actionFunc = EnKaizoku_SetupPlayerLoss; } 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)) { + if ((gSaveContext.save.saveInfo.playerData.health <= 0x10) && (this->action != KAIZOKU_ACTION_SCENE_FADE)) { Health_ChangeBy(play, 0x10); - this->unk_2D0 = 2; + this->spinAttackState = 2; this->subCamId = SUB_CAM_ID_DONE; this->picto.actor.flags |= ACTOR_FLAG_FREEZE_EXCEPTION; if (!CutsceneManager_IsNext(this->csId)) { CutsceneManager_Queue(this->csId); - this->actionFunc = func_80B86804; + this->actionFunc = EnKaizoku_SetupPlayerLoss; } else { CutsceneManager_StartWithPlayerCs(this->csId, &this->picto.actor); this->subCamId = CutsceneManager_GetCurrentSubCamId(this->picto.actor.csId); - this->actionFunc = func_80B86804; + this->actionFunc = EnKaizoku_SetupPlayerLoss; } return; } } + // 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; } } 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_ADVANCE) || (this->action == KAIZOKU_ACTION_READY))) { + EnKaizoku_SetupSlash(this); } - if ((this->bodyCollider.base.acFlags & AC_HIT) && (this->action > KAIZOKU_ACTION_0) && (this->unk_2D0 < 2) && - (this->action != KAIZOKU_ACTION_6) && (this->action != KAIZOKU_ACTION_12) && - (this->action != KAIZOKU_ACTION_14) && (this->action != KAIZOKU_ACTION_15)) { + 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); 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->unk_2B8 == 0)) { - this->unk_2B8 = 40; + (this->drawDmgEffTimer == 0)) { + this->drawDmgEffTimer = 40; 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->unk_2B8 == 0) { + this->drawDmgEffTimer == 0) { Actor_SetColorFilter(&this->picto.actor, COLORFILTER_COLORFLAG_BLUE, 120, COLORFILTER_BUFFLAG_OPA, 40); this->bodyCollider.elem.elemMaterial = ELEM_MATERIAL_UNK1; this->bodyCollider.base.colMaterial = COL_MATERIAL_HIT3; this->swordCollider.elem.elemMaterial = ELEM_MATERIAL_UNK2; - func_80B891B8(this); + EnKaizoku_SetupStunned(this); } break; - case KAIZOKU_DMGEFF_F: - if ((this->action != KAIZOKU_ACTION_5) && (this->action != KAIZOKU_ACTION_7) && - (this->action < KAIZOKU_ACTION_14)) { - sp64 = 1; + 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: - sp64 = 1; + case KAIZOKU_DMGEFF_ALWAYS_HIT: + wasHit = true; break; - case KAIZOKU_DMGEFF_D: - if (this->action == KAIZOKU_ACTION_13) { - sp64 = 1; - } else if (this->action != KAIZOKU_ACTION_6) { - func_80B87C7C(this); + case KAIZOKU_DMGEFF_STUNNED_ONLY: + if (this->action == KAIZOKU_ACTION_STUNNED) { + wasHit = true; + } else if (this->action != KAIZOKU_ACTION_JUMP) { + EnKaizoku_SetupJump(this); } break; - case KAIZOKU_DMGEFF_2: - if ((this->action != KAIZOKU_ACTION_5) && (this->action != KAIZOKU_ACTION_7) && - (this->action < KAIZOKU_ACTION_14)) { - this->unk_2B8 = 40; + case KAIZOKU_DMGEFF_FIRE_ARROW: + if ((this->action != KAIZOKU_ACTION_ROLL_FORWARD) && (this->action != KAIZOKU_ACTION_ROLL_BACK) && + (this->action < KAIZOKU_ACTION_DAMAGED)) { + this->drawDmgEffTimer = 40; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FIRE; - sp64 = 1; + wasHit = true; } break; 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->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->unk_2B8 = 80; + this->drawDmgEffTimer = 80; this->drawDmgEffType = ACTOR_DRAW_DMGEFF_FROZEN_SFX; this->drawDmgEffScale = 0.0f; this->drawDmgEffFrozenSteamScale = 1.5f; this->picto.actor.flags &= ~ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER; if (this->picto.actor.colChkInfo.health <= 0) { - func_80B8960C(this, play); + EnKaizoku_SetupDefeatKnockdown(this, play); } else { - func_80B891B8(this); + 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->unk_2B8 == 0)) { - this->unk_2B8 = 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, CLEAR_TAG_PARAMS(CLEAR_TAG_LARGE_LIGHT_RAYS)); - sp64 = 1; + wasHit = true; } break; @@ -1916,28 +1957,31 @@ 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) { - func_80B8960C(this, play); + EnKaizoku_SetupDefeatKnockdown(this, play); return; } this->bodyCollider.elem.elemMaterial = ELEM_MATERIAL_UNK1; this->bodyCollider.base.colMaterial = COL_MATERIAL_HIT3; this->swordCollider.elem.elemMaterial = ELEM_MATERIAL_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); + 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); @@ -1969,51 +2013,37 @@ 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) { EnKaizoku* this = (EnKaizoku*)thisx; PlayState* play = play2; - Vec3f sp34; - s32 pad; - if (this->unk_2D8 == 0) { + if (!this->dontUpdateSkel) { SkelAnime_Update(&this->skelAnime); } - if (this->action != KAIZOKU_ACTION_0) { - func_80B85900(this); + if (this->action != KAIZOKU_ACTION_HIDDEN) { + EnKaizoku_TurnHead(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->combatTimer); + DECR(this->lookTimer); + DECR(this->iceTimer); + DECR(this->cutsceneTimer); + DECR(this->drawDmgEffTimer); this->actionFunc(this, play); Actor_MoveWithGravity(&this->picto.actor); - if (this->action != KAIZOKU_ACTION_0) { - func_80B89A08(this, play); + if (this->action != KAIZOKU_ACTION_HIDDEN) { + EnKaizoku_UpdateDamage(this, play); } - if (this->action != KAIZOKU_ACTION_0) { + if (this->action != KAIZOKU_ACTION_HIDDEN) { Actor_SetFocus(&this->picto.actor, 60.0f); } @@ -2027,13 +2057,16 @@ void EnKaizoku_Update(Actor* thisx, PlayState* play2) { } if (this->picto.actor.bgCheckFlags & BGCHECKFLAG_GROUND) { - 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); - Math_ApproachZeroF(&this->unk_2F0, 1.0f, 5.0f); + Vec3f bounceVelocity; + s32 pad; + + 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->boyoBounceVelocity, 1.0f, 5.0f); } Actor_UpdateBgCheckInfo(play, &this->picto.actor, 35.0f, 40.0f, 35.0f, @@ -2041,7 +2074,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_HIDDEN)) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->bodyCollider.base); } if (this->swordState > 0) { @@ -2054,22 +2087,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_NECK) { 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_HEAD) { 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); @@ -2082,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]); @@ -2093,30 +2127,34 @@ 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_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)); 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_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_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++; if (this->bodyPartIndex >= KAIZOKU_BODYPART_MAX) { this->bodyPartIndex = 0; @@ -2127,11 +2165,11 @@ 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) { - Matrix_Scale(this->unk_2F8.x, this->unk_2F8.y, this->unk_2F8.z, MTXMODE_APPLY); + if (limbIndex == KAIZOKU_LIMB_RIGHT_SWORD) { + Matrix_Scale(this->swordScaleRight.x, this->swordScaleRight.y, this->swordScaleRight.z, MTXMODE_APPLY); } - if (limbIndex == KAIZOKU_LIMB_10) { - Matrix_Scale(this->unk_304.x, this->unk_304.y, this->unk_304.z, MTXMODE_APPLY); + if (limbIndex == KAIZOKU_LIMB_LEFT_SWORD) { + Matrix_Scale(this->swordScaleLeft.x, this->swordScaleLeft.y, this->swordScaleLeft.z, MTXMODE_APPLY); } } @@ -2150,8 +2188,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->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 c46592a930..eab21b7879 100644 --- a/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h +++ b/src/overlays/actors/ovl_En_Kaizoku/z_en_kaizoku.h @@ -12,29 +12,32 @@ 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 typedef enum EnKaizokuAnimation { - /* 0 */ EN_KAIZOKU_ANIM_0, - /* 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, - /* 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, - /* 19 */ EN_KAIZOKU_ANIM_MAX + /* 0 */ KAIZOKU_ANIM_FIGHTING_IDLE, + /* 1 */ KAIZOKU_ANIM_UNUSED_CONVERSATION, // from OOT: giving player membership card + /* 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, + /* 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, + /* 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 */ KAIZOKU_ANIM_MAX } EnKaizokuAnimation; typedef enum EnKaizokuBodyPart { @@ -56,6 +59,13 @@ typedef enum EnKaizokuBodyPart { /* 15 */ KAIZOKU_BODYPART_MAX } EnKaizokuBodyPart; +typedef enum KaizokuTextOffset { + /* 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 { /* 0x000 */ PictoActor picto; /* 0x148 */ SkelAnime skelAnime; @@ -63,36 +73,35 @@ typedef struct EnKaizoku { /* 0x21C */ Vec3s morphTable[KAIZOKU_LIMB_MAX]; /* 0x2AC */ EnKaizokuActionFunc actionFunc; /* 0x2B0 */ s16 action; - /* 0x2B2 */ s16 unk_2B2; + /* 0x2B2 */ s16 combatTimer; /* 0x2B4 */ s16 lookTimer; - /* 0x2B6 */ s16 unk_2B6; - /* 0x2B8 */ s16 unk_2B8; + /* 0x2B6 */ s16 iceTimer; + /* 0x2B8 */ s16 drawDmgEffTimer; /* 0x2BA */ s16 drawDmgEffType; /* 0x2BC */ s16 switchFlag; - /* 0x2BE */ s16 unk_2BE; /* 0x2C0 */ f32 drawDmgEffScale; /* 0x2C4 */ f32 drawDmgEffFrozenSteamScale; - /* 0x2C8 */ s16 unk_2C8; - /* 0x2CA */ s16 unk_2CA; + /* 0x2C8 */ s16 textIdOffset; // which of the 4 text states during interaction + /* 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; - /* 0x2D8 */ u8 unk_2D8; - /* 0x2D9 */ u8 unk_2D9; + /* 0x2D8 */ u8 dontUpdateSkel; + /* 0x2D9 */ u8 defeatBreathingStarted; /* 0x2DC */ f32 animEndFrame; - /* 0x2E0 */ f32 unk_2E0; + /* 0x2E0 */ f32 circlingRate; /* 0x2E4 */ EnKaizokuAnimation animIndex; /* 0x2E8 */ s32 bodyPartIndex; - /* 0x2EC */ s32 unk_2EC; - /* 0x2F0 */ f32 unk_2F0; - /* 0x2F4 */ s16 unk_2F4; - /* 0x2F8 */ Vec3f unk_2F8; - /* 0x304 */ Vec3f unk_304; + /* 0x2EC */ s32 colorType; + /* 0x2F0 */ f32 boyoBounceVelocity; + /* 0x2F4 */ s16 boyoBounceAngle; + /* 0x2F8 */ Vec3f swordScaleRight; + /* 0x304 */ Vec3f swordScaleLeft; /* 0x310 */ Vec3f bodyPartsPos[KAIZOKU_BODYPART_MAX]; - /* 0x3C4 */ Vec3f unk_3C4; + /* 0x3C4 */ Vec3f velocity; /* 0x3D0 */ s32 blureIndex; /* 0x3D4 */ ColliderCylinder bodyCollider; /* 0x420 */ ColliderQuad swordCollider; @@ -101,20 +110,19 @@ typedef struct EnKaizoku { /* 0x578 */ Vec3s headRot; /* 0x580 */ Vec3f rightFootPos; /* 0x58C */ Vec3f leftFootPos; - /* 0x598 */ s32 unk_598; - /* 0x59C */ s16 unk_59C; + /* 0x598 */ s32 cutsceneTimer; + /* 0x59C */ s16 cutsceneState; /* 0x59E */ s16 subCamId; - /* 0x5A0 */ s16 unk_5A0; - /* 0x5A2 */ s16 unk_5A2; + /* 0x5A0 */ s16 flashTimer; /* 0x5A4 */ Vec3f subCamEye; /* 0x5B0 */ Vec3f subCamAt; /* 0x5BC */ Vec3f subCamUp; - /* 0x5C8 */ Vec3f unk_5C8; - /* 0x5D4 */ Vec3f unk_5D4; - /* 0x5E0 */ f32 unk_5E0; - /* 0x5E4 */ f32 unk_5E4; - /* 0x5E8 */ f32 unk_5E8; - /* 0x5EC */ f32 unk_5EC; + /* 0x5C8 */ Vec3f subCamEyeTarget; + /* 0x5D4 */ Vec3f subCamAtTarget; + /* 0x5E0 */ f32 subCamVelocity; + /* 0x5E4 */ f32 unk_5E4; // unused + /* 0x5E8 */ f32 flashScreenAlpha; + /* 0x5EC */ f32 flashScreenAlphaTarget; } EnKaizoku; // size = 0x5F0 #endif // Z_EN_KAIZOKU_H 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 039e618f4a..ae77d36db5 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) { diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index c4a25bd36c..157d38bfb9 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -14656,47 +14656,47 @@ 0x80B8504C:("BgDblueWaterfall_Draw",), 0x80B85590:("EnKaizoku_Init",), 0x80B85800:("EnKaizoku_Destroy",), - 0x80B85858:("func_80B85858",), - 0x80B85900:("func_80B85900",), - 0x80B85A00:("func_80B85A00",), + 0x80B85858:("EnKaizoku_DodgeRanged",), + 0x80B85900:("EnKaizoku_TurnHead",), + 0x80B85A00:("EnKaizoku_ReactToPlayer",), 0x80B85E18:("EnKaizoku_ChangeAnim",), 0x80B85EA0:("EnKaizoku_ValidatePictograph",), - 0x80B85F48:("func_80B85F48",), - 0x80B85FA8:("func_80B85FA8",), - 0x80B86804:("func_80B86804",), - 0x80B868B8:("func_80B868B8",), - 0x80B86B58:("func_80B86B58",), - 0x80B86B74:("func_80B86B74",), - 0x80B872A4:("func_80B872A4",), - 0x80B872F4:("func_80B872F4",), - 0x80B874D8:("func_80B874D8",), - 0x80B8760C:("func_80B8760C",), - 0x80B87900:("func_80B87900",), - 0x80B8798C:("func_80B8798C",), - 0x80B87C7C:("func_80B87C7C",), - 0x80B87CF8:("func_80B87CF8",), - 0x80B87D3C:("func_80B87D3C",), - 0x80B87E28:("func_80B87E28",), - 0x80B87E9C:("func_80B87E9C",), - 0x80B87F70:("func_80B87F70",), - 0x80B87FDC:("func_80B87FDC",), - 0x80B88214:("func_80B88214",), - 0x80B88278:("func_80B88278",), - 0x80B8833C:("func_80B8833C",), - 0x80B88378:("func_80B88378",), - 0x80B88770:("func_80B88770",), - 0x80B887AC:("func_80B887AC",), - 0x80B88910:("func_80B88910",), - 0x80B88964:("func_80B88964",), - 0x80B88CD8:("func_80B88CD8",), - 0x80B88D6C:("func_80B88D6C",), - 0x80B891B8:("func_80B891B8",), - 0x80B89280:("func_80B89280",), - 0x80B893CC:("func_80B893CC",), - 0x80B894C0:("func_80B894C0",), - 0x80B8960C:("func_80B8960C",), - 0x80B8971C:("func_80B8971C",), - 0x80B89A08:("func_80B89A08",), + 0x80B85F48:("EnKaizoku_SetupWaitForApproach",), + 0x80B85FA8:("EnKaizoku_WaitForApproach",), + 0x80B86804:("EnKaizoku_SetupPlayerLoss",), + 0x80B868B8:("EnKaizoku_PlayerLoss",), + 0x80B86B58:("EnKaizoku_SetupPlayerWinCutscene",), + 0x80B86B74:("EnKaizoku_PlayerWinCutscene",), + 0x80B872A4:("EnKaizoku_SetupReady",), + 0x80B872F4:("EnKaizoku_Ready",), + 0x80B874D8:("EnKaizoku_SetupSpinDodge",), + 0x80B8760C:("EnKaizoku_SpinDodge",), + 0x80B87900:("EnKaizoku_SetupBlock",), + 0x80B8798C:("EnKaizoku_Block",), + 0x80B87C7C:("EnKaizoku_SetupJump",), + 0x80B87CF8:("EnKaizoku_SpawnVerticalFootDust",), + 0x80B87D3C:("EnKaizoku_Jump",), + 0x80B87E28:("EnKaizoku_SetupRollBack",), + 0x80B87E9C:("EnKaizoku_RollBack",), + 0x80B87F70:("EnKaizoku_SetupSlash",), + 0x80B87FDC:("EnKaizoku_Slash",), + 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",), + 0x80B89280:("EnKaizoku_Stunned",), + 0x80B893CC:("EnKaizoku_SetupDamaged",), + 0x80B894C0:("EnKaizoku_Damaged",), + 0x80B8960C:("EnKaizoku_SetupDefeatKnockdown",), + 0x80B8971C:("EnKaizoku_DefeatKnockdown",), + 0x80B89A08:("EnKaizoku_UpdateDamage",), 0x80B8A0A0:("EnKaizoku_Update",), 0x80B8A318:("EnKaizoku_OverrideLimbDraw",), 0x80B8A468:("EnKaizoku_PostLimbDraw",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index f752e671c4..b148a6032b 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -14833,7 +14833,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),