ref: b199f6cfbff81cec3e62351ae4aaa6edce0270d5
parent: 0c6338836d714f464bfcaa0c8c5b8c76e6f4958d
author: Remy Oukaour <remy.oukaour@gmail.com>
date: Fri Jan 19 14:31:45 EST 2018
Use hSerialConnectionStatus constants elsewhere
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -27,7 +27,7 @@
jr z, .not_linked
ld a, [hSerialConnectionStatus]
- cp $2
+ cp USING_INTERNAL_CLOCK
jr z, .player_2
.not_linked
@@ -98,7 +98,7 @@
and a
jr z, .not_linked_2
ld a, [hSerialConnectionStatus]
- cp $2
+ cp USING_INTERNAL_CLOCK
jr nz, .not_linked_2
xor a
ld [wEnemySwitchMonIndex], a
@@ -252,7 +252,7 @@
HandleBetweenTurnEffects: ; 3c1d6
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .CheckEnemyFirst
call CheckFaint_PlayerThenEnemy
ret c
@@ -351,7 +351,7 @@
HandleBerserkGene: ; 3c27c
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .reverse
call .player
@@ -459,7 +459,7 @@
cp $2
jr nz, .switch
ld a, [hSerialConnectionStatus]
- cp $2
+ cp USING_INTERNAL_CLOCK
jr z, .player_2
call BattleRandom
@@ -516,7 +516,7 @@
.both_have_quick_claw
ld a, [hSerialConnectionStatus]
- cp $2
+ cp USING_INTERNAL_CLOCK
jr z, .player_2b
call BattleRandom
cp c
@@ -546,7 +546,7 @@
.speed_tie
ld a, [hSerialConnectionStatus]
- cp $2
+ cp USING_INTERNAL_CLOCK
jr z, .player_2c
call BattleRandom
cp 1 + (50 percent)
@@ -710,7 +710,7 @@
HandleEncore: ; 3c4df
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .player_1
call .do_player
jr .do_enemy
@@ -1162,7 +1162,7 @@
HandlePerishSong: ; 3c801
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .EnemyFirst
call SetPlayerTurn
call .do_it
@@ -1231,7 +1231,7 @@
HandleWrap: ; 3c874
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .EnemyFirst
call SetPlayerTurn
call .do_it
@@ -1303,7 +1303,7 @@
HandleLeftovers: ; 3c8eb
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .DoEnemyFirst
call SetPlayerTurn
call .do_it
@@ -1353,7 +1353,7 @@
HandleMysteryberry: ; 3c93c
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .DoEnemyFirst
call SetPlayerTurn
call .do_it
@@ -1492,7 +1492,7 @@
HandleFutureSight: ; 3ca26
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .enemy_first
call SetPlayerTurn
call .do_it
@@ -1551,7 +1551,7 @@
HanleDefrost: ; 3ca8f
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .enemy_first
call .do_player_turn
jr .do_enemy_turn
@@ -1611,7 +1611,7 @@
HandleSafeguard: ; 3cafb
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .player1
call .CheckPlayer
jr .CheckEnemy
@@ -1648,7 +1648,7 @@
HandleScreens: ; 3cb36
ld a, [hSerialConnectionStatus]
- cp 1
+ cp USING_EXTERNAL_CLOCK
jr z, .Both
call .CheckPlayer
jr .CheckEnemy
@@ -1732,7 +1732,7 @@
ret nz
ld a, [hSerialConnectionStatus]
- cp 1
+ cp USING_EXTERNAL_CLOCK
jr z, .enemy_first
.player_first
@@ -2116,7 +2116,7 @@
DoubleSwitch: ; 3cdca
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .player_1
call ClearSprites
hlcoord 1, 0
@@ -4351,7 +4351,7 @@
HandleHealingItems: ; 3dcf9
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .player_1
call SetPlayerTurn
call HandleHPHealingItem
@@ -4596,7 +4596,7 @@
HandleStatBoostingHeldItems: ; 3de97
; The effects handled here are not used in-game.
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .player_1
call .DoPlayer
jp .DoEnemy
@@ -5375,7 +5375,7 @@
.dont_run
ld a, [hSerialConnectionStatus]
- cp $1
+ cp USING_EXTERNAL_CLOCK
jr z, .player_1
call BattleMonEntrance
call EnemyMonEntrance
--- a/engine/link.asm
+++ b/engine/link.asm
@@ -2143,7 +2143,7 @@
Special_WaitForOtherPlayerToExit: ; 29c92
ld c, 3
call DelayFrames
- ld a, -1
+ ld a, CONNECTION_NOT_ESTABLISHED
ld [hSerialConnectionStatus], a
xor a
ld [rSB], a
@@ -2169,7 +2169,7 @@
ld [rSC], a
ld c, 3
call DelayFrames
- ld a, -1
+ ld a, CONNECTION_NOT_ESTABLISHED
ld [hSerialConnectionStatus], a
ld a, [rIF]
push af
--- a/home/init.asm
+++ b/home/init.asm
@@ -136,7 +136,7 @@
; BG on
ld [rLCDC], a
- ld a, -1
+ ld a, CONNECTION_NOT_ESTABLISHED
ld [hSerialConnectionStatus], a
farcall InitCGBPals
--- a/mobile/mobile_40.asm
+++ b/mobile/mobile_40.asm
@@ -4052,9 +4052,9 @@
call CopyBytes
ld a, [wcd2f]
and a
- ld a, 2
+ ld a, USING_INTERNAL_CLOCK
jr z, .got_link_player_number
- ld a, 1
+ ld a, USING_EXTERNAL_CLOCK
.got_link_player_number
ld [hSerialConnectionStatus], a
ret
@@ -4075,7 +4075,7 @@
farcall ShowLinkBattleParticipantsAfterEnd
xor a
ld [wDisableTextAcceleration], a
- ld a, $ff
+ ld a, CONNECTION_NOT_ESTABLISHED
ld [hSerialConnectionStatus], a
pop af
ld [Options], a