Unify Shops, Scrubs and Merchants price and hinting code (#4321)

* commiting to branch switch

* shop,scrubs and merchant code unified

* last cleanups

* Update soh/soh/Enhancements/randomizer/hook_handlers.cpp

Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>

* attempt to fix reviews DOES NOT BUILD

* TIL include order matters

* Update soh/soh/Enhancements/randomizer/3drando/shops.cpp

Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>

* Update soh/soh/Enhancements/randomizer/3drando/shops.cpp

Note to self, Don't code tired. *proceeds to ignore note*

Co-authored-by: Angelo Bulfone <boomshroom@users.noreply.github.com>

* fix typos

* post merge

* commiting to check something

* probably cleaned up, needs a doublecheck

* fix presets

* address reviews

* fix small shopsanity count oversights

* undo rename

---------

Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com>
Co-authored-by: Angelo Bulfone <boomshroom@users.noreply.github.com>
Co-authored-by: Malkierian <malkierian@gmail.com>
This commit is contained in:
Pepper0ni
2024-10-08 22:33:58 +01:00
committed by GitHub
parent a9fbd8243f
commit 10921b2ade
51 changed files with 1403 additions and 920 deletions

View File

@@ -164,7 +164,7 @@ void EnDs_OfferOddPotion(EnDs* this, PlayState* play) {
}
s32 EnDs_CheckRupeesAndBottle() {
if (gSaveContext.rupees < 100) {
if (GameInteractor_Should(VB_GRANNY_SAY_INSUFFICIENT_RUPEES, gSaveContext.rupees < 100, NULL)) {
return 0;
} else if (GameInteractor_Should(VB_NEED_BOTTLE_FOR_GRANNYS_ITEM, Inventory_HasEmptyBottle() == 0, NULL)) {
return 1;
@@ -174,7 +174,7 @@ s32 EnDs_CheckRupeesAndBottle() {
}
void EnDs_GiveBluePotion(EnDs* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play) || !GameInteractor_Should(VB_GIVE_ITEM_FROM_GRANNYS_SHOP, true, this)) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
this->actionFunc = EnDs_Talk;
} else {
@@ -195,7 +195,9 @@ void EnDs_OfferBluePotion(EnDs* this, PlayState* play) {
this->actionFunc = EnDs_TalkNoEmptyBottle;
return;
case 2: // have 100 rupees and empty bottle
Rupees_ChangeBy(-100);
if(GameInteractor_Should(VB_GRANNY_TAKE_MONEY, true, this)){
Rupees_ChangeBy(-100);
}
this->actor.flags &= ~ACTOR_FLAG_WILL_TALK;
if (GameInteractor_Should(VB_GIVE_ITEM_FROM_GRANNYS_SHOP, true, this)) {
@@ -203,9 +205,9 @@ void EnDs_OfferBluePotion(EnDs* this, PlayState* play) {
Actor_OfferGetItem(&this->actor, play, GI_POTION_BLUE, 10000.0f, 50.0f);
gSaveContext.pendingSale = itemEntry.itemId;
gSaveContext.pendingSaleMod = itemEntry.modIndex;
this->actionFunc = EnDs_GiveBluePotion;
}
this->actionFunc = EnDs_GiveBluePotion;
return;
}
break;

View File

@@ -21,4 +21,8 @@ typedef struct EnDs {
/* 0x01EC */ EnDsActionFunc actionFunc;
} EnDs; // size = 0x01F0
void EnDs_Talk(EnDs* actor, PlayState* play);
void EnDs_TalkAfterGiveOddPotion(EnDs* actor, PlayState* play);
#endif

View File

@@ -245,15 +245,15 @@ void EnGm_ProcessChoiceIndex(EnGm* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) {
switch (play->msgCtx.choiceIndex) {
case 0: // yes
if (gSaveContext.rupees < 200) {
if (GameInteractor_Should(VB_CHECK_RANDO_PRICE_OF_MEDIGORON, gSaveContext.rupees < 200, this)) {
Message_ContinueTextbox(play, 0xC8);
this->actionFunc = func_80A3DD7C;
} else {
if (GameInteractor_Should(VB_GIVE_ITEM_FROM_MEDIGORON, true, this)) {
Actor_OfferGetItem(&this->actor, play, GI_SWORD_KNIFE, 415.0f, 10.0f);
this->actionFunc = func_80A3DF00;
}
this->actionFunc = func_80A3DF00;
}
break;
case 1: // no
@@ -265,8 +265,7 @@ void EnGm_ProcessChoiceIndex(EnGm* this, PlayState* play) {
}
void func_80A3DF00(EnGm* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play) || !GameInteractor_Should(VB_GIVE_ITEM_FROM_MEDIGORON, true, this)) {
Flags_SetRandomizerInf(RAND_INF_MERCHANTS_MEDIGORON);
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
this->actionFunc = func_80A3DF60;
} else {

View File

@@ -24,4 +24,6 @@ typedef struct EnGm {
/* 0x02C4 */ Vec3f talkPos;
} EnGm; // size = 0x02D0
void func_80A3DC44(EnGm* actor, PlayState* play);
#endif

View File

@@ -128,11 +128,9 @@ void func_80A8910C(EnJs* this, PlayState* play) {
}
void func_80A89160(EnJs* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play) || !GameInteractor_Should(VB_GIVE_ITEM_FROM_CARPET_SALESMAN, true, this)) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
En_Js_SetupAction(this, func_80A8910C);
// Moved into the text handling to patch a text bug, not a great solution though
// Flags_SetRandomizerInf(RAND_INF_MERCHANTS_CARPET_SALESMAN);
} else {
GetItemEntry itemEntry = ItemTable_Retrieve(GI_BOMBCHUS_10);
gSaveContext.pendingSale = itemEntry.itemId;
@@ -145,17 +143,18 @@ void func_80A891C4(EnJs* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) {
switch (play->msgCtx.choiceIndex) {
case 0: // yes
if (gSaveContext.rupees < 200) {
if (GameInteractor_Should(VB_CHECK_RANDO_PRICE_OF_CARPET_SALESMAN, gSaveContext.rupees < 200, this)) {
Message_ContinueTextbox(play, 0x6075);
func_80A89008(this);
} else {
if (GameInteractor_Should(VB_GIVE_BOMBCHUS_FROM_CARPET_SALESMAN, true, this) ||
(Actor_HasParent(&this->actor, play) || !GameInteractor_Should(VB_GIVE_ITEM_FROM_CARPET_SALESMAN, true, this))){
Rupees_ChangeBy(-200);
En_Js_SetupAction(this, func_80A89160);
} else{
Message_ContinueTextbox(play, 0x6073);
func_80A89008(this);
if (!GameInteractor_Should(VB_GIVE_ITEM_FROM_CARPET_SALESMAN, false, this)) {
if (GameInteractor_Should(VB_GIVE_BOMBCHUS_FROM_CARPET_SALESMAN, true, this) || Actor_HasParent(&this->actor, play)){
Rupees_ChangeBy(-200);
En_Js_SetupAction(this, func_80A89160);
} else{
Message_ContinueTextbox(play, 0x6073);
func_80A89008(this);
}
}
}
break;

View File

@@ -22,4 +22,6 @@ typedef struct EnJs {
/* 0x028C */ EnJsActionFunc actionFunc;
} EnJs; // size = 0x0290
void func_80A890C0(EnJs* actor, PlayState* play);
#endif