shithub: pokecrystal

Download patch

ref: ae4fe08084f3c3c5775bc286bcc630f2c20af083
parent: 3a2932cec1e8cb4ef4fb3dbabf24e341d03c7bbe
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Wed Oct 21 20:53:54 EDT 2020

Identify some more labels (a few link-related)

--- a/data/text/battle.asm
+++ b/data/text/battle.asm
@@ -199,7 +199,7 @@
 	text "Sent all to MOM!"
 	prompt
 
-BattleText_0x80a4f:
+UnusedRivalLossText: ; unreferenced
 	text "<RIVAL>: Huh? I"
 	line "should've chosen"
 	cont "your #MON!"
@@ -215,7 +215,7 @@
 	text "Use next #MON?"
 	done
 
-BattleText_0x80a93:
+UnusedRivalWinText: ; unreferenced
 	text "<RIVAL>: Yes!"
 	line "I guess I chose a"
 	cont "good #MON!"
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -8470,7 +8470,7 @@
 	call .PrintBattleRecord
 	hlcoord 0, 8
 	ld b, NUM_LINK_BATTLE_RECORDS
-	ld de, sLinkBattleRecord + 2
+	ld de, sLinkBattleRecord1Name
 .loop
 	push bc
 	push hl
@@ -8485,15 +8485,15 @@
 	push hl
 	ld h, d
 	ld l, e
-	ld de, wd002
+	ld de, wLinkBattleRecordName
 	ld bc, NAME_LENGTH - 1
 	call CopyBytes
 	ld a, "@"
 	ld [de], a
-	inc de
+	inc de ; wLinkBattleRecordWins
 	ld bc, 6
 	call CopyBytes
-	ld de, wd002
+	ld de, wLinkBattleRecordName
 	pop hl
 	call PlaceString
 	pop hl
@@ -8500,7 +8500,7 @@
 	ld de, 26
 	add hl, de
 	push hl
-	ld de, wd00d
+	ld de, wLinkBattleRecordWins
 	lb bc, 2, 4
 	call PrintNum
 	pop hl
@@ -8507,13 +8507,13 @@
 	ld de, 5
 	add hl, de
 	push hl
-	ld de, wd00f
+	ld de, wLinkBattleRecordLosses
 	lb bc, 2, 4
 	call PrintNum
 	pop hl
 	ld de, 5
 	add hl, de
-	ld de, wd011
+	ld de, wLinkBattleRecordDraws
 	lb bc, 2, 4
 	call PrintNum
 	jr .next
--- a/engine/link/link.asm
+++ b/engine/link/link.asm
@@ -2159,7 +2159,7 @@
 	ret
 
 SetBitsForTimeCapsuleRequest:
-	ld a, $2
+	ld a, USING_INTERNAL_CLOCK
 	ldh [rSB], a
 	xor a
 	ldh [hSerialReceive], a
@@ -2176,7 +2176,7 @@
 	ld a, [wPlayerLinkAction]
 	and a
 	jr z, .no_link_action
-	ld a, $2
+	ld a, USING_INTERNAL_CLOCK
 	ldh [rSB], a
 	xor a
 	ldh [hSerialReceive], a
@@ -2201,7 +2201,7 @@
 	jr z, .connected
 	ld a, CONNECTION_NOT_ESTABLISHED
 	ldh [hSerialConnectionStatus], a
-	ld a, $2
+	ld a, USING_INTERNAL_CLOCK
 	ldh [rSB], a
 	xor a
 	ldh [hSerialReceive], a
@@ -2219,7 +2219,7 @@
 	jr z, .done
 
 .not_done
-	ld a, $1
+	ld a, USING_EXTERNAL_CLOCK
 	ldh [rSB], a
 	ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
 	ldh [rSC], a
@@ -2464,7 +2464,7 @@
 	call DelayFrames
 	ld a, CONNECTION_NOT_ESTABLISHED
 	ldh [hSerialConnectionStatus], a
-	ld a, $2
+	ld a, USING_INTERNAL_CLOCK
 	ldh [rSB], a
 	xor a
 	ldh [hSerialReceive], a
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -388,7 +388,8 @@
 	ldh [rSC], a
 	ret
 
-Function919:: ; unreferenced
+SetBitsForTimeCapsuleRequestIfNotLinked:: ; unreferenced
+; Similar to SetBitsForTimeCapsuleRequest (see engine/link/link.asm).
 	ld a, [wLinkMode]
 	and a
 	ret nz
--- a/macros/wram.asm
+++ b/macros/wram.asm
@@ -230,8 +230,8 @@
 ENDM
 
 link_battle_record: MACRO
-\1Name::   ds NAME_LENGTH - 1
 \1ID::     dw
+\1Name::   ds NAME_LENGTH - 1
 \1Wins::   dw
 \1Losses:: dw
 \1Draws::  dw
--- a/wram.asm
+++ b/wram.asm
@@ -1056,8 +1056,13 @@
 
 NEXTU
 ; mystery gift data
-wMysteryGiftPartyTemp:: ; ds PARTY_LENGTH * (1 + 1 + NUM_MOVES)
-wMysteryGiftStaging::
+UNION
+wMysteryGiftPartyTemp:: ds (1 + 1 + NUM_MOVES) * PARTY_LENGTH
+
+NEXTU
+wMysteryGiftStaging:: ds 80
+
+NEXTU
 wc800:: ds 1
 wc801:: ds 1
 wc802:: ds 1
@@ -1076,6 +1081,7 @@
 wc820:: ds 1
 wc821:: ds 1
 wc822:: ds 46
+ENDU
 
 UNION
 wMysteryGiftTrainerData:: ds (1 + 1 + NUM_MOVES) * PARTY_LENGTH + 2
@@ -1830,6 +1836,13 @@
 wEndFlypoint:: db
 
 NEXTU
+; link battle record data
+wLinkBattleRecordName::   ds NAME_LENGTH
+wLinkBattleRecordWins::   dw
+wLinkBattleRecordLosses:: dw
+wLinkBattleRecordDraws::  dw
+
+NEXTU
 ; unidentified
 wd002:: db
 wd003:: db
@@ -1837,13 +1850,9 @@
 
 ; mobile?
 	ds 1
-wd006:: ds 2
-wd008:: ds 2
 	ds 2
-wd00c:: ds 1
-wd00d:: ds 1
-	ds 1
-wd00f:: ds 1
+wd008:: ds 2
+	ds 6
 wd010:: ds 1
 wd011:: ds 1
 wd012:: ds 1
@@ -2331,7 +2340,6 @@
 wInitListType:: db
 wBattleHasJustStarted:: db
 
-; wd265 has many different short-term uses
 wNamedObjectIndexBuffer::
 wDeciramBuffer::
 wTempByteValue::