Skip to content

Commit

Permalink
Cleanup and fix item00 queues
Browse files Browse the repository at this point in the history
  • Loading branch information
aMannus committed Aug 28, 2024
1 parent 34bca0b commit 9bdfb56
Show file tree
Hide file tree
Showing 4 changed files with 564 additions and 577 deletions.
20 changes: 6 additions & 14 deletions soh/soh/Enhancements/randomizer/ShufflePots.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,14 @@ uint8_t ObjTsubo_RandomizerHoldsItem(ObjTsubo* potActor, PlayState* play) {
}
}

void ObjTsubo_RandomizerSpawnCollectible(ObjTsubo* potActor) {
EnItem00* item00 =
(EnItem00*)Item_DropCollectible2(gPlayState, &potActor->actor.world.pos, ITEM00_SOH_GIVE_ITEM_ENTRY);
void ObjTsubo_RandomizerSpawnCollectible(ObjTsubo* potActor, PlayState* play) {
EnItem00* item00 = (EnItem00*)Item_DropCollectible2(play, &potActor->actor.world.pos, ITEM00_SOH_DUMMY);
item00->randoInf = potActor->potIdentity.randomizerInf;
item00->itemEntry =
OTRGlobals::Instance->gRandomizer->GetItemFromKnownCheck(potActor->potIdentity.randomizerCheck, GI_NONE);
item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem;
item00->actor.velocity.y = 8.0f;
item00->actor.speedXZ = 2.0f;
item00->actor.gravity = -0.9f;
item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f);
}

Expand All @@ -68,29 +66,23 @@ void ObjTsubo_RandomizerInit(void* actorRef) {

potActor->potIdentity =
Randomizer_IdentifyPot(gPlayState->sceneNum, (s16)actor->world.pos.x, (s16)actor->world.pos.z);

if (ObjTsubo_RandomizerHoldsItem(potActor, gPlayState)) {
potActor->potIdentity.isShuffled = true;
} else {
potActor->potIdentity.isShuffled = false;
}
}

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

switch (id) {
case VB_POT_DRAW: {
if (potActor->potIdentity.isShuffled) {
*should = false;
if (ObjTsubo_RandomizerHoldsItem(potActor, gPlayState)) {
potActor->actor.draw = (ActorFunc)ObjTsubo_RandomizerDraw;
*should = false;
}
break;
}
case VB_POT_DROP_ITEM: {
if (potActor->potIdentity.isShuffled) {
if (ObjTsubo_RandomizerHoldsItem(potActor, gPlayState)) {
ObjTsubo_RandomizerSpawnCollectible(potActor, gPlayState);
*should = false;
ObjTsubo_RandomizerSpawnCollectible(potActor);
}
break;
}
Expand Down
4 changes: 0 additions & 4 deletions soh/soh/Enhancements/randomizer/location.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ class SpoilerCollectionCheck {
static auto RandomizerInf(const uint16_t flag) {
return SpoilerCollectionCheck(SPOILER_CHK_RANDOMIZER_INF, 0x00, flag);
}

static auto Pot(const uint8_t scene, const uint8_t flag) {
return SpoilerCollectionCheck(SPOILER_CHK_POT, scene, flag);
}
};

enum class LocationType {
Expand Down
Loading

0 comments on commit 9bdfb56

Please sign in to comment.