More link trade shenanigans

This commit is contained in:
PikalaxALT 2015-12-21 14:10:16 -05:00
parent 047effba94
commit 630d789c70
21 changed files with 746 additions and 745 deletions

View File

@ -5700,7 +5700,7 @@ MoveSelectionScreen: ; 3e4bc
xor a xor a
ld [w2DMenuFlags2], a ld [w2DMenuFlags2], a
ld a, $10 ld a, $10
ld [w2DMenuFlags3], a ld [w2DMenuCursorOffsets], a
.menu_loop .menu_loop
ld a, [wMoveSelectionMenuType] ld a, [wMoveSelectionMenuType]
and a and a
@ -6531,7 +6531,7 @@ LoadEnemyMon: ; 3e8eb
ld [EnemyMonLevel], a ld [EnemyMonLevel], a
; Fill stats ; Fill stats
ld de, EnemyMonMaxHP ld de, EnemyMonMaxHP
ld b, $00 ld b, FALSE
ld hl, LinkBattleRNs + 7 ; ? ld hl, LinkBattleRNs + 7 ; ?
predef CalcPkmnStats predef CalcPkmnStats
@ -7529,7 +7529,7 @@ endr
push bc push bc
call LoadTileMapToTempTileMap call LoadTileMapToTempTileMap
pop bc pop bc
ld hl, MON_EXP + 2 ld hl, MON_STAT_EXP - 1
add hl, bc add hl, bc
ld d, [hl] ld d, [hl]
ld a, [hQuotient + 2] ld a, [hQuotient + 2]
@ -7562,7 +7562,7 @@ endr
ld d, MAX_LEVEL ld d, MAX_LEVEL
callab CalcExpAtLevel callab CalcExpAtLevel
pop bc pop bc
ld hl, MON_EXP + 2 ld hl, MON_STAT_EXP - 1
add hl, bc add hl, bc
push bc push bc
ld a, [hQuotient] ld a, [hQuotient]
@ -7621,10 +7621,10 @@ endr
add hl, bc add hl, bc
ld d, h ld d, h
ld e, l ld e, l
ld hl, MON_EXP + 2 ld hl, MON_STAT_EXP - 1
add hl, bc add hl, bc
push bc push bc
ld b, $1 ld b, TRUE
predef CalcPkmnStats predef CalcPkmnStats
pop bc pop bc
pop de pop de

View File

@ -286,7 +286,7 @@ HatchEggs: ; 16f70 (5:6f70)
ld [hl], a ld [hl], a
pop hl pop hl
push hl push hl
ld bc, MON_EXP + 2 ld bc, MON_STAT_EXP - 1
add hl, bc add hl, bc
ld b, $0 ld b, $0
predef CalcPkmnStats predef CalcPkmnStats

View File

@ -164,7 +164,7 @@ ForgetMove: ; 65d3
xor a xor a
ld [w2DMenuFlags2], a ld [w2DMenuFlags2], a
ld a, $20 ld a, $20
ld [w2DMenuFlags3], a ld [w2DMenuCursorOffsets], a
call StaticMenuJoypad call StaticMenuJoypad
push af push af
call Call_LoadTempTileMapToTileMap call Call_LoadTempTileMapToTileMap

View File

@ -44,7 +44,7 @@ TimeCapsule: ; 2805d
call Function87d call Function87d
ld a, [hLinkPlayerNumber] ld a, [hLinkPlayerNumber]
cp $2 cp $2
jr nz, .asm_28091 jr nz, .player_1
ld c, $3 ld c, $3
call DelayFrames call DelayFrames
xor a xor a
@ -61,7 +61,7 @@ TimeCapsule: ; 2805d
ld a, $81 ld a, $81
ld [rSC], a ld [rSC], a
.asm_28091 .player_1
ld de, MUSIC_NONE ld de, MUSIC_NONE
call PlayMusic call PlayMusic
ld c, $3 ld c, $3
@ -78,21 +78,21 @@ TimeCapsule: ; 2805d
ld [de], a ld [de], a
ld hl, wLinkData ld hl, wLinkData
ld de, OTPlayerName ld de, OTPlayerName
ld bc, 9 + NAME_LENGTH + 1 + PARTY_LENGTH + 1 + PARTY_LENGTH * REDMON_STRUCT_LENGTH + 2 * (PARTY_LENGTH * NAME_LENGTH) ; $1a8 ld bc, $1a8
call Function75f call Function75f
ld a, $fe ld a, $fe
ld [de], a ld [de], a
ld hl, wc608 ld hl, wMisc
ld de, wPlayerTrademonSpecies ld de, wPlayerTrademonSpecies
ld bc, wPlayerTrademonSpecies - wc608 ld bc, wPlayerTrademonSpecies - wMisc
call Function75f call Function75f
xor a xor a
ld [rIF], a ld [rIF], a
ld a, $1d ld a, $1d
ld [rIE], a ld [rIE], a
call Function287ab call Function287ab
ld hl, wd26b ld hl, OTPlayerName
call Function287ca call Link_FindFirstNonControlCharacter_SkipZero
push hl push hl
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
add hl, bc add hl, bc
@ -104,21 +104,21 @@ TimeCapsule: ; 2805d
jp nc, Function28b22 jp nc, Function28b22
ld de, wLinkData ld de, wLinkData
ld bc, $1a2 ld bc, $1a2
call Function2879e call Link_CopyOTData
ld de, wPlayerTrademonSpecies ld de, wPlayerTrademonSpecies
ld hl, wc813 ld hl, wTimeCapsulePartyMon1Species
ld c, $2 ld c, $2
.asm_280fe .loop
ld a, [de] ld a, [de]
inc de inc de
and a and a
jr z, .asm_280fe jr z, .loop
cp $fd cp $fd
jr z, .asm_280fe jr z, .loop
cp $fe cp $fe
jr z, .asm_280fe jr z, .loop
cp $ff cp $ff
jr z, .asm_2811d jr z, .next
push hl push hl
push bc push bc
ld b, $0 ld b, $0
@ -129,24 +129,24 @@ TimeCapsule: ; 2805d
ld [hl], a ld [hl], a
pop bc pop bc
pop hl pop hl
jr .asm_280fe jr .loop
.asm_2811d .next
ld hl, wc90f ld hl, wc90f
dec c dec c
jr nz, .asm_280fe jr nz, .loop
ld hl, wLinkData ld hl, wLinkPlayerName
ld de, wd26b ld de, OTPlayerName
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
call CopyBytes call CopyBytes
ld de, OTPartyCount ld de, OTPartyCount
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de
.asm_28135 .party_loop
ld a, [hli] ld a, [hli]
cp $ff cp -1
jr z, .asm_2814e jr z, .done_party
ld [wd265], a ld [wd265], a
push hl push hl
push de push de
@ -156,11 +156,11 @@ TimeCapsule: ; 2805d
ld a, [wd265] ld a, [wd265]
ld [de], a ld [de], a
inc de inc de
jr .asm_28135 jr .party_loop
.asm_2814e .done_party
ld [de], a ld [de], a
ld hl, wc813 ld hl, wTimeCapsulePartyMon1Species
call Function2868a call Function2868a
ld a, OTPartyMonOT % $100 ld a, OTPartyMonOT % $100
ld [wd102], a ld [wd102], a
@ -174,7 +174,7 @@ TimeCapsule: ; 2805d
call z, DelayFrames call z, DelayFrames
ld de, MUSIC_ROUTE_30 ld de, MUSIC_ROUTE_30
call PlayMusic call PlayMusic
jp Function287e3 jp InitTradeMenuDisplay
; 28177 ; 28177
Gen2ToGen2LinkComms: ; 28177 Gen2ToGen2LinkComms: ; 28177
@ -220,12 +220,12 @@ Gen2ToGen2LinkComms: ; 28177
ld a, $fe ld a, $fe
ld [de], a ld [de], a
ld hl, wLinkData ld hl, wLinkData
ld de, wd26b ld de, OTPlayerName
ld bc, $1c2 ld bc, $1c2
call Function75f call Function75f
ld a, $fe ld a, $fe
ld [de], a ld [de], a
ld hl, wc608 ld hl, wMisc
ld de, wPlayerTrademonSpecies ld de, wPlayerTrademonSpecies
ld bc, $c8 ld bc, $c8
call Function75f call Function75f
@ -245,13 +245,13 @@ Gen2ToGen2LinkComms: ; 28177
ld de, MUSIC_NONE ld de, MUSIC_NONE
call PlayMusic call PlayMusic
call Function287ab call Function287ab
ld hl, wd26b ld hl, OTPlayerName
call Function287ca call Link_FindFirstNonControlCharacter_SkipZero
ld de, wLinkData ld de, wLinkData
ld bc, $1b9 ld bc, $1b9
call Function2879e call Link_CopyOTData
ld de, wPlayerTrademonSpecies ld de, wPlayerTrademonSpecies
ld hl, wc813 ld hl, wLinkPlayerPartyMon1Species
ld c, $2 ld c, $2
.asm_28224 .asm_28224
ld a, [de] ld a, [de]
@ -392,7 +392,7 @@ Gen2ToGen2LinkComms: ; 28177
.asm_282fe .asm_282fe
ld hl, wLinkData ld hl, wLinkData
ld de, wd26b ld de, OTPlayerName
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
call CopyBytes call CopyBytes
ld de, OTPartyCount ld de, OTPartyCount
@ -427,7 +427,7 @@ Gen2ToGen2LinkComms: ; 28177
and $20 and $20
or $3 or $3
ld [hl], a ld [hl], a
ld hl, wd26b ld hl, OTPlayerName
ld de, OTName ld de, OTName
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
call CopyBytes call CopyBytes
@ -466,7 +466,7 @@ Gen2ToGen2LinkComms: ; 28177
.asm_283a9 .asm_283a9
ld de, MUSIC_ROUTE_30 ld de, MUSIC_ROUTE_30
call PlayMusic call PlayMusic
jp Function287e3 jp InitTradeMenuDisplay
; 283b2 ; 283b2
Function283b2: ; 283b2 Function283b2: ; 283b2
@ -561,73 +561,73 @@ ClearLinkData: ; 28426
Function28434: ; 28434 Function28434: ; 28434
ld hl, wd1f3 ld hl, wd1f3
ld a, $fd ld a, $fd
ld b, $7 ld b, 7
.asm_2843b .loop1
ld [hli], a ld [hli], a
dec b dec b
jr nz, .asm_2843b jr nz, .loop1
ld b, $a ld b, 10
.asm_28441 .loop2
call Random call Random
cp $fd cp $fd
jr nc, .asm_28441 jr nc, .loop2
ld [hli], a ld [hli], a
dec b dec b
jr nz, .asm_28441 jr nz, .loop2
ld hl, wc608 ld hl, wMisc
ld a, $fd ld a, $fd
rept 3 rept 3
ld [hli], a ld [hli], a
endr endr
ld b, $c8 ld b, $c8
xor a xor a
.asm_28457 .loop3
ld [hli], a ld [hli], a
dec b dec b
jr nz, .asm_28457 jr nz, .loop3
ld hl, wc818 ld hl, wc818
ld de, wc608 + 10 ld de, wMisc + 10
ld bc, 0 lb bc, 0, 0
.asm_28464 .loop4
inc c inc c
ld a, c ld a, c
cp $fd cp $fd
jr z, .asm_2848c jr z, .next1
ld a, b ld a, b
dec a dec a
jr nz, .asm_2847f jr nz, .next2
push bc push bc
ld a, [wLinkMode] ld a, [wLinkMode]
cp LINK_TIMECAPSULE cp LINK_TIMECAPSULE
ld b, $d ld b, $d
jr z, .asm_2847a jr z, .got_value
ld b, $27 ld b, $27
.asm_2847a .got_value
ld a, c ld a, c
cp b cp b
pop bc pop bc
jr z, .asm_28495 jr z, .done
.asm_2847f .next2
inc hl inc hl
ld a, [hl] ld a, [hl]
cp $fe cp $fe
jr nz, .asm_28464 jr nz, .loop4
ld a, c ld a, c
ld [de], a ld [de], a
inc de inc de
ld [hl], $ff ld [hl], $ff
jr .asm_28464 jr .loop4
.asm_2848c .next1
ld a, $ff ld a, $ff
ld [de], a ld [de], a
inc de inc de
lb bc, 1, 0 lb bc, 1, 0
jr .asm_28464 jr .loop4
.asm_28495 .done
ld a, $ff ld a, $ff
ld [de], a ld [de], a
ret ret
@ -636,7 +636,7 @@ endr
Link_PrepPartyData_Gen1: ; 28499 Link_PrepPartyData_Gen1: ; 28499
ld de, wLinkData ld de, wLinkData
ld a, $fd ld a, $fd
ld b, $6 ld b, 6
.loop1 .loop1
ld [de], a ld [de], a
inc de inc de
@ -781,7 +781,7 @@ Link_PrepPartyData_Gen1: ; 28499
ld [BaseSpecialAttack], a ld [BaseSpecialAttack], a
pop bc pop bc
ld hl, MON_EXP + 2 ld hl, MON_STAT_EXP - 1
add hl, bc add hl, bc
ld c, STAT_SATK ld c, STAT_SATK
ld b, TRUE ld b, TRUE
@ -960,7 +960,7 @@ Function2868a: ; 2868a
push hl push hl
ld d, h ld d, h
ld e, l ld e, l
ld bc, wcbea ld bc, wLinkOTPartyMonTypes
ld hl, wcbe8 ld hl, wcbe8
ld a, c ld a, c
ld [hli], a ld [hli], a
@ -969,12 +969,12 @@ Function2868a: ; 2868a
ld c, PARTY_LENGTH ld c, PARTY_LENGTH
.loop .loop
push bc push bc
call Function286ba call .ConvertToGen2
pop bc pop bc
dec c dec c
jr nz, .loop jr nz, .loop
pop hl pop hl
lb bc, 1, 8 ld bc, PARTY_LENGTH * REDMON_STRUCT_LENGTH
add hl, bc add hl, bc
ld de, OTPartyMonOT ld de, OTPartyMonOT
ld bc, PARTY_LENGTH * NAME_LENGTH ld bc, PARTY_LENGTH * NAME_LENGTH
@ -984,7 +984,7 @@ Function2868a: ; 2868a
jp CopyBytes jp CopyBytes
; 286ba ; 286ba
Function286ba: ; 286ba .ConvertToGen2: ; 286ba
ld b, h ld b, h
ld c, l ld c, l
ld a, [de] ld a, [de]
@ -1007,7 +1007,7 @@ Function286ba: ; 286ba
inc de inc de
ld [hl], a ld [hl], a
inc de inc de
ld hl, $20 ld hl, MON_STATUS
add hl, bc add hl, bc
ld a, [de] ld a, [de]
inc de inc de
@ -1025,9 +1025,9 @@ Function286ba: ; 286ba
ld a, l ld a, l
ld [wcbe8], a ld [wcbe8], a
ld a, h ld a, h
ld [wcbe9], a ld [wcbe8 + 1], a
push bc push bc
ld hl, $1 ld hl, MON_ITEM
add hl, bc add hl, bc
push hl push hl
ld h, d ld h, d
@ -1036,7 +1036,7 @@ Function286ba: ; 286ba
push bc push bc
ld a, [hli] ld a, [hli]
ld b, a ld b, a
call Function28771 call TimeCapsule_ReplaceTeruSama
ld a, b ld a, b
ld [de], a ld [de], a
inc de inc de
@ -1067,7 +1067,7 @@ Function286ba: ; 286ba
push bc push bc
ld d, h ld d, h
ld e, l ld e, l
ld hl, $a ld hl, MON_STAT_EXP - 1
add hl, bc add hl, bc
ld c, STAT_SATK ld c, STAT_SATK
ld b, TRUE ld b, TRUE
@ -1080,7 +1080,7 @@ Function286ba: ; 286ba
ld [hli], a ld [hli], a
push hl push hl
push bc push bc
ld hl, $a ld hl, MON_STAT_EXP - 1
add hl, bc add hl, bc
ld c, STAT_SDEF ld c, STAT_SDEF
ld b, TRUE ld b, TRUE
@ -1108,7 +1108,7 @@ endr
ret ret
; 28771 ; 28771
Function28771: ; 28771 TimeCapsule_ReplaceTeruSama: ; 28771
ld a, b ld a, b
and a and a
ret z ret z
@ -1145,11 +1145,11 @@ Function28771: ; 28771
db ITEM_C3, BERRY db ITEM_C3, BERRY
db ITEM_DC, BERRY db ITEM_DC, BERRY
db HM_08, BERRY db HM_08, BERRY
db $ff, BERRY db -1, BERRY
db $00 db 0
; 2879e ; 2879e
Function2879e: ; 2879e Link_CopyOTData: ; 2879e
.loop .loop
ld a, [hli] ld a, [hli]
cp $fe cp $fe
@ -1168,9 +1168,9 @@ Function287ab: ; 287ab
cp $2 cp $2
ret z ret z
ld hl, EnemyMonSpecies ld hl, EnemyMonSpecies
call Function287d8 call Link_FindFirstNonControlCharacter_AllowZero
ld de, LinkBattleRNs ld de, LinkBattleRNs
ld c, $a ld c, 10
.loop .loop
ld a, [hli] ld a, [hli]
cp $fe cp $fe
@ -1184,7 +1184,7 @@ Function287ab: ; 287ab
ret ret
; 287ca ; 287ca
Function287ca: ; 287ca Link_FindFirstNonControlCharacter_SkipZero: ; 287ca
.loop .loop
ld a, [hli] ld a, [hli]
and a and a
@ -1197,7 +1197,7 @@ Function287ca: ; 287ca
ret ret
; 287d8 ; 287d8
Function287d8: ; 287d8 Link_FindFirstNonControlCharacter_AllowZero: ; 287d8
.loop .loop
ld a, [hli] ld a, [hli]
cp $fd cp $fd
@ -1208,24 +1208,24 @@ Function287d8: ; 287d8
ret ret
; 287e3 ; 287e3
Function287e3: ; 287e3 InitTradeMenuDisplay: ; 287e3
call ClearScreen call ClearScreen
call Function28ef8 call LoadTradeScreenBorder
callba Function16d673 callba InitTradeSpeciesList
xor a xor a
ld hl, wOtherPlayerLinkMode ld hl, wOtherPlayerLinkMode
rept 3 rept 3
ld [hli], a ld [hli], a
endr endr
ld [hl], a ld [hl], a
ld a, $1 ld a, 1
ld [wMenuCursorY], a ld [wMenuCursorY], a
inc a inc a
ld [wPlayerLinkAction], a ld [wPlayerLinkAction], a
jp Function2888b jp LinkTrade_PlayerPartyMenu
; 28803 ; 28803
Function28803: ; 28803 LinkTrade_OTPartyMenu: ; 28803
ld a, OTPARTYMON ld a, OTPARTYMON
ld [MonType], a ld [MonType], a
ld a, A_BUTTON | D_UP | D_DOWN ld a, A_BUTTON | D_UP | D_DOWN
@ -1240,35 +1240,35 @@ Function28803: ; 28803
ld [w2DMenuCursorInitX], a ld [w2DMenuCursorInitX], a
ld a, 1 ld a, 1
ld [wMenuCursorX], a ld [wMenuCursorX], a
ld a, $10 ln a, 1, 0
ld [w2DMenuFlags3], a ld [w2DMenuCursorOffsets], a
ld a, $20 ld a, $20
ld [w2DMenuFlags1], a ld [w2DMenuFlags1], a
xor a xor a
ld [w2DMenuFlags2], a ld [w2DMenuFlags2], a
Function28835: ; 28835 LinkTradeOTPartymonMenuLoop: ; 28835
callba Function16d70c callba LinkTradeMenu
ld a, d ld a, d
and a and a
jp z, Function2891c jp z, LinkTradePartiesMenuMasterLoop
bit 0, a bit A_BUTTON_F, a
jr z, .asm_2885b jr z, .not_a_button
ld a, $1 ld a, $1
ld [wd263], a ld [wd263], a
callab Function50db9 callab Function50db9
ld hl, OTPartyMon1Species ld hl, OTPartyMon1Species
callba LinkMonStatsScreen callba LinkMonStatsScreen
jp Function2891c jp LinkTradePartiesMenuMasterLoop
.asm_2885b .not_a_button
bit 6, a bit D_UP_F, a
jr z, .asm_28883 jr z, .not_d_up
ld a, [wMenuCursorY] ld a, [wMenuCursorY]
ld b, a ld b, a
ld a, [OTPartyCount] ld a, [OTPartyCount]
cp b cp b
jp nz, Function2891c jp nz, LinkTradePartiesMenuMasterLoop
xor a xor a
ld [MonType], a ld [MonType], a
call HideCursor call HideCursor
@ -1281,16 +1281,16 @@ Function28835: ; 28835
pop hl pop hl
ld a, [PartyCount] ld a, [PartyCount]
ld [wMenuCursorY], a ld [wMenuCursorY], a
jr Function2888b jr LinkTrade_PlayerPartyMenu
.asm_28883 .not_d_up
bit 7, a bit D_DOWN_F, a
jp z, Function2891c jp z, LinkTradePartiesMenuMasterLoop
jp Function28ac9 jp Function28ac9
; 2888b ; 2888b
Function2888b: ; 2888b LinkTrade_PlayerPartyMenu: ; 2888b
callba Function49856 callba InitMG_Mobile_LinkTradePalMap
xor a xor a
ld [MonType], a ld [MonType], a
ld a, A_BUTTON | D_UP | D_DOWN ld a, A_BUTTON | D_UP | D_DOWN
@ -1305,70 +1305,70 @@ Function2888b: ; 2888b
ld [w2DMenuCursorInitX], a ld [w2DMenuCursorInitX], a
ld a, 1 ld a, 1
ld [wMenuCursorX], a ld [wMenuCursorX], a
ld a, $10 ln a, 1, 0
ld [w2DMenuFlags3], a ld [w2DMenuCursorOffsets], a
ld a, $20 ld a, $20
ld [w2DMenuFlags1], a ld [w2DMenuFlags1], a
xor a xor a
ld [w2DMenuFlags2], a ld [w2DMenuFlags2], a
call WaitBGMap2 call WaitBGMap2
Function288c5: ; 288c5 LinkTradePartymonMenuLoop: ; 288c5
callba Function16d70c callba LinkTradeMenu
ld a, d ld a, d
and a and a
jr nz, .asm_288d2 jr nz, .check_joypad
jp Function2891c jp LinkTradePartiesMenuMasterLoop
.asm_288d2 .check_joypad
bit 0, a bit A_BUTTON_F, a
jr z, .asm_288d9 jr z, .not_a_button
jp Function28926 jp Function28926
.asm_288d9 .not_a_button
bit 7, a bit D_DOWN_F, a
jr z, .asm_288fe jr z, .not_d_down
ld a, [wMenuCursorY] ld a, [wMenuCursorY]
dec a dec a
jp nz, Function2891c jp nz, LinkTradePartiesMenuMasterLoop
ld a, $1 ld a, OTPARTYMON
ld [MonType], a ld [MonType], a
call HideCursor call HideCursor
push hl push hl
push bc push bc
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
add hl, bc add hl, bc
ld [hl], $7f ld [hl], " "
pop bc pop bc
pop hl pop hl
ld a, $1 ld a, 1
ld [wMenuCursorY], a ld [wMenuCursorY], a
jp Function28803 jp LinkTrade_OTPartyMenu
.asm_288fe .not_d_down
bit 6, a bit D_UP_F, a
jr z, Function2891c jr z, LinkTradePartiesMenuMasterLoop
ld a, [wMenuCursorY] ld a, [wMenuCursorY]
ld b, a ld b, a
ld a, [PartyCount] ld a, [PartyCount]
cp b cp b
jr nz, Function2891c jr nz, LinkTradePartiesMenuMasterLoop
call HideCursor call HideCursor
push hl push hl
push bc push bc
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
add hl, bc add hl, bc
ld [hl], $7f ld [hl], " "
pop bc pop bc
pop hl pop hl
jp Function28ade jp Function28ade
; 2891c ; 2891c
Function2891c: ; 2891c LinkTradePartiesMenuMasterLoop: ; 2891c
ld a, [MonType] ld a, [MonType]
and a and a
jp z, Function288c5 jp z, LinkTradePartymonMenuLoop ; PARTYMON
jp Function28835 jp LinkTradeOTPartymonMenuLoop ; OTPARTYMON
; 28926 ; 28926
Function28926: ; 28926 Function28926: ; 28926
@ -1380,11 +1380,11 @@ Function28926: ; 28926
ld c, 18 ld c, 18
call Predef_LinkTextbox call Predef_LinkTextbox
hlcoord 2, 16 hlcoord 2, 16
ld de, String28ab4 ld de, .String_Stats_Trade
call PlaceString call PlaceString
callba Function4d354 callba Function4d354
.asm_28946 .joy_loop
ld a, " " ld a, " "
ldcoord_a 11, 16 ldcoord_a 11, 16
ld a, A_BUTTON | B_BUTTON | D_RIGHT ld a, A_BUTTON | B_BUTTON | D_RIGHT
@ -1400,23 +1400,23 @@ Function28926: ; 28926
ld a, 1 ld a, 1
ld [wMenuCursorY], a ld [wMenuCursorY], a
ld [wMenuCursorX], a ld [wMenuCursorX], a
ld a, $20 ln a, 2, 0
ld [w2DMenuFlags3], a ld [w2DMenuCursorOffsets], a
xor a xor a
ld [w2DMenuFlags1], a ld [w2DMenuFlags1], a
ld [w2DMenuFlags2], a ld [w2DMenuFlags2], a
call ScrollingMenuJoypad call ScrollingMenuJoypad
bit D_RIGHT_F, a bit D_RIGHT_F, a
jr nz, .asm_2898d jr nz, .d_right
bit B_BUTTON_F, a bit B_BUTTON_F, a
jr z, .asm_289cd jr z, .show_stats
.asm_28983 .b_button
pop af pop af
ld [wMenuCursorY], a ld [wMenuCursorY], a
call Call_LoadTempTileMapToTileMap call Call_LoadTempTileMapToTileMap
jp Function2888b jp LinkTrade_PlayerPartyMenu
.asm_2898d .d_right
ld a, " " ld a, " "
ldcoord_a 1, 16 ldcoord_a 1, 16
ld a, A_BUTTON | B_BUTTON | D_LEFT ld a, A_BUTTON | B_BUTTON | D_LEFT
@ -1432,19 +1432,19 @@ Function28926: ; 28926
ld a, 1 ld a, 1
ld [wMenuCursorY], a ld [wMenuCursorY], a
ld [wMenuCursorX], a ld [wMenuCursorX], a
ld a, $20 ln a, 2, 0
ld [w2DMenuFlags3], a ld [w2DMenuCursorOffsets], a
xor a xor a
ld [w2DMenuFlags1], a ld [w2DMenuFlags1], a
ld [w2DMenuFlags2], a ld [w2DMenuFlags2], a
call ScrollingMenuJoypad call ScrollingMenuJoypad
bit D_LEFT_F, a bit D_LEFT_F, a
jp nz, .asm_28946 jp nz, .joy_loop
bit B_BUTTON_F, a bit B_BUTTON_F, a
jr nz, .asm_28983 jr nz, .b_button
jr .asm_289fe jr .try_trade
.asm_289cd .show_stats
pop af pop af
ld [wMenuCursorY], a ld [wMenuCursorY], a
ld a, $4 ld a, $4
@ -1455,14 +1455,14 @@ Function28926: ; 28926
hlcoord 6, 1 hlcoord 6, 1
lb bc, 6, 1 lb bc, 6, 1
ld a, " " ld a, " "
call Function28b77 call LinkEngine_FillBox
hlcoord 17, 1 hlcoord 17, 1
lb bc, 6, 1 lb bc, 6, 1
ld a, " " ld a, " "
call Function28b77 call LinkEngine_FillBox
jp Function2888b jp LinkTrade_PlayerPartyMenu
.asm_289fe .try_trade
call PlaceHollowCursor call PlaceHollowCursor
pop af pop af
ld [wMenuCursorY], a ld [wMenuCursorY], a
@ -1472,15 +1472,15 @@ Function28926: ; 28926
callba Function16d6ce callba Function16d6ce
ld a, [wOtherPlayerLinkMode] ld a, [wOtherPlayerLinkMode]
cp $f cp $f
jp z, Function287e3 jp z, InitTradeMenuDisplay
ld [wd003], a ld [wd003], a
call Function28b68 call Function28b68
ld c, $64 ld c, 100
call DelayFrames call DelayFrames
callba Functionfb57e callba ValidateOTTrademon
jr c, .asm_28a58 jr c, .abnormal
callba Functionfb5dd callba Functionfb5dd
jp nc, Function28b87 jp nc, LinkTrade
xor a xor a
ld [wcf57], a ld [wcf57], a
ld [wOtherPlayerLinkAction], a ld [wOtherPlayerLinkAction], a
@ -1489,12 +1489,12 @@ Function28926: ; 28926
ld c, 18 ld c, 18
call Predef_LinkTextbox call Predef_LinkTextbox
callba Function4d354 callba Function4d354
ld hl, UnknownText_0x28aaf ld hl, .Text_CantTradeLastMon
bccoord 1, 14 bccoord 1, 14
call PlaceWholeStringInBoxAtOnce call PlaceWholeStringInBoxAtOnce
jr .asm_28a89 jr .cancel_trade
.asm_28a58 .abnormal
xor a xor a
ld [wcf57], a ld [wcf57], a
ld [wOtherPlayerLinkAction], a ld [wOtherPlayerLinkAction], a
@ -1507,41 +1507,41 @@ Function28926: ; 28926
ld [wd265], a ld [wd265], a
call GetPokemonName call GetPokemonName
hlcoord 0, 12 hlcoord 0, 12
ld b, $4 ld b, 4
ld c, $12 ld c, 18
call Predef_LinkTextbox call Predef_LinkTextbox
callba Function4d354 callba Function4d354
ld hl, UnknownText_0x28ac4 ld hl, .Text_Abnormal
bccoord 1, 14 bccoord 1, 14
call PlaceWholeStringInBoxAtOnce call PlaceWholeStringInBoxAtOnce
.asm_28a89 .cancel_trade
hlcoord 0, 12 hlcoord 0, 12
ld b, 4 ld b, 4
ld c, 18 ld c, 18
call Predef_LinkTextbox call Predef_LinkTextbox
hlcoord 1, 14 hlcoord 1, 14
ld de, String28ece ld de, String_TooBadTheTradeWasCanceled
call PlaceString call PlaceString
ld a, $1 ld a, $1
ld [wPlayerLinkAction], a ld [wPlayerLinkAction], a
callba Function16d6ce callba Function16d6ce
ld c, 100 ld c, 100
call DelayFrames call DelayFrames
jp Function287e3 jp InitTradeMenuDisplay
; 28aaf ; 28aaf
UnknownText_0x28aaf: ; 0x28aaf .Text_CantTradeLastMon: ; 0x28aaf
; If you trade that #MON, you won't be able to battle. ; If you trade that #MON, you won't be able to battle.
text_jump UnknownText_0x1c41b1 text_jump UnknownText_0x1c41b1
db "@" db "@"
; 0x28ab4 ; 0x28ab4
String28ab4: ; 28ab4 .String_Stats_Trade: ; 28ab4
db "STATS TRADE@" db "STATS TRADE@"
UnknownText_0x28ac4: ; 0x28ac4 .Text_Abnormal: ; 0x28ac4
; Your friend's @ appears to be abnormal! ; Your friend's @ appears to be abnormal!
text_jump UnknownText_0x1c41e6 text_jump UnknownText_0x1c41e6
db "@" db "@"
@ -1550,8 +1550,8 @@ UnknownText_0x28ac4: ; 0x28ac4
Function28ac9: ; 28ac9 Function28ac9: ; 28ac9
ld a, [wMenuCursorY] ld a, [wMenuCursorY]
cp $1 cp 1
jp nz, Function2891c jp nz, LinkTradePartiesMenuMasterLoop
call HideCursor call HideCursor
push hl push hl
push bc push bc
@ -1560,7 +1560,6 @@ Function28ac9: ; 28ac9
ld [hl], " " ld [hl], " "
pop bc pop bc
pop hl pop hl
Function28ade: ; 28ade Function28ade: ; 28ade
.loop1 .loop1
ld a, "▶" ld a, "▶"
@ -1580,12 +1579,12 @@ Function28ade: ; 28ade
jr z, .d_up jr z, .d_up
ld a, [OTPartyCount] ld a, [OTPartyCount]
ld [wMenuCursorY], a ld [wMenuCursorY], a
jp Function28803 jp LinkTrade_OTPartyMenu
.d_up .d_up
ld a, $1 ld a, $1
ld [wMenuCursorY], a ld [wMenuCursorY], a
jp Function2888b jp LinkTrade_PlayerPartyMenu
.a_button .a_button
ld a, "▷" ld a, "▷"
@ -1596,7 +1595,6 @@ Function28ade: ; 28ade
ld a, [wOtherPlayerLinkMode] ld a, [wOtherPlayerLinkMode]
cp $f cp $f
jr nz, .loop1 jr nz, .loop1
Function28b22: ; 28b22 Function28b22: ; 28b22
call RotateThreePalettesRight call RotateThreePalettesRight
call ClearScreen call ClearScreen
@ -1616,6 +1614,7 @@ Function28b22: ; 28b22
; 28b42 ; 28b42
Function28b42: ; 28b42 Function28b42: ; 28b42
; unreferenced
hlcoord 0, 16 hlcoord 0, 16
ld a, "┘" ld a, "┘"
ld bc, 2 * SCREEN_WIDTH ld bc, 2 * SCREEN_WIDTH
@ -1625,11 +1624,11 @@ Function28b42: ; 28b42
ld bc, SCREEN_WIDTH - 2 ld bc, SCREEN_WIDTH - 2
call ByteFill call ByteFill
hlcoord 2, 16 hlcoord 2, 16
ld de, String_28b61 ld de, .Cancel
jp PlaceString jp PlaceString
; 28b61 ; 28b61
String_28b61: ; 28b61 .Cancel: ; 28b61
db "CANCEL@" db "CANCEL@"
; 28b68 ; 28b68
@ -1638,28 +1637,28 @@ Function28b68: ; 28b68
hlcoord 6, 9 hlcoord 6, 9
ld bc, SCREEN_WIDTH ld bc, SCREEN_WIDTH
call AddNTimes call AddNTimes
ld [hl], $ec ld [hl], "▷"
ret ret
; 28b77 ; 28b77
Function28b77: ; 28b77 LinkEngine_FillBox: ; 28b77
.asm_28b77 .row
push bc push bc
push hl push hl
.asm_28b79 .col
ld [hli], a ld [hli], a
dec c dec c
jr nz, .asm_28b79 jr nz, .col
pop hl pop hl
ld bc, SCREEN_WIDTH ld bc, SCREEN_WIDTH
add hl, bc add hl, bc
pop bc pop bc
dec b dec b
jr nz, .asm_28b77 jr nz, .row
ret ret
; 28b87 ; 28b87
Function28b87: ; 28b87 LinkTrade: ; 28b87
xor a xor a
ld [wcf57], a ld [wcf57], a
ld [wOtherPlayerLinkAction], a ld [wOtherPlayerLinkAction], a
@ -1711,7 +1710,7 @@ Function28b87: ; 28b87
ld [w2DMenuFlags1], a ld [w2DMenuFlags1], a
ld [w2DMenuFlags2], a ld [w2DMenuFlags2], a
ld a, $20 ld a, $20
ld [w2DMenuFlags3], a ld [w2DMenuCursorOffsets], a
ld a, A_BUTTON | B_BUTTON ld a, A_BUTTON | B_BUTTON
ld [wMenuJoypadFilter], a ld [wMenuJoypadFilter], a
ld a, 1 ld a, 1
@ -1737,7 +1736,7 @@ Function28b87: ; 28b87
ld c, 18 ld c, 18
call Predef_LinkTextbox call Predef_LinkTextbox
hlcoord 1, 14 hlcoord 1, 14
ld de, String28ece ld de, String_TooBadTheTradeWasCanceled
call PlaceString call PlaceString
callba Function16d6ce callba Function16d6ce
jp Function28ea3 jp Function28ea3
@ -1754,7 +1753,7 @@ Function28b87: ; 28b87
ld c, 18 ld c, 18
call Predef_LinkTextbox call Predef_LinkTextbox
hlcoord 1, 14 hlcoord 1, 14
ld de, String28ece ld de, String_TooBadTheTradeWasCanceled
call PlaceString call PlaceString
jp Function28ea3 jp Function28ea3
@ -1837,7 +1836,7 @@ Function28b87: ; 28b87
callba GetCaughtGender callba GetCaughtGender
ld a, c ld a, c
ld [wPlayerTrademonCaughtData], a ld [wPlayerTrademonCaughtData], a
ld hl, wd26b ld hl, OTPlayerName
ld de, wOTTrademonSenderName ld de, wOTTrademonSenderName
ld bc, NAME_LENGTH ld bc, NAME_LENGTH
call CopyBytes call CopyBytes
@ -1937,7 +1936,7 @@ Function28b87: ; 28b87
ld [CurPartyMon], a ld [CurPartyMon], a
callab EvolvePokemon callab EvolvePokemon
call ClearScreen call ClearScreen
call Function28ef8 call LoadTradeScreenBorder
call Function28eff call Function28eff
callba Function4d354 callba Function4d354
ld b, $1 ld b, $1
@ -1998,7 +1997,7 @@ Function28b87: ; 28b87
Function28ea3: ; 28ea3 Function28ea3: ; 28ea3
ld c, 100 ld c, 100
call DelayFrames call DelayFrames
jp Function287e3 jp InitTradeMenuDisplay
; 28eab ; 28eab
String28eab: ; 28eab String28eab: ; 28eab
@ -2014,7 +2013,7 @@ UnknownText_0x28eb8: ; 0x28eb8
String28ebd: ; 28ebd String28ebd: ; 28ebd
db "Trade completed!@" db "Trade completed!@"
String28ece: ; 28ece String_TooBadTheTradeWasCanceled: ; 28ece
db "Too bad! The trade" db "Too bad! The trade"
next "was canceled!@" next "was canceled!@"
@ -2026,8 +2025,8 @@ Predef_LinkTextbox: ; 28eef
ret ret
; 28ef8 ; 28ef8
Function28ef8: ; 28ef8 LoadTradeScreenBorder: ; 28ef8
callba Function16d696 callba _LoadTradeScreenBorder
ret ret
; 28eff ; 28eff
@ -2038,6 +2037,7 @@ Function28eff: ; 28eff
; 28f09 ; 28f09
Function28f09: ; 28f09 Function28f09: ; 28f09
; unreferenced
hlcoord 0, 0 hlcoord 0, 0
ld b, 6 ld b, 6
ld c, 18 ld c, 18
@ -2046,7 +2046,7 @@ Function28f09: ; 28f09
ld b, 6 ld b, 6
ld c, 18 ld c, 18
call Predef_LinkTextbox call Predef_LinkTextbox
callba Functionfb60d callba PlaceTradePartnerNamesAndParty
ret ret
; 28f24 ; 28f24
@ -2064,7 +2064,7 @@ Special_CheckTimeCapsuleCompatibility: ; 29bfb
ld b, PARTY_LENGTH ; 6 ld b, PARTY_LENGTH ; 6
.loop .loop
ld a, [hli] ld a, [hli]
cp $ff cp -1
jr z, .checkitem jr z, .checkitem
cp CHIKORITA ; MEW + 1 ; 151 + 1 cp CHIKORITA ; MEW + 1 ; 151 + 1
jr nc, .mon_too_new jr nc, .mon_too_new

359
engine/link_trade.asm Executable file
View File

@ -0,0 +1,359 @@
__LoadTradeScreenBorder: ; 16d421
ld de, GFX_16cfc1
ld hl, VTiles2
lb bc, BANK(GFX_16cfc1), 70
call Get2bpp
ret
; 16d42e
Function16d42e: ; 16d42e
ld hl, Tilemap_16d465
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
; 16d43b
Function16d43b: ; 16d43b
call LoadStandardMenuDataHeader
call ClearBGPalettes
call ClearTileMap
call ClearSprites
callba __LoadTradeScreenBorder ; useless to farcall
callba Function16d42e ; useless to farcall
ld b, SCGB_08
call GetSGBLayout
call SetPalettes
call WaitBGMap
call JoyWaitAorB
call Call_ExitMenu
ret
; 16d465
Tilemap_16d465:
INCBIN "gfx/unknown/16d465.tilemap"
Tilemap_16d5cd:
INCBIN "gfx/unknown/16d5cd.tilemap"
Tilemap_16d5f5:
INCBIN "gfx/unknown/16d5f5.tilemap"
_LinkTextbox: ; 16d61d
ld h, d
ld l, e
push bc
push hl
call .draw_border
pop hl
pop bc
ld de, AttrMap - TileMap
add hl, de
inc b
inc b
inc c
inc c
ld a, $7
.loop
push bc
push hl
.loop2
ld [hli], a
dec c
jr nz, .loop2
pop hl
ld de, SCREEN_WIDTH
add hl, de
pop bc
dec b
jr nz, .loop
ret
; 16d640
.draw_border: ; 16d640
push hl
ld a, $30
ld [hli], a
inc a
call .fill_row
inc a
ld [hl], a
pop hl
ld de, SCREEN_WIDTH
add hl, de
.loop3
push hl
ld a, $33
ld [hli], a
ld a, " "
call .fill_row
ld [hl], $34
pop hl
ld de, SCREEN_WIDTH
add hl, de
dec b
jr nz, .loop3
ld a, $35
ld [hli], a
ld a, $36
call .fill_row
ld [hl], $37
ret
; 16d66d
.fill_row: ; 16d66d
ld d, c
.loop4
ld [hli], a
dec d
jr nz, .loop4
ret
; 16d673
InitTradeSpeciesList: ; 16d673
call _LoadTradeScreenBorder
call Function16d6ae
callba InitMG_Mobile_LinkTradePalMap
callba PlaceTradePartnerNamesAndParty
hlcoord 10, 17
ld de, .CANCEL
call PlaceString
ret
; 16d68f
.CANCEL: ; 16d68f
db "CANCEL@"
; 16d696
_LoadTradeScreenBorder: ; 16d696
call __LoadTradeScreenBorder
ret
; 16d69a
Function16d69a: ; 16d69a
ld de, GFX_16cfc1 + $300
ld hl, VTiles2 tile $76
lb bc, BANK(GFX_16cfc1), 8
call Get2bpp
ret
; 16d6a7
Function16d6a7: ; 16d6a7
callba Function49811
ret
; 16d6ae
Function16d6ae: ; 16d6ae
call Function16d42e
ld hl, Tilemap_16d5cd
decoord 0, 0
ld bc, 2 * SCREEN_WIDTH
call CopyBytes
ld hl, Tilemap_16d5f5
decoord 0, 16
ld bc, 2 * SCREEN_WIDTH
call CopyBytes
ret
; 16d6ca
LinkTextbox: ; 16d6ca
call _LinkTextbox
ret
; 16d6ce
Function16d6ce: ; 16d6ce
call LoadStandardMenuDataHeader
call Function16d6e1
callba Function87d
call Call_ExitMenu
call WaitBGMap2
ret
; 16d6e1
Function16d6e1: ; 16d6e1
hlcoord 4, 10
ld b, 1
ld c, 10
predef Predef_LinkTextbox
hlcoord 5, 11
ld de, .Waiting
call PlaceString
call WaitBGMap
call WaitBGMap2
ld c, 50
jp DelayFrames
; 16d701
.Waiting: ; 16d701
db "WAITING..!@"
; 16d70c
LinkTradeMenu: ; 16d70c
call .MenuAction
call .GetJoypad
ret
; 16d713
.GetJoypad: ; 16d713
push bc
push af
ld a, [hJoyLast]
and D_PAD
ld b, a
ld a, [hJoyPressed]
and BUTTONS
or b
ld b, a
pop af
ld a, b
pop bc
ld d, a
ret
; 16d725
.MenuAction: ; 16d725
ld hl, w2DMenuFlags2
res 7, [hl]
ld a, [hBGMapMode]
push af
call .loop
pop af
ld [hBGMapMode], a
ret
.loop
call .UpdateCursor
call .UpdateBGMapAndOAM
call .loop2
jr nc, .done
callba _2DMenuInterpretJoypad
jr c, .done
ld a, [w2DMenuFlags1]
bit 7, a
jr nz, .done
call .GetJoypad
ld b, a
ld a, [wMenuJoypadFilter]
and b
jr z, .loop
.done
ret
; 16d759
.UpdateBGMapAndOAM: ; 16d759
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
call WaitBGMap
pop af
ld [hOAMUpdate], a
xor a
ld [hBGMapMode], a
ret
.loop2
call RTC
call .TryAnims
ret c
ld a, [w2DMenuFlags1]
bit 7, a
jr z, .loop2
and a
ret
; 16d77a
.UpdateCursor: ; 16d77a
ld hl, wCursorCurrentTile
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hl]
cp $1f
jr nz, .not_currently_selected
ld a, [wCursorOffCharacter]
ld [hl], a
push hl
push bc
ld bc, PKMN_NAME_LENGTH
add hl, bc
ld [hl], a
pop bc
pop hl
.not_currently_selected
ld a, [w2DMenuCursorInitY]
ld b, a
ld a, [w2DMenuCursorInitX]
ld c, a
call Coord2Tile
ld a, [w2DMenuCursorOffsets]
swap a
and $f
ld c, a
ld a, [wMenuCursorY]
ld b, a
xor a
dec b
jr z, .skip
.loop3
add c
dec b
jr nz, .loop3
.skip
ld c, SCREEN_WIDTH
call AddNTimes
ld a, [w2DMenuCursorOffsets]
and $f
ld c, a
ld a, [wMenuCursorX]
ld b, a
xor a
dec b
jr z, .skip2
.loop4
add c
dec b
jr nz, .loop4
.skip2
ld c, a
add hl, bc
ld a, [hl]
cp $1f
jr z, .cursor_already_there
ld [wCursorOffCharacter], a
ld [hl], $1f
push hl
push bc
ld bc, PKMN_NAME_LENGTH
add hl, bc
ld [hl], $1f
pop bc
pop hl
.cursor_already_there
ld a, l
ld [wCursorCurrentTile], a
ld a, h
ld [wCursorCurrentTile + 1], a
ret
; 16d7e7
.TryAnims: ; 16d7e7
ld a, [w2DMenuFlags1]
bit 6, a
jr z, .skip_anims
callba PlaySpriteAnimationsAndDelayFrame
.skip_anims
call JoyTextDelay
call .GetJoypad
and a
ret z
scf
ret
; 16d7fe

View File

@ -239,8 +239,8 @@ Init2DMenuCursorPosition: ; 2411a (9:411a)
.InitFlags_b: ; 2418a .InitFlags_b: ; 2418a
ld a, [wMenuData2Spacing] ld a, [wMenuData2Spacing]
or %00100000 or $20
ld [w2DMenuFlags3], a ld [w2DMenuCursorOffsets], a
ret ret
; 24193 ; 24193
@ -536,7 +536,7 @@ Place2DMenuCursor: ; 24329
ld a, [w2DMenuCursorInitX] ld a, [w2DMenuCursorInitX]
ld c, a ld c, a
call Coord2Tile call Coord2Tile
ld a, [w2DMenuFlags3] ld a, [w2DMenuCursorOffsets]
swap a swap a
and $f and $f
ld c, a ld c, a
@ -553,7 +553,7 @@ Place2DMenuCursor: ; 24329
.got_row .got_row
ld c, SCREEN_WIDTH ld c, SCREEN_WIDTH
call AddNTimes call AddNTimes
ld a, [w2DMenuFlags3] ld a, [w2DMenuCursorOffsets]
and $f and $f
ld c, a ld c, a
ld a, [wMenuCursorX] ld a, [wMenuCursorX]
@ -809,8 +809,8 @@ _InitVerticalMenuCursor:: ; 2446d
; w2DMenuFlags2 ; w2DMenuFlags2
xor a xor a
ld [hli], a ld [hli], a
; w2DMenuFlags3 ; w2DMenuCursorOffsets
ld a, %00100000 ln a, 2, 0
ld [hli], a ld [hli], a
; wMenuJoypadFilter ; wMenuJoypadFilter
ld a, A_BUTTON ld a, A_BUTTON

View File

@ -309,7 +309,7 @@ ScrollingMenu_InitFlags: ; 24764
xor a xor a
ld [w2DMenuFlags2], a ld [w2DMenuFlags2], a
ld a, $20 ld a, $20
ld [w2DMenuFlags3], a ld [w2DMenuCursorOffsets], a
ld a, A_BUTTON | B_BUTTON | D_UP | D_DOWN ld a, A_BUTTON | B_BUTTON | D_UP | D_DOWN
bit 7, c bit 7, c
jr z, .disallow_select jr z, .disallow_select

View File

@ -474,22 +474,22 @@ Function4dfa6: ; 4dfa6 (13:5fa6)
ret ret
Function4dfb6: ; 4dfb6 (13:5fb6) Function4dfb6: ; 4dfb6 (13:5fb6)
ld a, [CurBaseData] ; wd236 (aliases: BaseDexNo) ld a, [BaseDexNo] ; wd236 (aliases: BaseDexNo)
ld [wd265], a ld [wd265], a
ld [CurSpecies], a ld [CurSpecies], a
xor a xor a
ld [hBGMapMode], a ld [hBGMapMode], a
call Function4dfda call Function4dfda
call Function4e002 call DrawStatsScreenPage
call Function4dfed call Function4dfed
ld hl, wcf64 ld hl, wcf64
bit 4, [hl] bit 4, [hl]
jr nz, .asm_4dfd6 jr nz, .place_frontpic
call SetPalettes call SetPalettes
ret ret
.asm_4dfd6 .place_frontpic
call Function4e226 call StatsScreen_PlaceFrontpic
ret ret
Function4dfda: ; 4dfda (13:5fda) Function4dfda: ; 4dfda (13:5fda)
@ -512,87 +512,88 @@ Function4dfed: ; 4dfed (13:5fed)
set 5, [hl] set 5, [hl]
ret ret
Function4e002: ; 4e002 (13:6002) DrawStatsScreenPage: ; 4e002 (13:6002)
ld a, [wcf64] ld a, [wcf64]
and $3 and $3
dec a dec a
ld hl, Jumptable_4e00d ld hl, .Jumptable
rst JumpTable rst JumpTable
ret ret
Jumptable_4e00d: ; 4e00d (13:600d) .Jumptable: ; 4e00d (13:600d)
dw Function4e013 jumptable_start
dw Function4e147 jumptable .PinkPage
dw Function4e1ae jumptable .GreenPage
jumptable .BluePage
Function4e013: ; 4e013 (13:6013) .PinkPage: ; 4e013 (13:6013)
hlcoord 0, 9 hlcoord 0, 9
ld b, $0 ld b, $0
predef DrawPlayerHP predef DrawPlayerHP
hlcoord 8, 9 hlcoord 8, 9
ld [hl], $41 ld [hl], $41
ld de, String_4e119 ld de, .Status_Type
hlcoord 0, 12 hlcoord 0, 12
call PlaceString call PlaceString
ld a, [TempMonPokerusStatus] ld a, [TempMonPokerusStatus]
ld b, a ld b, a
and $f and $f
jr nz, .asm_4e055 jr nz, .HasPokerus
ld a, b ld a, b
and $f0 and $f0
jr z, .asm_4e03d jr z, .NotImmuneToPkrs
hlcoord 8, 8 hlcoord 8, 8
ld [hl], $e8 ld [hl], "."
.asm_4e03d .NotImmuneToPkrs
ld a, [MonType] ld a, [MonType]
cp $2 cp BOXMON
jr z, .asm_4e060 jr z, .StatusOK
hlcoord 6, 13 hlcoord 6, 13
push hl push hl
ld de, TempMonStatus ld de, TempMonStatus
predef PlaceStatusString predef PlaceStatusString
pop hl pop hl
jr nz, .asm_4e066 jr nz, .done_status
jr .asm_4e060 jr .StatusOK
.asm_4e055 .HasPokerus
ld de, String_4e142 ld de, .PkrsStr
hlcoord 1, 13 hlcoord 1, 13
call PlaceString call PlaceString
jr .asm_4e066 jr .done_status
.asm_4e060 .StatusOK
ld de, String_4e127 ld de, .OK_str
call PlaceString call PlaceString
.asm_4e066 .done_status
hlcoord 1, 15 hlcoord 1, 15
predef PrintMonTypes predef PrintMonTypes
hlcoord 9, 8 hlcoord 9, 8
ld de, $14 ld de, SCREEN_WIDTH
ld b, $a ld b, 10
ld a, $31 ld a, $31
.asm_4e078 .vertical_divider
ld [hl], a ld [hl], a
add hl, de add hl, de
dec b dec b
jr nz, .asm_4e078 jr nz, .vertical_divider
ld de, String_4e12b ld de, .ExpPointStr
hlcoord 10, 9 hlcoord 10, 9
call PlaceString call PlaceString
hlcoord 17, 14 hlcoord 17, 14
call Function4e0d3 call .PrintNextLevel
hlcoord 13, 10 hlcoord 13, 10
lb bc, 3, 7 lb bc, 3, 7
ld de, TempMonExp ld de, TempMonExp
call PrintNum call PrintNum
call Function4e0e7 call .CalcExpToNextLevel
hlcoord 13, 13 hlcoord 13, 13
lb bc, 3, 7 lb bc, 3, 7
ld de, Buffer1 ; wd1ea (aliases: MagikarpLength) ld de, Buffer1 ; wd1ea (aliases: MagikarpLength)
call PrintNum call PrintNum
ld de, String_4e136 ld de, .LevelUpStr
hlcoord 10, 12 hlcoord 10, 12
call PlaceString call PlaceString
ld de, String_4e13f ld de, .ToStr
hlcoord 14, 14 hlcoord 14, 14
call PlaceString call PlaceString
hlcoord 11, 16 hlcoord 11, 16
@ -606,34 +607,34 @@ Function4e013: ; 4e013 (13:6013)
ld [hl], $41 ld [hl], $41
ret ret
Function4e0d3: ; 4e0d3 (13:60d3) .PrintNextLevel: ; 4e0d3 (13:60d3)
ld a, [TempMonLevel] ld a, [TempMonLevel]
push af push af
cp MAX_LEVEL cp MAX_LEVEL
jr z, .asm_4e0df jr z, .AtMaxLevel
inc a inc a
ld [TempMonLevel], a ld [TempMonLevel], a
.asm_4e0df .AtMaxLevel
call PrintLevel call PrintLevel
pop af pop af
ld [TempMonLevel], a ld [TempMonLevel], a
ret ret
Function4e0e7: ; 4e0e7 (13:60e7) .CalcExpToNextLevel: ; 4e0e7 (13:60e7)
ld a, [TempMonLevel] ld a, [TempMonLevel]
cp MAX_LEVEL cp MAX_LEVEL
jr z, .asm_4e111 jr z, .AlreadyAtMaxLevel
inc a inc a
ld d, a ld d, a
callba CalcExpAtLevel callba CalcExpAtLevel
rept 2 rept 2
ld hl, TempMonExp + 2 ld hl, TempMonExp + 2
endr endr
ld a, [$ffb6] ld a, [hQuotient + 2]
sub [hl] sub [hl]
dec hl dec hl
ld [wd1ec], a ld [Buffer3], a
ld a, [$ffb5] ld a, [hQuotient + 1]
sbc [hl] sbc [hl]
dec hl dec hl
ld [Buffer2], a ; wd1eb (aliases: MovementType) ld [Buffer2], a ; wd1eb (aliases: MovementType)
@ -641,7 +642,8 @@ endr
sbc [hl] sbc [hl]
ld [Buffer1], a ; wd1ea (aliases: MagikarpLength) ld [Buffer1], a ; wd1ea (aliases: MagikarpLength)
ret ret
.asm_4e111
.AlreadyAtMaxLevel
ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength) ld hl, Buffer1 ; wd1ea (aliases: MagikarpLength)
xor a xor a
rept 2 rept 2
@ -651,39 +653,39 @@ endr
ret ret
; 4e119 (13:6119) ; 4e119 (13:6119)
String_4e119: ; 4e119 .Status_Type: ; 4e119
db "STATUS/" db "STATUS/"
next "TYPE/@" next "TYPE/@"
; 4e127 ; 4e127
String_4e127: ; 4e127 .OK_str: ; 4e127
db "OK @" db "OK @"
; 4e12b ; 4e12b
String_4e12b: ; 4e12b .ExpPointStr: ; 4e12b
db "EXP POINTS@" db "EXP POINTS@"
; 4e136 ; 4e136
String_4e136: ; 4e136 .LevelUpStr: ; 4e136
db "LEVEL UP@" db "LEVEL UP@"
; 4e13f ; 4e13f
String_4e13f: ; 4e13f .ToStr: ; 4e13f
db "TO@" db "TO@"
; 4e142 ; 4e142
String_4e142: ; 4e142 .PkrsStr: ; 4e142
db "#RUS@" db "#RUS@"
; 4e147 ; 4e147
Function4e147: ; 4e147 (13:6147) .GreenPage: ; 4e147 (13:6147)
ld de, String_4e1a0 ld de, .Item
hlcoord 0, 8 hlcoord 0, 8
call PlaceString call PlaceString
call Function4e189 call .GetItemName
hlcoord 8, 8 hlcoord 8, 8
call PlaceString call PlaceString
ld de, String_4e1a9 ld de, .Move
hlcoord 0, 10 hlcoord 0, 10
call PlaceString call PlaceString
ld hl, TempMonMoves ld hl, TempMonMoves
@ -695,53 +697,53 @@ Function4e147: ; 4e147 (13:6147)
ld [Buffer1], a ld [Buffer1], a
predef ListMoves predef ListMoves
hlcoord 12, 11 hlcoord 12, 11
ld a, $28 ld a, SCREEN_WIDTH * 2
ld [Buffer1], a ld [Buffer1], a
predef ListMovePP predef ListMovePP
ret ret
Function4e189: ; 4e189 (13:6189) .GetItemName: ; 4e189 (13:6189)
ld de, String_4e1a5 ld de, .ThreeDashes
ld a, [TempMonItem] ld a, [TempMonItem]
and a and a
ret z ret z
ld b, a ld b, a
callba Function28771 callba TimeCapsule_ReplaceTeruSama
ld a, b ld a, b
ld [wd265], a ld [wd265], a
call GetItemName call GetItemName
ret ret
; 4e1a0 (13:61a0) ; 4e1a0 (13:61a0)
String_4e1a0: ; 4e1a0 .Item: ; 4e1a0
db "ITEM@" db "ITEM@"
; 4e1a5 ; 4e1a5
String_4e1a5: ; 4e1a5 .ThreeDashes: ; 4e1a5
db "---@" db "---@"
; 4e1a9 ; 4e1a9
String_4e1a9: ; 4e1a9 .Move: ; 4e1a9
db "MOVE@" db "MOVE@"
; 4e1ae ; 4e1ae
Function4e1ae: ; 4e1ae (13:61ae) .BluePage: ; 4e1ae (13:61ae)
call Function4e1cc call .PlaceOTInfo
hlcoord 10, 8 hlcoord 10, 8
ld de, $14 ld de, SCREEN_WIDTH
ld b, $a ld b, 10
ld a, $31 ld a, $31
.asm_4e1bb .BluePageVerticalDivider
ld [hl], a ld [hl], a
add hl, de add hl, de
dec b dec b
jr nz, .asm_4e1bb jr nz, .BluePageVerticalDivider
hlcoord 11, 8 hlcoord 11, 8
ld bc, $6 ld bc, 6
predef PrintTempMonStats predef PrintTempMonStats
ret ret
Function4e1cc: ; 4e1cc (13:61cc) .PlaceOTInfo: ; 4e1cc (13:61cc)
ld de, IDNoString ld de, IDNoString
hlcoord 0, 9 hlcoord 0, 9
call PlaceString call PlaceString
@ -752,7 +754,7 @@ Function4e1cc: ; 4e1cc (13:61cc)
lb bc, PRINTNUM_LEADINGZEROS | 2, 5 lb bc, PRINTNUM_LEADINGZEROS | 2, 5
ld de, TempMonID ld de, TempMonID
call PrintNum call PrintNum
ld hl, Unknown_4e216 ld hl, .OTNamePointers
call Function4e528 call Function4e528
call Function4e505 call Function4e505
callba CheckNickErrors callba CheckNickErrors
@ -760,52 +762,55 @@ Function4e1cc: ; 4e1cc (13:61cc)
call PlaceString call PlaceString
ld a, [TempMonCaughtGender] ld a, [TempMonCaughtGender]
and a and a
jr z, .asm_4e215 jr z, .done
cp $7f cp $7f
jr z, .asm_4e215 jr z, .done
and $80 and $80
ld a, "♂" ld a, "♂"
jr z, .asm_4e211 jr z, .got_gender
ld a, "♀" ld a, "♀"
.asm_4e211 .got_gender
hlcoord 9, 13 hlcoord 9, 13
ld [hl], a ld [hl], a
.asm_4e215 .done
ret ret
; 4e216 (13:6216) ; 4e216 (13:6216)
Unknown_4e216: ; 4e216 .OTNamePointers: ; 4e216
dw PartyMonOT dw PartyMonOT
dw OTPartyMonOT dw OTPartyMonOT
dw sBoxMonOT dw sBoxMonOT
dw wd00d dw wBufferMonOT
; 4e21e ; 4e21e
IDNoString: ; 4e21e IDNoString: ; 4e21e
db $73, "№.@" db "<ID>№.@"
OTString: ; 4e222 OTString: ; 4e222
db "OT/@" db "OT/@"
; 4e226 ; 4e226
Function4e226: ; 4e226 (13:6226) StatsScreen_PlaceFrontpic: ; 4e226 (13:6226)
ld hl, TempMonDVs ld hl, TempMonDVs
predef GetUnownLetter predef GetUnownLetter
call Function4e2ad call StatsScreen_GetAnimationParam
jr c, .asm_4e238 jr c, .egg
and a and a
jr z, .asm_4e23f jr z, .no_cry
jr .asm_4e246 jr .cry
.asm_4e238
.egg
call Function4e271 call Function4e271
call SetPalettes call SetPalettes
ret ret
.asm_4e23f
.no_cry
call Function4e253 call Function4e253
call SetPalettes call SetPalettes
ret ret
.asm_4e246
.cry
call SetPalettes call SetPalettes
call Function4e253 call Function4e253
ld a, [CurPartySpecies] ld a, [CurPartySpecies]
@ -817,11 +822,12 @@ Function4e253: ; 4e253 (13:6253)
set 5, [hl] set 5, [hl]
ld a, [CurPartySpecies] ld a, [CurPartySpecies]
cp UNOWN cp UNOWN
jr z, .asm_4e266 jr z, .unown
hlcoord 0, 0 hlcoord 0, 0
call PrepMonFrontpic call PrepMonFrontpic
ret ret
.asm_4e266
.unown
xor a xor a
ld [wBoxAlignment], a ld [wBoxAlignment], a
hlcoord 0, 0 hlcoord 0, 0
@ -831,12 +837,13 @@ Function4e253: ; 4e253 (13:6253)
Function4e271: ; 4e271 (13:6271) Function4e271: ; 4e271 (13:6271)
ld a, [CurPartySpecies] ld a, [CurPartySpecies]
cp UNOWN cp UNOWN
jr z, .asm_4e281 jr z, .unown
ld a, $1 ld a, $1
ld [wBoxAlignment], a ld [wBoxAlignment], a
call Function4e289 call Function4e289
ret ret
.asm_4e281
.unown
xor a xor a
ld [wBoxAlignment], a ld [wBoxAlignment], a
call Function4e289 call Function4e289
@ -857,34 +864,34 @@ Function4e289: ; 4e289 (13:6289)
set 6, [hl] set 6, [hl]
ret ret
Function4e2ad: ; 4e2ad (13:62ad) StatsScreen_GetAnimationParam: ; 4e2ad (13:62ad)
ld a, [MonType] ld a, [MonType]
ld hl, .Jumptable ld hl, .Jumptable
rst JumpTable rst JumpTable
ret ret
.Jumptable: ; 4e2b5 (13:62b5) .Jumptable: ; 4e2b5 (13:62b5)
dw Function4e2bf dw .PartyMon
dw Function4e2cf dw .OTPartyMon
dw Function4e2d1 dw .BoxMon
dw Function4e2ed dw .Tempmon
dw Function4e301 dw .Wildmon
Function4e2bf: ; 4e2bf (13:62bf) .PartyMon: ; 4e2bf (13:62bf)
ld a, [CurPartyMon] ld a, [CurPartyMon]
ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species) ld hl, PartyMons ; wdcdf (aliases: PartyMon1, PartyMon1Species)
ld bc, PARTYMON_STRUCT_LENGTH ld bc, PARTYMON_STRUCT_LENGTH
call AddNTimes call AddNTimes
ld b, h ld b, h
ld c, l ld c, l
jr Function4e2f2 jr .CheckEggFaintedFrzSlp
Function4e2cf: ; 4e2cf (13:62cf) .OTPartyMon: ; 4e2cf (13:62cf)
xor a xor a
ret ret
Function4e2d1: ; 4e2d1 (13:62d1) .BoxMon: ; 4e2d1 (13:62d1)
ld hl, sBoxMons ld hl, sBoxMons
ld bc, PARTYMON_STRUCT_LENGTH ld bc, PARTYMON_STRUCT_LENGTH
ld a, [CurPartyMon] ld a, [CurPartyMon]
@ -893,32 +900,33 @@ Function4e2d1: ; 4e2d1 (13:62d1)
ld c, l ld c, l
ld a, BANK(sBoxMons) ld a, BANK(sBoxMons)
call GetSRAMBank call GetSRAMBank
call Function4e2f2 call .CheckEggFaintedFrzSlp
push af push af
call CloseSRAM call CloseSRAM
pop af pop af
ret ret
Function4e2ed: ; 4e2ed (13:62ed) .Tempmon: ; 4e2ed (13:62ed)
ld bc, TempMonSpecies ; wd10e (aliases: TempMon) ld bc, TempMonSpecies ; wd10e (aliases: TempMon)
jr Function4e2f2 ; utterly pointless jr .CheckEggFaintedFrzSlp ; utterly pointless
Function4e2f2: ; 4e2f2 (13:62f2) .CheckEggFaintedFrzSlp: ; 4e2f2 (13:62f2)
ld a, [CurPartySpecies] ld a, [CurPartySpecies]
cp EGG cp EGG
jr z, .egg jr z, .egg
call CheckFaintedFrzSlp call CheckFaintedFrzSlp
jr c, Function4e305 jr c, .FaintedFrzSlp
.egg .egg
xor a xor a
scf scf
ret ret
Function4e301: ; 4e301 (13:6301) .Wildmon: ; 4e301 (13:6301)
ld a, $1 ld a, $1
and a and a
ret ret
Function4e305: ; 4e305 (13:6305)
.FaintedFrzSlp: ; 4e305 (13:6305)
xor a xor a
ret ret
@ -995,7 +1003,7 @@ EggStatsScreen: ; 4e33a
hlcoord 0, 0 hlcoord 0, 0
call PrepMonFrontpic call PrepMonFrontpic
callba Function10402d callba Function10402d
call Function4e497 call StatsScreen_AnimateEgg
ld a, [TempMonHappiness] ld a, [TempMonHappiness]
cp 6 cp 6
@ -1034,18 +1042,19 @@ EggALotMoreTimeString: ; 0x4e46e
; 0x4e497 ; 0x4e497
Function4e497: ; 4e497 (13:6497) StatsScreen_AnimateEgg: ; 4e497 (13:6497)
call Function4e2ad call StatsScreen_GetAnimationParam
ret nc ret nc
ld a, [TempMonHappiness] ld a, [TempMonHappiness]
ld e, $7 ld e, $7
cp $6 cp 6
jr c, .asm_4e4ab jr c, .animate
ld e, $8 ld e, $8
cp $b cp 11
jr c, .asm_4e4ab jr c, .animate
ret ret
.asm_4e4ab
.animate
push de push de
ld a, $1 ld a, $1
ld [wBoxAlignment], a ld [wBoxAlignment], a

View File

@ -1,6 +1,6 @@
; These functions seem to be related to backwards compatibility ; These functions seem to be related to backwards compatibility
Functionfb57e: ; fb57e ValidateOTTrademon: ; fb57e
ld a, [wd003] ld a, [wd003]
ld hl, OTPartyMon1Species ld hl, OTPartyMon1Species
call GetPartyLocation call GetPartyLocation
@ -14,21 +14,21 @@ Functionfb57e: ; fb57e
ld a, [hl] ld a, [hl]
pop hl pop hl
cp EGG cp EGG
jr z, .asm_fb59c jr z, .matching_or_egg
cp [hl] cp [hl]
jr nz, .asm_fb5db jr nz, .abnormal
.asm_fb59c .matching_or_egg
ld b, h ld b, h
ld c, l ld c, l
ld hl, MON_LEVEL ld hl, MON_LEVEL
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp 101 cp MAX_LEVEL + 1
jr nc, .asm_fb5db jr nc, .abnormal
ld a, [wLinkMode] ld a, [wLinkMode]
cp LINK_TIMECAPSULE cp LINK_TIMECAPSULE
jr nz, .asm_fb5d9 jr nz, .normal
ld hl, OTPartySpecies ld hl, OTPartySpecies
ld a, [wd003] ld a, [wd003]
ld c, a ld c, a
@ -39,29 +39,29 @@ Functionfb57e: ; fb57e
; Magnemite and Magneton's types changed ; Magnemite and Magneton's types changed
; from Electric to Electric/Steel. ; from Electric to Electric/Steel.
cp MAGNEMITE cp MAGNEMITE
jr z, .asm_fb5d9 jr z, .normal
cp MAGNETON cp MAGNETON
jr z, .asm_fb5d9 jr z, .normal
ld [CurSpecies], a ld [CurSpecies], a
call GetBaseData call GetBaseData
ld hl, wcbea ld hl, wLinkOTPartyMonTypes
rept 2 rept 2
add hl, bc add hl, bc
endr endr
ld a, [BaseType1] ld a, [BaseType1]
cp [hl] cp [hl]
jr nz, .asm_fb5db jr nz, .abnormal
inc hl inc hl
ld a, [BaseType2] ld a, [BaseType2]
cp [hl] cp [hl]
jr nz, .asm_fb5db jr nz, .abnormal
.asm_fb5d9 .normal
and a and a
ret ret
.asm_fb5db .abnormal
scf scf
ret ret
; fb5dd ; fb5dd
@ -72,10 +72,10 @@ Functionfb5dd: ; fb5dd
ld a, [PartyCount] ld a, [PartyCount]
ld b, a ld b, a
ld c, $0 ld c, $0
.asm_fb5e7 .loop
ld a, c ld a, c
cp d cp d
jr z, .asm_fb5f8 jr z, .next
push bc push bc
ld a, c ld a, c
ld hl, PartyMon1HP ld hl, PartyMon1HP
@ -83,48 +83,47 @@ Functionfb5dd: ; fb5dd
pop bc pop bc
ld a, [hli] ld a, [hli]
or [hl] or [hl]
jr nz, .asm_fb60b jr nz, .done
.asm_fb5f8 .next
inc c inc c
dec b dec b
jr nz, .asm_fb5e7 jr nz, .loop
ld a, [wd003] ld a, [wd003]
ld hl, OTPartyMon1HP ld hl, OTPartyMon1HP
call GetPartyLocation call GetPartyLocation
ld a, [hli] ld a, [hli]
or [hl] or [hl]
jr nz, .asm_fb60b jr nz, .done
scf scf
ret ret
.asm_fb60b .done
and a and a
ret ret
; fb60d ; fb60d
Functionfb60d: ; fb60d PlaceTradePartnerNamesAndParty: ; fb60d
hlcoord 4, 0 hlcoord 4, 0
ld de, PlayerName ld de, PlayerName
call PlaceString call PlaceString
ld a, $14 ld a, $14
ld [bc], a ld [bc], a
hlcoord 4, 8 hlcoord 4, 8
ld de, wd26b ld de, OTPlayerName
call PlaceString call PlaceString
ld a, $14 ld a, $14
ld [bc], a ld [bc], a
hlcoord 7, 1 hlcoord 7, 1
ld de, PartySpecies ld de, PartySpecies
call Functionfb634 call .PlaceSpeciesNames
hlcoord 7, 9 hlcoord 7, 9
ld de, OTPartySpecies ld de, OTPartySpecies
.PlaceSpeciesNames: ; fb634
Functionfb634: ; fb634
ld c, $0 ld c, $0
.asm_fb636 .loop
ld a, [de] ld a, [de]
cp $ff cp -1
ret z ret z
ld [wd265], a ld [wd265], a
push bc push bc
@ -143,7 +142,7 @@ Functionfb634: ; fb634
add hl, bc add hl, bc
pop bc pop bc
inc c inc c
jr .asm_fb636 jr .loop
; fb656 ; fb656
KantoMonSpecials: ; fb656 KantoMonSpecials: ; fb656

View File

@ -215,7 +215,7 @@ TMHM_PocketLoop: ; 2c8d3 (b:48d3)
xor a xor a
ld [w2DMenuFlags2], a ld [w2DMenuFlags2], a
ld a, $20 ld a, $20
ld [w2DMenuFlags3], a ld [w2DMenuCursorOffsets], a
ld a, A_BUTTON | B_BUTTON | D_UP | D_DOWN | D_LEFT | D_RIGHT ld a, A_BUTTON | B_BUTTON | D_UP | D_DOWN | D_LEFT | D_RIGHT
ld [wMenuJoypadFilter], a ld [wMenuJoypadFilter], a
ld a, [wTMHMPocketCursor] ld a, [wTMHMPocketCursor]

View File

@ -1285,7 +1285,7 @@ UpdateStatsAfterItem: ; ee8c
call GetPartyParamLocation call GetPartyParamLocation
ld d, h ld d, h
ld e, l ld e, l
ld a, MON_EXP + 2 ld a, MON_STAT_EXP - 1
call GetPartyParamLocation call GetPartyParamLocation
ld b, $1 ld b, $1
predef_jump CalcPkmnStats predef_jump CalcPkmnStats

View File

@ -5326,7 +5326,7 @@ endr
add hl, bc add hl, bc
ld a, $1 ld a, $1
ld c, a ld c, a
ld b, $0 ld b, FALSE
call CalcPkmnStatC call CalcPkmnStatC
ld a, [hProduct + 2] ld a, [hProduct + 2]
ld [de], a ld [de], a
@ -5716,7 +5716,7 @@ SentGetPkmnIntoFromBox: ; db3f
add hl, bc add hl, bc
ld d, h ld d, h
ld e, l ld e, l
ld hl, MON_EXP + 2 ld hl, MON_STAT_EXP - 1
add hl, bc add hl, bc
push bc push bc
@ -6461,7 +6461,7 @@ ComputeNPCTrademonStats: ; e134
ld d, h ld d, h
ld e, l ld e, l
push de push de
ld a, MON_EXP + 2 ld a, MON_STAT_EXP - 1
call GetPartyParamLocation call GetPartyParamLocation
ld b, $1 ld b, $1
call CalcPkmnStats call CalcPkmnStats
@ -6478,8 +6478,9 @@ ComputeNPCTrademonStats: ; e134
CalcPkmnStats: ; e167 CalcPkmnStats: ; e167
; Calculates all 6 Stats of a Pkmn ; Calculates all 6 Stats of a Pkmn
; b = 0 or 1 ; b: Take into account stat EXP if TRUE
; 'c' counts from 1-6 and points with 'BaseStats' to the base value ; 'c' counts from 1-6 and points with 'BaseStats' to the base value
; hl is the path to the Stat EXP
; results in $ffb5 and $ffb6 are saved in [de] ; results in $ffb5 and $ffb6 are saved in [de]
ld c, $0 ld c, $0
@ -10274,9 +10275,9 @@ LinkMonStatsScreen: ; 4d319
call ClearScreen call ClearScreen
call ClearBGPalettes call ClearBGPalettes
call MaxVolume call MaxVolume
callba Function28ef8 callba LoadTradeScreenBorder
callba Function4d354 callba Function4d354
callba Function16d673 callba InitTradeSpeciesList
callba Function28eff callba Function28eff
call WaitBGMap2 call WaitBGMap2
ret ret
@ -11869,7 +11870,7 @@ _TempMonStatsCalculation: ; 50893
add hl, bc add hl, bc
ld d, h ld d, h
ld e, l ld e, l
ld hl, MON_EXP + 2 ld hl, MON_STAT_EXP - 1
add hl, bc add hl, bc
push bc push bc
ld b, $1 ld b, $1
@ -15345,6 +15346,7 @@ INCLUDE "misc/battle_tower_47.asm"
SECTION "bank5B", ROMX, BANK[$5B] SECTION "bank5B", ROMX, BANK[$5B]
INCLUDE "misc/mobile_5b.asm" INCLUDE "misc/mobile_5b.asm"
INCLUDE "engine/link_trade.asm"
SECTION "bank5C", ROMX, BANK[$5C] SECTION "bank5C", ROMX, BANK[$5C]

View File

@ -482,7 +482,7 @@ endr
ld e, l ld e, l
push hl push hl
push de push de
ld hl, MON_EXP + 2 ld hl, MON_STAT_EXP - 1
add hl, bc add hl, bc
ld b, $1 ld b, $1
predef CalcPkmnStats predef CalcPkmnStats

View File

@ -490,7 +490,7 @@ Function4ab1a: ; 4ab1a
ld a, $fb ld a, $fb
ld [wMenuJoypadFilter], a ld [wMenuJoypadFilter], a
ld a, $26 ld a, $26
ld [w2DMenuFlags3], a ld [w2DMenuCursorOffsets], a
ld a, $2 ld a, $2
ld [w2DMenuNumCols], a ld [w2DMenuNumCols], a
call Function4adf7 call Function4adf7

View File

@ -6830,7 +6830,7 @@ Function102dd3: ; 102dd3
ld hl, VTiles0 ld hl, VTiles0
lb bc, BANK(GFX_1032a2), 4 lb bc, BANK(GFX_1032a2), 4
call Get2bpp call Get2bpp
callba Function16d421 callba __LoadTradeScreenBorder
call EnableLCD call EnableLCD
ret ret
; 102dec ; 102dec
@ -6889,7 +6889,7 @@ String_102e48: ; 102e48
Function102e4f: ; 102e4f Function102e4f: ; 102e4f
callba Function16d42e callba Function16d42e
callba Function49797 callba _InitMG_Mobile_LinkTradePalMap
ld de, PlayerName ld de, PlayerName
hlcoord 4, 0 hlcoord 4, 0
call PlaceString call PlaceString

View File

@ -7278,7 +7278,7 @@ Function11b483: ; 11b483
ld hl, MON_MAXHP ld hl, MON_MAXHP
add hl, de add hl, de
push hl push hl
ld hl, MON_EXP + 2 ld hl, MON_STAT_EXP - 1
add hl, de add hl, de
pop de pop de
push de push de

View File

@ -866,371 +866,3 @@ Unknown_16cfb9:
GFX_16cfc1: GFX_16cfc1:
INCBIN "gfx/unknown/16cfc1.2bpp" INCBIN "gfx/unknown/16cfc1.2bpp"
Function16d421: ; 16d421
ld de, GFX_16cfc1
ld hl, VTiles2
lb bc, BANK(GFX_16cfc1), $46
call Get2bpp
ret
; 16d42e
Function16d42e: ; 16d42e
ld hl, Tilemap_16d465
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
; 16d43b
Function16d43b: ; 16d43b
call LoadStandardMenuDataHeader
call ClearBGPalettes
call ClearTileMap
call ClearSprites
callba Function16d421
callba Function16d42e
ld b, SCGB_08
call GetSGBLayout
call SetPalettes
call WaitBGMap
call JoyWaitAorB
call Call_ExitMenu
ret
; 16d465
Tilemap_16d465:
INCBIN "gfx/unknown/16d465.tilemap"
Tilemap_16d5cd:
INCBIN "gfx/unknown/16d5cd.tilemap"
Tilemap_16d5f5:
INCBIN "gfx/unknown/16d5f5.tilemap"
_LinkTextbox: ; 16d61d
ld h, d
ld l, e
push bc
push hl
call .draw_border
pop hl
pop bc
ld de, AttrMap - TileMap
add hl, de
inc b
inc b
inc c
inc c
ld a, $7
.loop
push bc
push hl
.loop2
ld [hli], a
dec c
jr nz, .loop2
pop hl
ld de, SCREEN_WIDTH
add hl, de
pop bc
dec b
jr nz, .loop
ret
; 16d640
.draw_border: ; 16d640
push hl
ld a, $30
ld [hli], a
inc a
call .fill_row
inc a
ld [hl], a
pop hl
ld de, SCREEN_WIDTH
add hl, de
.loop3
push hl
ld a, $33
ld [hli], a
ld a, " "
call .fill_row
ld [hl], $34
pop hl
ld de, SCREEN_WIDTH
add hl, de
dec b
jr nz, .loop3
ld a, $35
ld [hli], a
ld a, $36
call .fill_row
ld [hl], $37
ret
; 16d66d
.fill_row: ; 16d66d
ld d, c
.loop4
ld [hli], a
dec d
jr nz, .loop4
ret
; 16d673
Function16d673: ; 16d673
call Function16d696
call Function16d6ae
callba Function49856
callba Functionfb60d
hlcoord 10, 17
ld de, String_16d68f
call PlaceString
ret
; 16d68f
String_16d68f: ; 16d68f
db "CANCEL@"
; 16d696
Function16d696: ; 16d696
call Function16d421
ret
; 16d69a
Function16d69a: ; 16d69a
ld de, GFX_16cfc1 + $300
ld hl, VTiles2 tile $76
lb bc, BANK(GFX_16cfc1), 8
call Get2bpp
ret
; 16d6a7
Function16d6a7: ; 16d6a7
callba Function49811
ret
; 16d6ae
Function16d6ae: ; 16d6ae
call Function16d42e
ld hl, Tilemap_16d5cd
decoord 0, 0
ld bc, $0028
call CopyBytes
ld hl, Tilemap_16d5f5
decoord 0, 16
ld bc, $0028
call CopyBytes
ret
; 16d6ca
LinkTextbox: ; 16d6ca
call _LinkTextbox
ret
; 16d6ce
Function16d6ce: ; 16d6ce
call LoadStandardMenuDataHeader
call Function16d6e1
callba Function87d
call Call_ExitMenu
call WaitBGMap2
ret
; 16d6e1
Function16d6e1: ; 16d6e1
hlcoord 4, 10
ld b, 1
ld c, 10
predef Predef_LinkTextbox
hlcoord 5, 11
ld de, .Waiting
call PlaceString
call WaitBGMap
call WaitBGMap2
ld c, $32
jp DelayFrames
; 16d701
.Waiting: ; 16d701
db "WAITING..!@"
; 16d70c
Function16d70c: ; 16d70c
call Function16d725
call Function16d713
ret
; 16d713
Function16d713: ; 16d713
push bc
push af
ld a, [hJoyLast]
and $f0
ld b, a
ld a, [hJoyPressed]
and $f
or b
ld b, a
pop af
ld a, b
pop bc
ld d, a
ret
; 16d725
Function16d725: ; 16d725
ld hl, w2DMenuFlags2
res 7, [hl]
ld a, [hBGMapMode]
push af
call Function16d734
pop af
ld [hBGMapMode], a
ret
; 16d734
Function16d734: ; 16d734
.asm_16d734
call Function16d77a
call Function16d759
call Function16d76a
jr nc, .asm_16d758
callba _2DMenuInterpretJoypad
jr c, .asm_16d758
ld a, [w2DMenuFlags1]
bit 7, a
jr nz, .asm_16d758
call Function16d713
ld b, a
ld a, [wMenuJoypadFilter]
and b
jr z, .asm_16d734
.asm_16d758
ret
; 16d759
Function16d759: ; 16d759
ld a, [hOAMUpdate]
push af
ld a, $1
ld [hOAMUpdate], a
call WaitBGMap
pop af
ld [hOAMUpdate], a
xor a
ld [hBGMapMode], a
ret
; 16d76a
Function16d76a: ; 16d76a
.asm_16d76a
call RTC
call Function16d7e7
ret c
ld a, [w2DMenuFlags1]
bit 7, a
jr z, .asm_16d76a
and a
ret
; 16d77a
Function16d77a: ; 16d77a
ld hl, wCursorCurrentTile
ld a, [hli]
ld h, [hl]
ld l, a
ld a, [hl]
cp $1f
jr nz, .asm_16d792
ld a, [wCursorOffCharacter]
ld [hl], a
push hl
push bc
ld bc, $000b
add hl, bc
ld [hl], a
pop bc
pop hl
.asm_16d792
ld a, [w2DMenuCursorInitY]
ld b, a
ld a, [w2DMenuCursorInitX]
ld c, a
call Coord2Tile
ld a, [w2DMenuFlags3]
swap a
and $f
ld c, a
ld a, [wMenuCursorY]
ld b, a
xor a
dec b
jr z, .asm_16d7b1
.asm_16d7ad
add c
dec b
jr nz, .asm_16d7ad
.asm_16d7b1
ld c, $14
call AddNTimes
ld a, [w2DMenuFlags3]
and $f
ld c, a
ld a, [wMenuCursorX]
ld b, a
xor a
dec b
jr z, .asm_16d7c8
.asm_16d7c4
add c
dec b
jr nz, .asm_16d7c4
.asm_16d7c8
ld c, a
add hl, bc
ld a, [hl]
cp $1f
jr z, .asm_16d7de
ld [wCursorOffCharacter], a
ld [hl], $1f
push hl
push bc
ld bc, $000b
add hl, bc
ld [hl], $1f
pop bc
pop hl
.asm_16d7de
ld a, l
ld [wCursorCurrentTile], a
ld a, h
ld [wCursorCurrentTile + 1], a
ret
; 16d7e7
Function16d7e7: ; 16d7e7
ld a, [w2DMenuFlags1]
bit 6, a
jr z, .asm_16d7f4
callba PlaySpriteAnimationsAndDelayFrame
.asm_16d7f4
call JoyTextDelay
call Function16d713
and a
ret z
scf
ret
; 16d7fe

View File

@ -153,7 +153,7 @@ MobileMenu_InitMenuBuffers: ; 4a071 (12:6071)
inc hl inc hl
xor a ; w2DMenuFlags2 xor a ; w2DMenuFlags2
ld [hli], a ld [hli], a
ld a, $20 ; w2DMenuFlags3 ld a, $20 ; w2DMenuCursorOffsets
ld [hli], a ld [hli], a
; this is a stupid way to load $c3 ; this is a stupid way to load $c3
ld a, A_BUTTON ld a, A_BUTTON

View File

@ -514,7 +514,7 @@ Palette_49757: ; 49757
RGB 31, 31, 31 RGB 31, 31, 31
; 49797 ; 49797
Function49797: ; 49797 _InitMG_Mobile_LinkTradePalMap: ; 49797
hlcoord 0, 0, AttrMap hlcoord 0, 0, AttrMap
lb bc, 16, 2 lb bc, 16, 2
ld a, $4 ld a, $4
@ -608,7 +608,7 @@ Palette_49826: ; 49826
RGB 31, 31, 31 RGB 31, 31, 31
; 49856 ; 49856
Function49856: ; 49856 InitMG_Mobile_LinkTradePalMap: ; 49856
call Function49797 call _InitMG_Mobile_LinkTradePalMap
ret ret
; 4985a ; 4985a

View File

@ -87,7 +87,7 @@ Function13a47: ; unreferenced
add hl, bc add hl, bc
ld d, h ld d, h
ld e, l ld e, l
ld hl, MON_EXP + 2 ld hl, MON_STAT_EXP - 1
add hl, bc add hl, bc
ld b, $1 ld b, $1
predef CalcPkmnStats predef CalcPkmnStats

View File

@ -1170,7 +1170,6 @@ wMysteryGiftPartyTemp:: ; ds PARTY_LENGTH * (1 + 1 + NUM_MOVES)
wMysteryGiftStaging:: wMysteryGiftStaging::
wLinkData:: ; ds $514 wLinkData:: ; ds $514
ds 6
wLinkPlayerName:: ds NAME_LENGTH wLinkPlayerName:: ds NAME_LENGTH
wLinkPartyCount:: ds 1 wLinkPartyCount:: ds 1
wLinkPartySpecies:: ds PARTY_LENGTH wLinkPartySpecies:: ds PARTY_LENGTH
@ -1197,8 +1196,8 @@ wLinkPlayerPartyMon5:: party_struct wLinkPlayerPartyMon5
wLinkPlayerPartyMon6:: party_struct wLinkPlayerPartyMon6 wLinkPlayerPartyMon6:: party_struct wLinkPlayerPartyMon6
wLinkPlayerPartyMonOTNames:: ds PARTY_LENGTH * NAME_LENGTH wLinkPlayerPartyMonOTNames:: ds PARTY_LENGTH * NAME_LENGTH
wLinkPlayerPartyMonNicks:: ds PARTY_LENGTH * PKMN_NAME_LENGTH wLinkPlayerPartyMonNicks:: ds PARTY_LENGTH * PKMN_NAME_LENGTH
wLinkPlayerDataEnd::
ds $357 ds $35d
wLinkDataEnd:: wLinkDataEnd::
ds wLinkData - @ ds wLinkData - @
@ -1342,9 +1341,10 @@ wcb59:: ds 20
wcb6d:: ds 1 wcb6d:: ds 1
wcb6e:: ds 22 wcb6e:: ds 22
wcb84:: ds 100 wcb84:: ds 100
wcbe8:: ds 1 wcbe8:: dw
wcbe9:: ds 1 wLinkOTPartyMonTypes::
wcbea:: ds 14 ds 2 * PARTY_LENGTH
ds 2
wcbf8:: ds 2 wcbf8:: ds 2
wcbfa:: ds 1 wcbfa:: ds 1
@ -1625,14 +1625,14 @@ w2DMenuNumRows:: ds 1
w2DMenuNumCols:: ds 1 w2DMenuNumCols:: ds 1
w2DMenuFlags1:: ds 1 w2DMenuFlags1:: ds 1
w2DMenuFlags2:: ds 1 w2DMenuFlags2:: ds 1
w2DMenuFlags3:: ds 1 w2DMenuCursorOffsets:: ds 1
wMenuJoypadFilter:: ds 1 wMenuJoypadFilter:: ds 1
wMenuData3End:: wMenuData3End::
wMenuCursorY:: ds 1 wMenuCursorY:: ds 1
wMenuCursorX:: ds 1 wMenuCursorX:: ds 1
wCursorOffCharacter:: ds 1 wCursorOffCharacter:: ds 1
wCursorCurrentTile:: ds 2 wCursorCurrentTile:: ds 2 ; cfac
ds 3 ds 3
OverworldDelay:: ; cfb1 OverworldDelay:: ; cfb1