Skip to content

Commit

Permalink
Fix song Fairies (HarbourMasters#4826)
Browse files Browse the repository at this point in the history
* Fix song fairies

* forgot a bool
  • Loading branch information
Pepper0ni authored Jan 8, 2025
1 parent 9455579 commit 323ea2d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions soh/soh/Enhancements/game-interactor/GameInteractor.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ typedef enum {
VB_FAIRY_HEAL,
// Opt: *ObjBean
VB_SPAWN_BEAN_STALK_FAIRIES,
// Opt: *ShotSun
VB_SPAWN_SONG_FAIRY,
// Opt: *EnGs
VB_SPAWN_GOSSIP_STONE_FAIRY,
} GIVanillaBehavior;
Expand Down
9 changes: 9 additions & 0 deletions soh/soh/Enhancements/randomizer/ShuffleFairies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "src/overlays/actors/ovl_En_Elf/z_en_elf.h"
#include "src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h"
#include "src/overlays/actors/ovl_En_Gs/z_en_gs.h"
#include "src/overlays/actors/ovl_Shot_Sun/z_shot_sun.h"
#include "../../OTRGlobals.h"
#include "../../cvar_prefixes.h"

Expand Down Expand Up @@ -116,6 +117,14 @@ void ShuffleFairies_OnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should,
if (fairySpawned) {
*should = false;
}
// Spawn a fairy from a ShotSun when playing the right song near it
} else if (id == VB_SPAWN_SONG_FAIRY) {
ShotSun* shotSun = (ShotSun*)(actor);
if (ShuffleFairies_SpawnFairy(shotSun->actor.world.pos.x, shotSun->actor.world.pos.y,
shotSun->actor.world.pos.z,
TWO_ACTOR_PARAMS(0x1000, (int32_t)shotSun->actor.world.pos.z))) {
*should = false;
}
// Handle playing both misc songs and song of storms in front of a gossip stone.
} else if (id == VB_SPAWN_GOSSIP_STONE_FAIRY) {
EnGs* gossipStone = (EnGs*)(actor);
Expand Down
2 changes: 1 addition & 1 deletion soh/soh/Enhancements/randomizer/location_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@ void Rando::StaticData::InitLocationTable() { //

locationTable[RC_LH_ISLAND_SUN_FAIRY] = Location::Fairy(RC_LH_ISLAND_SUN_FAIRY, RCQUEST_BOTH, RCAREA_LAKE_HYLIA, SCENE_LAKE_HYLIA, TWO_ACTOR_PARAMS(0x1000, 7319), "Island Sun's Song Fairy", "Island Sun's Song Fairy", RHT_LH_ISLAND_SUN_FAIRY, SpoilerCollectionCheck::RandomizerInf(RAND_INF_LH_ISLAND_SUN_FAIRY));
locationTable[RC_HF_POND_STORMS_FAIRY] = Location::Fairy(RC_HF_POND_STORMS_FAIRY, RCQUEST_BOTH, RCAREA_HYRULE_FIELD, SCENE_HYRULE_FIELD, TWO_ACTOR_PARAMS(0x1000, 5012), "Pond Song of Storms Fairy", "Pond Song of Storms Fairy", RHT_HF_POND_STORMS_FAIRY, SpoilerCollectionCheck::RandomizerInf(RAND_INF_HF_POND_STORMS_FAIRY));
locationTable[RC_HF_FENCE_GROTTO_STORMS_FAIRY] = Location::Fairy(RC_HF_FENCE_GROTTO_STORMS_FAIRY, RCQUEST_BOTH, RCAREA_HYRULE_FIELD, SCENE_GROTTOS, TWO_ACTOR_PARAMS(0x1012, -308), "Inside Fence Storms Fairy", "Inside Fence Storms Fairy", RHT_HF_FENCE_GROTTO_STORMS_FAIRY, SpoilerCollectionCheck::RandomizerInf(RHT_HF_FENCE_GROTTO_STORMS_FAIRY));
locationTable[RC_HF_FENCE_GROTTO_STORMS_FAIRY] = Location::Fairy(RC_HF_FENCE_GROTTO_STORMS_FAIRY, RCQUEST_BOTH, RCAREA_HYRULE_FIELD, SCENE_GROTTOS, TWO_ACTOR_PARAMS(0x1000, -308), "Inside Fence Storms Fairy", "Inside Fence Storms Fairy", RHT_HF_FENCE_GROTTO_STORMS_FAIRY, SpoilerCollectionCheck::RandomizerInf(RAND_INF_HF_FENCE_GROTTO_STORMS_FAIRY));
locationTable[RC_DMT_FLAG_SUN_FAIRY] = Location::Fairy(RC_DMT_FLAG_SUN_FAIRY, RCQUEST_BOTH, RCAREA_DEATH_MOUNTAIN_TRAIL, SCENE_DEATH_MOUNTAIN_TRAIL, TWO_ACTOR_PARAMS(0x1000, 464), "Flag Sun's Song Fairy", "Flag Sun's Song Fairy", RHT_DMT_FLAG_SUN_FAIRY, SpoilerCollectionCheck::RandomizerInf(RAND_INF_DMT_FLAG_SUN_FAIRY));
locationTable[RC_LW_SHORTCUT_STORMS_FAIRY] = Location::Fairy(RC_LW_SHORTCUT_STORMS_FAIRY, RCQUEST_BOTH, RCAREA_LOST_WOODS, SCENE_LOST_WOODS, TWO_ACTOR_PARAMS(0x1000, -795), "Shortcuts Song of Storms Fairy", "Shortcuts Song of Storms Fairy", RHT_LW_SHORTCUT_STORMS_FAIRY, SpoilerCollectionCheck::RandomizerInf(RAND_INF_LW_SHORTCUT_STORMS_FAIRY));
locationTable[RC_GF_KITCHEN_SUN_FAIRY] = Location::Fairy(RC_GF_KITCHEN_SUN_FAIRY, RCQUEST_BOTH, RCAREA_GERUDO_FORTRESS, SCENE_THIEVES_HIDEOUT, TWO_ACTOR_PARAMS(0x1000, -621), "Kitchen Sun's Song Fairy", "Kitchen Sun's Song Fairy", RHT_GF_KITCHEN_SUN_FAIRY, SpoilerCollectionCheck::RandomizerInf(RAND_INF_GF_KITCHEN_SUN_FAIRY));
Expand Down
1 change: 1 addition & 0 deletions soh/soh/Enhancements/randomizer/randomizer_inf.h
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,7 @@ typedef enum {
RAND_INF_LH_ISLAND_SUN_FAIRY,
RAND_INF_HF_POND_STORMS_FAIRY,
RAND_INF_DMT_FLAG_SUN_FAIRY,
RAND_INF_HF_FENCE_GROTTO_STORMS_FAIRY,
RAND_INF_LW_SHORTCUT_STORMS_FAIRY,
RAND_INF_GF_KITCHEN_SUN_FAIRY,
RAND_INF_SPIRIT_TEMPLE_BOULDER_ROOM_SUN_FAIRY,
Expand Down
6 changes: 4 additions & 2 deletions soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,10 @@ void ShotSun_SpawnFairy(ShotSun* this, PlayState* play) {
}

//! @bug fairyType may be uninitialized
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.home.pos.x, this->actor.home.pos.y,
this->actor.home.pos.z, 0, 0, 0, fairyType, true);
if (GameInteractor_Should(VB_SPAWN_SONG_FAIRY, true, this)) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ELF, this->actor.home.pos.x, this->actor.home.pos.y,
this->actor.home.pos.z, 0, 0, 0, fairyType, true);
}

Actor_Kill(&this->actor);
}
Expand Down

0 comments on commit 323ea2d

Please sign in to comment.