diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index dac11a2939..6f38baef1d 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -41,6 +41,14 @@ typedef enum { // - None VB_AMY_SOLVE, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - `*Color_RGB8` + VB_APPLY_MAGIC_METER_FILL_COLOR, + // #### `result` // ```c // true @@ -50,6 +58,14 @@ typedef enum { // - `s8*` sCsState VB_BARINADE_DEATH_SCENE, + // #### `result` + // ```c + // Flags_GetEventChkInf(EVENTCHKINF_BEGAN_BARINA_BATTLE) + // ``` + // #### `args` + // - `*BossVa` + VB_BARINADE_PLAY_REMATCH_INTRO, + // #### `result` // ```c // this->actor.textId == 0x401A @@ -1837,6 +1853,14 @@ typedef enum { // - `*EnMs` VB_MAGIC_BEAN_SALESMAN_TAKE_MONEY, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - None + VB_MAGIC_METER_DEPLETE_WHILE_CONSUMING, + // #### `result` // ```c // CHECK_QUEST_ITEM(QUEST_SONG_EPONA) diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index d501c8e5a3..9d6d517155 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -1022,6 +1022,24 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l case VB_CRAWL: *should = *should && Flags_GetRandomizerInf(RAND_INF_CAN_CRAWL); break; + case VB_BARINADE_PLAY_REMATCH_INTRO: + *should = + *should && (!RAND_GET_OPTION(RSK_SHUFFLE_BOSS_SOULS) || Flags_GetRandomizerInf(RAND_INF_BARINADE_SOUL)); + break; + case VB_MAGIC_METER_DEPLETE_WHILE_CONSUMING: + *should = *should && !Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MAGIC_METER); + break; + case VB_APPLY_MAGIC_METER_FILL_COLOR: { + Color_RGB8* color = va_arg(args, Color_RGB8*); + + if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MAGIC_METER)) { + *color = { 0, 0, 200 }; + if (CVarGetInteger(CVAR_COSMETIC("Consumable_MagicInfinite.Changed"), 0)) { + *color = CVarGetColor24(CVAR_COSMETIC("Consumable_MagicInfinite.Value"), *color); + } + } + break; + } case VB_CAN_BUY_SHOP_SHIELD_OR_TUNIC: { // Gate non-randomized shop shields/tunics behind finding a non-shop copy. if (RAND_GET_OPTION(RSK_SHOP_SHIELDS_AND_TUNICS_ONLY_REFILL).Is(RO_GENERIC_ON)) { diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 524ecd89f0..3681efd1c3 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -3263,7 +3263,7 @@ void Interface_UpdateMagicBar(PlayState* play) { break; case MAGIC_STATE_CONSUME: - if (!Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MAGIC_METER)) { + if (GameInteractor_Should(VB_MAGIC_METER_DEPLETE_WHILE_CONSUMING, true)) { gSaveContext.magic -= 2; if (gSaveContext.magic <= 0) { gSaveContext.magic = 0; @@ -3454,7 +3454,6 @@ void Interface_DrawMagicBar(PlayState* play) { Color_RGB8 magicbar_yellow = { 250, 250, 0 }; // Magic bar being used Color_RGB8 magicbar_green = { R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), R_MAGIC_FILL_COLOR(2) }; // Magic bar fill - Color_RGB8 magicbar_blue = { 0, 0, 200 }; // Infinite magic bar if (CVarGetInteger(CVAR_COSMETIC("Consumable.MagicActive.Changed"), 0)) { magicbar_yellow = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicActive.Value"), magicbar_yellow); @@ -3462,9 +3461,7 @@ void Interface_DrawMagicBar(PlayState* play) { if (CVarGetInteger(CVAR_COSMETIC("Consumable.Magic.Changed"), 0)) { magicbar_green = CVarGetColor24(CVAR_COSMETIC("Consumable.Magic.Value"), magicbar_green); } - if (CVarGetInteger("gCosmetics.Consumable_MagicInfinite.Changed", 0)) { - magicbar_blue = CVarGetColor24("gCosmetics.Consumable_MagicInfinite.Value", magicbar_blue); - } + GameInteractor_Should(VB_APPLY_MAGIC_METER_FILL_COLOR, true, &magicbar_green); OPEN_DISPS(play->state.gfxCtx); @@ -3591,30 +3588,16 @@ void Interface_DrawMagicBar(PlayState* play) { // Fill the rest of the bar with the normal magic color gDPPipeSync(OVERLAY_DISP++); - if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MAGIC_METER)) { - // Blue magic - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_blue.r, magicbar_blue.g, magicbar_blue.b, - interfaceCtx->magicAlpha); - } else { - // Green magic (default) - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_green.r, magicbar_green.g, magicbar_green.b, - interfaceCtx->magicAlpha); - } + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_green.r, magicbar_green.g, magicbar_green.b, + interfaceCtx->magicAlpha); gSPWideTextureRectangle(OVERLAY_DISP++, rMagicFillX << 2, (magicBarY + 3) << 2, (rMagicFillX + gSaveContext.magicTarget) << 2, (magicBarY + 10) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); } else { // Fill the whole bar with the normal magic color - if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MAGIC_METER)) { - // Blue magic - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_blue.r, magicbar_blue.g, magicbar_blue.b, - interfaceCtx->magicAlpha); - } else { - // Green magic (default) - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_green.r, magicbar_green.g, magicbar_green.b, - interfaceCtx->magicAlpha); - } + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_green.r, magicbar_green.g, magicbar_green.b, + interfaceCtx->magicAlpha); gDPLoadMultiBlock_4b(OVERLAY_DISP++, gMagicMeterFillTex, 0, G_TX_RENDERTILE, G_IM_FMT_I, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, diff --git a/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index dc434fbd9e..73337ce6bb 100644 --- a/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -672,43 +672,39 @@ void BossVa_Init(Actor* thisx, PlayState* play2) { } else { this->actor.colChkInfo.damageTable = sDamageTable; sPhase2Timer = 0xFFFF; - if (Flags_GetEventChkInf(EVENTCHKINF_BEGAN_BARINA_BATTLE)) { - if (Randomizer_GetSettingValue(RSK_SHUFFLE_BOSS_SOULS) && - !Flags_GetRandomizerInf(RAND_INF_BARINADE_SOUL)) { - sCsState = BOSSVA_BATTLE; - } else { - sCsState = INTRO_CALL_BARI; - sDoorState = 100; - Player_SetCsActionWithHaltedActors(play, &this->actor, 1); - play->envCtx.screenFillColor[0] = 0xDC; - play->envCtx.screenFillColor[1] = 0xDC; - play->envCtx.screenFillColor[2] = 0xBE; - play->envCtx.screenFillColor[3] = 0xD2; - func_80064520(play, &play->csCtx); - sSubCamId = Play_CreateSubCamera(play); - Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); - Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); - sSubCamEyeNext.x = sSubCamEye.x = 140.0f; - sSubCamEyeNext.y = sSubCamEye.y = 205.0f; - sSubCamEyeNext.z = sSubCamEye.z = -20.0f; - sSubCamAtNext.x = sSubCamAt.x = 10.0f; - sSubCamAtNext.y = sSubCamAt.y = 50.0f; - sSubCamAtNext.z = sSubCamAt.z = -220.0f; - Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); - this->timer = 20; + if (GameInteractor_Should(VB_BARINADE_PLAY_REMATCH_INTRO, + Flags_GetEventChkInf(EVENTCHKINF_BEGAN_BARINA_BATTLE), this)) { + sCsState = INTRO_CALL_BARI; + sDoorState = 100; + Player_SetCsActionWithHaltedActors(play, &this->actor, 1); + play->envCtx.screenFillColor[0] = 0xDC; + play->envCtx.screenFillColor[1] = 0xDC; + play->envCtx.screenFillColor[2] = 0xBE; + play->envCtx.screenFillColor[3] = 0xD2; + func_80064520(play, &play->csCtx); + sSubCamId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, sSubCamId, CAM_STAT_ACTIVE); + sSubCamEyeNext.x = sSubCamEye.x = 140.0f; + sSubCamEyeNext.y = sSubCamEye.y = 205.0f; + sSubCamEyeNext.z = sSubCamEye.z = -20.0f; + sSubCamAtNext.x = sSubCamAt.x = 10.0f; + sSubCamAtNext.y = sSubCamAt.y = 50.0f; + sSubCamAtNext.z = sSubCamAt.z = -220.0f; + Play_CameraSetAtEye(play, sSubCamId, &sSubCamAt, &sSubCamEye); + this->timer = 20; - for (i = BOSSVA_BARI_LOWER_5; i >= BOSSVA_BARI_UPPER_1; i--) { - Actor_SpawnAsChild( - &play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, - sInitPosOffsets[i].x + this->actor.world.pos.x, - sInitPosOffsets[i].y + this->actor.world.pos.y, - sInitPosOffsets[i].z + this->actor.world.pos.z, sInitRot[i].x + this->actor.world.rot.x, - sInitRot[i].y + this->actor.world.rot.y, sInitRot[i].z + this->actor.world.rot.z, i); - } - - sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec; + for (i = BOSSVA_BARI_LOWER_5; i >= BOSSVA_BARI_UPPER_1; i--) { + Actor_SpawnAsChild( + &play->actorCtx, &this->actor, play, ACTOR_BOSS_VA, + sInitPosOffsets[i].x + this->actor.world.pos.x, + sInitPosOffsets[i].y + this->actor.world.pos.y, + sInitPosOffsets[i].z + this->actor.world.pos.z, sInitRot[i].x + this->actor.world.rot.x, + sInitRot[i].y + this->actor.world.rot.y, sInitRot[i].z + this->actor.world.rot.z, i); } + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec; + } else { sCsState = INTRO_START; sDoorState = 5;