mirror of
https://github.com/pret/pokecrystal.git
synced 2024-11-23 13:29:42 +00:00
Identify mobile Name Card exchange labels
This commit is contained in:
parent
ba5bc304f9
commit
1237156948
@ -35,6 +35,12 @@
|
||||
SCGB_PARTY_MENU_HP_BARS EQU $fc
|
||||
SCGB_DEFAULT EQU $ff
|
||||
|
||||
; GetCrystalCGBLayout arguments (see engine/gfx/crystal_layouts.asm)
|
||||
const_def
|
||||
const CRYSTAL_CGB_MOBILE_0
|
||||
const CRYSTAL_CGB_MOBILE_1
|
||||
const CRYSTAL_CGB_NAME_CARD
|
||||
|
||||
; PredefPals indexes (see gfx/sgb/predef.pal)
|
||||
; GetPredefPal arguments (see engine/gfx/color.asm)
|
||||
const_def
|
||||
|
@ -260,14 +260,14 @@ _MysteryGiftSentHomeText::
|
||||
text "'s home."
|
||||
prompt
|
||||
|
||||
_MysteryGiftReceivedCardText::
|
||||
_NameCardReceivedCardText::
|
||||
text "Received"
|
||||
line "@"
|
||||
text_ram wMysteryGiftCardHolderName
|
||||
text "'s CARD."
|
||||
prompt
|
||||
|
||||
_MysteryGiftListedCardText::
|
||||
_NameCardListedCardText::
|
||||
text_ram wMysteryGiftCardHolderName
|
||||
text "'s CARD was"
|
||||
line "listed as no.@"
|
||||
@ -275,17 +275,17 @@ _MysteryGiftListedCardText::
|
||||
text "."
|
||||
prompt
|
||||
|
||||
_MysteryGiftNotRegisteredCardText::
|
||||
_NameCardNotRegisteredCardText::
|
||||
text "The CARD was not"
|
||||
line "registered."
|
||||
prompt
|
||||
|
||||
_MysteryGiftLinkCancelledText::
|
||||
_NameCardLinkCancelledText::
|
||||
text "The link has been"
|
||||
line "cancelled."
|
||||
prompt
|
||||
|
||||
_MysteryGiftLinkCommErrorText::
|
||||
_NameCardLinkCommErrorText::
|
||||
text "Communication"
|
||||
line "error."
|
||||
prompt
|
||||
|
@ -17,19 +17,18 @@ LoadSGBLayoutCGB:
|
||||
ld l, a
|
||||
ld h, 0
|
||||
add hl, hl
|
||||
ld de, .dw
|
||||
ld de, .Jumptable
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
ld l, a
|
||||
ld de, .ReturnFromJumpTable
|
||||
ld de, .done
|
||||
push de
|
||||
jp hl
|
||||
|
||||
.ReturnFromJumpTable:
|
||||
.done:
|
||||
ret
|
||||
|
||||
.dw
|
||||
.Jumptable:
|
||||
dw _CGB_BattleGrayscale
|
||||
dw _CGB_BattleColors
|
||||
dw _CGB_PokegearPals
|
||||
|
@ -1,16 +1,16 @@
|
||||
GetMysteryGift_MobileAdapterLayout:
|
||||
GetCrystalCGBLayout:
|
||||
ld a, b
|
||||
cp SCGB_DEFAULT
|
||||
jr nz, .not_ram
|
||||
jr nz, .not_default
|
||||
ld a, [wDefaultSGBLayout]
|
||||
.not_ram
|
||||
.not_default
|
||||
push af
|
||||
farcall ResetBGPals
|
||||
pop af
|
||||
ld l, a
|
||||
ld h, 0
|
||||
add hl, hl
|
||||
ld de, .dw
|
||||
ld de, .Jumptable
|
||||
add hl, de
|
||||
ld a, [hli]
|
||||
ld h, [hl]
|
||||
@ -18,15 +18,16 @@ GetMysteryGift_MobileAdapterLayout:
|
||||
ld de, .done
|
||||
push de
|
||||
jp hl
|
||||
.done
|
||||
.done:
|
||||
ret
|
||||
|
||||
.dw
|
||||
dw MG_Mobile_Layout00
|
||||
dw MG_Mobile_Layout01
|
||||
dw MG_Mobile_Layout02
|
||||
.Jumptable:
|
||||
dw _CrystalCGB_MobileLayout0
|
||||
dw _CrystalCGB_MobileLayout1
|
||||
dw _CrystalCGB_NameCard
|
||||
|
||||
MG_Mobile_Layout_FillBox:
|
||||
Crystal_FillBoxCGB:
|
||||
; This is a copy of FillBoxCGB.
|
||||
.row
|
||||
push bc
|
||||
push hl
|
||||
@ -42,7 +43,8 @@ MG_Mobile_Layout_FillBox:
|
||||
jr nz, .row
|
||||
ret
|
||||
|
||||
MG_Mobile_Layout_WipeAttrmap:
|
||||
Crystal_WipeAttrmap:
|
||||
; This is a copy of WipeAttrmap.
|
||||
hlcoord 0, 0, wAttrmap
|
||||
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
|
||||
xor a
|
||||
@ -62,9 +64,9 @@ MG_Mobile_Layout_LoadPals:
|
||||
call FarCopyWRAM
|
||||
ret
|
||||
|
||||
MG_Mobile_Layout00:
|
||||
_CrystalCGB_MobileLayout0:
|
||||
call MG_Mobile_Layout_LoadPals
|
||||
call MG_Mobile_Layout_WipeAttrmap
|
||||
call Crystal_WipeAttrmap
|
||||
call MG_Mobile_Layout_CreatePalBoxes
|
||||
farcall ApplyAttrmap
|
||||
farcall ApplyPals
|
||||
@ -74,33 +76,33 @@ MG_Mobile_Layout_CreatePalBoxes:
|
||||
hlcoord 0, 0, wAttrmap
|
||||
lb bc, 4, 1
|
||||
ld a, $1
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
lb bc, 2, 1
|
||||
ld a, $2
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
lb bc, 6, 1
|
||||
ld a, $3
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
hlcoord 1, 0, wAttrmap
|
||||
ld a, $1
|
||||
lb bc, 3, 18
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
lb bc, 2, 18
|
||||
ld a, $2
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
lb bc, 12, 18
|
||||
ld a, $3
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
hlcoord 19, 0, wAttrmap
|
||||
lb bc, 4, 1
|
||||
ld a, $1
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
lb bc, 2, 1
|
||||
ld a, $2
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
lb bc, 6, 1
|
||||
ld a, $3
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
hlcoord 0, 12, wAttrmap
|
||||
ld bc, 6 * SCREEN_WIDTH
|
||||
ld a, $7
|
||||
@ -129,14 +131,14 @@ Function49420::
|
||||
call FarCopyWRAM
|
||||
ret
|
||||
|
||||
MG_Mobile_Layout01:
|
||||
_CrystalCGB_MobileLayout1:
|
||||
call MG_Mobile_Layout_LoadPals
|
||||
ld de, wBGPals1 palette PAL_BG_TEXT
|
||||
ld hl, .TextPalette
|
||||
ld bc, 1 palettes
|
||||
ld a, BANK(wBGPals1)
|
||||
call FarCopyWRAM
|
||||
call MG_Mobile_Layout_WipeAttrmap
|
||||
call Crystal_WipeAttrmap
|
||||
hlcoord 0, 0, wAttrmap
|
||||
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
|
||||
xor a
|
||||
@ -170,7 +172,7 @@ Function49480:
|
||||
hlcoord 0, 0, wAttrmap
|
||||
lb bc, 4, SCREEN_WIDTH
|
||||
ld a, $7
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
hlcoord 0, 2, wAttrmap
|
||||
ld a, $4
|
||||
ld [hl], a
|
||||
@ -182,7 +184,7 @@ Function49496:
|
||||
hlcoord 0, 0, wAttrmap
|
||||
lb bc, 2, SCREEN_WIDTH
|
||||
ld a, $7
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
hlcoord 0, 1, wAttrmap
|
||||
ld a, $4
|
||||
ld [hl], a
|
||||
@ -192,14 +194,14 @@ Function49496:
|
||||
|
||||
INCLUDE "engine/tilesets/tileset_palettes.asm"
|
||||
|
||||
MG_Mobile_Layout02:
|
||||
_CrystalCGB_NameCard:
|
||||
ld hl, .BGPalette
|
||||
ld de, wBGPals1
|
||||
ld bc, 1 palettes
|
||||
ld a, BANK(wBGPals1)
|
||||
call FarCopyWRAM
|
||||
farcall ApplyPals
|
||||
call MG_Mobile_Layout_WipeAttrmap
|
||||
call Crystal_WipeAttrmap
|
||||
farcall ApplyAttrmap
|
||||
ld hl, .OBPalette
|
||||
ld de, wOBPals1
|
||||
@ -236,38 +238,38 @@ _InitMG_Mobile_LinkTradePalMap:
|
||||
hlcoord 0, 0, wAttrmap
|
||||
lb bc, 16, 2
|
||||
ld a, $4
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
ld a, $3
|
||||
ldcoord_a 0, 1, wAttrmap
|
||||
ldcoord_a 0, 14, wAttrmap
|
||||
hlcoord 2, 0, wAttrmap
|
||||
lb bc, 8, 18
|
||||
ld a, $5
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
hlcoord 2, 8, wAttrmap
|
||||
lb bc, 8, 18
|
||||
ld a, $6
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
hlcoord 0, 16, wAttrmap
|
||||
lb bc, 2, SCREEN_WIDTH
|
||||
ld a, $4
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
ld a, $3
|
||||
lb bc, 6, 1
|
||||
hlcoord 6, 1, wAttrmap
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
ld a, $3
|
||||
lb bc, 6, 1
|
||||
hlcoord 17, 1, wAttrmap
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
ld a, $3
|
||||
lb bc, 6, 1
|
||||
hlcoord 6, 9, wAttrmap
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
ld a, $3
|
||||
lb bc, 6, 1
|
||||
hlcoord 17, 9, wAttrmap
|
||||
call MG_Mobile_Layout_FillBox
|
||||
call Crystal_FillBoxCGB
|
||||
ld a, $2
|
||||
hlcoord 2, 16, wAttrmap
|
||||
ld [hli], a
|
||||
|
@ -22,6 +22,8 @@ REGION_CODE EQU $90 ; USA
|
||||
|
||||
MESSAGE_PREFIX EQU $5a
|
||||
|
||||
NAME_CARD_PREFIX EQU $3c
|
||||
|
||||
DoMysteryGift:
|
||||
call ClearTilemap
|
||||
call ClearSprites
|
||||
@ -260,14 +262,14 @@ DoMysteryGift:
|
||||
ExchangeMysteryGiftData:
|
||||
di
|
||||
farcall ClearChannels
|
||||
call InitializeMysteryGiftInterrupts
|
||||
call InitializeIRCommunicationInterrupts
|
||||
|
||||
.restart
|
||||
call BeginIRCommunication
|
||||
call InitializeIRCommunicationRoles
|
||||
ldh a, [hMGStatusFlags]
|
||||
cp MG_CANCELED
|
||||
jp z, EndOrContinueIRCommunication
|
||||
jp z, EndOrContinueMysteryGiftIRCommunication
|
||||
cp MG_OKAY
|
||||
jr nz, .restart
|
||||
|
||||
@ -279,8 +281,8 @@ ExchangeMysteryGiftData:
|
||||
ld b, 1
|
||||
call TryReceivingIRDataBlock
|
||||
jr nz, .failed
|
||||
call ReceiveIRDataPayload_GotRegionPrefix
|
||||
jp nz, EndOrContinueIRCommunication
|
||||
call ReceiveMysteryGiftDataPayload_GotRegionPrefix
|
||||
jp nz, EndOrContinueMysteryGiftIRCommunication
|
||||
jr ReceiverExchangeMysteryGiftDataPayloads_GotPayload
|
||||
|
||||
.failed
|
||||
@ -328,52 +330,52 @@ ExchangeMysteryGiftData:
|
||||
jr z, .continue
|
||||
ld a, MG_CANCELED
|
||||
ldh [hMGStatusFlags], a
|
||||
jp EndOrContinueIRCommunication
|
||||
jp EndOrContinueMysteryGiftIRCommunication
|
||||
|
||||
ReceiverExchangeMysteryGiftDataPayloads:
|
||||
; Receive the data payload
|
||||
call ReceiveIRDataPayload
|
||||
jp nz, EndOrContinueIRCommunication
|
||||
call ReceiveMysteryGiftDataPayload
|
||||
jp nz, EndOrContinueMysteryGiftIRCommunication
|
||||
; fallthrough
|
||||
ReceiverExchangeMysteryGiftDataPayloads_GotPayload:
|
||||
; Switch roles
|
||||
call BeginSendingIRCommunication
|
||||
jp nz, EndOrContinueIRCommunication
|
||||
jp nz, EndOrContinueMysteryGiftIRCommunication
|
||||
; Send the data payload
|
||||
call SendIRDataPayload
|
||||
jp nz, EndOrContinueIRCommunication
|
||||
call SendMysteryGiftDataPayload
|
||||
jp nz, EndOrContinueMysteryGiftIRCommunication
|
||||
; Switch roles
|
||||
call BeginReceivingIRCommunication
|
||||
jp nz, EndOrContinueIRCommunication
|
||||
jp nz, EndOrContinueMysteryGiftIRCommunication
|
||||
; Receive an empty block
|
||||
call ReceiveEmptyIRDataBlock
|
||||
jp EndOrContinueIRCommunication
|
||||
jp EndOrContinueMysteryGiftIRCommunication
|
||||
|
||||
SenderExchangeMysteryGiftDataPayloads:
|
||||
; Send the data payload
|
||||
call SendIRDataPayload
|
||||
jp nz, EndOrContinueIRCommunication
|
||||
call SendMysteryGiftDataPayload
|
||||
jp nz, EndOrContinueMysteryGiftIRCommunication
|
||||
; Switch roles
|
||||
call BeginReceivingIRCommunication
|
||||
jp nz, EndOrContinueIRCommunication
|
||||
jp nz, EndOrContinueMysteryGiftIRCommunication
|
||||
; Receive the data payload
|
||||
call ReceiveIRDataPayload
|
||||
jp nz, EndOrContinueIRCommunication
|
||||
call ReceiveMysteryGiftDataPayload
|
||||
jp nz, EndOrContinueMysteryGiftIRCommunication
|
||||
; Switch roles
|
||||
call BeginSendingIRCommunication
|
||||
jp nz, EndOrContinueIRCommunication
|
||||
jp nz, EndOrContinueMysteryGiftIRCommunication
|
||||
; Send an empty block
|
||||
call SendEmptyIRDataBlock
|
||||
jp EndOrContinueIRCommunication
|
||||
jp EndOrContinueMysteryGiftIRCommunication
|
||||
|
||||
ReceiveIRDataPayload:
|
||||
ReceiveMysteryGiftDataPayload:
|
||||
; Receive the region prefix
|
||||
ld hl, hMGExchangedByte
|
||||
ld b, 1
|
||||
call TryReceivingIRDataBlock
|
||||
ret nz
|
||||
; fallthrough
|
||||
ReceiveIRDataPayload_GotRegionPrefix:
|
||||
ReceiveMysteryGiftDataPayload_GotRegionPrefix:
|
||||
; Receive an empty block
|
||||
call ReceiveEmptyIRDataBlock
|
||||
ldh a, [hMGStatusFlags]
|
||||
@ -413,7 +415,7 @@ ReceiveIRDataPayload_GotRegionPrefix:
|
||||
cp MG_OKAY
|
||||
ret
|
||||
|
||||
SendIRDataPayload:
|
||||
SendMysteryGiftDataPayload:
|
||||
; Send the region prefix
|
||||
ld a, REGION_PREFIX
|
||||
ldh [hMGExchangedByte], a
|
||||
@ -458,7 +460,7 @@ SendIRDataPayload:
|
||||
cp MG_OKAY
|
||||
ret
|
||||
|
||||
EndOrContinueIRCommunication:
|
||||
EndOrContinueMysteryGiftIRCommunication:
|
||||
nop
|
||||
ldh a, [hMGStatusFlags]
|
||||
; Quit if player canceled
|
||||
@ -491,12 +493,12 @@ EndOrContinueIRCommunication:
|
||||
jr z, .sender
|
||||
; receiver
|
||||
call BeginReceivingIRCommunication
|
||||
jr nz, EndOrContinueIRCommunication
|
||||
jr nz, EndOrContinueMysteryGiftIRCommunication
|
||||
jp ReceiverExchangeMysteryGiftDataPayloads
|
||||
|
||||
.sender
|
||||
call BeginSendingIRCommunication
|
||||
jr nz, EndOrContinueIRCommunication
|
||||
jr nz, EndOrContinueMysteryGiftIRCommunication
|
||||
jp SenderExchangeMysteryGiftDataPayloads
|
||||
|
||||
.quit
|
||||
@ -513,121 +515,149 @@ EndOrContinueIRCommunication:
|
||||
pop af
|
||||
ret
|
||||
|
||||
Function104c2d:
|
||||
ExchangeNameCardData:
|
||||
di
|
||||
farcall ClearChannels
|
||||
call InitializeMysteryGiftInterrupts
|
||||
call InitializeIRCommunicationInterrupts
|
||||
|
||||
.loop2
|
||||
.restart
|
||||
call BeginIRCommunication
|
||||
call InitializeIRCommunicationRoles
|
||||
ldh a, [hMGStatusFlags]
|
||||
cp MG_CANCELED
|
||||
jp z, Function104d1c
|
||||
jp z, EndNameCardIRCommunication
|
||||
cp MG_OKAY
|
||||
jr nz, .loop2
|
||||
jr nz, .restart
|
||||
|
||||
ldh a, [hMGRole]
|
||||
cp IR_SENDER
|
||||
jr z, .sender
|
||||
; receiver
|
||||
call Function104c8a
|
||||
jp nz, Function104d1c
|
||||
; Receive the data payload
|
||||
call ReceiveNameCardDataPayload
|
||||
jp nz, EndNameCardIRCommunication
|
||||
; Switch roles
|
||||
call BeginSendingIRCommunication
|
||||
jp nz, Function104d1c
|
||||
call Function104cd2
|
||||
jp nz, Function104d1c
|
||||
jp nz, EndNameCardIRCommunication
|
||||
; Send the data payload
|
||||
call SendNameCardDataPayload
|
||||
jp nz, EndNameCardIRCommunication
|
||||
; Switch roles
|
||||
call BeginReceivingIRCommunication
|
||||
jp nz, Function104d1c
|
||||
jp nz, EndNameCardIRCommunication
|
||||
; Receive an empty block
|
||||
call ReceiveEmptyIRDataBlock
|
||||
jp Function104d1c
|
||||
jp EndNameCardIRCommunication
|
||||
|
||||
.sender
|
||||
call Function104cd2
|
||||
jp nz, Function104d1c
|
||||
; Send the data payload
|
||||
call SendNameCardDataPayload
|
||||
jp nz, EndNameCardIRCommunication
|
||||
; Switch roles
|
||||
call BeginReceivingIRCommunication
|
||||
jp nz, Function104d1c
|
||||
call Function104c8a
|
||||
jp nz, Function104d1c
|
||||
jp nz, EndNameCardIRCommunication
|
||||
; Receive the data payload
|
||||
call ReceiveNameCardDataPayload
|
||||
jp nz, EndNameCardIRCommunication
|
||||
; Switch roles
|
||||
call BeginSendingIRCommunication
|
||||
jp nz, Function104d1c
|
||||
jp nz, EndNameCardIRCommunication
|
||||
; Send an empty block
|
||||
call SendEmptyIRDataBlock
|
||||
jp Function104d1c
|
||||
jp EndNameCardIRCommunication
|
||||
|
||||
Function104c8a:
|
||||
ReceiveNameCardDataPayload:
|
||||
; Receive the Name Card prefix
|
||||
ld hl, hMGExchangedByte
|
||||
ld b, 1
|
||||
call TryReceivingIRDataBlock
|
||||
ret nz
|
||||
; Receive an empty block
|
||||
call ReceiveEmptyIRDataBlock
|
||||
ldh a, [hMGStatusFlags]
|
||||
cp MG_OKAY
|
||||
ret nz
|
||||
; Verify the received Name Card prefix
|
||||
ldh a, [hMGExchangedByte]
|
||||
cp $3c
|
||||
cp NAME_CARD_PREFIX
|
||||
jp nz, WrongMysteryGiftRegion
|
||||
swap a
|
||||
ldh [hMGExchangedByte], a
|
||||
; Switch roles
|
||||
call BeginSendingIRCommunication
|
||||
ret nz
|
||||
; Send the swapped Name Card prefix
|
||||
ld hl, hMGExchangedByte
|
||||
ld b, 1
|
||||
call TrySendingIRDataBlock
|
||||
ret nz
|
||||
; Send an empty block
|
||||
call SendEmptyIRDataBlock
|
||||
ldh a, [hMGStatusFlags]
|
||||
cp MG_OKAY
|
||||
ret nz
|
||||
; Switch roles
|
||||
call BeginReceivingIRCommunication
|
||||
ret nz
|
||||
ld hl, wMysteryGiftTrainer
|
||||
; Receive the staged data
|
||||
ld hl, wNameCardData
|
||||
ld a, [wMysteryGiftStagedDataLength]
|
||||
ld b, a
|
||||
call TryReceivingIRDataBlock
|
||||
ret nz
|
||||
; Receive an empty block
|
||||
call ReceiveEmptyIRDataBlock
|
||||
ldh a, [hMGStatusFlags]
|
||||
cp MG_OKAY
|
||||
ret
|
||||
|
||||
Function104cd2:
|
||||
ld a, $3c
|
||||
SendNameCardDataPayload:
|
||||
; Send the Name Card prefix
|
||||
ld a, NAME_CARD_PREFIX
|
||||
ldh [hMGExchangedByte], a
|
||||
ld hl, hMGExchangedByte
|
||||
ld b, 1
|
||||
call TrySendingIRDataBlock
|
||||
ret nz
|
||||
; Send an empty block
|
||||
call SendEmptyIRDataBlock
|
||||
ldh a, [hMGStatusFlags]
|
||||
cp MG_OKAY
|
||||
ret nz
|
||||
; Switch roles
|
||||
call BeginReceivingIRCommunication
|
||||
ret nz
|
||||
; Receive the swapped Name Card prefix
|
||||
ld hl, hMGExchangedByte
|
||||
ld b, 1
|
||||
call TryReceivingIRDataBlock
|
||||
ret nz
|
||||
; Receive an empty block
|
||||
call ReceiveEmptyIRDataBlock
|
||||
ldh a, [hMGStatusFlags]
|
||||
cp MG_OKAY
|
||||
ret nz
|
||||
; Verify the received swapped Name Card prefix
|
||||
ldh a, [hMGExchangedByte]
|
||||
swap a
|
||||
cp $3c
|
||||
cp NAME_CARD_PREFIX
|
||||
jp nz, WrongMysteryGiftRegion
|
||||
; Switch roles
|
||||
call BeginSendingIRCommunication
|
||||
ret nz
|
||||
; Send the staged data
|
||||
ld hl, wMysteryGiftStaging
|
||||
ld a, [wMysteryGiftStagedDataLength]
|
||||
ld b, a
|
||||
call TrySendingIRDataBlock
|
||||
ret nz
|
||||
; Send an empty block
|
||||
call SendEmptyIRDataBlock
|
||||
ldh a, [hMGStatusFlags]
|
||||
cp MG_OKAY
|
||||
ret
|
||||
|
||||
Function104d1c:
|
||||
EndNameCardIRCommunication:
|
||||
nop
|
||||
ldh a, [hMGStatusFlags]
|
||||
push af
|
||||
@ -674,7 +704,7 @@ TryReceivingIRDataBlock:
|
||||
cp MG_OKAY
|
||||
ret
|
||||
|
||||
InitializeMysteryGiftInterrupts:
|
||||
InitializeIRCommunicationInterrupts:
|
||||
call StartFastIRTimer
|
||||
ld a, 1 << TIMER
|
||||
ldh [rIE], a
|
||||
@ -1175,6 +1205,7 @@ ReceiveIRDataMessage:
|
||||
ld d, 0
|
||||
call ReceiveInfraredLEDOn
|
||||
jp z, InfraredLEDReceiveTimedOut
|
||||
|
||||
ld d, 16
|
||||
call SendInfraredLEDOff
|
||||
ret
|
||||
@ -1536,22 +1567,22 @@ InitMysteryGiftLayout:
|
||||
MysteryGiftGFX:
|
||||
INCBIN "gfx/mystery_gift/mystery_gift.2bpp"
|
||||
|
||||
Function105688:
|
||||
DoNameCardSwap:
|
||||
call ClearTilemap
|
||||
call ClearSprites
|
||||
call WaitBGMap
|
||||
call Function1057d7
|
||||
call InitNameCardLayout
|
||||
hlcoord 3, 8
|
||||
ld de, String_PressAToLink_BToCancel_JP
|
||||
ld de, .String_PressAToLink_BToCancel_JP
|
||||
call PlaceString
|
||||
call WaitBGMap
|
||||
call Function10578c
|
||||
call StageDataForNameCard
|
||||
call ClearMysteryGiftTrainer
|
||||
ld a, $24
|
||||
ld a, wNameCardDataEnd - wNameCardData
|
||||
ld [wMysteryGiftStagedDataLength], a
|
||||
ldh a, [rIE]
|
||||
push af
|
||||
call Function104c2d
|
||||
call ExchangeNameCardData
|
||||
ld d, a
|
||||
xor a
|
||||
ldh [rIF], a
|
||||
@ -1559,25 +1590,25 @@ Function105688:
|
||||
ldh [rIE], a
|
||||
ld a, d
|
||||
cp $10
|
||||
jp z, Function105712
|
||||
cp %01101100
|
||||
jp nz, Function10571a
|
||||
call Function1056eb
|
||||
jp z, .LinkCanceled
|
||||
cp MG_OKAY
|
||||
jp nz, .CommunicationError
|
||||
call .SlideNameCardUpOffScreen
|
||||
ld c, 60
|
||||
call DelayFrames
|
||||
call Function105777
|
||||
ld hl, MysteryGiftReceivedCardText
|
||||
call .ClearScreen
|
||||
ld hl, .NameCardReceivedCardText
|
||||
call PrintText
|
||||
ld de, wMysteryGiftTrainer
|
||||
ld de, wNameCardData
|
||||
farcall Function8ac70
|
||||
ld a, c
|
||||
ld [wDeciramBuffer], a
|
||||
ld hl, MysteryGiftNotRegisteredCardText
|
||||
jr c, PrintTextAndExit_JP
|
||||
ld hl, MysteryGiftListedCardText
|
||||
jr PrintTextAndExit_JP
|
||||
ld hl, .NameCardNotRegisteredCardText
|
||||
jr c, .PrintTextAndExit
|
||||
ld hl, .NameCardListedCardText
|
||||
jr .PrintTextAndExit
|
||||
|
||||
Function1056eb:
|
||||
.SlideNameCardUpOffScreen:
|
||||
ld c, 16
|
||||
.loop
|
||||
ld hl, wVirtualOAMSprite00YCoord
|
||||
@ -1606,51 +1637,51 @@ endr
|
||||
pop bc
|
||||
jr .loop
|
||||
|
||||
Function105712:
|
||||
call Function105777
|
||||
ld hl, MysteryGiftLinkCancelledText
|
||||
jr PrintTextAndExit_JP
|
||||
.LinkCanceled:
|
||||
call .ClearScreen
|
||||
ld hl, .NameCardLinkCancelledText
|
||||
jr .PrintTextAndExit
|
||||
|
||||
Function10571a:
|
||||
call Function105777
|
||||
ld hl, MysteryGiftLinkCommErrorText
|
||||
.CommunicationError:
|
||||
call .ClearScreen
|
||||
ld hl, .NameCardCommErrorText
|
||||
call PrintText
|
||||
jp Function105688
|
||||
jp DoNameCardSwap
|
||||
|
||||
PrintTextAndExit_JP:
|
||||
.PrintTextAndExit:
|
||||
call PrintText
|
||||
ld a, LCDC_DEFAULT
|
||||
ldh [rLCDC], a
|
||||
ret
|
||||
|
||||
String_PressAToLink_BToCancel_JP:
|
||||
.String_PressAToLink_BToCancel_JP:
|
||||
db "エーボタン<WO>おすと"
|
||||
next "つうしん<PKMN>おこなわれるよ!"
|
||||
next "ビーボタン<WO>おすと"
|
||||
next "つうしん<WO>ちゅうし します"
|
||||
db "@"
|
||||
|
||||
MysteryGiftReceivedCardText:
|
||||
text_far _MysteryGiftReceivedCardText
|
||||
.NameCardReceivedCardText:
|
||||
text_far _NameCardReceivedCardText
|
||||
text_end
|
||||
|
||||
MysteryGiftListedCardText:
|
||||
text_far _MysteryGiftListedCardText
|
||||
.NameCardListedCardText:
|
||||
text_far _NameCardListedCardText
|
||||
text_end
|
||||
|
||||
MysteryGiftNotRegisteredCardText:
|
||||
text_far _MysteryGiftNotRegisteredCardText
|
||||
.NameCardNotRegisteredCardText:
|
||||
text_far _NameCardNotRegisteredCardText
|
||||
text_end
|
||||
|
||||
MysteryGiftLinkCancelledText:
|
||||
text_far _MysteryGiftLinkCancelledText
|
||||
.NameCardLinkCancelledText:
|
||||
text_far _NameCardLinkCancelledText
|
||||
text_end
|
||||
|
||||
MysteryGiftLinkCommErrorText:
|
||||
text_far _MysteryGiftLinkCommErrorText
|
||||
.NameCardCommErrorText:
|
||||
text_far _NameCardLinkCommErrorText
|
||||
text_end
|
||||
|
||||
Function105777:
|
||||
.ClearScreen:
|
||||
call ClearSprites
|
||||
call ClearTilemap
|
||||
call EnableLCD
|
||||
@ -1660,8 +1691,8 @@ Function105777:
|
||||
call SetPalettes
|
||||
ret
|
||||
|
||||
Function10578c:
|
||||
ld de, wLinkData
|
||||
StageDataForNameCard:
|
||||
ld de, wMysteryGiftStaging
|
||||
ld a, BANK(sPlayerData)
|
||||
call OpenSRAM
|
||||
ld hl, sPlayerData + wPlayerName - wPlayerData
|
||||
@ -1682,15 +1713,15 @@ Function10578c:
|
||||
ld a, BANK(s4_a603) ; aka BANK(s4_a007) ; MBC30 bank used by JP Crystal; inaccessible by MBC3
|
||||
call OpenSRAM
|
||||
ld hl, s4_a603 ; address of MBC30 bank
|
||||
ld bc, $8
|
||||
ld bc, 8
|
||||
call CopyBytes
|
||||
ld hl, s4_a007 ; address of MBC30 bank
|
||||
ld bc, $c
|
||||
ld bc, 12
|
||||
call CopyBytes
|
||||
call CloseSRAM
|
||||
ret
|
||||
|
||||
Function1057d7:
|
||||
InitNameCardLayout:
|
||||
call ClearBGPalettes
|
||||
call DisableLCD
|
||||
ld hl, CardTradeGFX
|
||||
@ -1775,13 +1806,13 @@ Function1057d7:
|
||||
hlcoord 17, 15
|
||||
ld [hl], $3e
|
||||
ld de, wVirtualOAMSprite00
|
||||
ld hl, .OAM_data
|
||||
ld hl, .NameCardOAMData
|
||||
ld bc, 16 * SPRITEOAMSTRUCT_LENGTH
|
||||
call CopyBytes
|
||||
call EnableLCD
|
||||
call WaitBGMap
|
||||
ld b, $2
|
||||
farcall GetMysteryGift_MobileAdapterLayout
|
||||
ld b, CRYSTAL_CGB_NAME_CARD
|
||||
farcall GetCrystalCGBLayout
|
||||
jp SetPalettes
|
||||
|
||||
.Load6Row:
|
||||
@ -1829,7 +1860,7 @@ Function1057d7:
|
||||
jr nz, .row_loop_no_inc
|
||||
ret
|
||||
|
||||
.OAM_data:
|
||||
.NameCardOAMData:
|
||||
dbsprite 6, 2, 4, 1, $00, 0
|
||||
dbsprite 7, 2, 4, 1, $01, 0
|
||||
dbsprite 8, 2, 4, 1, $02, 0
|
||||
|
@ -45,8 +45,8 @@ InitMobileProfile:
|
||||
ld [wMusicFadeID + 1], a
|
||||
ld c, 20
|
||||
call DelayFrames
|
||||
ld b, $1
|
||||
call GetMysteryGift_MobileAdapterLayout
|
||||
ld b, CRYSTAL_CGB_MOBILE_1
|
||||
call GetCrystalCGBLayout
|
||||
call ClearBGPalettes
|
||||
hlcoord 0, 0
|
||||
ld b, 2
|
||||
@ -652,8 +652,8 @@ Wakayama: db "わかやまけん@" ; Wakayama
|
||||
Function48689:
|
||||
ld c, 7
|
||||
call DelayFrames
|
||||
ld b, $1
|
||||
call GetMysteryGift_MobileAdapterLayout
|
||||
ld b, CRYSTAL_CGB_MOBILE_1
|
||||
call GetCrystalCGBLayout
|
||||
call ClearBGPalettes
|
||||
hlcoord 0, 0
|
||||
ld b, 4
|
||||
|
@ -3964,7 +3964,7 @@ Function8ab3b:
|
||||
Function8ab93:
|
||||
call ClearBGPalettes
|
||||
call LoadStandardMenuHeader
|
||||
farcall Function105688
|
||||
farcall DoNameCardSwap
|
||||
call ClearSprites
|
||||
call Function891fe
|
||||
call Function89b28
|
||||
|
@ -603,7 +603,7 @@ Function4a485:
|
||||
ret
|
||||
|
||||
Function4a492:
|
||||
call MG_Mobile_Layout00
|
||||
call _CrystalCGB_MobileLayout0
|
||||
ret
|
||||
|
||||
MainMenu_MobileStudium:
|
||||
|
Loading…
Reference in New Issue
Block a user