diff options
| author | Dragorn421 <Dragorn421@users.noreply.github.com> | 2022-02-21 00:45:12 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-20 18:45:12 -0500 |
| commit | 145b14dbc4eeabe2547d458de7bbd3fffd446190 (patch) | |
| tree | d10bb4f01284760323b562359c5f0d1fe20ca168 /src/code | |
| parent | b9cc31dc74bd3472375ae06412ace007c8f46534 (diff) | |
sword -> meleeWeapon (#1147)
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_actor.c | 6 | ||||
| -rw-r--r-- | src/code/z_camera.c | 2 | ||||
| -rw-r--r-- | src/code/z_player_lib.c | 33 |
3 files changed, 22 insertions, 19 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 7e90800c9..2781e2a4c 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -3999,7 +3999,8 @@ s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s var1 = (s16)(actor->yawTowardsPlayer + 0x8000) - player->actor.shape.rot.y; var2 = actor->yawTowardsPlayer - arg5; - if ((actor->xzDistToPlayer <= range) && (player->swordState != 0) && (arg4 >= ABS(var1)) && (arg3 >= ABS(var2))) { + if ((actor->xzDistToPlayer <= range) && (player->meleeWeaponState != 0) && (arg4 >= ABS(var1)) && + (arg3 >= ABS(var2))) { return true; } else { return false; @@ -4039,7 +4040,8 @@ void func_800355B8(GlobalContext* globalCtx, Vec3f* pos) { u8 func_800355E4(GlobalContext* globalCtx, Collider* collider) { Player* player = GET_PLAYER(globalCtx); - if ((collider->acFlags & AC_TYPE_PLAYER) && (player->swordState != 0) && (player->swordAnimation == 0x16)) { + if ((collider->acFlags & AC_TYPE_PLAYER) && (player->meleeWeaponState != 0) && + (player->meleeWeaponAnimation == 0x16)) { return true; } else { return false; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 62cc90acf..68f2d4244 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -2928,7 +2928,7 @@ s32 Camera_Battle1(Camera* camera) { } anim->roll += (((OREG(36) * camera->speedRatio) * (1.0f - distRatio)) - anim->roll) * PCT(OREG(37)); camera->roll = DEGF_TO_BINANG(anim->roll); - camera->fov = Camera_LERPCeilF((player->swordState != 0 ? 0.8f + camera->fov = Camera_LERPCeilF((player->meleeWeaponState != 0 ? 0.8f : gSaveContext.health <= 0x10 ? 0.8f : 1.0f) * (fov - ((fov * 0.05f) * distRatio)), diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index cdf4c0abe..e58b3a630 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -477,7 +477,7 @@ s32 Player_IsBurningStickInRange(GlobalContext* globalCtx, Vec3f* pos, f32 xzRan s32 pad; if ((this->heldItemActionParam == PLAYER_AP_STICK) && (this->unk_860 != 0)) { - Math_Vec3f_Diff(&this->swordInfo[0].tip, pos, &diff); + Math_Vec3f_Diff(&this->meleeWeaponInfo[0].tip, pos, &diff); return ((SQ(diff.x) + SQ(diff.z)) <= SQ(xzRange)) && (0.0f <= diff.y) && (diff.y <= yRange); } else { return false; @@ -540,7 +540,7 @@ s32 func_8008F128(Player* this) { return Player_HoldsHookshot(this) && (this->heldActor == NULL); } -s32 Player_ActionToSword(s32 actionParam) { +s32 Player_ActionToMeleeWeapon(s32 actionParam) { s32 sword = actionParam - PLAYER_AP_FISHING_POLE; if ((sword > 0) && (sword < 6)) { @@ -550,8 +550,8 @@ s32 Player_ActionToSword(s32 actionParam) { } } -s32 Player_GetSwordHeld(Player* this) { - return Player_ActionToSword(this->heldItemActionParam); +s32 Player_GetMeleeWeaponHeld(Player* this) { + return Player_ActionToMeleeWeapon(this->heldItemActionParam); } s32 Player_HoldsTwoHandedWeapon(Player* this) { @@ -881,7 +881,7 @@ s32 func_8008FCC8(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p if (limbIndex == PLAYER_LIMB_ROOT) { D_80160014 = this->leftHandType; D_80160018 = this->rightHandType; - D_80160000 = &this->swordInfo[2].base; + D_80160000 = &this->meleeWeaponInfo[2].base; if (!LINK_IS_ADULT) { if (!(this->skelAnime.moveFlags & 4) || (this->skelAnime.moveFlags & 1)) { @@ -1098,15 +1098,16 @@ void func_800906D4(GlobalContext* globalCtx, Player* this, Vec3f* newTipPos) { Matrix_MultVec3f(&D_801260A4[1], &newBasePos[1]); Matrix_MultVec3f(&D_801260A4[2], &newBasePos[2]); - if (func_80090480(globalCtx, NULL, &this->swordInfo[0], &newTipPos[0], &newBasePos[0]) && + if (func_80090480(globalCtx, NULL, &this->meleeWeaponInfo[0], &newTipPos[0], &newBasePos[0]) && !(this->stateFlags1 & PLAYER_STATE1_22)) { - EffectBlure_AddVertex(Effect_GetByIndex(this->swordEffectIndex), &this->swordInfo[0].tip, - &this->swordInfo[0].base); + EffectBlure_AddVertex(Effect_GetByIndex(this->meleeWeaponEffectIndex), &this->meleeWeaponInfo[0].tip, + &this->meleeWeaponInfo[0].base); } - if ((this->swordState > 0) && ((this->swordAnimation < 0x18) || (this->stateFlags2 & PLAYER_STATE2_17))) { - func_80090480(globalCtx, &this->swordQuads[0], &this->swordInfo[1], &newTipPos[1], &newBasePos[1]); - func_80090480(globalCtx, &this->swordQuads[1], &this->swordInfo[2], &newTipPos[2], &newBasePos[2]); + if ((this->meleeWeaponState > 0) && + ((this->meleeWeaponAnimation < 0x18) || (this->stateFlags2 & PLAYER_STATE2_17))) { + func_80090480(globalCtx, &this->meleeWeaponQuads[0], &this->meleeWeaponInfo[1], &newTipPos[1], &newBasePos[1]); + func_80090480(globalCtx, &this->meleeWeaponQuads[1], &this->meleeWeaponInfo[2], &newTipPos[2], &newBasePos[2]); } } @@ -1194,7 +1195,7 @@ void Player_DrawHookshotReticle(GlobalContext* globalCtx, Player* this, f32 arg2 Vec3f D_801260D4 = { 1100.0f, -700.0f, 0.0f }; -f32 sSwordLengths[] = { +f32 sMeleeWeaponLengths[] = { 0.0f, 4000.0f, 3000.0f, 5500.0f, 0.0f, 2500.0f, }; @@ -1259,10 +1260,10 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* if (this->actor.scale.y >= 0.0f) { D_80126080.x = this->unk_85C * 5000.0f; func_80090A28(this, sp124); - if (this->swordState != 0) { + if (this->meleeWeaponState != 0) { func_800906D4(globalCtx, this, sp124); } else { - Math_Vec3f_Copy(&this->swordInfo[0].tip, &sp124[0]); + Math_Vec3f_Copy(&this->meleeWeaponInfo[0].tip, &sp124[0]); } } @@ -1275,13 +1276,13 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* gSPDisplayList(POLY_OPA_DISP++, gLinkChildLinkDekuStickDL); CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 2656); - } else if ((this->actor.scale.y >= 0.0f) && (this->swordState != 0)) { + } else if ((this->actor.scale.y >= 0.0f) && (this->meleeWeaponState != 0)) { Vec3f spE4[3]; if (Player_HoldsBrokenKnife(this)) { D_80126080.x = 1500.0f; } else { - D_80126080.x = sSwordLengths[Player_GetSwordHeld(this)]; + D_80126080.x = sMeleeWeaponLengths[Player_GetMeleeWeaponHeld(this)]; } func_80090A28(this, spE4); |
