2015-12-22 23:03:00 +00:00
|
|
|
LinkCommsBorderGFX:
|
2017-12-10 04:37:08 +00:00
|
|
|
INCBIN "gfx/trade/border_tiles.2bpp"
|
2015-12-22 23:03:00 +00:00
|
|
|
|
2020-10-23 17:36:54 +00:00
|
|
|
__LoadTradeScreenBorderGFX:
|
2015-12-22 23:03:00 +00:00
|
|
|
ld de, LinkCommsBorderGFX
|
2017-12-28 12:32:33 +00:00
|
|
|
ld hl, vTiles2
|
2015-12-22 23:03:00 +00:00
|
|
|
lb bc, BANK(LinkCommsBorderGFX), 70
|
2015-12-21 19:10:16 +00:00
|
|
|
call Get2bpp
|
|
|
|
ret
|
|
|
|
|
2020-11-01 17:36:38 +00:00
|
|
|
LoadMobileTradeBorderTilemap:
|
|
|
|
ld hl, MobileTradeBorderTilemap
|
2015-12-21 19:10:16 +00:00
|
|
|
decoord 0, 0
|
|
|
|
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
|
|
|
|
call CopyBytes
|
|
|
|
ret
|
|
|
|
|
2020-11-01 17:36:38 +00:00
|
|
|
TestMobileTradeBorderTilemap: ; unreferenced
|
|
|
|
; Loads the mobile trade border graphics and tilemap,
|
|
|
|
; with a placeholder SCGB_DIPLOMA layout, and exits
|
|
|
|
; after pressing A or B. Possibly used for testing.
|
2018-01-23 21:08:43 +00:00
|
|
|
call LoadStandardMenuHeader
|
2015-12-21 19:10:16 +00:00
|
|
|
call ClearBGPalettes
|
2020-02-13 17:30:13 +00:00
|
|
|
call ClearTilemap
|
2015-12-21 19:10:16 +00:00
|
|
|
call ClearSprites
|
2020-10-23 17:36:54 +00:00
|
|
|
farcall __LoadTradeScreenBorderGFX ; useless to farcall
|
2020-11-01 17:36:38 +00:00
|
|
|
farcall LoadMobileTradeBorderTilemap ; useless to farcall
|
2016-06-06 22:23:00 +00:00
|
|
|
ld b, SCGB_DIPLOMA
|
2015-12-21 19:10:16 +00:00
|
|
|
call GetSGBLayout
|
|
|
|
call SetPalettes
|
|
|
|
call WaitBGMap
|
|
|
|
call JoyWaitAorB
|
|
|
|
call Call_ExitMenu
|
|
|
|
ret
|
|
|
|
|
2020-11-01 17:36:38 +00:00
|
|
|
MobileTradeBorderTilemap:
|
|
|
|
INCBIN "gfx/trade/border_mobile.tilemap"
|
2015-12-21 19:10:16 +00:00
|
|
|
|
2020-11-01 17:36:38 +00:00
|
|
|
CableTradeBorderTopTilemap:
|
2017-12-10 04:37:08 +00:00
|
|
|
INCBIN "gfx/trade/border_cable_top.tilemap"
|
2015-12-21 19:10:16 +00:00
|
|
|
|
2020-11-01 17:36:38 +00:00
|
|
|
CableTradeBorderBottomTilemap:
|
2017-12-10 04:37:08 +00:00
|
|
|
INCBIN "gfx/trade/border_cable_bottom.tilemap"
|
2015-12-21 19:10:16 +00:00
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
_LinkTextbox:
|
2015-12-21 19:10:16 +00:00
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
push bc
|
|
|
|
push hl
|
2018-01-16 19:30:10 +00:00
|
|
|
call .PlaceBorder
|
2015-12-21 19:10:16 +00:00
|
|
|
pop hl
|
|
|
|
pop bc
|
|
|
|
|
2020-02-13 17:30:13 +00:00
|
|
|
ld de, wAttrmap - wTilemap
|
2015-12-21 19:10:16 +00:00
|
|
|
add hl, de
|
|
|
|
inc b
|
|
|
|
inc b
|
|
|
|
inc c
|
|
|
|
inc c
|
2018-01-16 19:30:10 +00:00
|
|
|
ld a, PAL_BG_TEXT
|
2015-12-22 23:03:00 +00:00
|
|
|
.row
|
2015-12-21 19:10:16 +00:00
|
|
|
push bc
|
|
|
|
push hl
|
2015-12-22 23:03:00 +00:00
|
|
|
.col
|
2015-12-21 19:10:16 +00:00
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-12-22 23:03:00 +00:00
|
|
|
jr nz, .col
|
2015-12-21 19:10:16 +00:00
|
|
|
pop hl
|
|
|
|
ld de, SCREEN_WIDTH
|
|
|
|
add hl, de
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-12-22 23:03:00 +00:00
|
|
|
jr nz, .row
|
2015-12-21 19:10:16 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.PlaceBorder
|
2015-12-21 19:10:16 +00:00
|
|
|
push hl
|
|
|
|
ld a, $30
|
|
|
|
ld [hli], a
|
|
|
|
inc a
|
2018-01-16 19:30:10 +00:00
|
|
|
call .PlaceRow
|
2015-12-21 19:10:16 +00:00
|
|
|
inc a
|
|
|
|
ld [hl], a
|
|
|
|
pop hl
|
|
|
|
ld de, SCREEN_WIDTH
|
|
|
|
add hl, de
|
2015-12-22 23:03:00 +00:00
|
|
|
.loop
|
2015-12-21 19:10:16 +00:00
|
|
|
push hl
|
|
|
|
ld a, $33
|
|
|
|
ld [hli], a
|
|
|
|
ld a, " "
|
2018-01-16 19:30:10 +00:00
|
|
|
call .PlaceRow
|
2015-12-21 19:10:16 +00:00
|
|
|
ld [hl], $34
|
|
|
|
pop hl
|
|
|
|
ld de, SCREEN_WIDTH
|
|
|
|
add hl, de
|
|
|
|
dec b
|
2015-12-22 23:03:00 +00:00
|
|
|
jr nz, .loop
|
2015-12-21 19:10:16 +00:00
|
|
|
|
|
|
|
ld a, $35
|
|
|
|
ld [hli], a
|
|
|
|
ld a, $36
|
2018-01-16 19:30:10 +00:00
|
|
|
call .PlaceRow
|
2015-12-21 19:10:16 +00:00
|
|
|
ld [hl], $37
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.PlaceRow
|
2015-12-21 19:10:16 +00:00
|
|
|
ld d, c
|
2018-01-16 19:30:10 +00:00
|
|
|
.row_loop
|
2015-12-21 19:10:16 +00:00
|
|
|
ld [hli], a
|
|
|
|
dec d
|
2018-01-16 19:30:10 +00:00
|
|
|
jr nz, .row_loop
|
2015-12-21 19:10:16 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
InitTradeSpeciesList:
|
2020-10-23 17:36:54 +00:00
|
|
|
call _LoadTradeScreenBorderGFX
|
2020-11-01 17:36:38 +00:00
|
|
|
call LoadCableTradeBorderTilemap
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall InitMG_Mobile_LinkTradePalMap
|
|
|
|
farcall PlaceTradePartnerNamesAndParty
|
2015-12-21 19:10:16 +00:00
|
|
|
hlcoord 10, 17
|
2020-05-29 11:16:49 +00:00
|
|
|
ld de, .CancelString
|
2015-12-21 19:10:16 +00:00
|
|
|
call PlaceString
|
|
|
|
ret
|
|
|
|
|
2020-05-29 11:16:49 +00:00
|
|
|
.CancelString:
|
2015-12-21 19:10:16 +00:00
|
|
|
db "CANCEL@"
|
|
|
|
|
2020-10-23 17:36:54 +00:00
|
|
|
_LoadTradeScreenBorderGFX:
|
|
|
|
call __LoadTradeScreenBorderGFX
|
2015-12-21 19:10:16 +00:00
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
LinkComms_LoadPleaseWaitTextboxBorderGFX:
|
2015-12-22 23:03:00 +00:00
|
|
|
ld de, LinkCommsBorderGFX + $30 tiles
|
2018-01-20 01:48:33 +00:00
|
|
|
ld hl, vTiles2 tile $76
|
2015-12-22 23:03:00 +00:00
|
|
|
lb bc, BANK(LinkCommsBorderGFX), 8
|
2015-12-21 19:10:16 +00:00
|
|
|
call Get2bpp
|
|
|
|
ret
|
|
|
|
|
2018-07-23 04:13:43 +00:00
|
|
|
LoadTradeRoomBGPals:
|
|
|
|
farcall _LoadTradeRoomBGPals
|
2015-12-21 19:10:16 +00:00
|
|
|
ret
|
|
|
|
|
2020-11-01 17:36:38 +00:00
|
|
|
LoadCableTradeBorderTilemap:
|
|
|
|
call LoadMobileTradeBorderTilemap
|
|
|
|
ld hl, CableTradeBorderTopTilemap
|
2015-12-21 19:10:16 +00:00
|
|
|
decoord 0, 0
|
|
|
|
ld bc, 2 * SCREEN_WIDTH
|
|
|
|
call CopyBytes
|
2020-11-01 17:36:38 +00:00
|
|
|
ld hl, CableTradeBorderBottomTilemap
|
2015-12-21 19:10:16 +00:00
|
|
|
decoord 0, 16
|
|
|
|
ld bc, 2 * SCREEN_WIDTH
|
|
|
|
call CopyBytes
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
LinkTextbox:
|
2015-12-21 19:10:16 +00:00
|
|
|
call _LinkTextbox
|
|
|
|
ret
|
|
|
|
|
2020-10-29 19:15:14 +00:00
|
|
|
PrintWaitingTextAndSyncAndExchangeNybble:
|
2018-01-23 21:08:43 +00:00
|
|
|
call LoadStandardMenuHeader
|
2020-10-29 19:15:14 +00:00
|
|
|
call .PrintWaitingText
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall WaitLinkTransfer
|
2015-12-21 19:10:16 +00:00
|
|
|
call Call_ExitMenu
|
|
|
|
call WaitBGMap2
|
|
|
|
ret
|
|
|
|
|
2020-10-29 19:15:14 +00:00
|
|
|
.PrintWaitingText:
|
2015-12-21 19:10:16 +00:00
|
|
|
hlcoord 4, 10
|
|
|
|
ld b, 1
|
|
|
|
ld c, 10
|
2018-01-16 19:30:10 +00:00
|
|
|
predef LinkTextboxAtHL
|
2015-12-21 19:10:16 +00:00
|
|
|
hlcoord 5, 11
|
|
|
|
ld de, .Waiting
|
|
|
|
call PlaceString
|
|
|
|
call WaitBGMap
|
|
|
|
call WaitBGMap2
|
|
|
|
ld c, 50
|
|
|
|
jp DelayFrames
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.Waiting:
|
2015-12-21 19:10:16 +00:00
|
|
|
db "WAITING..!@"
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
LinkTradeMenu:
|
2015-12-21 19:10:16 +00:00
|
|
|
call .MenuAction
|
|
|
|
call .GetJoypad
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.GetJoypad:
|
2015-12-21 19:10:16 +00:00
|
|
|
push bc
|
|
|
|
push af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hJoyLast]
|
2015-12-21 19:10:16 +00:00
|
|
|
and D_PAD
|
|
|
|
ld b, a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hJoyPressed]
|
2015-12-21 19:10:16 +00:00
|
|
|
and BUTTONS
|
|
|
|
or b
|
|
|
|
ld b, a
|
|
|
|
pop af
|
|
|
|
ld a, b
|
|
|
|
pop bc
|
|
|
|
ld d, a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.MenuAction:
|
2015-12-21 19:10:16 +00:00
|
|
|
ld hl, w2DMenuFlags2
|
|
|
|
res 7, [hl]
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hBGMapMode]
|
2015-12-21 19:10:16 +00:00
|
|
|
push af
|
|
|
|
call .loop
|
|
|
|
pop af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2015-12-21 19:10:16 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
.loop
|
|
|
|
call .UpdateCursor
|
|
|
|
call .UpdateBGMapAndOAM
|
|
|
|
call .loop2
|
|
|
|
jr nc, .done
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall _2DMenuInterpretJoypad
|
2015-12-21 19:10:16 +00: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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.UpdateBGMapAndOAM:
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh a, [hOAMUpdate]
|
2015-12-21 19:10:16 +00:00
|
|
|
push af
|
|
|
|
ld a, $1
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hOAMUpdate], a
|
2015-12-21 19:10:16 +00:00
|
|
|
call WaitBGMap
|
|
|
|
pop af
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hOAMUpdate], a
|
2015-12-21 19:10:16 +00:00
|
|
|
xor a
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [hBGMapMode], a
|
2015-12-21 19:10:16 +00:00
|
|
|
ret
|
|
|
|
|
|
|
|
.loop2
|
2020-02-19 18:08:40 +00:00
|
|
|
call UpdateTimeAndPals
|
2015-12-21 19:10:16 +00:00
|
|
|
call .TryAnims
|
|
|
|
ret c
|
|
|
|
ld a, [w2DMenuFlags1]
|
|
|
|
bit 7, a
|
|
|
|
jr z, .loop2
|
|
|
|
and a
|
|
|
|
ret
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.UpdateCursor:
|
2015-12-21 19:10:16 +00:00
|
|
|
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
|
2018-01-20 17:25:55 +00:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2015-12-21 19:10:16 +00:00
|
|
|
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
|
2018-01-20 17:25:55 +00:00
|
|
|
ld bc, MON_NAME_LENGTH
|
2015-12-21 19:10:16 +00:00
|
|
|
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
|
|
|
|
|
2018-06-24 14:09:41 +00:00
|
|
|
.TryAnims:
|
2015-12-21 19:10:16 +00:00
|
|
|
ld a, [w2DMenuFlags1]
|
|
|
|
bit 6, a
|
|
|
|
jr z, .skip_anims
|
2017-12-24 17:47:30 +00:00
|
|
|
farcall PlaySpriteAnimationsAndDelayFrame
|
2015-12-21 19:10:16 +00:00
|
|
|
.skip_anims
|
|
|
|
call JoyTextDelay
|
|
|
|
call .GetJoypad
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
scf
|
|
|
|
ret
|