summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSonic Dreamcaster <alejandro.asenjo88@gmail.com>2025-01-06 02:10:18 -0300
committerSonic Dreamcaster <alejandro.asenjo88@gmail.com>2025-01-06 02:10:18 -0300
commite99e0f5e2d7ba88cc86b5b07dfc0733c6ec525cb (patch)
tree2e08caa3bef9579edc0937b07410af1d12b70037
parent3ae035d8e3b598bc1d46dbb1363076ba61518133 (diff)
fix Sector Z box bug
-rw-r--r--src/overlays/ovl_i4/fox_sz.c15
-rw-r--r--src/overlays/ovl_i5/fox_ma.c2
-rw-r--r--src/port/ui/ImguiUI.cpp4
3 files changed, 19 insertions, 2 deletions
diff --git a/src/overlays/ovl_i4/fox_sz.c b/src/overlays/ovl_i4/fox_sz.c
index 2add5e81..0e8c1b0f 100644
--- a/src/overlays/ovl_i4/fox_sz.c
+++ b/src/overlays/ovl_i4/fox_sz.c
@@ -611,6 +611,11 @@ void SectorZ_UpdateEvents(ActorAllRange* this) {
gActors[3].state = 2;
for (i = 10; i < ARRAY_COUNT(gActors); i++) {
+#ifdef AVOID_UB
+ if (gActors[i].obj.status == OBJ_FREE) {
+ continue;
+ }
+#endif
gActors[i].aiIndex = -1;
gActors[i].state = 3;
}
@@ -1893,7 +1898,13 @@ void SectorZ_LoadLevelObjects(void) {
}
}
- for (j = 50, actor = &gActors[j], i = 0; i < 1000; i++) {
+ if (CVarGetInteger("gSzActorFix", 0) == 1) {
+ j = 47;
+ } else {
+ j = 50;
+ }
+
+ for (actor = &gActors[j], i = 0; i < 1000; i++) {
if (gLevelObjects[i].id <= OBJ_INVALID) {
break;
}
@@ -1911,7 +1922,7 @@ void SectorZ_LoadLevelObjects(void) {
Object_SetInfo(&actor->info, actor->obj.id);
actor->itemDrop = DROP_SILVER_RING;
- if (j++ >= ARRAY_COUNT(gActors)) {
+ if (j++ >= 59) {
break;
}
actor++;
diff --git a/src/overlays/ovl_i5/fox_ma.c b/src/overlays/ovl_i5/fox_ma.c
index fcb4cca5..d8abc023 100644
--- a/src/overlays/ovl_i5/fox_ma.c
+++ b/src/overlays/ovl_i5/fox_ma.c
@@ -3492,12 +3492,14 @@ void Macbeth_MaRailwaySignal_Draw(MaRailwaySignal* this) {
Vec3f frameTable[50];
Matrix_Push(&gGfxMatrix);
+ // Lever
Animation_GetFrameData(&D_MA_602F2E0, 0, frameTable);
Animation_DrawSkeleton(1, D_MA_602F36C, frameTable, Macbeth_MaRailwaySignal_OverrideLimbDraw1, NULL, this,
&gIdentityMatrix);
Matrix_Pop(&gGfxMatrix);
Matrix_Push(&gGfxMatrix);
Animation_GetFrameData(&D_MA_602F098, 0, frameTable);
+ // Base
Animation_DrawSkeleton(1, D_MA_602F264, frameTable, Macbeth_MaRailwaySignal_OverrideLimbDraw2, NULL, this,
&gIdentityMatrix);
Matrix_Pop(&gGfxMatrix);
diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp
index ed9616fc..741bdb8a 100644
--- a/src/port/ui/ImguiUI.cpp
+++ b/src/port/ui/ImguiUI.cpp
@@ -461,6 +461,10 @@ void DrawEnhancementsMenu() {
.tooltip = "Fixes a camera bug found in the code of the game"
});
+ UIWidgets::CVarCheckbox("Sector Z: Spawn all actors", "gSzActorFix", {
+ .tooltip = "Fixes a bug found in Sector Z, where only 10 of 12 available actors are spawned, this causes two 'Space Junk Boxes' to be missing from the level."
+ });
+
ImGui::EndMenu();
}