mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
Avoid "+- 1" at every maskbits
This commit is contained in:
parent
8048082114
commit
7b3de85a06
@ -1304,7 +1304,7 @@ ParseSFXOrRest: ; e8698
|
|||||||
ld [hl], a
|
ld [hl], a
|
||||||
; are we on the last channel? (noise sampling)
|
; are we on the last channel? (noise sampling)
|
||||||
ld a, [CurChannel]
|
ld a, [CurChannel]
|
||||||
maskbits NUM_MUSIC_CHANS +- 1
|
maskbits NUM_MUSIC_CHANS
|
||||||
cp CHAN4
|
cp CHAN4
|
||||||
ret z
|
ret z
|
||||||
; update hi frequency from next param
|
; update hi frequency from next param
|
||||||
@ -1668,7 +1668,7 @@ MusicEE; e883e
|
|||||||
; if ????, jump
|
; if ????, jump
|
||||||
; get channel
|
; get channel
|
||||||
ld a, [CurChannel]
|
ld a, [CurChannel]
|
||||||
maskbits NUM_MUSIC_CHANS +- 1
|
maskbits NUM_MUSIC_CHANS
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
; hl = Channel1JumpCondition + channel id
|
; hl = Channel1JumpCondition + channel id
|
||||||
@ -1966,7 +1966,7 @@ Music_NoteType: ; e8963
|
|||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, [CurChannel]
|
ld a, [CurChannel]
|
||||||
maskbits NUM_MUSIC_CHANS +- 1
|
maskbits NUM_MUSIC_CHANS
|
||||||
cp CHAN4
|
cp CHAN4
|
||||||
ret z
|
ret z
|
||||||
; intensity
|
; intensity
|
||||||
@ -2414,7 +2414,7 @@ SetLRTracks: ; e8b1b
|
|||||||
push de
|
push de
|
||||||
; store current channel in de
|
; store current channel in de
|
||||||
ld a, [CurChannel]
|
ld a, [CurChannel]
|
||||||
maskbits NUM_MUSIC_CHANS +- 1
|
maskbits NUM_MUSIC_CHANS
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
; get this channel's lr tracks
|
; get this channel's lr tracks
|
||||||
@ -2449,7 +2449,7 @@ _PlayMusic:: ; e8b30
|
|||||||
call LoadMusicByte ; store first byte of music header in a
|
call LoadMusicByte ; store first byte of music header in a
|
||||||
rlca
|
rlca
|
||||||
rlca
|
rlca
|
||||||
maskbits NUM_MUSIC_CHANS +- 1
|
maskbits NUM_MUSIC_CHANS
|
||||||
inc a
|
inc a
|
||||||
.loop
|
.loop
|
||||||
; start playing channels
|
; start playing channels
|
||||||
@ -2505,7 +2505,7 @@ _PlayCryHeader:: ; e8b79
|
|||||||
; Top 2 bits contain the number of channels
|
; Top 2 bits contain the number of channels
|
||||||
rlca
|
rlca
|
||||||
rlca
|
rlca
|
||||||
maskbits NUM_MUSIC_CHANS +- 1
|
maskbits NUM_MUSIC_CHANS
|
||||||
|
|
||||||
; For each channel:
|
; For each channel:
|
||||||
inc a
|
inc a
|
||||||
@ -2530,7 +2530,7 @@ _PlayCryHeader:: ; e8b79
|
|||||||
|
|
||||||
; No tempo for channel 4
|
; No tempo for channel 4
|
||||||
ld a, [CurChannel]
|
ld a, [CurChannel]
|
||||||
maskbits NUM_MUSIC_CHANS +- 1
|
maskbits NUM_MUSIC_CHANS
|
||||||
cp CHAN4
|
cp CHAN4
|
||||||
jr nc, .start
|
jr nc, .start
|
||||||
|
|
||||||
@ -2669,7 +2669,7 @@ _PlaySFX:: ; e8c04
|
|||||||
call LoadMusicByte
|
call LoadMusicByte
|
||||||
rlca ; top 2
|
rlca ; top 2
|
||||||
rlca ; bits
|
rlca ; bits
|
||||||
maskbits NUM_MUSIC_CHANS +- 1
|
maskbits NUM_MUSIC_CHANS
|
||||||
inc a ; # channels -> # loops
|
inc a ; # channels -> # loops
|
||||||
.startchannels
|
.startchannels
|
||||||
push af
|
push af
|
||||||
@ -2722,7 +2722,7 @@ PlayStereoSFX:: ; e8ca6
|
|||||||
call LoadMusicByte
|
call LoadMusicByte
|
||||||
rlca
|
rlca
|
||||||
rlca
|
rlca
|
||||||
maskbits NUM_MUSIC_CHANS +- 1
|
maskbits NUM_MUSIC_CHANS
|
||||||
inc a
|
inc a
|
||||||
|
|
||||||
.loop
|
.loop
|
||||||
@ -2736,7 +2736,7 @@ PlayStereoSFX:: ; e8ca6
|
|||||||
push de
|
push de
|
||||||
; get tracks for this channel
|
; get tracks for this channel
|
||||||
ld a, [CurChannel]
|
ld a, [CurChannel]
|
||||||
maskbits NUM_MUSIC_CHANS +- 1
|
maskbits NUM_MUSIC_CHANS
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
call GetLRTracks
|
call GetLRTracks
|
||||||
|
@ -216,6 +216,8 @@ NUM_WATERMON EQU 3 ; data/wild/*_water.asm table size
|
|||||||
GRASS_WILDDATA_LENGTH EQU (NUM_GRASSMON * 2 + 1) * 3 + 2
|
GRASS_WILDDATA_LENGTH EQU (NUM_GRASSMON * 2 + 1) * 3 + 2
|
||||||
WATER_WILDDATA_LENGTH EQU (NUM_WATERMON * 2 + 1) * 1 + 2
|
WATER_WILDDATA_LENGTH EQU (NUM_WATERMON * 2 + 1) * 1 + 2
|
||||||
|
|
||||||
|
NUM_ROAMMON_MAPS EQU 16 ; RoamMaps table size (see data/wild/roammon_maps.asm)
|
||||||
|
|
||||||
|
|
||||||
; swarms
|
; swarms
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ endr
|
|||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
RoamMaps: ; 2a40f
|
RoamMaps: ; 2a40f
|
||||||
|
; there are NUM_ROAMMON_MAPS entries
|
||||||
roam_map ROUTE_29, 2, ROUTE_30, ROUTE_46
|
roam_map ROUTE_29, 2, ROUTE_30, ROUTE_46
|
||||||
roam_map ROUTE_30, 2, ROUTE_29, ROUTE_31
|
roam_map ROUTE_30, 2, ROUTE_29, ROUTE_31
|
||||||
roam_map ROUTE_31, 3, ROUTE_30, ROUTE_32, ROUTE_36
|
roam_map ROUTE_31, 3, ROUTE_30, ROUTE_32, ROUTE_36
|
||||||
|
@ -186,7 +186,7 @@ AIChooseMove: ; 440ce
|
|||||||
.ChooseMove:
|
.ChooseMove:
|
||||||
ld hl, Buffer1
|
ld hl, Buffer1
|
||||||
call Random
|
call Random
|
||||||
maskbits NUM_MOVES +- 1
|
maskbits NUM_MOVES
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, 0
|
ld b, 0
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -640,7 +640,7 @@ StartTrainerBattle_LoadPokeBallGraphics: ; 8c5dc (23:45dc)
|
|||||||
.cgb
|
.cgb
|
||||||
ld hl, .daypals
|
ld hl, .daypals
|
||||||
ld a, [TimeOfDayPal]
|
ld a, [TimeOfDayPal]
|
||||||
maskbits NUM_DAYTIMES +- 1
|
maskbits NUM_DAYTIMES
|
||||||
cp DARKNESS_F
|
cp DARKNESS_F
|
||||||
jr nz, .daytime
|
jr nz, .daytime
|
||||||
ld hl, .nightpals
|
ld hl, .nightpals
|
||||||
|
@ -6031,7 +6031,7 @@ ParseEnemyAction: ; 3e7c1
|
|||||||
.loop2
|
.loop2
|
||||||
ld hl, EnemyMonMoves
|
ld hl, EnemyMonMoves
|
||||||
call BattleRandom
|
call BattleRandom
|
||||||
maskbits NUM_MOVES +- 1
|
maskbits NUM_MOVES
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, 0
|
ld b, 0
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -932,7 +932,7 @@ BattleCommand_CheckObedience: ; 343db
|
|||||||
|
|
||||||
.RandomMove:
|
.RandomMove:
|
||||||
call BattleRandom
|
call BattleRandom
|
||||||
maskbits NUM_MOVES +- 1
|
maskbits NUM_MOVES
|
||||||
|
|
||||||
cp b
|
cp b
|
||||||
jr nc, .RandomMove
|
jr nc, .RandomMove
|
||||||
@ -4387,7 +4387,7 @@ BattleCommand_SleepTalk: ; 35b33
|
|||||||
.sample_move
|
.sample_move
|
||||||
push hl
|
push hl
|
||||||
call BattleRandom
|
call BattleRandom
|
||||||
maskbits NUM_MOVES +- 1
|
maskbits NUM_MOVES
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, 0
|
ld b, 0
|
||||||
add hl, bc
|
add hl, bc
|
||||||
@ -8204,7 +8204,7 @@ BattleCommand_Conversion: ; 3707f
|
|||||||
.done
|
.done
|
||||||
.loop3
|
.loop3
|
||||||
call BattleRandom
|
call BattleRandom
|
||||||
maskbits NUM_MOVES +- 1
|
maskbits NUM_MOVES
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, StringBuffer1
|
ld hl, StringBuffer1
|
||||||
|
@ -1206,7 +1206,7 @@ BattleAnimCmd_Sound: ; cc7cd (33:47cd)
|
|||||||
srl a
|
srl a
|
||||||
ld [wSFXDuration], a
|
ld [wSFXDuration], a
|
||||||
call .GetCryTrack
|
call .GetCryTrack
|
||||||
maskbits NUM_NOISE_CHANS +- 1
|
maskbits NUM_NOISE_CHANS
|
||||||
ld [CryTracks], a ; CryTracks
|
ld [CryTracks], a ; CryTracks
|
||||||
|
|
||||||
ld e, a
|
ld e, a
|
||||||
@ -1243,7 +1243,7 @@ BattleAnimCmd_Sound: ; cc7cd (33:47cd)
|
|||||||
|
|
||||||
BattleAnimCmd_Cry: ; cc807 (33:4807)
|
BattleAnimCmd_Cry: ; cc807 (33:4807)
|
||||||
call GetBattleAnimByte
|
call GetBattleAnimByte
|
||||||
maskbits NUM_NOISE_CHANS +- 1
|
maskbits NUM_NOISE_CHANS
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .CryData
|
ld hl, .CryData
|
||||||
|
@ -1230,7 +1230,7 @@ LoadMapPals:
|
|||||||
ld l, a
|
ld l, a
|
||||||
; Futher refine by time of day
|
; Futher refine by time of day
|
||||||
ld a, [TimeOfDayPal]
|
ld a, [TimeOfDayPal]
|
||||||
maskbits NUM_DAYTIMES +- 1
|
maskbits NUM_DAYTIMES
|
||||||
add a
|
add a
|
||||||
add a
|
add a
|
||||||
add a
|
add a
|
||||||
@ -1276,7 +1276,7 @@ LoadMapPals:
|
|||||||
|
|
||||||
.got_pals
|
.got_pals
|
||||||
ld a, [TimeOfDayPal]
|
ld a, [TimeOfDayPal]
|
||||||
maskbits NUM_DAYTIMES +- 1
|
maskbits NUM_DAYTIMES
|
||||||
ld bc, 8 palettes
|
ld bc, 8 palettes
|
||||||
ld hl, MapObjectPals
|
ld hl, MapObjectPals
|
||||||
call AddNTimes
|
call AddNTimes
|
||||||
@ -1300,7 +1300,7 @@ LoadMapPals:
|
|||||||
ld de, RoofPals
|
ld de, RoofPals
|
||||||
add hl, de
|
add hl, de
|
||||||
ld a, [TimeOfDayPal]
|
ld a, [TimeOfDayPal]
|
||||||
maskbits NUM_DAYTIMES +- 1
|
maskbits NUM_DAYTIMES
|
||||||
cp NITE_F
|
cp NITE_F
|
||||||
jr c, .morn_day
|
jr c, .morn_day
|
||||||
rept 4
|
rept 4
|
||||||
|
@ -27,12 +27,12 @@ Function_LoadOpponentTrainerAndPokemons: ; 1f8000
|
|||||||
add b
|
add b
|
||||||
ld b, a ; b contains the nr of the trainer
|
ld b, a ; b contains the nr of the trainer
|
||||||
if DEF(_CRYSTAL11)
|
if DEF(_CRYSTAL11)
|
||||||
maskbits BATTLETOWER_NUM_UNIQUE_TRAINERS +- 1
|
maskbits BATTLETOWER_NUM_UNIQUE_TRAINERS
|
||||||
cp BATTLETOWER_NUM_UNIQUE_TRAINERS
|
cp BATTLETOWER_NUM_UNIQUE_TRAINERS
|
||||||
else
|
else
|
||||||
; Crystal 1.0 used the wrong constant here, so only the first 21
|
; Crystal 1.0 used the wrong constant here, so only the first 21
|
||||||
; trainers in BattleTowerTrainers can be sampled.
|
; trainers in BattleTowerTrainers can be sampled.
|
||||||
maskbits BATTLETOWER_NUM_UNIQUE_PKMN +- 1
|
maskbits BATTLETOWER_NUM_UNIQUE_PKMN
|
||||||
cp BATTLETOWER_NUM_UNIQUE_PKMN
|
cp BATTLETOWER_NUM_UNIQUE_PKMN
|
||||||
endc
|
endc
|
||||||
jr nc, .resample
|
jr nc, .resample
|
||||||
@ -115,7 +115,7 @@ Function_LoadRandomBattleTowerPkmn: ; 1f8081
|
|||||||
ld a, [hRandomAdd]
|
ld a, [hRandomAdd]
|
||||||
add b
|
add b
|
||||||
ld b, a
|
ld b, a
|
||||||
maskbits BATTLETOWER_NUM_UNIQUE_PKMN +- 1
|
maskbits BATTLETOWER_NUM_UNIQUE_PKMN
|
||||||
cp BATTLETOWER_NUM_UNIQUE_PKMN
|
cp BATTLETOWER_NUM_UNIQUE_PKMN
|
||||||
jr nc, .resample
|
jr nc, .resample
|
||||||
; in register 'a' is the chosen Pkmn of the LevelGroup
|
; in register 'a' is the chosen Pkmn of the LevelGroup
|
||||||
|
@ -17,7 +17,7 @@ Special_BuenasPassword: ; 8af6b
|
|||||||
ld a, [MenuSelection]
|
ld a, [MenuSelection]
|
||||||
ld c, a
|
ld c, a
|
||||||
ld a, [wBuenasPassword]
|
ld a, [wBuenasPassword]
|
||||||
maskbits NUM_PASSWORDS_PER_CATEGORY +- 1
|
maskbits NUM_PASSWORDS_PER_CATEGORY
|
||||||
cp c
|
cp c
|
||||||
jr nz, .wrong
|
jr nz, .wrong
|
||||||
ld b, $1
|
ld b, $1
|
||||||
|
@ -80,7 +80,7 @@ rept 4
|
|||||||
endr
|
endr
|
||||||
|
|
||||||
ld a, [TimeOfDay]
|
ld a, [TimeOfDay]
|
||||||
maskbits NUM_DAYTIMES +- 1
|
maskbits NUM_DAYTIMES
|
||||||
cp NITE_F
|
cp NITE_F
|
||||||
jr c, .time_species
|
jr c, .time_species
|
||||||
inc hl
|
inc hl
|
||||||
|
@ -435,7 +435,7 @@ MagnetTrain_Jumptable_FirstRunThrough: ; 8ceae
|
|||||||
ld a, [wEnvironment]
|
ld a, [wEnvironment]
|
||||||
push af
|
push af
|
||||||
ld a, [TimeOfDay]
|
ld a, [TimeOfDay]
|
||||||
maskbits NUM_DAYTIMES +- 1
|
maskbits NUM_DAYTIMES
|
||||||
ld [TimeOfDayPal], a
|
ld [TimeOfDayPal], a
|
||||||
ld a, $1
|
ld a, $1
|
||||||
ld [wEnvironment], a
|
ld [wEnvironment], a
|
||||||
|
@ -10,7 +10,7 @@ LoadPoisonBGPals: ; cbcdd
|
|||||||
and a
|
and a
|
||||||
jr nz, .cgb
|
jr nz, .cgb
|
||||||
ld a, [TimeOfDayPal]
|
ld a, [TimeOfDayPal]
|
||||||
maskbits NUM_DAYTIMES +- 1
|
maskbits NUM_DAYTIMES
|
||||||
cp DARKNESS_F
|
cp DARKNESS_F
|
||||||
ld a, %00000000
|
ld a, %00000000
|
||||||
jr z, .convert_pals
|
jr z, .convert_pals
|
||||||
|
@ -775,7 +775,7 @@ GetPokedexEntryBank:
|
|||||||
ld a, [EnemyMonSpecies]
|
ld a, [EnemyMonSpecies]
|
||||||
rlca
|
rlca
|
||||||
rlca
|
rlca
|
||||||
maskbits NUM_DEX_ENTRY_BANKS +- 1
|
maskbits NUM_DEX_ENTRY_BANKS
|
||||||
ld hl, .PokedexEntryBanks
|
ld hl, .PokedexEntryBanks
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld e, a
|
ld e, a
|
||||||
|
@ -82,7 +82,7 @@ _LoadFontsBattleExtra:: ; fb4be
|
|||||||
|
|
||||||
LoadFrame: ; fb4cc
|
LoadFrame: ; fb4cc
|
||||||
ld a, [TextBoxFrame]
|
ld a, [TextBoxFrame]
|
||||||
maskbits NUM_FRAMES +- 1
|
maskbits NUM_FRAMES
|
||||||
ld bc, 6 * LEN_1BPP_TILE
|
ld bc, 6 * LEN_1BPP_TILE
|
||||||
ld hl, Frames
|
ld hl, Frames
|
||||||
call AddNTimes
|
call AddNTimes
|
||||||
|
@ -893,7 +893,7 @@ MapObjectMovementPattern: ; 47dd
|
|||||||
ld hl, OBJECT_DIRECTION_WALKING
|
ld hl, OBJECT_DIRECTION_WALKING
|
||||||
add hl, de
|
add hl, de
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
maskbits NUM_DIRECTIONS +- 1
|
maskbits NUM_DIRECTIONS
|
||||||
ld d, 1 * 8 + 6
|
ld d, 1 * 8 + 6
|
||||||
cp DOWN
|
cp DOWN
|
||||||
jr z, .ok_13
|
jr z, .ok_13
|
||||||
|
@ -106,7 +106,7 @@ Function6f3e: ; 6f3e
|
|||||||
ld hl, OBJECT_DIRECTION_WALKING
|
ld hl, OBJECT_DIRECTION_WALKING
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
maskbits NUM_DIRECTIONS +- 1
|
maskbits NUM_DIRECTIONS
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .data_6f5b
|
ld hl, .data_6f5b
|
||||||
@ -131,7 +131,7 @@ Function6f5f: ; 6f5f
|
|||||||
push af
|
push af
|
||||||
ld hl, OBJECT_DIRECTION_WALKING
|
ld hl, OBJECT_DIRECTION_WALKING
|
||||||
add hl, bc
|
add hl, bc
|
||||||
maskbits NUM_DIRECTIONS +- 1
|
maskbits NUM_DIRECTIONS
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .data_6f7b
|
ld hl, .data_6f7b
|
||||||
@ -178,7 +178,7 @@ Function6fa1: ; 6fa1
|
|||||||
ld hl, OBJECT_DIRECTION_WALKING
|
ld hl, OBJECT_DIRECTION_WALKING
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
maskbits NUM_DIRECTIONS +- 1
|
maskbits NUM_DIRECTIONS
|
||||||
jr z, .down
|
jr z, .down
|
||||||
dec a
|
dec a
|
||||||
jr z, .up
|
jr z, .up
|
||||||
|
@ -954,7 +954,7 @@ InitPackBuffers: ; 1068a
|
|||||||
ld [wJumptableIndex], a
|
ld [wJumptableIndex], a
|
||||||
; pocket id -> jumptable index
|
; pocket id -> jumptable index
|
||||||
ld a, [wLastPocket]
|
ld a, [wLastPocket]
|
||||||
maskbits NUM_POCKETS +- 1
|
maskbits NUM_POCKETS
|
||||||
ld [wCurrPocket], a
|
ld [wCurrPocket], a
|
||||||
inc a
|
inc a
|
||||||
add a
|
add a
|
||||||
@ -1099,7 +1099,7 @@ DepositSellTutorial_InterpretJoypad: ; 1076f
|
|||||||
.d_left
|
.d_left
|
||||||
ld a, [wJumptableIndex]
|
ld a, [wJumptableIndex]
|
||||||
dec a
|
dec a
|
||||||
maskbits NUM_POCKETS +- 1
|
maskbits NUM_POCKETS
|
||||||
ld [wJumptableIndex], a
|
ld [wJumptableIndex], a
|
||||||
push de
|
push de
|
||||||
ld de, SFX_SWITCH_POCKETS
|
ld de, SFX_SWITCH_POCKETS
|
||||||
@ -1111,7 +1111,7 @@ DepositSellTutorial_InterpretJoypad: ; 1076f
|
|||||||
.d_right
|
.d_right
|
||||||
ld a, [wJumptableIndex]
|
ld a, [wJumptableIndex]
|
||||||
inc a
|
inc a
|
||||||
maskbits NUM_POCKETS +- 1
|
maskbits NUM_POCKETS
|
||||||
ld [wJumptableIndex], a
|
ld [wJumptableIndex], a
|
||||||
push de
|
push de
|
||||||
ld de, SFX_SWITCH_POCKETS
|
ld de, SFX_SWITCH_POCKETS
|
||||||
@ -1281,7 +1281,7 @@ WaitBGMap_DrawPackGFX: ; 1089a (4:489a)
|
|||||||
call WaitBGMap
|
call WaitBGMap
|
||||||
DrawPackGFX: ; 1089d
|
DrawPackGFX: ; 1089d
|
||||||
ld a, [wCurrPocket]
|
ld a, [wCurrPocket]
|
||||||
maskbits NUM_POCKETS +- 1
|
maskbits NUM_POCKETS
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, $0
|
ld d, $0
|
||||||
ld a, [BattleType]
|
ld a, [BattleType]
|
||||||
|
@ -140,7 +140,7 @@ DoPlayerMovement:: ; 80000
|
|||||||
|
|
||||||
.water
|
.water
|
||||||
ld a, c
|
ld a, c
|
||||||
maskbits NUM_DIRECTIONS +- 1
|
maskbits NUM_DIRECTIONS
|
||||||
ld c, a
|
ld c, a
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, .water_table
|
ld hl, .water_table
|
||||||
@ -244,7 +244,7 @@ DoPlayerMovement:: ; 80000
|
|||||||
ld a, [PlayerDirection]
|
ld a, [PlayerDirection]
|
||||||
rrca
|
rrca
|
||||||
rrca
|
rrca
|
||||||
maskbits NUM_DIRECTIONS +- 1
|
maskbits NUM_DIRECTIONS
|
||||||
cp e
|
cp e
|
||||||
jr z, .not_turning
|
jr z, .not_turning
|
||||||
|
|
||||||
@ -430,7 +430,7 @@ DoPlayerMovement:: ; 80000
|
|||||||
ld a, [PlayerDirection]
|
ld a, [PlayerDirection]
|
||||||
rrca
|
rrca
|
||||||
rrca
|
rrca
|
||||||
maskbits NUM_DIRECTIONS +- 1
|
maskbits NUM_DIRECTIONS
|
||||||
cp e
|
cp e
|
||||||
jr nz, .not_warp
|
jr nz, .not_warp
|
||||||
call WarpCheck
|
call WarpCheck
|
||||||
@ -559,7 +559,7 @@ DoPlayerMovement:: ; 80000
|
|||||||
cp 0
|
cp 0
|
||||||
ret z
|
ret z
|
||||||
|
|
||||||
maskbits NUM_DIRECTIONS +- 1
|
maskbits NUM_DIRECTIONS
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .forced_dpad
|
ld hl, .forced_dpad
|
||||||
|
@ -589,7 +589,7 @@ Special_SurfStartStep: ; 8379
|
|||||||
ld a, [PlayerDirection]
|
ld a, [PlayerDirection]
|
||||||
srl a
|
srl a
|
||||||
srl a
|
srl a
|
||||||
maskbits NUM_DIRECTIONS +- 1
|
maskbits NUM_DIRECTIONS
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .movement_data
|
ld hl, .movement_data
|
||||||
|
@ -230,7 +230,7 @@ GetDexEntryPointer: ; 44333
|
|||||||
push de
|
push de
|
||||||
rlca
|
rlca
|
||||||
rlca
|
rlca
|
||||||
maskbits NUM_DEX_ENTRY_BANKS +- 1
|
maskbits NUM_DEX_ENTRY_BANKS
|
||||||
ld hl, .PokedexEntryBanks
|
ld hl, .PokedexEntryBanks
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld e, a
|
ld e, a
|
||||||
|
@ -251,7 +251,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8)
|
|||||||
ld a, $4f
|
ld a, $4f
|
||||||
call ByteFill
|
call ByteFill
|
||||||
ld a, [wPokegearCard]
|
ld a, [wPokegearCard]
|
||||||
maskbits NUM_POKEGEAR_CARDS +- 1
|
maskbits NUM_POKEGEAR_CARDS
|
||||||
add a
|
add a
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
@ -289,7 +289,7 @@ InitPokegearTilemap: ; 90da8 (24:4da8)
|
|||||||
ld [hWY], a
|
ld [hWY], a
|
||||||
; swap region maps
|
; swap region maps
|
||||||
ld a, [wPokegearMapRegion]
|
ld a, [wPokegearMapRegion]
|
||||||
maskbits NUM_REGIONS +- 1
|
maskbits NUM_REGIONS
|
||||||
xor 1
|
xor 1
|
||||||
ld [wPokegearMapRegion], a
|
ld [wPokegearMapRegion], a
|
||||||
ret
|
ret
|
||||||
|
@ -247,7 +247,7 @@ endr
|
|||||||
; Generate a number, either 0, 1, or 2, to choose a time of day.
|
; Generate a number, either 0, 1, or 2, to choose a time of day.
|
||||||
.loop2
|
.loop2
|
||||||
call Random
|
call Random
|
||||||
maskbits NUM_DAYTIMES +- 1
|
maskbits NUM_DAYTIMES
|
||||||
cp DARKNESS_F
|
cp DARKNESS_F
|
||||||
jr z, .loop2
|
jr z, .loop2
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ OaksPkmnTalk8:
|
|||||||
; 0-15 are all valid indexes into .Adverbs,
|
; 0-15 are all valid indexes into .Adverbs,
|
||||||
; so no need for a retry loop
|
; so no need for a retry loop
|
||||||
call Random
|
call Random
|
||||||
maskbits NUM_OAKS_MON_TALK_ADVERBS +- 1
|
maskbits NUM_OAKS_MON_TALK_ADVERBS
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .Adverbs
|
ld hl, .Adverbs
|
||||||
@ -466,7 +466,7 @@ OaksPkmnTalk9:
|
|||||||
; 0-15 are all valid indexes into .Adjectives,
|
; 0-15 are all valid indexes into .Adjectives,
|
||||||
; so no need for a retry loop
|
; so no need for a retry loop
|
||||||
call Random
|
call Random
|
||||||
maskbits NUM_OAKS_MON_TALK_ADJECTIVES +- 1
|
maskbits NUM_OAKS_MON_TALK_ADJECTIVES
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .Adjectives
|
ld hl, .Adjectives
|
||||||
@ -692,7 +692,7 @@ PokedexShow_GetDexEntryBank:
|
|||||||
dec a
|
dec a
|
||||||
rlca
|
rlca
|
||||||
rlca
|
rlca
|
||||||
maskbits NUM_DEX_ENTRY_BANKS +- 1
|
maskbits NUM_DEX_ENTRY_BANKS
|
||||||
ld hl, .PokedexEntryBanks
|
ld hl, .PokedexEntryBanks
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld e, a
|
ld e, a
|
||||||
@ -1164,7 +1164,7 @@ PnP_Text3:
|
|||||||
|
|
||||||
PeoplePlaces4: ; People
|
PeoplePlaces4: ; People
|
||||||
call Random
|
call Random
|
||||||
maskbits NUM_TRAINER_CLASSES +- 1
|
maskbits NUM_TRAINER_CLASSES
|
||||||
inc a
|
inc a
|
||||||
cp NUM_TRAINER_CLASSES - 1
|
cp NUM_TRAINER_CLASSES - 1
|
||||||
jr nc, PeoplePlaces4
|
jr nc, PeoplePlaces4
|
||||||
@ -1208,7 +1208,7 @@ PeoplePlaces5:
|
|||||||
; 0-15 are all valid indexes into .Adjectives,
|
; 0-15 are all valid indexes into .Adjectives,
|
||||||
; so no need for a retry loop
|
; so no need for a retry loop
|
||||||
call Random
|
call Random
|
||||||
maskbits NUM_PNP_PEOPLE_ADJECTIVES +- 1
|
maskbits NUM_PNP_PEOPLE_ADJECTIVES
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .Adjectives
|
ld hl, .Adjectives
|
||||||
@ -1358,7 +1358,7 @@ PeoplePlaces7:
|
|||||||
; 0-15 are all valid indexes into .Adjectives,
|
; 0-15 are all valid indexes into .Adjectives,
|
||||||
; so no need for a retry loop
|
; so no need for a retry loop
|
||||||
call Random
|
call Random
|
||||||
maskbits NUM_PNP_PLACES_ADJECTIVES +- 1
|
maskbits NUM_PNP_PLACES_ADJECTIVES
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .Adjectives
|
ld hl, .Adjectives
|
||||||
@ -1565,7 +1565,7 @@ BuenasPassword4:
|
|||||||
; There are only 11 groups to choose from.
|
; There are only 11 groups to choose from.
|
||||||
.greater_than_11
|
.greater_than_11
|
||||||
call Random
|
call Random
|
||||||
maskbits NUM_PASSWORD_CATEGORIES +- 1
|
maskbits NUM_PASSWORD_CATEGORIES
|
||||||
cp NUM_PASSWORD_CATEGORIES
|
cp NUM_PASSWORD_CATEGORIES
|
||||||
jr nc, .greater_than_11
|
jr nc, .greater_than_11
|
||||||
; Store it in the high nybble of e.
|
; Store it in the high nybble of e.
|
||||||
@ -1574,7 +1574,7 @@ BuenasPassword4:
|
|||||||
; For each group, choose one of the three passwords.
|
; For each group, choose one of the three passwords.
|
||||||
.greater_than_three
|
.greater_than_three
|
||||||
call Random
|
call Random
|
||||||
maskbits NUM_PASSWORDS_PER_CATEGORY +- 1
|
maskbits NUM_PASSWORDS_PER_CATEGORY
|
||||||
cp NUM_PASSWORDS_PER_CATEGORY
|
cp NUM_PASSWORDS_PER_CATEGORY
|
||||||
jr nc, .greater_than_three
|
jr nc, .greater_than_three
|
||||||
; The high nybble of wBuenasPassword will now contain the password group index, and the low nybble contains the actual password.
|
; The high nybble of wBuenasPassword will now contain the password group index, and the low nybble contains the actual password.
|
||||||
|
@ -614,7 +614,7 @@ GetPocketName:
|
|||||||
ld a, [wItemAttributeParamBuffer]
|
ld a, [wItemAttributeParamBuffer]
|
||||||
dec a
|
dec a
|
||||||
ld hl, .Pockets
|
ld hl, .Pockets
|
||||||
maskbits NUM_POCKETS +- 1
|
maskbits NUM_POCKETS
|
||||||
add a
|
add a
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
@ -2474,7 +2474,7 @@ Script_warpfacing:
|
|||||||
; parameters: facing, map_group, map_id, x, y
|
; parameters: facing, map_group, map_id, x, y
|
||||||
|
|
||||||
call GetScriptByte
|
call GetScriptByte
|
||||||
maskbits NUM_DIRECTIONS +- 1
|
maskbits NUM_DIRECTIONS
|
||||||
ld c, a
|
ld c, a
|
||||||
ld a, [wPlayerSpriteSetupFlags]
|
ld a, [wPlayerSpriteSetupFlags]
|
||||||
set 5, a
|
set 5, a
|
||||||
|
@ -283,7 +283,7 @@ StatsScreen_GetJoypad: ; 4de2c (13:5e2c)
|
|||||||
StatsScreen_JoypadAction: ; 4de54 (13:5e54)
|
StatsScreen_JoypadAction: ; 4de54 (13:5e54)
|
||||||
push af
|
push af
|
||||||
ld a, [wcf64]
|
ld a, [wcf64]
|
||||||
maskbits NUM_STAT_PAGES +- 1
|
maskbits NUM_STAT_PAGES
|
||||||
ld c, a
|
ld c, a
|
||||||
pop af
|
pop af
|
||||||
bit B_BUTTON_F, a
|
bit B_BUTTON_F, a
|
||||||
@ -512,7 +512,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
|
|||||||
|
|
||||||
.ClearBox: ; 4dfda (13:5fda)
|
.ClearBox: ; 4dfda (13:5fda)
|
||||||
ld a, [wcf64]
|
ld a, [wcf64]
|
||||||
maskbits NUM_STAT_PAGES +- 1
|
maskbits NUM_STAT_PAGES
|
||||||
ld c, a
|
ld c, a
|
||||||
call StatsScreen_LoadPageIndicators
|
call StatsScreen_LoadPageIndicators
|
||||||
hlcoord 0, 8
|
hlcoord 0, 8
|
||||||
@ -522,7 +522,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
|
|||||||
|
|
||||||
.LoadPals: ; 4dfed (13:5fed)
|
.LoadPals: ; 4dfed (13:5fed)
|
||||||
ld a, [wcf64]
|
ld a, [wcf64]
|
||||||
maskbits NUM_STAT_PAGES +- 1
|
maskbits NUM_STAT_PAGES
|
||||||
ld c, a
|
ld c, a
|
||||||
farcall LoadStatsScreenPals
|
farcall LoadStatsScreenPals
|
||||||
call DelayFrame
|
call DelayFrame
|
||||||
@ -532,7 +532,7 @@ StatsScreen_LoadGFX: ; 4dfb6 (13:5fb6)
|
|||||||
|
|
||||||
.PageTilemap: ; 4e002 (13:6002)
|
.PageTilemap: ; 4e002 (13:6002)
|
||||||
ld a, [wcf64]
|
ld a, [wcf64]
|
||||||
maskbits NUM_STAT_PAGES +- 1
|
maskbits NUM_STAT_PAGES
|
||||||
dec a
|
dec a
|
||||||
ld hl, .Jumptable
|
ld hl, .Jumptable
|
||||||
rst JumpTable
|
rst JumpTable
|
||||||
|
@ -552,7 +552,7 @@ TradeAnim_GetTrademonSFX: ; 29277
|
|||||||
; 29281
|
; 29281
|
||||||
|
|
||||||
TradeAnim_TubeAnimJumptable: ; 29281
|
TradeAnim_TubeAnimJumptable: ; 29281
|
||||||
maskbits TRADEANIMJUMPTABLE_LENGTH +- 1
|
maskbits TRADEANIMJUMPTABLE_LENGTH
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .Jumptable
|
ld hl, .Jumptable
|
||||||
|
@ -835,7 +835,7 @@ INCBIN "gfx/unown_puzzle/tile_borders.2bpp"
|
|||||||
|
|
||||||
LoadUnownPuzzlePiecesGFX: ; e17a3
|
LoadUnownPuzzlePiecesGFX: ; e17a3
|
||||||
ld a, [ScriptVar]
|
ld a, [ScriptVar]
|
||||||
maskbits NUM_UNOWN_PUZZLES +- 1
|
maskbits NUM_UNOWN_PUZZLES
|
||||||
ld e, a
|
ld e, a
|
||||||
ld d, 0
|
ld d, 0
|
||||||
ld hl, .LZPointers
|
ld hl, .LZPointers
|
||||||
|
@ -739,11 +739,11 @@ JumpRoamMons: ; 2a394
|
|||||||
JumpRoamMon: ; 2a3cd
|
JumpRoamMon: ; 2a3cd
|
||||||
.loop
|
.loop
|
||||||
ld hl, RoamMaps
|
ld hl, RoamMaps
|
||||||
.innerloop1 ; This loop is completely unnecessary.
|
.innerloop1 ; This loop happens to be unnecessary.
|
||||||
call Random ; Choose a random number.
|
call Random ; Choose a random number.
|
||||||
maskbits $10 - 1 ; Mask the number to limit it between 0 and 15.
|
maskbits NUM_ROAMMON_MAPS ; Mask the number to limit it between 0 and 15.
|
||||||
cp $10 ; If the number is not less than 16, try again.
|
cp NUM_ROAMMON_MAPS ; If the number is not less than 16, try again.
|
||||||
jr nc, .innerloop1 ; I'm sure you can guess why this check is bogus.
|
jr nc, .innerloop1 ; I'm sure you can guess why this check is bogus.
|
||||||
inc a
|
inc a
|
||||||
ld b, a
|
ld b, a
|
||||||
.innerloop2 ; Loop to get hl to the address of the chosen roam map.
|
.innerloop2 ; Loop to get hl to the address of the chosen roam map.
|
||||||
|
@ -48,17 +48,17 @@ GetClock:: ; 5b7
|
|||||||
|
|
||||||
ld [hl], RTC_S
|
ld [hl], RTC_S
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
maskbits 60 - 1
|
maskbits 60
|
||||||
ld [hRTCSeconds], a
|
ld [hRTCSeconds], a
|
||||||
|
|
||||||
ld [hl], RTC_M
|
ld [hl], RTC_M
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
maskbits 60 - 1
|
maskbits 60
|
||||||
ld [hRTCMinutes], a
|
ld [hRTCMinutes], a
|
||||||
|
|
||||||
ld [hl], RTC_H
|
ld [hl], RTC_H
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
maskbits 24 - 1
|
maskbits 24
|
||||||
ld [hRTCHours], a
|
ld [hRTCHours], a
|
||||||
|
|
||||||
ld [hl], RTC_DL
|
ld [hl], RTC_DL
|
||||||
|
@ -37,17 +37,17 @@ ENDM
|
|||||||
|
|
||||||
maskbits: MACRO
|
maskbits: MACRO
|
||||||
; masks just enough bits to cover the argument
|
; masks just enough bits to cover the argument
|
||||||
; e.g. "maskbits %00010100" becomes "and %00011111"
|
; e.g. "maskbits 26" becomes "and %00011111" (since 26 - 1 = %00011001)
|
||||||
; example usage in rejection sampling:
|
; example usage in rejection sampling:
|
||||||
; .loop
|
; .loop
|
||||||
; call Random
|
; call Random
|
||||||
; maskbits 30 +- 1
|
; maskbits 30
|
||||||
; cp 30
|
; cp 30
|
||||||
; jr nc, .loop
|
; jr nc, .loop
|
||||||
x = 1
|
x = 1
|
||||||
rept 8
|
rept 8
|
||||||
if x < (\1)
|
if x + 1 < (\1)
|
||||||
x = (x + 1) * 2 +- 1
|
x = x << 1 | 1
|
||||||
endc
|
endc
|
||||||
endr
|
endr
|
||||||
and x
|
and x
|
||||||
|
@ -1072,7 +1072,7 @@ Function106464:: ; 106464
|
|||||||
|
|
||||||
Function10649b: ; 10649b
|
Function10649b: ; 10649b
|
||||||
ld a, [TextBoxFrame]
|
ld a, [TextBoxFrame]
|
||||||
maskbits NUM_FRAMES +- 1
|
maskbits NUM_FRAMES
|
||||||
ld bc, 6 * LEN_1BPP_TILE
|
ld bc, 6 * LEN_1BPP_TILE
|
||||||
ld hl, Frames
|
ld hl, Frames
|
||||||
call AddNTimes
|
call AddNTimes
|
||||||
|
Loading…
Reference in New Issue
Block a user