From 4b9c949428bd89def55102393fae2375e50a6829 Mon Sep 17 00:00:00 2001 From: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> Date: Fri, 26 Sep 2025 16:50:16 +0200 Subject: [PATCH] Fix dark link ice floors (#5808) --- soh/soh/Enhancements/enemyrandomizer.cpp | 19 +++++++++++++++++ .../vanilla-behavior/GIVanillaBehavior.h | 17 +++++++++++++++ .../actors/ovl_player_actor/z_player.c | 21 ++++++++++++++----- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/soh/soh/Enhancements/enemyrandomizer.cpp b/soh/soh/Enhancements/enemyrandomizer.cpp index 11f024226..2913e06db 100644 --- a/soh/soh/Enhancements/enemyrandomizer.cpp +++ b/soh/soh/Enhancements/enemyrandomizer.cpp @@ -619,6 +619,7 @@ void FixClubMoblinScale(void* ptr) { void RegisterEnemyRandomizer() { COND_ID_HOOK(OnActorInit, ACTOR_EN_MB, CVAR_ENEMY_RANDOMIZER_VALUE, FixClubMoblinScale); + // prevent dark link from triggering a voidout COND_VB_SHOULD(VB_TRIGGER_VOIDOUT, CVAR_ENEMY_RANDOMIZER_VALUE != CVAR_ENEMY_RANDOMIZER_DEFAULT, { Actor* actor = va_arg(args, Actor*); @@ -647,6 +648,24 @@ void RegisterEnemyRandomizer() { } }); + // prevent dark link from interfering with ice floors + COND_VB_SHOULD(VB_SET_STATIC_PREV_FLOOR_TYPE, CVAR_ENEMY_RANDOMIZER_VALUE != CVAR_ENEMY_RANDOMIZER_DEFAULT, { + Player* playerOrDarkLink = va_arg(args, Player*); + + if (playerOrDarkLink->actor.id != ACTOR_PLAYER) { + *should = false; + } + }); + + // prevent dark link from interfering with ice floors + COND_VB_SHOULD(VB_SET_STATIC_FLOOR_TYPE, CVAR_ENEMY_RANDOMIZER_VALUE != CVAR_ENEMY_RANDOMIZER_DEFAULT, { + Player* playerOrDarkLink = va_arg(args, Player*); + + if (playerOrDarkLink->actor.id != ACTOR_PLAYER) { + *should = false; + } + }); + // prevent dark link from being grabbed by like likes and therefore grabbing the player COND_VB_SHOULD(VB_LIKE_LIKE_GRAB_PLAYER, CVAR_ENEMY_RANDOMIZER_VALUE != CVAR_ENEMY_RANDOMIZER_DEFAULT, { EnRr* likeLike = va_arg(args, EnRr*); diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index 7e517155b..6eada52f6 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -2239,6 +2239,7 @@ typedef enum { // #### `args` // - `*PlayState` VB_SHOW_GAMEPLAY_TIMER, + // (this->dyna.actor.params >> 5 & 0x7F) == GI_ICE_TRAP && this->actionFunc == EnBox_Open && // this->skelanime.curFrame > 45 && this->iceSmokeTimer < 100 // ``` @@ -2253,6 +2254,22 @@ typedef enum { // #### `args` // - `*DoorShutter` VB_BE_NEAR_DOOR_SHUTTER, + + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - `*Player` + VB_SET_STATIC_PREV_FLOOR_TYPE, + + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - `*Player` + VB_SET_STATIC_FLOOR_TYPE, } GIVanillaBehavior; #endif diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 3571ca135..7da8447c0 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -5796,7 +5796,10 @@ void func_8083AA10(Player* this, PlayState* play) { if (this->hoverBootsTimer != 0) { this->actor.velocity.y = 1.0f; - sPrevFloorProperty = 9; + + if (GameInteractor_Should(VB_SET_STATIC_PREV_FLOOR_TYPE, true, this)) { + sPrevFloorProperty = 9; + } return; } @@ -11151,7 +11154,9 @@ s32 Player_UpdateHoverBoots(Player* this) { } return false; } else { - sFloorType = 0; + if (GameInteractor_Should(VB_SET_STATIC_FLOOR_TYPE, true, this)) { + sFloorType = 0; + } this->floorPitch = this->floorPitchAlt = sFloorShapePitch = 0; return true; @@ -11182,7 +11187,9 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { f32 ceilingCheckHeight; u32 flags; - sPrevFloorProperty = this->floorProperty; + if (GameInteractor_Should(VB_SET_STATIC_PREV_FLOOR_TYPE, true, this)) { + sPrevFloorProperty = this->floorProperty; + } #define vWallCheckRadius float0 #define vWallCheckHeight float1 @@ -11453,7 +11460,9 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { } if (this->actor.bgCheckFlags & 1) { - sFloorType = func_80041D4C(&play->colCtx, floorPoly, this->actor.floorBgId); + if (GameInteractor_Should(VB_SET_STATIC_FLOOR_TYPE, true, this)) { + sFloorType = func_80041D4C(&play->colCtx, floorPoly, this->actor.floorBgId); + } if (!Player_UpdateHoverBoots(this)) { f32 floorPolyNormalX; @@ -12100,7 +12109,9 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Actor_UpdatePos(&this->actor); Player_ProcessSceneCollision(play, this); } else { - sFloorType = 0; + if (GameInteractor_Should(VB_SET_STATIC_FLOOR_TYPE, true, this)) { + sFloorType = 0; + } this->floorProperty = 0; if (!(this->stateFlags1 & PLAYER_STATE1_LOADING) && (this->stateFlags1 & PLAYER_STATE1_ON_HORSE)) {