summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
authorAdam Bird <Archez@users.noreply.github.com>2023-11-24 09:38:45 -0500
committerGitHub <noreply@github.com>2023-11-24 09:38:45 -0500
commitf2df029efa9c46d4169dd1b1fc10ad887ddebe65 (patch)
treeda896cbc1801febc46d503017d262f48010ee53f /soh/src/code
parentbdb201201e133b9a09f08158b60d5df5aeb66907 (diff)
fix: skybox crash for mask shop (#3427)
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/z_vr_box.c7
-rw-r--r--soh/src/code/z_vr_box_draw.c10
2 files changed, 14 insertions, 3 deletions
diff --git a/soh/src/code/z_vr_box.c b/soh/src/code/z_vr_box.c
index b77c3d869..ff2622187 100644
--- a/soh/src/code/z_vr_box.c
+++ b/soh/src/code/z_vr_box.c
@@ -417,7 +417,12 @@ void func_800AEFC8(SkyboxContext* skyboxCtx, s16 skyboxId) {
s32 j;
s32 phi_s3 = 0;
- if (skyboxId == SKYBOX_BAZAAR || (skyboxId > SKYBOX_HOUSE_KAKARIKO && skyboxId <= SKYBOX_BOMBCHU_SHOP)) {
+ //! @bug All shops only provide 2 faces for their sky box. Mask shop is missing from the condition
+ // meaning that the Mask shop will calculate 4 faces
+ // This effect is not noticed as the faces are behind the camera, but will cause a crash in SoH.
+ // SOH General: We have added the Mask shop to this check so only the 2 expected faces are calculated.
+ if (skyboxId == SKYBOX_BAZAAR || skyboxId == SKYBOX_HAPPY_MASK_SHOP ||
+ (skyboxId >= SKYBOX_KOKIRI_SHOP && skyboxId <= SKYBOX_BOMBCHU_SHOP)) {
for (j = 0, i = 0; i < 2; i++, j += 2) {
phi_s3 = func_800ADBB0(skyboxCtx, skyboxCtx->roomVtx, phi_s3, D_8012AEBC[i].unk_0, D_8012AEBC[i].unk_4,
D_8012AEBC[i].unk_8, D_8012AEBC[i].unk_C, D_8012AEBC[i].unk_10, i, j);
diff --git a/soh/src/code/z_vr_box_draw.c b/soh/src/code/z_vr_box_draw.c
index 8eb97573e..5b4867121 100644
--- a/soh/src/code/z_vr_box_draw.c
+++ b/soh/src/code/z_vr_box_draw.c
@@ -59,8 +59,14 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[2]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[3]);
- if (skyboxId != SKYBOX_BAZAAR) {
- if (skyboxId <= SKYBOX_HOUSE_KAKARIKO || skyboxId > SKYBOX_BOMBCHU_SHOP) {
+ //! @bug All shops only provide 2 faces for their sky box. Mask shop is missing from the condition
+ // meaning that the Mask shop will render the previously loaded sky box values, or uninitialized data.
+ // This effect is not noticed as the faces are behind the camera, but will cause a crash in SoH.
+ // SOH General: We have added the Mask shop to this check so only the 2 expected faces are rendered.
+ if (skyboxId != SKYBOX_BAZAAR && skyboxId != SKYBOX_HAPPY_MASK_SHOP) {
+ if (skyboxId < SKYBOX_KOKIRI_SHOP || skyboxId > SKYBOX_BOMBCHU_SHOP) {
+ // Skip remaining faces for most shop skyboxes
+
gDPPipeSync(POLY_OPA_DISP++);
gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[2]);
gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[4]);