summaryrefslogtreecommitdiff
path: root/engine/pokemon/correct_nick_errors.asm
diff options
context:
space:
mode:
authorentrpntr <entrpntr@gmail.com>2020-03-17 15:23:39 -0400
committerentrpntr <entrpntr@gmail.com>2020-03-17 15:23:39 -0400
commitc248b30aa7487b51a9182a833b1db29f14a7267c (patch)
treeea00fee853340ff7a4b2ab2da8cb902105e854f1 /engine/pokemon/correct_nick_errors.asm
parentd7327a64949c5abb607299184507c89e4c4f1387 (diff)
Cleanup of files for banks $01 and $04 for main.asm.
Diffstat (limited to 'engine/pokemon/correct_nick_errors.asm')
-rw-r--r--engine/pokemon/correct_nick_errors.asm53
1 files changed, 53 insertions, 0 deletions
diff --git a/engine/pokemon/correct_nick_errors.asm b/engine/pokemon/correct_nick_errors.asm
new file mode 100644
index 00000000..c7b6ff39
--- /dev/null
+++ b/engine/pokemon/correct_nick_errors.asm
@@ -0,0 +1,53 @@
+CorrectNickErrors:: ; 677e (1:677e)
+ push bc
+ push de
+ ld b, MON_NAME_LENGTH
+.checkchar
+ ld a, [de]
+ cp "@"
+ jr z, .done
+ ld hl, .textcommands
+ dec hl
+.loop
+ inc hl
+ ld a, [hl]
+ cp $ff
+ jr z, .next
+ ld a, [de]
+ cp [hl]
+ inc hl
+ jr c, .loop
+ cp [hl]
+ jr nc, .loop
+ ld a, "?"
+ ld [de], a
+ jr .loop
+
+.next
+ inc de
+ dec b
+ jr nz, .checkchar
+ pop de
+ push de
+ ld a, "?"
+ ld [de], a
+ inc de
+ ld a, "@"
+ ld [de], a
+.done
+ pop de
+ pop bc
+ ret
+
+.textcommands
+; table defining which characters are actually text commands
+; format:
+ ; ≥ <
+ db "<START>", $04 + 1
+ db "<PLAY_G>", $18 + 1
+ db $1d, "%" + 1
+ db $35, "<GREEN>" + 1
+ db "<ENEMY>", "<ENEMY>" + 1
+ db $49, "<TM>" + 1
+ db "<ROCKET>", "┘" + 1
+ db -1 ; end \ No newline at end of file