mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-26 03:12:18 -05:00
magic (#3278)
This commit is contained in:
parent
cff2e37287
commit
9d581f10e7
@ -1090,8 +1090,8 @@ s32 Health_ChangeBy(PlayState* play, s16 healthChange);
|
||||
void Rupees_ChangeBy(s16 rupeeChange);
|
||||
void Inventory_ChangeAmmo(s16 item, s16 ammoChange);
|
||||
void Magic_Fill(PlayState* play);
|
||||
void func_800876C8(PlayState* play);
|
||||
s32 func_80087708(PlayState* play, s16 arg1, s16 arg2);
|
||||
void Magic_Reset(PlayState* play);
|
||||
s32 Magic_RequestChange(PlayState* play, s16 amount, s16 type);
|
||||
void func_80088AA0(s16 seconds);
|
||||
void func_80088AF0(PlayState* play);
|
||||
void func_80088B34(s16 arg0);
|
||||
|
@ -2451,7 +2451,7 @@ void func_80030488(PlayState* play) {
|
||||
void Actor_DisableLens(PlayState* play) {
|
||||
if (play->actorCtx.lensActive) {
|
||||
play->actorCtx.lensActive = false;
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ void KaleidoSetup_Update(PlayState* play) {
|
||||
if (pauseCtx->state == 0 && pauseCtx->debugState == 0 && play->gameOverCtx.state == GAMEOVER_INACTIVE &&
|
||||
play->sceneLoadFlag == 0 && play->transitionMode == 0 && gSaveContext.cutsceneIndex < 0xFFF0 &&
|
||||
gSaveContext.nextCutsceneIndex < 0xFFF0 && !Play_InCsMode(play) &&
|
||||
play->shootingGalleryStatus <= 1 && gSaveContext.magicState != 8 && gSaveContext.magicState != 9 &&
|
||||
play->shootingGalleryStatus <= 1 && gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY && gSaveContext.magicState != MAGIC_STATE_FILL &&
|
||||
(play->sceneNum != SCENE_BOMBCHU_BOWLING_ALLEY || !Flags_GetSwitch(play, 0x38))) {
|
||||
|
||||
u8 easyPauseBufferEnabled = CVarGetInteger("gCheatEasyPauseBufferEnabled", 0);
|
||||
|
@ -2196,14 +2196,14 @@ u8 Item_Give(PlayState* play, u8 item) {
|
||||
}
|
||||
return Return_Item(item, MOD_NONE, item);
|
||||
} else if (item == ITEM_MAGIC_SMALL) {
|
||||
if (gSaveContext.magicState != 10) {
|
||||
if (gSaveContext.magicState != MAGIC_STATE_ADD) {
|
||||
if (play != NULL) {
|
||||
Magic_Fill(play);
|
||||
}
|
||||
}
|
||||
|
||||
if (play != NULL) {
|
||||
func_80087708(play, 12, 5);
|
||||
Magic_RequestChange(play, 12, MAGIC_ADD);
|
||||
}
|
||||
|
||||
if (!Flags_GetInfTable(INFTABLE_198)) {
|
||||
@ -2213,13 +2213,13 @@ u8 Item_Give(PlayState* play, u8 item) {
|
||||
|
||||
return Return_Item(item, MOD_NONE, item);
|
||||
} else if (item == ITEM_MAGIC_LARGE) {
|
||||
if (gSaveContext.magicState != 10) {
|
||||
if (gSaveContext.magicState != MAGIC_STATE_ADD) {
|
||||
if (play != NULL) {
|
||||
Magic_Fill(play);
|
||||
}
|
||||
}
|
||||
if (play != NULL) {
|
||||
func_80087708(play, 24, 5);
|
||||
Magic_RequestChange(play, 24, MAGIC_ADD);
|
||||
}
|
||||
|
||||
if (!Flags_GetInfTable(INFTABLE_198)) {
|
||||
@ -2328,7 +2328,7 @@ u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) {
|
||||
slot = SLOT(item);
|
||||
if (item == RG_MAGIC_SINGLE) {
|
||||
gSaveContext.isMagicAcquired = true;
|
||||
gSaveContext.magicFillTarget = 0x30;
|
||||
gSaveContext.magicFillTarget = MAGIC_NORMAL_METER;
|
||||
Magic_Fill(play);
|
||||
return Return_Item_Entry(giEntry, RG_NONE);
|
||||
} else if (item == RG_MAGIC_DOUBLE) {
|
||||
@ -2336,7 +2336,7 @@ u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) {
|
||||
gSaveContext.isMagicAcquired = true;
|
||||
}
|
||||
gSaveContext.isDoubleMagicAcquired = true;
|
||||
gSaveContext.magicFillTarget = 0x60;
|
||||
gSaveContext.magicFillTarget = MAGIC_DOUBLE_METER;
|
||||
gSaveContext.magicLevel = 0;
|
||||
Magic_Fill(play);
|
||||
return Return_Item_Entry(giEntry, RG_NONE);
|
||||
@ -3140,96 +3140,96 @@ void Inventory_ChangeAmmo(s16 item, s16 ammoChange) {
|
||||
void Magic_Fill(PlayState* play) {
|
||||
if (gSaveContext.isMagicAcquired) {
|
||||
gSaveContext.prevMagicState = gSaveContext.magicState;
|
||||
gSaveContext.magicFillTarget = (gSaveContext.isDoubleMagicAcquired + 1) * 0x30;
|
||||
gSaveContext.magicState = 9;
|
||||
gSaveContext.magicFillTarget = (gSaveContext.isDoubleMagicAcquired + 1) * MAGIC_NORMAL_METER;
|
||||
gSaveContext.magicState = MAGIC_STATE_FILL;
|
||||
}
|
||||
}
|
||||
|
||||
void func_800876C8(PlayState* play) {
|
||||
if ((gSaveContext.magicState != 8) && (gSaveContext.magicState != 9)) {
|
||||
if (gSaveContext.magicState == 10) {
|
||||
void Magic_Reset(PlayState* play) {
|
||||
if ((gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY) && (gSaveContext.magicState != MAGIC_STATE_FILL)) {
|
||||
if (gSaveContext.magicState == MAGIC_STATE_ADD) {
|
||||
gSaveContext.prevMagicState = gSaveContext.magicState;
|
||||
}
|
||||
gSaveContext.magicState = 5;
|
||||
gSaveContext.magicState = MAGIC_STATE_RESET;
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_80087708(PlayState* play, s16 arg1, s16 arg2) {
|
||||
s32 Magic_RequestChange(PlayState* play, s16 amount, s16 type) {
|
||||
if (!gSaveContext.isMagicAcquired) {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((arg2 != 5) && (gSaveContext.magic - arg1) < 0) {
|
||||
if ((type != 5) && (gSaveContext.magic - amount) < 0) {
|
||||
if (gSaveContext.magicCapacity != 0) {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
}
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (arg2) {
|
||||
case 0:
|
||||
case 2:
|
||||
if ((gSaveContext.magicState == 0) || (gSaveContext.magicState == 7)) {
|
||||
if (gSaveContext.magicState == 7) {
|
||||
switch (type) {
|
||||
case MAGIC_CONSUME_NOW:
|
||||
case MAGIC_CONSUME_NOW_ALT:
|
||||
if ((gSaveContext.magicState == MAGIC_STATE_IDLE) || (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) {
|
||||
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
|
||||
play->actorCtx.lensActive = false;
|
||||
}
|
||||
gSaveContext.magicTarget = gSaveContext.magic - arg1;
|
||||
gSaveContext.magicState = 1;
|
||||
gSaveContext.magicTarget = gSaveContext.magic - amount;
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP;
|
||||
return 1;
|
||||
} else {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
case 1:
|
||||
if ((gSaveContext.magicState == 0) || (gSaveContext.magicState == 7)) {
|
||||
if (gSaveContext.magicState == 7) {
|
||||
case MAGIC_CONSUME_WAIT_NO_PREVIEW:
|
||||
if ((gSaveContext.magicState == MAGIC_STATE_IDLE) || (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) {
|
||||
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
|
||||
play->actorCtx.lensActive = false;
|
||||
}
|
||||
gSaveContext.magicTarget = gSaveContext.magic - arg1;
|
||||
gSaveContext.magicState = 6;
|
||||
return 1;
|
||||
gSaveContext.magicTarget = gSaveContext.magic - amount;
|
||||
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_3;
|
||||
return true;
|
||||
} else {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
case 3:
|
||||
if (gSaveContext.magicState == 0) {
|
||||
case MAGIC_CONSUME_LENS:
|
||||
if (gSaveContext.magicState == MAGIC_STATE_IDLE) {
|
||||
if (gSaveContext.magic != 0) {
|
||||
play->interfaceCtx.unk_230 = 80;
|
||||
gSaveContext.magicState = 7;
|
||||
return 1;
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME_LENS;
|
||||
return true;
|
||||
} else {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (gSaveContext.magicState == 7) {
|
||||
return 1;
|
||||
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
|
||||
return true;
|
||||
} else {
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
case 4:
|
||||
if ((gSaveContext.magicState == 0) || (gSaveContext.magicState == 7)) {
|
||||
if (gSaveContext.magicState == 7) {
|
||||
case MAGIC_CONSUME_WAIT_PREVIEW:
|
||||
if ((gSaveContext.magicState == MAGIC_STATE_IDLE) || (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS)) {
|
||||
if (gSaveContext.magicState == MAGIC_STATE_CONSUME_LENS) {
|
||||
play->actorCtx.lensActive = false;
|
||||
}
|
||||
gSaveContext.magicTarget = gSaveContext.magic - arg1;
|
||||
gSaveContext.magicState = 4;
|
||||
return 1;
|
||||
gSaveContext.magicTarget = gSaveContext.magic - amount;
|
||||
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_2;
|
||||
return true;
|
||||
} else {
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
case 5:
|
||||
case MAGIC_ADD:
|
||||
if (gSaveContext.magicCapacity >= gSaveContext.magic) {
|
||||
gSaveContext.magicTarget = gSaveContext.magic + arg1;
|
||||
gSaveContext.magicTarget = gSaveContext.magic + amount;
|
||||
|
||||
if (gSaveContext.magicTarget >= gSaveContext.magicCapacity) {
|
||||
gSaveContext.magicTarget = gSaveContext.magicCapacity;
|
||||
}
|
||||
|
||||
gSaveContext.magicState = 10;
|
||||
return 1;
|
||||
gSaveContext.magicState = MAGIC_STATE_ADD;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -3278,8 +3278,8 @@ void Interface_UpdateMagicBar(PlayState* play) {
|
||||
s16 temp;
|
||||
|
||||
switch (gSaveContext.magicState) {
|
||||
case 8:
|
||||
temp = gSaveContext.magicLevel * 0x30;
|
||||
case MAGIC_STATE_STEP_CAPACITY:
|
||||
temp = gSaveContext.magicLevel * MAGIC_NORMAL_METER;
|
||||
if (gSaveContext.magicCapacity != temp) {
|
||||
if (gSaveContext.magicCapacity < temp) {
|
||||
gSaveContext.magicCapacity += 8;
|
||||
@ -3293,11 +3293,11 @@ void Interface_UpdateMagicBar(PlayState* play) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gSaveContext.magicState = 9;
|
||||
gSaveContext.magicState = MAGIC_STATE_FILL;
|
||||
}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
case MAGIC_STATE_FILL:
|
||||
gSaveContext.magic += 4;
|
||||
|
||||
if (gSaveContext.gameMode == 0 && gSaveContext.sceneSetupIndex < 4) {
|
||||
@ -3314,32 +3314,32 @@ void Interface_UpdateMagicBar(PlayState* play) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case MAGIC_STATE_CONSUME_SETUP:
|
||||
sMagicBorderRatio = 2;
|
||||
gSaveContext.magicState = 2;
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
case MAGIC_STATE_CONSUME:
|
||||
gSaveContext.magic -= 2;
|
||||
if (gSaveContext.magic <= 0) {
|
||||
gSaveContext.magic = 0;
|
||||
gSaveContext.magicState = 3;
|
||||
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_1;
|
||||
if (CVarGetInteger("gCosmetics.Consumable_MagicBorder.Changed", 0)) {
|
||||
sMagicBorder = CVarGetColor24("gCosmetics.Consumable_MagicBorder.Value", sMagicBorder_ori);
|
||||
} else {
|
||||
sMagicBorder = sMagicBorder_ori;
|
||||
}
|
||||
} else if (gSaveContext.magic == gSaveContext.magicTarget) {
|
||||
gSaveContext.magicState = 3;
|
||||
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_1;
|
||||
if (CVarGetInteger("gCosmetics.Consumable_MagicBorder.Changed", 0)) {
|
||||
sMagicBorder = CVarGetColor24("gCosmetics.Consumable_MagicBorder.Value", sMagicBorder_ori);
|
||||
} else {
|
||||
sMagicBorder = sMagicBorder_ori;
|
||||
}
|
||||
}
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
case MAGIC_STATE_METER_FLASH_1:
|
||||
case MAGIC_STATE_METER_FLASH_2:
|
||||
case MAGIC_STATE_METER_FLASH_3:
|
||||
temp = sMagicBorderIndexes[sMagicBorderStep];
|
||||
borderChangeR = ABS(sMagicBorder.r - sMagicBorderColors[temp][0]) / sMagicBorderRatio;
|
||||
borderChangeG = ABS(sMagicBorder.g - sMagicBorderColors[temp][1]) / sMagicBorderRatio;
|
||||
@ -3376,16 +3376,16 @@ void Interface_UpdateMagicBar(PlayState* play) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 5:
|
||||
case MAGIC_STATE_RESET:
|
||||
if (CVarGetInteger("gCosmetics.Consumable_MagicBorder.Changed", 0)) {
|
||||
sMagicBorder = CVarGetColor24("gCosmetics.Consumable_MagicBorder.Value", sMagicBorder_ori);
|
||||
} else {
|
||||
sMagicBorder = sMagicBorder_ori;
|
||||
}
|
||||
gSaveContext.magicState = 0;
|
||||
gSaveContext.magicState = MAGIC_STATE_IDLE;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
case MAGIC_STATE_CONSUME_LENS:
|
||||
if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) &&
|
||||
(msgCtx->msgMode == MSGMODE_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) &&
|
||||
(play->sceneLoadFlag == 0) && (play->transitionMode == 0) && !Play_InCsMode(play)) {
|
||||
@ -3402,7 +3402,7 @@ void Interface_UpdateMagicBar(PlayState* play) {
|
||||
play->actorCtx.lensActive = false;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_GLASSMODE_OFF, &D_801333D4, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
gSaveContext.magicState = 0;
|
||||
gSaveContext.magicState = MAGIC_STATE_IDLE;
|
||||
if (CVarGetInteger("gCosmetics.Consumable_MagicBorder.Changed", 0)) {
|
||||
sMagicBorder = CVarGetColor24("gCosmetics.Consumable_MagicBorder.Value", sMagicBorder_ori);
|
||||
} else {
|
||||
@ -3454,7 +3454,7 @@ void Interface_UpdateMagicBar(PlayState* play) {
|
||||
}
|
||||
break;
|
||||
|
||||
case 10:
|
||||
case MAGIC_STATE_ADD:
|
||||
gSaveContext.magic += 4;
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_GAUGE_UP - SFX_FLAG, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
if (gSaveContext.magic >= gSaveContext.magicTarget) {
|
||||
@ -3465,7 +3465,7 @@ void Interface_UpdateMagicBar(PlayState* play) {
|
||||
break;
|
||||
|
||||
default:
|
||||
gSaveContext.magicState = 0;
|
||||
gSaveContext.magicState = MAGIC_STATE_IDLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -3598,7 +3598,7 @@ void Interface_DrawMagicBar(PlayState* play) {
|
||||
ENVIRONMENT, TEXEL0, ENVIRONMENT, 0, 0, 0, PRIMITIVE);
|
||||
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255);
|
||||
|
||||
if (gSaveContext.magicState == 4) {
|
||||
if (gSaveContext.magicState == MAGIC_STATE_METER_FLASH_2) {
|
||||
// Yellow part of the bar indicating the amount of magic to be subtracted
|
||||
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_yellow.r, magicbar_yellow.g, magicbar_yellow.b, interfaceCtx->magicAlpha);
|
||||
|
||||
@ -5245,7 +5245,7 @@ void Interface_Draw(PlayState* play) {
|
||||
Interface_DrawLineupTick(play);
|
||||
}
|
||||
|
||||
if (fullUi || gSaveContext.magicState > 0) {
|
||||
if (fullUi || gSaveContext.magicState > MAGIC_STATE_IDLE) {
|
||||
Interface_DrawMagicBar(play);
|
||||
}
|
||||
|
||||
@ -6541,7 +6541,7 @@ void Interface_Update(PlayState* play) {
|
||||
((play->csCtx.state == CS_STATE_IDLE) || !Player_InCsMode(play))) {
|
||||
if ((gSaveContext.isMagicAcquired != 0) && (gSaveContext.magicLevel == 0)) {
|
||||
gSaveContext.magicLevel = gSaveContext.isDoubleMagicAcquired + 1;
|
||||
gSaveContext.magicState = 8;
|
||||
gSaveContext.magicState = MAGIC_STATE_STEP_CAPACITY;
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
osSyncPrintf("魔法スター─────ト!!!!!!!!!\n"); // "Magic Start!!!!!!!!!"
|
||||
osSyncPrintf("MAGIC_MAX=%d\n", gSaveContext.magicLevel);
|
||||
|
@ -545,7 +545,7 @@ void Play_Init(GameState* thisx) {
|
||||
|
||||
if (gSaveContext.gameMode != 0 || gSaveContext.cutsceneIndex >= 0xFFF0) {
|
||||
gSaveContext.nayrusLoveTimer = 0;
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
gSaveContext.sceneSetupIndex = (gSaveContext.cutsceneIndex & 0xF) + 4;
|
||||
} else if (!LINK_IS_ADULT && IS_DAY) {
|
||||
gSaveContext.sceneSetupIndex = 0;
|
||||
|
@ -342,7 +342,7 @@ uint8_t Player_IsCustomLinkModel() {
|
||||
s32 Player_InBlockingCsMode(PlayState* play, Player* this) {
|
||||
return (this->stateFlags1 & 0x20000080) || (this->csMode != 0) || (play->sceneLoadFlag == 0x14) ||
|
||||
(this->stateFlags1 & 1) || (this->stateFlags3 & 0x80) ||
|
||||
((gSaveContext.magicState != 0) && (Player_ActionToMagicSpell(this, this->itemAction) >= 0));
|
||||
((gSaveContext.magicState != MAGIC_STATE_IDLE) && (Player_ActionToMagicSpell(this, this->itemAction) >= 0));
|
||||
}
|
||||
|
||||
s32 Player_InCsMode(PlayState* play) {
|
||||
|
@ -55,7 +55,7 @@ void ArrowFire_Init(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void ArrowFire_Destroy(Actor* thisx, PlayState* play) {
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
LOG_STRING("消滅"); // "Disappearance"
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ void ArrowIce_Init(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void ArrowIce_Destroy(Actor* thisx, PlayState* play) {
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
LOG_STRING("消滅"); // "Disappearance"
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ void ArrowLight_Init(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void ArrowLight_Destroy(Actor* thisx, PlayState* play) {
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
LOG_STRING("消滅"); // "Disappearance"
|
||||
}
|
||||
|
||||
|
@ -741,7 +741,7 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play) {
|
||||
switch (actionIndex) {
|
||||
case FAIRY_UPGRADE_MAGIC:
|
||||
gSaveContext.isMagicAcquired = true;
|
||||
gSaveContext.magicFillTarget = 0x30;
|
||||
gSaveContext.magicFillTarget = MAGIC_NORMAL_METER;
|
||||
Interface_ChangeAlpha(9);
|
||||
break;
|
||||
case FAIRY_UPGRADE_DOUBLE_MAGIC:
|
||||
@ -749,7 +749,7 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play) {
|
||||
gSaveContext.isMagicAcquired = true;
|
||||
}
|
||||
gSaveContext.isDoubleMagicAcquired = true;
|
||||
gSaveContext.magicFillTarget = 0x60;
|
||||
gSaveContext.magicFillTarget = MAGIC_DOUBLE_METER;
|
||||
gSaveContext.magicLevel = 0;
|
||||
Interface_ChangeAlpha(9);
|
||||
break;
|
||||
|
@ -85,9 +85,9 @@ void EnMThunder_Init(Actor* thisx, PlayState* play2) {
|
||||
this->unk_1CA = 0;
|
||||
|
||||
if (player->stateFlags2 & 0x20000) {
|
||||
if (!gSaveContext.isMagicAcquired || gSaveContext.magicState ||
|
||||
if (!gSaveContext.isMagicAcquired || (gSaveContext.magicState != MAGIC_STATE_IDLE) ||
|
||||
(((this->actor.params & 0xFF00) >> 8) &&
|
||||
!(func_80087708(play, (this->actor.params & 0xFF00) >> 8, 0)))) {
|
||||
!(Magic_RequestChange(play, (this->actor.params & 0xFF00) >> 8, MAGIC_CONSUME_NOW)))) {
|
||||
Audio_PlaySoundGeneral(NA_SE_IT_ROLLING_CUT, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
|
||||
&D_801333E8);
|
||||
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_SWING_HARD, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
|
||||
@ -116,7 +116,7 @@ void EnMThunder_Destroy(Actor* thisx, PlayState* play) {
|
||||
EnMThunder* this = (EnMThunder*)thisx;
|
||||
|
||||
if (this->unk_1CA != 0) {
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
}
|
||||
|
||||
Collider_DestroyCylinder(play, &this->collider);
|
||||
@ -158,8 +158,8 @@ void func_80A9F408(EnMThunder* this, PlayState* play) {
|
||||
|
||||
if (this->unk_1CA == 0) {
|
||||
if (player->unk_858 >= 0.1f) {
|
||||
if ((gSaveContext.magicState) || (((this->actor.params & 0xFF00) >> 8) &&
|
||||
!(func_80087708(play, (this->actor.params & 0xFF00) >> 8, 4)))) {
|
||||
if ((gSaveContext.magicState != MAGIC_STATE_IDLE) || (((this->actor.params & 0xFF00) >> 8) &&
|
||||
!(Magic_RequestChange(play, (this->actor.params & 0xFF00) >> 8, MAGIC_CONSUME_WAIT_PREVIEW)))) {
|
||||
func_80A9F350(this, play);
|
||||
func_80A9EFE0(this, func_80A9F350);
|
||||
this->unk_1C8 = 0;
|
||||
@ -193,7 +193,7 @@ void func_80A9F408(EnMThunder* this, PlayState* play) {
|
||||
} else {
|
||||
player->stateFlags2 &= ~0x20000;
|
||||
if ((this->actor.params & 0xFF00) >> 8) {
|
||||
gSaveContext.magicState = 1;
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP;
|
||||
}
|
||||
if (player->unk_858 < 0.85f) {
|
||||
this->collider.info.toucher.dmgFlags = D_80AA044C[this->unk_1C7];
|
||||
|
@ -195,7 +195,7 @@ void UseBow(Actor* thisx, PlayState* play, u8 started, u8 arrowType) {
|
||||
} else if (started == 0) {
|
||||
if (this->itemTimer <= 0) {
|
||||
if (AMMO(ITEM_BOW) > 0) {
|
||||
if (arrowType >= 1 && !func_80087708(play, magicArrowCosts[arrowType], 0)) {
|
||||
if (arrowType >= 1 && !Magic_RequestChange(play, magicArrowCosts[arrowType], MAGIC_CONSUME_NOW)) {
|
||||
func_80078884(NA_SE_SY_ERROR);
|
||||
this->canMove = 1;
|
||||
return;
|
||||
@ -455,7 +455,7 @@ void UseSpell(Actor* thisx, PlayState* play, u8 started, u8 spellType) {
|
||||
|
||||
if (started == 0 && this->usedSpell != 0) {
|
||||
this->itemTimer = 10;
|
||||
gSaveContext.magicState = 5;
|
||||
gSaveContext.magicState = MAGIC_STATE_RESET;
|
||||
|
||||
switch (this->usedSpell) {
|
||||
case 1:
|
||||
@ -487,7 +487,7 @@ void UseSpell(Actor* thisx, PlayState* play, u8 started, u8 spellType) {
|
||||
break;
|
||||
}
|
||||
|
||||
gSaveContext.magicState = 3;
|
||||
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_1;
|
||||
this->magicTimer--;
|
||||
if (this->magicTimer <= 0) {
|
||||
gSaveContext.magic--;
|
||||
@ -497,7 +497,7 @@ void UseSpell(Actor* thisx, PlayState* play, u8 started, u8 spellType) {
|
||||
|
||||
this->itemTimer = 10;
|
||||
this->usedSpell = 0;
|
||||
gSaveContext.magicState = 5;
|
||||
gSaveContext.magicState = MAGIC_STATE_RESET;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -568,7 +568,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) {
|
||||
|
||||
// Causes Dark Link to shield in place when Link is using magic attacks other than the spin attack
|
||||
|
||||
if ((gSaveContext.magicState == 3) && (player->meleeWeaponState == 0 || (player->meleeWeaponAnimation < SPIN_ATTACK_1H) ||
|
||||
if ((gSaveContext.magicState == MAGIC_STATE_METER_FLASH_1) && (player->meleeWeaponState == 0 || (player->meleeWeaponAnimation < SPIN_ATTACK_1H) ||
|
||||
(player->meleeWeaponAnimation > BIG_SPIN_2H))) {
|
||||
sStickTilt = 0.0f;
|
||||
input->cur.stick_x = 0;
|
||||
|
@ -1810,7 +1810,7 @@ void func_80B5772C(EnZl3* this, PlayState* play) {
|
||||
}
|
||||
|
||||
void func_80B57754(EnZl3* this, PlayState* play) {
|
||||
if (gSaveContext.magicState == 0) {
|
||||
if (gSaveContext.magicState == MAGIC_STATE_IDLE) {
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_OCEFF_WIPE4, this->actor.world.pos.x,
|
||||
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, true);
|
||||
func_80B56DA4(this);
|
||||
|
@ -65,7 +65,7 @@ void MagicDark_Init(Actor* thisx, PlayState* play) {
|
||||
|
||||
void MagicDark_Destroy(Actor* thisx, PlayState* play) {
|
||||
if (gSaveContext.nayrusLoveTimer == 0) {
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ void MagicFire_Init(Actor* thisx, PlayState* play) {
|
||||
}
|
||||
|
||||
void MagicFire_Destroy(Actor* thisx, PlayState* play) {
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
}
|
||||
|
||||
void MagicFire_UpdateBeforeCast(Actor* thisx, PlayState* play) {
|
||||
|
@ -70,7 +70,7 @@ void MagicWind_Init(Actor* thisx, PlayState* play) {
|
||||
void MagicWind_Destroy(Actor* thisx, PlayState* play) {
|
||||
MagicWind* this = (MagicWind*)thisx;
|
||||
SkelCurve_Destroy(play, &this->skelCurve);
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
// "wipe out"
|
||||
LOG_STRING("消滅");
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ void OceffSpot_Destroy(Actor* thisx, PlayState* play) {
|
||||
|
||||
LightContext_RemoveLight(play, &play->lightCtx, this->lightNode1);
|
||||
LightContext_RemoveLight(play, &play->lightCtx, this->lightNode2);
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
if ((gSaveContext.nayrusLoveTimer != 0) && (play->actorCtx.actorLists[ACTORCAT_PLAYER].length != 0)) {
|
||||
player->stateFlags3 |= PLAYER_STATE3_RESTORE_NAYRUS_LOVE;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ void OceffStorm_Destroy(Actor* thisx, PlayState* play) {
|
||||
OceffStorm* this = (OceffStorm*)thisx;
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
if (gSaveContext.nayrusLoveTimer != 0) {
|
||||
player->stateFlags3 |= PLAYER_STATE3_RESTORE_NAYRUS_LOVE;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ void OceffWipe_Destroy(Actor* thisx, PlayState* play) {
|
||||
OceffWipe* this = (OceffWipe*)thisx;
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
if (gSaveContext.nayrusLoveTimer != 0) {
|
||||
player->stateFlags3 |= PLAYER_STATE3_RESTORE_NAYRUS_LOVE;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ void OceffWipe2_Destroy(Actor* thisx, PlayState* play) {
|
||||
OceffWipe2* this = (OceffWipe2*)thisx;
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
if (gSaveContext.nayrusLoveTimer != 0) {
|
||||
player->stateFlags3 |= PLAYER_STATE3_RESTORE_NAYRUS_LOVE;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ void OceffWipe3_Destroy(Actor* thisx, PlayState* play) {
|
||||
OceffWipe3* this = (OceffWipe3*)thisx;
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
if (gSaveContext.nayrusLoveTimer != 0) {
|
||||
player->stateFlags3 |= PLAYER_STATE3_RESTORE_NAYRUS_LOVE;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ void OceffWipe4_Init(Actor* thisx, PlayState* play) {
|
||||
void OceffWipe4_Destroy(Actor* thisx, PlayState* play) {
|
||||
OceffWipe4* this = (OceffWipe4*)thisx;
|
||||
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
}
|
||||
|
||||
void OceffWipe4_Update(Actor* thisx, PlayState* play) {
|
||||
|
@ -2224,7 +2224,7 @@ s32 func_8083442C(Player* this, PlayState* play) {
|
||||
s32 magicArrowType;
|
||||
|
||||
if ((this->heldItemAction >= PLAYER_IA_BOW_FIRE) && (this->heldItemAction <= PLAYER_IA_BOW_0E) &&
|
||||
(gSaveContext.magicState != 0)) {
|
||||
(gSaveContext.magicState != MAGIC_STATE_IDLE)) {
|
||||
func_80078884(NA_SE_SY_ERROR);
|
||||
} else {
|
||||
func_80833638(this, func_808351D4);
|
||||
@ -2240,7 +2240,7 @@ s32 func_8083442C(Player* this, PlayState* play) {
|
||||
|
||||
if (this->unk_860 >= 0) {
|
||||
if ((magicArrowType >= 0) && (magicArrowType <= 2) &&
|
||||
!func_80087708(play, sMagicArrowCosts[magicArrowType], 0)) {
|
||||
!Magic_RequestChange(play, sMagicArrowCosts[magicArrowType], MAGIC_CONSUME_NOW)) {
|
||||
arrowType = ARROW_NORMAL;
|
||||
}
|
||||
|
||||
@ -2979,7 +2979,7 @@ void func_80835F44(PlayState* play, Player* this, s32 item) {
|
||||
}
|
||||
|
||||
if (actionParam == PLAYER_IA_LENS_OF_TRUTH) {
|
||||
if (func_80087708(play, 0, 3)) {
|
||||
if (Magic_RequestChange(play, 0, MAGIC_CONSUME_LENS)) {
|
||||
if (play->actorCtx.lensActive) {
|
||||
Actor_DisableLens(play);
|
||||
} else {
|
||||
@ -3004,7 +3004,7 @@ void func_80835F44(PlayState* play, Player* this, s32 item) {
|
||||
temp = Player_ActionToMagicSpell(this, actionParam);
|
||||
if (temp >= 0) {
|
||||
if (((actionParam == PLAYER_IA_FARORES_WIND) && (gSaveContext.respawn[RESPAWN_MODE_TOP].data > 0)) ||
|
||||
((gSaveContext.magicCapacity != 0) && (gSaveContext.magicState == 0) &&
|
||||
((gSaveContext.magicCapacity != 0) && (gSaveContext.magicState == MAGIC_STATE_IDLE) &&
|
||||
(gSaveContext.magic >= sMagicSpellCosts[temp]))) {
|
||||
this->itemAction = actionParam;
|
||||
this->unk_6AD = 4;
|
||||
@ -4981,7 +4981,7 @@ void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) {
|
||||
func_80835DE4(play, this, func_808507F4, 0);
|
||||
|
||||
this->unk_84F = magicSpell - 3;
|
||||
func_80087708(play, sMagicSpellCosts[magicSpell], 4);
|
||||
Magic_RequestChange(play, sMagicSpellCosts[magicSpell], MAGIC_CONSUME_WAIT_PREVIEW);
|
||||
|
||||
u8 isFastFarores = CVarGetInteger("gFastFarores", 0) && this->itemAction == PLAYER_IA_FARORES_WIND;
|
||||
|
||||
@ -9740,7 +9740,7 @@ void Player_Init(Actor* thisx, PlayState* play2) {
|
||||
}
|
||||
|
||||
if (gSaveContext.nayrusLoveTimer != 0) {
|
||||
gSaveContext.magicState = 3;
|
||||
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_1;
|
||||
func_80846A00(play, this, 1);
|
||||
this->stateFlags3 &= ~PLAYER_STATE3_RESTORE_NAYRUS_LOVE;
|
||||
}
|
||||
@ -10666,8 +10666,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
|
||||
func_80848C74(play, this);
|
||||
}
|
||||
|
||||
if ((this->stateFlags3 & PLAYER_STATE3_RESTORE_NAYRUS_LOVE) && (gSaveContext.nayrusLoveTimer != 0) && (gSaveContext.magicState == 0)) {
|
||||
gSaveContext.magicState = 3;
|
||||
if ((this->stateFlags3 & PLAYER_STATE3_RESTORE_NAYRUS_LOVE) && (gSaveContext.nayrusLoveTimer != 0) && (gSaveContext.magicState == MAGIC_STATE_IDLE)) {
|
||||
gSaveContext.magicState = MAGIC_STATE_METER_FLASH_1;
|
||||
func_80846A00(play, this, 1);
|
||||
this->stateFlags3 &= ~PLAYER_STATE3_RESTORE_NAYRUS_LOVE;
|
||||
}
|
||||
@ -11373,7 +11373,7 @@ void Player_Destroy(Actor* thisx, PlayState* play) {
|
||||
Collider_DestroyQuad(play, &this->meleeWeaponQuads[1]);
|
||||
Collider_DestroyQuad(play, &this->shieldQuad);
|
||||
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
|
||||
gSaveContext.linkAge = play->linkAgeOnLoad;
|
||||
|
||||
@ -13098,39 +13098,39 @@ void func_8084EAC0(Player* this, PlayState* play) {
|
||||
}
|
||||
|
||||
if (CVarGetInteger("gBlueManaPercentRestore", 0)) {
|
||||
if (gSaveContext.magicState != 10) {
|
||||
if (gSaveContext.magicState != MAGIC_STATE_ADD) {
|
||||
Magic_Fill(play);
|
||||
}
|
||||
|
||||
func_80087708(play,
|
||||
Magic_RequestChange(play,
|
||||
(gSaveContext.magicLevel * 48 * CVarGetInteger("gBluePotionMana", 100) / 100 + 15) /
|
||||
16 * 16,
|
||||
5);
|
||||
MAGIC_ADD);
|
||||
} else {
|
||||
if (gSaveContext.magicState != 10) {
|
||||
if (gSaveContext.magicState != MAGIC_STATE_ADD) {
|
||||
Magic_Fill(play);
|
||||
}
|
||||
|
||||
func_80087708(play, CVarGetInteger("gBluePotionMana", 100), 5);
|
||||
Magic_RequestChange(play, CVarGetInteger("gBluePotionMana", 100), MAGIC_ADD);
|
||||
;
|
||||
}
|
||||
} else if (CVarGetInteger("gGreenPotionEffect", 0) &&
|
||||
this->itemAction == PLAYER_IA_BOTTLE_POTION_GREEN) {
|
||||
if (CVarGetInteger("gGreenPercentRestore", 0)) {
|
||||
if (gSaveContext.magicState != 10) {
|
||||
if (gSaveContext.magicState != MAGIC_STATE_ADD) {
|
||||
Magic_Fill(play);
|
||||
}
|
||||
|
||||
func_80087708(play,
|
||||
Magic_RequestChange(play,
|
||||
(gSaveContext.magicLevel * 48 * CVarGetInteger("gGreenPotionMana", 100) / 100 + 15) /
|
||||
16 * 16,
|
||||
5);
|
||||
MAGIC_ADD);
|
||||
} else {
|
||||
if (gSaveContext.magicState != 10) {
|
||||
if (gSaveContext.magicState != MAGIC_STATE_ADD) {
|
||||
Magic_Fill(play);
|
||||
}
|
||||
|
||||
func_80087708(play, CVarGetInteger("gGreenPotionMana", 100), 5);
|
||||
Magic_RequestChange(play, CVarGetInteger("gGreenPotionMana", 100), MAGIC_ADD);
|
||||
;
|
||||
}
|
||||
} else if (CVarGetInteger("gMilkEffect", 0) && (this->itemAction == PLAYER_IA_BOTTLE_MILK_FULL ||
|
||||
@ -13174,7 +13174,7 @@ void func_8084EAC0(Player* this, PlayState* play) {
|
||||
func_8083C0E8(this, play);
|
||||
func_8005B1A4(Play_GetCamera(play, 0));
|
||||
} else if (this->unk_850 == 1) {
|
||||
if ((gSaveContext.healthAccumulator == 0) && (gSaveContext.magicState != 9)) {
|
||||
if ((gSaveContext.healthAccumulator == 0) && (gSaveContext.magicState != MAGIC_STATE_FILL)) {
|
||||
func_80832B78(play, this, &gPlayerAnim_link_bottle_drink_demo_end);
|
||||
this->unk_850 = 2;
|
||||
Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_IA_BOTTLE);
|
||||
@ -13933,7 +13933,7 @@ void func_808507F4(Player* this, PlayState* play) {
|
||||
u8 isFastFarores = CVarGetInteger("gFastFarores", 0) && this->itemAction == PLAYER_IA_FARORES_WIND;
|
||||
if (LinkAnimation_Update(play, &this->skelAnime)) {
|
||||
if (this->unk_84F < 0) {
|
||||
if ((this->itemAction == PLAYER_IA_NAYRUS_LOVE) || isFastFarores || (gSaveContext.magicState == 0)) {
|
||||
if ((this->itemAction == PLAYER_IA_NAYRUS_LOVE) || isFastFarores || (gSaveContext.magicState == MAGIC_STATE_IDLE)) {
|
||||
func_80839FFC(this, play);
|
||||
func_8005B1A4(Play_GetCamera(play, 0));
|
||||
}
|
||||
@ -13944,10 +13944,10 @@ void func_808507F4(Player* this, PlayState* play) {
|
||||
if (func_80846A00(play, this, this->unk_84F) != NULL) {
|
||||
this->stateFlags1 |= PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE;
|
||||
if ((this->unk_84F != 0) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) {
|
||||
gSaveContext.magicState = 1;
|
||||
gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP;
|
||||
}
|
||||
} else {
|
||||
func_800876C8(play);
|
||||
Magic_Reset(play);
|
||||
}
|
||||
} else {
|
||||
LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, D_80854A64[this->unk_84F], 0.83f * (isFastFarores ? 2 : 1));
|
||||
|
@ -2987,8 +2987,8 @@ void FileChoose_LoadGame(GameState* thisx) {
|
||||
gSaveContext.unk_13EE = 0x32;
|
||||
gSaveContext.nayrusLoveTimer = 0;
|
||||
gSaveContext.healthAccumulator = 0;
|
||||
gSaveContext.magicState = 0;
|
||||
gSaveContext.prevMagicState = 0;
|
||||
gSaveContext.magicState = MAGIC_STATE_IDLE;
|
||||
gSaveContext.prevMagicState = MAGIC_STATE_IDLE;
|
||||
gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX;
|
||||
gSaveContext.skyboxTime = 0;
|
||||
gSaveContext.nextTransitionType = 0xFF;
|
||||
|
@ -4167,8 +4167,8 @@ void KaleidoScope_Update(PlayState* play)
|
||||
gSaveContext.health = CVarGetInteger("gFullHealthSpawn", 0) ? gSaveContext.healthCapacity : 0x30;
|
||||
Audio_QueueSeqCmd(0xF << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xA);
|
||||
gSaveContext.healthAccumulator = 0;
|
||||
gSaveContext.magicState = 0;
|
||||
gSaveContext.prevMagicState = 0;
|
||||
gSaveContext.magicState = MAGIC_STATE_IDLE;
|
||||
gSaveContext.prevMagicState = MAGIC_STATE_IDLE;
|
||||
osSyncPrintf(VT_FGCOL(YELLOW));
|
||||
osSyncPrintf("MAGIC_NOW=%d ", gSaveContext.magic);
|
||||
osSyncPrintf("Z_MAGIC_NOW_NOW=%d → ", gSaveContext.magicFillTarget);
|
||||
|
Loading…
Reference in New Issue
Block a user