From b199f6cfbff81cec3e62351ae4aaa6edce0270d5 Mon Sep 17 00:00:00 2001 From: Remy Oukaour Date: Fri, 19 Jan 2018 19:31:45 -0500 Subject: [PATCH] Use hSerialConnectionStatus constants elsewhere --- engine/battle/core.asm | 42 +++++++++++++++++++++--------------------- engine/link.asm | 4 ++-- home/init.asm | 2 +- mobile/mobile_40.asm | 6 +++--- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/engine/battle/core.asm b/engine/battle/core.asm index 9ec9cc63e..e8abea583 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -27,7 +27,7 @@ DoBattle: ; 3c000 jr z, .not_linked ld a, [hSerialConnectionStatus] - cp $2 + cp USING_INTERNAL_CLOCK jr z, .player_2 .not_linked @@ -98,7 +98,7 @@ DoBattle: ; 3c000 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 @@ Stubbed_Function3c1bf: HandleBetweenTurnEffects: ; 3c1d6 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .CheckEnemyFirst call CheckFaint_PlayerThenEnemy ret c @@ -351,7 +351,7 @@ CheckFaint_EnemyThenPlayer: ; 3c25c HandleBerserkGene: ; 3c27c ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .reverse call .player @@ -459,7 +459,7 @@ DetermineMoveOrder: ; 3c314 cp $2 jr nz, .switch ld a, [hSerialConnectionStatus] - cp $2 + cp USING_INTERNAL_CLOCK jr z, .player_2 call BattleRandom @@ -516,7 +516,7 @@ DetermineMoveOrder: ; 3c314 .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 @@ DetermineMoveOrder: ; 3c314 .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 @@ ParsePlayerAction: ; 3c434 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 @@ ResidualDamage: ; 3c716 HandlePerishSong: ; 3c801 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .EnemyFirst call SetPlayerTurn call .do_it @@ -1231,7 +1231,7 @@ HandlePerishSong: ; 3c801 HandleWrap: ; 3c874 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .EnemyFirst call SetPlayerTurn call .do_it @@ -1303,7 +1303,7 @@ SwitchTurnCore: ; 3c8e4 HandleLeftovers: ; 3c8eb ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .DoEnemyFirst call SetPlayerTurn call .do_it @@ -1353,7 +1353,7 @@ HandleLeftovers: ; 3c8eb HandleMysteryberry: ; 3c93c ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .DoEnemyFirst call SetPlayerTurn call .do_it @@ -1492,7 +1492,7 @@ HandleMysteryberry: ; 3c93c HandleFutureSight: ; 3ca26 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .enemy_first call SetPlayerTurn call .do_it @@ -1551,7 +1551,7 @@ HandleFutureSight: ; 3ca26 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 @@ HanleDefrost: ; 3ca8f HandleSafeguard: ; 3cafb ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player1 call .CheckPlayer jr .CheckEnemy @@ -1648,7 +1648,7 @@ HandleSafeguard: ; 3cafb HandleScreens: ; 3cb36 ld a, [hSerialConnectionStatus] - cp 1 + cp USING_EXTERNAL_CLOCK jr z, .Both call .CheckPlayer jr .CheckEnemy @@ -1732,7 +1732,7 @@ HandleWeather: ; 3cb9e ret nz ld a, [hSerialConnectionStatus] - cp 1 + cp USING_EXTERNAL_CLOCK jr z, .enemy_first .player_first @@ -2116,7 +2116,7 @@ HandleEnemyMonFaint: ; 3cd55 DoubleSwitch: ; 3cdca ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call ClearSprites hlcoord 1, 0 @@ -4351,7 +4351,7 @@ RecallPlayerMon: ; 3dce6 HandleHealingItems: ; 3dcf9 ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call SetPlayerTurn call HandleHPHealingItem @@ -4596,7 +4596,7 @@ UseConfusionHealingItem: ; 3de51 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 @@ PlayerSwitch: ; 3e3ad .dont_run ld a, [hSerialConnectionStatus] - cp $1 + cp USING_EXTERNAL_CLOCK jr z, .player_1 call BattleMonEntrance call EnemyMonEntrance diff --git a/engine/link.asm b/engine/link.asm index 0de4eab2d..19559798d 100755 --- a/engine/link.asm +++ b/engine/link.asm @@ -2143,7 +2143,7 @@ Special_EnterTimeCapsule: ; 29c7b 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 @@ Special_WaitForOtherPlayerToExit: ; 29c92 ld [rSC], a ld c, 3 call DelayFrames - ld a, -1 + ld a, CONNECTION_NOT_ESTABLISHED ld [hSerialConnectionStatus], a ld a, [rIF] push af diff --git a/home/init.asm b/home/init.asm index e5859bf08..d8e476c3f 100644 --- a/home/init.asm +++ b/home/init.asm @@ -136,7 +136,7 @@ Init:: ; 17d ; BG on ld [rLCDC], a - ld a, -1 + ld a, CONNECTION_NOT_ESTABLISHED ld [hSerialConnectionStatus], a farcall InitCGBPals diff --git a/mobile/mobile_40.asm b/mobile/mobile_40.asm index 6fa20d80f..ac5f68b0b 100644 --- a/mobile/mobile_40.asm +++ b/mobile/mobile_40.asm @@ -4052,9 +4052,9 @@ _StartMobileBattle: ; 1019ab 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 @@ StartMobileBattle: ; 101a21 farcall ShowLinkBattleParticipantsAfterEnd xor a ld [wDisableTextAcceleration], a - ld a, $ff + ld a, CONNECTION_NOT_ESTABLISHED ld [hSerialConnectionStatus], a pop af ld [Options], a