Skip to content

Commit 563a7e3

Browse files
committed
make cvar
1 parent df3811f commit 563a7e3

File tree

2 files changed

+85
-43
lines changed

2 files changed

+85
-43
lines changed

soh/soh/SohMenuBar.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1369,6 +1369,8 @@ void DrawEnhancementsMenu() {
13691369
UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows bypassing Bongo Bongo's intro cutscene to quickly kill him");
13701370
UIWidgets::PaddedEnhancementCheckbox("Original RBA Values", "gRestoreRBAValues", true, false);
13711371
UIWidgets::Tooltip("Restores the original outcomes when performing Reverse Bottle Adventure.");
1372+
UIWidgets::PaddedEnhancementCheckbox("Early Eyeball Frog", "gRestorations.EarlyEyeballFrog", true, false);
1373+
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.");
13721374

13731375
ImGui::EndMenu();
13741376
}

soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c

+83-43
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,42 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) {
127127
s16 ret = NPC_TALK_STATE_TALKING;
128128

129129
switch (Message_GetState(&play->msgCtx)) {
130+
case TEXT_STATE_DONE:
131+
if (CVarGetInteger("gRestorations.EarlyEyeballFrog", 0)) {
132+
if (Message_ShouldAdvance(play)) {
133+
ret = NPC_TALK_STATE_ITEM_GIVEN;
134+
}
135+
} else {
136+
ret = NPC_TALK_STATE_IDLE;
137+
switch (this->actor.textId) {
138+
case 0x4012:
139+
Flags_SetInfTable(INFTABLE_139);
140+
ret = NPC_TALK_STATE_ACTION;
141+
break;
142+
case 0x401B:
143+
ret = !Message_ShouldAdvance(play) ? NPC_TALK_STATE_TALKING : NPC_TALK_STATE_ACTION;
144+
break;
145+
case 0x401F:
146+
Flags_SetInfTable(INFTABLE_139);
147+
break;
148+
}
149+
}
150+
break;
130151
case TEXT_STATE_CLOSING:
131-
ret = NPC_TALK_STATE_IDLE;
132-
switch (this->actor.textId) {
133-
case 0x4012:
134-
Flags_SetInfTable(INFTABLE_139);
135-
ret = NPC_TALK_STATE_ACTION;
136-
break;
137-
case 0x401B:
138-
ret = !Message_ShouldAdvance(play) ? NPC_TALK_STATE_TALKING : NPC_TALK_STATE_ACTION;
139-
break;
140-
case 0x401F:
141-
Flags_SetInfTable(INFTABLE_139);
142-
break;
152+
if (CVarGetInteger("gRestorations.EarlyEyeballFrog", 0)) {
153+
ret = NPC_TALK_STATE_IDLE;
154+
switch (this->actor.textId) {
155+
case 0x4012:
156+
Flags_SetInfTable(INFTABLE_139);
157+
ret = NPC_TALK_STATE_ACTION;
158+
break;
159+
case 0x401B:
160+
ret = !Message_ShouldAdvance(play) ? NPC_TALK_STATE_TALKING : NPC_TALK_STATE_ACTION;
161+
break;
162+
case 0x401F:
163+
Flags_SetInfTable(INFTABLE_139);
164+
break;
165+
}
143166
}
144167
break;
145168
case TEXT_STATE_DONE_FADING:
@@ -159,8 +182,10 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) {
159182
break;
160183
}
161184
if (this->actor.textId == 0x4014) {
162-
if (play->msgCtx.choiceIndex == 0 && this->actor.textId == 0x4014) {
163-
// EnKz_SetupGetItem(this, play);
185+
if (play->msgCtx.choiceIndex == 0 && (CVarGetInteger("gRestorations.EarlyEyeballFrog", 0) && this->actor.textId == 0x4014)) {
186+
if (!CVarGetInteger("gRestorations.EarlyEyeballFrog", 0)) {
187+
EnKz_SetupGetItem(this, play);
188+
}
164189
ret = NPC_TALK_STATE_ACTION;
165190
} else {
166191
this->actor.textId = 0x4016;
@@ -173,11 +198,6 @@ s16 func_80A9C6C0(PlayState* play, Actor* thisx) {
173198
ret = NPC_TALK_STATE_ACTION;
174199
}
175200
break;
176-
case TEXT_STATE_DONE:
177-
if (Message_ShouldAdvance(play)) {
178-
ret = NPC_TALK_STATE_ITEM_GIVEN;
179-
}
180-
break;
181201
case TEXT_STATE_NONE:
182202
case TEXT_STATE_DONE_HAS_NEXT:
183203
case TEXT_STATE_SONG_DEMO_DONE:
@@ -204,30 +224,39 @@ s32 func_80A9C95C(PlayState* play, EnKz* this, s16* talkState, f32 unkf, NpcGetT
204224
s16 sp32;
205225
s16 sp30;
206226
f32 xzDistToPlayer;
207-
// f32 yaw;
227+
f32 yaw;
208228

209229
if (Actor_ProcessTalkRequest(&this->actor, play)) {
210230
*talkState = NPC_TALK_STATE_TALKING;
211231
return 1;
212232
}
213233

214-
// yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos);
215-
// yaw -= this->actor.shape.rot.y;
216-
// if ((fabsf(yaw) > 1638.0f) || (this->actor.xzDistToPlayer < 265.0f)) {
217-
// this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
218-
// return 0;
219-
// }
234+
if (!CVarGetInteger("gRestorations.EarlyEyeballFrog", 0)) {
235+
if (*talkState != NPC_TALK_STATE_IDLE) {
236+
*talkState = updateTalkState(play, &this->actor);
237+
return 0;
238+
}
220239

221-
// this->actor.flags |= ACTOR_FLAG_TARGETABLE;
240+
yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos);
241+
yaw -= this->actor.shape.rot.y;
242+
if ((fabsf(yaw) > 1638.0f) || (this->actor.xzDistToPlayer < 265.0f)) {
243+
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
244+
return 0;
245+
}
246+
247+
this->actor.flags |= ACTOR_FLAG_TARGETABLE;
248+
}
222249

223250
Actor_GetScreenPos(play, &this->actor, &sp32, &sp30);
224251
if (!((sp32 >= -30) && (sp32 < 361) && (sp30 >= -10) && (sp30 < 241))) {
225252
return 0;
226253
}
227254

228-
if (*talkState != NPC_TALK_STATE_IDLE) {
229-
*talkState = updateTalkState(play, &this->actor);
230-
return 0;
255+
if (CVarGetInteger("gRestorations.EarlyEyeballFrog", 0)) {
256+
if (*talkState != NPC_TALK_STATE_IDLE) {
257+
*talkState = updateTalkState(play, &this->actor);
258+
return 0;
259+
}
231260
}
232261

233262
xzDistToPlayer = this->actor.xzDistToPlayer;
@@ -244,16 +273,18 @@ s32 func_80A9C95C(PlayState* play, EnKz* this, s16* talkState, f32 unkf, NpcGetT
244273

245274
void func_80A9CB18(EnKz* this, PlayState* play) {
246275
Player* player = GET_PLAYER(play);
247-
f32 yaw;
248276

249-
yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos);
250-
yaw -= this->actor.shape.rot.y;
251-
if ((fabsf(yaw) > 1638.0f) || (this->actor.xzDistToPlayer < 265.0f)) {
252-
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
253-
return 0;
254-
}
277+
if (CVarGetInteger("gRestorations.EarlyEyeballFrog", 0)) {
278+
f32 yaw;
279+
yaw = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos);
280+
yaw -= this->actor.shape.rot.y;
281+
if ((fabsf(yaw) > 1638.0f) || (this->actor.xzDistToPlayer < 265.0f)) {
282+
this->actor.flags &= ~ACTOR_FLAG_TARGETABLE;
283+
return 0;
284+
}
255285

256-
this->actor.flags |= ACTOR_FLAG_TARGETABLE;
286+
this->actor.flags |= ACTOR_FLAG_TARGETABLE;
287+
}
257288

258289
if (func_80A9C95C(play, this, &this->interactInfo.talkState, 340.0f, EnKz_GetText, func_80A9C6C0)) {
259290
if (GameInteractor_Should(GI_VB_BE_ABLE_TO_EXCHANGE_RUTOS_LETTER, (this->actor.textId == 0x401A), this) &&
@@ -276,12 +307,15 @@ void func_80A9CB18(EnKz* this, PlayState* play) {
276307
this->actor.textId = 0x4014;
277308
this->sfxPlayed = false;
278309
player->actor.textId = this->actor.textId;
279-
// this->isTrading = true;
310+
if (!CVarGetInteger("gRestorations.EarlyEyeballFrog", 0)) {
311+
this->isTrading = true;
312+
}
280313
return;
281314
}
282315
}
283-
284-
// this->isTrading = false;
316+
if (!CVarGetInteger("gRestorations.EarlyEyeballFrog", 0)) {
317+
this->isTrading = false;
318+
}
285319
if (Flags_GetInfTable(INFTABLE_139)) {
286320
this->actor.textId = CHECK_QUEST_ITEM(QUEST_SONG_SERENADE) ? 0x4045 : 0x401A;
287321
player->actor.textId = this->actor.textId;
@@ -448,7 +482,9 @@ void EnKz_StopMweep(EnKz* this, PlayState* play) {
448482

449483
void EnKz_Wait(EnKz* this, PlayState* play) {
450484
if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) {
451-
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
485+
if (CVarGetInteger("gRestorations.EarlyEyeballFrog", 0)) {
486+
this->interactInfo.talkState = NPC_TALK_STATE_IDLE;
487+
}
452488
this->actionFunc = EnKz_SetupGetItem;
453489
EnKz_SetupGetItem(this, play);
454490
} else {
@@ -475,7 +511,11 @@ void EnKz_SetupGetItem(EnKz* this, PlayState* play) {
475511
Flags_SetRandomizerInf(RAND_INF_ADULT_TRADES_ZD_TRADE_PRESCRIPTION);
476512
}
477513
} else {
478-
getItemId = func_8002F368(play) == EXCH_ITEM_PRESCRIPTION ? GI_FROG : GI_TUNIC_ZORA;
514+
if (CVarGetInteger("gRestorations.EarlyEyeballFrog", 0)) {
515+
getItemId = func_8002F368(play) == EXCH_ITEM_PRESCRIPTION ? GI_FROG : GI_TUNIC_ZORA;
516+
} else {
517+
getItemId = this->isTrading ? GI_FROG : GI_TUNIC_ZORA;
518+
}
479519
yRange = fabsf(this->actor.yDistToPlayer) + 1.0f;
480520
xzRange = this->actor.xzDistToPlayer + 1.0f;
481521
func_8002F434(&this->actor, play, getItemId, xzRange, yRange);

0 commit comments

Comments
 (0)