Small polishing of the previous commit + Item Sorting

- Fixes a few bugs from the last commit, namely:
     - The guy who gives you the Pocket Lapras having bugged text
     - Being able to use it where you shouldn't (Cycling Road, Seafoam before the boulder puzzle)
     - Pocket Lapras not having an item description

- As well as this, automatic item sorting has been added. Just press Start in the bag menu and all your items will get assorted into a convenient list.

- Changed a few item descriptions since some of them didn't terminate properly

- Freed up some space in the Home bank
This commit is contained in:
Martha Schilling 2024-05-14 21:17:36 +01:00
parent dd7130c489
commit 2c02483f01
15 changed files with 379 additions and 66 deletions

View file

@ -13,7 +13,7 @@
const POKE_BALL ; $04
const TOWN_MAP ; $05
const BICYCLE ; $06
const SURFBOARD ; $07 buggy?
const POCKET_LAPRAS ; $07
const SAFARI_BALL ; $08
const POKEDEX ; $09
const MOON_STONE ; $0A

View file

@ -6,7 +6,7 @@ KeyItemFlags:
dbit FALSE ; POKE_BALL
dbit TRUE ; TOWN_MAP
dbit TRUE ; BICYCLE
dbit TRUE ; LAPRAS' BALL - SURFBOARD
dbit TRUE ; POCKET_LAPRAS
dbit FALSE ; SAFARI_BALL
dbit TRUE ; POKEDEX
dbit FALSE ; MOON_STONE

View file

@ -6,7 +6,7 @@ ItemNames::
li "POKé BALL"
li "TOWN MAP"
li "BICYCLE"
li "LAPRAS' BALL" ; surfboard, ?????, etc.
li "LAPRAS' BALL" ; Pocket Lapras
li "SAFARI BALL"
li "POKéDEX"
li "MOON STONE"

View file

@ -6,7 +6,7 @@ ItemPrices::
bcd3 200 ; POKE_BALL
bcd3 0 ; TOWN_MAP
bcd3 0 ; BICYCLE
bcd3 0 ; SURFBOARD
bcd3 0 ; POCKET_LAPRAS
bcd3 1000 ; SAFARI_BALL
bcd3 0 ; POKEDEX
bcd3 0 ; MOON_STONE

View file

@ -12,8 +12,8 @@ _UltraBallDescription::
prompt
_GreatBallDescription::
text "A BALL with a de-"
next "cent success rate."
text "A BALL with a good"
next "success rate."
prompt
_PokeBallDescription::
@ -31,6 +31,11 @@ _BicycleDescription::
next "for travel."
prompt
_PocketLaprasDescription::
text "A LAPRAS that lets"
next "you cross water."
prompt
_SafariBallDescription::
text "Just an ULTRA BALL"
next "painted green."
@ -110,7 +115,7 @@ _EscapeRopeDescription::
_RepelDescription::
text "Repels weak #-"
next "MON for 100 steps."
next "MON. (100 steps)"
prompt
_OldAmberDescription::
@ -205,18 +210,18 @@ _MaxReviveDescription::
prompt
_GuardSpecDescription::
text "Prevents stats"
next "reduction. (1 BTL)"
text "Prevents stat re-"
next "duction. (1 BTL)"
prompt
_SuperRepelDescription::
text "Repels weak #-"
next "MON for 200 steps."
next "MON. (200 steps)"
prompt
_MaxRepelDescription::
text "Repels weak #-"
next "MON for 250 steps."
next "MON. (250 steps)"
prompt
_DireHitDescription::
@ -281,7 +286,7 @@ _OaksParcelDescription::
_ItemfinderDescription::
text "Checks for unseen"
next "items in the area."
next "items nearby."
prompt
_SilphScopeDescription::
@ -340,8 +345,8 @@ _ElixerDescription::
prompt
_MaxElixerDescription::
text "Fully restores the"
next "PP of one #MON."
text "Fully restores PP"
next "of all moves."
prompt
_CitrinePassDescription::
@ -380,13 +385,13 @@ _HM02Description::
prompt
_HM03Description::
text "A strong water-"
text "A strong WATER-"
next "type attack."
prompt
_HM04Description::
text "A powerful physi-"
next "cal attack."
text "A strong physical"
next "attack."
prompt
_HM05Description::
@ -420,12 +425,12 @@ _TM05Description::
prompt
_TM06Description::
text "A poison move with"
next "increasing damage."
text "A POISON move with"
next "rising damage."
prompt
_TM07Description::
text "A one-hit KO,"
text "A one-hit KO"
next "drill attack."
prompt
@ -475,8 +480,8 @@ _TM16Description::
prompt
_TM17Description::
text "An attack that al-"
next "so hurts the user."
text "A move that also"
next "hurts the user."
prompt
_TM18Description::
@ -520,13 +525,13 @@ _TM25Description::
prompt
_TM26Description::
text "Tough but useless"
next "vs. flying foes."
text "Tough, but useless"
next "vs. FLYING foes."
prompt
_TM27Description::
text "A GROUND-type,"
next "one-hit KO attack."
text "A one-hit KO"
next "GROUND attack."
prompt
_TM28Description::
@ -595,8 +600,8 @@ _TM40Description::
prompt
_TM41Description::
text "Restores HP by 1/2"
next "the user's max HP."
text "Restores 1/2 the"
next "user's max HP."
prompt
_TM42Description::
@ -615,8 +620,8 @@ _TM44Description::
prompt
_TM45Description::
text "A move that may"
next "cause paralysis."
text "A move that will"
next "paralyze a foe."
prompt
_TM46Description::
@ -640,8 +645,8 @@ _TM49Description::
prompt
_TM50Description::
text "Makes a decoy with"
next "1/4 user's max HP."
text "Uses 1/4 max HP"
next "to make a decoy."
prompt
_UnusedItemDescription::

View file

@ -233,3 +233,18 @@ ENDC
line "your friend and"
cont "come again!"
done
_SortItemsText::
text "Would you like to"
next "sort items?"
done
_SortComplete::
text "Sorting is"
next "complete!"
prompt
_NothingToSort::
text "There are no items"
next "to sort."
prompt

View file

@ -23,7 +23,7 @@ ItemUsePtrTable:
dw ItemUseBall ; POKE_BALL
dw ItemUseTownMap ; TOWN_MAP
dw ItemUseBicycle ; BICYCLE
dw ItemUseSurfboard ; out-of-battle Surf effect
dw ItemUseLapras ; POCKET_LAPRAS
dw ItemUseBall ; SAFARI_BALL
dw ItemUsePokedex ; POKEDEX
dw ItemUseEvoStone ; MOON_STONE
@ -759,12 +759,17 @@ ItemUseBicycle:
jp PrintText
; used for Surf out-of-battle effect
ItemUseSurfboard:
ItemUseLapras:
ld a, [wWalkBikeSurfState]
ld [wWalkBikeSurfStateCopy], a
cp 2 ; is the player already surfing?
jr z, .tryToStopSurfing
.tryToSurf
farcall IsSurfingAllowed
ld hl, wd728
bit 1, [hl]
res 1, [hl]
jp z, .no
call IsNextTileShoreOrWater
jp c, SurfingAttemptFailed
ld hl, TilePairCollisionsWater
@ -837,6 +842,10 @@ ItemUseSurfboard:
inc a
ld [wSimulatedJoypadStatesIndex], a
ret
.no
ld a, 1
and a
ret
SurfingGotOnText:
text_far _SurfingGotOnText

View file

@ -26,7 +26,7 @@ ItemDescriptionPointers:
text_end
text_far _BicycleDescription
text_end
text_far _UnusedItemDescription
text_far _PocketLaprasDescription
text_end
text_far _SafariBallDescription
text_end

View file

@ -165,7 +165,7 @@ StartMenu_Pokemon::
bit 1, [hl]
res 1, [hl]
jp z, .loop
ld a, SURFBOARD
ld a, POCKET_LAPRAS
ld [wcf91], a
ld [wPseudoItemID], a
call UseItem
@ -331,6 +331,7 @@ StartMenu_Item::
ld a, [wBagSavedMenuItem]
ld [wCurrentMenuItem], a
call DisplayListMenuID
jp nz, .sortItems
ld a, [wCurrentMenuItem]
ld [wBagSavedMenuItem], a
jr nc, .choseItem
@ -451,6 +452,9 @@ StartMenu_Item::
.infoItem
farcall DisplayItemDescription
jp ItemMenuLoop
.sortItems
farcall SortItems
jp ItemMenuLoop
CannotUseItemsHereText:
text_far _CannotUseItemsHereText

View file

@ -147,3 +147,264 @@ HandleItemListSwapping::
pop de
pop hl
jp DisplayListMenuIDLoop
SortItems::
push hl
push bc
ld hl, SortItemsText ; Display the text to ask to sort
call PrintText
call YesNoChoice
ld a, [wCurrentMenuItem]
and a
jp z, .beginSorting ; If yes
jr .done
.finishedSwapping
ld a, [hSwapTemp] ; If not 0, then a swap of items did occur
cp 0
jr z, .nothingSorted
ld hl, SortComplete
jr .printResultText
.nothingSorted
ld hl, NothingToSort
.printResultText
call PrintText
.done
xor a ; Zeroes a
pop bc
pop hl
ret
.beginSorting
xor a
ld [hSwapTemp], a ; 1 if something in the bag got sorted
ld de, 0
ld hl, ItemSortList
ld b, [hl] ; This is the first item to check for
ld hl, wBagItems
ld c, 0 ; Relative to wBagItems, this is where we'd like to begin swapping
.loopCurrItemInBag
ld a, [hl] ; Load the value of hl to a (which is an item number) and Increments to the quantity
cp -1 ; See if the item number is $ff, which is 'cancel'
jr z, .findNextItem ; If it is cancel, then move onto the next item
cp b
jr z, .hasItem ; If it's not b, then go to the next item in the bag
inc hl ; increments past the quantity to the next item to check
inc hl
jr .loopCurrItemInBag
.findNextItem
ld d, 0
inc e
ld hl, ItemSortList
add hl, de
ld b, [hl]
ld hl, wBagItems ; Resets hl to start at the beginning of the bag
ld a, b
cp -1 ; Check if we got through all of the items, to the last one
jr z, .finishedSwapping
jr .loopCurrItemInBag
.hasItem ; c contains where to swap to relative to the start of wBagItems
; hl contains where the item to swap is absolute.
; b contains the item ID
push de
ld d, h
ld e, l
ld hl, wBagItems
ld a, b
ld b, 0
add hl, bc ; hl now holds where we'd like to swap to
ld b, a
ld a, [de]
cp [hl]
jr z, .cont ; If they're the same item
ld a, 1
ld [hSwapTemp], a
ld a, [hl]
ld [hSwapItemID],a ; [hSwapItemID] = second item ID
inc hl
ld a,[hld]
ld [hSwapItemQuantity],a ; [hSwapItemQuantity] = second item quantity
ld a,[de]
ld [hli],a ; put first item ID in second item slot
inc de
ld a,[de]
ld [hl],a ; put first item quantity in second item slot
ld a,[hSwapItemQuantity]
ld [de],a ; put second item quantity in first item slot
dec de
ld a,[hSwapItemID]
ld [de],a ; put second item ID in first item slot
.cont
inc c
inc c
ld h, d
ld l, e
pop de
jr .findNextItem
SortItemsText::
text_far _SortItemsText
db "@"
SortComplete::
text_far _SortComplete
db "@"
NothingToSort::
text_far _NothingToSort
db "@"
ItemSortList::
; Used Key Items
db BICYCLE
db SUPER_ROD
db POCKET_LAPRAS
db ITEMFINDER
db TOWN_MAP
db MYSTERY_BOX
; Balls
db POKE_BALL
db GREAT_BALL
db ULTRA_BALL
db SAFARI_BALL
db MASTER_BALL
; Common Items
db REPEL
db SUPER_REPEL
db MAX_REPEL
db ESCAPE_ROPE
db POKE_DOLL
; Health
db POTION
db SUPER_POTION
db HYPER_POTION
db MAX_POTION
db FULL_RESTORE
db FRESH_WATER
db SODA_POP
db LEMONADE
; Revival
db REVIVE
db MAX_REVIVE
; Status
db ANTIDOTE
db BURN_HEAL
db ICE_HEAL
db AWAKENING
db PARLYZ_HEAL
db FULL_HEAL
db POKE_FLUTE
; PP
db ETHER
db MAX_ETHER
db ELIXER
db MAX_ELIXER
; Battle Raises
db X_ACCURACY
db X_ATTACK
db X_DEFEND
db X_SPEED
db X_SPECIAL
db GUARD_SPEC
db DIRE_HIT
; Permanent Raises
db RARE_CANDY
db HP_UP
db PROTEIN
db IRON
db CARBOS
db CALCIUM
db PP_UP
; Evolution Items
db LEAF_STONE
db FIRE_STONE
db THUNDER_STONE
db WATER_STONE
db MOON_STONE
db HEART_STONE
db POISON_STONE
db ICE_STONE
db METAL_COAT
db UP_GRADE
db DUBIOUS_DISC
db BLK_AUGURITE
db PROTECTOR
db CANDY_JAR
; Other Non-Key Items
db DOME_FOSSIL
db HELIX_FOSSIL
db WING_FOSSIL
db OLD_AMBER
db NUGGET
db BOTTLE_CAP
; Key Items With No Use
db COIN_CASE
db SILPHLETTER
db S_S_TICKET
db OLD_SEA_MAP
db CITRINE_PASS
db SECRET_KEY
db BIKE_VOUCHER
db CARD_KEY
db GOLD_TEETH
db OAKS_PARCEL
db LIFT_KEY
db SILPH_SCOPE
db TEA
db EXP_ALL
; TMs
db TM01
db TM01 + 1
db TM01 + 2
db TM01 + 3
db TM01 + 4
db TM01 + 5
db TM01 + 6
db TM01 + 7
db TM01 + 8
db TM01 + 9
db TM01 + 10
db TM01 + 11
db TM01 + 12
db TM01 + 13
db TM01 + 14
db TM01 + 15
db TM01 + 16
db TM01 + 17
db TM01 + 18
db TM01 + 19
db TM01 + 20
db TM01 + 21
db TM01 + 22
db TM01 + 23
db TM01 + 24
db TM01 + 25
db TM01 + 26
db TM01 + 27
db TM01 + 28
db TM01 + 29
db TM01 + 30
db TM01 + 31
db TM01 + 32
db TM01 + 33
db TM01 + 34
db TM01 + 35
db TM01 + 36
db TM01 + 37
db TM01 + 38
db TM01 + 39
db TM01 + 40
db TM01 + 41
db TM01 + 42
db TM01 + 43
db TM01 + 44
db TM01 + 45
db TM01 + 46
db TM01 + 47
db TM01 + 48
db TM01 + 49
; HMs
db HM01
db HM01 + 1
db HM01 + 2
db HM01 + 3
db HM01 + 4
db -1 ; end

View file

@ -33,7 +33,7 @@ TrySurf:
and a
jr nz, .no2
call GetPartyMonName2
ld a, SURFBOARD
ld a, POCKET_LAPRAS
ld [wcf91], a
ld [wPseudoItemID], a
call UseItem

View file

@ -1,7 +1,8 @@
; rst vectors (unused)
SECTION "rst0", ROM0[$0000]
rst $38
_Bankswitch::
jp Bankswitch
ds $08 - @, 0 ; unused

View file

@ -50,7 +50,7 @@ DisplayListMenuID::
ld [wTopMenuItemY], a
ld a, 5
ld [wTopMenuItemX], a
ld a, A_BUTTON | B_BUTTON | SELECT
ld a, A_BUTTON | B_BUTTON | SELECT | START
ld [wMenuWatchedKeys], a
ld c, 10
call DelayFrames
@ -178,6 +178,8 @@ DisplayListMenuIDLoop::
jp nz, ExitListMenu ; if so, exit the menu
bit BIT_SELECT, a
jp nz, HandleItemListSwapping ; if so, allow the player to swap menu entries
bit 3, a ; was the start button pressed?
jp nz, .sortItems ; if so, allow the player to swap menu entries
ld b, a
bit BIT_D_DOWN, b
ld hl, wListScrollOffset
@ -197,6 +199,10 @@ DisplayListMenuIDLoop::
jp z, DisplayListMenuIDLoop
dec [hl]
jp DisplayListMenuIDLoop
.sortItems
rra ; Sets the zero flag to 0 so the sorting function will happen
rla
jp BankswitchBack
DisplayChooseQuantityMenu::
; text box dimensions/coordinates for just quantity

View file

@ -1,13 +1,13 @@
MACRO farcall
ld b, BANK(\1)
ld hl, \1
call Bankswitch
rst _Bankswitch
ENDM
MACRO callfar
ld hl, \1
ld b, BANK(\1)
call Bankswitch
rst _Bankswitch
ENDM
MACRO farjp

View file

@ -87,34 +87,42 @@ CinnabarIslandText7:
_CinnabarPocketLapras1:
text "Bah, this LAPRAS"
line "just doesn't"
cont "wanna fight! Can"
cont "you believe that?"
line "just doesn't want"
cont "to fight! Can you"
cont "believe that?"
para "All it does is"
line "SURF. My GYARADOS"
cont "can do that!"
para "All it likes to"
line "do is SURF, but"
cont "my GYARADOS can"
cont "already do that!"
para "Here. Take it."
line "I can't stand"
cont "looking at its"
cont "big ol' eyes."
done
para "Here, take it. I"
line "can't stand its"
cont "big ol' eyes"
cont "looking at me."
prompt
_PocketLaprasNoRoomText:
text "You don't have"
line "room either?"
line "room, either?"
para "Well, it's not"
line "going anywhere..."
line "like it's going"
cont "anywhere..."
done
_ReceivedPocketLaprasText:
text "Take care of that"
line "LAPRAS though,"
cont "yeah? They're"
cont "an endangered"
cont "species."
text "<PLAYER> received"
line "@"
text_ram wStringBuffer
text "!@"
text_end
_CinnabarPocketLapras2:
text "Take care of it"
line "though, alright?"
cont "LAPRAS is very"
cont "endangered."
para "You should stay"
line "safe, too." ; haha, llinos, you sly dog
@ -124,6 +132,10 @@ _ReceivedPocketLaprasText:
CinnabarPocketLapras1:
text_far _CinnabarPocketLapras1
text_end
CinnabarPocketLapras2:
text_far _CinnabarPocketLapras2
text_end
PocketLaprasNoRoomText:
text_far _PocketLaprasNoRoomText
@ -139,21 +151,21 @@ CinnabarPocketLapras:
jr nz, .skip
ld hl, CinnabarPocketLapras1
call PrintText
call TheAutoskipStopinator ; it's been a while but i didnt forget how annoying this was
lb bc, SURFBOARD, 1
lb bc, POCKET_LAPRAS, 1
call GiveItem
jr nc, .bag_full
SetEvent EVENT_GOT_POCKET_LAPRAS ; if you get here, it's done. Using this to load all three texts with one PrintText instruction
sound_get_key_item
ld hl, ReceivedPocketLaprasText
call PrintText
ld a, SFX_GET_KEY_ITEM
call PlaySound
SetEvent EVENT_GOT_POCKET_LAPRAS ; if you get here, it's done.
jr .end
.bag_full
ld hl, PocketLaprasNoRoomText
jr .end
.skip
ld hl, ReceivedPocketLaprasText
ld hl, CinnabarPocketLapras2
call PrintText
; fallthrough
.end
call PrintText
call TheAutoskipStopinator
jp TextScriptEnd