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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -5326,7 +5326,7 @@ endr
add hl, bc
ld a, $1
ld c, a
ld b, $0
ld b, FALSE
call CalcPkmnStatC
ld a, [hProduct + 2]
ld [de], a
@ -5716,7 +5716,7 @@ SentGetPkmnIntoFromBox: ; db3f
add hl, bc
ld d, h
ld e, l
ld hl, MON_EXP + 2
ld hl, MON_STAT_EXP - 1
add hl, bc
push bc
@ -6461,7 +6461,7 @@ ComputeNPCTrademonStats: ; e134
ld d, h
ld e, l
push de
ld a, MON_EXP + 2
ld a, MON_STAT_EXP - 1
call GetPartyParamLocation
ld b, $1
call CalcPkmnStats
@ -6478,8 +6478,9 @@ ComputeNPCTrademonStats: ; e134
CalcPkmnStats: ; e167
; 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
; hl is the path to the Stat EXP
; results in $ffb5 and $ffb6 are saved in [de]
ld c, $0
@ -10274,9 +10275,9 @@ LinkMonStatsScreen: ; 4d319
call ClearScreen
call ClearBGPalettes
call MaxVolume
callba Function28ef8
callba LoadTradeScreenBorder
callba Function4d354
callba Function16d673
callba InitTradeSpeciesList
callba Function28eff
call WaitBGMap2
ret
@ -11869,7 +11870,7 @@ _TempMonStatsCalculation: ; 50893
add hl, bc
ld d, h
ld e, l
ld hl, MON_EXP + 2
ld hl, MON_STAT_EXP - 1
add hl, bc
push bc
ld b, $1
@ -15345,6 +15346,7 @@ INCLUDE "misc/battle_tower_47.asm"
SECTION "bank5B", ROMX, BANK[$5B]
INCLUDE "misc/mobile_5b.asm"
INCLUDE "engine/link_trade.asm"
SECTION "bank5C", ROMX, BANK[$5C]

View File

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

View File

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

View File

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

View File

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

View File

@ -866,371 +866,3 @@ Unknown_16cfb9:
GFX_16cfc1:
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
xor a ; w2DMenuFlags2
ld [hli], a
ld a, $20 ; w2DMenuFlags3
ld a, $20 ; w2DMenuCursorOffsets
ld [hli], a
; this is a stupid way to load $c3
ld a, A_BUTTON

View File

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

View File

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

View File

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