diff options
| author | Garrett Cox <garrettjcox@gmail.com> | 2025-01-02 15:00:37 -0600 |
|---|---|---|
| committer | Garrett Cox <garrettjcox@gmail.com> | 2025-01-02 15:00:37 -0600 |
| commit | 9df889eba0bed8119f4262b035b3eb6ef13b1e41 (patch) | |
| tree | 4544be82a206138b6027893afedc950567dd41de /mm/src/code | |
| parent | 2dea19dc607ca713211ee0ad21b9ef9787738ce6 (diff) | |
| parent | 297156af0ab1e8b63caf9870b78a2c7939ea6a01 (diff) | |
Merge branch 'develop' of garrettjoecox.github.com:HarbourMasters/2ship2harkinian into develop-rando
Diffstat (limited to 'mm/src/code')
| -rw-r--r-- | mm/src/code/z_actor.c | 26 | ||||
| -rw-r--r-- | mm/src/code/z_en_item00.c | 11 | ||||
| -rw-r--r-- | mm/src/code/z_player_lib.c | 15 |
3 files changed, 29 insertions, 23 deletions
diff --git a/mm/src/code/z_actor.c b/mm/src/code/z_actor.c index 079c61be1..e805e9521 100644 --- a/mm/src/code/z_actor.c +++ b/mm/src/code/z_actor.c @@ -24,6 +24,7 @@ #include "2s2h/Enhancements/FrameInterpolation/FrameInterpolation.h" #include "2s2h/GameInteractor/GameInteractor.h" #include "2s2h/BenPort.h" +#include "2s2h/ShipUtils.h" // bss // FaultClient sActorFaultClient; // 2 funcs @@ -2826,6 +2827,10 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { DynaPoly_UpdateBgActorTransforms(play, &play->colCtx.dyna); } +// 2S2H [Port] Extern these for use below in interpolation checks +extern void Player_Action_93(Player* this, PlayState* play); +extern void Player_Action_95(Player* this, PlayState* play); + void Actor_Draw(PlayState* play, Actor* actor) { Lights* light; @@ -2841,6 +2846,13 @@ void Actor_Draw(PlayState* play, Actor* actor) { (actor->flags & (ACTOR_FLAG_10000000 | ACTOR_FLAG_400000)) ? NULL : &actor->world.pos, play); Lights_Draw(light, play->state.gfxCtx); + // If the player is performing a Deku spin or entering a Deku flower, set it so that interpolation allows for >90 + // angle changes to be interpolated smoothly + if (actor->id == ACTOR_PLAYER && + (((Player*)actor)->actionFunc == Player_Action_93 || ((Player*)actor)->actionFunc == Player_Action_95)) { + FrameInterpolation_InterpolateWiderAngles(); + } + FrameInterpolation_RecordActorPosRotMatrix(); if (actor->flags & ACTOR_FLAG_IGNORE_QUAKE) { Matrix_SetTranslateRotateYXZ(actor->world.pos.x + play->mainCamera.quakeOffset.x, @@ -3127,18 +3139,18 @@ s32 Ship_CalcShouldDrawAndUpdate(PlayState* play, Actor* actor, Vec3f* projected return true; } - s32 multiplier = CVarGetInteger("gEnhancements.Graphics.IncreaseActorDrawDistance", 1); - multiplier = MAX(multiplier, 1); + s32 distMultiplier = CVarGetInteger("gEnhancements.Graphics.IncreaseActorDrawDistance", 1); + distMultiplier = MAX(distMultiplier, 1); // Apply distance scale to forward cullzone check bool isWithingForwardCullZone = (-actor->uncullZoneScale < projectedPos->z) && - (projectedPos->z < ((actor->uncullZoneForward * multiplier) + actor->uncullZoneScale)); + (projectedPos->z < ((actor->uncullZoneForward + actor->uncullZoneScale) * distMultiplier)); if (isWithingForwardCullZone) { // Ensure the projected W value is at least 1.0 f32 clampedProjectedW = CLAMP_MIN(projectedW, 1.0f); - f32 ratioAdjusted = 1.0f; + f32 aspectMultiplier = 1.0f; f32 uncullZoneScaleDiagonal; f32 uncullZoneScaleVertical; f32 uncullZoneDownwardAdjusted; @@ -3157,14 +3169,12 @@ s32 Ship_CalcShouldDrawAndUpdate(PlayState* play, Actor* actor, Vec3f* projected } if (CVarGetInteger("gEnhancements.Graphics.ActorCullingAccountsForWidescreen", 0)) { - float originalAspectRatio = 4.0f / 3.0f; - float currentAspectRatio = OTRGetAspectRatio(); - ratioAdjusted = MAX(currentAspectRatio / originalAspectRatio, 1.0f); + aspectMultiplier = Ship_GetExtendedAspectRatioMultiplier(); } // Apply adjsuted aspect ratio to just the horizontal cullzone check bool isWithinHorizontalCullZone = - ((fabsf(projectedPos->x) - uncullZoneScaleDiagonal) < (clampedProjectedW * ratioAdjusted)); + ((fabsf(projectedPos->x) - uncullZoneScaleDiagonal) < (clampedProjectedW * aspectMultiplier)); bool isAboveBottomOfCullZone = ((-clampedProjectedW < (projectedPos->y + uncullZoneScaleVertical))); bool isBelowTopOfCullZone = ((projectedPos->y - uncullZoneDownwardAdjusted) < clampedProjectedW); diff --git a/mm/src/code/z_en_item00.c b/mm/src/code/z_en_item00.c index 92dc54a9b..5140f4dd1 100644 --- a/mm/src/code/z_en_item00.c +++ b/mm/src/code/z_en_item00.c @@ -6,6 +6,8 @@ #include "overlays/actors/ovl_En_Elforg/z_en_elforg.h" #include "2s2h/GameInteractor/GameInteractor.h" +#include "2s2h/Enhancements/FrameInterpolation/FrameInterpolation.h" + #define FLAGS 0x00000000 #define THIS ((EnItem00*)thisx) @@ -710,6 +712,13 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) { EnItem00* this = THIS; if (!(this->unk14E & this->unk150)) { + // 2S2H [Interpolation] Skip interpolation when the item moves from the ground to over the player head + Player* player = GET_PLAYER(play); + bool itemOnPlayer = + player->actor.home.pos.x == this->actor.world.pos.x && player->actor.home.pos.z == this->actor.world.pos.z; + FrameInterpolation_RecordOpenChild(this, itemOnPlayer ? 1 : 0); + FrameInterpolation_IgnoreActorMtx(); + switch (this->actor.params) { case ITEM00_RUPEE_GREEN: case ITEM00_RUPEE_BLUE: @@ -779,6 +788,8 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) { case ITEM00_BIG_FAIRY: break; } + + FrameInterpolation_RecordCloseChild(); } } diff --git a/mm/src/code/z_player_lib.c b/mm/src/code/z_player_lib.c index 12c6e86e9..6c1d4ae61 100644 --- a/mm/src/code/z_player_lib.c +++ b/mm/src/code/z_player_lib.c @@ -3681,21 +3681,6 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G Player_DrawHookshotReticle(play, player, 77600.0f); } } - } else if (CVarGetInteger("gEnhancements.Graphics.BowReticle", 0) && - ((player->heldItemAction == PLAYER_IA_BOW_FIRE) || - (player->heldItemAction == PLAYER_IA_BOW_ICE) || - (player->heldItemAction == PLAYER_IA_BOW_LIGHT) || (player->heldItemAction == PLAYER_IA_BOW))) { - if (heldActor != NULL) { - MtxF sp44; - - Matrix_RotateZYX(0, -15216, -17496, MTXMODE_APPLY); - Matrix_Get(&sp44); - - if (func_800B7128(player) != 0) { - Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY); - Player_DrawHookshotReticle(play, player, 776000.0f); - } - } } else if (player->meleeWeaponState != PLAYER_MELEE_WEAPON_STATE_0) { if (player->meleeWeaponAnimation == PLAYER_MWA_GORON_PUNCH_RIGHT) { func_80126B8C(play, player); |
