Skip to content

Commit

Permalink
Fix Zones boss UB
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicdcer committed Nov 18, 2024
1 parent 611e14e commit 561f6a7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 9 additions & 1 deletion src/mods/spawner.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,13 +302,21 @@ void Spawner_ObjKill(void) {
}

// Use this function to add code that eases your documentation work!
Spawner_Playground(void) {
void Spawner_Playground(void) {
Player* player = &gPlayer[0];

player->mercyTimer = 100;
gLaserStrength[0] = 2;
gBombCount[0] = 9;
gLifeCount[0] = 9;

#if 0
if (gControllerPress[0].button & L_JPAD) {
gArwingSpeed -= 50;
} else if (gControllerPress[0].button & R_JPAD) {
gArwingSpeed += 50;
}
#endif
}

void Spawner(void) {
Expand Down
7 changes: 3 additions & 4 deletions src/overlays/ovl_i3/fox_zo.c
Original file line number Diff line number Diff line change
Expand Up @@ -3271,14 +3271,13 @@ void Zoness_801986FC(ZoSarumarine* this, s32 arg1, f32 xOff, f32 yOff, f32 zOff,
}
}

#ifdef AVOID_UB
if (i < ARRAY_COUNT(gActors)) {
#else
#ifndef AVOID_UB
// @Bug: checking out of bounds
// If this passes the boss kills himself.
if (i >= ARRAY_COUNT(gActors)) {
#endif
actor245->obj.status = OBJ_FREE;
}
#endif
}

void Zoness_801989FC(ZoSarumarine* this) {
Expand Down

0 comments on commit 561f6a7

Please sign in to comment.