From eab0b6064d2e90b0c64fcd6b811211f035a43519 Mon Sep 17 00:00:00 2001 From: pikalaxalt Date: Sun, 19 Jun 2016 00:31:29 -0400 Subject: CheckNickErrors --- main.asm | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/main.asm b/main.asm index fa73e475..2185fbfe 100644 --- a/main.asm +++ b/main.asm @@ -145,10 +145,61 @@ LoadFonts_NoOAMUpdate:: ; 65cb (1:65cb) INCLUDE "engine/learn.asm" -CheckNickErrors:: ; 677e -IF DEF(GOLD) - dr $677e, $67bd +CheckNickErrors:: ; 677e (1:677e) + push bc + push de + ld b, PKMN_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 "", $04 + 1 + db "", $18 + 1 + db $1d, "%" + 1 + db $35, "" + 1 + db "", "" + 1 + db $49, "" + 1 + db "", "┘" + 1 + db -1 ; end + Multiply_:: ; 67bd +IF DEF(GOLD) dr $67bd, $681d Divide_:: ; 681d dr $681d, $6fa0 @@ -157,8 +208,6 @@ CheckNPCMovementPermissions: ; 6fa0 ENDC IF DEF(SILVER) - dr $6744, $6783 -Multiply_:: ; 6783 dr $6783, $67e3 Divide_:: ; 67e3 dr $67e3, $6f66 -- cgit v1.2.3