@@ -914,7 +914,7 @@ namespace mod::events
914914
915915 int32_t proc_query042 (void * unk1, void * unk2, int32_t unk3)
916916 {
917- if (transformAnywhereEnabled )
917+ if (checkValidTransformAnywhere () )
918918 {
919919 // Return false to allow transforming infront of NPCs using Midna's transform option
920920 return 0 ;
@@ -1111,6 +1111,7 @@ namespace mod::events
11111111 void handleQuickTransform ()
11121112 {
11131113 rando::Seed* seed;
1114+ using namespace libtp ::tp::d_com_inf_game;
11141115 if (seed = getCurrentSeed (randomizer), !seed)
11151116 {
11161117 return ;
@@ -1122,7 +1123,7 @@ namespace mod::events
11221123 }
11231124
11241125 // Ensure that Link is loaded on the map.
1125- libtp::tp::d_a_alink::daAlink* linkMapPtr = libtp::tp::d_com_inf_game:: dComIfG_gameInfo.play .mPlayer ;
1126+ libtp::tp::d_a_alink::daAlink* linkMapPtr = dComIfG_gameInfo.play .mPlayer ;
11261127 if (!linkMapPtr)
11271128 {
11281129 return ;
@@ -1178,7 +1179,7 @@ namespace mod::events
11781179 return ;
11791180 }
11801181
1181- if (!transformAnywhereEnabled )
1182+ if (!checkValidTransformAnywhere () )
11821183 {
11831184 if (daMidna_c__checkMetamorphoseEnableBase)
11841185 {
@@ -1490,7 +1491,7 @@ namespace mod::events
14901491
14911492 void * handleTransformAnywhere (libtp::tp::f_op_actor_iter::fopAcIt_JudgeFunc unk1, void * unk2)
14921493 {
1493- if (transformAnywhereEnabled )
1494+ if (checkValidTransformAnywhere () )
14941495 {
14951496 // Return nullptr to make the calling function return true
14961497 return nullptr ;
@@ -1500,6 +1501,39 @@ namespace mod::events
15001501 return libtp::tp::f_op_actor_iter::fopAcIt_Judge (unk1, unk2);
15011502 }
15021503
1504+ bool checkValidTransformAnywhere ()
1505+ {
1506+ using namespace libtp ::data::stage;
1507+ using namespace libtp ::tp::d_com_inf_game;
1508+
1509+ if (!transformAnywhereEnabled)
1510+ {
1511+ return false ;
1512+ }
1513+
1514+ // Check if the player is currently playing the Goats minigame
1515+ if (libtp::tp::d_a_alink::checkStageName (allStages[StageIDs::Ordon_Ranch]))
1516+ {
1517+ switch (dComIfG_gameInfo.play .mStartStage .mLayer )
1518+ {
1519+ // Layer 4 or 5 is used when the minigame is taking place
1520+ case 4 :
1521+ case 5 :
1522+ {
1523+ // Return false, as the game will crash if the player is in wolf form after the minigame ends
1524+ return false ;
1525+ }
1526+ default :
1527+ {
1528+ break ;
1529+ }
1530+ }
1531+ }
1532+
1533+ // Return true, as the bool is set and there are no conflicting scenarios to prevent transformation
1534+ return true ;
1535+ }
1536+
15031537 KEEP_FUNC void performStaticASMReplacement (uint32_t memoryOffset, uint32_t value)
15041538 {
15051539 *reinterpret_cast <uint32_t *>(memoryOffset) = value;
0 commit comments