Skip to content

Commit

Permalink
Ganons tower pot not spawning item fix + cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aMannus committed Aug 29, 2024
1 parent 19343dc commit ced2297
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
29 changes: 14 additions & 15 deletions soh/soh/Enhancements/randomizer/ShufflePots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,21 @@ void ObjTsubo_RandomizerInit(void* actorRef) {
}

void PotOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* optionalArg) {
ObjTsubo* potActor = static_cast<ObjTsubo*>(optionalArg);

switch (id) {
case VB_POT_DRAW: {
if (ObjTsubo_RandomizerHoldsItem(potActor, gPlayState)) {
potActor->actor.draw = (ActorFunc)ObjTsubo_RandomizerDraw;
*should = false;
}
break;
// Draw custom model for pot to indicate it holding a randomized item.
if (id == VB_POT_DRAW) {
ObjTsubo* potActor = static_cast<ObjTsubo*>(optionalArg);
if (ObjTsubo_RandomizerHoldsItem(potActor, gPlayState)) {
potActor->actor.draw = (ActorFunc)ObjTsubo_RandomizerDraw;
*should = false;
}
case VB_POT_DROP_ITEM: {
if (ObjTsubo_RandomizerHoldsItem(potActor, gPlayState)) {
ObjTsubo_RandomizerSpawnCollectible(potActor, gPlayState);
*should = false;
}
break;
}

// Do not spawn vanilla item from pot, instead spawn the ranomized item.
if (id == VB_POT_DROP_ITEM) {
ObjTsubo* potActor = static_cast<ObjTsubo*>(optionalArg);
if (ObjTsubo_RandomizerHoldsItem(potActor, gPlayState)) {
ObjTsubo_RandomizerSpawnCollectible(potActor, gPlayState);
*should = false;
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions soh/soh/Enhancements/randomizer/randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2270,12 +2270,10 @@ CowIdentity Randomizer::IdentifyCow(s32 sceneNum, s32 posX, s32 posZ) {

PotIdentity Randomizer::IdentifyPot(s32 sceneNum, s32 posX, s32 posZ) {
struct PotIdentity potIdentity;
uint32_t potSceneNum;
uint32_t potSceneNum = sceneNum;

if (sceneNum == SCENE_GANONDORF_BOSS) {
potSceneNum = SCENE_GANONS_TOWER;
} else {
potSceneNum = sceneNum;
}

potIdentity.randomizerInf = RAND_INF_MAX;
Expand Down
4 changes: 3 additions & 1 deletion soh/soh/Enhancements/randomizer/randomizerTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,7 @@ typedef enum {
RC_GANONS_CASTLE_MQ_DEKU_SCRUB_RIGHT,
RC_GANONS_TOWER_BOSS_KEY_CHEST,

// Pots
// Overworld Pots
RC_KF_LINKS_HOUSE_POT,
RC_KF_TWINS_HOUSE_POT_1,
RC_KF_TWINS_HOUSE_POT_2,
Expand Down Expand Up @@ -1701,6 +1701,8 @@ typedef enum {
RC_ZF_NEAR_JABU_POT_2,
RC_ZF_NEAR_JABU_POT_3,
RC_ZF_NEAR_JABU_POT_4,

// Dungeon Pots
RC_DODONGOS_CAVERN_LIZALFOS_POT_1,
RC_DODONGOS_CAVERN_LIZALFOS_POT_2,
RC_DODONGOS_CAVERN_LIZALFOS_POT_3,
Expand Down
9 changes: 5 additions & 4 deletions soh/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,11 @@ static InitChainEntry sInitChain[] = {
void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play) {
s16 dropParams = this->actor.params & 0x1F;

if ((dropParams >= ITEM00_RUPEE_GREEN) && (dropParams <= ITEM00_BOMBS_SPECIAL) &&
GameInteractor_Should(VB_POT_DROP_ITEM, true, this)) {
Item_DropCollectible(play, &this->actor.world.pos,
(dropParams | (((this->actor.params >> 9) & 0x3F) << 8)));
if (GameInteractor_Should(VB_POT_DROP_ITEM, true, this)) {
if ((dropParams >= ITEM00_RUPEE_GREEN) && (dropParams <= ITEM00_BOMBS_SPECIAL)) {
Item_DropCollectible(play, &this->actor.world.pos,
(dropParams | (((this->actor.params >> 9) & 0x3F) << 8)));
}
}
}

Expand Down

0 comments on commit ced2297

Please sign in to comment.