Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WeaponInfo docs #1596

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,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);
Expand Down
4 changes: 2 additions & 2 deletions include/z64player.h
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,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
Expand Down
112 changes: 63 additions & 49 deletions src/code/z_player_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,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;
Expand Down Expand Up @@ -1290,30 +1290,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;
}
}
Expand Down Expand Up @@ -1342,33 +1354,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 };
Comment on lines +1491 to +1499
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the comments help greatly, the variable names themselves are quite confusing for me currently. I initially couldnt tell if this was the position of the left hand or what.

Using "offset" from the previous comment, it would be something like
sMeleeWeaponTipOffsetFromLeftHand0. This tells me that its the position of something relative to something else (and the fact that its in model space is imo clear by its usage instantly, and doesnt need to be in the name)


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]);
}
}

Expand Down Expand Up @@ -1399,20 +1413,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) {
Expand Down Expand Up @@ -1497,17 +1511,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]);
}
}

Expand All @@ -1520,16 +1534,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
Expand Down
16 changes: 8 additions & 8 deletions src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Arms_Hook/z_arms_hook.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/overlays/actors/ovl_En_Arrow/z_en_arrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,36 +414,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 };
Comment on lines +418 to +419
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently we dont have a convention for naming these types of vectors. So maybe its something we need to solve outside of this PR. But, suffixing "model" isnt all that common so far for these.

Most often youll see "offset" used. As in, posA is 400 units in the y direction and 1500 units in the z direction from the base position of whatever the relevant entity is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"offset" makes it sound like it's just an addition though, when in fact the transformation also involves scaling and rotation (or any other linear transform but typically TRS)

It seems more typical/robust to me to specify the coordinates system a position is expressed in, here the "left hand limb (model) space"

I don't like the jumbled mess of words it comes out as either, but I don't really see a better option and apparently this is how I named similar coordinates in this file in the past (e.g. sPlayerFocusHeadLimbModelPos in #1230), it wasn't challenged then (just to say that other stuff would need changing too)

Brainstorming based on sPlayerFocusHeadLimbModelPos

  • sPlayerFocusPosHeadLimbSpace
  • sPlayerFocusPos_HeadLimbSpace
  • sPlayerFocusPos_HeadLimb

🤔

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);
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/overlays/actors/ovl_En_Boom/z_en_boom.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,22 +247,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);
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_En_Boom/z_en_boom.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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

Expand Down
10 changes: 5 additions & 5 deletions src/overlays/actors/ovl_En_Butte/z_en_butte.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);

Expand All @@ -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);
Expand Down
Loading