shithub: pokecrystal

Download patch

ref: a1e711b80dbd652cdf3b89811f7539d93782b0b5
parent: 4c4fd7258c0c0bc289af2af0658c12bf96f75032
author: mid-kid <[email protected]>
date: Fri Mar 31 22:58:53 EDT 2023

Use more appropriate labels for link operations

--- a/engine/link/link.asm
+++ b/engine/link/link.asm
@@ -126,7 +126,7 @@
 	call Link_CopyOTData
 
 	ld de, wOTPatchLists
-	ld hl, wLinkPatchData1
+	ld hl, wLinkPlayerData
 	ld c, 2
 .loop
 	ld a, [de]
@@ -152,11 +152,11 @@
 	jr .loop
 
 .next
-	ld hl, wLinkPatchData2
+	ld hl, wLinkPlayerData + SERIAL_PATCH_DATA_SIZE
 	dec c
 	jr nz, .loop
 
-	ld hl, wLinkPlayerName
+	ld hl, wLinkData
 	ld de, wOTPlayerName
 	ld bc, NAME_LENGTH
 	call CopyBytes
@@ -293,8 +293,8 @@
 	ld bc, NAME_LENGTH + 1 + PARTY_LENGTH + 1 + 2 + (PARTYMON_STRUCT_LENGTH + NAME_LENGTH * 2) * PARTY_LENGTH
 	call Link_CopyOTData
 
-	ld de, wPlayerTrademon
-	ld hl, wLinkPatchData1
+	ld de, wOTPatchLists
+	ld hl, wLinkPlayerData
 	ld c, 2
 .loop1
 	ld a, [de]
@@ -320,7 +320,7 @@
 	jr .loop1
 
 .next1
-	ld hl, wLinkPatchData2
+	ld hl, wLinkPlayerData + SERIAL_PATCH_DATA_SIZE
 	dec c
 	jr nz, .loop1
 
@@ -339,10 +339,14 @@
 	cp SERIAL_MAIL_PREAMBLE_BYTE
 	jr z, .loop3
 	dec hl
+
 	ld de, wLinkOTMail
 	ld bc, wLinkDataEnd - wLinkOTMail ; should be wLinkOTMailEnd - wLinkOTMail
 	call CopyBytes
-	ld hl, wLinkOTMail
+
+; Replace SERIAL_MAIL_REPLACEMENT_BYTE with SERIAL_NO_DATA_BYTE across all mail
+; message bodies.
+	ld hl, wLinkOTMailMessages
 	ld bc, (MAIL_MSG_LENGTH + 1) * PARTY_LENGTH
 .loop4
 	ld a, [hl]
@@ -355,6 +359,7 @@
 	ld a, b
 	or c
 	jr nz, .loop4
+
 	ld de, wLinkOTMailPatchSet
 .loop5
 	ld a, [de]
@@ -434,7 +439,7 @@
 	ld [de], a
 
 .skip_mail
-	ld hl, wLinkPlayerName
+	ld hl, wLinkData
 	ld de, wOTPlayerName
 	ld bc, NAME_LENGTH
 	call CopyBytes
--- a/ram/wram.asm
+++ b/ram/wram.asm
@@ -1006,10 +1006,6 @@
 wTimeCapsulePartyMon{d:n}Nickname:: ds MON_NAME_LENGTH
 endr
 
-NEXTU
-; link patch lists
-wLinkPatchData1:: ds SERIAL_PATCH_DATA_SIZE
-wLinkPatchData2:: ds SERIAL_PATCH_DATA_SIZE
 ENDU