vb richard (#108)

* Lost Dog + Custom Hook Handler

* vb richard

* fix the merge

---------

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

View File

@ -303,6 +303,8 @@ typedef enum {
GI_VB_GIVE_ITEM_FROM_HORSEBACK_ARCHERY,
// Opt: *EnSth
GI_VB_GIVE_ITEM_FROM_SKULLTULA_REWARD,
// Opt: *EnHy
GI_VB_GIVE_ITEM_FROM_LOST_DOG,
GI_VB_GIVE_ITEM_FAIRY_OCARINA,
GI_VB_GIVE_ITEM_WEIRD_EGG,

View File

@ -28,6 +28,7 @@ extern "C" {
#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_Skj/z_en_skj.h"
#include "src/overlays/actors/ovl_En_Hy/z_en_hy.h"
#include "adult_trade_shuffle.h"
extern SaveContext gSaveContext;
extern PlayState* gPlayState;
@ -917,6 +918,15 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void
*should = false;
break;
}
case GI_VB_GIVE_ITEM_FROM_LOST_DOG: {
EnHy* enHy = static_cast<EnHy*>(optionalArg);
Flags_SetInfTable(INFTABLE_191);
gSaveContext.dogParams = 0;
gSaveContext.dogIsLost = false;
enHy->actionFunc = func_80A7127C;
*should = false;
break;
}
case GI_VB_TRADE_TIMER_ODD_MUSHROOM:
case GI_VB_TRADE_TIMER_EYEDROPS:
case GI_VB_TRADE_TIMER_FROG:

View File

@ -14,6 +14,7 @@
#include "objects/object_cne/object_cne.h"
#include "objects/object_cob/object_cob.h"
#include "objects/object_os_anime/object_os_anime.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED)
@ -659,19 +660,10 @@ s16 func_80A70058(PlayState* play, Actor* thisx) {
gSaveContext.dogParams = 0;
break;
case 0x709F:
if (Flags_GetInfTable(INFTABLE_191)) { // Already brought the lost dog back
func_80A6F7CC(this, play, GI_RUPEE_BLUE);
} else {
if (!IS_RANDO) {
func_80A6F7CC(this, play, GI_HEART_PIECE);
} else {
this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_LOST_DOG, GI_HEART_PIECE);
// The follownig line and last arguments of GiveItemEntryFromActor are copied from func_80A6F7CC
this->unkGetItemId = this->getItemEntry.getItemId;
GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f);
}
if (GameInteractor_Should(GI_VB_GIVE_ITEM_FROM_LOST_DOG, true, this)) {
func_80A6F7CC(this, play, Flags_GetInfTable(INFTABLE_191) ? GI_RUPEE_BLUE : GI_HEART_PIECE);
this->actionFunc = func_80A714C4;
}
this->actionFunc = func_80A714C4;
break;
}
return NPC_TALK_STATE_IDLE;
@ -1068,36 +1060,26 @@ void func_80A714C4(EnHy* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actionFunc = func_80A71530;
} else {
if (!IS_RANDO || this->getItemEntry.getItemId == GI_NONE) {
Actor_OfferGetItem(&this->actor, play, this->unkGetItemId, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f);
} else {
GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f);
}
Actor_OfferGetItem(&this->actor, play, this->unkGetItemId, this->actor.xzDistToPlayer + 1.0f,
fabsf(this->actor.yDistToPlayer) + 1.0f);
}
}
void func_80A71530(EnHy* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) {
if (IS_RANDO) {
if (!Flags_GetInfTable(INFTABLE_191)) {
Flags_SetInfTable(INFTABLE_191);
}
gSaveContext.dogParams = 0;
gSaveContext.dogIsLost = false;
} else {
switch (this->unkGetItemId) {
case GI_HEART_PIECE:
gSaveContext.dogParams = 0;
gSaveContext.dogIsLost = false;
Flags_SetInfTable(INFTABLE_191);
break;
case GI_RUPEE_BLUE:
Rupees_ChangeBy(5);
gSaveContext.dogParams = 0;
gSaveContext.dogIsLost = false;
break;
}
switch (this->unkGetItemId) {
case GI_HEART_PIECE:
gSaveContext.dogParams = 0;
gSaveContext.dogIsLost = false;
SET_INFTABLE(INFTABLE_191);
break;
case GI_RUPEE_BLUE:
Rupees_ChangeBy(5);
gSaveContext.dogParams = 0;
gSaveContext.dogIsLost = false;
break;
}
this->actionFunc = func_80A7127C;
}
}

View File

@ -62,4 +62,6 @@ typedef struct EnHy {
/* */ GetItemEntry getItemEntry;
} EnHy; // size = 0x0334
void func_80A7127C(EnHy* enHy, PlayState* play);
#endif