summaryrefslogtreecommitdiff
path: root/soh/src/code
diff options
context:
space:
mode:
authorSirius902 <10891979+Sirius902@users.noreply.github.com>2022-07-07 19:21:14 -0700
committerGitHub <noreply@github.com>2022-07-07 22:21:14 -0400
commitee184b5a5162320c543493841975725324e02943 (patch)
treed65082709e69d0b1f3a1be237c6d98715903f7c0 /soh/src/code
parenta1f92d76ab5b60d29b07b0332dbfb6936bff74f7 (diff)
Checkered room crash workaround (#615)
* Increase poly and vertex count for dyna actors * Add TODO * Only apply fix in Forest Temple * Enable globally
Diffstat (limited to 'soh/src/code')
-rw-r--r--soh/src/code/z_bgcheck.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/soh/src/code/z_bgcheck.c b/soh/src/code/z_bgcheck.c
index 91d3951ca..6b5c2f613 100644
--- a/soh/src/code/z_bgcheck.c
+++ b/soh/src/code/z_bgcheck.c
@@ -1584,9 +1584,19 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis
BgCheck_SetSubdivisionDimension(colCtx->minBounds.z, colCtx->subdivAmount.z, &colCtx->maxBounds.z,
&colCtx->subdivLength.z, &colCtx->subdivLengthInv.z);
-#ifdef _SOH64 // BGCheck needs more memory on 64 bits because it crashes on some areas
+// OTRTODO: Re-enable when the below DynaPoly workaround is removed.
+// #ifdef _SOH64 // BGCheck needs more memory on 64 bits because it crashes on some areas
+// colCtx->memSize *= 2;
+// #endif
+
+ // BGCheck needs a higher polygon and vertex count due to removed object dependencies.
+ // Otherwise Forest Temple checkered room will crash due to the hallway actor being killed a frame late.
+ //
+ // OTRTODO: This is a workaround. The proper solution to fix this crash is to manage object loading / unloading
+ // the same as N64.
colCtx->memSize *= 2;
-#endif
+ colCtx->dyna.polyListMax *= 2;
+ colCtx->dyna.vtxListMax *= 2;
memSize = colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z +
colCtx->colHeader->numPolygons * sizeof(u8) + colCtx->dyna.polyNodesMax * sizeof(SSNode) +