Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <string.h>

FpCtxt fp = {.savedArea = 0x1c,
.enemyContactOverride = -1,
.camDistMin = 100,
.camDistMax = 1000,
.freeCamMoveSpeed = 250,
Expand Down Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions src/fp.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ typedef struct {
bool turbo;
bool warp;
u8 warpDelay;
s8 enemyContactOverride;
char *lastImportedSavePath;
bool freeCam;
bool lockCam;
Expand Down
9 changes: 7 additions & 2 deletions src/fp/warps/bosses.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "bosses.h"
#include "common.h"
#include "fp.h"
#include "menu/menu.h"
#include <stdlib.h>

Expand Down Expand Up @@ -100,7 +101,8 @@ static BattlePage *pageList[] = {&pageBowser, &pageChapterBosses, &pageJrT

pm_Npc bossesDummyNpc = {0};

static pm_Enemy dummyEnemy = {.npcID = BOSSES_DUMMY_ID};
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;
static bool leavingBattle = FALSE;
Expand Down Expand Up @@ -137,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
Expand Down Expand Up @@ -168,6 +170,9 @@ void bossesUpdateWarps() {
}
} else if (warpCountdown > 0) {
warpCountdown--;
if (warpCountdown == 0) {
fp.enemyContactOverride = -1;
}
}
}

Expand Down
18 changes: 17 additions & 1 deletion src/pm64.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Loading