spruce up CheckUnownLetter

This commit is contained in:
yenatch 2013-02-18 19:57:45 -05:00
parent fd51a5a3b1
commit 340e028c49

View File

@ -6081,42 +6081,47 @@ CheckSleepingTreeMon: ; 3eb38
CheckUnownLetter: ; 3eb75 CheckUnownLetter: ; 3eb75
; Return carry if the Unown letter hasn't been unlocked yet ; Return carry if the Unown letter hasn't been unlocked yet
ld a, [$def3] ; UnownLetter
ld a, [UnlockedUnowns]
ld c, a ld c, a
ld de, $0000 ld de, 0
.loop .loop
; Has this set been unlocked?
; Don't check this set unless it's been unlocked
srl c srl c
jr nc, .next jr nc, .next
; Check out the set
; Is our letter in the set?
ld hl, .LetterSets ld hl, .LetterSets
add hl, de add hl, de
ld a, [hli] ld a, [hli]
ld h, [hl] ld h, [hl]
ld l, a ld l, a
; Is our letter in the set?
push de push de
ld a, [$d234] ld a, [UnownLetter]
ld de, $0001 ld de, 1
push bc push bc
call IsInArray call IsInArray
pop bc pop bc
pop de pop de
jr c, .Match
jr c, .match
.next .next
; Next set ; Make sure we haven't gone past the end of the table
inc e inc e
inc e inc e
ld a, e ld a, e
; Gone past the end of the table? cp a, .Set1 - .LetterSets
cp a, 4*2 ; 4 sets with 2-byte pointers
jr c, .loop jr c, .loop
; Didn't find the letter (not unlocked) ; Hasn't been unlocked, or the letter is invalid
scf scf
ret ret
.Match .match
; Valid letter ; Valid letter
and a and a
ret ret
@ -6129,25 +6134,20 @@ CheckUnownLetter: ; 3eb75
.Set1 .Set1
; A B C D E F G H I J K ; A B C D E F G H I J K
db $01, $02, $03, $04, $05, $06, $07, $08, $09, $0a, $0b db 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, $ff
db $ff ; end
.Set2 .Set2
; L M N O P Q R ; L M N O P Q R
db $0c, $0d, $0e, $0f, $10, $11, $12 db 12, 13, 14, 15, 16, 17, 18, $ff
db $ff ; end
.Set3 .Set3
; S T U V W ; S T U V W
db $13, $14, $15, $16, $17 db 19, 20, 21, 22, 23, $ff
db $ff ; end
.Set4 .Set4
; X Y Z ; X Y Z
db $18, $19, $1a db 24, 25, 26, $ff
db $ff ; end
; 3ebc7 ; 3ebc7
INCBIN "baserom.gbc", $3ebc7, $3edd8 - $3ebc7 INCBIN "baserom.gbc", $3ebc7, $3edd8 - $3ebc7
BattleRNG: ; 3edd8 BattleRNG: ; 3edd8