shithub: pokered

Download patch

ref: bb1bf5e6a7536378dffc2b995384d6dc8692bea8
parent: d1162fec71ca789cae66dfe826aa0eae0e134b53
author: YamaArashi <shadow962@live.com>
date: Fri Oct 28 21:44:13 EDT 2016

link battle action constants

--- a/constants/misc_constants.asm
+++ b/constants/misc_constants.asm
@@ -200,3 +200,7 @@
 LINK_STATE_BATTLING      EQU $04 ; in a link battle
 LINK_STATE_RESET         EQU $05 ; reset game (unused)
 LINK_STATE_TRADING       EQU $32 ; in a link trade
+
+LINKBATTLE_RUN       EQU $F
+LINKBATTLE_STRUGGLE  EQU $E
+LINKBATTLE_NO_ACTION EQU $D ; never sent
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -432,13 +432,13 @@
 	jr nz, .noLinkBattle
 ; link battle
 	ld a, [wSerialExchangeNybbleReceiveData]
-	cp $f
+	cp LINKBATTLE_RUN
 	jp z, EnemyRan
-	cp $e
+	cp LINKBATTLE_STRUGGLE
 	jr z, .noLinkBattle
-	cp $d
+	cp LINKBATTLE_NO_ACTION
 	jr z, .noLinkBattle
-	sub $4
+	sub 4
 	jr c, .noLinkBattle
 ; the link battle enemy has switched mons
 	ld a, [wPlayerBattleStatus1]
@@ -990,7 +990,7 @@
 ; link battle
 	call LinkBattleExchangeData
 	ld a, [wSerialExchangeNybbleReceiveData]
-	cp $f
+	cp LINKBATTLE_RUN
 	ret z
 	call LoadScreenTilesFromBuffer1
 .notLinkBattle
@@ -1679,12 +1679,12 @@
 	call SaveScreenTilesToBuffer1
 	xor a
 	ld [wActionResultOrTookBattleTurn], a
-	ld a, $f
+	ld a, LINKBATTLE_RUN
 	ld [wPlayerMoveListIndex], a
 	call LinkBattleExchangeData
 	call LoadScreenTilesFromBuffer1
 	ld a, [wSerialExchangeNybbleReceiveData]
-	cp $f
+	cp LINKBATTLE_RUN
 	ld a, $2
 	jr z, .playSound
 	dec a
@@ -2999,16 +2999,16 @@
 	call LinkBattleExchangeData
 	call LoadScreenTilesFromBuffer1
 	ld a, [wSerialExchangeNybbleReceiveData]
-	cp $e
+	cp LINKBATTLE_STRUGGLE
 	jp z, .linkedOpponentUsedStruggle
-	cp $d
+	cp LINKBATTLE_NO_ACTION
 	jr z, .unableToSelectMove
-	cp $4
+	cp 4
 	ret nc
 	ld [wEnemyMoveListIndex], a
 	ld c, a
 	ld hl, wEnemyMonMoves
-	ld b, $0
+	ld b, 0
 	add hl, bc
 	ld a, [hl]
 	jr .done
@@ -3087,7 +3087,7 @@
 	ld a, $ff
 	ld [wSerialExchangeNybbleReceiveData], a
 	ld a, [wPlayerMoveListIndex]
-	cp $f ; is the player running from battle?
+	cp LINKBATTLE_RUN ; is the player running from battle?
 	jr z, .doExchange
 	ld a, [wActionResultOrTookBattleTurn]
 	and a ; is the player switching in another mon?
@@ -3095,7 +3095,7 @@
 ; the player used a move
 	ld a, [wPlayerSelectedMove]
 	cp STRUGGLE
-	ld b, $e
+	ld b, LINKBATTLE_STRUGGLE
 	jr z, .next
 	dec b
 	inc a
@@ -5676,9 +5676,9 @@
 	jr nz, .executeEnemyMove
 	ld b, $1
 	ld a, [wSerialExchangeNybbleReceiveData]
-	cp $e
+	cp LINKBATTLE_STRUGGLE
 	jr z, .executeEnemyMove
-	cp $4
+	cp 4
 	ret nc
 .executeEnemyMove
 	ld hl, wAILayer2Encouragement