This commit is contained in:
PikalaxALT
2015-12-13 14:15:16 -05:00
parent ecd277204a
commit acd92eee94
20 changed files with 1956 additions and 2168 deletions

View File

@@ -41,7 +41,7 @@ MenuData2_0x49d1c: ; 49d1c
db $80 ; flags
db 0 ; items
dw MainMenuItems
dw Function1f79
dw PlaceMenuStrings
dw MainMenuText
; 49d20

View File

@@ -809,9 +809,9 @@ UnknownText_0x15eae: ; 0x15eae
SellMenu: ; 15eb3
call DisableSpriteUpdates
callba Function106a5
callba DepositSellInitPackBuffers
.asm_15ebc
callba Function106be
callba DepositSellPack
ld a, [wcf66]
and a
jp z, Function15ece

File diff suppressed because it is too large Load Diff

View File

@@ -431,9 +431,9 @@ KrisDepositItemMenu: ; 0x1588b
jr c, .asm_158b6
call DisableSpriteUpdates
call LoadStandardMenuDataHeader
callba Function106a5
callba DepositSellInitPackBuffers
.asm_1589c
callba Function106be
callba DepositSellPack
ld a, [wcf66]
and a
jr z, .asm_158b3
@@ -629,7 +629,7 @@ Function15985: ; 0x15985
call Function156c7
.asm_159f2
callba Function2490c
callba SwitchItemsInBag
.asm_159f8
jp .asm_15989

View File

@@ -795,49 +795,49 @@ GiveTakePartyMonItem: ; 12b60
; Eggs can't hold items!
ld a, [CurPartySpecies]
cp EGG
jr z, .asm_12ba6
jr z, .cancel
ld hl, GiveTakeItemMenuData
call LoadMenuDataHeader
call InterpretMenu2
call ExitMenu
jr c, .asm_12ba6
jr c, .cancel
call GetCurNick
ld hl, StringBuffer1
ld de, wd050
ld bc, $b
ld de, wd050_MonNick
ld bc, PKMN_NAME_LENGTH
call CopyBytes
ld a, [MenuSelection2]
cp 1
jr nz, .asm_12ba0
jr nz, .take
call LoadStandardMenuDataHeader
call ClearPalettes
call Function12ba9
call .GiveItem
call ClearPalettes
call LoadFontsBattleExtra
call ExitMenu
ld a, 0
ret
.asm_12ba0
.take
call TakePartyItem
ld a, 3
ret
.asm_12ba6
.cancel
ld a, 3
ret
; 12ba9
Function12ba9: ; 12ba9
.GiveItem: ; 12ba9
callba Function106a5
callba DepositSellInitPackBuffers
.loop
callba Function106be
callba DepositSellPack
ld a, [wcf66]
and a
@@ -852,7 +852,7 @@ Function12ba9: ; 12ba9
and a
jr nz, .next
call Function12bd9
call TryGiveItemToPartymon
jr .quit
.next
@@ -865,41 +865,41 @@ Function12ba9: ; 12ba9
; 12bd9
Function12bd9: ; 12bd9
TryGiveItemToPartymon: ; 12bd9
call SpeechTextBox
call PartyMonItemName
call GetPartyItemLocation
ld a, [hl]
and a
jr z, .asm_12bf4
jr z, .give_item_to_mon
push hl
ld d, a
callba ItemIsMail
pop hl
jr c, .asm_12c01
jr c, .please_remove_mail
ld a, [hl]
jr .asm_12c08
jr .already_holding_item
.asm_12bf4
.give_item_to_mon
call GiveItemToPokemon
ld hl, MadeHoldText
call MenuTextBoxBackup
call GivePartyItem
ret
.asm_12c01
.please_remove_mail
ld hl, PleaseRemoveMailText
call MenuTextBoxBackup
ret
.asm_12c08
.already_holding_item
ld [wd265], a
call GetItemName
ld hl, SwitchAlreadyHoldingText
call StartMenuYesNo
jr c, .asm_12c4b
jr c, .abort
call GiveItemToPokemon
ld a, [wd265]
@@ -909,7 +909,7 @@ Function12bd9: ; 12bd9
pop af
ld [CurItem], a
call ReceiveItemFromPokemon
jr nc, .asm_12c3c
jr nc, .bag_full
ld hl, TookAndMadeHoldText
call MenuTextBoxBackup
@@ -918,14 +918,14 @@ Function12bd9: ; 12bd9
call GivePartyItem
ret
.asm_12c3c
.bag_full
ld a, [wd265]
ld [CurItem], a
call ReceiveItemFromPokemon
ld hl, ItemStorageIsFullText
call MenuTextBoxBackup
.asm_12c4b
.abort
ret
; 12c4c

274
engine/switch_items.asm Executable file
View File

@@ -0,0 +1,274 @@
SwitchItemsInBag: ; 2490c (9:490c)
ld a, [wSwitchItem]
and a
jr z, .init
ld b, a
ld a, [wCurrPocketCursorPosition]
inc a
cp b
jr z, .trivial
ld a, [wCurrPocketCursorPosition]
call Function24a5c
ld a, [hl]
cp $ff
ret z
ld a, [wSwitchItem]
dec a
ld [wSwitchItem], a
call Function249a7
jp c, Function249d1
ld a, [wCurrPocketCursorPosition]
ld c, a
ld a, [wSwitchItem]
cp c
jr c, .asm_2497a
jr .asm_2494a
.init
ld a, [wCurrPocketCursorPosition]
inc a
ld [wSwitchItem], a
ret
.trivial
xor a
ld [wSwitchItem], a
ret
.asm_2494a
ld a, [wSwitchItem]
call Function24a40
ld a, [wCurrPocketCursorPosition]
ld d, a
ld a, [wSwitchItem]
ld e, a
call Function24a6c
push bc
ld a, [wSwitchItem]
call Function24a5c
dec hl
push hl
call Function24a80
add hl, bc
ld d, h
ld e, l
pop hl
pop bc
call Function24aab
ld a, [wCurrPocketCursorPosition]
call Function24a4d
xor a
ld [wSwitchItem], a
ret
.asm_2497a
ld a, [wSwitchItem]
call Function24a40
ld a, [wCurrPocketCursorPosition]
ld d, a
ld a, [wSwitchItem]
ld e, a
call Function24a6c
push bc
ld a, [wSwitchItem]
call Function24a5c
ld d, h
ld e, l
call Function24a80
add hl, bc
pop bc
call CopyBytes
ld a, [wCurrPocketCursorPosition]
call Function24a4d
xor a
ld [wSwitchItem], a
ret
Function249a7: ; 249a7 (9:49a7)
ld a, [wSwitchItem]
call Function24a5c
ld d, h
ld e, l
ld a, [wCurrPocketCursorPosition]
call Function24a5c
ld a, [de]
cp [hl]
jr nz, .asm_249cd
ld a, [wCurrPocketCursorPosition]
call Function24a97
cp 99
jr z, .asm_249cd
ld a, [wSwitchItem]
call Function24a97
cp 99
jr nz, .asm_249cf
.asm_249cd
and a
ret
.asm_249cf
scf
ret
Function249d1: ; 249d1 (9:49d1)
ld a, [wSwitchItem]
call Function24a5c
inc hl
push hl
ld a, [wCurrPocketCursorPosition]
call Function24a5c
inc hl
ld a, [hl]
pop hl
add [hl]
cp 100
jr c, .asm_24a01
sub 99
push af
ld a, [wCurrPocketCursorPosition]
call Function24a5c
inc hl
ld [hl], 99
ld a, [wSwitchItem]
call Function24a5c
inc hl
pop af
ld [hl], a
xor a
ld [wSwitchItem], a
ret
.asm_24a01
push af
ld a, [wCurrPocketCursorPosition]
call Function24a5c
inc hl
pop af
ld [hl], a
ld hl, wMenuData2Addr
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [wSwitchItem]
cp [hl]
jr nz, .asm_24a25
dec [hl]
ld a, [wSwitchItem]
call Function24a5c
ld [hl], $ff
xor a
ld [wSwitchItem], a
ret
.asm_24a25
dec [hl]
call Function24a80
push bc
ld a, [wSwitchItem]
call Function24a5c
pop bc
push hl
add hl, bc
pop de
.asm_24a34
ld a, [hli]
ld [de], a
inc de
cp $ff
jr nz, .asm_24a34
xor a
ld [wSwitchItem], a
ret
Function24a40: ; 24a40 (9:4a40)
call Function24a5c
ld de, wd002
call Function24a80
call CopyBytes
ret
Function24a4d: ; 24a4d (9:4a4d)
call Function24a5c
ld d, h
ld e, l
ld hl, wd002
call Function24a80
call CopyBytes
ret
Function24a5c: ; 24a5c (9:4a5c)
push af
call Function24a80
ld hl, wMenuData2Addr
ld a, [hli]
ld h, [hl]
ld l, a
inc hl
pop af
call AddNTimes
ret
Function24a6c: ; 24a6c (9:4a6c)
push hl
call Function24a80
ld a, d
sub e
jr nc, .asm_24a76
dec a
cpl
.asm_24a76
ld hl, 0
call AddNTimes
ld b, h
ld c, l
pop hl
ret
Function24a80: ; 24a80 (9:4a80)
push hl
ld a, [wcf94]
ld c, a
ld b, 0
ld hl, Unknown_24a91
rept 2
add hl, bc
endr
ld c, [hl]
inc hl
ld b, [hl]
pop hl
ret
; 24a91 (9:4a91)
Unknown_24a91: ; 24a91
dw 0, 1, 2
; 24a97
Function24a97: ; 24a97 (9:4a97)
push af
call Function24a80
ld a, c
cp $2
jr nz, .asm_24aa7
pop af
call Function24a5c
inc hl
ld a, [hl]
ret
.asm_24aa7
pop af
ld a, $1
ret
Function24aab: ; 24aab (9:4aab)
.loop
ld a, [hld]
ld [de], a
dec de
dec bc
ld a, b
or c
jr nz, .loop
ret

592
engine/tmhm2.asm Executable file

File diff suppressed because it is too large Load Diff