mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Identify SwitchItemsInBag labels
Thanks to FIQ for having done so in Polished Crystal
This commit is contained in:
parent
7b12060e6a
commit
93dcc8b6eb
@ -2532,10 +2532,10 @@ DittoMetalPowder:
|
|||||||
ldh a, [hBattleTurn]
|
ldh a, [hBattleTurn]
|
||||||
and a
|
and a
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
jr nz, .Ditto
|
jr nz, .got_species
|
||||||
ld a, [wTempEnemyMonSpecies]
|
ld a, [wTempEnemyMonSpecies]
|
||||||
|
|
||||||
.Ditto:
|
.got_species
|
||||||
cp DITTO
|
cp DITTO
|
||||||
ret nz
|
ret nz
|
||||||
|
|
||||||
|
@ -1103,7 +1103,7 @@ TutorialPack:
|
|||||||
.ItemsMenuData:
|
.ItemsMenuData:
|
||||||
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
|
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
|
||||||
db 5, 8 ; rows, columns
|
db 5, 8 ; rows, columns
|
||||||
db 2 ; horizontal spacing
|
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
|
||||||
dbw 0, wDudeNumItems
|
dbw 0, wDudeNumItems
|
||||||
dba PlaceMenuItemName
|
dba PlaceMenuItemName
|
||||||
dba PlaceMenuItemQuantity
|
dba PlaceMenuItemQuantity
|
||||||
@ -1123,7 +1123,7 @@ TutorialPack:
|
|||||||
.KeyItemsMenuData:
|
.KeyItemsMenuData:
|
||||||
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
|
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
|
||||||
db 5, 8 ; rows, columns
|
db 5, 8 ; rows, columns
|
||||||
db 1 ; horizontal spacing
|
db SCROLLINGMENU_ITEMS_NORMAL ; item format
|
||||||
dbw 0, wDudeNumKeyItems
|
dbw 0, wDudeNumKeyItems
|
||||||
dba PlaceMenuItemName
|
dba PlaceMenuItemName
|
||||||
dba PlaceMenuItemQuantity
|
dba PlaceMenuItemQuantity
|
||||||
@ -1152,7 +1152,7 @@ TutorialPack:
|
|||||||
.BallsMenuData:
|
.BallsMenuData:
|
||||||
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
|
db STATICMENU_ENABLE_SELECT | STATICMENU_ENABLE_LEFT_RIGHT | STATICMENU_ENABLE_START | STATICMENU_WRAP | STATICMENU_CURSOR ; flags
|
||||||
db 5, 8 ; rows, columns
|
db 5, 8 ; rows, columns
|
||||||
db 2 ; horizontal spacing
|
db SCROLLINGMENU_ITEMS_QUANTITY ; item format
|
||||||
dbw 0, wDudeNumBalls
|
dbw 0, wDudeNumBalls
|
||||||
dba PlaceMenuItemName
|
dba PlaceMenuItemName
|
||||||
dba PlaceMenuItemQuantity
|
dba PlaceMenuItemQuantity
|
||||||
|
@ -15,76 +15,76 @@ SwitchItemsInBag:
|
|||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
dec a
|
dec a
|
||||||
ld [wSwitchItem], a
|
ld [wSwitchItem], a
|
||||||
call Function249a7
|
call .try_combining_stacks
|
||||||
jp c, Function249d1
|
jp c, .combine_stacks
|
||||||
ld a, [wScrollingMenuCursorPosition]
|
ld a, [wScrollingMenuCursorPosition]
|
||||||
ld c, a
|
ld c, a
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
cp c
|
cp c
|
||||||
jr c, .asm_2497a
|
jr c, .above
|
||||||
jr .asm_2494a
|
jr .below
|
||||||
|
|
||||||
.init
|
.init:
|
||||||
ld a, [wScrollingMenuCursorPosition]
|
ld a, [wScrollingMenuCursorPosition]
|
||||||
inc a
|
inc a
|
||||||
ld [wSwitchItem], a
|
ld [wSwitchItem], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.trivial
|
.trivial:
|
||||||
xor a
|
xor a
|
||||||
ld [wSwitchItem], a
|
ld [wSwitchItem], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.asm_2494a
|
.below:
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
call Function24a40
|
call ItemSwitch_CopyItemToBuffer
|
||||||
ld a, [wScrollingMenuCursorPosition]
|
ld a, [wScrollingMenuCursorPosition]
|
||||||
ld d, a
|
ld d, a
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
ld e, a
|
ld e, a
|
||||||
call Function24a6c
|
call ItemSwitch_GetItemOffset
|
||||||
push bc
|
push bc
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
call ItemSwitch_GetNthItem
|
call ItemSwitch_GetNthItem
|
||||||
dec hl
|
dec hl
|
||||||
push hl
|
push hl
|
||||||
call ItemSwitch_ConvertItemFormatToDW
|
call ItemSwitch_GetItemFormatSize
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld d, h
|
ld d, h
|
||||||
ld e, l
|
ld e, l
|
||||||
pop hl
|
pop hl
|
||||||
pop bc
|
pop bc
|
||||||
call Function24aab
|
call ItemSwitch_BackwardsCopyBytes
|
||||||
ld a, [wScrollingMenuCursorPosition]
|
ld a, [wScrollingMenuCursorPosition]
|
||||||
call Function24a4d
|
call ItemSwitch_CopyBufferToItem
|
||||||
xor a
|
xor a
|
||||||
ld [wSwitchItem], a
|
ld [wSwitchItem], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.asm_2497a
|
.above:
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
call Function24a40
|
call ItemSwitch_CopyItemToBuffer
|
||||||
ld a, [wScrollingMenuCursorPosition]
|
ld a, [wScrollingMenuCursorPosition]
|
||||||
ld d, a
|
ld d, a
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
ld e, a
|
ld e, a
|
||||||
call Function24a6c
|
call ItemSwitch_GetItemOffset
|
||||||
push bc
|
push bc
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
call ItemSwitch_GetNthItem
|
call ItemSwitch_GetNthItem
|
||||||
ld d, h
|
ld d, h
|
||||||
ld e, l
|
ld e, l
|
||||||
call ItemSwitch_ConvertItemFormatToDW
|
call ItemSwitch_GetItemFormatSize
|
||||||
add hl, bc
|
add hl, bc
|
||||||
pop bc
|
pop bc
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
ld a, [wScrollingMenuCursorPosition]
|
ld a, [wScrollingMenuCursorPosition]
|
||||||
call Function24a4d
|
call ItemSwitch_CopyBufferToItem
|
||||||
xor a
|
xor a
|
||||||
ld [wSwitchItem], a
|
ld [wSwitchItem], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Function249a7:
|
.try_combining_stacks:
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
call ItemSwitch_GetNthItem
|
call ItemSwitch_GetNthItem
|
||||||
ld d, h
|
ld d, h
|
||||||
@ -93,24 +93,23 @@ Function249a7:
|
|||||||
call ItemSwitch_GetNthItem
|
call ItemSwitch_GetNthItem
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr nz, .asm_249cd
|
jr nz, .no_combine
|
||||||
ld a, [wScrollingMenuCursorPosition]
|
ld a, [wScrollingMenuCursorPosition]
|
||||||
call Function24a97
|
call ItemSwitch_GetItemQuantity
|
||||||
cp MAX_ITEM_STACK
|
cp MAX_ITEM_STACK
|
||||||
jr z, .asm_249cd
|
jr z, .no_combine
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
call Function24a97
|
call ItemSwitch_GetItemQuantity
|
||||||
cp MAX_ITEM_STACK
|
cp MAX_ITEM_STACK
|
||||||
jr nz, .asm_249cf
|
jr nz, .combine
|
||||||
.asm_249cd
|
.no_combine
|
||||||
and a
|
and a
|
||||||
ret
|
ret
|
||||||
|
.combine
|
||||||
.asm_249cf
|
|
||||||
scf
|
scf
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Function249d1:
|
.combine_stacks:
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
call ItemSwitch_GetNthItem
|
call ItemSwitch_GetNthItem
|
||||||
inc hl
|
inc hl
|
||||||
@ -122,7 +121,7 @@ Function249d1:
|
|||||||
pop hl
|
pop hl
|
||||||
add [hl]
|
add [hl]
|
||||||
cp MAX_ITEM_STACK + 1
|
cp MAX_ITEM_STACK + 1
|
||||||
jr c, .asm_24a01
|
jr c, .merge_stacks
|
||||||
sub MAX_ITEM_STACK
|
sub MAX_ITEM_STACK
|
||||||
push af
|
push af
|
||||||
ld a, [wScrollingMenuCursorPosition]
|
ld a, [wScrollingMenuCursorPosition]
|
||||||
@ -138,7 +137,7 @@ Function249d1:
|
|||||||
ld [wSwitchItem], a
|
ld [wSwitchItem], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.asm_24a01
|
.merge_stacks:
|
||||||
push af
|
push af
|
||||||
ld a, [wScrollingMenuCursorPosition]
|
ld a, [wScrollingMenuCursorPosition]
|
||||||
call ItemSwitch_GetNthItem
|
call ItemSwitch_GetNthItem
|
||||||
@ -151,18 +150,18 @@ Function249d1:
|
|||||||
ld l, a
|
ld l, a
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr nz, .asm_24a25
|
jr nz, .not_combining_last_item
|
||||||
dec [hl]
|
dec [hl]
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
call ItemSwitch_GetNthItem
|
call ItemSwitch_GetNthItem
|
||||||
ld [hl], $ff
|
ld [hl], -1 ; end
|
||||||
xor a
|
xor a
|
||||||
ld [wSwitchItem], a
|
ld [wSwitchItem], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.asm_24a25
|
.not_combining_last_item:
|
||||||
dec [hl]
|
dec [hl]
|
||||||
call ItemSwitch_ConvertItemFormatToDW
|
call ItemSwitch_GetItemFormatSize
|
||||||
push bc
|
push bc
|
||||||
ld a, [wSwitchItem]
|
ld a, [wSwitchItem]
|
||||||
call ItemSwitch_GetNthItem
|
call ItemSwitch_GetNthItem
|
||||||
@ -170,35 +169,35 @@ Function249d1:
|
|||||||
push hl
|
push hl
|
||||||
add hl, bc
|
add hl, bc
|
||||||
pop de
|
pop de
|
||||||
.asm_24a34
|
.copy_loop
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
inc de
|
inc de
|
||||||
cp $ff
|
cp -1 ; end?
|
||||||
jr nz, .asm_24a34
|
jr nz, .copy_loop
|
||||||
xor a
|
xor a
|
||||||
ld [wSwitchItem], a
|
ld [wSwitchItem], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Function24a40:
|
ItemSwitch_CopyItemToBuffer:
|
||||||
call ItemSwitch_GetNthItem
|
call ItemSwitch_GetNthItem
|
||||||
ld de, wd002
|
ld de, wSwitchItemBuffer
|
||||||
call ItemSwitch_ConvertItemFormatToDW
|
call ItemSwitch_GetItemFormatSize
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Function24a4d:
|
ItemSwitch_CopyBufferToItem:
|
||||||
call ItemSwitch_GetNthItem
|
call ItemSwitch_GetNthItem
|
||||||
ld d, h
|
ld d, h
|
||||||
ld e, l
|
ld e, l
|
||||||
ld hl, wd002
|
ld hl, wSwitchItemBuffer
|
||||||
call ItemSwitch_ConvertItemFormatToDW
|
call ItemSwitch_GetItemFormatSize
|
||||||
call CopyBytes
|
call CopyBytes
|
||||||
ret
|
ret
|
||||||
|
|
||||||
ItemSwitch_GetNthItem:
|
ItemSwitch_GetNthItem:
|
||||||
push af
|
push af
|
||||||
call ItemSwitch_ConvertItemFormatToDW
|
call ItemSwitch_GetItemFormatSize
|
||||||
ld hl, wMenuData_ItemsPointerAddr
|
ld hl, wMenuData_ItemsPointerAddr
|
||||||
ld a, [hli]
|
ld a, [hli]
|
||||||
ld h, [hl]
|
ld h, [hl]
|
||||||
@ -208,9 +207,9 @@ ItemSwitch_GetNthItem:
|
|||||||
call AddNTimes
|
call AddNTimes
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Function24a6c:
|
ItemSwitch_GetItemOffset:
|
||||||
push hl
|
push hl
|
||||||
call ItemSwitch_ConvertItemFormatToDW
|
call ItemSwitch_GetItemFormatSize
|
||||||
ld a, d
|
ld a, d
|
||||||
sub e
|
sub e
|
||||||
jr nc, .dont_negate
|
jr nc, .dont_negate
|
||||||
@ -224,12 +223,12 @@ Function24a6c:
|
|||||||
pop hl
|
pop hl
|
||||||
ret
|
ret
|
||||||
|
|
||||||
ItemSwitch_ConvertItemFormatToDW:
|
ItemSwitch_GetItemFormatSize:
|
||||||
push hl
|
push hl
|
||||||
ld a, [wMenuData_ScrollingMenuItemFormat]
|
ld a, [wMenuData_ScrollingMenuItemFormat]
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, .format_dws
|
ld hl, .item_format_sizes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld c, [hl]
|
ld c, [hl]
|
||||||
@ -238,29 +237,30 @@ ItemSwitch_ConvertItemFormatToDW:
|
|||||||
pop hl
|
pop hl
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.format_dws
|
.item_format_sizes:
|
||||||
dw 0
|
; entries correspond to SCROLLINGMENU_ITEMS_* constants
|
||||||
dw 1
|
dw 0 ; unused
|
||||||
dw 2
|
dw 1 ; SCROLLINGMENU_ITEMS_NORMAL
|
||||||
|
dw 2 ; SCROLLINGMENU_ITEMS_QUANTITY
|
||||||
|
|
||||||
Function24a97:
|
ItemSwitch_GetItemQuantity:
|
||||||
push af
|
push af
|
||||||
call ItemSwitch_ConvertItemFormatToDW
|
call ItemSwitch_GetItemFormatSize
|
||||||
ld a, c
|
ld a, c
|
||||||
cp 2
|
cp 2
|
||||||
jr nz, .not_2
|
jr nz, .no_quantity
|
||||||
pop af
|
pop af
|
||||||
call ItemSwitch_GetNthItem
|
call ItemSwitch_GetNthItem
|
||||||
inc hl
|
inc hl
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.not_2
|
.no_quantity
|
||||||
pop af
|
pop af
|
||||||
ld a, $1
|
ld a, 1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Function24aab:
|
ItemSwitch_BackwardsCopyBytes:
|
||||||
.loop
|
.loop
|
||||||
ld a, [hld]
|
ld a, [hld]
|
||||||
ld [de], a
|
ld [de], a
|
||||||
|
4
wram.asm
4
wram.asm
@ -1814,6 +1814,10 @@ NEXTU
|
|||||||
; earthquake data buffer
|
; earthquake data buffer
|
||||||
wEarthquakeMovementDataBuffer:: ds 5
|
wEarthquakeMovementDataBuffer:: ds 5
|
||||||
|
|
||||||
|
NEXTU
|
||||||
|
; switching items in pack
|
||||||
|
wSwitchItemBuffer:: ds 2 ; may store 1 or 2 bytes
|
||||||
|
|
||||||
NEXTU
|
NEXTU
|
||||||
; miscellaneous
|
; miscellaneous
|
||||||
wTempDayOfWeek::
|
wTempDayOfWeek::
|
||||||
|
Loading…
Reference in New Issue
Block a user