From 898da32ec073380ff148fd41ccce41524bd05eaf Mon Sep 17 00:00:00 2001 From: JCog <42006114+JCog@users.noreply.github.com> Date: Fri, 16 Oct 2026 12:16:58 -0500 Subject: [PATCH 1/3] set dummy enemy level to prevent boss warp crash with bump attack equipped --- src/fp/warps/bosses.c | 3 ++- src/pm64.h | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/fp/warps/bosses.c b/src/fp/warps/bosses.c index 8104ea5..eb4e86f 100644 --- a/src/fp/warps/bosses.c +++ b/src/fp/warps/bosses.c @@ -100,7 +100,8 @@ static BattlePage *pageList[] = {&pageBowser, &pageChapterBosses, &pageJrT pm_Npc bossesDummyNpc = {0}; -static pm_Enemy dummyEnemy = {.npcID = BOSSES_DUMMY_ID}; +static pm_NpcSettings dummyNpcSettings = {.level = 99}; +static pm_Enemy dummyEnemy = {.npcID = BOSSES_DUMMY_ID, .npcSettings = &dummyNpcSettings}; static pm_Encounter dummyEncounter = {.enemy[0] = &dummyEnemy}; static s8 warpCountdown = 0; static bool leavingBattle = FALSE; diff --git a/src/pm64.h b/src/pm64.h index f7c01ba..933ae8e 100644 --- a/src/pm64.h +++ b/src/pm64.h @@ -907,6 +907,22 @@ typedef struct pm_BattleStatus { /* 0x45C */ char unk_45C[4]; } pm_BattleStatus; // size = 0x460 +typedef struct pm_NpcSettings { + /* 0x00 */ u32 defaultAnim; + /* 0x04 */ s16 height; + /* 0x06 */ s16 radius; + /* 0x08 */ void *otherAI; + /* 0x0C */ void *onInteract; + /* 0x10 */ void *ai; + /* 0x14 */ void *onHit; + /* 0x18 */ void *aux; + /* 0x1C */ void *onDefeat; + /* 0x20 */ s32 flags; + /* 0x24 */ s32 unk_24; + /* 0x28 */ s16 level; + /* 0x2A */ s16 actionFlags; // action flags: 1 = jump on seeing player +} pm_NpcSettings; // size = 0x2C + typedef struct pm_Enemy { /* 0x00 */ s32 flags; /* 0x04 */ s8 encounterIndex; @@ -917,7 +933,7 @@ typedef struct pm_Enemy { /* 0x0A */ s16 spawnPos[3]; /* 0x10 */ Vec3s unk_10; // TODO hitbox pos? /* 0x16 */ char unk_16[2]; - /* 0x18 */ void *npcSettings; + /* 0x18 */ pm_NpcSettings *npcSettings; /* 0x1C */ void *initBytecode; /* 0x20 */ void *interactBytecode; /* 0x24 */ void *aiBytecode; From f94d8701450ee7c7e3b4bf15242a162415f0051e Mon Sep 17 00:00:00 2001 From: JCog <42006114+JCog@users.noreply.github.com> Date: Fri, 16 Oct 2026 13:00:49 -0500 Subject: [PATCH 2/3] override encounter cheat during boss warps --- src/fp.c | 7 ++++++- src/fp.h | 1 + src/fp/warps/bosses.c | 6 +++++- src/pm64.h | 4 ++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/fp.c b/src/fp.c index 6a95aed..0b8ba90 100644 --- a/src/fp.c +++ b/src/fp.c @@ -19,6 +19,7 @@ #include FpCtxt fp = {.savedArea = 0x1c, + .enemyContactOverride = -1, .camDistMin = 100, .camDistMax = 1000, .freeCamMoveSpeed = 250, @@ -305,7 +306,11 @@ void fpDrawTimer(struct GfxFont *font, s32 cellWidth, s32 cellHeight, u8 menuAlp } void fpUpdateCheats(void) { - pm_gGameStatus.debugEnemyContact = settings->cheatEnemyContact; + if (fp.enemyContactOverride > -1) { + pm_gGameStatus.debugEnemyContact = fp.enemyContactOverride; + } else { + pm_gGameStatus.debugEnemyContact = settings->cheatEnemyContact; + } if (CHEAT_ACTIVE(CHEAT_HP)) { pm_gPlayerData.curHP = pm_gPlayerData.curMaxHP; } diff --git a/src/fp.h b/src/fp.h index 6534913..72c92d7 100644 --- a/src/fp.h +++ b/src/fp.h @@ -58,6 +58,7 @@ typedef struct { bool turbo; bool warp; u8 warpDelay; + s8 enemyContactOverride; char *lastImportedSavePath; bool freeCam; bool lockCam; diff --git a/src/fp/warps/bosses.c b/src/fp/warps/bosses.c index eb4e86f..80c619c 100644 --- a/src/fp/warps/bosses.c +++ b/src/fp/warps/bosses.c @@ -1,5 +1,6 @@ #include "bosses.h" #include "common.h" +#include "fp.h" #include "menu/menu.h" #include @@ -138,7 +139,7 @@ static void bossWarpProc(struct MenuItem *item, void *data) { battle = (u8)((s32)data & 0xFF); pm_clear_windows(); pm_clear_printers(); - // context is also true when paused, so checking game mode + fp.enemyContactOverride = 0; // prevent encounters cheat from interrupting warp if (pm_gGameStatus.context != CONTEXT_WORLD && pm_CurGameMode != 10 && pm_CurGameMode != 11) { // end battle cleanly so next fight can start fresh pm_gBattleState = 32; // BATTLE_STATE_END_BATTLE @@ -169,6 +170,9 @@ void bossesUpdateWarps() { } } else if (warpCountdown > 0) { warpCountdown--; + if (warpCountdown == 0) { + fp.enemyContactOverride = -1; + } } } diff --git a/src/pm64.h b/src/pm64.h index 933ae8e..f872ce8 100644 --- a/src/pm64.h +++ b/src/pm64.h @@ -920,8 +920,8 @@ typedef struct pm_NpcSettings { /* 0x20 */ s32 flags; /* 0x24 */ s32 unk_24; /* 0x28 */ s16 level; - /* 0x2A */ s16 actionFlags; // action flags: 1 = jump on seeing player -} pm_NpcSettings; // size = 0x2C + /* 0x2A */ s16 actionFlags; // action flags: 1 = jump on seeing player +} pm_NpcSettings; // size = 0x2C typedef struct pm_Enemy { /* 0x00 */ s32 flags; From 59e2200fb4834cfa8fd92a1022eb0813ee630d48 Mon Sep 17 00:00:00 2001 From: JCog <42006114+JCog@users.noreply.github.com> Date: Fri, 16 Oct 2026 13:25:40 -0500 Subject: [PATCH 3/3] set dummyNpcSettings level to 100 --- src/fp/warps/bosses.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fp/warps/bosses.c b/src/fp/warps/bosses.c index 80c619c..ef49aad 100644 --- a/src/fp/warps/bosses.c +++ b/src/fp/warps/bosses.c @@ -101,7 +101,7 @@ static BattlePage *pageList[] = {&pageBowser, &pageChapterBosses, &pageJrT pm_Npc bossesDummyNpc = {0}; -static pm_NpcSettings dummyNpcSettings = {.level = 99}; +static pm_NpcSettings dummyNpcSettings = {.level = 100}; static pm_Enemy dummyEnemy = {.npcID = BOSSES_DUMMY_ID, .npcSettings = &dummyNpcSettings}; static pm_Encounter dummyEncounter = {.enemy[0] = &dummyEnemy}; static s8 warpCountdown = 0;