Skip to content

Commit

Permalink
Add toggles for disabling heart drops and random drops (#507)
Browse files Browse the repository at this point in the history
* Adds toggles for disabling random drops and fixed heart drops

* Changed the "No Fixed Heart Drops" toggle to the more useful "No Random Heart Drops" toggle

* Adds an explanation that the no heart drops option is similar to Hero Mode

* Moved difficulty options into their own sub-menu
Moved time saver options into their own sub-menu
Moved clutter reducing options into their own sub-menu

* fixed the tag name of mweep speed

* Moved Skip Text to Experimental
  • Loading branch information
1SDANi authored Jul 4, 2022
1 parent d63c007 commit 818d5f9
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 41 deletions.
90 changes: 57 additions & 33 deletions libultraship/libultraship/ImGuiImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,43 +883,65 @@ namespace SohImGui {
{
if (ImGui::BeginMenu("Gameplay"))
{
EnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, "");
EnhancementSliderInt("King Zora Speed: %dx", "##WEEPSPEED", "gMweepSpeed", 1, 5, "");
EnhancementSliderInt("Biggoron Forge Time: %d days", "##FORGETIME", "gForgeTime", 0, 3, "");
Tooltip("Allows you to change the number of days it takes for Biggoron to forge the Biggoron Sword");
EnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, "");
EnhancementSliderInt("Damage Multiplier %dx", "##DAMAGEMUL", "gDamageMul", 1, 4, "");
Tooltip("Modifies all sources of damage not affected by other sliders");
EnhancementSliderInt("Fall Damage Multiplier %dx", "##FALLDAMAGEMUL", "gFallDamageMul", 1, 4, "");
Tooltip("Modifies all fall damage");
EnhancementSliderInt("Void Damage Multiplier %dx", "##VOIDDAMAGEMUL", "gVoidDamageMul", 1, 4, "");
Tooltip("Modifies all void out damage");

EnhancementCheckbox("Skip Text", "gSkipText");
Tooltip("Holding down B skips text");
EnhancementCheckbox("Mute Low HP Alarm", "gLowHpAlarm");
Tooltip("Disable the low HP beeping sound");
EnhancementCheckbox("Minimal UI", "gMinimalUI");
Tooltip("Hides most of the UI when not needed");
if (ImGui::BeginMenu("Time Savers"))
{
EnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, "");
EnhancementSliderInt("King Zora Speed: %dx", "##MWEEPSPEED", "gMweepSpeed", 1, 5, "");
EnhancementSliderInt("Biggoron Forge Time: %d days", "##FORGETIME", "gForgeTime", 0, 3, "");
Tooltip("Allows you to change the number of days it takes for Biggoron to forge the Biggoron Sword");
EnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, "");

EnhancementCheckbox("Faster Block Push", "gFasterBlockPush");
EnhancementCheckbox("No Forced Navi", "gNoForcedNavi");
Tooltip("Prevent forced Navi conversations");
EnhancementCheckbox("No Skulltula Freeze", "gSkulltulaFreeze");
Tooltip("Stops the game from freezing the player when picking up Gold Skulltulas");
EnhancementCheckbox("MM Bunny Hood", "gMMBunnyHood");
Tooltip("Wearing the Bunny Hood grants a speed increase like in Majora's Mask");
EnhancementCheckbox("Fast Chests", "gFastChests");
Tooltip("Kick open every chest");
EnhancementCheckbox("Fast Drops", "gFastDrops");
Tooltip("Skip first-time pickup messages for consumable items");
EnhancementCheckbox("Better Owl", "gBetterOwl");
Tooltip("The default response to Kaepora Gaebora is always that you understood what he said");

ImGui::EndMenu();
}

if (ImGui::BeginMenu("Difficulty Options"))
{
EnhancementSliderInt("Damage Multiplier %dx", "##DAMAGEMUL", "gDamageMul", 1, 4, "");
Tooltip("Modifies all sources of damage not affected by other sliders");
EnhancementSliderInt("Fall Damage Multiplier %dx", "##FALLDAMAGEMUL", "gFallDamageMul", 1, 4, "");
Tooltip("Modifies all fall damage");
EnhancementSliderInt("Void Damage Multiplier %dx", "##VOIDDAMAGEMUL", "gVoidDamageMul", 1, 4, "");
Tooltip("Modifies all void out damage");

EnhancementCheckbox("No Random Drops", "gNoRandomDrops");
Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses");
EnhancementCheckbox("No Heart Drops", "gNoHeartDrops");
Tooltip("Disables heart drops, but not heart placements, like from a Deku Scrub running off. This simulates Hero Mode from other games in the series.");

ImGui::EndMenu();
}

if (ImGui::BeginMenu("Reduced Clutter"))
{
EnhancementCheckbox("Mute Low HP Alarm", "gLowHpAlarm");
Tooltip("Disable the low HP beeping sound");
EnhancementCheckbox("Minimal UI", "gMinimalUI");
Tooltip("Hides most of the UI when not needed");
EnhancementCheckbox("Disable Navi Call Audio", "gDisableNaviCallAudio");
Tooltip("Disables the voice audio when Navi calls you");

ImGui::EndMenu();
}


EnhancementCheckbox("Visual Stone of Agony", "gVisualAgony");
Tooltip("Displays an icon and plays a sound when Stone of Agony should be activated, for those without rumble");
EnhancementCheckbox("Faster Block Push", "gFasterBlockPush");
EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots");
Tooltip("Allows equipping the tunic and boots to c-buttons");
EnhancementCheckbox("MM Bunny Hood", "gMMBunnyHood");
Tooltip("Wearing the Bunny Hood grants a speed increase like in Majora's Mask");
EnhancementCheckbox("No Forced Navi", "gNoForcedNavi");
Tooltip("Prevent forced Navi conversations");
EnhancementCheckbox("No Skulltula Freeze", "gSkulltulaFreeze");
Tooltip("Stops the game from freezing the player when picking up Gold Skulltulas");
EnhancementCheckbox("Disable Navi Call Audio", "gDisableNaviCallAudio");
Tooltip("Disables the voice audio when Navi calls you");
EnhancementCheckbox("Fast Chests", "gFastChests");
Tooltip("Kick open every chest");
EnhancementCheckbox("Fast Drops", "gFastDrops");
Tooltip("Skip first-time pickup messages for consumable items");
EnhancementCheckbox("Better Owl", "gBetterOwl");
Tooltip("The default response to Kaepora Gaebora is always that you understood what he said");
EnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime");
Tooltip("Allows the Lon Lon Ranch obstacle course reward to be shared across time periods");
EnhancementCheckbox("Enable visible guard vision", "gGuardVision");
Expand Down Expand Up @@ -1069,6 +1091,8 @@ namespace SohImGui {
EnhancementCheckbox("Kokiri Draw Distance", "gDisableKokiriDrawDistance");
Tooltip("Kokiris are mystical being that appear from a certain distance\nEnable this will remove their draw distance");
}
EnhancementCheckbox("Skip Text", "gSkipText");
Tooltip("Holding down B skips text.\nKnown to cause a cutscene softlock in Water Temple.\nSoftlock can be fixed by pressing D-Right in Debug mode.");

ImGui::EndMenu();
}
Expand Down
12 changes: 9 additions & 3 deletions soh/src/code/z_en_item00.c
Original file line number Diff line number Diff line change
Expand Up @@ -1377,6 +1377,8 @@ EnItem00* Item_DropCollectible(GlobalContext* globalCtx, Vec3f* spawnPos, s16 pa

params &= 0x3FFF;

if ((params & 0x00FF) == ITEM00_HEART && CVar_GetS32("gNoHeartDrops", 0)) { return NULL; }

if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) {
// TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf)
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x,
Expand Down Expand Up @@ -1420,6 +1422,8 @@ EnItem00* Item_DropCollectible2(GlobalContext* globalCtx, Vec3f* spawnPos, s16 p

params &= 0x3FFF;

if ((params & 0x00FF) == ITEM00_HEART && CVar_GetS32("gNoHeartDrops", 0)) { return NULL; }

if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) {
// TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf)
spawnedActor = (EnItem00*)Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_ELF, spawnPos->x,
Expand Down Expand Up @@ -1455,6 +1459,8 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
param8000 = params & 0x8000;
params &= 0x7FFF;

if (CVar_GetS32("gNoRandomDrops", 0)) { return; }

if (fromActor != NULL) {
if (fromActor->dropFlag) {
if (fromActor->dropFlag & 0x01) {
Expand Down Expand Up @@ -1496,11 +1502,11 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
EffectSsDeadSound_SpawnStationary(globalCtx, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true,
DEADSOUND_REPEAT_MODE_OFF, 40);
return;
} else if (gSaveContext.health <= 0x30) { // 3 hearts or less
} else if (gSaveContext.health <= 0x30 && !CVar_GetS32("gNoHeartDrops", 0)) { // 3 hearts or less
params = 0xB * 0x10;
dropTableIndex = 0x0;
dropId = ITEM00_HEART;
} else if (gSaveContext.health <= 0x50) { // 5 hearts or less
} else if (gSaveContext.health <= 0x50 && !CVar_GetS32("gNoHeartDrops", 0)) { // 5 hearts or less
params = 0xA * 0x10;
dropTableIndex = 0x0;
dropId = ITEM00_HEART;
Expand Down Expand Up @@ -1533,7 +1539,7 @@ void Item_DropCollectibleRandom(GlobalContext* globalCtx, Actor* fromActor, Vec3
}
}

if (dropId != 0xFF) {
if (dropId != 0xFF && (!CVar_GetS32("gNoHeartDrops", 0) || dropId != ITEM00_HEART)) {
dropQuantity = sDropQuantities[params + dropTableIndex];
while (dropQuantity > 0) {
if (!param8000) {
Expand Down
2 changes: 1 addition & 1 deletion soh/src/code/z_message_PAL.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ void Message_DrawText(GlobalContext* globalCtx, Gfx** gfxP) {
}
}
if (msgCtx->textDelayTimer == 0) {
msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 1);
msgCtx->textDrawPos = i + CVar_GetS32("gTextSpeed", 2);
msgCtx->textDelayTimer = msgCtx->textDelay;
} else {
msgCtx->textDelayTimer--;
Expand Down
11 changes: 9 additions & 2 deletions soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) {
func_80078884(NA_SE_SY_ERROR);
} else {
// Random rewards
if (rnd < 0.4f) {
if (CVar_GetS32("gNoRandomDrops", 0)) {
collectibleParams = -1;
} else if(rnd < 0.4f) {
collectibleParams = ITEM00_BOMBS_A;
} else if (rnd < 0.6f) {
collectibleParams = ITEM00_MAGIC_LARGE;
Expand All @@ -194,7 +196,12 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, GlobalContext* globalCtx) {
}
} else if (Flags_GetCollectible(globalCtx, this->dyna.actor.params) != 0) {
// If small key already collected, drop recovery heart instead
collectibleParams = ITEM00_HEART;
if (CVar_GetS32("gNoHeartDrops", 0)) {
collectibleParams = -1;
}
else {
collectibleParams = ITEM00_HEART;
}
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
} else {
// Drops a small key and sets a collect flag
Expand Down
7 changes: 6 additions & 1 deletion soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,12 @@ void EnKusa_DropCollectible(EnKusa* this, GlobalContext* globalCtx) {
Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.world.pos, dropParams << 4);
break;
case ENKUSA_TYPE_1:
if (Rand_ZeroOne() < 0.5f) {
if (CVar_GetS32("gNoRandomDrops", 0)) {
}
else if (CVar_GetS32("gNoHeartDrops", 0)) {
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_SEEDS);
}
else if (Rand_ZeroOne() < 0.5f) {
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_SEEDS);
} else {
Item_DropCollectible(globalCtx, &this->actor.world.pos, ITEM00_HEART);
Expand Down
2 changes: 1 addition & 1 deletion soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void ObjComb_ChooseItemDrop(ObjComb* this, GlobalContext* globalCtx) {
} else if (Rand_ZeroOne() < 0.5f) {
params = -1;
}
if (params >= 0) {
if (params >= 0 && !CVar_GetS32("gNoRandomDrops", 0)) {
Item_DropCollectible(globalCtx, &this->actor.world.pos, params);
}
}
Expand Down

0 comments on commit 818d5f9

Please sign in to comment.