From 9289b0211d8a54e0bc4de73fdaa0d47c32d5a190 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Fri, 2 Feb 2024 11:36:48 +1100 Subject: [PATCH] Retail `z_player_lib.c` OK (#1689) * z_player_lib OK * space * line break --- src/code/z_player_lib.c | 77 +++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 7a7d9c366c..5fc1c4863d 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1107,9 +1107,13 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** Matrix_RotateZ(BINANG_TO_RAD(this->unk_6C0), MTXMODE_APPLY); } } else if (limbIndex == PLAYER_LIMB_L_THIGH) { + s32 pad; + func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN, PLAYER_LIMB_L_FOOT); } else if (limbIndex == PLAYER_LIMB_R_THIGH) { + s32 pad; + func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_R_THIGH, PLAYER_LIMB_R_SHIN, PLAYER_LIMB_R_FOOT); } else { @@ -1407,42 +1411,6 @@ Color_RGB8 sBottleColors[] = { { 80, 80, 255 }, // Fairy }; -Vec3f D_80126128 = { 398.0f, 1419.0f, 244.0f }; - -BowSlingshotStringData sBowSlingshotStringData[] = { - { gLinkAdultBowStringDL, { 0.0f, -360.4f, 0.0f } }, // Bow - { gLinkChildSlingshotStringDL, { 606.0f, 236.0f, 0.0f } }, // Slingshot -}; - -// Coordinates of the shield quad collider vertices, in the right hand limb's own model space. -Vec3f sRightHandLimbModelShieldQuadVertices[] = { - { -4500.0f, -3000.0f, -600.0f }, - { 1500.0f, -3000.0f, -600.0f }, - { -4500.0f, 3000.0f, -600.0f }, - { 1500.0f, 3000.0f, -600.0f }, -}; - -Vec3f D_80126184 = { 100.0f, 1500.0f, 0.0f }; -Vec3f D_80126190 = { 100.0f, 1640.0f, 0.0f }; - -// Coordinates of the shield quad collider vertices, in the sheath limb's own model space. -Vec3f sSheathLimbModelShieldQuadVertices[] = { - { -3000.0f, -3000.0f, -900.0f }, - { 3000.0f, -3000.0f, -900.0f }, - { -3000.0f, 3000.0f, -900.0f }, - { 3000.0f, 3000.0f, -900.0f }, -}; - -// Position and rotation of the shield on Link's back, in the sheath limb's own model space. -Vec3f sSheathLimbModelShieldOnBackPos = { 630.0f, 100.0f, -30.0f }; -Vec3s sSheathLimbModelShieldOnBackZyxRot = { 0, 0, 0x7FFF }; - -// Position of Link's foot, in the foot limb's own model space. -Vec3f sLeftRightFootLimbModelFootPos[] = { - { 200.0f, 300.0f, 0.0f }, - { 200.0f, 200.0f, 0.0f }, -}; - void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) { Player* this = (Player*)thisx; @@ -1507,6 +1475,8 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve if (this->actor.scale.y >= 0.0f) { if (!Player_HoldsHookshot(this) && ((hookedActor = this->heldActor) != NULL)) { if (this->stateFlags1 & PLAYER_STATE1_9) { + static Vec3f D_80126128 = { 398.0f, 1419.0f, 244.0f }; + Matrix_MultVec3f(&D_80126128, &hookedActor->world.pos); Matrix_RotateZYX(0x69E8, -0x5708, 0x458E, MTXMODE_APPLY); Matrix_Get(&sp14C); @@ -1536,6 +1506,10 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve Matrix_Get(&this->shieldMf); } else if ((this->rightHandType == PLAYER_MODELTYPE_RH_BOW_SLINGSHOT) || (this->rightHandType == PLAYER_MODELTYPE_RH_BOW_SLINGSHOT_2)) { + static BowSlingshotStringData sBowSlingshotStringData[] = { + { gLinkAdultBowStringDL, { 0.0f, -360.4f, 0.0f } }, // Bow + { gLinkChildSlingshotStringDL, { 606.0f, 236.0f, 0.0f } }, // Slingshot + }; BowSlingshotStringData* stringData = &sBowSlingshotStringData[gSaveContext.save.linkAge]; OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2783); @@ -1577,15 +1551,26 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve CLOSE_DISPS(play->state.gfxCtx, "../z_player_lib.c", 2809); } else if ((this->actor.scale.y >= 0.0f) && (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD)) { + // Coordinates of the shield quad collider vertices, in the right hand limb's own model space. + static Vec3f sRightHandLimbModelShieldQuadVertices[] = { + { -4500.0f, -3000.0f, -600.0f }, + { 1500.0f, -3000.0f, -600.0f }, + { -4500.0f, 3000.0f, -600.0f }, + { 1500.0f, 3000.0f, -600.0f }, + }; + Matrix_Get(&this->shieldMf); Player_UpdateShieldCollider(play, this, &this->shieldQuad, sRightHandLimbModelShieldQuadVertices); } if (this->actor.scale.y >= 0.0f) { if ((this->heldItemAction == PLAYER_IA_HOOKSHOT) || (this->heldItemAction == PLAYER_IA_LONGSHOT)) { + static Vec3f D_80126184 = { 100.0f, 1500.0f, 0.0f }; + Matrix_MultVec3f(&D_80126184, &this->unk_3C8); if (heldActor != NULL) { + static Vec3f D_80126190 = { 100.0f, 1640.0f, 0.0f }; MtxF sp44; s32 pad; @@ -1622,6 +1607,17 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve if (limbIndex == PLAYER_LIMB_SHEATH) { if ((this->rightHandType != PLAYER_MODELTYPE_RH_SHIELD) && (this->rightHandType != PLAYER_MODELTYPE_RH_FF)) { + // Coordinates of the shield quad collider vertices, in the sheath limb's own model space. + static Vec3f sSheathLimbModelShieldQuadVertices[] = { + { -3000.0f, -3000.0f, -900.0f }, + { 3000.0f, -3000.0f, -900.0f }, + { -3000.0f, 3000.0f, -900.0f }, + { 3000.0f, 3000.0f, -900.0f }, + }; + // Position and rotation of the shield on Link's back, in the sheath limb's own model space. + static Vec3f sSheathLimbModelShieldOnBackPos = { 630.0f, 100.0f, -30.0f }; + static Vec3s sSheathLimbModelShieldOnBackZyxRot = { 0, 0, 0x7FFF }; + if (Player_IsChildWithHylianShield(this)) { Player_UpdateShieldCollider(play, this, &this->shieldQuad, sSheathLimbModelShieldQuadVertices); } @@ -1632,6 +1628,11 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve } else if (limbIndex == PLAYER_LIMB_HEAD) { Matrix_MultVec3f(&sPlayerFocusHeadLimbModelPos, &this->actor.focus.pos); } else { + // Position of Link's foot, in the foot limb's own model space. + static Vec3f sLeftRightFootLimbModelFootPos[] = { + { 200.0f, 300.0f, 0.0f }, + { 200.0f, 200.0f, 0.0f }, + }; Vec3f* footPos = &sLeftRightFootLimbModelFootPos[((void)0, gSaveContext.save.linkAge)]; // The same model position is used for both feet, @@ -1733,8 +1734,6 @@ void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject, OPEN_DISPS(play->state.gfxCtx, "../z_player_lib.c", 3129); - { s32 pad[2]; } - opaRef = POLY_OPA_DISP; POLY_OPA_DISP++; @@ -1744,6 +1743,8 @@ void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject, gSPDisplayList(WORK_DISP++, POLY_OPA_DISP); gSPDisplayList(WORK_DISP++, POLY_XLU_DISP); + { s32 pad[2]; } + gSPSegment(POLY_OPA_DISP++, 0x00, NULL); gDPPipeSync(POLY_OPA_DISP++);