mirror of
https://github.com/pret/pokecrystal.git
synced 2026-04-26 00:23:43 -05:00
Update link.asm and WRAM link transfer related symbols
This commit is contained in:
parent
45ef09d2bc
commit
17b59c8953
|
|
@ -53,7 +53,7 @@ DEF MAX_ITEM_STACK EQU 99
|
|||
|
||||
; mail
|
||||
DEF MAIL_LINE_LENGTH EQU $10
|
||||
DEF MAIL_MSG_LENGTH EQU $20
|
||||
DEF MAIL_MSG_LENGTH EQU 2 * MAIL_LINE_LENGTH
|
||||
DEF MAILBOX_CAPACITY EQU 10
|
||||
DEF MAIL_STRUCT_LENGTH EQU $2f ; mailmsg struct
|
||||
DEF MAIL_STRUCT_LENGTH_JP EQU $2a ; mailmsg_jp struct
|
||||
|
|
|
|||
|
|
@ -37,10 +37,20 @@ DEF SERIAL_RN_PREAMBLE_LENGTH EQU 7
|
|||
DEF SERIAL_PATCH_PREAMBLE_LENGTH EQU 3
|
||||
DEF SERIAL_RNS_LENGTH EQU 10
|
||||
|
||||
DEF SERIAL_PADDING_LENGTH EQU 3
|
||||
|
||||
; Gen 2 to Gen 2 link party data structure
|
||||
DEF LINK_PARTY_DATA_LENGTH EQU NAME_LENGTH + (1 + PARTY_LENGTH + 1) + 2 + (PARTYMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH
|
||||
; Gen 2 to Gen 1 link party data structure (Time Capsule)
|
||||
DEF LINK_TIME_CAPSULE_PARTY_DATA_LENGTH EQU NAME_LENGTH + (1 + PARTY_LENGTH + 1) + (REDMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH
|
||||
|
||||
|
||||
DEF SERIAL_MAIL_PREAMBLE_BYTE EQU $20
|
||||
DEF SERIAL_MAIL_PREAMBLE_LENGTH EQU 5
|
||||
; used to replace SERIAL_NO_DATA_BYTE
|
||||
DEF SERIAL_MAIL_REPLACEMENT_BYTE EQU $21
|
||||
; length of the mail patch list (it's bigger than the mail patched area by 18 bytes)
|
||||
DEF SERIAL_MAIL_PATCH_LIST_LENGTH EQU (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1) + 3) * PARTY_LENGTH + 1
|
||||
|
||||
; timeout duration after exchanging a byte
|
||||
DEF SERIAL_LINK_BYTE_TIMEOUT EQU $5000
|
||||
|
|
|
|||
|
|
@ -81,16 +81,16 @@ endc
|
|||
ldh [rIE], a
|
||||
|
||||
ld hl, wLinkBattleRNPreamble
|
||||
ld de, wEnemyMon
|
||||
ld de, wOTLinkBattleRNData
|
||||
ld bc, SERIAL_RN_PREAMBLE_LENGTH + SERIAL_RNS_LENGTH
|
||||
vc_hook Wireless_ExchangeBytes_Gen2toGen1_RNG_state
|
||||
call Serial_ExchangeBytes
|
||||
ld a, SERIAL_NO_DATA_BYTE
|
||||
ld [de], a
|
||||
|
||||
ld hl, wLinkData
|
||||
ld de, wOTPartyData
|
||||
ld bc, SERIAL_PREAMBLE_LENGTH + NAME_LENGTH + (1 + PARTY_LENGTH + 1) + (REDMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH + 3
|
||||
ld hl, wLinkSendTimeCapsuleParty
|
||||
ld de, wLinkReceivedPartyData
|
||||
ld bc, SERIAL_PREAMBLE_LENGTH + LINK_TIME_CAPSULE_PARTY_DATA_LENGTH + SERIAL_PADDING_LENGTH
|
||||
vc_hook Wireless_ExchangeBytes_Gen2toGen1_party_structs
|
||||
call Serial_ExchangeBytes
|
||||
ld a, SERIAL_NO_DATA_BYTE
|
||||
|
|
@ -109,7 +109,7 @@ endc
|
|||
|
||||
call Link_CopyRandomNumbers
|
||||
|
||||
ld hl, wOTPartyData
|
||||
ld hl, wLinkReceivedPartyData
|
||||
call Link_FindFirstNonControlCharacter_SkipZero
|
||||
push hl
|
||||
ld bc, NAME_LENGTH
|
||||
|
|
@ -121,13 +121,13 @@ endc
|
|||
cp $7
|
||||
jp nc, ExitLinkCommunications
|
||||
|
||||
ld de, wLinkData
|
||||
ld bc, NAME_LENGTH + (1 + PARTY_LENGTH + 1) + (REDMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH + 3
|
||||
ld de, wLinkPlayerName
|
||||
ld bc, LINK_TIME_CAPSULE_PARTY_DATA_LENGTH + SERIAL_PADDING_LENGTH
|
||||
call Link_CopyOTData
|
||||
|
||||
ld de, wOTPatchLists
|
||||
ld hl, wTimeCapsulePlayerData
|
||||
ld c, 2
|
||||
ld hl, wTimeCapsulePatchedData
|
||||
ld c, 2 ; number of patch lists
|
||||
.loop
|
||||
ld a, [de]
|
||||
inc de
|
||||
|
|
@ -152,11 +152,11 @@ endc
|
|||
jr .loop
|
||||
|
||||
.next
|
||||
ld hl, wTimeCapsulePlayerData + SERIAL_PATCH_DATA_SIZE
|
||||
ld hl, wTimeCapsulePatchedData + SERIAL_PATCH_DATA_SIZE
|
||||
dec c
|
||||
jr nz, .loop
|
||||
|
||||
ld hl, wLinkData
|
||||
ld hl, wLinkPlayerName
|
||||
ld de, wOTPlayerName
|
||||
ld bc, NAME_LENGTH
|
||||
call CopyBytes
|
||||
|
|
@ -183,7 +183,7 @@ endc
|
|||
|
||||
.done_party
|
||||
ld [de], a
|
||||
ld hl, wTimeCapsulePlayerData
|
||||
ld hl, wTimeCapsulePatchedData
|
||||
call Link_ConvertPartyStruct1to2
|
||||
|
||||
ld a, LOW(wOTPartyMonOTs)
|
||||
|
|
@ -254,9 +254,9 @@ endc
|
|||
ld a, SERIAL_NO_DATA_BYTE
|
||||
ld [de], a
|
||||
|
||||
ld hl, wLinkData
|
||||
ld de, wOTPartyData
|
||||
ld bc, SERIAL_PREAMBLE_LENGTH + NAME_LENGTH + (1 + PARTY_LENGTH + 1) + 2 + (PARTYMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH + 3
|
||||
ld hl, wLinkSendParty
|
||||
ld de, wLinkReceivedPartyData
|
||||
ld bc, SERIAL_PREAMBLE_LENGTH + LINK_PARTY_DATA_LENGTH + SERIAL_PADDING_LENGTH
|
||||
vc_hook Wireless_ExchangeBytes_party_structs
|
||||
call Serial_ExchangeBytes
|
||||
ld a, SERIAL_NO_DATA_BYTE
|
||||
|
|
@ -271,9 +271,9 @@ endc
|
|||
ld a, [wLinkMode]
|
||||
cp LINK_TRADECENTER
|
||||
jr nz, .not_trading
|
||||
ld hl, wLinkPlayerMail
|
||||
ld de, wLinkOTMail
|
||||
ld bc, wLinkPlayerMailEnd - wLinkPlayerMail
|
||||
ld hl, wLinkSendMail
|
||||
ld de, wLinkReceivedMail
|
||||
ld bc, wLinkSendMailEnd - wLinkSendMail
|
||||
vc_hook Wireless_ExchangeBytes_mail
|
||||
call ExchangeBytes
|
||||
.not_trading
|
||||
|
|
@ -287,26 +287,26 @@ endc
|
|||
|
||||
call Link_CopyRandomNumbers
|
||||
|
||||
ld hl, wOTPartyData
|
||||
ld hl, wLinkReceivedPartyData
|
||||
call Link_FindFirstNonControlCharacter_SkipZero
|
||||
ld de, wLinkData
|
||||
ld bc, NAME_LENGTH + 1 + PARTY_LENGTH + 1 + 2 + (PARTYMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH
|
||||
ld de, wLinkPlayerName
|
||||
ld bc, LINK_PARTY_DATA_LENGTH
|
||||
call Link_CopyOTData
|
||||
|
||||
ld de, wOTPatchLists
|
||||
ld hl, wLinkPlayerData
|
||||
ld c, 2
|
||||
.loop1
|
||||
ld hl, wLinkPlayerPatchedData
|
||||
ld c, 2 ; number of patch lists
|
||||
.party_patch_loop
|
||||
ld a, [de]
|
||||
inc de
|
||||
and a
|
||||
jr z, .loop1
|
||||
jr z, .party_patch_loop
|
||||
cp SERIAL_PREAMBLE_BYTE
|
||||
jr z, .loop1
|
||||
jr z, .party_patch_loop
|
||||
cp SERIAL_NO_DATA_BYTE
|
||||
jr z, .loop1
|
||||
jr z, .party_patch_loop
|
||||
cp SERIAL_PATCH_LIST_PART_TERMINATOR
|
||||
jr z, .next1
|
||||
jr z, .next_patch_list
|
||||
push hl
|
||||
push bc
|
||||
ld b, 0
|
||||
|
|
@ -317,66 +317,68 @@ endc
|
|||
ld [hl], a
|
||||
pop bc
|
||||
pop hl
|
||||
jr .loop1
|
||||
jr .party_patch_loop
|
||||
|
||||
.next1
|
||||
ld hl, wLinkPlayerData + SERIAL_PATCH_DATA_SIZE
|
||||
.next_patch_list
|
||||
ld hl, wLinkPlayerPatchedData + SERIAL_PATCH_DATA_SIZE
|
||||
dec c
|
||||
jr nz, .loop1
|
||||
jr nz, .party_patch_loop
|
||||
|
||||
ld a, [wLinkMode]
|
||||
cp LINK_TRADECENTER
|
||||
jp nz, .skip_mail
|
||||
ld hl, wLinkOTMail
|
||||
.loop2
|
||||
|
||||
; if we're in Trade Center, process received raw mail data
|
||||
ld hl, wLinkReceivedMail
|
||||
.find_mail_preamble
|
||||
ld a, [hli]
|
||||
cp SERIAL_MAIL_PREAMBLE_BYTE
|
||||
jr nz, .loop2
|
||||
.loop3
|
||||
jr nz, .find_mail_preamble
|
||||
.skip_mail_preamble
|
||||
ld a, [hli]
|
||||
cp SERIAL_NO_DATA_BYTE
|
||||
jr z, .loop3
|
||||
jr z, .skip_mail_preamble
|
||||
cp SERIAL_MAIL_PREAMBLE_BYTE
|
||||
jr z, .loop3
|
||||
jr z, .skip_mail_preamble
|
||||
dec hl
|
||||
|
||||
ld de, wLinkOTMail
|
||||
ld bc, wLinkDataEnd - wLinkOTMail ; should be wLinkOTMailEnd - wLinkOTMail
|
||||
ld de, wLinkReceivedMailMessages
|
||||
ld bc, wLinkDataEnd - wLinkReceivedMail ; should be wLinkReceivedMailEnd - wLinkReceivedMail
|
||||
call CopyBytes
|
||||
|
||||
; Replace SERIAL_MAIL_REPLACEMENT_BYTE with SERIAL_NO_DATA_BYTE across all mail
|
||||
; message bodies.
|
||||
ld hl, wLinkOTMailMessages
|
||||
ld hl, wLinkReceivedMailMessages
|
||||
ld bc, (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
|
||||
.loop4
|
||||
.mail_body_patch_loop
|
||||
ld a, [hl]
|
||||
cp SERIAL_MAIL_REPLACEMENT_BYTE
|
||||
jr nz, .okay1
|
||||
jr nz, .okay
|
||||
ld [hl], SERIAL_NO_DATA_BYTE
|
||||
.okay1
|
||||
.okay
|
||||
inc hl
|
||||
dec bc
|
||||
ld a, b
|
||||
or c
|
||||
jr nz, .loop4
|
||||
jr nz, .mail_body_patch_loop
|
||||
|
||||
ld de, wLinkOTMailPatchSet
|
||||
.loop5
|
||||
ld de, wLinkReceivedMailPatchSet
|
||||
.mail_metadata_patch_loop
|
||||
ld a, [de]
|
||||
inc de
|
||||
cp SERIAL_PATCH_LIST_PART_TERMINATOR
|
||||
jr z, .start_copying_mail
|
||||
ld hl, wLinkOTMailMetadata
|
||||
ld hl, wLinkReceivedMailMetadata
|
||||
dec a
|
||||
ld b, 0
|
||||
ld c, a
|
||||
add hl, bc
|
||||
ld [hl], SERIAL_NO_DATA_BYTE
|
||||
jr .loop5
|
||||
jr .mail_metadata_patch_loop
|
||||
|
||||
.start_copying_mail
|
||||
ld hl, wLinkOTMail
|
||||
ld de, wLinkReceivedMail
|
||||
ld hl, wLinkReceivedMailMessages
|
||||
ld de, wLinkOTMail
|
||||
ld b, PARTY_LENGTH
|
||||
.copy_mail_loop
|
||||
push bc
|
||||
|
|
@ -391,7 +393,8 @@ endc
|
|||
pop bc
|
||||
dec b
|
||||
jr nz, .copy_mail_loop
|
||||
ld de, wLinkReceivedMail
|
||||
|
||||
ld de, wLinkOTMail
|
||||
ld b, PARTY_LENGTH
|
||||
.copy_author_loop
|
||||
push bc
|
||||
|
|
@ -406,22 +409,23 @@ endc
|
|||
pop bc
|
||||
dec b
|
||||
jr nz, .copy_author_loop
|
||||
|
||||
ld b, PARTY_LENGTH
|
||||
ld de, wLinkReceivedMail
|
||||
.fix_mail_loop
|
||||
ld de, wLinkOTMail
|
||||
.translate_mail_loop
|
||||
push bc
|
||||
push de
|
||||
farcall ParseMailLanguage
|
||||
ld a, c
|
||||
or a
|
||||
or a ; MAIL_LANG_ENGLISH
|
||||
jr z, .next
|
||||
sub $3
|
||||
jr nc, .skip
|
||||
sub MAIL_LANG_ITALIAN
|
||||
jr nc, .italian_spanish
|
||||
farcall ConvertEnglishMailToFrenchGerman
|
||||
jr .next
|
||||
|
||||
.skip
|
||||
cp $2
|
||||
.italian_spanish
|
||||
cp (MAIL_LANG_SPANISH + 1) - MAIL_LANG_ITALIAN
|
||||
jr nc, .next
|
||||
farcall ConvertEnglishMailToSpanishItalian
|
||||
|
||||
|
|
@ -433,13 +437,14 @@ endc
|
|||
ld e, l
|
||||
pop bc
|
||||
dec b
|
||||
jr nz, .fix_mail_loop
|
||||
ld de, wLinkReceivedMailEnd
|
||||
jr nz, .translate_mail_loop
|
||||
|
||||
ld de, wLinkOTMailEnd
|
||||
xor a
|
||||
ld [de], a
|
||||
|
||||
.skip_mail
|
||||
ld hl, wLinkData
|
||||
ld hl, wLinkPlayerName
|
||||
ld de, wOTPlayerName
|
||||
ld bc, NAME_LENGTH
|
||||
call CopyBytes
|
||||
|
|
@ -646,7 +651,8 @@ endr
|
|||
jr nz, .clear_loop
|
||||
|
||||
; Loop through all the patchable link data
|
||||
ld hl, wLinkData + SERIAL_PREAMBLE_LENGTH + NAME_LENGTH + (1 + PARTY_LENGTH + 1) - 1
|
||||
ld hl, wLinkSendParty + SERIAL_PREAMBLE_LENGTH + NAME_LENGTH + (1 + PARTY_LENGTH + 1) - 1
|
||||
assert wLinkSendParty == wLinkSendTimeCapsuleParty
|
||||
ld de, wPlayerPatchLists + SERIAL_RNS_LENGTH
|
||||
lb bc, 0, 0
|
||||
.patch_loop
|
||||
|
|
@ -697,7 +703,7 @@ endr
|
|||
ret
|
||||
|
||||
Link_PrepPartyData_Gen1:
|
||||
ld de, wLinkData
|
||||
ld de, wLinkSendTimeCapsuleParty
|
||||
ld a, SERIAL_PREAMBLE_BYTE
|
||||
ld b, SERIAL_PREAMBLE_LENGTH
|
||||
.loop1
|
||||
|
|
@ -867,7 +873,7 @@ Link_PrepPartyData_Gen1:
|
|||
ret
|
||||
|
||||
Link_PrepPartyData_Gen2:
|
||||
ld de, wLinkData
|
||||
ld de, wLinkSendParty
|
||||
ld a, SERIAL_PREAMBLE_BYTE
|
||||
ld b, SERIAL_PREAMBLE_LENGTH
|
||||
.preamble_loop
|
||||
|
|
@ -905,12 +911,12 @@ Link_PrepPartyData_Gen2:
|
|||
cp LINK_TRADECENTER
|
||||
ret nz
|
||||
|
||||
; Fill 5 bytes at wLinkPlayerMailPreamble with $20
|
||||
ld de, wLinkPlayerMail
|
||||
; Fill 5 bytes at wLinkSendMailPreamble with $20
|
||||
ld de, wLinkSendMail
|
||||
ld a, SERIAL_MAIL_PREAMBLE_BYTE
|
||||
call Link_CopyMailPreamble
|
||||
|
||||
; Copy all the mail messages to wLinkPlayerMailMessages
|
||||
; Copy all the mail messages to wLinkSendMailMessages
|
||||
ld a, BANK(sPartyMail)
|
||||
call OpenSRAM
|
||||
ld hl, sPartyMail
|
||||
|
|
@ -925,7 +931,7 @@ Link_PrepPartyData_Gen2:
|
|||
dec b
|
||||
jr nz, .message_loop
|
||||
|
||||
; Copy the mail data to wLinkPlayerMailMetadata
|
||||
; Copy the mail data to wLinkSendMailMetadata
|
||||
ld hl, sPartyMail
|
||||
ld b, PARTY_LENGTH
|
||||
.metadata_loop
|
||||
|
|
@ -941,7 +947,7 @@ Link_PrepPartyData_Gen2:
|
|||
; Translate the messages if necessary
|
||||
ld b, PARTY_LENGTH
|
||||
ld de, sPartyMail
|
||||
ld hl, wLinkPlayerMailMessages
|
||||
ld hl, wLinkSendMailMessages
|
||||
.translate_loop
|
||||
push bc
|
||||
push hl
|
||||
|
|
@ -975,7 +981,7 @@ Link_PrepPartyData_Gen2:
|
|||
call CloseSRAM
|
||||
|
||||
; The SERIAL_NO_DATA_BYTE value isn't allowed anywhere in message text
|
||||
ld hl, wLinkPlayerMailMessages
|
||||
ld hl, wLinkSendMailMessages
|
||||
ld bc, (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
|
||||
.message_patch_loop
|
||||
ld a, [hl]
|
||||
|
|
@ -990,8 +996,8 @@ Link_PrepPartyData_Gen2:
|
|||
jr nz, .message_patch_loop
|
||||
|
||||
; Calculate the patch offsets for the mail metadata
|
||||
ld hl, wLinkPlayerMailMetadata
|
||||
ld de, wLinkPlayerMailPatchSet
|
||||
ld hl, wLinkSendMailMetadata
|
||||
ld de, wLinkSendMailPatchSet
|
||||
ld b, (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) * PARTY_LENGTH
|
||||
ld c, 0
|
||||
.metadata_patch_loop
|
||||
|
|
@ -1822,7 +1828,7 @@ LinkTrade:
|
|||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
push hl
|
||||
ld hl, wLinkPlayerMail
|
||||
ld hl, wLinkOTMail
|
||||
ld a, [wCurOTTradePartyMon]
|
||||
ld bc, MAIL_STRUCT_LENGTH
|
||||
call AddNTimes
|
||||
|
|
|
|||
|
|
@ -191,8 +191,10 @@ MACRO battle_tower_struct
|
|||
ENDM
|
||||
|
||||
MACRO mailmsg
|
||||
\1Message:: ds MAIL_MSG_LENGTH
|
||||
\1MessageEnd:: db
|
||||
\1Message::
|
||||
\1Line1:: ds MAIL_LINE_LENGTH
|
||||
\1LineBreak:: db ; '<NEXT>'
|
||||
\1Line2:: ds MAIL_LINE_LENGTH
|
||||
\1Author:: ds PLAYER_NAME_LENGTH
|
||||
\1Nationality:: dw
|
||||
\1AuthorID:: dw
|
||||
|
|
@ -202,8 +204,10 @@ MACRO mailmsg
|
|||
ENDM
|
||||
|
||||
MACRO mailmsg_jp
|
||||
\1Message:: ds MAIL_MSG_LENGTH
|
||||
\1MessageEnd:: db
|
||||
\1Message::
|
||||
\1Line1:: ds MAIL_LINE_LENGTH
|
||||
\1LineBreak:: db ; '<NEXT>'
|
||||
\1Line2:: ds MAIL_LINE_LENGTH
|
||||
\1Author:: ds NAME_LENGTH_JAPANESE - 1
|
||||
\1AuthorID:: dw
|
||||
\1Species:: db
|
||||
|
|
|
|||
95
ram/wram.asm
95
ram/wram.asm
|
|
@ -950,22 +950,58 @@ wDebugOriginalColors:: ds 256 * 4
|
|||
|
||||
SECTION UNION "Overworld Map", WRAM0
|
||||
|
||||
; raw link data
|
||||
; buffer for various link transfer data
|
||||
wLinkData:: ds 1300
|
||||
wLinkDataEnd::
|
||||
|
||||
|
||||
SECTION UNION "Overworld Map", WRAM0
|
||||
|
||||
; link data members
|
||||
; player's party data, formatted for link transfer (Gen 2 link session)
|
||||
wLinkSendParty:: ds SERIAL_PREAMBLE_LENGTH + LINK_PARTY_DATA_LENGTH + SERIAL_PADDING_LENGTH
|
||||
|
||||
ds 50
|
||||
; player's party mail, formatted for link transfer, during a link session
|
||||
wLinkSendMail::
|
||||
wLinkSendMailPreamble:: ds SERIAL_MAIL_PREAMBLE_LENGTH
|
||||
wLinkSendMailMessages:: ds (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
|
||||
wLinkSendMailMetadata:: ds (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) * PARTY_LENGTH
|
||||
wLinkSendMailPatchSet:: ds SERIAL_MAIL_PATCH_LIST_LENGTH
|
||||
wLinkSendMailEnd::
|
||||
ds 10
|
||||
|
||||
; during a link session, the other player's raw mail data is initially stored here
|
||||
wLinkReceivedMail::
|
||||
ds SERIAL_MAIL_PREAMBLE_LENGTH + MAIL_STRUCT_LENGTH * PARTY_LENGTH + SERIAL_MAIL_PATCH_LIST_LENGTH
|
||||
wLinkReceivedMailEnd::
|
||||
ds 10
|
||||
; wLinkReceivedMailEnd should have been used instead of wLinkDataEnd (see engine/link/link.asm)
|
||||
assert @ == wLinkDataEnd
|
||||
|
||||
|
||||
SECTION UNION "Overworld Map", WRAM0
|
||||
|
||||
; player's party data, formatted for link transfer (Time Capsule link session)
|
||||
wLinkSendTimeCapsuleParty:: ds SERIAL_PREAMBLE_LENGTH + LINK_TIME_CAPSULE_PARTY_DATA_LENGTH + SERIAL_PADDING_LENGTH
|
||||
|
||||
|
||||
SECTION UNION "Overworld Map", WRAM0
|
||||
|
||||
; after the initial link session, the other player's party and mail data
|
||||
; is temporarily stored here before applying patch data
|
||||
|
||||
; link player's name and party species are not patched,
|
||||
; as they normally don't contain SERIAL_NO_DATA_BYTE
|
||||
wLinkPlayerName:: ds NAME_LENGTH
|
||||
wLinkPartyCount:: db
|
||||
wLinkPartySpecies:: ds PARTY_LENGTH
|
||||
wLinkPartyEnd:: db ; older code doesn't check PartyCount
|
||||
|
||||
UNION
|
||||
; link player data
|
||||
wLinkPlayerData::
|
||||
; Gen 2 link player party data
|
||||
wLinkPlayerPatchedData::
|
||||
wLinkPlayerID:: dw
|
||||
|
||||
; wLinkPlayerPartyMon1 - wLinkPlayerPartyMon6
|
||||
for n, 1, PARTY_LENGTH + 1
|
||||
wLinkPlayerPartyMon{d:n}:: party_struct wLinkPlayerPartyMon{d:n}
|
||||
|
|
@ -983,9 +1019,16 @@ for n, 1, PARTY_LENGTH + 1
|
|||
wLinkPlayerPartyMon{d:n}Nickname:: ds MON_NAME_LENGTH
|
||||
endr
|
||||
|
||||
ds 459
|
||||
|
||||
; received mail data, stripped of the serial preamble
|
||||
wLinkReceivedMailMessages:: ds (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
|
||||
wLinkReceivedMailMetadata:: ds (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) * PARTY_LENGTH
|
||||
wLinkReceivedMailPatchSet:: ds SERIAL_MAIL_PATCH_LIST_LENGTH
|
||||
|
||||
NEXTU
|
||||
; time capsule party data
|
||||
wTimeCapsulePlayerData::
|
||||
; Gen 1 (Time Capsule) link player party data
|
||||
wTimeCapsulePatchedData::
|
||||
; wTimeCapsulePartyMon1 - wTimeCapsulePartyMon6
|
||||
for n, 1, PARTY_LENGTH + 1
|
||||
wTimeCapsulePartyMon{d:n}:: red_party_struct wTimeCapsulePartyMon{d:n}
|
||||
|
|
@ -1003,6 +1046,7 @@ for n, 1, PARTY_LENGTH + 1
|
|||
wTimeCapsulePartyMon{d:n}Nickname:: ds MON_NAME_LENGTH
|
||||
endr
|
||||
|
||||
ds SERIAL_PADDING_LENGTH ; unused but written to
|
||||
ENDU
|
||||
|
||||
|
||||
|
|
@ -1021,30 +1065,14 @@ endr
|
|||
|
||||
SECTION UNION "Overworld Map", WRAM0
|
||||
|
||||
; link mail data
|
||||
; other player's link mail data, patched and formatted to mailmsg structure
|
||||
ds 500
|
||||
wLinkPlayerMail::
|
||||
wLinkPlayerMailPreamble:: ds SERIAL_MAIL_PREAMBLE_LENGTH
|
||||
wLinkPlayerMailMessages:: ds (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
|
||||
wLinkPlayerMailMetadata:: ds (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) * PARTY_LENGTH
|
||||
wLinkPlayerMailPatchSet:: ds 100 + SERIAL_PATCH_PREAMBLE_LENGTH
|
||||
wLinkPlayerMailEnd::
|
||||
ds 10
|
||||
wLinkOTMail::
|
||||
wLinkOTMailMessages:: ds (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
|
||||
wLinkOTMailMetadata:: ds (MAIL_STRUCT_LENGTH - (MAIL_MSG_LENGTH + 1)) * PARTY_LENGTH
|
||||
wLinkOTMailPatchSet:: ds 100 + SERIAL_PATCH_PREAMBLE_LENGTH
|
||||
wLinkOTMailPadding:: ds SERIAL_MAIL_PREAMBLE_LENGTH
|
||||
wLinkOTMailEnd::
|
||||
ds 10
|
||||
|
||||
|
||||
SECTION UNION "Overworld Map", WRAM0
|
||||
|
||||
; received link mail data
|
||||
ds 500
|
||||
wLinkReceivedMail:: ds MAIL_STRUCT_LENGTH * PARTY_LENGTH
|
||||
wLinkReceivedMailEnd:: db
|
||||
; wLinkOTMon1Mail - wLinkOTMon6Mail
|
||||
for n, 1, PARTY_LENGTH + 1
|
||||
wLinkOTMon{d:n}Mail:: mailmsg wLinkOTMon{d:n}Mail
|
||||
endr
|
||||
wLinkOTMailEnd:: db
|
||||
|
||||
|
||||
SECTION UNION "Overworld Map", WRAM0
|
||||
|
|
@ -2734,7 +2762,13 @@ wTimeOfDay:: db
|
|||
|
||||
SECTION "Enemy Party", WRAMX
|
||||
|
||||
; This union spans 451 bytes.
|
||||
UNION
|
||||
; during a link session, other player's raw party data is initially stored here
|
||||
wLinkReceivedPartyData:: ds SERIAL_PREAMBLE_LENGTH + LINK_PARTY_DATA_LENGTH + SERIAL_PADDING_LENGTH
|
||||
wLinkReceivedPartyEnd:: db
|
||||
|
||||
NEXTU
|
||||
wPokedexShowPointerAddr:: dw
|
||||
wPokedexShowPointerBank:: db
|
||||
ds 3
|
||||
|
|
@ -2752,7 +2786,6 @@ wOTPlayerID:: dw
|
|||
wOTPartyCount:: db
|
||||
wOTPartySpecies:: ds PARTY_LENGTH
|
||||
wOTPartyEnd:: db ; older code doesn't check PartyCount
|
||||
ENDU
|
||||
|
||||
UNION
|
||||
; ot party mons
|
||||
|
|
@ -2787,7 +2820,9 @@ wDudeNumBalls:: db
|
|||
wDudeBalls:: ds 2 * 4 + 1
|
||||
ENDU
|
||||
|
||||
ds 4
|
||||
ENDU
|
||||
|
||||
ds 2
|
||||
|
||||
wd430:: ; mobile
|
||||
wBattleAction:: db
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user