2015-12-22 15:03:00 -08:00
|
|
|
LinkCommsBorderGFX:
|
2017-12-09 20:37:08 -08:00
|
|
|
INCBIN "gfx/trade/border_tiles.2bpp"
|
2015-12-22 15:03:00 -08:00
|
|
|
; 16d421
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
__LoadTradeScreenBorder: ; 16d421
|
2015-12-22 15:03:00 -08:00
|
|
|
ld de, LinkCommsBorderGFX
|
2017-12-28 04:32:33 -08:00
|
|
|
ld hl, vTiles2
|
2015-12-22 15:03:00 -08:00
|
|
|
lb bc, BANK(LinkCommsBorderGFX), 70
|
2015-12-21 11:10:16 -08:00
|
|
|
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
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall __LoadTradeScreenBorder ; useless to farcall
|
|
|
|
farcall Function16d42e ; useless to farcall
|
2016-06-06 15:23:00 -07:00
|
|
|
ld b, SCGB_DIPLOMA
|
2015-12-21 11:10:16 -08:00
|
|
|
call GetSGBLayout
|
|
|
|
call SetPalettes
|
|
|
|
call WaitBGMap
|
|
|
|
call JoyWaitAorB
|
|
|
|
call Call_ExitMenu
|
|
|
|
ret
|
|
|
|
; 16d465
|
|
|
|
|
|
|
|
Tilemap_16d465:
|
2017-12-09 20:37:08 -08:00
|
|
|
INCBIN "gfx/trade/border_mobile_fullscreen.tilemap"
|
2015-12-21 11:10:16 -08:00
|
|
|
|
|
|
|
Tilemap_16d5cd:
|
2017-12-09 20:37:08 -08:00
|
|
|
INCBIN "gfx/trade/border_cable_top.tilemap"
|
2015-12-21 11:10:16 -08:00
|
|
|
|
|
|
|
Tilemap_16d5f5:
|
2017-12-09 20:37:08 -08:00
|
|
|
INCBIN "gfx/trade/border_cable_bottom.tilemap"
|
2015-12-21 11:10:16 -08:00
|
|
|
|
|
|
|
_LinkTextbox: ; 16d61d
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
push bc
|
|
|
|
push hl
|
2018-01-16 11:30:10 -08:00
|
|
|
call .PlaceBorder
|
2015-12-21 11:10:16 -08:00
|
|
|
pop hl
|
|
|
|
pop bc
|
|
|
|
|
|
|
|
ld de, AttrMap - TileMap
|
|
|
|
add hl, de
|
|
|
|
inc b
|
|
|
|
inc b
|
|
|
|
inc c
|
|
|
|
inc c
|
2018-01-16 11:30:10 -08:00
|
|
|
ld a, PAL_BG_TEXT
|
2015-12-22 15:03:00 -08:00
|
|
|
.row
|
2015-12-21 11:10:16 -08:00
|
|
|
push bc
|
|
|
|
push hl
|
2015-12-22 15:03:00 -08:00
|
|
|
.col
|
2015-12-21 11:10:16 -08:00
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .col
|
2015-12-21 11:10:16 -08:00
|
|
|
pop hl
|
|
|
|
ld de, SCREEN_WIDTH
|
|
|
|
add hl, de
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .row
|
2015-12-21 11:10:16 -08:00
|
|
|
ret
|
|
|
|
; 16d640
|
|
|
|
|
2018-01-16 11:30:10 -08:00
|
|
|
.PlaceBorder ; 16d640
|
2015-12-21 11:10:16 -08:00
|
|
|
push hl
|
|
|
|
ld a, $30
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
2018-01-16 11:30:10 -08:00
|
|
|
call .PlaceRow
|
2015-12-21 11:10:16 -08:00
|
|
|
inc a
|
|
|
|
ld [hl], a
|
|
|
|
pop hl
|
|
|
|
ld de, SCREEN_WIDTH
|
|
|
|
add hl, de
|
2015-12-22 15:03:00 -08:00
|
|
|
.loop
|
2015-12-21 11:10:16 -08:00
|
|
|
push hl
|
|
|
|
ld a, $33
|
|
|
|
ld [hli], a
|
|
|
|
ld a, " "
|
2018-01-16 11:30:10 -08:00
|
|
|
call .PlaceRow
|
2015-12-21 11:10:16 -08:00
|
|
|
ld [hl], $34
|
|
|
|
pop hl
|
|
|
|
ld de, SCREEN_WIDTH
|
|
|
|
add hl, de
|
|
|
|
dec b
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .loop
|
2015-12-21 11:10:16 -08:00
|
|
|
|
|
|
|
ld a, $35
|
|
|
|
ld [hli], a
|
|
|
|
ld a, $36
|
2018-01-16 11:30:10 -08:00
|
|
|
call .PlaceRow
|
2015-12-21 11:10:16 -08:00
|
|
|
ld [hl], $37
|
|
|
|
ret
|
|
|
|
; 16d66d
|
|
|
|
|
2018-01-16 11:30:10 -08:00
|
|
|
.PlaceRow ; 16d66d
|
2015-12-21 11:10:16 -08:00
|
|
|
ld d, c
|
2018-01-16 11:30:10 -08:00
|
|
|
.row_loop
|
2015-12-21 11:10:16 -08:00
|
|
|
ld [hli], a
|
|
|
|
dec d
|
2018-01-16 11:30:10 -08:00
|
|
|
jr nz, .row_loop
|
2015-12-21 11:10:16 -08:00
|
|
|
ret
|
|
|
|
; 16d673
|
|
|
|
|
|
|
|
InitTradeSpeciesList: ; 16d673
|
|
|
|
call _LoadTradeScreenBorder
|
|
|
|
call Function16d6ae
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall InitMG_Mobile_LinkTradePalMap
|
|
|
|
farcall PlaceTradePartnerNamesAndParty
|
2015-12-21 11:10:16 -08:00
|
|
|
hlcoord 10, 17
|
|
|
|
ld de, .CANCEL
|
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
; 16d68f
|
|
|
|
|
|
|
|
.CANCEL: ; 16d68f
|
|
|
|
db "CANCEL@"
|
|
|
|
; 16d696
|
|
|
|
|
|
|
|
_LoadTradeScreenBorder: ; 16d696
|
|
|
|
call __LoadTradeScreenBorder
|
|
|
|
ret
|
|
|
|
; 16d69a
|
|
|
|
|
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
LinkComms_LoadPleaseWaitTextboxBorderGFX: ; 16d69a
|
|
|
|
ld de, LinkCommsBorderGFX + $30 tiles
|
2018-01-19 11:49:43 -08:00
|
|
|
ld hl, vTiles2 tile "ぁ"
|
2015-12-22 15:03:00 -08:00
|
|
|
lb bc, BANK(LinkCommsBorderGFX), 8
|
2015-12-21 11:10:16 -08:00
|
|
|
call Get2bpp
|
|
|
|
ret
|
|
|
|
; 16d6a7
|
|
|
|
|
2016-05-15 18:50:31 -07:00
|
|
|
LoadTradeRoomBGPals_: ; 16d6a7
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall LoadTradeRoomBGPals
|
2015-12-21 11:10:16 -08:00
|
|
|
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
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall WaitLinkTransfer
|
2015-12-21 11:10:16 -08:00
|
|
|
call Call_ExitMenu
|
|
|
|
call WaitBGMap2
|
|
|
|
ret
|
|
|
|
; 16d6e1
|
|
|
|
|
|
|
|
Function16d6e1: ; 16d6e1
|
|
|
|
hlcoord 4, 10
|
|
|
|
ld b, 1
|
|
|
|
ld c, 10
|
2018-01-16 11:30:10 -08:00
|
|
|
predef LinkTextboxAtHL
|
2015-12-21 11:10:16 -08:00
|
|
|
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
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall _2DMenuInterpretJoypad
|
2015-12-21 11:10:16 -08:00
|
|
|
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
|
2017-12-24 09:47:30 -08:00
|
|
|
farcall PlaySpriteAnimationsAndDelayFrame
|
2015-12-21 11:10:16 -08:00
|
|
|
.skip_anims
|
|
|
|
call JoyTextDelay
|
|
|
|
call .GetJoypad
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
; 16d7fe
|