Added three sliders for multiplying damage (#478)

* Added three sliders for multiplying damage:
1) Generic Slider, includes everything not multiplied by other sliders
2) Fall Damage Slider, includes all fall damage
3) Void Damage Slider, includes all void out damage

* Included tooltips

* Modified func_80837B18 to handle the modified flag the same as Player_InflictDamage does

* hotfix of a dumb oversight

* Fixed an oversight that led to compile failure on Linux and probably more things that weren't noticeable in unit testing

* I keep missing dumb mistakes.
I keep missing dumb mistakes.
Is this the last dumb mistake I've missed?

* Oh crud it's because I declared func_80837B18_modified after func_80837B18 isn't it? I am the ultimate dumbus.
This commit is contained in:
earthcrafterman 2022-06-20 13:51:59 -04:00 committed by GitHub
parent 7d0af303ec
commit 36b9b9519d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 5 deletions

View File

@ -879,6 +879,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");

View File

@ -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
@ -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) {
@ -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;
}
}
@ -8284,7 +8295,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;
}
@ -14834,9 +14845,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;
}