Skip to content

Commit

Permalink
Merge pull request #91 from JCog/battle-warps
Browse files Browse the repository at this point in the history
Instant Boss Warps
  • Loading branch information
JCog authored Sep 25, 2024
2 parents 4ee5367 + 91093b3 commit 7883741
Show file tree
Hide file tree
Showing 9 changed files with 323 additions and 318 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-patches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
xdelta3 -e -S none -s base-jp.z64 fp-jp.z64 fp-jp.xdelta
xdelta3 -e -S none -s base-us.z64 fp-us.z64 fp-us.xdelta
- name: Upload JP patch
uses: actions/upload-artifact@v2.2.4
uses: actions/upload-artifact@v4
with:
name: fp-jp.xdelta
path: fp-jp.xdelta
Expand Down
1 change: 1 addition & 0 deletions genhooks
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ genhook "$sym_update_player_input_rom_hook" "jal $sym_fpUpdateInput;"
genhook "$sym_fire_flower_hook" "nop;"

genhook "$sym_peekaboo_hook" "jal $sym_fpIsAbilityActive;"
genhook "$sym_get_npc_unsafe_hook" "jal $sym_fpGetNpcUnsafe;"

# Remove calls to update backup save in slot 7 to make room for fp settings saves
genhook "$sym_flush_backups_hook_1" "nop;"
Expand Down
12 changes: 9 additions & 3 deletions lib/libpm-jp.a
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ pm_gItemTable = 0x800878B0;
pm_gItemHudScripts = 0x8008A650;
pm_gAreas = 0x800934C0;
pm_viFrames = 0x80093B64;
pm_gEncounterSubState = 0x8009A5B0;
pm_timeFreezeMode = 0x8009A5B8;
pm_gameState = 0x8009A5E0;
pm_gEncounterState = 0x8009A5E0;
pm_gSoundManager = 0x8009A620;
nuGfxCfb_ptr = 0x8009A62C;
pm_masterGfxPos = 0x8009A64C;
Expand All @@ -19,9 +20,9 @@ pm_gCameras = 0x800B1D60;
pm_gEffectInstances = 0x800B4378;
__osEventStateTab = 0x800D9F60;
pm_gCurrentSaveFile = 0x800DACA0;
pm_battleState = 0x800DC048;
pm_gBattleState = 0x800DC048;
pm_gBattleStatus = 0x800DC050;
pm_battleState2 = 0x800DC4BC;
pm_gBattleSubState = 0x800DC4BC;
pm_playerActionsTable = 0x800F7E1C;
pm_popupMenuVar = 0x8010D800;
pm_gPartnerActionStatus = 0x8010ED70;
Expand All @@ -47,6 +48,7 @@ pm_update_camera_zone_interp = 0x80031124;
pm_setCurtainDrawCallback = 0x8002BEC4;
pm_setCurtainFadeGoal = 0x8002BED4;
pm_setGameMode = 0x80033180;
pm_get_npc_unsafe = 0x8003A7AC;
pm_get_npc_safe = 0x8003A808;
pm_au_sfx_reset_players = 0x8004D168;
pm_snd_ambient_stop_all = 0x8005547C;
Expand All @@ -72,12 +74,14 @@ pm_disable_player_input = 0x800E0158;
pm_is_ability_active = 0x800E9CE8;
pm_hidePopupMenu = 0x800F1340;
pm_destroyPopupMenu = 0x800F14C8;
pm_clear_printers = 0x80128884;
pm_set_screen_overlay_alpha = 0x8013D184;
pm_setMapTransitionEffect = 0x8013D350;
pm_updateExitMapScreenOverlay = 0x8013D35C;
pm_clearWindows = 0x8014C4A0;
pm_playSfx = 0x8014ED64;
pm_bgmSetSong = 0x8014F9C8;
pm_bgm_pop_battle_song = 0x8014FF1C;
pm_useIdleAnimation = 0x8026F26C;
pm_gotoMap = 0x802CA400;
pm_saveGame = 0x802DC150;
Expand All @@ -101,5 +105,7 @@ fire_flower_hook = 0x803AD0A0;

peekaboo_hook = 0x801AF3A0;

get_npc_unsafe_hook = 0x8004165C;

flush_backups_hook_1 = 0x8002B064;
flush_backups_hook_2 = 0x8002B074;
12 changes: 9 additions & 3 deletions lib/libpm-us.a
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ pm_gItemTable = 0x800878E0;
pm_gItemHudScripts = 0x8008A680;
pm_gAreas = 0x800934F0;
pm_viFrames = 0x80093B94;
pm_gEncounterSubState = 0x8009A5D0;
pm_timeFreezeMode = 0x8009A5D8;
pm_gameState = 0x8009A600;
pm_gEncounterState = 0x8009A600;
pm_gSoundManager = 0x8009A640;
nuGfxCfb_ptr = 0x8009A64C;
pm_masterGfxPos = 0x8009A66C;
Expand All @@ -19,9 +20,9 @@ pm_gCameras = 0x800B1D80;
pm_gEffectInstances = 0x800B4398;
__osEventStateTab = 0x800D9F80;
pm_gCurrentSaveFile = 0x800DACC0;
pm_battleState = 0x800DC068;
pm_gBattleState = 0x800DC068;
pm_gBattleStatus = 0x800DC070;
pm_battleState2 = 0x800DC4DC;
pm_gBattleSubState = 0x800DC4DC;
pm_playerActionsTable = 0x800F7C8C;
pm_popupMenuVar = 0x8010D640;
pm_gPartnerActionStatus = 0x8010EBB0;
Expand All @@ -47,6 +48,7 @@ pm_setCurtainFadeGoal = 0x8002BF14;
pm_update_cameras = 0x8002D400;
pm_update_camera_zone_interp = 0x80031494;
pm_setGameMode = 0x800334F0;
pm_get_npc_unsafe = 0x8003AAEC;
pm_get_npc_safe = 0x8003AB48;
pm_au_sfx_reset_players = 0x8004D4BC;
pm_snd_ambient_stop_all = 0x800557CC;
Expand All @@ -72,12 +74,14 @@ pm_disable_player_input = 0x800E0178;
pm_is_ability_active = 0x800E9D48;
pm_hidePopupMenu = 0x800F13B0;
pm_destroyPopupMenu = 0x800F1538;
pm_clear_printers = 0x80123674;
pm_set_screen_overlay_alpha = 0x801380D4;
pm_setMapTransitionEffect = 0x801382A0;
pm_updateExitMapScreenOverlay = 0x801382AC;
pm_clearWindows = 0x801473F0;
pm_playSfx = 0x80149CB4;
pm_bgmSetSong = 0x8014A918;
pm_bgm_pop_battle_song = 0x8014AE6C;
pm_useIdleAnimation = 0x8026F0EC;
pm_gotoMap = 0x802CA400;
pm_saveGame = 0x802E11A0;
Expand All @@ -101,5 +105,7 @@ fire_flower_hook = 0x803A4DA0;

peekaboo_hook = 0x801A7110;

get_npc_unsafe_hook = 0x8004199C;

flush_backups_hook_1 = 0x8002B0A4;
flush_backups_hook_2 = 0x8002B0B4;
10 changes: 10 additions & 0 deletions src/fp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "common.h"
#include "fp/practice/timer.h"
#include "fp/practice/trainer.h"
#include "fp/warps/bosses.h"
#include "io/io.h"
#include "sys/crash_screen.h"
#include "sys/input.h"
Expand Down Expand Up @@ -472,6 +473,7 @@ void fpUpdate(void) {
}

fpUpdateWarps();
bossesUpdateWarps();

// Override updateMode so update_cameras switch always defaults
if (fp.freeCam) {
Expand Down Expand Up @@ -579,6 +581,14 @@ HOOK s32 fpIsAbilityActive(s32 ability) {
return pm_is_ability_active(ability);
}

HOOK pm_Npc *fpGetNpcUnsafe(s16 npcId) {
if (npcId == BOSSES_DUMMY_ID) {
bossesDummyNpc.pos = pm_gPlayerStatus.position;
return &bossesDummyNpc;
}
return pm_get_npc_unsafe(npcId);
}

#include <grc.c>
#include <list/list.c>
#include <set/set.c>
Expand Down
14 changes: 7 additions & 7 deletions src/fp/practice/trainer.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,8 @@ static void updateBlockTrainer(void) {
}

// Either goombario or mario attacking
if ((pm_battleState2 == 3 && pm_gPlayerStatus.playerData.currentPartner == PARTNER_GOOMBARIO) ||
pm_battleState2 == 4) {
if ((pm_gBattleSubState == 3 && pm_gPlayerStatus.playerData.currentPartner == PARTNER_GOOMBARIO) ||
pm_gBattleSubState == 4) {
if (pm_gActionCommandStatus.state == 10 && pm_gGameStatus.pressedButtons[0].a) {
acLastAPress = pm_gGameStatus.frameCounter;
} else if (pm_gActionCommandStatus.state == 11) {
Expand All @@ -518,24 +518,24 @@ static void updateBlockTrainer(void) {

static void updateClippyTrainer(void) {
if (settings->trainerClippyEnabled) {
if (pm_gGameStatus.pressedButtons[0].cr && pm_gCurrentEncounter.eFirstStrike != 2) {
if (pm_gameState == 2 && pm_gPartnerActionStatus.partnerActionState == 1) {
if (pm_gGameStatus.pressedButtons[0].cr && pm_gCurrentEncounter.firstStrikeType != 2) {
if (pm_gEncounterState == 2 && pm_gPartnerActionStatus.partnerActionState == 1) {
clippyStatus = CLIPPY_EARLY;
} else if (clippyFramesSinceBattle > 0) {
clippyStatus = CLIPPY_LATE;
} else if (pm_gameState == 3 && clippyFramesSinceBattle == 0) {
} else if (pm_gEncounterState == 3 && clippyFramesSinceBattle == 0) {
clippyStatus = CLIPPY_SUCCESS;
}
}

if (pm_gameState == 3) {
if (pm_gEncounterState == 3) {
clippyFramesSinceBattle++;
switch (clippyStatus) {
case CLIPPY_EARLY: fpLog("early"); break;
case CLIPPY_LATE: fpLog("late"); break;
}
clippyStatus = CLIPPY_NONE;
} else if (pm_gameState != 3) {
} else if (pm_gEncounterState != 3) {
clippyFramesSinceBattle = 0;
}
}
Expand Down
Loading

0 comments on commit 7883741

Please sign in to comment.