2015-11-09 20:55:39 -08:00
|
|
|
LinkCommunications: ; 28000
|
2015-11-11 20:38:57 -08:00
|
|
|
call ClearBGPalettes
|
|
|
|
ld c, 80
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
|
|
|
call ClearScreen
|
|
|
|
call ClearSprites
|
|
|
|
call UpdateSprites
|
|
|
|
xor a
|
|
|
|
ld [hSCX], a
|
|
|
|
ld [hSCY], a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld c, 80
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
|
|
|
call ClearScreen
|
|
|
|
call UpdateSprites
|
|
|
|
call LoadStandardFont
|
|
|
|
call LoadFontsBattleExtra
|
2015-12-22 15:03:00 -08:00
|
|
|
callba LinkComms_LoadPleaseWaitTextboxBorderGFX
|
2015-12-11 13:59:40 -08:00
|
|
|
call WaitBGMap2
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 3, 8
|
2015-12-20 09:54:08 -08:00
|
|
|
ld b, 2
|
|
|
|
ld c, 12
|
2015-11-09 20:55:39 -08:00
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2015-12-22 15:03:00 -08:00
|
|
|
callba LinkTextbox2
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 4, 10
|
2015-12-20 09:54:08 -08:00
|
|
|
ld de, String_PleaseWait
|
2015-11-09 20:55:39 -08:00
|
|
|
call PlaceString
|
|
|
|
call Function28eff
|
2015-12-11 13:59:40 -08:00
|
|
|
call WaitBGMap2
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wcf5d
|
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], $50
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_TIMECAPSULE
|
2015-12-20 09:54:08 -08:00
|
|
|
jp nz, Gen2ToGen2LinkComms
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
TimeCapsule: ; 2805d
|
|
|
|
call ClearLinkData
|
|
|
|
call Link_PrepPartyData_Gen1
|
2015-12-22 15:03:00 -08:00
|
|
|
call FixDataForLinkTransfer
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
call Function87d
|
|
|
|
ld a, [hLinkPlayerNumber]
|
|
|
|
cp $2
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, .player_1
|
2015-12-22 15:03:00 -08:00
|
|
|
ld c, 3
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
|
|
|
xor a
|
|
|
|
ld [hSerialSend], a
|
|
|
|
ld a, $1
|
|
|
|
ld [rSC], a
|
|
|
|
ld a, $81
|
|
|
|
ld [rSC], a
|
|
|
|
call DelayFrame
|
|
|
|
xor a
|
|
|
|
ld [hSerialSend], a
|
|
|
|
ld a, $1
|
|
|
|
ld [rSC], a
|
|
|
|
ld a, $81
|
|
|
|
ld [rSC], a
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.player_1
|
2015-11-09 20:55:39 -08:00
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
ld c, $3
|
|
|
|
call DelayFrames
|
|
|
|
xor a
|
|
|
|
ld [rIF], a
|
|
|
|
ld a, $8
|
|
|
|
ld [rIE], a
|
|
|
|
ld hl, wd1f3
|
|
|
|
ld de, EnemyMonSpecies
|
|
|
|
ld bc, $11
|
|
|
|
call Function75f
|
|
|
|
ld a, $fe
|
|
|
|
ld [de], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld hl, wLinkData
|
|
|
|
ld de, OTPlayerName
|
2015-12-21 11:10:16 -08:00
|
|
|
ld bc, $1a8
|
2015-11-09 20:55:39 -08:00
|
|
|
call Function75f
|
|
|
|
ld a, $fe
|
|
|
|
ld [de], a
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, wMisc
|
2015-11-22 21:21:21 -08:00
|
|
|
ld de, wPlayerTrademonSpecies
|
2015-12-21 11:10:16 -08:00
|
|
|
ld bc, wPlayerTrademonSpecies - wMisc
|
2015-11-09 20:55:39 -08:00
|
|
|
call Function75f
|
|
|
|
xor a
|
|
|
|
ld [rIF], a
|
|
|
|
ld a, $1d
|
|
|
|
ld [rIE], a
|
2015-12-22 15:03:00 -08:00
|
|
|
call Link_CopyRandomNumbers
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, OTPlayerName
|
|
|
|
call Link_FindFirstNonControlCharacter_SkipZero
|
2015-11-09 20:55:39 -08:00
|
|
|
push hl
|
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
pop hl
|
|
|
|
and a
|
|
|
|
jp z, Function28b22
|
|
|
|
cp $7
|
|
|
|
jp nc, Function28b22
|
2015-12-20 09:54:08 -08:00
|
|
|
ld de, wLinkData
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, $1a2
|
2015-12-21 11:10:16 -08:00
|
|
|
call Link_CopyOTData
|
2015-11-22 21:21:21 -08:00
|
|
|
ld de, wPlayerTrademonSpecies
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, wTimeCapsulePartyMon1Species
|
2015-11-09 20:55:39 -08:00
|
|
|
ld c, $2
|
2015-12-21 11:10:16 -08:00
|
|
|
.loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
and a
|
2015-12-21 11:10:16 -08:00
|
|
|
jr z, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $fd
|
2015-12-21 11:10:16 -08:00
|
|
|
jr z, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $fe
|
2015-12-21 11:10:16 -08:00
|
|
|
jr z, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $ff
|
2015-12-21 11:10:16 -08:00
|
|
|
jr z, .next
|
2015-11-09 20:55:39 -08:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld b, $0
|
|
|
|
dec a
|
|
|
|
ld c, a
|
|
|
|
add hl, bc
|
|
|
|
ld a, $fe
|
|
|
|
ld [hl], a
|
|
|
|
pop bc
|
|
|
|
pop hl
|
2015-12-21 11:10:16 -08:00
|
|
|
jr .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.next
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wc90f
|
|
|
|
dec c
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, .loop
|
|
|
|
ld hl, wLinkPlayerName
|
|
|
|
ld de, OTPlayerName
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
ld de, OTPartyCount
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-21 11:10:16 -08:00
|
|
|
.party_loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hli]
|
2015-12-21 11:10:16 -08:00
|
|
|
cp -1
|
|
|
|
jr z, .done_party
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [wd265], a
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
callab ConvertMon_1to2
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ld a, [wd265]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-21 11:10:16 -08:00
|
|
|
jr .party_loop
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.done_party
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [de], a
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, wTimeCapsulePartyMon1Species
|
2015-11-09 20:55:39 -08:00
|
|
|
call Function2868a
|
|
|
|
ld a, OTPartyMonOT % $100
|
|
|
|
ld [wd102], a
|
|
|
|
ld a, OTPartyMonOT / $100
|
|
|
|
ld [wd103], a
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
ld a, [hLinkPlayerNumber]
|
|
|
|
cp $2
|
|
|
|
ld c, 66
|
|
|
|
call z, DelayFrames
|
|
|
|
ld de, MUSIC_ROUTE_30
|
|
|
|
call PlayMusic
|
2015-12-21 11:10:16 -08:00
|
|
|
jp InitTradeMenuDisplay
|
2015-11-09 20:55:39 -08:00
|
|
|
; 28177
|
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
Gen2ToGen2LinkComms: ; 28177
|
|
|
|
call ClearLinkData
|
|
|
|
call Link_PrepPartyData_Gen2
|
2015-12-22 15:03:00 -08:00
|
|
|
call FixDataForLinkTransfer
|
2015-11-09 20:55:39 -08:00
|
|
|
call Function29dba
|
|
|
|
ld a, [ScriptVar]
|
|
|
|
and a
|
2016-01-04 05:43:55 -08:00
|
|
|
jp z, LinkTimeout
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hLinkPlayerNumber]
|
|
|
|
cp $2
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .Player1
|
2015-12-20 09:54:08 -08:00
|
|
|
ld c, 3
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
|
|
|
xor a
|
|
|
|
ld [hSerialSend], a
|
|
|
|
ld a, $1
|
|
|
|
ld [rSC], a
|
|
|
|
ld a, $81
|
|
|
|
ld [rSC], a
|
|
|
|
call DelayFrame
|
|
|
|
xor a
|
|
|
|
ld [hSerialSend], a
|
|
|
|
ld a, $1
|
|
|
|
ld [rSC], a
|
|
|
|
ld a, $81
|
|
|
|
ld [rSC], a
|
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
.Player1
|
2015-11-09 20:55:39 -08:00
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
2015-12-20 09:54:08 -08:00
|
|
|
ld c, 3
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
|
|
|
xor a
|
|
|
|
ld [rIF], a
|
|
|
|
ld a, $8
|
|
|
|
ld [rIE], a
|
|
|
|
ld hl, wd1f3
|
|
|
|
ld de, EnemyMonSpecies
|
|
|
|
ld bc, $11
|
|
|
|
call Function75f
|
|
|
|
ld a, $fe
|
|
|
|
ld [de], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld hl, wLinkData
|
2015-12-21 11:10:16 -08:00
|
|
|
ld de, OTPlayerName
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, $1c2
|
|
|
|
call Function75f
|
|
|
|
ld a, $fe
|
|
|
|
ld [de], a
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, wMisc
|
2015-11-22 21:21:21 -08:00
|
|
|
ld de, wPlayerTrademonSpecies
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, $c8
|
|
|
|
call Function75f
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_TRADECENTER
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .not_trading
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wc9f4
|
|
|
|
ld de, wcb84
|
|
|
|
ld bc, $186
|
|
|
|
call Function283f2
|
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
.not_trading
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [rIF], a
|
|
|
|
ld a, $1d
|
|
|
|
ld [rIE], a
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
2015-12-22 15:03:00 -08:00
|
|
|
call Link_CopyRandomNumbers
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, OTPlayerName
|
|
|
|
call Link_FindFirstNonControlCharacter_SkipZero
|
2015-12-20 09:54:08 -08:00
|
|
|
ld de, wLinkData
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, $1b9
|
2015-12-21 11:10:16 -08:00
|
|
|
call Link_CopyOTData
|
2015-11-22 21:21:21 -08:00
|
|
|
ld de, wPlayerTrademonSpecies
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, wLinkPlayerPartyMon1Species
|
2015-11-09 20:55:39 -08:00
|
|
|
ld c, $2
|
2015-12-22 15:03:00 -08:00
|
|
|
.loop1
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
and a
|
2015-12-22 15:03:00 -08:00
|
|
|
jr z, .loop1
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $fd
|
2015-12-22 15:03:00 -08:00
|
|
|
jr z, .loop1
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $fe
|
2015-12-22 15:03:00 -08:00
|
|
|
jr z, .loop1
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $ff
|
2015-12-22 15:03:00 -08:00
|
|
|
jr z, .next1
|
2015-11-09 20:55:39 -08:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld b, $0
|
|
|
|
dec a
|
|
|
|
ld c, a
|
|
|
|
add hl, bc
|
|
|
|
ld a, $fe
|
|
|
|
ld [hl], a
|
|
|
|
pop bc
|
|
|
|
pop hl
|
2015-12-22 15:03:00 -08:00
|
|
|
jr .loop1
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
.next1
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wc90f
|
|
|
|
dec c
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .loop1
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_TRADECENTER
|
2015-12-22 15:03:00 -08:00
|
|
|
jp nz, .skip_mail
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wcb84
|
2015-12-22 15:03:00 -08:00
|
|
|
.loop2
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hli]
|
|
|
|
cp $20
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .loop2
|
|
|
|
.loop3
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hli]
|
|
|
|
cp $fe
|
2015-12-22 15:03:00 -08:00
|
|
|
jr z, .loop3
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $20
|
2015-12-22 15:03:00 -08:00
|
|
|
jr z, .loop3
|
2015-11-09 20:55:39 -08:00
|
|
|
dec hl
|
|
|
|
ld de, wcb84
|
2015-12-22 15:03:00 -08:00
|
|
|
ld bc, $190 ; 400
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
|
|
|
ld hl, wcb84
|
2015-12-22 15:03:00 -08:00
|
|
|
ld bc, $c6 ; 198
|
|
|
|
.loop4
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hl]
|
|
|
|
cp $21
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .okay1
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [hl], $fe
|
2015-12-22 15:03:00 -08:00
|
|
|
.okay1
|
2015-11-09 20:55:39 -08:00
|
|
|
inc hl
|
|
|
|
dec bc
|
|
|
|
ld a, b
|
|
|
|
or c
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .loop4
|
2015-11-09 20:55:39 -08:00
|
|
|
ld de, wcc9e
|
2015-12-22 15:03:00 -08:00
|
|
|
.loop5
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
cp $ff
|
2015-12-22 15:03:00 -08:00
|
|
|
jr z, .start_copying_mail
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wcc4a
|
|
|
|
dec a
|
|
|
|
ld b, $0
|
|
|
|
ld c, a
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], $fe
|
2015-12-22 15:03:00 -08:00
|
|
|
jr .loop5
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
.start_copying_mail
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wcb84
|
|
|
|
ld de, wc9f4
|
2015-12-22 15:03:00 -08:00
|
|
|
ld b, PARTY_LENGTH
|
|
|
|
.copy_mail_loop
|
2015-11-09 20:55:39 -08:00
|
|
|
push bc
|
2015-12-22 15:03:00 -08:00
|
|
|
ld bc, MAIL_MSG_LENGTH + 1
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
2015-12-22 15:03:00 -08:00
|
|
|
ld a, (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) % $100
|
2015-11-09 20:55:39 -08:00
|
|
|
add e
|
|
|
|
ld e, a
|
2015-12-22 15:03:00 -08:00
|
|
|
ld a, (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) / $100
|
2015-11-09 20:55:39 -08:00
|
|
|
adc d
|
|
|
|
ld d, a
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .copy_mail_loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ld de, wc9f4
|
2015-12-22 15:03:00 -08:00
|
|
|
ld b, PARTY_LENGTH
|
|
|
|
.copy_author_loop
|
2015-11-09 20:55:39 -08:00
|
|
|
push bc
|
2015-12-22 15:03:00 -08:00
|
|
|
ld a, (MAIL_MSG_LENGTH + 1) % $100
|
2015-11-09 20:55:39 -08:00
|
|
|
add e
|
|
|
|
ld e, a
|
2015-12-22 15:03:00 -08:00
|
|
|
ld a, (MAIL_MSG_LENGTH + 1) / $100
|
2015-11-09 20:55:39 -08:00
|
|
|
adc d
|
|
|
|
ld d, a
|
2015-12-22 15:03:00 -08:00
|
|
|
ld bc, MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .copy_author_loop
|
|
|
|
ld b, PARTY_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
ld de, wc9f4
|
2015-12-22 15:03:00 -08:00
|
|
|
.fix_mail_loop
|
2015-11-09 20:55:39 -08:00
|
|
|
push bc
|
|
|
|
push de
|
2015-11-22 09:01:58 -08:00
|
|
|
callba IsMailEuropean
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, c
|
|
|
|
or a
|
2015-11-22 09:01:58 -08:00
|
|
|
jr z, .next
|
2015-11-09 20:55:39 -08:00
|
|
|
sub $3
|
2015-11-22 09:01:58 -08:00
|
|
|
jr nc, .skip
|
|
|
|
callba DeutenEnglischenPost
|
|
|
|
jr .next
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-11-22 09:01:58 -08:00
|
|
|
.skip
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $2
|
2015-11-22 09:01:58 -08:00
|
|
|
jr nc, .next
|
|
|
|
callba HandleSpanishItalianMail
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-11-22 09:01:58 -08:00
|
|
|
.next
|
2015-11-09 20:55:39 -08:00
|
|
|
pop de
|
2015-11-22 09:01:58 -08:00
|
|
|
ld hl, MAIL_STRUCT_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, de
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .fix_mail_loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ld de, wcb0e
|
|
|
|
xor a
|
|
|
|
ld [de], a
|
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
.skip_mail
|
2015-12-20 09:54:08 -08:00
|
|
|
ld hl, wLinkData
|
2015-12-21 11:10:16 -08:00
|
|
|
ld de, OTPlayerName
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
ld de, OTPartyCount
|
|
|
|
ld bc, 8
|
|
|
|
call CopyBytes
|
2016-01-04 05:43:55 -08:00
|
|
|
ld de, OTPlayerID
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, 2
|
|
|
|
call CopyBytes
|
2016-01-04 05:43:55 -08:00
|
|
|
ld de, OTPartyMons
|
|
|
|
ld bc, OTPartyDataEnd - OTPartyMons
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
|
|
|
ld a, OTPartyMonOT % $100
|
|
|
|
ld [wd102], a
|
|
|
|
ld a, OTPartyMonOT / $100
|
|
|
|
ld [wd103], a
|
|
|
|
ld de, MUSIC_NONE
|
|
|
|
call PlayMusic
|
|
|
|
ld a, [hLinkPlayerNumber]
|
|
|
|
cp $2
|
|
|
|
ld c, 66
|
|
|
|
call z, DelayFrames
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_COLOSSEUM
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .ready_to_trade
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, CAL
|
|
|
|
ld [OtherTrainerClass], a
|
|
|
|
call ClearScreen
|
2016-01-04 05:43:55 -08:00
|
|
|
callba Link_WaitBGMap
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, Options
|
|
|
|
ld a, [hl]
|
|
|
|
push af
|
|
|
|
and $20
|
|
|
|
or $3
|
|
|
|
ld [hl], a
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, OTPlayerName
|
2016-01-17 21:39:01 -08:00
|
|
|
ld de, OTClassName
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
2015-11-11 20:38:57 -08:00
|
|
|
call ReturnToMapFromSubmenu
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [wc2d7]
|
|
|
|
push af
|
|
|
|
ld a, $1
|
|
|
|
ld [wc2d7], a
|
|
|
|
ld a, [rIE]
|
|
|
|
push af
|
|
|
|
ld a, [rIF]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [rIF], a
|
|
|
|
ld a, [rIE]
|
|
|
|
set 1, a
|
|
|
|
ld [rIE], a
|
|
|
|
pop af
|
|
|
|
ld [rIF], a
|
|
|
|
predef StartBattle
|
|
|
|
ld a, [rIF]
|
|
|
|
ld h, a
|
|
|
|
xor a
|
|
|
|
ld [rIF], a
|
|
|
|
pop af
|
|
|
|
ld [rIE], a
|
|
|
|
ld a, h
|
|
|
|
ld [rIF], a
|
|
|
|
pop af
|
|
|
|
ld [wc2d7], a
|
|
|
|
pop af
|
|
|
|
ld [Options], a
|
|
|
|
callba LoadPokemonData
|
|
|
|
jp Function28b22
|
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
.ready_to_trade
|
2015-11-09 20:55:39 -08:00
|
|
|
ld de, MUSIC_ROUTE_30
|
|
|
|
call PlayMusic
|
2015-12-21 11:10:16 -08:00
|
|
|
jp InitTradeMenuDisplay
|
2015-11-09 20:55:39 -08:00
|
|
|
; 283b2
|
|
|
|
|
2016-01-04 05:43:55 -08:00
|
|
|
LinkTimeout: ; 283b2
|
2015-12-20 09:54:08 -08:00
|
|
|
ld de, .TooMuchTimeHasElapsed
|
2016-01-04 05:43:55 -08:00
|
|
|
ld b, 10
|
2015-12-20 09:54:08 -08:00
|
|
|
.loop
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrame
|
2015-12-01 18:54:11 -08:00
|
|
|
call LinkDataReceived
|
2015-11-09 20:55:39 -08:00
|
|
|
dec b
|
2015-12-20 09:54:08 -08:00
|
|
|
jr nz, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [hld], a
|
|
|
|
ld [hl], a
|
|
|
|
ld [hVBlank], a
|
|
|
|
push de
|
|
|
|
hlcoord 0, 12
|
2015-12-20 09:54:08 -08:00
|
|
|
ld b, 4
|
|
|
|
ld c, 18
|
2015-11-09 20:55:39 -08:00
|
|
|
push de
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2015-12-22 15:03:00 -08:00
|
|
|
callba LinkTextbox2
|
2015-11-09 20:55:39 -08:00
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
bccoord 1, 14
|
|
|
|
call PlaceWholeStringInBoxAtOnce
|
2015-11-20 08:47:52 -08:00
|
|
|
call RotateThreePalettesRight
|
2015-11-09 20:55:39 -08:00
|
|
|
call ClearScreen
|
2015-11-20 12:15:32 -08:00
|
|
|
ld b, SCGB_08
|
2015-11-09 20:55:39 -08:00
|
|
|
call GetSGBLayout
|
2015-12-11 13:59:40 -08:00
|
|
|
call WaitBGMap2
|
2015-11-09 20:55:39 -08:00
|
|
|
ret
|
|
|
|
; 283ed
|
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
.TooMuchTimeHasElapsed: ; 0x283ed
|
2015-11-09 20:55:39 -08:00
|
|
|
; Too much time has elapsed. Please try again.
|
|
|
|
text_jump UnknownText_0x1c4183
|
|
|
|
db "@"
|
|
|
|
; 0x283f2
|
|
|
|
|
|
|
|
Function283f2: ; 283f2
|
|
|
|
ld a, $1
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hFFCC], a
|
2015-12-22 15:03:00 -08:00
|
|
|
.loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hl]
|
|
|
|
ld [hSerialSend], a
|
|
|
|
call Function78a
|
|
|
|
push bc
|
|
|
|
ld b, a
|
|
|
|
inc hl
|
|
|
|
ld a, $30
|
2015-12-22 15:03:00 -08:00
|
|
|
.delay_cycles
|
2015-11-09 20:55:39 -08:00
|
|
|
dec a
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .delay_cycles
|
2015-11-11 20:38:57 -08:00
|
|
|
ld a, [hFFCC]
|
2015-11-09 20:55:39 -08:00
|
|
|
and a
|
|
|
|
ld a, b
|
|
|
|
pop bc
|
2015-12-22 15:03:00 -08:00
|
|
|
jr z, .load
|
2015-11-09 20:55:39 -08:00
|
|
|
dec hl
|
|
|
|
xor a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hFFCC], a
|
2015-12-22 15:03:00 -08:00
|
|
|
jr .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
.load
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec bc
|
|
|
|
ld a, b
|
|
|
|
or c
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ret
|
|
|
|
; 28419
|
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
String_PleaseWait: ; 28419
|
2015-11-09 20:55:39 -08:00
|
|
|
db "PLEASE WAIT!@"
|
|
|
|
; 28426
|
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
ClearLinkData: ; 28426
|
|
|
|
ld hl, wLinkData
|
|
|
|
ld bc, wLinkDataEnd - wLinkData
|
|
|
|
.loop
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
dec bc
|
|
|
|
ld a, b
|
|
|
|
or c
|
2015-12-20 09:54:08 -08:00
|
|
|
jr nz, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ret
|
|
|
|
; 28434
|
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
FixDataForLinkTransfer: ; 28434
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wd1f3
|
|
|
|
ld a, $fd
|
2015-12-22 15:03:00 -08:00
|
|
|
ld b, LinkBattleRNs - wd1f3
|
2015-12-21 11:10:16 -08:00
|
|
|
.loop1
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [hli], a
|
|
|
|
dec b
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, .loop1
|
2015-12-22 15:03:00 -08:00
|
|
|
ld b, TempEnemyMonSpecies - LinkBattleRNs
|
2015-12-21 11:10:16 -08:00
|
|
|
.loop2
|
2015-11-09 20:55:39 -08:00
|
|
|
call Random
|
|
|
|
cp $fd
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nc, .loop2
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [hli], a
|
|
|
|
dec b
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, .loop2
|
|
|
|
ld hl, wMisc
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, $fd
|
|
|
|
rept 3
|
|
|
|
ld [hli], a
|
|
|
|
endr
|
2016-01-09 20:41:03 -08:00
|
|
|
ld b, $c8
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
2015-12-21 11:10:16 -08:00
|
|
|
.loop3
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [hli], a
|
|
|
|
dec b
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, .loop3
|
2015-12-22 15:03:00 -08:00
|
|
|
ld hl, wTimeCapsulePartyMon1 - 1 + 6
|
|
|
|
ld de, wc612
|
2015-12-21 11:10:16 -08:00
|
|
|
lb bc, 0, 0
|
|
|
|
.loop4
|
2015-11-09 20:55:39 -08:00
|
|
|
inc c
|
|
|
|
ld a, c
|
|
|
|
cp $fd
|
2015-12-21 11:10:16 -08:00
|
|
|
jr z, .next1
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, b
|
|
|
|
dec a
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, .next2
|
2015-11-09 20:55:39 -08:00
|
|
|
push bc
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_TIMECAPSULE
|
|
|
|
ld b, $d
|
2015-12-21 11:10:16 -08:00
|
|
|
jr z, .got_value
|
2015-11-09 20:55:39 -08:00
|
|
|
ld b, $27
|
2015-12-21 11:10:16 -08:00
|
|
|
.got_value
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, c
|
|
|
|
cp b
|
|
|
|
pop bc
|
2015-12-21 11:10:16 -08:00
|
|
|
jr z, .done
|
|
|
|
.next2
|
2015-11-09 20:55:39 -08:00
|
|
|
inc hl
|
|
|
|
ld a, [hl]
|
|
|
|
cp $fe
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, .loop4
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, c
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld [hl], $ff
|
2015-12-21 11:10:16 -08:00
|
|
|
jr .loop4
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.next1
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, $ff
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
lb bc, 1, 0
|
2015-12-21 11:10:16 -08:00
|
|
|
jr .loop4
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.done
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, $ff
|
|
|
|
ld [de], a
|
|
|
|
ret
|
|
|
|
; 28499
|
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
Link_PrepPartyData_Gen1: ; 28499
|
|
|
|
ld de, wLinkData
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, $fd
|
2015-12-21 11:10:16 -08:00
|
|
|
ld b, 6
|
2015-12-20 09:54:08 -08:00
|
|
|
.loop1
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec b
|
2015-12-20 09:54:08 -08:00
|
|
|
jr nz, .loop1
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PlayerName
|
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
push de
|
|
|
|
ld hl, PartyCount
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-20 09:54:08 -08:00
|
|
|
.loop2
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hli]
|
2015-12-20 09:54:08 -08:00
|
|
|
cp -1
|
|
|
|
jr z, .done_party
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [wd265], a
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
callab ConvertMon_2to1
|
|
|
|
pop de
|
|
|
|
pop hl
|
|
|
|
ld a, [wd265]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-20 09:54:08 -08:00
|
|
|
jr .loop2
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
.done_party
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [de], a
|
|
|
|
pop de
|
2015-12-20 09:54:08 -08:00
|
|
|
ld hl, 1 + PARTY_LENGTH + 1
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, de
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld hl, PartyMon1Species
|
2015-12-20 09:54:08 -08:00
|
|
|
ld c, PARTY_LENGTH
|
|
|
|
.mon_loop
|
2015-11-09 20:55:39 -08:00
|
|
|
push bc
|
2015-12-20 09:54:08 -08:00
|
|
|
call .ConvertPartyStruct2to1
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec c
|
2015-12-20 09:54:08 -08:00
|
|
|
jr nz, .mon_loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PartyMonOT
|
2015-12-20 09:54:08 -08:00
|
|
|
call .copy_ot_nicks
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PartyMonNicknames
|
2015-12-20 09:54:08 -08:00
|
|
|
.copy_ot_nicks
|
|
|
|
ld bc, PARTY_LENGTH * NAME_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
jp CopyBytes
|
|
|
|
; 284f6
|
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
.ConvertPartyStruct2to1: ; 284f6
|
2015-11-09 20:55:39 -08:00
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wd265], a
|
|
|
|
callab ConvertMon_2to1
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
ld a, [wd265]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-20 09:54:08 -08:00
|
|
|
ld hl, MON_HP
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
xor a
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-20 09:54:08 -08:00
|
|
|
ld hl, MON_STATUS
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld a, [bc]
|
2015-12-20 09:54:08 -08:00
|
|
|
cp MAGNEMITE
|
|
|
|
jr z, .steel_type
|
|
|
|
cp MAGNETON
|
|
|
|
jr nz, .skip_steel
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
.steel_type
|
|
|
|
ld a, ELECTRIC
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-20 09:54:08 -08:00
|
|
|
jr .done_steel
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
.skip_steel
|
2015-11-09 20:55:39 -08:00
|
|
|
push bc
|
|
|
|
dec a
|
|
|
|
ld hl, BaseData + 7 ; type
|
|
|
|
ld bc, BaseData1 - BaseData0
|
|
|
|
call AddNTimes
|
|
|
|
ld bc, 2
|
|
|
|
ld a, BANK(BaseData)
|
|
|
|
call FarCopyBytes
|
|
|
|
pop bc
|
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
.done_steel
|
2015-11-09 20:55:39 -08:00
|
|
|
push bc
|
2015-12-20 09:54:08 -08:00
|
|
|
ld hl, MON_ITEM
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
2015-12-20 09:54:08 -08:00
|
|
|
ld bc, MON_HAPPINESS - MON_ITEM
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
|
|
|
pop bc
|
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
ld hl, MON_LEVEL
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [de], a
|
|
|
|
ld [CurPartyLevel], a
|
|
|
|
inc de
|
|
|
|
|
|
|
|
push bc
|
2015-12-20 09:54:08 -08:00
|
|
|
ld hl, MON_MAXHP
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
2015-12-20 09:54:08 -08:00
|
|
|
ld bc, MON_SAT - MON_MAXHP
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
|
|
|
pop bc
|
|
|
|
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
|
|
|
|
ld a, [bc]
|
|
|
|
dec a
|
|
|
|
push bc
|
|
|
|
ld b, 0
|
|
|
|
ld c, a
|
|
|
|
ld hl, KantoMonSpecials
|
|
|
|
add hl, bc
|
|
|
|
ld a, BANK(KantoMonSpecials)
|
|
|
|
call GetFarByte
|
|
|
|
ld [BaseSpecialAttack], a
|
|
|
|
pop bc
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, MON_STAT_EXP - 1
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
2015-12-20 09:54:08 -08:00
|
|
|
ld c, STAT_SATK
|
|
|
|
ld b, TRUE
|
2015-11-09 20:55:39 -08:00
|
|
|
predef CalcPkmnStatC
|
|
|
|
|
|
|
|
pop bc
|
|
|
|
pop de
|
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, [hQuotient + 1]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, [hQuotient + 2]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
ld h, b
|
|
|
|
ld l, c
|
|
|
|
ret
|
|
|
|
; 28595
|
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
Link_PrepPartyData_Gen2: ; 28595
|
|
|
|
ld de, wLinkData
|
|
|
|
ld a, $fd
|
|
|
|
ld b, 6
|
2015-11-09 20:55:39 -08:00
|
|
|
.loop1
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec b
|
|
|
|
jr nz, .loop1
|
2015-11-22 09:01:58 -08:00
|
|
|
; de = $c806
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PlayerName
|
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
2015-11-22 09:01:58 -08:00
|
|
|
; de = $c811
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PartyCount
|
2015-11-22 09:01:58 -08:00
|
|
|
ld bc, 1 + PARTY_LENGTH + 1
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
2015-11-22 09:01:58 -08:00
|
|
|
; de = $c819
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PlayerID
|
|
|
|
ld bc, 2
|
|
|
|
call CopyBytes
|
2015-11-22 09:01:58 -08:00
|
|
|
; de = $c81b
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PartyMon1Species
|
2015-11-22 09:01:58 -08:00
|
|
|
ld bc, PARTY_LENGTH * PARTYMON_STRUCT_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
2015-11-22 09:01:58 -08:00
|
|
|
; de = $c93b
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PartyMonOT
|
2015-11-22 09:01:58 -08:00
|
|
|
ld bc, PARTY_LENGTH * NAME_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
2015-11-22 09:01:58 -08:00
|
|
|
; de = $c97d
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PartyMonNicknames
|
2015-11-22 09:01:58 -08:00
|
|
|
ld bc, PARTY_LENGTH * PKMN_NAME_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
2015-11-22 09:01:58 -08:00
|
|
|
; de = $c9bf
|
|
|
|
|
|
|
|
; Okay, we did all that. Now, are we in the trade center?
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_TRADECENTER
|
|
|
|
ret nz
|
2015-11-22 09:01:58 -08:00
|
|
|
|
2015-11-22 21:21:21 -08:00
|
|
|
; Fill 5 bytes at wc9f4 with $20
|
2015-11-09 20:55:39 -08:00
|
|
|
ld de, wc9f4
|
|
|
|
ld a, $20
|
|
|
|
call Function28682
|
2015-11-22 09:01:58 -08:00
|
|
|
|
2015-11-22 21:21:21 -08:00
|
|
|
; Copy all the mail messages to wc9f9
|
2015-11-17 14:56:49 -08:00
|
|
|
ld a, BANK(sPartyMail)
|
2015-11-09 20:55:39 -08:00
|
|
|
call GetSRAMBank
|
2015-11-17 14:56:49 -08:00
|
|
|
ld hl, sPartyMail
|
2015-11-09 20:55:39 -08:00
|
|
|
ld b, PARTY_LENGTH
|
|
|
|
.loop2
|
|
|
|
push bc
|
2015-11-22 09:01:58 -08:00
|
|
|
ld bc, MAIL_MSG_LENGTH + 1
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
2015-11-22 21:21:21 -08:00
|
|
|
ld bc, sPartyMon1MailEnd - sPartyMon1MailAuthor
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
|
|
|
jr nz, .loop2
|
2015-11-22 21:21:21 -08:00
|
|
|
; Copy the mail metadata to wcabf
|
2015-11-17 14:56:49 -08:00
|
|
|
ld hl, sPartyMail
|
2015-11-09 20:55:39 -08:00
|
|
|
ld b, PARTY_LENGTH
|
|
|
|
.loop3
|
|
|
|
push bc
|
2015-11-22 09:01:58 -08:00
|
|
|
ld bc, MAIL_MSG_LENGTH + 1
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
2015-11-22 21:21:21 -08:00
|
|
|
ld bc, sPartyMon1MailEnd - sPartyMon1MailAuthor
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
|
|
|
pop bc
|
|
|
|
dec b
|
|
|
|
jr nz, .loop3
|
2015-11-22 09:01:58 -08:00
|
|
|
|
2015-11-09 20:55:39 -08:00
|
|
|
ld b, PARTY_LENGTH
|
2015-11-17 14:56:49 -08:00
|
|
|
ld de, sPartyMail
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wc9f9
|
|
|
|
.loop4
|
|
|
|
push bc
|
|
|
|
push hl
|
|
|
|
push de
|
|
|
|
push hl
|
2015-11-22 09:01:58 -08:00
|
|
|
callba IsMailEuropean
|
2015-11-09 20:55:39 -08:00
|
|
|
pop de
|
|
|
|
ld a, c
|
|
|
|
or a
|
|
|
|
jr z, .next
|
|
|
|
sub $3
|
2015-11-22 09:01:58 -08:00
|
|
|
jr nc, .italian_spanish
|
|
|
|
callba HandleFrenchGermanMail
|
2015-11-09 20:55:39 -08:00
|
|
|
jr .next
|
|
|
|
|
2015-11-22 09:01:58 -08:00
|
|
|
.italian_spanish
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $2
|
|
|
|
jr nc, .next
|
2015-11-22 09:01:58 -08:00
|
|
|
callba HandleSpanishItalianMail
|
2015-11-09 20:55:39 -08:00
|
|
|
|
|
|
|
.next
|
|
|
|
pop de
|
2015-11-17 14:56:49 -08:00
|
|
|
ld hl, MAIL_STRUCT_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, de
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
pop hl
|
2015-11-22 21:21:21 -08:00
|
|
|
ld bc, sPartyMon1MailAuthor - sPartyMon1Mail
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
|
|
|
jr nz, .loop4
|
|
|
|
call CloseSRAM
|
|
|
|
ld hl, wc9f9
|
2015-11-22 21:21:21 -08:00
|
|
|
ld bc, PARTY_LENGTH * (sPartyMon1MailAuthor - sPartyMon1Mail)
|
2015-11-09 20:55:39 -08:00
|
|
|
.loop5
|
|
|
|
ld a, [hl]
|
|
|
|
cp $fe
|
|
|
|
jr nz, .skip2
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [hl], sPartyMon1MailAuthor - sPartyMon1Mail
|
2015-11-09 20:55:39 -08:00
|
|
|
|
|
|
|
.skip2
|
|
|
|
inc hl
|
|
|
|
dec bc
|
|
|
|
ld a, b
|
|
|
|
or c
|
|
|
|
jr nz, .loop5
|
|
|
|
ld hl, wcabf
|
|
|
|
ld de, wcb13
|
2015-11-22 21:21:21 -08:00
|
|
|
ld b, PARTY_LENGTH * (sPartyMon1MailEnd - sPartyMon1MailAuthor)
|
2015-11-09 20:55:39 -08:00
|
|
|
ld c, $0
|
|
|
|
.loop6
|
|
|
|
inc c
|
|
|
|
ld a, [hl]
|
|
|
|
cp $fe
|
|
|
|
jr nz, .skip3
|
|
|
|
ld [hl], $ff
|
|
|
|
ld a, c
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
|
|
|
|
.skip3
|
|
|
|
inc hl
|
|
|
|
dec b
|
|
|
|
jr nz, .loop6
|
|
|
|
ld a, $ff
|
|
|
|
ld [de], a
|
|
|
|
ret
|
|
|
|
; 28682
|
|
|
|
|
|
|
|
Function28682: ; 28682
|
|
|
|
ld c, $5
|
|
|
|
.loop
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
; 2868a
|
|
|
|
|
|
|
|
Function2868a: ; 2868a
|
|
|
|
push hl
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2015-12-21 11:10:16 -08:00
|
|
|
ld bc, wLinkOTPartyMonTypes
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wcbe8
|
|
|
|
ld a, c
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], b
|
|
|
|
ld hl, OTPartyMon1Species
|
2015-12-20 09:54:08 -08:00
|
|
|
ld c, PARTY_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
.loop
|
|
|
|
push bc
|
2015-12-21 11:10:16 -08:00
|
|
|
call .ConvertToGen2
|
2015-11-09 20:55:39 -08:00
|
|
|
pop bc
|
|
|
|
dec c
|
|
|
|
jr nz, .loop
|
|
|
|
pop hl
|
2015-12-21 11:10:16 -08:00
|
|
|
ld bc, PARTY_LENGTH * REDMON_STRUCT_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
|
|
|
ld de, OTPartyMonOT
|
2015-12-20 09:54:08 -08:00
|
|
|
ld bc, PARTY_LENGTH * NAME_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
|
|
|
ld de, OTPartyMonNicknames
|
2015-12-20 09:54:08 -08:00
|
|
|
ld bc, PARTY_LENGTH * PKMN_NAME_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
jp CopyBytes
|
|
|
|
; 286ba
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.ConvertToGen2: ; 286ba
|
2015-11-09 20:55:39 -08:00
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
push bc
|
|
|
|
push de
|
|
|
|
ld [wd265], a
|
|
|
|
callab ConvertMon_1to2
|
|
|
|
pop de
|
|
|
|
pop bc
|
|
|
|
ld a, [wd265]
|
|
|
|
ld [bc], a
|
|
|
|
ld [CurSpecies], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld hl, MON_HP
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [hli], a
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [hl], a
|
|
|
|
inc de
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, MON_STATUS
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [hl], a
|
|
|
|
ld hl, wcbe8
|
|
|
|
ld a, [hli]
|
|
|
|
ld h, [hl]
|
|
|
|
ld l, a
|
|
|
|
ld a, [de]
|
|
|
|
ld [hli], a
|
|
|
|
inc de
|
|
|
|
ld a, [de]
|
|
|
|
ld [hli], a
|
|
|
|
inc de
|
|
|
|
ld a, l
|
|
|
|
ld [wcbe8], a
|
|
|
|
ld a, h
|
2015-12-21 11:10:16 -08:00
|
|
|
ld [wcbe8 + 1], a
|
2015-11-09 20:55:39 -08:00
|
|
|
push bc
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, MON_ITEM
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
|
|
|
push hl
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
pop de
|
|
|
|
push bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld b, a
|
2015-12-21 11:10:16 -08:00
|
|
|
call TimeCapsule_ReplaceTeruSama
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, b
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
pop bc
|
|
|
|
ld bc, $19
|
|
|
|
call CopyBytes
|
|
|
|
pop bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
|
|
|
ld hl, $1f
|
|
|
|
add hl, bc
|
|
|
|
ld a, [de]
|
|
|
|
inc de
|
|
|
|
ld [hl], a
|
|
|
|
ld [CurPartyLevel], a
|
|
|
|
push bc
|
|
|
|
ld hl, $24
|
|
|
|
add hl, bc
|
|
|
|
push hl
|
|
|
|
ld h, d
|
|
|
|
ld l, e
|
|
|
|
pop de
|
|
|
|
ld bc, 8
|
|
|
|
call CopyBytes
|
|
|
|
pop bc
|
|
|
|
call GetBaseData
|
|
|
|
push de
|
|
|
|
push bc
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, MON_STAT_EXP - 1
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
2015-12-20 09:54:08 -08:00
|
|
|
ld c, STAT_SATK
|
|
|
|
ld b, TRUE
|
2015-11-09 20:55:39 -08:00
|
|
|
predef CalcPkmnStatC
|
|
|
|
pop bc
|
|
|
|
pop hl
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, [hQuotient + 1]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [hli], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, [hQuotient + 2]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [hli], a
|
|
|
|
push hl
|
|
|
|
push bc
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, MON_STAT_EXP - 1
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
2015-12-20 09:54:08 -08:00
|
|
|
ld c, STAT_SDEF
|
|
|
|
ld b, TRUE
|
2015-11-09 20:55:39 -08:00
|
|
|
predef CalcPkmnStatC
|
|
|
|
pop bc
|
|
|
|
pop hl
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, [hQuotient + 1]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [hli], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, [hQuotient + 2]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [hli], a
|
|
|
|
push hl
|
|
|
|
ld hl, $1b
|
|
|
|
add hl, bc
|
|
|
|
ld a, $46
|
|
|
|
ld [hli], a
|
|
|
|
xor a
|
|
|
|
rept 2
|
|
|
|
ld [hli], a
|
|
|
|
endr
|
|
|
|
ld [hl], a
|
|
|
|
pop hl
|
|
|
|
rept 2
|
|
|
|
inc de
|
|
|
|
endr
|
|
|
|
ret
|
|
|
|
; 28771
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
TimeCapsule_ReplaceTeruSama: ; 28771
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, b
|
|
|
|
and a
|
|
|
|
ret z
|
|
|
|
push hl
|
|
|
|
ld hl, .TimeCapsuleAlt
|
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
|
|
|
and a
|
|
|
|
jr z, .end
|
|
|
|
cp b
|
|
|
|
jr z, .found
|
|
|
|
inc hl
|
|
|
|
jr .loop
|
|
|
|
|
|
|
|
.found
|
|
|
|
ld b, [hl]
|
|
|
|
|
|
|
|
.end
|
|
|
|
pop hl
|
|
|
|
ret
|
|
|
|
|
|
|
|
.TimeCapsuleAlt ; 28785
|
|
|
|
; Pokémon traded from RBY do not have held items, so GSC usually interprets the
|
|
|
|
; catch rate as an item. However, if the catch rate appears in this table, the
|
|
|
|
; item associated with the table entry is used instead.
|
|
|
|
db ITEM_19, LEFTOVERS
|
|
|
|
db ITEM_2D, BITTER_BERRY
|
|
|
|
db ITEM_32, GOLD_BERRY
|
|
|
|
db ITEM_5A, BERRY
|
|
|
|
db ITEM_64, BERRY
|
|
|
|
db ITEM_78, BERRY
|
|
|
|
db ITEM_87, BERRY
|
|
|
|
db ITEM_BE, BERRY
|
|
|
|
db ITEM_C3, BERRY
|
|
|
|
db ITEM_DC, BERRY
|
|
|
|
db HM_08, BERRY
|
2015-12-21 11:10:16 -08:00
|
|
|
db -1, BERRY
|
|
|
|
db 0
|
2015-11-09 20:55:39 -08:00
|
|
|
; 2879e
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
Link_CopyOTData: ; 2879e
|
2015-12-20 09:54:08 -08:00
|
|
|
.loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hli]
|
|
|
|
cp $fe
|
2015-12-20 09:54:08 -08:00
|
|
|
jr z, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec bc
|
|
|
|
ld a, b
|
|
|
|
or c
|
2015-12-20 09:54:08 -08:00
|
|
|
jr nz, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ret
|
|
|
|
; 287ab
|
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
Link_CopyRandomNumbers: ; 287ab
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hLinkPlayerNumber]
|
|
|
|
cp $2
|
|
|
|
ret z
|
|
|
|
ld hl, EnemyMonSpecies
|
2015-12-21 11:10:16 -08:00
|
|
|
call Link_FindFirstNonControlCharacter_AllowZero
|
2015-11-09 20:55:39 -08:00
|
|
|
ld de, LinkBattleRNs
|
2015-12-21 11:10:16 -08:00
|
|
|
ld c, 10
|
2015-12-20 09:54:08 -08:00
|
|
|
.loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hli]
|
|
|
|
cp $fe
|
2015-12-20 09:54:08 -08:00
|
|
|
jr z, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $fd
|
2015-12-20 09:54:08 -08:00
|
|
|
jr z, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
dec c
|
2015-12-20 09:54:08 -08:00
|
|
|
jr nz, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ret
|
|
|
|
; 287ca
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
Link_FindFirstNonControlCharacter_SkipZero: ; 287ca
|
2015-12-20 09:54:08 -08:00
|
|
|
.loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hli]
|
|
|
|
and a
|
2015-12-20 09:54:08 -08:00
|
|
|
jr z, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $fd
|
2015-12-20 09:54:08 -08:00
|
|
|
jr z, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $fe
|
2015-12-20 09:54:08 -08:00
|
|
|
jr z, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
dec hl
|
|
|
|
ret
|
|
|
|
; 287d8
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
Link_FindFirstNonControlCharacter_AllowZero: ; 287d8
|
2015-12-20 09:54:08 -08:00
|
|
|
.loop
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hli]
|
|
|
|
cp $fd
|
2015-12-20 09:54:08 -08:00
|
|
|
jr z, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $fe
|
2015-12-20 09:54:08 -08:00
|
|
|
jr z, .loop
|
2015-11-09 20:55:39 -08:00
|
|
|
dec hl
|
|
|
|
ret
|
|
|
|
; 287e3
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
InitTradeMenuDisplay: ; 287e3
|
2015-11-09 20:55:39 -08:00
|
|
|
call ClearScreen
|
2015-12-21 11:10:16 -08:00
|
|
|
call LoadTradeScreenBorder
|
|
|
|
callba InitTradeSpeciesList
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
2015-11-23 13:04:53 -08:00
|
|
|
ld hl, wOtherPlayerLinkMode
|
2015-11-09 20:55:39 -08:00
|
|
|
rept 3
|
|
|
|
ld [hli], a
|
|
|
|
endr
|
|
|
|
ld [hl], a
|
2015-12-21 11:10:16 -08:00
|
|
|
ld a, 1
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorY], a
|
2015-11-09 20:55:39 -08:00
|
|
|
inc a
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wPlayerLinkAction], a
|
2015-12-21 11:10:16 -08:00
|
|
|
jp LinkTrade_PlayerPartyMenu
|
2015-11-09 20:55:39 -08:00
|
|
|
; 28803
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
LinkTrade_OTPartyMenu: ; 28803
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, OTPARTYMON
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [MonType], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, A_BUTTON | D_UP | D_DOWN
|
|
|
|
ld [wMenuJoypadFilter], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [OTPartyCount]
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuNumRows], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 1
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuNumCols], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 9
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuCursorInitY], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 6
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuCursorInitX], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 1
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorX], a
|
2015-12-21 11:10:16 -08:00
|
|
|
ln a, 1, 0
|
|
|
|
ld [w2DMenuCursorOffsets], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, $20
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuFlags1], a
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuFlags2], a
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
LinkTradeOTPartymonMenuLoop: ; 28835
|
|
|
|
callba LinkTradeMenu
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, d
|
|
|
|
and a
|
2015-12-21 11:10:16 -08:00
|
|
|
jp z, LinkTradePartiesMenuMasterLoop
|
|
|
|
bit A_BUTTON_F, a
|
|
|
|
jr z, .not_a_button
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, $1
|
|
|
|
ld [wd263], a
|
|
|
|
callab Function50db9
|
|
|
|
ld hl, OTPartyMon1Species
|
2015-12-17 10:49:26 -08:00
|
|
|
callba LinkMonStatsScreen
|
2015-12-21 11:10:16 -08:00
|
|
|
jp LinkTradePartiesMenuMasterLoop
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.not_a_button
|
|
|
|
bit D_UP_F, a
|
|
|
|
jr z, .not_d_up
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld b, a
|
|
|
|
ld a, [OTPartyCount]
|
|
|
|
cp b
|
2015-12-21 11:10:16 -08:00
|
|
|
jp nz, LinkTradePartiesMenuMasterLoop
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [MonType], a
|
2015-12-17 19:31:16 -08:00
|
|
|
call HideCursor
|
2015-11-09 20:55:39 -08:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
add hl, bc
|
2015-12-17 10:49:26 -08:00
|
|
|
ld [hl], " "
|
2015-11-09 20:55:39 -08:00
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
ld a, [PartyCount]
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorY], a
|
2015-12-21 11:10:16 -08:00
|
|
|
jr LinkTrade_PlayerPartyMenu
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.not_d_up
|
|
|
|
bit D_DOWN_F, a
|
|
|
|
jp z, LinkTradePartiesMenuMasterLoop
|
2015-11-09 20:55:39 -08:00
|
|
|
jp Function28ac9
|
|
|
|
; 2888b
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
LinkTrade_PlayerPartyMenu: ; 2888b
|
|
|
|
callba InitMG_Mobile_LinkTradePalMap
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [MonType], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, A_BUTTON | D_UP | D_DOWN
|
|
|
|
ld [wMenuJoypadFilter], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [PartyCount]
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuNumRows], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 1
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuNumCols], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 1
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuCursorInitY], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 6
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuCursorInitX], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 1
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorX], a
|
2015-12-21 11:10:16 -08:00
|
|
|
ln a, 1, 0
|
|
|
|
ld [w2DMenuCursorOffsets], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, $20
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuFlags1], a
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuFlags2], a
|
2015-12-11 13:59:40 -08:00
|
|
|
call WaitBGMap2
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
LinkTradePartymonMenuLoop: ; 288c5
|
|
|
|
callba LinkTradeMenu
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, d
|
|
|
|
and a
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, .check_joypad
|
|
|
|
jp LinkTradePartiesMenuMasterLoop
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.check_joypad
|
|
|
|
bit A_BUTTON_F, a
|
|
|
|
jr z, .not_a_button
|
2015-11-09 20:55:39 -08:00
|
|
|
jp Function28926
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.not_a_button
|
|
|
|
bit D_DOWN_F, a
|
|
|
|
jr z, .not_d_down
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-09 20:55:39 -08:00
|
|
|
dec a
|
2015-12-21 11:10:16 -08:00
|
|
|
jp nz, LinkTradePartiesMenuMasterLoop
|
|
|
|
ld a, OTPARTYMON
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [MonType], a
|
2015-12-17 19:31:16 -08:00
|
|
|
call HideCursor
|
2015-11-09 20:55:39 -08:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
add hl, bc
|
2015-12-21 11:10:16 -08:00
|
|
|
ld [hl], " "
|
2015-11-09 20:55:39 -08:00
|
|
|
pop bc
|
|
|
|
pop hl
|
2015-12-21 11:10:16 -08:00
|
|
|
ld a, 1
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorY], a
|
2015-12-21 11:10:16 -08:00
|
|
|
jp LinkTrade_OTPartyMenu
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.not_d_down
|
|
|
|
bit D_UP_F, a
|
|
|
|
jr z, LinkTradePartiesMenuMasterLoop
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld b, a
|
|
|
|
ld a, [PartyCount]
|
|
|
|
cp b
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, LinkTradePartiesMenuMasterLoop
|
2015-12-17 19:31:16 -08:00
|
|
|
call HideCursor
|
2015-11-09 20:55:39 -08:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
add hl, bc
|
2015-12-21 11:10:16 -08:00
|
|
|
ld [hl], " "
|
2015-11-09 20:55:39 -08:00
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
jp Function28ade
|
|
|
|
; 2891c
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
LinkTradePartiesMenuMasterLoop: ; 2891c
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [MonType]
|
|
|
|
and a
|
2015-12-21 11:10:16 -08:00
|
|
|
jp z, LinkTradePartymonMenuLoop ; PARTYMON
|
|
|
|
jp LinkTradeOTPartymonMenuLoop ; OTPARTYMON
|
2015-11-09 20:55:39 -08:00
|
|
|
; 28926
|
|
|
|
|
|
|
|
Function28926: ; 28926
|
|
|
|
call LoadTileMapToTempTileMap
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-09 20:55:39 -08:00
|
|
|
push af
|
|
|
|
hlcoord 0, 15
|
2015-12-20 09:54:08 -08:00
|
|
|
ld b, 1
|
|
|
|
ld c, 18
|
2015-11-25 07:16:29 -08:00
|
|
|
call Predef_LinkTextbox
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 2, 16
|
2015-12-21 11:10:16 -08:00
|
|
|
ld de, .String_Stats_Trade
|
2015-11-09 20:55:39 -08:00
|
|
|
call PlaceString
|
2016-01-04 05:43:55 -08:00
|
|
|
callba Link_WaitBGMap
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.joy_loop
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, " "
|
2015-11-09 20:55:39 -08:00
|
|
|
ldcoord_a 11, 16
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, A_BUTTON | B_BUTTON | D_RIGHT
|
|
|
|
ld [wMenuJoypadFilter], a
|
|
|
|
ld a, 1
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuNumRows], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 1
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuNumCols], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 16
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuCursorInitY], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 1
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuCursorInitX], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 1
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorY], a
|
|
|
|
ld [wMenuCursorX], a
|
2015-12-21 11:10:16 -08:00
|
|
|
ln a, 2, 0
|
|
|
|
ld [w2DMenuCursorOffsets], a
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuFlags1], a
|
|
|
|
ld [w2DMenuFlags2], a
|
2015-12-15 15:59:49 -08:00
|
|
|
call ScrollingMenuJoypad
|
2015-12-20 09:54:08 -08:00
|
|
|
bit D_RIGHT_F, a
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, .d_right
|
2015-12-20 09:54:08 -08:00
|
|
|
bit B_BUTTON_F, a
|
2015-12-21 11:10:16 -08:00
|
|
|
jr z, .show_stats
|
|
|
|
.b_button
|
2015-11-09 20:55:39 -08:00
|
|
|
pop af
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorY], a
|
2015-11-09 20:55:39 -08:00
|
|
|
call Call_LoadTempTileMapToTileMap
|
2015-12-21 11:10:16 -08:00
|
|
|
jp LinkTrade_PlayerPartyMenu
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.d_right
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, " "
|
2015-11-09 20:55:39 -08:00
|
|
|
ldcoord_a 1, 16
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, A_BUTTON | B_BUTTON | D_LEFT
|
|
|
|
ld [wMenuJoypadFilter], a
|
|
|
|
ld a, 1
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuNumRows], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 1
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuNumCols], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 16
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuCursorInitY], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 11
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuCursorInitX], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 1
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorY], a
|
|
|
|
ld [wMenuCursorX], a
|
2015-12-21 11:10:16 -08:00
|
|
|
ln a, 2, 0
|
|
|
|
ld [w2DMenuCursorOffsets], a
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuFlags1], a
|
|
|
|
ld [w2DMenuFlags2], a
|
2015-12-15 15:59:49 -08:00
|
|
|
call ScrollingMenuJoypad
|
2015-12-20 09:54:08 -08:00
|
|
|
bit D_LEFT_F, a
|
2015-12-21 11:10:16 -08:00
|
|
|
jp nz, .joy_loop
|
2015-12-20 09:54:08 -08:00
|
|
|
bit B_BUTTON_F, a
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, .b_button
|
|
|
|
jr .try_trade
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.show_stats
|
2015-11-09 20:55:39 -08:00
|
|
|
pop af
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorY], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, $4
|
|
|
|
ld [wd263], a
|
|
|
|
callab Function50db9
|
2015-12-17 10:49:26 -08:00
|
|
|
callba LinkMonStatsScreen
|
2015-11-09 20:55:39 -08:00
|
|
|
call Call_LoadTempTileMapToTileMap
|
|
|
|
hlcoord 6, 1
|
|
|
|
lb bc, 6, 1
|
|
|
|
ld a, " "
|
2015-12-21 11:10:16 -08:00
|
|
|
call LinkEngine_FillBox
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 17, 1
|
|
|
|
lb bc, 6, 1
|
|
|
|
ld a, " "
|
2015-12-21 11:10:16 -08:00
|
|
|
call LinkEngine_FillBox
|
|
|
|
jp LinkTrade_PlayerPartyMenu
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.try_trade
|
2015-12-17 19:31:16 -08:00
|
|
|
call PlaceHollowCursor
|
2015-11-09 20:55:39 -08:00
|
|
|
pop af
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorY], a
|
2015-11-09 20:55:39 -08:00
|
|
|
dec a
|
2015-11-10 16:51:13 -08:00
|
|
|
ld [wd002], a
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
callba Function16d6ce
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, [wOtherPlayerLinkMode]
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $f
|
2015-12-21 11:10:16 -08:00
|
|
|
jp z, InitTradeMenuDisplay
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [wd003], a
|
|
|
|
call Function28b68
|
2015-12-21 11:10:16 -08:00
|
|
|
ld c, 100
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
2015-12-21 11:10:16 -08:00
|
|
|
callba ValidateOTTrademon
|
|
|
|
jr c, .abnormal
|
2015-11-09 20:55:39 -08:00
|
|
|
callba Functionfb5dd
|
2015-12-21 11:10:16 -08:00
|
|
|
jp nc, LinkTrade
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [wcf57], a
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wOtherPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 0, 12
|
2015-12-20 09:54:08 -08:00
|
|
|
ld b, 4
|
|
|
|
ld c, 18
|
2015-11-25 07:16:29 -08:00
|
|
|
call Predef_LinkTextbox
|
2016-01-04 05:43:55 -08:00
|
|
|
callba Link_WaitBGMap
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, .Text_CantTradeLastMon
|
2015-11-09 20:55:39 -08:00
|
|
|
bccoord 1, 14
|
|
|
|
call PlaceWholeStringInBoxAtOnce
|
2015-12-21 11:10:16 -08:00
|
|
|
jr .cancel_trade
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.abnormal
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [wcf57], a
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wOtherPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [wd003]
|
|
|
|
ld hl, OTPartySpecies
|
|
|
|
ld c, a
|
|
|
|
ld b, $0
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wd265], a
|
|
|
|
call GetPokemonName
|
|
|
|
hlcoord 0, 12
|
2015-12-21 11:10:16 -08:00
|
|
|
ld b, 4
|
|
|
|
ld c, 18
|
2015-11-25 07:16:29 -08:00
|
|
|
call Predef_LinkTextbox
|
2016-01-04 05:43:55 -08:00
|
|
|
callba Link_WaitBGMap
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, .Text_Abnormal
|
2015-11-09 20:55:39 -08:00
|
|
|
bccoord 1, 14
|
|
|
|
call PlaceWholeStringInBoxAtOnce
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.cancel_trade
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 0, 12
|
2015-12-20 09:54:08 -08:00
|
|
|
ld b, 4
|
|
|
|
ld c, 18
|
2015-11-25 07:16:29 -08:00
|
|
|
call Predef_LinkTextbox
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 1, 14
|
2015-12-21 11:10:16 -08:00
|
|
|
ld de, String_TooBadTheTradeWasCanceled
|
2015-11-09 20:55:39 -08:00
|
|
|
call PlaceString
|
|
|
|
ld a, $1
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
callba Function16d6ce
|
2015-12-20 09:54:08 -08:00
|
|
|
ld c, 100
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
2015-12-21 11:10:16 -08:00
|
|
|
jp InitTradeMenuDisplay
|
2015-11-09 20:55:39 -08:00
|
|
|
; 28aaf
|
|
|
|
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.Text_CantTradeLastMon: ; 0x28aaf
|
2015-11-09 20:55:39 -08:00
|
|
|
; If you trade that #MON, you won't be able to battle.
|
|
|
|
text_jump UnknownText_0x1c41b1
|
|
|
|
db "@"
|
|
|
|
; 0x28ab4
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.String_Stats_Trade: ; 28ab4
|
2015-11-09 20:55:39 -08:00
|
|
|
db "STATS TRADE@"
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.Text_Abnormal: ; 0x28ac4
|
2015-11-09 20:55:39 -08:00
|
|
|
; Your friend's @ appears to be abnormal!
|
|
|
|
text_jump UnknownText_0x1c41e6
|
|
|
|
db "@"
|
|
|
|
; 0x28ac9
|
|
|
|
|
|
|
|
|
|
|
|
Function28ac9: ; 28ac9
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuCursorY]
|
2015-12-21 11:10:16 -08:00
|
|
|
cp 1
|
|
|
|
jp nz, LinkTradePartiesMenuMasterLoop
|
2015-12-17 19:31:16 -08:00
|
|
|
call HideCursor
|
2015-11-09 20:55:39 -08:00
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
add hl, bc
|
2015-12-20 09:54:08 -08:00
|
|
|
ld [hl], " "
|
2015-11-09 20:55:39 -08:00
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
Function28ade: ; 28ade
|
2015-12-20 09:54:08 -08:00
|
|
|
.loop1
|
|
|
|
ld a, "â–¶"
|
2015-11-09 20:55:39 -08:00
|
|
|
ldcoord_a 9, 17
|
2015-12-20 09:54:08 -08:00
|
|
|
.loop2
|
2015-11-09 20:55:39 -08:00
|
|
|
call JoyTextDelay
|
|
|
|
ld a, [hJoyLast]
|
|
|
|
and a
|
2015-12-20 09:54:08 -08:00
|
|
|
jr z, .loop2
|
|
|
|
bit A_BUTTON_F, a
|
|
|
|
jr nz, .a_button
|
2015-11-09 20:55:39 -08:00
|
|
|
push af
|
|
|
|
ld a, " "
|
|
|
|
ldcoord_a 9, 17
|
|
|
|
pop af
|
2015-12-20 09:54:08 -08:00
|
|
|
bit D_UP_F, a
|
|
|
|
jr z, .d_up
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [OTPartyCount]
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorY], a
|
2015-12-21 11:10:16 -08:00
|
|
|
jp LinkTrade_OTPartyMenu
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
.d_up
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, $1
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorY], a
|
2015-12-21 11:10:16 -08:00
|
|
|
jp LinkTrade_PlayerPartyMenu
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-20 09:54:08 -08:00
|
|
|
.a_button
|
|
|
|
ld a, "â–·"
|
2015-11-09 20:55:39 -08:00
|
|
|
ldcoord_a 9, 17
|
|
|
|
ld a, $f
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
callba Function16d6ce
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, [wOtherPlayerLinkMode]
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $f
|
2015-12-20 09:54:08 -08:00
|
|
|
jr nz, .loop1
|
2015-11-09 20:55:39 -08:00
|
|
|
Function28b22: ; 28b22
|
2015-11-20 08:47:52 -08:00
|
|
|
call RotateThreePalettesRight
|
2015-11-09 20:55:39 -08:00
|
|
|
call ClearScreen
|
2015-11-20 12:15:32 -08:00
|
|
|
ld b, SCGB_08
|
2015-11-09 20:55:39 -08:00
|
|
|
call GetSGBLayout
|
2015-12-11 13:59:40 -08:00
|
|
|
call WaitBGMap2
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [wcfbb], a
|
|
|
|
xor a
|
|
|
|
ld [rSB], a
|
|
|
|
ld [hSerialSend], a
|
|
|
|
ld a, $1
|
|
|
|
ld [rSC], a
|
|
|
|
ld a, $81
|
|
|
|
ld [rSC], a
|
|
|
|
ret
|
|
|
|
; 28b42
|
|
|
|
|
|
|
|
Function28b42: ; 28b42
|
2015-12-21 11:10:16 -08:00
|
|
|
; unreferenced
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 0, 16
|
|
|
|
ld a, "┘"
|
|
|
|
ld bc, 2 * SCREEN_WIDTH
|
|
|
|
call ByteFill
|
|
|
|
hlcoord 1, 16
|
|
|
|
ld a, " "
|
|
|
|
ld bc, SCREEN_WIDTH - 2
|
|
|
|
call ByteFill
|
|
|
|
hlcoord 2, 16
|
2015-12-21 11:10:16 -08:00
|
|
|
ld de, .Cancel
|
2015-11-09 20:55:39 -08:00
|
|
|
jp PlaceString
|
|
|
|
; 28b61
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
.Cancel: ; 28b61
|
2015-11-09 20:55:39 -08:00
|
|
|
db "CANCEL@"
|
|
|
|
; 28b68
|
|
|
|
|
|
|
|
Function28b68: ; 28b68
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, [wOtherPlayerLinkMode]
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 6, 9
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
call AddNTimes
|
2015-12-21 11:10:16 -08:00
|
|
|
ld [hl], "â–·"
|
2015-11-09 20:55:39 -08:00
|
|
|
ret
|
|
|
|
; 28b77
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
LinkEngine_FillBox: ; 28b77
|
|
|
|
.row
|
2015-11-09 20:55:39 -08:00
|
|
|
push bc
|
|
|
|
push hl
|
2015-12-21 11:10:16 -08:00
|
|
|
.col
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [hli], a
|
|
|
|
dec c
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, .col
|
2015-11-09 20:55:39 -08:00
|
|
|
pop hl
|
|
|
|
ld bc, SCREEN_WIDTH
|
|
|
|
add hl, bc
|
|
|
|
pop bc
|
|
|
|
dec b
|
2015-12-21 11:10:16 -08:00
|
|
|
jr nz, .row
|
2015-11-09 20:55:39 -08:00
|
|
|
ret
|
|
|
|
; 28b87
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
LinkTrade: ; 28b87
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [wcf57], a
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wOtherPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 0, 12
|
|
|
|
ld b, $4
|
|
|
|
ld c, $12
|
2015-11-25 07:16:29 -08:00
|
|
|
call Predef_LinkTextbox
|
2016-01-04 05:43:55 -08:00
|
|
|
callba Link_WaitBGMap
|
2015-11-10 16:51:13 -08:00
|
|
|
ld a, [wd002]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PartySpecies
|
|
|
|
ld c, a
|
|
|
|
ld b, $0
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wd265], a
|
|
|
|
call GetPokemonName
|
|
|
|
ld hl, StringBuffer1
|
|
|
|
ld de, wd004
|
|
|
|
ld bc, PKMN_NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
ld a, [wd003]
|
|
|
|
ld hl, OTPartySpecies
|
|
|
|
ld c, a
|
|
|
|
ld b, $0
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wd265], a
|
|
|
|
call GetPokemonName
|
|
|
|
ld hl, UnknownText_0x28eb8
|
|
|
|
bccoord 1, 14
|
|
|
|
call PlaceWholeStringInBoxAtOnce
|
2015-11-11 13:11:08 -08:00
|
|
|
call LoadStandardMenuDataHeader
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 10, 7
|
2015-12-20 09:54:08 -08:00
|
|
|
ld b, 3
|
|
|
|
ld c, 7
|
2015-11-25 07:16:29 -08:00
|
|
|
call Predef_LinkTextbox
|
2015-11-09 20:55:39 -08:00
|
|
|
ld de, String28eab
|
|
|
|
hlcoord 12, 8
|
|
|
|
call PlaceString
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 8
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuCursorInitY], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 11
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuCursorInitX], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 1
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuNumCols], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, 2
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuNumRows], a
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
2015-12-19 11:48:30 -08:00
|
|
|
ld [w2DMenuFlags1], a
|
|
|
|
ld [w2DMenuFlags2], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, $20
|
2015-12-21 11:10:16 -08:00
|
|
|
ld [w2DMenuCursorOffsets], a
|
2015-12-20 09:54:08 -08:00
|
|
|
ld a, A_BUTTON | B_BUTTON
|
|
|
|
ld [wMenuJoypadFilter], a
|
|
|
|
ld a, 1
|
2015-12-15 15:59:49 -08:00
|
|
|
ld [wMenuCursorY], a
|
|
|
|
ld [wMenuCursorX], a
|
2016-01-04 05:43:55 -08:00
|
|
|
callba Link_WaitBGMap
|
2015-12-15 15:59:49 -08:00
|
|
|
call ScrollingMenuJoypad
|
2015-11-09 20:55:39 -08:00
|
|
|
push af
|
|
|
|
call Call_ExitMenu
|
2015-12-11 13:59:40 -08:00
|
|
|
call WaitBGMap2
|
2015-11-09 20:55:39 -08:00
|
|
|
pop af
|
|
|
|
bit 1, a
|
|
|
|
jr nz, .asm_28c33
|
2015-12-15 15:59:49 -08:00
|
|
|
ld a, [wMenuCursorY]
|
2015-11-09 20:55:39 -08:00
|
|
|
dec a
|
|
|
|
jr z, .asm_28c54
|
|
|
|
|
|
|
|
.asm_28c33
|
|
|
|
ld a, $1
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 0, 12
|
|
|
|
ld b, 4
|
|
|
|
ld c, 18
|
2015-11-25 07:16:29 -08:00
|
|
|
call Predef_LinkTextbox
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 1, 14
|
2015-12-21 11:10:16 -08:00
|
|
|
ld de, String_TooBadTheTradeWasCanceled
|
2015-11-09 20:55:39 -08:00
|
|
|
call PlaceString
|
|
|
|
callba Function16d6ce
|
|
|
|
jp Function28ea3
|
|
|
|
|
|
|
|
.asm_28c54
|
|
|
|
ld a, $2
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
callba Function16d6ce
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, [wOtherPlayerLinkMode]
|
2015-11-09 20:55:39 -08:00
|
|
|
dec a
|
|
|
|
jr nz, .asm_28c7b
|
|
|
|
hlcoord 0, 12
|
|
|
|
ld b, 4
|
|
|
|
ld c, 18
|
2015-11-25 07:16:29 -08:00
|
|
|
call Predef_LinkTextbox
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 1, 14
|
2015-12-21 11:10:16 -08:00
|
|
|
ld de, String_TooBadTheTradeWasCanceled
|
2015-11-09 20:55:39 -08:00
|
|
|
call PlaceString
|
|
|
|
jp Function28ea3
|
|
|
|
|
|
|
|
.asm_28c7b
|
2015-11-17 14:56:49 -08:00
|
|
|
ld hl, sPartyMail
|
2015-11-10 16:51:13 -08:00
|
|
|
ld a, [wd002]
|
2015-11-17 14:56:49 -08:00
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
call AddNTimes
|
2015-11-17 14:56:49 -08:00
|
|
|
ld a, BANK(sPartyMail)
|
2015-11-09 20:55:39 -08:00
|
|
|
call GetSRAMBank
|
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2015-11-17 14:56:49 -08:00
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
add hl, bc
|
2015-11-10 16:51:13 -08:00
|
|
|
ld a, [wd002]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld c, a
|
|
|
|
.asm_28c96
|
|
|
|
inc c
|
|
|
|
ld a, c
|
|
|
|
cp $6
|
|
|
|
jr z, .asm_28ca6
|
|
|
|
push bc
|
2015-11-17 14:56:49 -08:00
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
|
|
|
pop bc
|
|
|
|
jr .asm_28c96
|
|
|
|
|
|
|
|
.asm_28ca6
|
2015-11-17 14:56:49 -08:00
|
|
|
ld hl, sPartyMail
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [PartyCount]
|
|
|
|
dec a
|
2015-11-17 14:56:49 -08:00
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
call AddNTimes
|
|
|
|
push hl
|
|
|
|
ld hl, wc9f4
|
|
|
|
ld a, [wd003]
|
2015-11-17 14:56:49 -08:00
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
call AddNTimes
|
|
|
|
pop de
|
2015-11-17 14:56:49 -08:00
|
|
|
ld bc, MAIL_STRUCT_LENGTH
|
2015-11-09 20:55:39 -08:00
|
|
|
call CopyBytes
|
|
|
|
call CloseSRAM
|
|
|
|
ld hl, PlayerName
|
2015-11-22 21:21:21 -08:00
|
|
|
ld de, wPlayerTrademonSenderName
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
2015-11-10 16:51:13 -08:00
|
|
|
ld a, [wd002]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PartySpecies
|
|
|
|
ld b, $0
|
|
|
|
ld c, a
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [wPlayerTrademonSpecies], a
|
2015-11-09 20:55:39 -08:00
|
|
|
push af
|
2015-11-10 16:51:13 -08:00
|
|
|
ld a, [wd002]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PartyMonOT
|
|
|
|
call SkipNames
|
2015-11-22 21:21:21 -08:00
|
|
|
ld de, wPlayerTrademonOTName
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
ld hl, PartyMon1ID
|
2015-11-10 16:51:13 -08:00
|
|
|
ld a, [wd002]
|
2015-11-09 20:55:39 -08:00
|
|
|
call GetPartyLocation
|
|
|
|
ld a, [hli]
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [wPlayerTrademonID], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hl]
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [wPlayerTrademonID + 1], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PartyMon1DVs
|
2015-11-10 16:51:13 -08:00
|
|
|
ld a, [wd002]
|
2015-11-09 20:55:39 -08:00
|
|
|
call GetPartyLocation
|
|
|
|
ld a, [hli]
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [wPlayerTrademonDVs], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hl]
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [wPlayerTrademonDVs + 1], a
|
2015-11-10 16:51:13 -08:00
|
|
|
ld a, [wd002]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, PartyMon1Species
|
|
|
|
call GetPartyLocation
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
callba GetCaughtGender
|
|
|
|
ld a, c
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [wPlayerTrademonCaughtData], a
|
2015-12-21 11:10:16 -08:00
|
|
|
ld hl, OTPlayerName
|
2015-11-22 21:21:21 -08:00
|
|
|
ld de, wOTTrademonSenderName
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
ld a, [wd003]
|
|
|
|
ld hl, OTPartySpecies
|
|
|
|
ld b, $0
|
|
|
|
ld c, a
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [wOTTrademonSpecies], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [wd003]
|
|
|
|
ld hl, OTPartyMonOT
|
|
|
|
call SkipNames
|
2015-11-22 21:21:21 -08:00
|
|
|
ld de, wOTTrademonOTName
|
2015-11-09 20:55:39 -08:00
|
|
|
ld bc, NAME_LENGTH
|
|
|
|
call CopyBytes
|
|
|
|
ld hl, OTPartyMon1ID
|
|
|
|
ld a, [wd003]
|
|
|
|
call GetPartyLocation
|
|
|
|
ld a, [hli]
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [wOTTrademonID], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hl]
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [wOTTrademonID + 1], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, OTPartyMon1DVs
|
|
|
|
ld a, [wd003]
|
|
|
|
call GetPartyLocation
|
|
|
|
ld a, [hli]
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [wOTTrademonDVs], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [hl]
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [wOTTrademonDVs + 1], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [wd003]
|
|
|
|
ld hl, OTPartyMon1Species
|
|
|
|
call GetPartyLocation
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
callba GetCaughtGender
|
|
|
|
ld a, c
|
2015-11-22 21:21:21 -08:00
|
|
|
ld [wOTTrademonCaughtData], a
|
2015-11-10 16:51:13 -08:00
|
|
|
ld a, [wd002]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [CurPartyMon], a
|
|
|
|
ld hl, PartySpecies
|
|
|
|
ld b, $0
|
|
|
|
ld c, a
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2015-11-10 16:51:13 -08:00
|
|
|
ld [wd002], a
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [wPokemonWithdrawDepositParameter], a
|
2015-12-13 17:33:56 -08:00
|
|
|
callab RemoveMonFromPartyOrBox
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [PartyCount]
|
|
|
|
dec a
|
|
|
|
ld [CurPartyMon], a
|
|
|
|
ld a, $1
|
2015-11-28 12:13:40 -08:00
|
|
|
ld [wForceEvolution], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [wd003]
|
|
|
|
push af
|
|
|
|
ld hl, OTPartySpecies
|
|
|
|
ld b, $0
|
|
|
|
ld c, a
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wd003], a
|
|
|
|
ld c, 100
|
|
|
|
call DelayFrames
|
|
|
|
call ClearTileMap
|
|
|
|
call LoadFontsBattleExtra
|
2015-11-20 12:15:32 -08:00
|
|
|
ld b, SCGB_08
|
2015-11-09 20:55:39 -08:00
|
|
|
call GetSGBLayout
|
|
|
|
ld a, [hLinkPlayerNumber]
|
|
|
|
cp $1
|
2015-11-22 21:21:21 -08:00
|
|
|
jr z, .player_2
|
|
|
|
predef TradeAnimation
|
|
|
|
jr .done_animation
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-11-22 21:21:21 -08:00
|
|
|
.player_2
|
|
|
|
predef TradeAnimationPlayer2
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-11-22 21:21:21 -08:00
|
|
|
.done_animation
|
2015-11-09 20:55:39 -08:00
|
|
|
pop af
|
|
|
|
ld c, a
|
|
|
|
ld [CurPartyMon], a
|
|
|
|
ld hl, OTPartySpecies
|
|
|
|
ld d, $0
|
|
|
|
ld e, a
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
ld [CurPartySpecies], a
|
|
|
|
ld hl, OTPartyMon1Species
|
|
|
|
ld a, c
|
|
|
|
call GetPartyLocation
|
|
|
|
ld de, TempMonSpecies
|
|
|
|
ld bc, PARTYMON_STRUCT_LENGTH
|
|
|
|
call CopyBytes
|
2015-11-17 09:29:37 -08:00
|
|
|
predef AddTempmonToParty
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [PartyCount]
|
|
|
|
dec a
|
|
|
|
ld [CurPartyMon], a
|
2015-11-18 15:35:44 -08:00
|
|
|
callab EvolvePokemon
|
2015-11-09 20:55:39 -08:00
|
|
|
call ClearScreen
|
2015-12-21 11:10:16 -08:00
|
|
|
call LoadTradeScreenBorder
|
2015-11-09 20:55:39 -08:00
|
|
|
call Function28eff
|
2016-01-04 05:43:55 -08:00
|
|
|
callba Link_WaitBGMap
|
2015-11-09 20:55:39 -08:00
|
|
|
ld b, $1
|
|
|
|
pop af
|
|
|
|
ld c, a
|
|
|
|
cp MEW
|
|
|
|
jr z, .asm_28e49
|
|
|
|
ld a, [CurPartySpecies]
|
|
|
|
cp MEW
|
|
|
|
jr z, .asm_28e49
|
|
|
|
ld b, $2
|
|
|
|
ld a, c
|
|
|
|
cp CELEBI
|
|
|
|
jr z, .asm_28e49
|
|
|
|
ld a, [CurPartySpecies]
|
|
|
|
cp CELEBI
|
|
|
|
jr z, .asm_28e49
|
|
|
|
ld b, $0
|
|
|
|
|
|
|
|
.asm_28e49
|
|
|
|
ld a, b
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
push bc
|
|
|
|
call Function862
|
|
|
|
pop bc
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_TIMECAPSULE
|
|
|
|
jr z, .asm_28e63
|
|
|
|
ld a, b
|
|
|
|
and a
|
|
|
|
jr z, .asm_28e63
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, [wOtherPlayerLinkAction]
|
2015-11-09 20:55:39 -08:00
|
|
|
cp b
|
|
|
|
jr nz, .asm_28e49
|
|
|
|
|
|
|
|
.asm_28e63
|
|
|
|
callba Function14a58
|
|
|
|
callba MobileFn_1060af
|
|
|
|
callba BackupMobileEventIndex
|
|
|
|
ld c, 40
|
|
|
|
call DelayFrames
|
|
|
|
hlcoord 0, 12
|
|
|
|
ld b, 4
|
|
|
|
ld c, 18
|
2015-11-25 07:16:29 -08:00
|
|
|
call Predef_LinkTextbox
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 1, 14
|
|
|
|
ld de, String28ebd
|
|
|
|
call PlaceString
|
2016-01-04 05:43:55 -08:00
|
|
|
callba Link_WaitBGMap
|
2015-11-09 20:55:39 -08:00
|
|
|
ld c, 50
|
|
|
|
call DelayFrames
|
|
|
|
ld a, [wLinkMode]
|
|
|
|
cp LINK_TIMECAPSULE
|
2015-12-20 09:54:08 -08:00
|
|
|
jp z, TimeCapsule
|
|
|
|
jp Gen2ToGen2LinkComms
|
2015-11-09 20:55:39 -08:00
|
|
|
; 28ea3
|
|
|
|
|
|
|
|
Function28ea3: ; 28ea3
|
|
|
|
ld c, 100
|
|
|
|
call DelayFrames
|
2015-12-21 11:10:16 -08:00
|
|
|
jp InitTradeMenuDisplay
|
2015-11-09 20:55:39 -08:00
|
|
|
; 28eab
|
|
|
|
|
|
|
|
String28eab: ; 28eab
|
|
|
|
db "TRADE"
|
|
|
|
next "CANCEL@"
|
|
|
|
|
|
|
|
UnknownText_0x28eb8: ; 0x28eb8
|
|
|
|
; Trade @ for @ ?
|
|
|
|
text_jump UnknownText_0x1c4212
|
|
|
|
db "@"
|
|
|
|
; 0x28ebd
|
|
|
|
|
|
|
|
String28ebd: ; 28ebd
|
|
|
|
db "Trade completed!@"
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
String_TooBadTheTradeWasCanceled: ; 28ece
|
2015-11-09 20:55:39 -08:00
|
|
|
db "Too bad! The trade"
|
|
|
|
next "was canceled!@"
|
|
|
|
|
|
|
|
|
2015-11-25 07:16:29 -08:00
|
|
|
Predef_LinkTextbox: ; 28eef
|
2015-11-09 20:55:39 -08:00
|
|
|
ld d, h
|
|
|
|
ld e, l
|
2015-11-25 07:16:29 -08:00
|
|
|
callba LinkTextbox
|
2015-11-09 20:55:39 -08:00
|
|
|
ret
|
|
|
|
; 28ef8
|
|
|
|
|
2015-12-21 11:10:16 -08:00
|
|
|
LoadTradeScreenBorder: ; 28ef8
|
|
|
|
callba _LoadTradeScreenBorder
|
2015-11-09 20:55:39 -08:00
|
|
|
ret
|
|
|
|
; 28eff
|
|
|
|
|
|
|
|
Function28eff: ; 28eff
|
|
|
|
callba Function16d6a7
|
|
|
|
call SetPalettes
|
|
|
|
ret
|
|
|
|
; 28f09
|
|
|
|
|
|
|
|
Function28f09: ; 28f09
|
2015-12-21 11:10:16 -08:00
|
|
|
; unreferenced
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 0, 0
|
|
|
|
ld b, 6
|
|
|
|
ld c, 18
|
2015-11-25 07:16:29 -08:00
|
|
|
call Predef_LinkTextbox
|
2015-11-09 20:55:39 -08:00
|
|
|
hlcoord 0, 8
|
|
|
|
ld b, 6
|
|
|
|
ld c, 18
|
2015-11-25 07:16:29 -08:00
|
|
|
call Predef_LinkTextbox
|
2015-12-21 11:10:16 -08:00
|
|
|
callba PlaceTradePartnerNamesAndParty
|
2015-11-09 20:55:39 -08:00
|
|
|
ret
|
|
|
|
; 28f24
|
|
|
|
|
2015-11-22 21:21:21 -08:00
|
|
|
INCLUDE "engine/trade/animation.asm"
|
2015-11-09 20:55:39 -08:00
|
|
|
|
|
|
|
Special_CheckTimeCapsuleCompatibility: ; 29bfb
|
|
|
|
; Checks to see if your Party is compatible with the generation 1 games. Returns the following in ScriptVar:
|
|
|
|
; 0: Party is okay
|
|
|
|
; 1: At least one Pokemon was introduced in GS
|
|
|
|
; 2: At least one Pokemon has a move that was introduced in GS
|
|
|
|
; 3: At least one Pokemon is holding mail
|
|
|
|
|
|
|
|
; If any party Pokemon was introduced in the generation 2 games, don't let it in.
|
|
|
|
ld hl, PartySpecies
|
|
|
|
ld b, PARTY_LENGTH ; 6
|
|
|
|
.loop
|
|
|
|
ld a, [hli]
|
2015-12-21 11:10:16 -08:00
|
|
|
cp -1
|
2015-11-09 20:55:39 -08:00
|
|
|
jr z, .checkitem
|
|
|
|
cp CHIKORITA ; MEW + 1 ; 151 + 1
|
|
|
|
jr nc, .mon_too_new
|
|
|
|
dec b
|
|
|
|
jr nz, .loop
|
|
|
|
|
|
|
|
; If any party Pokemon is holding mail, don't let it in.
|
|
|
|
.checkitem
|
|
|
|
ld a, [PartyCount]
|
|
|
|
ld b, a
|
|
|
|
ld hl, PartyMon1Item
|
|
|
|
.itemloop
|
|
|
|
push hl
|
|
|
|
push bc
|
|
|
|
ld d, [hl]
|
|
|
|
callba ItemIsMail
|
|
|
|
pop bc
|
|
|
|
pop hl
|
|
|
|
jr c, .mon_has_mail
|
|
|
|
ld de, PARTYMON_STRUCT_LENGTH
|
|
|
|
add hl, de
|
|
|
|
dec b
|
|
|
|
jr nz, .itemloop
|
|
|
|
|
|
|
|
; If any party Pokemon has a move that was introduced in the generation 2 games, don't let it in.
|
|
|
|
ld hl, PartyMon1Moves
|
|
|
|
ld a, [PartyCount]
|
|
|
|
ld b, a
|
|
|
|
.move_loop
|
|
|
|
ld c, NUM_MOVES
|
|
|
|
.move_next
|
|
|
|
ld a, [hli]
|
|
|
|
cp STRUGGLE + 1
|
|
|
|
jr nc, .move_too_new
|
|
|
|
dec c
|
|
|
|
jr nz, .move_next
|
|
|
|
ld de, PartyMon2 - (PartyMon1 + NUM_MOVES)
|
|
|
|
add hl, de
|
|
|
|
dec b
|
|
|
|
jr nz, .move_loop
|
|
|
|
xor a
|
|
|
|
jr .done
|
|
|
|
|
|
|
|
.mon_too_new
|
|
|
|
ld [wd265], a
|
|
|
|
call GetPokemonName
|
|
|
|
ld a, $1
|
|
|
|
jr .done
|
|
|
|
|
|
|
|
.move_too_new
|
|
|
|
push bc
|
|
|
|
ld [wd265], a
|
|
|
|
call GetMoveName
|
|
|
|
call CopyName1
|
|
|
|
pop bc
|
|
|
|
call Function29c67
|
|
|
|
ld a, $2
|
|
|
|
jr .done
|
|
|
|
|
|
|
|
.mon_has_mail
|
|
|
|
call Function29c67
|
|
|
|
ld a, $3
|
|
|
|
|
|
|
|
.done
|
|
|
|
ld [ScriptVar], a
|
|
|
|
ret
|
|
|
|
; 29c67
|
|
|
|
|
|
|
|
Function29c67: ; 29c67
|
|
|
|
ld a, [PartyCount]
|
|
|
|
sub b
|
|
|
|
ld c, a
|
|
|
|
inc c
|
|
|
|
ld b, $0
|
|
|
|
ld hl, PartyCount
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
ld [wd265], a
|
|
|
|
call GetPokemonName
|
|
|
|
ret
|
|
|
|
; 29c7b
|
|
|
|
|
|
|
|
Special_EnterTimeCapsule: ; 29c7b
|
2015-11-23 13:04:53 -08:00
|
|
|
ld c, 10
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
|
|
|
ld a, $4
|
|
|
|
call Function29f17
|
2015-11-23 13:04:53 -08:00
|
|
|
ld c, 40
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
|
|
|
xor a
|
|
|
|
ld [hVBlank], a
|
|
|
|
inc a
|
|
|
|
ld [wLinkMode], a
|
|
|
|
ret
|
|
|
|
; 29c92
|
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
WaitForOtherPlayerToExit: ; 29c92
|
|
|
|
ld c, 3
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
|
|
|
ld a, -1
|
|
|
|
ld [hLinkPlayerNumber], a
|
|
|
|
xor a
|
|
|
|
ld [rSB], a
|
|
|
|
ld [hSerialReceive], a
|
|
|
|
ld a, $1
|
|
|
|
ld [rSC], a
|
|
|
|
ld a, $81
|
|
|
|
ld [rSC], a
|
2015-12-22 15:03:00 -08:00
|
|
|
ld c, 3
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
|
|
|
xor a
|
|
|
|
ld [rSB], a
|
|
|
|
ld [hSerialReceive], a
|
|
|
|
ld a, $0
|
|
|
|
ld [rSC], a
|
|
|
|
ld a, $80
|
|
|
|
ld [rSC], a
|
|
|
|
ld c, $3
|
|
|
|
call DelayFrames
|
|
|
|
xor a
|
|
|
|
ld [rSB], a
|
|
|
|
ld [hSerialReceive], a
|
|
|
|
ld [rSC], a
|
2015-12-22 15:03:00 -08:00
|
|
|
ld c, 3
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
|
|
|
ld a, -1
|
|
|
|
ld [hLinkPlayerNumber], a
|
|
|
|
ld a, [rIF]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [rIF], a
|
|
|
|
ld a, $f
|
|
|
|
ld [rIE], a
|
|
|
|
pop af
|
|
|
|
ld [rIF], a
|
|
|
|
ld hl, wcf5b
|
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ld [hVBlank], a
|
|
|
|
ld [wLinkMode], a
|
|
|
|
ret
|
|
|
|
; 29ce8
|
|
|
|
|
|
|
|
Special_SetBitsForLinkTradeRequest: ; 29ce8
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, LINK_TRADECENTER - 1
|
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [wd265], a
|
|
|
|
ret
|
|
|
|
; 29cf1
|
|
|
|
|
|
|
|
Special_SetBitsForBattleRequest: ; 29cf1
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, LINK_COLOSSEUM - 1
|
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [wd265], a
|
|
|
|
ret
|
|
|
|
; 29cfa
|
|
|
|
|
|
|
|
Special_SetBitsForTimeCapsuleRequest: ; 29cfa
|
|
|
|
ld a, $2
|
|
|
|
ld [rSB], a
|
|
|
|
xor a
|
|
|
|
ld [hSerialReceive], a
|
|
|
|
ld a, $0
|
|
|
|
ld [rSC], a
|
|
|
|
ld a, $80
|
|
|
|
ld [rSC], a
|
2015-11-23 13:04:53 -08:00
|
|
|
xor a ; LINK_TIMECAPSULE - 1
|
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [wd265], a
|
|
|
|
ret
|
|
|
|
; 29d11
|
|
|
|
|
|
|
|
Special_WaitForLinkedFriend: ; 29d11
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, [wPlayerLinkAction]
|
2015-11-09 20:55:39 -08:00
|
|
|
and a
|
|
|
|
jr z, .asm_29d2f
|
|
|
|
ld a, $2
|
|
|
|
ld [rSB], a
|
|
|
|
xor a
|
|
|
|
ld [hSerialReceive], a
|
|
|
|
ld a, $0
|
|
|
|
ld [rSC], a
|
|
|
|
ld a, $80
|
|
|
|
ld [rSC], a
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
|
|
|
|
.asm_29d2f
|
|
|
|
ld a, $2
|
|
|
|
ld [wcf5c], a
|
|
|
|
ld a, $ff
|
|
|
|
ld [wcf5b], a
|
|
|
|
.asm_29d39
|
|
|
|
ld a, [hLinkPlayerNumber]
|
|
|
|
cp $2
|
|
|
|
jr z, .asm_29d79
|
|
|
|
cp $1
|
|
|
|
jr z, .asm_29d79
|
|
|
|
ld a, -1
|
|
|
|
ld [hLinkPlayerNumber], a
|
|
|
|
ld a, $2
|
|
|
|
ld [rSB], a
|
|
|
|
xor a
|
|
|
|
ld [hSerialReceive], a
|
|
|
|
ld a, $0
|
|
|
|
ld [rSC], a
|
|
|
|
ld a, $80
|
|
|
|
ld [rSC], a
|
|
|
|
ld a, [wcf5b]
|
|
|
|
dec a
|
|
|
|
ld [wcf5b], a
|
|
|
|
jr nz, .asm_29d68
|
|
|
|
ld a, [wcf5c]
|
|
|
|
dec a
|
|
|
|
ld [wcf5c], a
|
|
|
|
jr z, .asm_29d8d
|
|
|
|
|
|
|
|
.asm_29d68
|
|
|
|
ld a, $1
|
|
|
|
ld [rSB], a
|
|
|
|
ld a, $1
|
|
|
|
ld [rSC], a
|
|
|
|
ld a, $81
|
|
|
|
ld [rSC], a
|
|
|
|
call DelayFrame
|
|
|
|
jr .asm_29d39
|
|
|
|
|
|
|
|
.asm_29d79
|
2015-12-01 18:54:11 -08:00
|
|
|
call LinkDataReceived
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrame
|
2015-12-01 18:54:11 -08:00
|
|
|
call LinkDataReceived
|
2015-11-09 20:55:39 -08:00
|
|
|
ld c, $32
|
|
|
|
call DelayFrames
|
|
|
|
ld a, $1
|
|
|
|
ld [ScriptVar], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.asm_29d8d
|
|
|
|
xor a
|
|
|
|
ld [ScriptVar], a
|
|
|
|
ret
|
|
|
|
; 29d92
|
|
|
|
|
|
|
|
Special_CheckLinkTimeout: ; 29d92
|
|
|
|
ld a, $1
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wcf5b
|
|
|
|
ld a, $3
|
|
|
|
ld [hli], a
|
|
|
|
xor a
|
|
|
|
ld [hl], a
|
|
|
|
call WaitBGMap
|
|
|
|
ld a, $2
|
|
|
|
ld [hVBlank], a
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
call Function29e0c
|
|
|
|
xor a
|
|
|
|
ld [hVBlank], a
|
|
|
|
ld a, [ScriptVar]
|
|
|
|
and a
|
|
|
|
ret nz
|
|
|
|
jp Function29f04
|
|
|
|
; 29dba
|
|
|
|
|
|
|
|
Function29dba: ; 29dba
|
|
|
|
ld a, $5
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wcf5b
|
|
|
|
ld a, $3
|
|
|
|
ld [hli], a
|
|
|
|
xor a
|
|
|
|
ld [hl], a
|
|
|
|
call WaitBGMap
|
|
|
|
ld a, $2
|
|
|
|
ld [hVBlank], a
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
|
|
|
call Function29e0c
|
|
|
|
ld a, [ScriptVar]
|
|
|
|
and a
|
2015-12-22 15:03:00 -08:00
|
|
|
jr z, .vblank
|
2015-12-14 08:12:18 -08:00
|
|
|
ld bc, -1
|
2015-12-22 15:03:00 -08:00
|
|
|
.wait
|
2015-11-09 20:55:39 -08:00
|
|
|
dec bc
|
|
|
|
ld a, b
|
|
|
|
or c
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .wait
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, [wOtherPlayerLinkMode]
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $5
|
2015-12-22 15:03:00 -08:00
|
|
|
jr nz, .script_var
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, $6
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld hl, wcf5b
|
|
|
|
ld a, $1
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], $32
|
|
|
|
call Function29e0c
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, [wOtherPlayerLinkMode]
|
2015-11-09 20:55:39 -08:00
|
|
|
cp $6
|
2015-12-22 15:03:00 -08:00
|
|
|
jr z, .vblank
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
.script_var
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [ScriptVar], a
|
|
|
|
ret
|
|
|
|
|
2015-12-22 15:03:00 -08:00
|
|
|
.vblank
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [hVBlank], a
|
|
|
|
ret
|
|
|
|
; 29e0c
|
|
|
|
|
|
|
|
Function29e0c: ; 29e0c
|
|
|
|
xor a
|
2015-11-11 20:38:57 -08:00
|
|
|
ld [hFFCA], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [wcf5b]
|
|
|
|
ld h, a
|
|
|
|
ld a, [wcf5c]
|
|
|
|
ld l, a
|
|
|
|
push hl
|
|
|
|
call Function29e3b
|
|
|
|
pop hl
|
|
|
|
jr nz, .asm_29e2f
|
|
|
|
call Function29e47
|
|
|
|
call Function29e53
|
|
|
|
call Function29e3b
|
|
|
|
jr nz, .asm_29e2f
|
|
|
|
call Function29e47
|
|
|
|
xor a
|
|
|
|
jr .asm_29e31
|
|
|
|
|
|
|
|
.asm_29e2f
|
|
|
|
ld a, $1
|
|
|
|
|
|
|
|
.asm_29e31
|
|
|
|
ld [ScriptVar], a
|
|
|
|
ld hl, wcf5b
|
|
|
|
xor a
|
|
|
|
ld [hli], a
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 29e3b
|
|
|
|
|
|
|
|
Function29e3b: ; 29e3b
|
|
|
|
call Function87d
|
|
|
|
ld hl, wcf5b
|
|
|
|
ld a, [hli]
|
|
|
|
inc a
|
|
|
|
ret nz
|
|
|
|
ld a, [hl]
|
|
|
|
inc a
|
|
|
|
ret
|
|
|
|
; 29e47
|
|
|
|
|
|
|
|
Function29e47: ; 29e47
|
|
|
|
ld b, $a
|
|
|
|
.asm_29e49
|
|
|
|
call DelayFrame
|
2015-12-01 18:54:11 -08:00
|
|
|
call LinkDataReceived
|
2015-11-09 20:55:39 -08:00
|
|
|
dec b
|
|
|
|
jr nz, .asm_29e49
|
|
|
|
ret
|
|
|
|
; 29e53
|
|
|
|
|
|
|
|
Function29e53: ; 29e53
|
|
|
|
dec h
|
|
|
|
srl h
|
|
|
|
rr l
|
|
|
|
srl h
|
|
|
|
rr l
|
|
|
|
inc h
|
|
|
|
ld a, h
|
|
|
|
ld [wcf5b], a
|
|
|
|
ld a, l
|
|
|
|
ld [wcf5c], a
|
|
|
|
ret
|
|
|
|
; 29e66
|
|
|
|
|
|
|
|
Special_TryQuickSave: ; 29e66
|
|
|
|
ld a, [wd265]
|
|
|
|
push af
|
2015-11-17 20:29:14 -08:00
|
|
|
callba Link_SaveGame
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, $1
|
|
|
|
jr nc, .asm_29e75
|
|
|
|
xor a
|
|
|
|
|
|
|
|
.asm_29e75
|
|
|
|
ld [ScriptVar], a
|
|
|
|
ld c, $1e
|
|
|
|
call DelayFrames
|
|
|
|
pop af
|
|
|
|
ld [wd265], a
|
|
|
|
ret
|
|
|
|
; 29e82
|
|
|
|
|
|
|
|
Special_CheckBothSelectedSameRoom: ; 29e82
|
|
|
|
ld a, [wd265]
|
|
|
|
call Function29f17
|
|
|
|
push af
|
2015-12-01 18:54:11 -08:00
|
|
|
call LinkDataReceived
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrame
|
2015-12-01 18:54:11 -08:00
|
|
|
call LinkDataReceived
|
2015-11-09 20:55:39 -08:00
|
|
|
pop af
|
|
|
|
ld b, a
|
|
|
|
ld a, [wd265]
|
|
|
|
cp b
|
2015-11-23 13:04:53 -08:00
|
|
|
jr nz, .fail
|
2015-11-09 20:55:39 -08:00
|
|
|
ld a, [wd265]
|
|
|
|
inc a
|
|
|
|
ld [wLinkMode], a
|
|
|
|
xor a
|
|
|
|
ld [hVBlank], a
|
|
|
|
ld a, $1
|
|
|
|
ld [ScriptVar], a
|
|
|
|
ret
|
|
|
|
|
2015-11-23 13:04:53 -08:00
|
|
|
.fail
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [ScriptVar], a
|
|
|
|
ret
|
|
|
|
; 29eaf
|
|
|
|
|
|
|
|
Special_TimeCapsule: ; 29eaf
|
|
|
|
ld a, LINK_TIMECAPSULE
|
|
|
|
ld [wLinkMode], a
|
|
|
|
call DisableSpriteUpdates
|
|
|
|
callab LinkCommunications
|
|
|
|
call EnableSpriteUpdates
|
|
|
|
xor a
|
|
|
|
ld [hVBlank], a
|
|
|
|
ret
|
|
|
|
; 29ec4
|
|
|
|
|
|
|
|
Special_TradeCenter: ; 29ec4
|
|
|
|
ld a, LINK_TRADECENTER
|
|
|
|
ld [wLinkMode], a
|
|
|
|
call DisableSpriteUpdates
|
|
|
|
callab LinkCommunications
|
|
|
|
call EnableSpriteUpdates
|
|
|
|
xor a
|
|
|
|
ld [hVBlank], a
|
|
|
|
ret
|
|
|
|
; 29ed9
|
|
|
|
|
|
|
|
Special_Colosseum: ; 29ed9
|
|
|
|
ld a, LINK_COLOSSEUM
|
|
|
|
ld [wLinkMode], a
|
|
|
|
call DisableSpriteUpdates
|
|
|
|
callab LinkCommunications
|
|
|
|
call EnableSpriteUpdates
|
|
|
|
xor a
|
|
|
|
ld [hVBlank], a
|
|
|
|
ret
|
|
|
|
; 29eee
|
|
|
|
|
|
|
|
Special_CloseLink: ; 29eee
|
|
|
|
xor a
|
|
|
|
ld [wLinkMode], a
|
|
|
|
ld c, $3
|
|
|
|
call DelayFrames
|
|
|
|
jp Function29f04
|
|
|
|
; 29efa
|
|
|
|
|
|
|
|
Special_FailedLinkToPast: ; 29efa
|
2015-11-23 13:04:53 -08:00
|
|
|
ld c, 40
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
|
|
|
ld a, $e
|
|
|
|
jp Function29f17
|
|
|
|
; 29f04
|
|
|
|
|
|
|
|
Function29f04: ; 29f04
|
2015-11-23 13:04:53 -08:00
|
|
|
ld c, 3
|
2015-11-09 20:55:39 -08:00
|
|
|
call DelayFrames
|
|
|
|
ld a, -1
|
|
|
|
ld [hLinkPlayerNumber], a
|
|
|
|
ld a, $2
|
|
|
|
ld [rSB], a
|
|
|
|
xor a
|
|
|
|
ld [hSerialReceive], a
|
|
|
|
ld [rSC], a
|
|
|
|
ret
|
|
|
|
; 29f17
|
|
|
|
|
|
|
|
Function29f17: ; 29f17
|
|
|
|
add $d0
|
2015-11-23 13:04:53 -08:00
|
|
|
ld [wPlayerLinkAction], a
|
2015-11-09 20:55:39 -08:00
|
|
|
ld [wcf57], a
|
|
|
|
ld a, $2
|
|
|
|
ld [hVBlank], a
|
|
|
|
call DelayFrame
|
|
|
|
call DelayFrame
|
2015-11-23 13:04:53 -08:00
|
|
|
.receive_loop
|
2015-11-09 20:55:39 -08:00
|
|
|
call Function83b
|
2015-11-23 13:04:53 -08:00
|
|
|
ld a, [wOtherPlayerLinkMode]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld b, a
|
|
|
|
and $f0
|
|
|
|
cp $d0
|
2015-11-23 13:04:53 -08:00
|
|
|
jr z, .done
|
|
|
|
ld a, [wOtherPlayerLinkAction]
|
2015-11-09 20:55:39 -08:00
|
|
|
ld b, a
|
|
|
|
and $f0
|
|
|
|
cp $d0
|
2015-11-23 13:04:53 -08:00
|
|
|
jr nz, .receive_loop
|
2015-11-09 20:55:39 -08:00
|
|
|
|
2015-11-23 13:04:53 -08:00
|
|
|
.done
|
2015-11-09 20:55:39 -08:00
|
|
|
xor a
|
|
|
|
ld [hVBlank], a
|
|
|
|
ld a, b
|
|
|
|
and $f
|
|
|
|
ret
|
|
|
|
; 29f47
|
|
|
|
|
|
|
|
Special_CableClubCheckWhichChris: ; 29f47
|
|
|
|
ld a, [hLinkPlayerNumber]
|
|
|
|
cp $1
|
|
|
|
ld a, $1
|
|
|
|
jr z, .yes
|
|
|
|
dec a
|
|
|
|
|
|
|
|
.yes
|
|
|
|
ld [ScriptVar], a
|
|
|
|
ret
|
|
|
|
; 29f54
|
|
|
|
|
|
|
|
GFX_29f54: ; 29f54
|
2015-12-20 09:54:08 -08:00
|
|
|
; unreferenced
|
2015-11-09 20:55:39 -08:00
|
|
|
INCBIN "gfx/unknown/029f54.2bpp"
|
|
|
|
; 29fe4
|