Magic Armor Cheat Refactor

This commit is contained in:
MelonSpeedruns
2026-05-13 13:53:05 -04:00
parent 7a77d48954
commit b6f1fbf074
7 changed files with 110 additions and 13 deletions
+3 -1
View File
@@ -171,7 +171,9 @@ struct UserSettings {
ConfigVar<bool> canTransformAnywhere;
ConfigVar<bool> fastRoll;
ConfigVar<bool> fastSpinner;
ConfigVar<bool> freeMagicArmor;
ConfigVar<bool> magicArmorNoDrain;
ConfigVar<bool> magicArmorNoDamageLoss;
ConfigVar<bool> magicArmorNoHeavy;
ConfigVar<bool> invincibleEnemies;
// Technical
+4 -3
View File
@@ -12738,7 +12738,7 @@ void daAlink_c::setMagicArmorBrk(int i_status) {
BOOL daAlink_c::checkMagicArmorHeavy() const {
#if TARGET_PC
return checkMagicArmorWearAbility() && (dComIfGs_getRupee() == 0 && !dusk::getSettings().game.freeMagicArmor);
return checkMagicArmorWearAbility() && (dComIfGs_getRupee() == 0 && !dusk::getSettings().game.magicArmorNoHeavy);
#else
return checkMagicArmorWearAbility() && dComIfGs_getRupee() == 0;
#endif
@@ -18711,7 +18711,7 @@ int daAlink_c::execute() {
#if TARGET_PC
// This handles rupee drain and transitions between rupees/no rupees
// We can skip all of that if the magic armor doesn't use rupees
if (!dusk::getSettings().game.freeMagicArmor && checkMagicArmorWearAbility() && mClothesChangeWaitTimer == 0) {
if (!dusk::getSettings().game.magicArmorNoDrain && checkMagicArmorWearAbility() && mClothesChangeWaitTimer == 0) {
#else
if (checkMagicArmorWearAbility() && mClothesChangeWaitTimer == 0) {
#endif
@@ -18724,7 +18724,8 @@ int daAlink_c::execute() {
}
}
if (dComIfGs_getRupee() == 0 && field_0x2fd7 != 0) {
if (dComIfGs_getRupee() == 0 && field_0x2fd7 != 0 IF_DUSK( && !dusk::getSettings().game.magicArmorNoHeavy))
{
setMagicArmorBrk(0);
seStartOnlyReverb(Z2SE_AL_M_ARMER_TURNOFF);
mZ2Link.setLinkState(5);
+1 -1
View File
@@ -192,7 +192,7 @@ int daAlink_c::setDamagePoint(int i_dmgAmount, BOOL i_checkZoraMag, BOOL i_setDm
if (checkMagicArmorNoDamage()) {
#if TARGET_PC
if(dusk::getSettings().game.freeMagicArmor) {
if(dusk::getSettings().game.magicArmorNoDamageLoss) {
i_dmgAmount = 0;
}
#endif
+2 -2
View File
@@ -348,7 +348,7 @@ void daAlink_c::changeLink(int param_0) {
initModel(static_cast<J3DModelData*>(dComIfG_getObjectRes(l_mArcName, "al_hands.bmd")), 0);
#if TARGET_PC
if (dComIfGs_getRupee() != 0 || dusk::getSettings().game.freeMagicArmor)
if (dComIfGs_getRupee() != 0 || dusk::getSettings().game.magicArmorNoHeavy)
#else
if (dComIfGs_getRupee() != 0)
#endif
@@ -458,7 +458,7 @@ void daAlink_c::changeLink(int param_0) {
field_0x06f0 = field_0x064C->getMaterialNodePointer(2)->getShape();
#if TARGET_PC
if (dComIfGs_getRupee() != 0 || dusk::getSettings().game.freeMagicArmor) {
if (dComIfGs_getRupee() != 0 || dusk::getSettings().game.magicArmorNoHeavy) {
#else
if (dComIfGs_getRupee() != 0) {
#endif
+6 -2
View File
@@ -106,7 +106,9 @@ UserSettings g_userSettings = {
.canTransformAnywhere {"game.canTransformAnywhere", false},
.fastRoll {"game.fastRoll", false},
.fastSpinner {"game.fastSpinner", false},
.freeMagicArmor {"game.freeMagicArmor", false},
.magicArmorNoDrain {"game.magicArmorNoDrain", false},
.magicArmorNoDamageLoss {"game.magicArmorNoDamageLoss", false},
.magicArmorNoHeavy {"game.magicArmorNoHeavy", false},
.invincibleEnemies {"game.invincibleEnemies", false},
// Technical
@@ -226,7 +228,9 @@ void registerSettings() {
Register(g_userSettings.game.enableFastIronBoots);
Register(g_userSettings.game.canTransformAnywhere);
Register(g_userSettings.game.fastRoll);
Register(g_userSettings.game.freeMagicArmor);
Register(g_userSettings.game.magicArmorNoDrain);
Register(g_userSettings.game.magicArmorNoDamageLoss);
Register(g_userSettings.game.magicArmorNoHeavy);
Register(g_userSettings.game.restoreWiiGlitches);
Register(g_userSettings.game.enableLinkDollRotation);
Register(g_userSettings.game.enableAchievementToasts);
+4 -1
View File
@@ -33,7 +33,10 @@ void resetForSpeedrunMode() {
getSettings().game.canTransformAnywhere.setSpeedrunValue(false);
getSettings().game.fastRoll.setSpeedrunValue(false);
getSettings().game.fastSpinner.setSpeedrunValue(false);
getSettings().game.freeMagicArmor.setSpeedrunValue(false);
getSettings().game.magicArmorNoDrain.setSpeedrunValue(false);
getSettings().game.magicArmorNoDamageLoss.setSpeedrunValue(false);
getSettings().game.magicArmorNoHeavy.setSpeedrunValue(false);
getSettings().game.invincibleEnemies.setSpeedrunValue(false);
getSettings().game.pauseOnFocusLost.setSpeedrunValue(false);
aurora_set_pause_on_focus_lost(false);
+90 -3
View File
@@ -200,7 +200,9 @@ void reset_for_speedrun_mode() {
getSettings().game.canTransformAnywhere.setSpeedrunValue(false);
getSettings().game.fastRoll.setSpeedrunValue(false);
getSettings().game.fastSpinner.setSpeedrunValue(false);
getSettings().game.freeMagicArmor.setSpeedrunValue(false);
getSettings().game.magicArmorNoDrain.setSpeedrunValue(false);
getSettings().game.magicArmorNoDamageLoss.setSpeedrunValue(false);
getSettings().game.magicArmorNoHeavy.setSpeedrunValue(false);
getSettings().game.invincibleEnemies.setSpeedrunValue(false);
getSettings().game.pauseOnFocusLost.setSpeedrunValue(false);
@@ -1173,8 +1175,93 @@ SettingsWindow::SettingsWindow(bool prelaunch) : mPrelaunch(prelaunch) {
"Makes Link's roll animation and movement twice as fast.");
addCheat("Fast Spinner", getSettings().game.fastSpinner,
"Speeds up Spinner movement while holding R.");
addCheat("Free Magic Armor", getSettings().game.freeMagicArmor,
"Lets the magic armor work without consuming rupees.");
leftPane.register_control(
leftPane.add_select_button({
.key = "Magic Armor Mode",
.getValue =
[] {
const bool noDrain = getSettings().game.magicArmorNoDrain.getValue();
const bool noDamageLoss = getSettings().game.magicArmorNoDamageLoss.getValue();
const bool noHeavy = getSettings().game.magicArmorNoHeavy.getValue();
if (!noDrain && !noDamageLoss && !noHeavy) {
return Rml::String{"Off"};
}
if (noDrain && noDamageLoss && noHeavy) {
return Rml::String{"All"};
}
return Rml::String{"Some"};
},
.isModified =
[] {
const auto& noDrain = getSettings().game.magicArmorNoDrain;
const auto& noDamageLoss = getSettings().game.magicArmorNoDamageLoss;
const auto& noHeavy = getSettings().game.magicArmorNoHeavy;
return noDrain.getValue() != noDrain.getDefaultValue() ||
noDamageLoss.getValue() != noDamageLoss.getDefaultValue() ||
noHeavy.getValue() != noHeavy.getDefaultValue();
},
}),
rightPane, [](Pane& pane) {
pane.clear();
pane.add_button("Select All").on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
getSettings().game.magicArmorNoDrain.setValue(true);
getSettings().game.magicArmorNoDamageLoss.setValue(true);
getSettings().game.magicArmorNoHeavy.setValue(true);
config::Save();
});
pane.add_button("Select None").on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
getSettings().game.magicArmorNoDrain.setValue(false);
getSettings().game.magicArmorNoDamageLoss.setValue(false);
getSettings().game.magicArmorNoHeavy.setValue(false);
config::Save();
});
pane.add_section("Features");
pane.add_button({
.text = "No Rupee Drain",
.isSelected =
[] { return getSettings().game.magicArmorNoDrain.getValue(); },
})
.on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
auto& v = getSettings().game.magicArmorNoDrain;
v.setValue(!v.getValue());
config::Save();
});
pane.add_button(
{
.text = "No Damage Loss",
.isSelected =
[] { return getSettings().game.magicArmorNoDamageLoss.getValue(); },
})
.on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
auto& v = getSettings().game.magicArmorNoDamageLoss;
v.setValue(!v.getValue());
config::Save();
});
pane.add_button(
{
.text = "No Heavy Armor",
.isSelected =
[] { return getSettings().game.magicArmorNoHeavy.getValue(); },
})
.on_pressed([] {
mDoAud_seStartMenu(kSoundItemChange);
auto& v = getSettings().game.magicArmorNoHeavy;
v.setValue(!v.getValue());
config::Save();
});
pane.add_rml("<br/>Toggle which features of the Magic Armor you want active.");
});
addCheat("Invincible Enemies", getSettings().game.invincibleEnemies,
"Prevents enemies from taking damage.");
});