From f593adee274bd7ff8b7b66a9ecff149b7c1be367 Mon Sep 17 00:00:00 2001 From: earthcrafterman Date: Wed, 6 Jul 2022 11:47:10 -0400 Subject: [PATCH 1/4] Added a time saver option to allow players to instantly put items away Expanded the range of damage multiplication to 80 (20 hearts of damage for each quarter heart) so players can play a sudden death challenge --- libultraship/libultraship/ImGuiImpl.cpp | 9 ++++++--- soh/src/overlays/actors/ovl_player_actor/z_player.c | 11 +++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index 5e9b404d96d..e08b4c3b7ca 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -926,17 +926,20 @@ namespace SohImGui { 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("Instant Putaway", "gInstantPutaway"); + Tooltip("Allow Link to put items away without having to wait around"); ImGui::EndMenu(); } if (ImGui::BeginMenu("Difficulty Options")) { - EnhancementSliderInt("Damage Multiplier %dx", "##DAMAGEMUL", "gDamageMul", 1, 4, ""); + // Max damage multiplier increased to 100 to allow for instant death challenges. 1/4 heart * 80 = 20 hearts of damage + EnhancementSliderInt("Damage Multiplier %dx", "##DAMAGEMUL", "gDamageMul", 1, 80, ""); Tooltip("Modifies all sources of damage not affected by other sliders"); - EnhancementSliderInt("Fall Damage Multiplier %dx", "##FALLDAMAGEMUL", "gFallDamageMul", 1, 4, ""); + EnhancementSliderInt("Fall Damage Multiplier %dx", "##FALLDAMAGEMUL", "gFallDamageMul", 1, 80, ""); Tooltip("Modifies all fall damage"); - EnhancementSliderInt("Void Damage Multiplier %dx", "##VOIDDAMAGEMUL", "gVoidDamageMul", 1, 4, ""); + EnhancementSliderInt("Void Damage Multiplier %dx", "##VOIDDAMAGEMUL", "gVoidDamageMul", 1, 80, ""); Tooltip("Modifies all void out damage"); EnhancementCheckbox("No Random Drops", "gNoRandomDrops"); diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index f0be829d4b9..c7b35d6fc89 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -9829,8 +9829,15 @@ void func_808473D4(GlobalContext* globalCtx, Player* this) { this->unk_837 = 20; } else if (this->unk_837 != 0) { - doAction = DO_ACTION_NONE; - this->unk_837--; + if (CVar_GetS32("gInstantPutaway", 0) != 0) + { + this->unk_837 = 0; + } + else + { + doAction = DO_ACTION_NONE; + this->unk_837--; + } } Interface_SetDoAction(globalCtx, doAction); From eb4badbc0cc1e4549c2aa3c145b4309023570778 Mon Sep 17 00:00:00 2001 From: earthcrafterman Date: Fri, 8 Jul 2022 10:21:13 -0400 Subject: [PATCH 2/4] The damage sliders are now comboboxes Damage multiplication is now exponential instead of incremental The FPS slider is now a text input --- libultraship/libultraship/ImGuiImpl.cpp | 85 ++++++++++++++++--- .../actors/ovl_player_actor/z_player.c | 6 +- 2 files changed, 78 insertions(+), 13 deletions(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index e08b4c3b7ca..d6bf87953d8 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -89,6 +89,39 @@ namespace SohImGui { "None" }; + const char* powers256[9] = { + "Vanilla (1x)", + "Double (2x)", + "Quadrouple (4x)", + "Octuple (8x)", + "Hexadecuple (16x)", + "Duotrigintuple (32x)", + "Quattuorsexagintuple (64x)", + "Octoviginticentuple (128x)", + "Hexaquinquagintiducentuple (256x)" + }; + + const char* powers128[8] = { + "Vanilla (1x)", + "Double (2x)", + "Quadrouple (4x)", + "Octuple (8x)", + "Hexadecuple (16x)", + "Duotrigintuple (32x)", + "Quattuorsexagintuple (64x)", + "Octoviginticentuple (128x)" + }; + + const char* powers64[7] = { + "Vanilla (1x)", + "Double (2x)", + "Quadrouple (4x)", + "Octuple (8x)", + "Hexadecuple (16x)", + "Duotrigintuple (32x)", + "Quattuorsexagintuple (64x)" + }; + std::map> windowCategories; std::map customWindows; @@ -934,13 +967,36 @@ namespace SohImGui { if (ImGui::BeginMenu("Difficulty Options")) { - // Max damage multiplier increased to 100 to allow for instant death challenges. 1/4 heart * 80 = 20 hearts of damage - EnhancementSliderInt("Damage Multiplier %dx", "##DAMAGEMUL", "gDamageMul", 1, 80, ""); - Tooltip("Modifies all sources of damage not affected by other sliders"); - EnhancementSliderInt("Fall Damage Multiplier %dx", "##FALLDAMAGEMUL", "gFallDamageMul", 1, 80, ""); - Tooltip("Modifies all fall damage"); - EnhancementSliderInt("Void Damage Multiplier %dx", "##VOIDDAMAGEMUL", "gVoidDamageMul", 1, 80, ""); - Tooltip("Modifies all void out damage"); + ImGui::Text("Damage Multiplier"); + EnhancementCombobox("gDamageMul", powers256, 9, 0); + Tooltip("Modifies all sources of damage not affected by other sliders\n\ +2x: Can survive all common attacks from the start of the game\n\ +4x: Dies in 1 hit to any substantial attack from the start of the game\n\ +8x: Can only survive trivial damage from the start of the game\n\ +16x: Can survive all common attacks with max health without double defense\n\ +32x: Can survive all common attacks with max health and double defense\n\ +64x: Can survive trivial damage with max health without double defense\n\ +128x: Can survive trivial damage with max health and double defense\n\ +256x: Cannot survive damage"); + ImGui::Text("Fall Damage Multiplier"); + EnhancementCombobox("gFallDamageMul", powers128, 8, 0); + Tooltip("Modifies all fall damage\n\ +2x: Can survive all fall damage from the start of the game\n\ +4x: Can only survive short fall damage from the start of the game\n\ +8x: Cannot survive any fall damage from the start of the game\n\ +16x: Can survive all fall damage with max health without double defense\n\ +32x: Can survive all fall damage with max health and double defense\n\ +64x: Can survive short fall damage with double defense\n\ +128x: Cannot survive fall damage"); + ImGui::Text("Void Damage Multiplier"); + EnhancementCombobox("gVoidDamageMul", powers64, 7, 0); + Tooltip("Modifies all void damage\n\ +2x: Can survive void damage from the start of the game\n\ +4x: Cannot survive void damage from the start of the game\n\ +8x: Can survive void damage twice with max health without double defense\n\ +16x: Can survive void damage with max health without double defense\n\ +32x: Can survive void damage with max health and double defense\n\ +64x: Cannot survive void damage"); EnhancementCheckbox("No Random Drops", "gNoRandomDrops"); Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses"); @@ -1129,6 +1185,7 @@ namespace SohImGui { int val = CVar_GetS32(fps_cvar, 20); val = MAX(MIN(val, 250), 20); int fps = val; + const int step_one = 1; if (fps == 20) { @@ -1139,8 +1196,17 @@ namespace SohImGui { ImGui::Text("Frame interpolation: %d FPS", fps); } - if (ImGui::SliderInt("##FPSInterpolation", &val, 20, 250, "", ImGuiSliderFlags_AlwaysClamp)) + if (ImGui::InputScalar("##FPSInterpolation", ImGuiDataType_S32, &val, &step_one, "")) { + if (val > 250) + { + val = 250; + } + else if (val < 20) + { + val = 20; + } + CVar_SetS32(fps_cvar, val); needs_save = true; } @@ -1149,8 +1215,7 @@ namespace SohImGui { "Set to match your monitor's refresh rate, or a divisor of it.\n" "A higher target FPS than your monitor's refresh rate will just waste resources,\n" "and might give a worse result.\n" - "For consistent input lag, set this value and your monitor's refresh rate to a multiple of 20.\n" - "Ctrl+Click for keyboard input."); + "For consistent input lag, set this value and your monitor's refresh rate to a multiple of 20."); } if (impl.backend == Backend::DX11) { diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index c7b35d6fc89..f81adb21980 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -3561,7 +3561,7 @@ s32 func_80837B18_modified(GlobalContext* globalCtx, Player* this, s32 damage, u s32 modifiedDamage = damage; if (modified) { - modifiedDamage *= CVar_GetS32("gDamageMul", 1); + modifiedDamage *= (1 << CVar_GetS32("gDamageMul", 0)); } return Health_ChangeBy(globalCtx, modifiedDamage); @@ -3794,7 +3794,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { if (this->unk_A86 != 0) { if (!Player_InBlockingCsMode(globalCtx, this)) { - Player_InflictDamageModified(globalCtx, -16 * CVar_GetS32("gVoidDamageMul", 1), false); + Player_InflictDamageModified(globalCtx, -16 * (1 << CVar_GetS32("gVoidDamageMul", 0)), false); this->unk_A86 = 0; } } @@ -8352,7 +8352,7 @@ s32 func_80843E64(GlobalContext* globalCtx, Player* this) { impactInfo = &D_80854600[impactIndex]; - if (Player_InflictDamageModified(globalCtx, impactInfo->damage * CVar_GetS32("gFallDamageMul", 1), false)) { + if (Player_InflictDamageModified(globalCtx, impactInfo->damage * (1 << CVar_GetS32("gFallDamageMul", 0)), false)) { return -1; } From ee0a91cb0cf436e6d361ea16b8682a84139ecb10 Mon Sep 17 00:00:00 2001 From: earthcrafterman Date: Mon, 11 Jul 2022 19:50:24 -0400 Subject: [PATCH 3/4] Splitting into solely being a quick putaway PR --- libultraship/libultraship/ImGuiImpl.cpp | 71 ++----------------- .../actors/ovl_player_actor/z_player.c | 6 +- 2 files changed, 10 insertions(+), 67 deletions(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index 12e6b6dbe14..0acd3aab5e8 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -91,39 +91,6 @@ namespace SohImGui { "None" }; - const char* powers256[9] = { - "Vanilla (1x)", - "Double (2x)", - "Quadrouple (4x)", - "Octuple (8x)", - "Hexadecuple (16x)", - "Duotrigintuple (32x)", - "Quattuorsexagintuple (64x)", - "Octoviginticentuple (128x)", - "Hexaquinquagintiducentuple (256x)" - }; - - const char* powers128[8] = { - "Vanilla (1x)", - "Double (2x)", - "Quadrouple (4x)", - "Octuple (8x)", - "Hexadecuple (16x)", - "Duotrigintuple (32x)", - "Quattuorsexagintuple (64x)", - "Octoviginticentuple (128x)" - }; - - const char* powers64[7] = { - "Vanilla (1x)", - "Double (2x)", - "Quadrouple (4x)", - "Octuple (8x)", - "Hexadecuple (16x)", - "Duotrigintuple (32x)", - "Quattuorsexagintuple (64x)" - }; - std::map> windowCategories; std::map customWindows; @@ -972,36 +939,12 @@ namespace SohImGui { if (ImGui::BeginMenu("Difficulty Options")) { - ImGui::Text("Damage Multiplier"); - EnhancementCombobox("gDamageMul", powers256, 9, 0); - Tooltip("Modifies all sources of damage not affected by other sliders\n\ -2x: Can survive all common attacks from the start of the game\n\ -4x: Dies in 1 hit to any substantial attack from the start of the game\n\ -8x: Can only survive trivial damage from the start of the game\n\ -16x: Can survive all common attacks with max health without double defense\n\ -32x: Can survive all common attacks with max health and double defense\n\ -64x: Can survive trivial damage with max health without double defense\n\ -128x: Can survive trivial damage with max health and double defense\n\ -256x: Cannot survive damage"); - ImGui::Text("Fall Damage Multiplier"); - EnhancementCombobox("gFallDamageMul", powers128, 8, 0); - Tooltip("Modifies all fall damage\n\ -2x: Can survive all fall damage from the start of the game\n\ -4x: Can only survive short fall damage from the start of the game\n\ -8x: Cannot survive any fall damage from the start of the game\n\ -16x: Can survive all fall damage with max health without double defense\n\ -32x: Can survive all fall damage with max health and double defense\n\ -64x: Can survive short fall damage with double defense\n\ -128x: Cannot survive fall damage"); - ImGui::Text("Void Damage Multiplier"); - EnhancementCombobox("gVoidDamageMul", powers64, 7, 0); - Tooltip("Modifies damage taken after falling into a void\n\ -2x: Can survive void damage from the start of the game\n\ -4x: Cannot survive void damage from the start of the game\n\ -8x: Can survive void damage twice with max health without double defense\n\ -16x: Can survive void damage with max health without double defense\n\ -32x: Can survive void damage with max health and double defense\n\ -64x: Cannot survive void damage"); + 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 damage taken after falling into a void"); EnhancementCheckbox("No Random Drops", "gNoRandomDrops"); Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses"); @@ -1205,7 +1148,7 @@ namespace SohImGui { ImGui::Text("Frame interpolation: %d FPS", fps); } - if (ImGui::InputScalar("##FPSInterpolation", ImGuiDataType_S32, &val, &step_one, "")) + if (ImGui::SliderInt("##FPSInterpolation", &val, 20, 250, "", ImGuiSliderFlags_AlwaysClamp)) { if (val > 250) { diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index f81adb21980..c7b35d6fc89 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -3561,7 +3561,7 @@ s32 func_80837B18_modified(GlobalContext* globalCtx, Player* this, s32 damage, u s32 modifiedDamage = damage; if (modified) { - modifiedDamage *= (1 << CVar_GetS32("gDamageMul", 0)); + modifiedDamage *= CVar_GetS32("gDamageMul", 1); } return Health_ChangeBy(globalCtx, modifiedDamage); @@ -3794,7 +3794,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) { if (this->unk_A86 != 0) { if (!Player_InBlockingCsMode(globalCtx, this)) { - Player_InflictDamageModified(globalCtx, -16 * (1 << CVar_GetS32("gVoidDamageMul", 0)), false); + Player_InflictDamageModified(globalCtx, -16 * CVar_GetS32("gVoidDamageMul", 1), false); this->unk_A86 = 0; } } @@ -8352,7 +8352,7 @@ s32 func_80843E64(GlobalContext* globalCtx, Player* this) { impactInfo = &D_80854600[impactIndex]; - if (Player_InflictDamageModified(globalCtx, impactInfo->damage * (1 << CVar_GetS32("gFallDamageMul", 0)), false)) { + if (Player_InflictDamageModified(globalCtx, impactInfo->damage * CVar_GetS32("gFallDamageMul", 1), false)) { return -1; } From 6b5811acf303eba3688156768cd061b315dee11f Mon Sep 17 00:00:00 2001 From: earthcrafterman Date: Tue, 12 Jul 2022 06:09:29 -0400 Subject: [PATCH 4/4] Removed some leftover code from the split --- libultraship/libultraship/ImGuiImpl.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index 0d5a76d0158..7937a560a79 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -1158,7 +1158,6 @@ namespace SohImGui { int val = CVar_GetS32(fps_cvar, 20); val = MAX(MIN(val, 250), 20); int fps = val; - const int step_one = 1; if (fps == 20) {