summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
authorPepe20129 <72659707+Pepe20129@users.noreply.github.com>2024-10-07 23:36:21 +0200
committerGitHub <noreply@github.com>2024-10-07 14:36:21 -0700
commit2822dfc3f3f3cf27046c76b010322d715410b87a (patch)
tree303e938c3d566c89b6bcac5585d1c7ded4fb2d62 /soh/src/code
parent7450cee0b28cfe042685afcbdd7cadf6dce410db (diff)
VBify (#4255)
* Convert ocarina buttons & skip scarecrow song to VB * Move most of boss rush & rupee/key counters to VB * Move BossRush_HandleCompleteBoss to VB * Convert boss timestamps to VB * Move being able to open doors to VB * Convert Entrance_OverrideWeatherState to VB * Move boss souls to hook_handlers.cpp * Update hook_handlers.cpp * Move infinite upgrades to hook_handlers.cpp * Move skeleton key to hook_handlers.cpp * Move swim and child wallet to hook_handlers.cpp * Move ganons boss key to hook_handlers.cpp * Move triforce hunt to hook_handlers.cpp * Move randomizer sheik spawn to hook_handlers.cpp * Update BossRush.h * Convert spoiling items to VB * Move load game stuff to hook_handlers.cpp * Move warp song handling to hook_handlers.cpp * Convert being able to play bowling to VB * Move shooting gallery man handling to hook_handlers.cpp * Move spirit temple silver block removal to hook_handlers.cpp * Fix build * Move last beehive stuff to hook_handlers.cpp * Fix build * Add VB_CLOSE_PAUSE_MENU * Add VB_BE_ABLE_TO_SAVE * Add VB_RENDER_YES_ON_CONTINUE_PROMPT * Add VB_SPAWN_BLUE_WARP * Add VB_BLUE_WARP_ADULT_WARP_OUT * Add VB_BG_BREAKWALL_BREAK * Convert Saria stuff to VB * Remove now unused check * Add VB_GANON_HEAL_BEFORE_FIGHT * Update hook_handlers.cpp * Fix blue warp offsets * Fixes from review * Improve documentation * Update BossRush.cpp * Fix my stupidity * Fix #4327 * Update hook_handlers.cpp * Fix blue warps * Use ultralib types & clean header * Replace options amount macro with BR_OPTIONS_MAX * Remove unused includes * Remove accidental line doubling * Tweaks to boss rush (#6) * Update GameInteractor_HookTable.h --------- Co-authored-by: Garrett Cox <garrettjcox@gmail.com>
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/code_800EC960.c12
-rw-r--r--soh/src/code/z_horse.c8
-rw-r--r--soh/src/code/z_parameter.c70
-rw-r--r--soh/src/code/z_play.c4
-rw-r--r--soh/src/code/z_sram.c4
5 files changed, 46 insertions, 52 deletions
diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c
index a1364b8a9..145ab7c1c 100644
--- a/soh/src/code/code_800EC960.c
+++ b/soh/src/code/code_800EC960.c
@@ -1,6 +1,8 @@
#include <libultraship/libultra.h>
#include "global.h"
#include "soh/Enhancements/audio/AudioEditor.h"
+#include "soh/Enhancements/game-interactor/GameInteractor.h"
+#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
// TODO: can these macros be shared between files? code_800F9280 seems to use
// versions without any casts...
@@ -1626,23 +1628,23 @@ void func_800ED458(s32 arg0) {
}
Audio_OcaUpdateBtnMap(customControls, dpad, rStick);
- if (D_8016BA18 & sOcarinaD4BtnMap && (!IS_RANDO || Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_A))) {
+ if (D_8016BA18 & sOcarinaD4BtnMap && GameInteractor_Should(VB_HAVE_OCARINA_NOTE_D4, true, NULL)) {
osSyncPrintf("Presss NA_KEY_D4 %08x\n", sOcarinaD4BtnMap);
sCurOcarinaBtnVal = 2;
sCurOcarinaBtnIdx = 0;
- } else if (D_8016BA18 & sOcarinaF4BtnMap && (!IS_RANDO || Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_DOWN))) {
+ } else if (D_8016BA18 & sOcarinaF4BtnMap && GameInteractor_Should(VB_HAVE_OCARINA_NOTE_F4, true, NULL)) {
osSyncPrintf("Presss NA_KEY_F4 %08x\n", sOcarinaF4BtnMap);
sCurOcarinaBtnVal = 5;
sCurOcarinaBtnIdx = 1;
- } else if (D_8016BA18 & sOcarinaA4BtnMap && (!IS_RANDO || Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_RIGHT))) {
+ } else if (D_8016BA18 & sOcarinaA4BtnMap && GameInteractor_Should(VB_HAVE_OCARINA_NOTE_A4, true, NULL)) {
osSyncPrintf("Presss NA_KEY_A4 %08x\n", sOcarinaA4BtnMap);
sCurOcarinaBtnVal = 9;
sCurOcarinaBtnIdx = 2;
- } else if (D_8016BA18 & sOcarinaB4BtnMap && (!IS_RANDO || Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_LEFT))) {
+ } else if (D_8016BA18 & sOcarinaB4BtnMap && GameInteractor_Should(VB_HAVE_OCARINA_NOTE_B4, true, NULL)) {
osSyncPrintf("Presss NA_KEY_B4 %08x\n", sOcarinaA4BtnMap);
sCurOcarinaBtnVal = 0xB;
sCurOcarinaBtnIdx = 3;
- } else if (D_8016BA18 & sOcarinaD5BtnMap && (!IS_RANDO || Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_UP))) {
+ } else if (D_8016BA18 & sOcarinaD5BtnMap && GameInteractor_Should(VB_HAVE_OCARINA_NOTE_D5, true, NULL)) {
osSyncPrintf("Presss NA_KEY_D5 %08x\n", sOcarinaD5BtnMap);
sCurOcarinaBtnVal = 0xE;
sCurOcarinaBtnIdx = 4;
diff --git a/soh/src/code/z_horse.c b/soh/src/code/z_horse.c
index 48c76396f..33ba7a84d 100644
--- a/soh/src/code/z_horse.c
+++ b/soh/src/code/z_horse.c
@@ -1,6 +1,8 @@
#include "global.h"
#include "vt.h"
#include <assert.h>
+#include "soh/Enhancements/game-interactor/GameInteractor.h"
+#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
s32 func_8006CFC0(s32 scene) {
s32 validScenes[] = { SCENE_HYRULE_FIELD, SCENE_LAKE_HYLIA, SCENE_GERUDO_VALLEY, SCENE_GERUDOS_FORTRESS, SCENE_LON_LON_RANCH };
@@ -75,9 +77,9 @@ void func_8006D0EC(PlayState* play, Player* player) {
} else if ((play->sceneNum == gSaveContext.horseData.scene) &&
(((Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) != 0) && (!IS_RANDO ||
(IS_RANDO && CHECK_QUEST_ITEM(QUEST_SONG_EPONA) &&
- Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_UP) &&
- Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_LEFT) &&
- Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_RIGHT) &&
+ GameInteractor_Should(VB_HAVE_OCARINA_NOTE_D5, true, NULL) &&
+ GameInteractor_Should(VB_HAVE_OCARINA_NOTE_B4, true, NULL) &&
+ GameInteractor_Should(VB_HAVE_OCARINA_NOTE_A4, true, NULL) &&
(INV_CONTENT(ITEM_OCARINA_FAIRY) != ITEM_NONE)))) || DREG(1) != 0)) {
// "Set by existence of horse %d %d %d"
osSyncPrintf("馬存在によるセット %d %d %d\n", gSaveContext.horseData.scene, Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED),
diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c
index 1ca58cf00..0d14468f2 100644
--- a/soh/src/code/z_parameter.c
+++ b/soh/src/code/z_parameter.c
@@ -5372,8 +5372,7 @@ void Interface_Draw(PlayState* play) {
if (fullUi) {
s16 PosX_RC;
s16 PosY_RC;
- //when not having a wallet (or infinite money) in rando, don't calculate the ruppe icon
- if (!IS_RANDO || (Flags_GetRandomizerInf(RAND_INF_HAS_WALLET) && !Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MONEY))) {
+ if (GameInteractor_Should(VB_RENDER_RUPEE_COUNTER, true, NULL)) {
// Rupee Icon
if (CVarGetInteger(CVAR_ENHANCEMENT("DynamicWalletIcon"), 0)) {
switch (CUR_UPG_VALUE(UPG_WALLET)) {
@@ -5444,14 +5443,10 @@ void Interface_Draw(PlayState* play) {
PosX_RC = PosX_RC_ori;
}
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, rColor.r, rColor.g, rColor.b, interfaceCtx->magicAlpha);
- // Draw Rupee icon. Hide in Boss Rush.
- if (!IS_BOSS_RUSH) {
- OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, PosX_RC, PosY_RC, 16, 16, 1 << 10, 1 << 10);
- }
+ OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, PosX_RC, PosY_RC, 16, 16, 1 << 10, 1 << 10);
}
- //when having the skeleton key in rando, don't render the small key counter
- if (!Flags_GetRandomizerInf(RAND_INF_HAS_SKELETON_KEY)) {
+ if (GameInteractor_Should(VB_RENDER_KEY_COUNTER, true, NULL)) {
switch (play->sceneNum) {
case SCENE_FOREST_TEMPLE:
case SCENE_FIRE_TEMPLE:
@@ -5467,7 +5462,6 @@ void Interface_Draw(PlayState* play) {
case SCENE_GANONS_TOWER_COLLAPSE_INTERIOR:
case SCENE_INSIDE_GANONS_CASTLE_COLLAPSE:
case SCENE_TREASURE_BOX_SHOP:
-
if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] >= 0) {
s16 X_Margins_SKC;
s16 Y_Margins_SKC;
@@ -5533,49 +5527,47 @@ void Interface_Draw(PlayState* play) {
}
}
- // Rupee Counter
- gDPPipeSync(OVERLAY_DISP++);
+ if (GameInteractor_Should(VB_RENDER_RUPEE_COUNTER, true, NULL)) {
+ // Rupee Counter
+ gDPPipeSync(OVERLAY_DISP++);
- if (gSaveContext.rupees == CUR_CAPACITY(UPG_WALLET)) {
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 255, 0, interfaceCtx->magicAlpha);
- } else if (gSaveContext.rupees != 0) {
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
- } else {
- gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 100, 100, interfaceCtx->magicAlpha);
- }
+ if (gSaveContext.rupees == CUR_CAPACITY(UPG_WALLET)) {
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 255, 0, interfaceCtx->magicAlpha);
+ } else if (gSaveContext.rupees != 0) {
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->magicAlpha);
+ } else {
+ gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 100, 100, interfaceCtx->magicAlpha);
+ }
- gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
- PRIMITIVE, 0);
+ gDPSetCombineLERP(OVERLAY_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
+ PRIMITIVE, 0);
- interfaceCtx->counterDigits[0] = interfaceCtx->counterDigits[1] = 0;
- interfaceCtx->counterDigits[2] = gSaveContext.rupees;
+ interfaceCtx->counterDigits[0] = interfaceCtx->counterDigits[1] = 0;
+ interfaceCtx->counterDigits[2] = gSaveContext.rupees;
- if ((interfaceCtx->counterDigits[2] > 9999) || (interfaceCtx->counterDigits[2] < 0)) {
- interfaceCtx->counterDigits[2] &= 0xDDD;
- }
+ if ((interfaceCtx->counterDigits[2] > 9999) || (interfaceCtx->counterDigits[2] < 0)) {
+ interfaceCtx->counterDigits[2] &= 0xDDD;
+ }
- while (interfaceCtx->counterDigits[2] >= 100) {
- interfaceCtx->counterDigits[0]++;
- interfaceCtx->counterDigits[2] -= 100;
- }
+ while (interfaceCtx->counterDigits[2] >= 100) {
+ interfaceCtx->counterDigits[0]++;
+ interfaceCtx->counterDigits[2] -= 100;
+ }
- while (interfaceCtx->counterDigits[2] >= 10) {
- interfaceCtx->counterDigits[1]++;
- interfaceCtx->counterDigits[2] -= 10;
- }
+ while (interfaceCtx->counterDigits[2] >= 10) {
+ interfaceCtx->counterDigits[1]++;
+ interfaceCtx->counterDigits[2] -= 10;
+ }
- svar2 = rupeeDigitsFirst[CUR_UPG_VALUE(UPG_WALLET)];
- svar5 = rupeeDigitsCount[CUR_UPG_VALUE(UPG_WALLET)];
+ svar2 = rupeeDigitsFirst[CUR_UPG_VALUE(UPG_WALLET)];
+ svar5 = rupeeDigitsCount[CUR_UPG_VALUE(UPG_WALLET)];
- // Draw Rupee Counter. Hide in Boss Rush and when not having a wallet in rando.
- if (!IS_BOSS_RUSH && (!IS_RANDO || Flags_GetRandomizerInf(RAND_INF_HAS_WALLET))) {
for (svar1 = 0, svar3 = 16; svar1 < svar5; svar1++, svar2++, svar3 += 8) {
OVERLAY_DISP = Gfx_TextureI8(OVERLAY_DISP, ((u8*)digitTextures[interfaceCtx->counterDigits[svar2]]),
8, 16, PosX_RC + svar3, PosY_RC, 8, 16, 1 << 10, 1 << 10);
}
}
- }
- else {
+ } else {
// Make sure item counts have black backgrounds
gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 0, 0, interfaceCtx->magicAlpha);
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0);
diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c
index a54314d00..56c786889 100644
--- a/soh/src/code/z_play.c
+++ b/soh/src/code/z_play.c
@@ -1804,10 +1804,6 @@ void* Play_LoadFile(PlayState* play, RomFile* file) {
}
void Play_InitEnvironment(PlayState* play, s16 skyboxId) {
- // For entrance rando, ensure the correct weather state and sky mode is applied
- if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) {
- Entrance_OverrideWeatherState();
- }
Skybox_Init(&play->state, &play->skyboxCtx, skyboxId);
Environment_Init(play, &play->envCtx, 0);
}
diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c
index 9daa5a3cf..8a848f301 100644
--- a/soh/src/code/z_sram.c
+++ b/soh/src/code/z_sram.c
@@ -2,6 +2,8 @@
#include "vt.h"
#include <string.h>
+#include "soh/Enhancements/game-interactor/GameInteractor.h"
+#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
#include "soh/Enhancements/randomizer/randomizer_entrance.h"
#include "soh/Enhancements/randomizer/savefile.h"
@@ -198,7 +200,7 @@ void Sram_OpenSave() {
}
}
- if (!(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ADULT_TRADE))) {
+ if (GameInteractor_Should(VB_REVERT_SPOILING_ITEMS, true, NULL)) {
for (i = 0; i < ARRAY_COUNT(gSpoilingItems); i++) {
if (INV_CONTENT(ITEM_TRADE_ADULT) == gSpoilingItems[i]) {
INV_CONTENT(gSpoilingItemReverts[i]) = gSpoilingItemReverts[i];