diff --git a/include/functions.h b/include/functions.h index 7b437bfdb70..19113048f62 100644 --- a/include/functions.h +++ b/include/functions.h @@ -366,7 +366,7 @@ s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, G void* thisx); s32 Player_OverrideLimbDrawGameplayCrawling(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx); -u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase); +u8 Player_UpdateWeaponInfo(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newPosA, Vec3f* newPosB); void Player_DrawGetItem(PlayState* play, Player* this); void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx); u32 Player_InitPauseDrawData(PlayState* play, u8* segment, SkelAnime* skelAnime); diff --git a/include/z64player.h b/include/z64player.h index 79c38271c09..4e78aee6ed6 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -657,8 +657,8 @@ typedef struct PlayerAgeProperties { typedef struct WeaponInfo { /* 0x00 */ s32 active; - /* 0x04 */ Vec3f tip; - /* 0x10 */ Vec3f base; + /* 0x04 */ Vec3f posA; // For melee weapons, this is the tip (furthest from the player hand) + /* 0x10 */ Vec3f posB; // For melee weapons, this is the base (near the player hand) } WeaponInfo; // size = 0x1C #define LEDGE_DIST_MAX 399.96002f diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index ca4952c57fd..c599af063dd 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -789,7 +789,7 @@ int Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 y s32 pad; if ((this->heldItemAction == PLAYER_IA_DEKU_STICK) && (this->unk_860 != 0)) { - Math_Vec3f_Diff(&this->meleeWeaponInfo[0].tip, pos, &diff); + Math_Vec3f_Diff(&this->meleeWeaponInfo[0].posA, pos, &diff); return ((SQ(diff.x) + SQ(diff.z)) <= SQ(xzRange)) && (0.0f <= diff.y) && (diff.y <= yRange); } else { return false; @@ -1424,30 +1424,42 @@ s32 Player_OverrideLimbDrawGameplayCrawling(PlayState* play, s32 limbIndex, Gfx* return false; } -u8 func_80090480(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newTip, Vec3f* newBase) { - if (weaponInfo->active == 0) { +/** + * Handles colliders for player weapons, by creating a quad collider each frame between the weapon's previous position + * and its new position. + * This position is given as a pair, `newPosA` and `newPosB`, representing two ends of a line that can be thought of as + * the active part of the weapon. Note that this line is not necessarily following the weapon's shape: for example + * arrows use a line perpendicular to the shaft. + * @param collider The quad collider to use for the weapon. + * @param newPosA One end of the line. For melee weapons, this is the tip. + * @param newPosB One end of the line. For melee weapons, this is the base. + * @return true if the weapon is active at a new position. + */ +u8 Player_UpdateWeaponInfo(PlayState* play, ColliderQuad* collider, WeaponInfo* weaponInfo, Vec3f* newPosA, + Vec3f* newPosB) { + if (!weaponInfo->active) { if (collider != NULL) { Collider_ResetQuadAT(play, &collider->base); } - Math_Vec3f_Copy(&weaponInfo->tip, newTip); - Math_Vec3f_Copy(&weaponInfo->base, newBase); - weaponInfo->active = 1; + Math_Vec3f_Copy(&weaponInfo->posA, newPosA); + Math_Vec3f_Copy(&weaponInfo->posB, newPosB); + weaponInfo->active = true; return true; - } else if ((weaponInfo->tip.x == newTip->x) && (weaponInfo->tip.y == newTip->y) && - (weaponInfo->tip.z == newTip->z) && (weaponInfo->base.x == newBase->x) && - (weaponInfo->base.y == newBase->y) && (weaponInfo->base.z == newBase->z)) { + } else if ((weaponInfo->posA.x == newPosA->x) && (weaponInfo->posA.y == newPosA->y) && + (weaponInfo->posA.z == newPosA->z) && (weaponInfo->posB.x == newPosB->x) && + (weaponInfo->posB.y == newPosB->y) && (weaponInfo->posB.z == newPosB->z)) { if (collider != NULL) { Collider_ResetQuadAT(play, &collider->base); } return false; } else { if (collider != NULL) { - Collider_SetQuadVertices(collider, newBase, newTip, &weaponInfo->base, &weaponInfo->tip); + Collider_SetQuadVertices(collider, newPosB, newPosA, &weaponInfo->posB, &weaponInfo->posA); CollisionCheck_SetAT(play, &play->colChkCtx, &collider->base); } - Math_Vec3f_Copy(&weaponInfo->base, newBase); - Math_Vec3f_Copy(&weaponInfo->tip, newTip); - weaponInfo->active = 1; + Math_Vec3f_Copy(&weaponInfo->posB, newPosB); + Math_Vec3f_Copy(&weaponInfo->posA, newPosA); + weaponInfo->active = true; return true; } } @@ -1476,33 +1488,35 @@ void Player_UpdateShieldCollider(PlayState* play, Player* this, ColliderQuad* co } } -Vec3f D_80126080 = { 5000.0f, 400.0f, 0.0f }; -Vec3f D_8012608C = { 5000.0f, -400.0f, 1000.0f }; -Vec3f D_80126098 = { 5000.0f, 1400.0f, -1000.0f }; +// Positions for the tip of melee weapons, in the left hand limb's own model space. +Vec3f sMeleeWeaponTipLeftHandLimbModelPos0 = { 5000.0f, 400.0f, 0.0f }; +Vec3f sMeleeWeaponTipLeftHandLimbModelPos1 = { 5000.0f, -400.0f, 1000.0f }; +Vec3f sMeleeWeaponTipLeftHandLimbModelPos2 = { 5000.0f, 1400.0f, -1000.0f }; -Vec3f D_801260A4[3] = { - { 0.0f, 400.0f, 0.0f }, - { 0.0f, 1400.0f, -1000.0f }, - { 0.0f, -400.0f, 1000.0f }, -}; +// Positions for the base of melee weapons, in the left hand limb's own model space. +Vec3f sMeleeWeaponBaseLeftHandLimbModelPos0 = { 0.0f, 400.0f, 0.0f }; +Vec3f sMeleeWeaponBaseLeftHandLimbModelPos1 = { 0.0f, 1400.0f, -1000.0f }; +Vec3f sMeleeWeaponBaseLeftHandLimbModelPos2 = { 0.0f, -400.0f, 1000.0f }; -void func_800906D4(PlayState* play, Player* this, Vec3f* newTipPos) { - Vec3f newBasePos[3]; +void Player_UpdateMeleeWeaponInfo(PlayState* play, Player* this, Vec3f* newTipPositions) { + Vec3f newBasePositions[3]; - Matrix_MultVec3f(&D_801260A4[0], &newBasePos[0]); - Matrix_MultVec3f(&D_801260A4[1], &newBasePos[1]); - Matrix_MultVec3f(&D_801260A4[2], &newBasePos[2]); + Matrix_MultVec3f(&sMeleeWeaponBaseLeftHandLimbModelPos0, &newBasePositions[0]); + Matrix_MultVec3f(&sMeleeWeaponBaseLeftHandLimbModelPos1, &newBasePositions[1]); + Matrix_MultVec3f(&sMeleeWeaponBaseLeftHandLimbModelPos2, &newBasePositions[2]); - if (func_80090480(play, NULL, &this->meleeWeaponInfo[0], &newTipPos[0], &newBasePos[0]) && + if (Player_UpdateWeaponInfo(play, NULL, &this->meleeWeaponInfo[0], &newTipPositions[0], &newBasePositions[0]) && !(this->stateFlags1 & PLAYER_STATE1_22)) { - EffectBlure_AddVertex(Effect_GetByIndex(this->meleeWeaponEffectIndex), &this->meleeWeaponInfo[0].tip, - &this->meleeWeaponInfo[0].base); + EffectBlure_AddVertex(Effect_GetByIndex(this->meleeWeaponEffectIndex), &this->meleeWeaponInfo[0].posA, + &this->meleeWeaponInfo[0].posB); } if ((this->meleeWeaponState > 0) && ((this->meleeWeaponAnimation < PLAYER_MWA_SPIN_ATTACK_1H) || (this->stateFlags2 & PLAYER_STATE2_17))) { - func_80090480(play, &this->meleeWeaponQuads[0], &this->meleeWeaponInfo[1], &newTipPos[1], &newBasePos[1]); - func_80090480(play, &this->meleeWeaponQuads[1], &this->meleeWeaponInfo[2], &newTipPos[2], &newBasePos[2]); + Player_UpdateWeaponInfo(play, &this->meleeWeaponQuads[0], &this->meleeWeaponInfo[1], &newTipPositions[1], + &newBasePositions[1]); + Player_UpdateWeaponInfo(play, &this->meleeWeaponQuads[1], &this->meleeWeaponInfo[2], &newTipPositions[2], + &newBasePositions[2]); } } @@ -1533,20 +1547,20 @@ void Player_DrawGetItem(PlayState* play, Player* this) { } } -void func_80090A28(Player* this, Vec3f* vecs) { - D_8012608C.x = D_80126080.x; +void Player_CalcMeleeWeaponTipPositions(Player* this, Vec3f* tipPositions) { + sMeleeWeaponTipLeftHandLimbModelPos1.x = sMeleeWeaponTipLeftHandLimbModelPos0.x; if (this->unk_845 >= 3) { this->unk_845++; - D_8012608C.x *= 1.0f + ((9 - this->unk_845) * 0.1f); + sMeleeWeaponTipLeftHandLimbModelPos1.x *= 1.0f + ((9 - this->unk_845) * 0.1f); } - D_8012608C.x += 1200.0f; - D_80126098.x = D_8012608C.x; + sMeleeWeaponTipLeftHandLimbModelPos1.x += 1200.0f; + sMeleeWeaponTipLeftHandLimbModelPos2.x = sMeleeWeaponTipLeftHandLimbModelPos1.x; - Matrix_MultVec3f(&D_80126080, &vecs[0]); - Matrix_MultVec3f(&D_8012608C, &vecs[1]); - Matrix_MultVec3f(&D_80126098, &vecs[2]); + Matrix_MultVec3f(&sMeleeWeaponTipLeftHandLimbModelPos0, &tipPositions[0]); + Matrix_MultVec3f(&sMeleeWeaponTipLeftHandLimbModelPos1, &tipPositions[1]); + Matrix_MultVec3f(&sMeleeWeaponTipLeftHandLimbModelPos2, &tipPositions[2]); } void Player_DrawHookshotReticle(PlayState* play, Player* this, f32 arg2) { @@ -1631,17 +1645,17 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve Math_Vec3f_Copy(&this->leftHandPos, sCurBodyPartPos); if (this->itemAction == PLAYER_IA_DEKU_STICK) { - Vec3f sp124[3]; + Vec3f tipPositions[3]; OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2633); if (this->actor.scale.y >= 0.0f) { - D_80126080.x = this->unk_85C * 5000.0f; - func_80090A28(this, sp124); + sMeleeWeaponTipLeftHandLimbModelPos0.x = this->unk_85C * 5000.0f; + Player_CalcMeleeWeaponTipPositions(this, tipPositions); if (this->meleeWeaponState != 0) { - func_800906D4(play, this, sp124); + Player_UpdateMeleeWeaponInfo(play, this, tipPositions); } else { - Math_Vec3f_Copy(&this->meleeWeaponInfo[0].tip, &sp124[0]); + Math_Vec3f_Copy(&this->meleeWeaponInfo[0].posA, &tipPositions[0]); } } @@ -1654,16 +1668,16 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2656); } else if ((this->actor.scale.y >= 0.0f) && (this->meleeWeaponState != 0)) { - Vec3f spE4[3]; + Vec3f tipPositions[3]; if (Player_HoldsBrokenKnife(this)) { - D_80126080.x = 1500.0f; + sMeleeWeaponTipLeftHandLimbModelPos0.x = 1500.0f; } else { - D_80126080.x = sMeleeWeaponLengths[Player_GetMeleeWeaponHeld(this)]; + sMeleeWeaponTipLeftHandLimbModelPos0.x = sMeleeWeaponLengths[Player_GetMeleeWeaponHeld(this)]; } - func_80090A28(this, spE4); - func_800906D4(play, this, spE4); + Player_CalcMeleeWeaponTipPositions(this, tipPositions); + Player_UpdateMeleeWeaponInfo(play, this, tipPositions); } else if ((*dList != NULL) && (this->leftHandType == PLAYER_MODELTYPE_LH_BOTTLE)) { //! @bug When Player is actively using shield, the `itemAction` value will be set to -1. //! If shield is used at the same time a bottle is in hand, `Player_ActionToBottle` will diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 63f929d43e9..916d28321f4 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -305,8 +305,8 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) { ArmsHook* this = (ArmsHook*)thisx; Player* player = GET_PLAYER(play); Vec3f sp78; - Vec3f hookNewTip; - Vec3f hookNewBase; + Vec3f posA; + Vec3f posB; f32 sp5C; f32 sp58; @@ -317,16 +317,16 @@ void ArmsHook_Draw(Actor* thisx, PlayState* play) { if ((ArmsHook_Shoot != this->actionFunc) || (this->timer <= 0)) { Matrix_MultVec3f(&D_80865B70, &this->unk_1E8); - Matrix_MultVec3f(&D_80865B88, &hookNewTip); - Matrix_MultVec3f(&D_80865B94, &hookNewBase); - this->hookInfo.active = 0; + Matrix_MultVec3f(&D_80865B88, &posA); + Matrix_MultVec3f(&D_80865B94, &posB); + this->weaponInfo.active = false; } else { Matrix_MultVec3f(&D_80865B7C, &this->unk_1E8); - Matrix_MultVec3f(&D_80865BA0, &hookNewTip); - Matrix_MultVec3f(&D_80865BAC, &hookNewBase); + Matrix_MultVec3f(&D_80865BA0, &posA); + Matrix_MultVec3f(&D_80865BAC, &posB); } - func_80090480(play, &this->collider, &this->hookInfo, &hookNewTip, &hookNewBase); + Player_UpdateWeaponInfo(play, &this->collider, &this->weaponInfo, &posA, &posB); Gfx_SetupDL_25Opa(play->state.gfxCtx); MATRIX_FINALIZE_AND_LOAD(POLY_OPA_DISP++, play->state.gfxCtx, "../z_arms_hook.c", 895); gSPDisplayList(POLY_OPA_DISP++, gLinkAdultHookshotTipDL); diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h index b624599a53d..53fd8ea9df8 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h @@ -11,7 +11,7 @@ typedef void (*ArmsHookActionFunc)(struct ArmsHook*, PlayState*); typedef struct ArmsHook { /* 0x0000 */ Actor actor; /* 0x014C */ ColliderQuad collider; - /* 0x01CC */ WeaponInfo hookInfo; + /* 0x01CC */ WeaponInfo weaponInfo; /* 0x01E8 */ Vec3f unk_1E8; /* 0x01F4 */ Vec3f unk_1F4; /* 0x0200 */ Actor* grabbed; diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index 6e5a1010fb9..9c21149e5a1 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -277,9 +277,9 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, PlayState* play) { webPos.x = this->dyna.actor.world.pos.x; webPos.y = this->dyna.actor.world.pos.y - 50.0f; webPos.z = this->dyna.actor.world.pos.z; - if (Player_IsBurningStickInRange(play, &webPos, 70.0f, 50.0f) != 0) { - this->dyna.actor.home.pos.x = player->meleeWeaponInfo[0].tip.x; - this->dyna.actor.home.pos.z = player->meleeWeaponInfo[0].tip.z; + if (Player_IsBurningStickInRange(play, &webPos, 70.0f, 50.0f)) { + this->dyna.actor.home.pos.x = player->meleeWeaponInfo[0].posA.x; + this->dyna.actor.home.pos.z = player->meleeWeaponInfo[0].posA.z; BgYdanSp_BurnWeb(this, play); return; } @@ -395,10 +395,10 @@ void BgYdanSp_WallWebIdle(BgYdanSp* this, PlayState* play) { this->dyna.actor.home.pos.y = this->dyna.actor.world.pos.y + 80.0f; BgYdanSp_BurnWeb(this, play); } else if (player->heldItemAction == PLAYER_IA_DEKU_STICK && player->unk_860 != 0) { - Actor_WorldToActorCoords(&this->dyna.actor, &sp30, &player->meleeWeaponInfo[0].tip); + Actor_WorldToActorCoords(&this->dyna.actor, &sp30, &player->meleeWeaponInfo[0].posA); if (fabsf(sp30.x) < 100.0f && sp30.z < 1.0f && sp30.y < 200.0f) { OnePointCutscene_Init(play, 3020, 40, &this->dyna.actor, CAM_ID_MAIN); - Math_Vec3f_Copy(&this->dyna.actor.home.pos, &player->meleeWeaponInfo[0].tip); + Math_Vec3f_Copy(&this->dyna.actor.home.pos, &player->meleeWeaponInfo[0].posA); BgYdanSp_BurnWeb(this, play); } } diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index 34bc646bd67..29d18a2ff18 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -415,36 +415,36 @@ void EnArrow_Update(Actor* thisx, PlayState* play) { } void func_809B4800(EnArrow* this, PlayState* play) { - static Vec3f D_809B4E88 = { 0.0f, 400.0f, 1500.0f }; - static Vec3f D_809B4E94 = { 0.0f, -400.0f, 1500.0f }; + static Vec3f sPosAModel = { 0.0f, 400.0f, 1500.0f }; + static Vec3f sPosBModel = { 0.0f, -400.0f, 1500.0f }; static Vec3f D_809B4EA0 = { 0.0f, 0.0f, -300.0f }; - Vec3f sp44; - Vec3f sp38; + Vec3f posA; + Vec3f posB; s32 addBlureVertex; Matrix_MultVec3f(&D_809B4EA0, &this->unk_21C); if (EnArrow_Fly == this->actionFunc) { - Matrix_MultVec3f(&D_809B4E88, &sp44); - Matrix_MultVec3f(&D_809B4E94, &sp38); + Matrix_MultVec3f(&sPosAModel, &posA); + Matrix_MultVec3f(&sPosBModel, &posB); if (this->actor.params <= ARROW_SEED) { addBlureVertex = this->actor.params <= ARROW_LIGHT; if (this->hitActor == NULL) { - addBlureVertex &= func_80090480(play, &this->collider, &this->weaponInfo, &sp44, &sp38); + addBlureVertex &= Player_UpdateWeaponInfo(play, &this->collider, &this->weaponInfo, &posA, &posB); } else { if (addBlureVertex) { - if ((sp44.x == this->weaponInfo.tip.x) && (sp44.y == this->weaponInfo.tip.y) && - (sp44.z == this->weaponInfo.tip.z) && (sp38.x == this->weaponInfo.base.x) && - (sp38.y == this->weaponInfo.base.y) && (sp38.z == this->weaponInfo.base.z)) { + if ((posA.x == this->weaponInfo.posA.x) && (posA.y == this->weaponInfo.posA.y) && + (posA.z == this->weaponInfo.posA.z) && (posB.x == this->weaponInfo.posB.x) && + (posB.y == this->weaponInfo.posB.y) && (posB.z == this->weaponInfo.posB.z)) { addBlureVertex = false; } } } if (addBlureVertex) { - EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &sp44, &sp38); + EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &posA, &posB); } } } diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 56f6bd34520..428c26f219d 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -248,22 +248,22 @@ void EnBoom_Update(Actor* thisx, PlayState* play) { } void EnBoom_Draw(Actor* thisx, PlayState* play) { - static Vec3f sMultVec1 = { -960.0f, 0.0f, 0.0f }; - static Vec3f sMultVec2 = { 960.0f, 0.0f, 0.0f }; + static Vec3f sPosAModel = { -960.0f, 0.0f, 0.0f }; + static Vec3f sPosBModel = { 960.0f, 0.0f, 0.0f }; EnBoom* this = (EnBoom*)thisx; - Vec3f vec1; - Vec3f vec2; + Vec3f posA; + Vec3f posB; OPEN_DISPS(play->state.gfxCtx, "../z_en_boom.c", 567); Matrix_RotateY(BINANG_TO_RAD(this->actor.world.rot.y), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD(0x1F40), MTXMODE_APPLY); Matrix_RotateX(BINANG_TO_RAD(this->actor.world.rot.x), MTXMODE_APPLY); - Matrix_MultVec3f(&sMultVec1, &vec1); - Matrix_MultVec3f(&sMultVec2, &vec2); + Matrix_MultVec3f(&sPosAModel, &posA); + Matrix_MultVec3f(&sPosBModel, &posB); - if (func_80090480(play, &this->collider, &this->boomerangInfo, &vec1, &vec2)) { - EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &vec1, &vec2); + if (Player_UpdateWeaponInfo(play, &this->collider, &this->weaponInfo, &posA, &posB)) { + EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &posA, &posB); } Gfx_SetupDL_25Opa(play->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.h b/src/overlays/actors/ovl_En_Boom/z_en_boom.h index 7a211880a4a..8077dddf1e8 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.h +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.h @@ -17,7 +17,7 @@ typedef struct EnBoom { /* 0x01D4 */ u8 returnTimer; // returns to Link when 0 /* 0x01D5 */ u8 activeTimer; // increments once every update /* 0x01D8 */ s32 effectIndex; - /* 0x01DC */ WeaponInfo boomerangInfo; + /* 0x01DC */ WeaponInfo weaponInfo; /* 0x01F8 */ EnBoomActionFunc actionFunc; } EnBoom; // size = 0x01FC diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index 4a93d3f8dd9..22b051d5ca5 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -303,9 +303,9 @@ void EnButte_FollowLink(EnButte* this, PlayState* play) { minAnimSpeed = 0.0f; if ((this->flightParamsIdx != 0) && (this->timer < 12)) { - swordTip.x = player->meleeWeaponInfo[0].tip.x + Math_SinS(player->actor.shape.rot.y) * 10.0f; - swordTip.y = player->meleeWeaponInfo[0].tip.y; - swordTip.z = player->meleeWeaponInfo[0].tip.z + Math_CosS(player->actor.shape.rot.y) * 10.0f; + swordTip.x = player->meleeWeaponInfo[0].posA.x + Math_SinS(player->actor.shape.rot.y) * 10.0f; + swordTip.y = player->meleeWeaponInfo[0].posA.y; + swordTip.z = player->meleeWeaponInfo[0].posA.z + Math_CosS(player->actor.shape.rot.y) * 10.0f; yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &swordTip) + (s16)(Rand_ZeroOne() * D_809CE410); if (Math_ScaledStepToS(&this->actor.world.rot.y, yaw, 2000) != 0) { @@ -317,7 +317,7 @@ void EnButte_FollowLink(EnButte* this, PlayState* play) { } } - this->posYTarget = MAX(player->actor.world.pos.y + 30.0f, player->meleeWeaponInfo[0].tip.y); + this->posYTarget = MAX(player->actor.world.pos.y + 30.0f, player->meleeWeaponInfo[0].posA.y); EnButte_Turn(this); @@ -337,7 +337,7 @@ void EnButte_FollowLink(EnButte* this, PlayState* play) { (this->swordDownTimer <= 0) && (distSqFromHome < SQ(320.0f)))) { EnButte_SetupFlyAround(this); } else if (distSqFromHome > SQ(240.0f)) { - distSqFromSword = Math3D_Dist2DSq(player->meleeWeaponInfo[0].tip.x, player->meleeWeaponInfo[0].tip.z, + distSqFromSword = Math3D_Dist2DSq(player->meleeWeaponInfo[0].posA.x, player->meleeWeaponInfo[0].posA.z, this->actor.world.pos.x, this->actor.world.pos.z); if (distSqFromSword < SQ(60.0f)) { EnButte_SetupTransformIntoFairy(this); diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index c6ff95c34c7..33d11ff2dc7 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -177,7 +177,7 @@ void ObjSyokudai_Update(Actor* thisx, PlayState* play2) { interactionType = 1; } } else if (player->heldItemAction == PLAYER_IA_DEKU_STICK) { - Math_Vec3f_Diff(&player->meleeWeaponInfo[0].tip, &this->actor.world.pos, &tipToFlame); + Math_Vec3f_Diff(&player->meleeWeaponInfo[0].posA, &this->actor.world.pos, &tipToFlame); tipToFlame.y -= 67.0f; if ((SQ(tipToFlame.x) + SQ(tipToFlame.y) + SQ(tipToFlame.z)) < SQ(20.0f)) { interactionType = -1; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index a7ec13a920a..f9ac4ace8d7 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -1701,7 +1701,7 @@ void func_808322FC(Player* this) { void func_80832318(Player* this) { this->stateFlags2 &= ~PLAYER_STATE2_17; this->meleeWeaponState = 0; - this->meleeWeaponInfo[0].active = this->meleeWeaponInfo[1].active = this->meleeWeaponInfo[2].active = 0; + this->meleeWeaponInfo[0].active = this->meleeWeaponInfo[1].active = this->meleeWeaponInfo[2].active = false; } void func_80832340(PlayState* play, Player* this) { @@ -8805,7 +8805,7 @@ s32 func_80842DF4(PlayState* play, Player* this) { s32 bgId; Vec3f sp68; Vec3f sp5C; - Vec3f sp50; + Vec3f baseToTip; s32 temp1; s32 surfaceMaterial; @@ -8815,18 +8815,18 @@ s32 func_80842DF4(PlayState* play, Player* this) { !(this->meleeWeaponQuads[1].base.atFlags & AT_BOUNCED)) { if (this->skelAnime.curFrame >= 2.0f) { - phi_f2 = Math_Vec3f_DistXYZAndStoreDiff(&this->meleeWeaponInfo[0].tip, - &this->meleeWeaponInfo[0].base, &sp50); + phi_f2 = Math_Vec3f_DistXYZAndStoreDiff(&this->meleeWeaponInfo[0].posA, + &this->meleeWeaponInfo[0].posB, &baseToTip); if (phi_f2 != 0.0f) { phi_f2 = (phi_f2 + 10.0f) / phi_f2; } - sp68.x = this->meleeWeaponInfo[0].tip.x + (sp50.x * phi_f2); - sp68.y = this->meleeWeaponInfo[0].tip.y + (sp50.y * phi_f2); - sp68.z = this->meleeWeaponInfo[0].tip.z + (sp50.z * phi_f2); + sp68.x = this->meleeWeaponInfo[0].posA.x + (baseToTip.x * phi_f2); + sp68.y = this->meleeWeaponInfo[0].posA.y + (baseToTip.y * phi_f2); + sp68.z = this->meleeWeaponInfo[0].posA.z + (baseToTip.z * phi_f2); - if (BgCheck_EntityLineTest1(&play->colCtx, &sp68, &this->meleeWeaponInfo[0].tip, &sp5C, &groundPoly, - true, false, false, true, &bgId) && + if (BgCheck_EntityLineTest1(&play->colCtx, &sp68, &this->meleeWeaponInfo[0].posA, &sp5C, + &groundPoly, true, false, false, true, &bgId) && !SurfaceType_IsIgnoredByEntities(&play->colCtx, groundPoly, bgId) && (SurfaceType_GetFloorType(&play->colCtx, groundPoly, bgId) != FLOOR_TYPE_6) && (func_8002F9EC(play, &this->actor, groundPoly, bgId, &sp5C) == 0)) { @@ -11177,7 +11177,7 @@ void Player_UpdateBurningDekuStick(PlayState* play, Player* this) { this->unk_85C = temp; } - func_8002836C(play, &this->meleeWeaponInfo[0].tip, &D_808547A4, &D_808547B0, &D_808547BC, &D_808547C0, + func_8002836C(play, &this->meleeWeaponInfo[0].posA, &D_808547A4, &D_808547B0, &D_808547BC, &D_808547C0, temp * 200.0f, 0, 8); }