Flag tracker (#3447)

* Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found).
Remove areaChecks and looping functionality as redundant.

* Additional vanilla handling.

* Fix tracker not showing MQ checks in MQ non-rando.
Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ.

* Set all areas to spoiled if not rando.

* Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment.

* Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12).
Fix Anju As Adult check.

* Remove Anchor-specific code :baguette:

* Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there.

* Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added.

* Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12.
Fix vanilla checks being marked collected in MQ dungeons.

* Fix 100 GS check.

* ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame.

* Fix gravedigging tour tracking.

* Fix membership card check tracking.
Change scene and flag values to any existing enums.
Clarifying formatting for the checking loop vOrMQ conditions.

* Fix Gravedigging Tour tracking.
Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications.
Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant.

* Fix Kak Potion Shop being "seen" when entering as child.
This commit is contained in:
Malkierian
2023-11-28 19:25:48 -07:00
committed by GitHub
parent 33fe8776bb
commit c4f34624ba
9 changed files with 195 additions and 181 deletions

View File

@@ -3384,7 +3384,7 @@ void Message_Update(PlayState* play) {
}
sLastPlayedSong = 0xFF;
osSyncPrintf("OCARINA_MODE=%d chk_ocarina_no=%d\n", play->msgCtx.ocarinaMode, msgCtx->unk_E3F2);
CheckTracker_OnMessageClose();
// TODO: OnMessageClose hook
break;
case MSGMODE_PAUSED:
break;

View File

@@ -313,7 +313,9 @@ void EnSth_GiveReward(EnSth* this, PlayState* play) {
this->actor.parent = NULL;
EnSth_SetupAction(this, EnSth_RewardObtainedTalk);
gSaveContext.eventChkInf[EVENTCHKINF_SKULLTULA_REWARD_INDEX] |= this->eventFlag;
GameInteractor_ExecuteOnFlagSet(FLAG_EVENT_CHECK_INF, (EVENTCHKINF_SKULLTULA_REWARD_INDEX << 4) + sEventFlagsShift[this->actor.params]);
if (this->eventFlag != 0) {
GameInteractor_ExecuteOnFlagSet(FLAG_EVENT_CHECK_INF, (EVENTCHKINF_SKULLTULA_REWARD_INDEX << 4) + sEventFlagsShift[this->actor.params]);
}
} else {
EnSth_GivePlayerItem(this, play);
}

View File

@@ -408,7 +408,7 @@ s32 EnTk_ChooseReward(EnTk* this) {
f32 luck;
s32 reward;
if ((IS_RANDO || CVarGetInteger("gDampeWin", 0)) && !Flags_GetCollectible(gPlayState, 0x1F) && this->heartPieceSpawned == 0) {
if ((IS_RANDO || CVarGetInteger("gDampeWin", 0)) && !Flags_GetCollectible(gPlayState, COLLECTFLAG_GRAVEDIGGING_HEART_PIECE) && this->heartPieceSpawned == 0) {
return 3;
}
@@ -624,10 +624,8 @@ void EnTk_Dig(EnTk* this, PlayState* play) {
this->currentReward = EnTk_ChooseReward(this);
// merging in dampe tour fix seems messy, so i'm just wrapping this whole thing
// in an n64dd check for now
if (IS_RANDO || CVarGetInteger("gDampeWin", 0)) {
if (this->currentReward == 3) {
if (this->currentReward == 3) {
if (IS_RANDO || CVarGetInteger("gDampeWin", 0)) {
/*
* Upgrade the purple rupee reward to the heart piece if this
* is the first grand prize dig.
@@ -635,37 +633,31 @@ void EnTk_Dig(EnTk* this, PlayState* play) {
if (!Flags_GetItemGetInf(ITEMGETINF_1C) && !(IS_RANDO || CVarGetInteger("gDampeWin", 0))) {
Flags_SetItemGetInf(ITEMGETINF_1C);
this->currentReward = 4;
} else if ((IS_RANDO || CVarGetInteger("gDampeWin", 0)) && !Flags_GetCollectible(gPlayState, 0x1F) && this->heartPieceSpawned == 0) {
} else if ((IS_RANDO || CVarGetInteger("gDampeWin", 0)) && !Flags_GetCollectible(gPlayState, COLLECTFLAG_GRAVEDIGGING_HEART_PIECE) && this->heartPieceSpawned == 0) {
this->currentReward = 4;
}
}
if ((IS_RANDO || CVarGetInteger("gDampeWin", 0)) && this->currentReward == 4) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, rewardPos.x, rewardPos.y, rewardPos.z, 0,
0, 0, 0x1F06, true);
this->heartPieceSpawned = 1;
} else {
Item_DropCollectible(play, &rewardPos, rewardParams[this->currentReward]);
/*
* Upgrade the purple rupee reward to the heart piece if this
* is the first grand prize dig.
*/
// If vanilla itemGetInf flag is not set, it's impossible for the new flag to be set, so return true.
// Otherwise if the gGravediggingTourFix is enabled and the new flag hasn't been set, return true.
// If true, spawn the heart piece and set the vanilla itemGetInf flag and new temp clear flag.
if (!heartPieceSpawned &&
(!(gSaveContext.itemGetInf[1] & ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE) ||
CVarGetInteger("gGravediggingTourFix", 0) &&
!Flags_GetCollectible(play, COLLECTFLAG_GRAVEDIGGING_HEART_PIECE))) {
this->currentReward = 4;
gSaveContext.itemGetInf[1] |= ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE;
heartPieceSpawned = true;
}
}
if (IS_RANDO && this->currentReward == 4) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ITEM00, rewardPos.x, rewardPos.y, rewardPos.z, 0, 0, 0, 0x1906, true);
this->heartPieceSpawned = 1;
} else {
if (this->currentReward == 3) {
/*
* Upgrade the purple rupee reward to the heart piece if this
* is the first grand prize dig.
*/
// If vanilla itemGetInf flag is not set, it's impossible for the new flag to be set, so return true.
// Otherwise if the gGravediggingTourFix is enabled and the new flag hasn't been set, return true.
// If true, spawn the heart piece and set the vanilla itemGetInf flag and new temp clear flag.
if (!heartPieceSpawned &&
(!(gSaveContext.itemGetInf[1] & ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE) ||
CVarGetInteger("gGravediggingTourFix", 0) &&
!Flags_GetCollectible(play, COLLECTFLAG_GRAVEDIGGING_HEART_PIECE))) {
this->currentReward = 4;
gSaveContext.itemGetInf[1] |= ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE;
heartPieceSpawned = true;
}
}
EnItem00* reward = Item_DropCollectible(play, &rewardPos, rewardParams[this->currentReward]);
if (this->currentReward == 4) {
reward->collectibleFlag = COLLECTFLAG_GRAVEDIGGING_HEART_PIECE;