named CountSetBits output variable

This commit is contained in:
YamaArashi 2015-08-07 04:24:06 -07:00
parent 8d30191707
commit 525f1b96f3
15 changed files with 78 additions and 63 deletions

View file

@ -19,8 +19,8 @@ DisplayOakLabRightPoster: ; 1e965 (7:6965)
ld hl, wPokedexOwned
ld b, wPokedexOwnedEnd - wPokedexOwned
call CountSetBits
ld a, [wd11e]
cp $2
ld a, [wNumSetBits]
cp 2
tx_pre_id SaveOptionText
jr c, .ownThreeOrMoreMon
tx_pre_id StrengthsAndWeaknessesText

View file

@ -395,7 +395,7 @@ PrintNumBadges: ; 5e2f (1:5e2f)
ld b, $1
call CountSetBits
pop hl
ld de, wd11e
ld de, wNumSetBits
lb bc, 1, 2
jp PrintNumber
@ -405,7 +405,7 @@ PrintNumOwnedMons: ; 5e42 (1:5e42)
ld b, wPokedexOwnedEnd - wPokedexOwned
call CountSetBits
pop hl
ld de, wd11e
ld de, wNumSetBits
lb bc, 1, 3
jp PrintNumber

View file

@ -169,14 +169,14 @@ HandlePokedexListMenu: ; 40111 (10:4111)
ld hl,wPokedexSeen
ld b,wPokedexSeenEnd - wPokedexSeen
call CountSetBits
ld de,wd11e
ld de, wNumSetBits
coord hl, 16, 3
lb bc, 1, 3
call PrintNumber ; print number of seen pokemon
ld hl,wPokedexOwned
ld b,wPokedexOwnedEnd - wPokedexOwned
call CountSetBits
ld de,wd11e
ld de, wNumSetBits
coord hl, 16, 6
lb bc, 1, 3
call PrintNumber ; print number of owned pokemon

View file

@ -4,45 +4,45 @@ OaksAideScript: ; 0x59035
call YesNoChoice
ld a, [wCurrentMenuItem]
and a
jr nz, .asm_59086
jr nz, .choseNo
ld hl, wPokedexOwned
ld b, wPokedexOwnedEnd - wPokedexOwned
call CountSetBits
ld a, [wd11e]
ld [$ffdd], a
ld a, [wNumSetBits]
ld [hOaksAideNumMonsOwned], a
ld b, a
ld a, [$ffdb]
ld a, [hOaksAideRequirement]
cp b
jr z, .asm_59059
jr nc, .asm_5907c
.asm_59059
jr z, .giveItem
jr nc, .notEnoughOwnedMons
.giveItem
ld hl, OaksAideHereYouGoText
call PrintText
ld a, [$ffdc]
ld a, [hOaksAideItemReward]
ld b, a
ld c, 1
call GiveItem
jr nc, .BagFull
jr nc, .bagFull
ld hl, OaksAideGotItemText
call PrintText
ld a, $1
jr .asm_5908e
.BagFull
jr .done
.bagFull
ld hl, OaksAideNoRoomText
call PrintText
xor a
jr .asm_5908e
.asm_5907c
jr .done
.notEnoughOwnedMons
ld hl, OaksAideUhOhText
call PrintText
ld a, $80
jr .asm_5908e
.asm_59086
jr .done
.choseNo
ld hl, OaksAideComeBackText
call PrintText
ld a, $ff
.asm_5908e
ld [$ffdb], a
.done
ld [hOaksAideResult], a
ret
OaksAideHiText: ; 59091 (16:5091)

View file

@ -2,18 +2,18 @@ DisplayDexRating: ; 44169 (11:4169)
ld hl, wPokedexSeen
ld b, wPokedexSeenEnd - wPokedexSeen
call CountSetBits
ld a, [wd11e] ; result of CountSetBits (seen count)
ld [$FFDB], a
ld a, [wNumSetBits]
ld [hDexRatingNumMonsSeen], a
ld hl, wPokedexOwned
ld b, wPokedexOwnedEnd - wPokedexOwned
call CountSetBits
ld a, [wd11e] ; result of CountSetBits (own count)
ld [$FFDC], a
ld a, [wNumSetBits]
ld [hDexRatingNumMonsOwned], a
ld hl, DexRatingsTable
.findRating
ld a, [hli]
ld b, a
ld a, [$FFDC] ; number of pokemon owned
ld a, [hDexRatingNumMonsOwned]
cp b
jr c, .foundRating
inc hl
@ -24,30 +24,30 @@ DisplayDexRating: ; 44169 (11:4169)
ld h, [hl]
ld l, a ; load text pointer into hl
CheckAndResetEventA EVENT_HALL_OF_FAME_DEX_RATING
jr nz, .label3
jr nz, .hallOfFame
push hl
ld hl, PokedexRatingText_441cc
call PrintText
pop hl
call PrintText
callba PlayPokedexRatingSfx
jp WaitForTextScrollButtonPress ; wait for button press
.label3
jp WaitForTextScrollButtonPress
.hallOfFame
ld de, wcc5b
ld a, [$FFDB]
ld a, [hDexRatingNumMonsSeen]
ld [de], a
inc de
ld a, [$FFDC]
ld a, [hDexRatingNumMonsOwned]
ld [de], a
inc de
.label4
.copyRatingTextLoop
ld a, [hli]
cp a, $50
jr z, .label5
cp a, "@"
jr z, .doneCopying
ld [de], a
inc de
jr .label4
.label5
jr .copyRatingTextLoop
.doneCopying
ld [de], a
ret