summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/battle/core.asm26
-rw-r--r--engine/battle/effect_commands.asm4
-rw-r--r--engine/battle/move_effects/false_swipe.asm2
-rw-r--r--engine/events/bug_contest/judging.asm6
-rw-r--r--engine/events/magikarp.asm2
-rw-r--r--engine/pokemon/evolve.asm2
-rw-r--r--home.asm51
-rw-r--r--home/compare.asm35
-rw-r--r--home/queue_script.asm12
-rw-r--r--hram.asm4
10 files changed, 72 insertions, 72 deletions
diff --git a/engine/battle/core.asm b/engine/battle/core.asm
index 7e92a3e31..312ba8158 100644
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -530,7 +530,7 @@ DetermineMoveOrder:
ld de, wBattleMonSpeed
ld hl, wEnemyMonSpeed
ld c, 2
- call StringCmp
+ call CompareBytes
jr z, .speed_tie
jp nc, .player_first
jp .enemy_first
@@ -3715,19 +3715,19 @@ TryToRunAwayFromBattle:
inc a
ld [wNumFleeAttempts], a
ld a, [hli]
- ld [hStringCmpString2 + 0], a
+ ld [hPartyMon1Speed + 0], a
ld a, [hl]
- ld [hStringCmpString2 + 1], a
+ ld [hPartyMon1Speed + 1], a
ld a, [de]
inc de
- ld [hStringCmpString1 + 0], a
+ ld [hEnemyMonSpeed + 0], a
ld a, [de]
- ld [hStringCmpString1 + 1], a
+ ld [hEnemyMonSpeed + 1], a
call Call_LoadTempTileMapToTileMap
- ld de, hStringCmpString2
- ld hl, hStringCmpString1
- ld c, $2
- call StringCmp
+ ld de, hPartyMon1Speed
+ ld hl, hEnemyMonSpeed
+ ld c, 2
+ call CompareBytes
jr nc, .can_escape
xor a
@@ -3739,9 +3739,9 @@ TryToRunAwayFromBattle:
ld [hDividend + 0], a
ld a, [hProduct + 3]
ld [hDividend + 1], a
- ld a, [hStringCmpString1 + 0]
+ ld a, [hEnemyMonSpeed + 0]
ld b, a
- ld a, [hStringCmpString1 + 1]
+ ld a, [hEnemyMonSpeed + 1]
srl b
rr a
srl b
@@ -8712,7 +8712,7 @@ AddLastMobileBattleToLinkRecord:
push de
ld bc, 12
ld de, wStringBuffer1
- call CompareLong
+ call CompareBytesLong
pop de
pop hl
jr c, .done
@@ -8821,7 +8821,7 @@ AddLastMobileBattleToLinkRecord:
pop hl
push bc
ld c, 3
- call StringCmp
+ call CompareBytes
pop bc
jr z, .equal
jr nc, .done2
diff --git a/engine/battle/effect_commands.asm b/engine/battle/effect_commands.asm
index eb30af88b..bb98badca 100644
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -6154,7 +6154,7 @@ BattleCommand_Heal:
push de
push bc
ld c, 2
- call StringCmp
+ call CompareBytes
pop bc
pop de
pop hl
@@ -6573,7 +6573,7 @@ BattleCommand_TimeBasedHealContinue:
; Don't bother healing if HP is already full.
push bc
- call StringCmp
+ call CompareBytes
pop bc
jr z, .Full
diff --git a/engine/battle/move_effects/false_swipe.asm b/engine/battle/move_effects/false_swipe.asm
index 4f4eb329c..0d3f7d47c 100644
--- a/engine/battle/move_effects/false_swipe.asm
+++ b/engine/battle/move_effects/false_swipe.asm
@@ -13,7 +13,7 @@ BattleCommand_FalseSwipe:
ld c, 2
push hl
push de
- call StringCmp
+ call CompareBytes
pop de
pop hl
jr c, .done
diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm
index d8f9d7657..a6ec3baf6 100644
--- a/engine/events/bug_contest/judging.asm
+++ b/engine/events/bug_contest/judging.asm
@@ -171,7 +171,7 @@ DetermineContestWinners:
ld de, wBugContestTempScore
ld hl, wBugContestFirstPlaceScore
ld c, 2
- call StringCmp
+ call CompareBytes
jr c, .not_first_place
ld hl, wBugContestSecondPlaceWinnerID
ld de, wBugContestThirdPlaceWinnerID
@@ -189,7 +189,7 @@ DetermineContestWinners:
ld de, wBugContestTempScore
ld hl, wBugContestSecondPlaceScore
ld c, 2
- call StringCmp
+ call CompareBytes
jr c, .not_second_place
ld hl, wBugContestSecondPlaceWinnerID
ld de, wBugContestThirdPlaceWinnerID
@@ -203,7 +203,7 @@ DetermineContestWinners:
ld de, wBugContestTempScore
ld hl, wBugContestThirdPlaceScore
ld c, 2
- call StringCmp
+ call CompareBytes
jr c, .done
ld hl, wBugContestThirdPlaceWinnerID
call CopyTempContestant
diff --git a/engine/events/magikarp.asm b/engine/events/magikarp.asm
index 7fe8adba7..cf8ad80ba 100644
--- a/engine/events/magikarp.asm
+++ b/engine/events/magikarp.asm
@@ -36,7 +36,7 @@ CheckMagikarpLength:
ld hl, wMagikarpLength
ld de, wBestMagikarpLengthFeet
ld c, 2
- call StringCmp
+ call CompareBytes
jr nc, .not_long_enough
; NEW RECORD!!! Let's save that.
diff --git a/engine/pokemon/evolve.asm b/engine/pokemon/evolve.asm
index 571cff0b8..f2006bcf6 100644
--- a/engine/pokemon/evolve.asm
+++ b/engine/pokemon/evolve.asm
@@ -99,7 +99,7 @@ EvolveAfterBattle_MasterLoop:
ld de, wTempMonAttack
ld hl, wTempMonDefense
ld c, 2
- call StringCmp
+ call CompareBytes
ld a, ATK_EQ_DEF
jr z, .got_tyrogue_evo
ld a, ATK_LT_DEF
diff --git a/home.asm b/home.asm
index 8f68511b4..27587d511 100644
--- a/home.asm
+++ b/home.asm
@@ -162,55 +162,8 @@ CallPointerAt::
rst Bankswitch
ret
-QueueScript::
-; Push pointer hl in the current bank to wQueuedScriptBank.
- ld a, [hROMBank]
-
-FarQueueScript::
-; Push pointer a:hl to wQueuedScriptBank.
- ld [wQueuedScriptBank], a
- ld a, l
- ld [wQueuedScriptAddr], a
- ld a, h
- ld [wQueuedScriptAddr + 1], a
- ret
-
-StringCmp::
-; Compare c bytes at de and hl.
-; Return z if they all match.
-.loop
- ld a, [de]
- cp [hl]
- ret nz
- inc de
- inc hl
- dec c
- jr nz, .loop
- ret
-
-CompareLong::
-; Compare bc bytes at de and hl.
-; Return carry if they all match.
-
- ld a, [de]
- cp [hl]
- jr nz, .Diff
-
- inc de
- inc hl
- dec bc
-
- ld a, b
- or c
- jr nz, CompareLong
-
- scf
- ret
-
-.Diff:
- and a
- ret
-
+INCLUDE "home/queue_script.asm"
+INCLUDE "home/compare.asm"
INCLUDE "home/tilemap.asm"
INCLUDE "home/hp_pals.asm"
diff --git a/home/compare.asm b/home/compare.asm
new file mode 100644
index 000000000..26b7567fd
--- /dev/null
+++ b/home/compare.asm
@@ -0,0 +1,35 @@
+CompareBytes::
+; Compare c bytes at de and hl.
+; Return z if they all match.
+.loop
+ ld a, [de]
+ cp [hl]
+ ret nz
+ inc de
+ inc hl
+ dec c
+ jr nz, .loop
+ ret
+
+CompareBytesLong::
+; Compare bc bytes at de and hl.
+; Return carry if they all match.
+.loop
+ ld a, [de]
+ cp [hl]
+ jr nz, .diff
+
+ inc de
+ inc hl
+ dec bc
+
+ ld a, b
+ or c
+ jr nz, .loop
+
+ scf
+ ret
+
+.diff:
+ and a
+ ret
diff --git a/home/queue_script.asm b/home/queue_script.asm
new file mode 100644
index 000000000..40a971dc9
--- /dev/null
+++ b/home/queue_script.asm
@@ -0,0 +1,12 @@
+QueueScript::
+; Push pointer hl in the current bank to wQueuedScriptBank.
+ ld a, [hROMBank]
+
+FarQueueScript::
+; Push pointer a:hl to wQueuedScriptBank.
+ ld [wQueuedScriptBank], a
+ ld a, l
+ ld [wQueuedScriptAddr], a
+ ld a, h
+ ld [wQueuedScriptAddr + 1], a
+ ret
diff --git a/hram.asm b/hram.asm
index 47d6f954a..7b54988f6 100644
--- a/hram.asm
+++ b/hram.asm
@@ -48,8 +48,8 @@ hConnectedMapWidth EQU $ffb0
hPastLeadingZeroes EQU $ffb3
-hStringCmpString1 EQU $ffb1
-hStringCmpString2 EQU $ffb5
+hEnemyMonSpeed EQU $ffb1
+hPartyMon1Speed EQU $ffb5
hDividend EQU $ffb3 ; length in b register, before 'call Divide' (max 4 bytes)
hDivisor EQU $ffb7 ; 1 byte long