vb ocarina memory (#107)

* Ocarina Memory Game

* vb memory game

---------

Co-authored-by: Taw <Tawling@users.noreply.github.com>
This commit is contained in:
briaguya 2024-04-16 20:18:26 -04:00 committed by GitHub
parent f3273e7627
commit 63afaa3cc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 19 deletions

View File

@ -287,6 +287,8 @@ typedef enum {
// Opt: *EnFr // Opt: *EnFr
GI_VB_GIVE_ITEM_FROM_FROGS, GI_VB_GIVE_ITEM_FROM_FROGS,
// Opt: *EnSkj // Opt: *EnSkj
GI_VB_GIVE_ITEM_FROM_OCARINA_MEMORY_GAME,
// Opt: *EnSkj
GI_VB_GIVE_ITEM_FROM_SKULL_KID_SARIAS_SONG, GI_VB_GIVE_ITEM_FROM_SKULL_KID_SARIAS_SONG,
GI_VB_GIVE_ITEM_FROM_MAN_ON_ROOF, GI_VB_GIVE_ITEM_FROM_MAN_ON_ROOF,
// Opt: *EnSyatekiMan // Opt: *EnSyatekiMan

View File

@ -27,6 +27,7 @@ extern "C" {
#include "src/overlays/actors/ovl_En_Sth/z_en_sth.h" #include "src/overlays/actors/ovl_En_Sth/z_en_sth.h"
#include "src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h" #include "src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.h"
#include "src/overlays/actors/ovl_En_Box/z_en_box.h" #include "src/overlays/actors/ovl_En_Box/z_en_box.h"
#include "src/overlays/actors/ovl_En_Skj/z_en_skj.h"
#include "adult_trade_shuffle.h" #include "adult_trade_shuffle.h"
extern SaveContext gSaveContext; extern SaveContext gSaveContext;
extern PlayState* gPlayState; extern PlayState* gPlayState;
@ -909,6 +910,13 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void
*should = false; *should = false;
break; break;
} }
case GI_VB_GIVE_ITEM_FROM_OCARINA_MEMORY_GAME: {
EnSkj* enSkj = static_cast<EnSkj*>(optionalArg);
Flags_SetItemGetInf(ITEMGETINF_17);
enSkj->actionFunc = (EnSkjActionFunc)EnSkj_CleanupOcarinaGame;
*should = false;
break;
}
case GI_VB_TRADE_TIMER_ODD_MUSHROOM: case GI_VB_TRADE_TIMER_ODD_MUSHROOM:
case GI_VB_TRADE_TIMER_EYEDROPS: case GI_VB_TRADE_TIMER_EYEDROPS:
case GI_VB_TRADE_TIMER_FROG: case GI_VB_TRADE_TIMER_FROG:

View File

@ -1541,7 +1541,9 @@ void EnSkj_WaitForOfferResponse(EnSkj* this, PlayState* play) {
void EnSkj_WonOcarinaMiniGame(EnSkj* this, PlayState* play) { void EnSkj_WonOcarinaMiniGame(EnSkj* this, PlayState* play) {
if (D_80B01EA0) { if (D_80B01EA0) {
this->actionFunc = EnSkj_WaitToGiveReward; if (GameInteractor_Should(GI_VB_GIVE_ITEM_FROM_OCARINA_MEMORY_GAME, true, this)) {
this->actionFunc = EnSkj_WaitToGiveReward;
}
} else { } else {
func_8002F2CC(&this->actor, play, 26.0f); func_8002F2CC(&this->actor, play, 26.0f);
} }
@ -1549,13 +1551,8 @@ void EnSkj_WonOcarinaMiniGame(EnSkj* this, PlayState* play) {
void EnSkj_WaitToGiveReward(EnSkj* this, PlayState* play) { void EnSkj_WaitToGiveReward(EnSkj* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
if (IS_RANDO && gSaveContext.ocarinaGameRoundNum != 3) { Actor_OfferGetItem(&this->actor, play,
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_OCARINA_MEMORY_GAME, GI_HEART_PIECE); sOcarinaGameRewards[gSaveContext.ocarinaGameRoundNum], 26.0f, 26.0f);
GiveItemEntryFromActor(&this->actor, play, getItemEntry, 26.0f, 26.0f);
} else {
Actor_OfferGetItem(&this->actor, play, sOcarinaGameRewards[gSaveContext.ocarinaGameRoundNum], 26.0f, 26.0f);
}
this->actionFunc = EnSkj_GiveOcarinaGameReward; this->actionFunc = EnSkj_GiveOcarinaGameReward;
} }
} }
@ -1565,12 +1562,8 @@ void EnSkj_GiveOcarinaGameReward(EnSkj* this, PlayState* play) {
this->actor.parent = NULL; this->actor.parent = NULL;
this->actionFunc = EnSkj_FinishOcarinaGameRound; this->actionFunc = EnSkj_FinishOcarinaGameRound;
} else { } else {
if (IS_RANDO && gSaveContext.ocarinaGameRoundNum != 3) { Actor_OfferGetItem(&this->actor, play,
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_OCARINA_MEMORY_GAME, GI_HEART_PIECE); sOcarinaGameRewards[gSaveContext.ocarinaGameRoundNum], 26.0f, 26.0f);
GiveItemEntryFromActor(&this->actor, play, getItemEntry, 26.0f, 26.0f);
} else {
Actor_OfferGetItem(&this->actor, play, sOcarinaGameRewards[gSaveContext.ocarinaGameRoundNum], 26.0f, 26.0f);
}
} }
} }
@ -1582,11 +1575,7 @@ void EnSkj_FinishOcarinaGameRound(EnSkj* this, PlayState* play) {
gSaveContext.ocarinaGameRoundNum++; gSaveContext.ocarinaGameRoundNum++;
} }
if (IS_RANDO) { if (ocarinaGameRoundNum == 2) {
gSaveContext.ocarinaGameRoundNum = 3;
}
if (ocarinaGameRoundNum == 2 || IS_RANDO) {
Flags_SetItemGetInf(ITEMGETINF_17); Flags_SetItemGetInf(ITEMGETINF_17);
this->actionFunc = EnSkj_CleanupOcarinaGame; this->actionFunc = EnSkj_CleanupOcarinaGame;
} else { } else {

View File

@ -37,4 +37,6 @@ typedef struct EnSkj {
/* 0x02F4 */ Vec3f posCopy; /* 0x02F4 */ Vec3f posCopy;
} EnSkj; // size = 0x0300 } EnSkj; // size = 0x0300
void EnSkj_CleanupOcarinaGame(EnSkj* enSkj, PlayState* play);
#endif #endif