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 three sliders for multiplying damage #478

Merged
merged 7 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions libultraship/libultraship/SohImGuiImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,12 @@ namespace SohImGui {
EnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, "");
EnhancementSliderInt("King Zora Speed: %dx", "##WEEPSPEED", "gMweepSpeed", 1, 5, "");
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");
Expand Down
25 changes: 20 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 @@ -351,6 +351,7 @@ s32 func_80852F38(GlobalContext* globalCtx, Player* this);
s32 func_80852FFC(GlobalContext* globalCtx, Actor* actor, s32 csMode);
void func_80853080(Player* this, GlobalContext* globalCtx);
s32 Player_InflictDamage(GlobalContext* globalCtx, s32 damage);
s32 Player_InflictDamageModified(GlobalContext* globalCtx, s32 damage, u8 modified);
void func_80853148(GlobalContext* globalCtx, Actor* actor);

// .bss part 1
Expand Down Expand Up @@ -3516,12 +3517,22 @@ void func_80837AFC(Player* this, s32 timer) {
this->unk_88F = 0;
}

s32 func_80837B18(GlobalContext* globalCtx, Player* this, s32 damage) {
s32 func_80837B18_modified(GlobalContext* globalCtx, Player* this, s32 damage, u8 modified) {
if ((this->invincibilityTimer != 0) || (this->actor.category != ACTORCAT_PLAYER)) {
return 1;
}

return Health_ChangeBy(globalCtx, damage);
s32 modifiedDamage = damage;
if (modified)
{
modifiedDamage *= CVar_GetS32("gDamageMul", 1);
}

return Health_ChangeBy(globalCtx, modifiedDamage);
}

s32 func_80837B18(GlobalContext* globalCtx, Player* this, s32 damage) {
return func_80837B18_modified(globalCtx, this, damage, true);
}

void func_80837B60(Player* this) {
Expand Down Expand Up @@ -3747,7 +3758,7 @@ s32 func_808382DC(Player* this, GlobalContext* globalCtx) {

if (this->unk_A86 != 0) {
if (!Player_InBlockingCsMode(globalCtx, this)) {
Player_InflictDamage(globalCtx, -16);
Player_InflictDamageModified(globalCtx, -16 * CVar_GetS32("gVoidDamageMul", 1), false);
this->unk_A86 = 0;
}
}
Expand Down Expand Up @@ -8279,7 +8290,7 @@ s32 func_80843E64(GlobalContext* globalCtx, Player* this) {

impactInfo = &D_80854600[impactIndex];

if (Player_InflictDamage(globalCtx, impactInfo->damage)) {
if (Player_InflictDamageModified(globalCtx, impactInfo->damage * CVar_GetS32("gFallDamageMul", 1), false)) {
return -1;
}

Expand Down Expand Up @@ -14829,9 +14840,13 @@ void func_80853080(Player* this, GlobalContext* globalCtx) {
}

s32 Player_InflictDamage(GlobalContext* globalCtx, s32 damage) {
return Player_InflictDamageModified(globalCtx, damage, true);
}

s32 Player_InflictDamageModified(GlobalContext* globalCtx, s32 damage, u8 modified) {
Player* this = GET_PLAYER(globalCtx);

if (!Player_InBlockingCsMode(globalCtx, this) && !func_80837B18(globalCtx, this, damage)) {
if (!Player_InBlockingCsMode(globalCtx, this) && !func_80837B18_modified(globalCtx, this, damage, modified)) {
this->stateFlags2 &= ~PLAYER_STATE2_7;
return 1;
}
Expand Down