Disable infinite magic cheat

This commit is contained in:
Mr-Wiseguy 2023-12-17 21:43:09 -05:00
parent b3e4ab13ca
commit a8e6cd112e
1 changed files with 124 additions and 123 deletions

View File

@ -1,138 +1,139 @@
#include "patches.h" #include "patches.h"
/*
// Infinite magic // Infinite magic
s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) { s32 Magic_Consume(PlayState* play, s16 magicToConsume, s16 type) {
InterfaceContext* interfaceCtx = &play->interfaceCtx; InterfaceContext* interfaceCtx = &play->interfaceCtx;
magicToConsume = 0; magicToConsume = 0;
// // Magic is not acquired yet // // Magic is not acquired yet
// if (!gSaveContext.save.saveInfo.playerData.isMagicAcquired) { // if (!gSaveContext.save.saveInfo.playerData.isMagicAcquired) {
// return false; // return false;
// } // }
// Not enough magic available to consume // Not enough magic available to consume
if ((gSaveContext.save.saveInfo.playerData.magic - magicToConsume) < 0) { if ((gSaveContext.save.saveInfo.playerData.magic - magicToConsume) < 0) {
if (gSaveContext.magicCapacity != 0) { if (gSaveContext.magicCapacity != 0) {
Audio_PlaySfx(NA_SE_SY_ERROR); Audio_PlaySfx(NA_SE_SY_ERROR);
} }
return false; return false;
} }
switch (type) { switch (type) {
case MAGIC_CONSUME_NOW: case MAGIC_CONSUME_NOW:
case MAGIC_CONSUME_NOW_ALT: case MAGIC_CONSUME_NOW_ALT:
// Drain magic immediately e.g. Deku Bubble // Drain magic immediately e.g. Deku Bubble
if ((gSaveContext.magicState == MAGIC_STATE_IDLE) || if ((gSaveContext.magicState == MAGIC_STATE_IDLE) ||
(gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) { (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) {
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) { if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
play->actorCtx.lensActive = false; play->actorCtx.lensActive = false;
} }
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
magicToConsume = 0; magicToConsume = 0;
} }
gSaveContext.magicToConsume = magicToConsume; gSaveContext.magicToConsume = magicToConsume;
gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP; gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP;
return true; return true;
} else { } else {
Audio_PlaySfx(NA_SE_SY_ERROR); Audio_PlaySfx(NA_SE_SY_ERROR);
return false; return false;
} }
case MAGIC_CONSUME_WAIT_NO_PREVIEW: case MAGIC_CONSUME_WAIT_NO_PREVIEW:
// Sets consume target but waits to consume. // Sets consume target but waits to consume.
// No yellow magic to preview target consumption. // No yellow magic to preview target consumption.
if ((gSaveContext.magicState == MAGIC_STATE_IDLE) || if ((gSaveContext.magicState == MAGIC_STATE_IDLE) ||
(gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) { (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) {
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) { if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
play->actorCtx.lensActive = false; play->actorCtx.lensActive = false;
} }
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
magicToConsume = 0; magicToConsume = 0;
} }
gSaveContext.magicToConsume = magicToConsume; gSaveContext.magicToConsume = magicToConsume;
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_3; gSaveContext.magicState = MAGIC_STATE_METER_FLASH_3;
return true; return true;
} else { } else {
Audio_PlaySfx(NA_SE_SY_ERROR); Audio_PlaySfx(NA_SE_SY_ERROR);
return false; return false;
} }
case MAGIC_CONSUME_LENS: case MAGIC_CONSUME_LENS:
if (gSaveContext.magicState == MAGIC_STATE_IDLE) { if (gSaveContext.magicState == MAGIC_STATE_IDLE) {
if (gSaveContext.save.saveInfo.playerData.magic != 0) { if (gSaveContext.save.saveInfo.playerData.magic != 0) {
interfaceCtx->magicConsumptionTimer = 80; interfaceCtx->magicConsumptionTimer = 80;
gSaveContext.magicState = MAGIC_STATE_CONSUME_LENS; gSaveContext.magicState = MAGIC_STATE_CONSUME_LENS;
return true; return true;
} else { } else {
return false; return false;
} }
} else if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) { } else if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
return true; return true;
} else { } else {
return false; return false;
} }
case MAGIC_CONSUME_WAIT_PREVIEW: case MAGIC_CONSUME_WAIT_PREVIEW:
// Sets consume target but waits to consume. // Sets consume target but waits to consume.
// Preview consumption with a yellow bar. e.g. Spin Attack // Preview consumption with a yellow bar. e.g. Spin Attack
if ((gSaveContext.magicState == MAGIC_STATE_IDLE) || if ((gSaveContext.magicState == MAGIC_STATE_IDLE) ||
(gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) { (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) {
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) { if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
play->actorCtx.lensActive = false; play->actorCtx.lensActive = false;
} }
gSaveContext.magicToConsume = magicToConsume; gSaveContext.magicToConsume = magicToConsume;
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_2; gSaveContext.magicState = MAGIC_STATE_METER_FLASH_2;
return true; return true;
} else { } else {
Audio_PlaySfx(NA_SE_SY_ERROR); Audio_PlaySfx(NA_SE_SY_ERROR);
return false; return false;
} }
case MAGIC_CONSUME_GORON_ZORA: case MAGIC_CONSUME_GORON_ZORA:
// Goron spiked rolling or Zora electric barrier // Goron spiked rolling or Zora electric barrier
if (gSaveContext.save.saveInfo.playerData.magic != 0) { if (gSaveContext.save.saveInfo.playerData.magic != 0) {
interfaceCtx->magicConsumptionTimer = 10; interfaceCtx->magicConsumptionTimer = 10;
gSaveContext.magicState = MAGIC_STATE_CONSUME_GORON_ZORA_SETUP; gSaveContext.magicState = MAGIC_STATE_CONSUME_GORON_ZORA_SETUP;
return true; return true;
} else { } else {
return false; return false;
} }
case MAGIC_CONSUME_GIANTS_MASK: case MAGIC_CONSUME_GIANTS_MASK:
// Wearing Giant's Mask // Wearing Giant's Mask
if (gSaveContext.magicState == MAGIC_STATE_IDLE) { if (gSaveContext.magicState == MAGIC_STATE_IDLE) {
if (gSaveContext.save.saveInfo.playerData.magic != 0) { if (gSaveContext.save.saveInfo.playerData.magic != 0) {
interfaceCtx->magicConsumptionTimer = R_MAGIC_CONSUME_TIMER_GIANTS_MASK; interfaceCtx->magicConsumptionTimer = R_MAGIC_CONSUME_TIMER_GIANTS_MASK;
gSaveContext.magicState = MAGIC_STATE_CONSUME_GIANTS_MASK; gSaveContext.magicState = MAGIC_STATE_CONSUME_GIANTS_MASK;
return true; return true;
} else { } else {
return false; return false;
} }
} }
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_GIANTS_MASK) { if (gSaveContext.magicState == MAGIC_STATE_CONSUME_GIANTS_MASK) {
return true; return true;
} else { } else {
return false; return false;
} }
case MAGIC_CONSUME_DEITY_BEAM: case MAGIC_CONSUME_DEITY_BEAM:
// Consumes magic immediately // Consumes magic immediately
if ((gSaveContext.magicState == MAGIC_STATE_IDLE) || if ((gSaveContext.magicState == MAGIC_STATE_IDLE) ||
(gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) { (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) {
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) { if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
play->actorCtx.lensActive = false; play->actorCtx.lensActive = false;
} }
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) { if (CHECK_WEEKEVENTREG(WEEKEVENTREG_DRANK_CHATEAU_ROMANI)) {
magicToConsume = 0; magicToConsume = 0;
} }
gSaveContext.save.saveInfo.playerData.magic -= magicToConsume; gSaveContext.save.saveInfo.playerData.magic -= magicToConsume;
return true; return true;
} else { } else {
Audio_PlaySfx(NA_SE_SY_ERROR); Audio_PlaySfx(NA_SE_SY_ERROR);
return false; return false;
} }
} }
return false; return false;
} }
*/