kep-hack/engine/overworld/ferry_script.asm
Martha Schilling 508a4e790e The Big One.
Whoa, this one's been in the making for a while now. This one has been my attempt to fix as much as I could within a little over a month. Here's what I've got for you.

- Fixed a bug in Silph Gauntlet where the trainers would not see you unless you spoke to them

- Removed the unnecessary Gawarhed and Wugtrio static encounters. In what was once Gawarhed's place is a Rare Candy.

- Implemented a working ferry system (huge thanks to Red++) that allows travelling to Faraway Island and Citrine City with the right tickets. Currently both maps use a copy of the SS Anne, which may be revised later.

- Bittybat, Magnetite and Burgela have been removed to fix a Pokedex bug where entries wouldn't display correctly if the total number wasn't a multiple of 8.

- Fixed a bug where fishing up a Wiglett and Wugtrio would play the trainer battle and Champion battle themes respectively

- Restructured the Pokedex a little. Don't worry, Lickitung's still number 108!

- All references to betamon in the disassembly have had their names updated to match the new Ogasawara ones

- Removed Blastyke as a Game Corner prize, replacing it with Squeamata.

- Garnet Cavern is now properly listed as a dungeon map

- Fixed an issue where trying to leave Bill's House after entering the garden would put you back in the garden

- Moved Silph Gauntlet's Beauty down 1 floor to make the number of trainers on each floor more consistent

- Finished Gauntlet 6F except for the trainer text (PvK please help)

- Gavillain's stats updated to match KEP 1.4 on the Showdown server. It's now a Dragon/Electric type with less Ice coverage.

- Fixed Clefable's and Wigglytuff's starting movesets from an earlier commit

- Fixed an ABSOLUTELY HORRIBLE, EGREGIOUSLY FRUSTRATING BUG that caused the Pokedex's seen counter to rarely update. This is what caused this commit to be delayed for so long. No joke.

- New sprites, courtesy of Albatross, for Sylveon's back sprite, Alolan Marowak, Alolan Muk, Galarian Weezing and Magnezone!

- Fixed a bug preventing the trade for Haunter from being accessed.
2023-09-19 23:34:25 +01:00

231 lines
3.9 KiB
NASM

; New script for Red++
; Based on a combination of Fossil Lab and Elevator Menus
; Allows travel to any Event Island based on which tickets the player has in the pack
EventIslandsFerryScript::
ld hl, WelcomeToSeagallopText
call PrintText
call GetFerryTickets
ld a, [wFilteredBagItemsCount]
and a
jr z, .noTicket
call DoIslandMenu
ret
.noTicket
call ManualTextScroll
ld hl,NoTicketText
call PrintText
ret
GetFerryTickets:
; generate a list in wram of all Event Items the player has
xor a
ld [wFilteredBagItemsCount], a
ld de, wFilteredBagItems
ld hl, TicketList
.loop
ld a, [hli]
and a
jr z, .done
push hl
push de
ld [wd11e], a
ld b, a
predef GetQuantityOfItemInBag
pop de
pop hl
ld a, b
and a
jr z, .loop
; A ticket's in the bag
ld a, [wd11e]
ld [de], a
inc de
push hl
ld hl, wFilteredBagItemsCount
inc [hl]
pop hl
jr .loop
.done
ld hl, wFilteredBagItemsCount
ld a, [hl]
and a
jr z, .endList ; if no items are in the pack, don't add "Go Home" option
; add Vermilion to the list if there is one, to get back home
ld a, FLOOR_11F
ld [de],a
inc de
inc [hl] ; increase item count so GO HOME shows up
.endList
ld a, $ff ; End of list
ld [de], a
ret
TicketList:
db OLD_SEA_MAP
db CITRINE_PASS
db $00
PrintTicketsInBag:
; Print the list of names inside the menu box we drew
ld hl, wFilteredBagItems
xor a
ld [$ffdb], a
.loop
ld a, [hli]
cp $ff
ret z
push hl
ld [wd11e], a
call GetItemName
coord hl, 2, 2
ld a, [$ffdb]
ld bc, $28
call AddNTimes
ld de, wcd6d
call PlaceString
ld hl, $ffdb
inc [hl]
pop hl
jr .loop
DoIslandMenu:
; Display the menu we generated earlier, let the player choose an item to use,
; then do the elevator thing and update the warps accordingly
ld hl, wd730
set 6, [hl]
xor a
ld [wCurrentMenuItem], a
ld a, $3 ; A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
ld a, [wFilteredBagItemsCount]
dec a
ld [wMaxMenuItem], a
ld a, 2
ld [wTopMenuItemY], a
ld a, 1
ld [wTopMenuItemX], a
ld a, [wFilteredBagItemsCount]
dec a
ld bc, 2
ld hl, 3
call AddNTimes
dec l
ld b, l
ld c, $d
ld hl, wTileMap
call TextBoxBorder
call UpdateSprites
call PrintTicketsInBag
ld hl, wd730
res 6, [hl]
call HandleMenuInput
bit 1, a ; Pressed B?
jr nz, .cancelledChoosingTicket
ld hl, wFilteredBagItems
ld a, [wCurrentMenuItem]
ld d, 0
ld e, a
add hl, de
ld a, [hl]
ld [$ffdb], a
cp OLD_SEA_MAP
jr z, .choseFarawayIsland
cp CITRINE_PASS
jr z, .choseCitrineCity
;choseVermilion
ld b, 1
ld c, VERMILION_FERRY_DOCK
jr .islandSelected
.choseFarawayIsland
ld b, 0
ld c, FARAWAY_ISLAND_OUTSIDE
jr .islandSelected
.choseCitrineCity
ld b, 1
ld c, CITRINE_FERRY_DOCK
jr .islandSelected
.islandSelected
; First, see if we need to update the warps
ld a, [wWarpEntries + 3] ; Map ID of first warp
cp c ; see if we're already at the place we tried to go
jr z, .alreadyThere
; Hold onto the warp entry we selected
push bc
; Mark for it to do the shake animation
ld hl, wCurrentMapScriptFlags
set 7, [hl]
; Announce that we are leaving
ld hl, AllAboardText
call PrintText
; Update the warp entries to match the ones for that island
pop bc ; get the warp IDs back
ld hl, wWarpEntries
call .doWarpStuff
; This is called once to update the first warp, then it falls through to run again and update the second warp
.doWarpStuff
inc hl
inc hl
ld a, b
ld [hli], a
ld a, c
ld [hli], a
ret
.cancelledChoosingTicket
ld hl, GoingNowhereText
call PrintText
ret
.alreadyThere
ld hl, AlreadyThereText
call PrintText
ret
WelcomeToSeagallopText:
text "Welcome aboard"
line "the SEAGALLOP"
cont "FERRY!"
para "Do you have a"
line "ticket to travel"
cont "with us today?@@"
NoTicketText:
text "No? That's too"
line "bad."
para "Come back and see"
line "us later."
prompt
db "@"
GoingNowhereText:
text "Come back and see"
line "us later."
prompt
db "@"
AllAboardText:
text "All aboard!"
prompt
db "@"
AlreadyThereText:
text "We're already"
line "there!"
prompt
db "@"