Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a time saver option to allow players to instantly put items away #600

Merged
merged 6 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 76 additions & 7 deletions libultraship/libultraship/ImGuiImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,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<std::string, std::vector<std::string>> windowCategories;
std::map<std::string, CustomWindow> customWindows;

Expand Down Expand Up @@ -931,18 +964,44 @@ namespace SohImGui {
Tooltip("Skip first-time pickup messages for consumable items");
EnhancementCheckbox("Better Owl", "gBetterOwl");
Tooltip("The default response to Kaepora Gaebora is\nalways 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, "");
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");
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");

EnhancementCheckbox("No Random Drops", "gNoRandomDrops");
Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses");
Expand Down Expand Up @@ -1135,6 +1194,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)
{
Expand All @@ -1145,8 +1205,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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use clamp for this:

val = math::clamp(val, 20.0f, 250.0f);

{
val = 250;
}
else if (val < 20)
{
val = 20;
}

CVar_SetS32(fps_cvar, val);
needs_save = true;
}
Expand Down
17 changes: 12 additions & 5 deletions soh/src/overlays/actors/ovl_player_actor/z_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand Down