Early Eyeball Frog (#4120)

* early eyeball is real :D

* make cvar

* update cvars

* fix additional cvar check bug
This commit is contained in:
inspectredc 2024-09-13 00:01:57 +01:00 committed by GitHub
parent 1f85420625
commit c507d4d9a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 86 additions and 29 deletions

View File

@ -1421,6 +1421,8 @@ void DrawEnhancementsMenu() {
UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows bypassing Bongo Bongo's intro cutscene to quickly kill him"); UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows bypassing Bongo Bongo's intro cutscene to quickly kill him");
UIWidgets::PaddedEnhancementCheckbox("Original RBA Values", CVAR_ENHANCEMENT("RestoreRBAValues"), true, false); UIWidgets::PaddedEnhancementCheckbox("Original RBA Values", CVAR_ENHANCEMENT("RestoreRBAValues"), true, false);
UIWidgets::Tooltip("Restores the original outcomes when performing Reverse Bottle Adventure."); UIWidgets::Tooltip("Restores the original outcomes when performing Reverse Bottle Adventure.");
UIWidgets::PaddedEnhancementCheckbox("Early Eyeball Frog", CVAR_ENHANCEMENT("EarlyEyeballFrog"), true, false);
UIWidgets::Tooltip("Restores a bug from NTSC 1.0/1.1 that allows you to obtain the eyeball frog from King Zora instead of the Zora Tunic by holding shield.");
ImGui::EndMenu(); ImGui::EndMenu();
} }

View File

@ -128,18 +128,41 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) {
switch (Message_GetState(&play->msgCtx)) { switch (Message_GetState(&play->msgCtx)) {
case TEXT_STATE_DONE: case TEXT_STATE_DONE:
ret = NPC_TALK_STATE_IDLE; if (CVarGetInteger(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 0)) {
switch (this->actor.textId) { if (Message_ShouldAdvance(play)) {
case 0x4012: ret = NPC_TALK_STATE_ITEM_GIVEN;
Flags_SetInfTable(INFTABLE_139); }
ret = NPC_TALK_STATE_ACTION; } else {
break; ret = NPC_TALK_STATE_IDLE;
case 0x401B: switch (this->actor.textId) {
ret = !Message_ShouldAdvance(play) ? NPC_TALK_STATE_TALKING : NPC_TALK_STATE_ACTION; case 0x4012:
break; Flags_SetInfTable(INFTABLE_139);
case 0x401F: ret = NPC_TALK_STATE_ACTION;
Flags_SetInfTable(INFTABLE_139); break;
break; case 0x401B:
ret = !Message_ShouldAdvance(play) ? NPC_TALK_STATE_TALKING : NPC_TALK_STATE_ACTION;
break;
case 0x401F:
Flags_SetInfTable(INFTABLE_139);
break;
}
}
break;
case TEXT_STATE_CLOSING:
if (CVarGetInteger(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 0)) {
ret = NPC_TALK_STATE_IDLE;
switch (this->actor.textId) {
case 0x4012:
Flags_SetInfTable(INFTABLE_139);
ret = NPC_TALK_STATE_ACTION;
break;
case 0x401B:
ret = !Message_ShouldAdvance(play) ? NPC_TALK_STATE_TALKING : NPC_TALK_STATE_ACTION;
break;
case 0x401F:
Flags_SetInfTable(INFTABLE_139);
break;
}
} }
break; break;
case TEXT_STATE_DONE_FADING: case TEXT_STATE_DONE_FADING:
@ -160,7 +183,9 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) {
} }
if (this->actor.textId == 0x4014) { if (this->actor.textId == 0x4014) {
if (play->msgCtx.choiceIndex == 0) { if (play->msgCtx.choiceIndex == 0) {
EnKz_SetupGetItem(this, play); if (!CVarGetInteger(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 0)) {
EnKz_SetupGetItem(this, play);
}
ret = NPC_TALK_STATE_ACTION; ret = NPC_TALK_STATE_ACTION;
} else { } else {
this->actor.textId = 0x4016; this->actor.textId = 0x4016;
@ -175,7 +200,6 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) {
break; break;
case TEXT_STATE_NONE: case TEXT_STATE_NONE:
case TEXT_STATE_DONE_HAS_NEXT: case TEXT_STATE_DONE_HAS_NEXT:
case TEXT_STATE_CLOSING:
case TEXT_STATE_SONG_DEMO_DONE: case TEXT_STATE_SONG_DEMO_DONE:
case TEXT_STATE_8: case TEXT_STATE_8:
case TEXT_STATE_9: case TEXT_STATE_9:
@ -207,25 +231,34 @@ s32 func_80A9C95C(PlayState* play, EnKz* this, s16* talkState, f32 unkf, NpcGetT
return 1; return 1;
} }
if (*talkState != NPC_TALK_STATE_IDLE) { if (!CVarGetInteger(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 0)) {
*talkState = updateTalkState(play, &this->actor); if (*talkState != NPC_TALK_STATE_IDLE) {
return 0; *talkState = updateTalkState(play, &this->actor);
} return 0;
}
yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos);
yaw -= this->actor.shape.rot.y; yaw -= this->actor.shape.rot.y;
if ((fabsf(yaw) > 1638.0f) || (this->actor.xzDistToPlayer < 265.0f)) { if ((fabsf(yaw) > 1638.0f) || (this->actor.xzDistToPlayer < 265.0f)) {
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
return 0; return 0;
} }
this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->actor.flags |= ACTOR_FLAG_TARGETABLE;
}
Actor_GetScreenPos(play, &this->actor, &sp32, &sp30); Actor_GetScreenPos(play, &this->actor, &sp32, &sp30);
if (!((sp32 >= -30) && (sp32 < 361) && (sp30 >= -10) && (sp30 < 241))) { if (!((sp32 >= -30) && (sp32 < 361) && (sp30 >= -10) && (sp30 < 241))) {
return 0; return 0;
} }
if (CVarGetInteger(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 0)) {
if (*talkState != NPC_TALK_STATE_IDLE) {
*talkState = updateTalkState(play, &this->actor);
return 0;
}
}
xzDistToPlayer = this->actor.xzDistToPlayer; xzDistToPlayer = this->actor.xzDistToPlayer;
this->actor.xzDistToPlayer = Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos); this->actor.xzDistToPlayer = Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos);
if (func_8002F2CC(&this->actor, play, unkf) == 0) { if (func_8002F2CC(&this->actor, play, unkf) == 0) {
@ -241,6 +274,18 @@ s32 func_80A9C95C(PlayState* play, EnKz* this, s16* talkState, f32 unkf, NpcGetT
void func_80A9CB18(EnKz* this, PlayState* play) { void func_80A9CB18(EnKz* this, PlayState* play) {
Player* player = GET_PLAYER(play); Player* player = GET_PLAYER(play);
if (CVarGetInteger(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 0)) {
f32 yaw;
yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos);
yaw -= this->actor.shape.rot.y;
if ((fabsf(yaw) > 1638.0f) || (this->actor.xzDistToPlayer < 265.0f)) {
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
return 0;
}
this->actor.flags |= ACTOR_FLAG_TARGETABLE;
}
if (func_80A9C95C(play, this, &this->interactInfo.talkState, 340.0f, EnKz_GetText, func_80A9C6C0)) { if (func_80A9C95C(play, this, &this->interactInfo.talkState, 340.0f, EnKz_GetText, func_80A9C6C0)) {
if (GameInteractor_Should(VB_BE_ABLE_TO_EXCHANGE_RUTOS_LETTER, (this->actor.textId == 0x401A), this) && if (GameInteractor_Should(VB_BE_ABLE_TO_EXCHANGE_RUTOS_LETTER, (this->actor.textId == 0x401A), this) &&
!Flags_GetEventChkInf(EVENTCHKINF_KING_ZORA_MOVED)) !Flags_GetEventChkInf(EVENTCHKINF_KING_ZORA_MOVED))
@ -262,12 +307,15 @@ void func_80A9CB18(EnKz* this, PlayState* play) {
this->actor.textId = 0x4014; this->actor.textId = 0x4014;
this->sfxPlayed = false; this->sfxPlayed = false;
player->actor.textId = this->actor.textId; player->actor.textId = this->actor.textId;
this->isTrading = true; if (!CVarGetInteger(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 0)) {
this->isTrading = true;
}
return; return;
} }
} }
if (!CVarGetInteger(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 0)) {
this->isTrading = false; this->isTrading = false;
}
if (Flags_GetInfTable(INFTABLE_139)) { if (Flags_GetInfTable(INFTABLE_139)) {
this->actor.textId = CHECK_QUEST_ITEM(QUEST_SONG_SERENADE) ? 0x4045 : 0x401A; this->actor.textId = CHECK_QUEST_ITEM(QUEST_SONG_SERENADE) ? 0x4045 : 0x401A;
player->actor.textId = this->actor.textId; player->actor.textId = this->actor.textId;
@ -434,6 +482,9 @@ void EnKz_StopMweep(EnKz* this, PlayState* play) {
void EnKz_Wait(EnKz* this, PlayState* play) { void EnKz_Wait(EnKz* this, PlayState* play) {
if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) { if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
if (CVarGetInteger(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 0)) {
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
}
this->actionFunc = EnKz_SetupGetItem; this->actionFunc = EnKz_SetupGetItem;
EnKz_SetupGetItem(this, play); EnKz_SetupGetItem(this, play);
} else { } else {
@ -460,7 +511,11 @@ void EnKz_SetupGetItem(EnKz* this, PlayState* play) {
Flags_SetRandomizerInf(RAND_INF_ADULT_TRADES_ZD_TRADE_PRESCRIPTION); Flags_SetRandomizerInf(RAND_INF_ADULT_TRADES_ZD_TRADE_PRESCRIPTION);
} }
} else { } else {
getItemId = this->isTrading ? GI_FROG : GI_TUNIC_ZORA; if (CVarGetInteger(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 0)) {
getItemId = func_8002F368(play) == EXCH_ITEM_PRESCRIPTION ? GI_FROG : GI_TUNIC_ZORA;
} else {
getItemId = this->isTrading ? GI_FROG : GI_TUNIC_ZORA;
}
yRange = fabsf(this->actor.yDistToPlayer) + 1.0f; yRange = fabsf(this->actor.yDistToPlayer) + 1.0f;
xzRange = this->actor.xzDistToPlayer + 1.0f; xzRange = this->actor.xzDistToPlayer + 1.0f;
Actor_OfferGetItem(&this->actor, play, getItemId, xzRange, yRange); Actor_OfferGetItem(&this->actor, play, getItemId, xzRange, yRange);