diff --git a/data/maps/objects/IndigoPlateauLobby.asm b/data/maps/objects/IndigoPlateauLobby.asm index 9dd054a2..eae9fc66 100644 --- a/data/maps/objects/IndigoPlateauLobby.asm +++ b/data/maps/objects/IndigoPlateauLobby.asm @@ -4,6 +4,7 @@ IndigoPlateauLobby_Object: def_warp_events warp_event 7, 11, LAST_MAP, 1 warp_event 8, 11, LAST_MAP, 2 + ;warp_event 8, 0, HALL_OF_FAME, 1 ; test post-game setup warp_event 8, 0, LORELEIS_ROOM, 1 def_bg_events diff --git a/data/maps/objects/RedsHouse2F.asm b/data/maps/objects/RedsHouse2F.asm index 8ecb2e0d..aa3c0051 100644 --- a/data/maps/objects/RedsHouse2F.asm +++ b/data/maps/objects/RedsHouse2F.asm @@ -4,12 +4,13 @@ RedsHouse2F_Object: def_warp_events warp_event 7, 1, REDS_HOUSE_1F, 3 ;warp_event 5, 1, SILPH_GAUNTLET_7F, 1 ; - Test Chief - ;warp_event 5, 1, SILPH_CO_11F, 1 ; - Test Omega & Giovanni + ;warp_event 5, 1, SILPH_CO_11F, 1 ; - Test J&J, Omega, & Giovanni ;warp_event 5, 1, ROCKET_HIDEOUT_B4F, 2 ; - Test Giovanni 1 ;warp_event 5, 1, MT_MOON_SQUARE, 1 ; - Test Shop, NPCs, and Crater - ;warp_event 5, 1, CELESTE_HILL, 2 ; - Test GMolt + ;warp_event 5, 1, CELESTE_HILL, 1 ; - Test GMolt ;warp_event 5, 1, INDIGO_PLATEAU_LOBBY, 1 ; easy league access warp_event 5, 1, GARNET_CAVERN_B1F, 1 ; Test GCuno + ;warp_event 5, 1, FARAWAY_ISLAND_INSIDE, 1 ; Test Mew def_bg_events diff --git a/scripts/HallOfFame.asm b/scripts/HallOfFame.asm index d89f95ec..c3c32441 100644 --- a/scripts/HallOfFame.asm +++ b/scripts/HallOfFame.asm @@ -96,6 +96,7 @@ HallofFameRoomScript1: ld [wJoyIgnore], a call PostGameSetup + call ResetLegendaryPokemon ld a, $2 ld [wHallOfFameCurScript], a @@ -113,9 +114,8 @@ HallofFameRoomText1: ; It replaces the Cerulean Cave Guard bit, adapting him into the whole ordeal. PostGameSetup: - SetEvent EVENT_POST_GAME_ATTAINED ld hl, ObjectsToHide -.loop1 +.loop1 ; Hides ld a, [hli] cp $ff jr z, .skip @@ -126,16 +126,100 @@ PostGameSetup: jr .loop1 .skip ld hl, ObjectsToShow -.loop2 +.loop2 ; Shows ld a, [hli] cp -1 ret z push hl - ld [wMissableObjectIndex], a - predef ShowObject + call ShowThis pop hl jr .loop2 +; Begin conditional shows for Legendary Pokemon. +; Here, we check if a Pokemon is owned, and if it is, we reset their events. +; It's really suboptimal and I think there is a way to make it better. +ResetLegendaryPokemon: + ld a, DEX_ARTICUNO ; Load dex number + call HoFIsPokemonBitSet ; Is it owned? + jr nz, .skipArticuno ; If owned, skip + ResetEvent EVENT_BEAT_ARTICUNO ; If not, reset the event... + ld a, HS_ARTICUNO + call ShowThis ; And restore the hide/show. +.skipArticuno ; Rinse and repeat. + ld a, DEX_ZAPDOS + call HoFIsPokemonBitSet + jr z, .skipZapdos + ResetEvent EVENT_BEAT_ZAPDOS + ld a, HS_ZAPDOS + call ShowThis +.skipZapdos + ld a, DEX_MOLTRES + call HoFIsPokemonBitSet + jr z, .skipMoltres + ResetEvent EVENT_BEAT_MOLTRES + ld a, HS_MOLTRES + call ShowThis +.skipMoltres + ; Omega is special. + ; If Omega wasn't obtained, it'll be available somewhere else on Silph Co. 11F. + ; Commented out until we actually do this. +; ld a, DEX_OMEGA +; ld [wd11e], a +; call HoFIsPokemonBitSet +; jr nz, .skipOmega +; ResetEvent EVENT_BEAT_OMEGA_2 +; ld a, HS_OMEGA_2 +; call ShowThis +;.skipOmega + ; Mew's hints aren't until the post-game, but is available regardless. + ; So, we put this here. + ld a, DEX_MEW + call HoFIsPokemonBitSet + jr z, .skipMew + ResetEvent EVENT_BEAT_MEW + ld a, HS_MEW + call ShowThis +.skipMew + ; If you haven't cleared the game yet, you've not met the Galarian Birds. + ; So we may as well skip processing all this. + CheckEvent EVENT_POST_GAME_ATTAINED + jp z, .skipGalarianBirdsAndMewtwo + ld a, DEX_ARTICUNO_G + call HoFIsPokemonBitSet + jr z, .skipArticunoG + ResetEvent EVENT_BEAT_ARTICUNO_G + ld a, HS_GARNET_ARTICUNO_G + call ShowThis +.skipArticunoG + ld a, DEX_ZAPDOS_G + call HoFIsPokemonBitSet + jr z, .skipZapdosG + ResetEvent EVENT_BEAT_ZAPDOSG + ld a, HS_BRUNSWICK_ZAPDOS_G_2 + call ShowThis +.skipZapdosG + ld a, DEX_MOLTRES_G + call HoFIsPokemonBitSet + jr z, .skipMoltresG + ResetEvent EVENT_BEAT_GALARIAN_MOLTRES + ld a, HS_MOLTRES_G + call ShowThis +.skipMoltresG + ld a, DEX_MEWTWO + call HoFIsPokemonBitSet + jr z, .skipGalarianBirdsAndMewtwo + ResetEvent EVENT_BEAT_MEWTWO + ld a, HS_MEWTWO + call ShowThis +.skipGalarianBirdsAndMewtwo + ; We set this last to save on processing earlier in the script. + SetEvent EVENT_POST_GAME_ATTAINED + ret + +ShowThis: + ld [wMissableObjectIndex], a + predef ShowObject + ObjectsToShow: db HS_ROUTE_1_OAK ; Oak post-game fight db -1 ; end @@ -146,3 +230,26 @@ ObjectsToHide: db HS_MT_MOON_CRATER_GUARD ; Mt. Moon Crater access db HS_CERULEAN_CAVE_GUY ; Cerulean Cave access db -1 ; end + +; Farcalling this caused weird issues so I'm just using a clone +; This is a function used in engine/menus/pokedex.asm to check if a Pokemon is in the dex. +; We use this to reset Legendary Pokemon after the Elite Four. +; It does have the optimisation of loading wPokedexOwned for processing, anyway. +; tests if a pokemon's bit is set in the seen or owned pokemon bit fields +; INPUT: +; [wd11e] = pokedex number +; hl = address of bit field +; OUTPUT: +; 0 = Not Owned +; 1 = Owned +HoFIsPokemonBitSet: + ld [wd11e], a + ld hl, wPokedexOwned + ld a, [wd11e] + dec a + ld c, a + ld b, FLAG_TEST + predef FlagActionPredef + ld a, c + and a + ret