Avoid "+- 1" at every maskbits

This commit is contained in:
Remy Oukaour
2018-01-16 17:27:50 -05:00
parent 8048082114
commit 7b3de85a06
32 changed files with 79 additions and 76 deletions

View File

@@ -27,12 +27,12 @@ Function_LoadOpponentTrainerAndPokemons: ; 1f8000
add b
ld b, a ; b contains the nr of the trainer
if DEF(_CRYSTAL11)
maskbits BATTLETOWER_NUM_UNIQUE_TRAINERS +- 1
maskbits BATTLETOWER_NUM_UNIQUE_TRAINERS
cp BATTLETOWER_NUM_UNIQUE_TRAINERS
else
; Crystal 1.0 used the wrong constant here, so only the first 21
; trainers in BattleTowerTrainers can be sampled.
maskbits BATTLETOWER_NUM_UNIQUE_PKMN +- 1
maskbits BATTLETOWER_NUM_UNIQUE_PKMN
cp BATTLETOWER_NUM_UNIQUE_PKMN
endc
jr nc, .resample
@@ -115,7 +115,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081
ld a, [hRandomAdd]
add b
ld b, a
maskbits BATTLETOWER_NUM_UNIQUE_PKMN +- 1
maskbits BATTLETOWER_NUM_UNIQUE_PKMN
cp BATTLETOWER_NUM_UNIQUE_PKMN
jr nc, .resample
; in register 'a' is the chosen Pkmn of the LevelGroup

View File

@@ -17,7 +17,7 @@ Special_BuenasPassword: ; 8af6b
ld a, [MenuSelection]
ld c, a
ld a, [wBuenasPassword]
maskbits NUM_PASSWORDS_PER_CATEGORY +- 1
maskbits NUM_PASSWORDS_PER_CATEGORY
cp c
jr nz, .wrong
ld b, $1

View File

@@ -80,7 +80,7 @@ rept 4
endr
ld a, [TimeOfDay]
maskbits NUM_DAYTIMES +- 1
maskbits NUM_DAYTIMES
cp NITE_F
jr c, .time_species
inc hl

View File

@@ -435,7 +435,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae
ld a, [wEnvironment]
push af
ld a, [TimeOfDay]
maskbits NUM_DAYTIMES +- 1
maskbits NUM_DAYTIMES
ld [TimeOfDayPal], a
ld a, $1
ld [wEnvironment], a

View File

@@ -10,7 +10,7 @@ LoadPoisonBGPals: ; cbcdd
and a
jr nz, .cgb
ld a, [TimeOfDayPal]
maskbits NUM_DAYTIMES +- 1
maskbits NUM_DAYTIMES
cp DARKNESS_F
ld a, %00000000
jr z, .convert_pals