rgbds supports 'X - 1' instead of 'X + -1'

This commit is contained in:
Rangi 2020-03-21 14:01:05 -04:00
parent 5a5f5ececd
commit 6a6ba10315
32 changed files with 47 additions and 47 deletions

View File

@ -1294,7 +1294,7 @@ GetNoiseSample:
; load ptr to sample header in wNoiseSampleAddress ; load ptr to sample header in wNoiseSampleAddress
; are we on the last channel? ; are we on the last channel?
ld a, [wCurChannel] ld a, [wCurChannel]
and NUM_MUSIC_CHANS + -1 and NUM_MUSIC_CHANS - 1
cp CHAN4 cp CHAN4
; ret if not ; ret if not
ret nz ret nz

View File

@ -61,10 +61,10 @@ MOVE_LENGTH EQU const_value
const STAT_DEF const STAT_DEF
const STAT_SPD const STAT_SPD
const STAT_SATK const STAT_SATK
NUM_EXP_STATS EQU const_value + -1 NUM_EXP_STATS EQU const_value - 1
const STAT_SDEF const STAT_SDEF
NUM_STATS EQU const_value + -1 NUM_STATS EQU const_value - 1
NUM_BATTLE_STATS EQU NUM_STATS + -1 ; don't count HP NUM_BATTLE_STATS EQU NUM_STATS - 1 ; don't count HP
; stat formula constants ; stat formula constants
STAT_MIN_NORMAL EQU 5 STAT_MIN_NORMAL EQU 5

View File

@ -287,7 +287,7 @@ ENDM
add_mt FLAMETHROWER add_mt FLAMETHROWER
add_mt THUNDERBOLT add_mt THUNDERBOLT
add_mt ICE_BEAM add_mt ICE_BEAM
NUM_TM_HM_TUTOR EQU __enum__ + -1 NUM_TM_HM_TUTOR EQU __enum__ - 1
const ITEM_FA ; fa const ITEM_FA ; fa

View File

@ -257,7 +257,7 @@
const ROCK_SMASH ; f9 const ROCK_SMASH ; f9
const WHIRLPOOL ; fa const WHIRLPOOL ; fa
const BEAT_UP ; fb const BEAT_UP ; fb
NUM_ATTACKS EQU const_value + -1 NUM_ATTACKS EQU const_value - 1
const MOVE_OR_ANIM_FC ; fc const MOVE_OR_ANIM_FC ; fc
const MOVE_OR_ANIM_FD ; fd const MOVE_OR_ANIM_FD ; fd

View File

@ -271,7 +271,7 @@ JOHTO_POKEMON EQU const_value
const LUGIA ; f9 const LUGIA ; f9
const HO_OH ; fa const HO_OH ; fa
const CELEBI ; fb const CELEBI ; fb
NUM_POKEMON EQU const_value + -1 NUM_POKEMON EQU const_value - 1
const MON_FC ; fc const MON_FC ; fc
const EGG ; fd const EGG ; fd
const MON_FE ; fe const MON_FE ; fe
@ -311,4 +311,4 @@ NUM_POKEMON EQU const_value + -1
const UNOWN_X ; 24 const UNOWN_X ; 24
const UNOWN_Y ; 25 const UNOWN_Y ; 25
const UNOWN_Z ; 26 const UNOWN_Z ; 26
NUM_UNOWN EQU const_value + -1 ; 26 NUM_UNOWN EQU const_value - 1 ; 26

View File

@ -124,7 +124,7 @@ MONS_PER_BOX EQU 20
NUM_BOXES EQU 14 NUM_BOXES EQU 14
; hall of fame ; hall of fame
HOF_MON_LENGTH EQU 1 + 2 + 2 + 1 + (MON_NAME_LENGTH + -1) ; species, id, dvs, level, nick HOF_MON_LENGTH EQU 1 + 2 + 2 + 1 + (MON_NAME_LENGTH - 1) ; species, id, dvs, level, nick
HOF_LENGTH EQU 1 + HOF_MON_LENGTH * PARTY_LENGTH + 1 ; win count, party, terminator HOF_LENGTH EQU 1 + HOF_MON_LENGTH * PARTY_LENGTH + 1 ; win count, party, terminator
NUM_HOF_TEAMS EQU 30 NUM_HOF_TEAMS EQU 30

View File

@ -224,7 +224,7 @@ EMOTE_FROM_MEM EQU -1
const FRUITTREE_PEWTER_CITY_1 ; 1c const FRUITTREE_PEWTER_CITY_1 ; 1c
const FRUITTREE_PEWTER_CITY_2 ; 1d const FRUITTREE_PEWTER_CITY_2 ; 1d
const FRUITTREE_FUCHSIA_CITY ; 1e const FRUITTREE_FUCHSIA_CITY ; 1e
NUM_FRUIT_TREES EQU const_value + -1 NUM_FRUIT_TREES EQU const_value - 1
; describedecoration arguments ; describedecoration arguments
; DescribeDecoration.JumpTable indexes (see engine/overworld/decorations.asm) ; DescribeDecoration.JumpTable indexes (see engine/overworld/decorations.asm)

View File

@ -38,7 +38,7 @@ _tgt = 0
endc endc
if "\1" == "north" if "\1" == "north"
_blk = \3_WIDTH * (\3_HEIGHT + -3) + _src _blk = \3_WIDTH * (\3_HEIGHT - 3) + _src
_map = _tgt _map = _tgt
_win = (\3_WIDTH + 6) * \3_HEIGHT + 1 _win = (\3_WIDTH + 6) * \3_HEIGHT + 1
_y = \3_HEIGHT * 2 - 1 _y = \3_HEIGHT * 2 - 1
@ -60,9 +60,9 @@ _len = \3_WIDTH
endc endc
elif "\1" == "west" elif "\1" == "west"
_blk = (\3_WIDTH * _src) + \3_WIDTH + -3 _blk = (\3_WIDTH * _src) + \3_WIDTH - 3
_map = (CURRENT_MAP_WIDTH + 6) * _tgt _map = (CURRENT_MAP_WIDTH + 6) * _tgt
_win = (\3_WIDTH + 6) * 2 + -6 _win = (\3_WIDTH + 6) * 2 - 6
_y = (\4) * -2 _y = (\4) * -2
_x = \3_WIDTH * 2 - 1 _x = \3_WIDTH * 2 - 1
_len = CURRENT_MAP_HEIGHT + 3 - (\4) _len = CURRENT_MAP_HEIGHT + 3 - (\4)

View File

@ -4,7 +4,7 @@
roam_map: MACRO roam_map: MACRO
map_id \1 map_id \1
db _NARG - 1 db _NARG - 1
rept _NARG + -1 rept _NARG - 1
map_id \2 map_id \2
shift shift
endr endr

View File

@ -1840,8 +1840,8 @@ This bug can allow you to talk to Eusine in Celadon City and encounter Ho-Oh wit
ld hl, wPlayerName ld hl, wPlayerName
-rept NAME_LENGTH_JAPANESE + -2 ; should be PLAYER_NAME_LENGTH + -2 -rept NAME_LENGTH_JAPANESE - 2 ; should be PLAYER_NAME_LENGTH - 2
+rept PLAYER_NAME_LENGTH + -2 +rept PLAYER_NAME_LENGTH - 2
ld a, [de] ld a, [de]
cp [hl] cp [hl]
jr nz, .notfound jr nz, .notfound

View File

@ -244,7 +244,7 @@ BattleAnim_ClearOAM:
ld a, [hl] ld a, [hl]
and $ff ^ (PALETTE_MASK | VRAM_BANK_1) ; PAL_BATTLE_OB_ENEMY (0) and $ff ^ (PALETTE_MASK | VRAM_BANK_1) ; PAL_BATTLE_OB_ENEMY (0)
ld [hli], a ld [hli], a
rept SPRITEOAMSTRUCT_LENGTH + -1 rept SPRITEOAMSTRUCT_LENGTH - 1
inc hl inc hl
endr endr
dec c dec c

View File

@ -395,10 +395,10 @@ ValidateBTParty:
ld a, [hl] ld a, [hl]
and a and a
x = $ff x = $ff
rept ($ff + -NUM_POKEMON) rept ($ff - NUM_POKEMON)
jr z, .invalid jr z, .invalid
cp x cp x
x = x + -1 x = x - 1
endr endr
jr nz, .valid jr nz, .valid

View File

@ -211,7 +211,7 @@ DetermineContestWinners:
CopyTempContestant: CopyTempContestant:
; Could've just called CopyBytes. ; Could've just called CopyBytes.
ld de, wBugContestTempWinnerID ld de, wBugContestTempWinnerID
rept BUG_CONTESTANT_SIZE + -1 rept BUG_CONTESTANT_SIZE - 1
ld a, [de] ld a, [de]
inc de inc de
ld [hli], a ld [hli], a

View File

@ -57,7 +57,7 @@ CelebiShrineEvent:
ld c, 4 ld c, 4
.OAMloop: .OAMloop:
ld [hli], a ; tile id ld [hli], a ; tile id
rept SPRITEOAMSTRUCT_LENGTH + -1 rept SPRITEOAMSTRUCT_LENGTH - 1
inc hl inc hl
endr endr
inc a inc a

View File

@ -383,7 +383,7 @@ FlyToAnim:
ld c, 4 ld c, 4
.OAMloop .OAMloop
ld [hli], a ; tile id ld [hli], a ; tile id
rept SPRITEOAMSTRUCT_LENGTH + -1 rept SPRITEOAMSTRUCT_LENGTH - 1
inc hl inc hl
endr endr
inc a inc a

View File

@ -98,10 +98,10 @@ RotateUnownFrontpic:
gbprinterrect: MACRO gbprinterrect: MACRO
y = 0 y = 0
rept \1 rept \1
x = \1 * (\2 + -1) + y x = \1 * (\2 - 1) + y
rept \2 rept \2
dw wGameboyPrinterRAM tile x dw wGameboyPrinterRAM tile x
x = x + -\2 x = x - \2
endr endr
y = y + 1 y = y + 1
endr endr

View File

@ -261,7 +261,7 @@ Unreferenced_Function9282c:
ld a, [hl] ld a, [hl]
xor %00100000 xor %00100000
ld [hli], a ; tile id ld [hli], a ; tile id
rept SPRITEOAMSTRUCT_LENGTH + -1 rept SPRITEOAMSTRUCT_LENGTH - 1
inc hl inc hl
endr endr
dec c dec c

View File

@ -538,7 +538,7 @@ PokeAnim_CopyBitmaskToBuffer:
poke_anim_box: MACRO poke_anim_box: MACRO
y = 7 y = 7
rept \1 rept \1
x = 7 + -\1 x = 7 - \1
rept \1 rept \1
db x + y db x + y
x = x + 1 x = x + 1

View File

@ -114,7 +114,7 @@ Options_TextSpeed:
ld a, c ; right pressed ld a, c ; right pressed
cp OPT_TEXT_SPEED_SLOW cp OPT_TEXT_SPEED_SLOW
jr c, .Increase jr c, .Increase
ld c, OPT_TEXT_SPEED_FAST + -1 ld c, OPT_TEXT_SPEED_FAST - 1
.Increase: .Increase:
inc c inc c

View File

@ -1796,16 +1796,16 @@ endr
hue = 31 hue = 31
rept 8 rept 8
RGB hue, hue, hue RGB hue, hue, hue
hue = hue + -1 hue = hue - 1
RGB hue, hue, hue RGB hue, hue, hue
hue = hue + -2 hue = hue - 2
endr endr
.SlowFadePalettes: .SlowFadePalettes:
hue = 31 hue = 31
rept 16 rept 16
RGB hue, hue, hue RGB hue, hue, hue
hue = hue + -1 hue = hue - 1
endr endr
Intro_LoadTilemap: Intro_LoadTilemap:

View File

@ -339,7 +339,7 @@ EvolutionAnimation:
ld a, [hl] ld a, [hl]
or b or b
ld [hli], a ; attributes ld [hli], a ; attributes
rept SPRITEOAMSTRUCT_LENGTH + -1 rept SPRITEOAMSTRUCT_LENGTH - 1
inc hl inc hl
endr endr
dec c dec c

View File

@ -356,7 +356,7 @@ AnimateTitleCrystal:
ld a, [hl] ld a, [hl]
add 2 add 2
ld [hli], a ; y ld [hli], a ; y
rept SPRITEOAMSTRUCT_LENGTH + -1 rept SPRITEOAMSTRUCT_LENGTH - 1
inc hl inc hl
endr endr
dec c dec c

View File

@ -1472,7 +1472,7 @@ BillsPC_UpdateSelectionCursor:
inc hl inc hl
ld [de], a ; y ld [de], a ; y
inc de inc de
rept SPRITEOAMSTRUCT_LENGTH + -1 rept SPRITEOAMSTRUCT_LENGTH - 1
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de
@ -1520,7 +1520,7 @@ BillsPC_UpdateInsertCursor:
inc hl inc hl
ld [de], a ; y ld [de], a ; y
inc de inc de
rept SPRITEOAMSTRUCT_LENGTH + -1 rept SPRITEOAMSTRUCT_LENGTH - 1
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a
inc de inc de

View File

@ -117,7 +117,7 @@ GeneratePartyMonStats:
and a and a
jr nz, .randomlygeneratemoves jr nz, .randomlygeneratemoves
ld de, wEnemyMonMoves ld de, wEnemyMonMoves
rept NUM_MOVES + -1 rept NUM_MOVES - 1
ld a, [de] ld a, [de]
inc de inc de
ld [hli], a ld [hli], a
@ -128,7 +128,7 @@ endr
.randomlygeneratemoves .randomlygeneratemoves
xor a xor a
rept NUM_MOVES + -1 rept NUM_MOVES - 1
ld [hli], a ld [hli], a
endr endr
ld [hl], a ld [hl], a

View File

@ -216,7 +216,7 @@ CheckOwnMon:
ld hl, wPlayerName ld hl, wPlayerName
rept NAME_LENGTH_JAPANESE + -2 ; should be PLAYER_NAME_LENGTH + -2 rept NAME_LENGTH_JAPANESE - 2 ; should be PLAYER_NAME_LENGTH - 2
ld a, [de] ld a, [de]
cp [hl] cp [hl]
jr nz, .notfound jr nz, .notfound

View File

@ -2,7 +2,7 @@
const PINK_PAGE ; 1 const PINK_PAGE ; 1
const GREEN_PAGE ; 2 const GREEN_PAGE ; 2
const BLUE_PAGE ; 3 const BLUE_PAGE ; 3
NUM_STAT_PAGES EQU const_value + -1 NUM_STAT_PAGES EQU const_value - 1
STAT_PAGE_MASK EQU %00000011 STAT_PAGE_MASK EQU %00000011

View File

@ -2,7 +2,7 @@ tilepal: MACRO
; used in gfx/tilesets/*_palette_map.asm ; used in gfx/tilesets/*_palette_map.asm
; vram bank, pals ; vram bank, pals
x = \1 << OAM_TILE_BANK x = \1 << OAM_TILE_BANK
rept (_NARG + -1) / 2 rept (_NARG - 1) / 2
dn (x | PAL_BG_\3), (x | PAL_BG_\2) dn (x | PAL_BG_\3), (x | PAL_BG_\2)
shift shift
shift shift

View File

@ -163,7 +163,7 @@ LoadMetatiles::
ld h, a ld h, a
; copy the 4x4 metatile ; copy the 4x4 metatile
rept METATILE_WIDTH + -1 rept METATILE_WIDTH - 1
rept METATILE_WIDTH rept METATILE_WIDTH
ld a, [hli] ld a, [hli]
ld [de], a ld [de], a

View File

@ -51,7 +51,7 @@ dx: MACRO
x = 8 * ((\1) - 1) x = 8 * ((\1) - 1)
rept \1 rept \1
db ((\2) >> x) & $ff db ((\2) >> x) & $ff
x = x + -8 x = x - 8
endr endr
ENDM ENDM

View File

@ -4,7 +4,7 @@ frame: MACRO
db \1 db \1
x = \2 x = \2
if _NARG > 2 if _NARG > 2
rept _NARG + -2 rept _NARG - 2
x = x | (1 << (\3 + 1)) x = x | (1 << (\3 + 1))
shift shift
endr endr

View File

@ -106,7 +106,7 @@ box: MACRO
\1Species:: ds MONS_PER_BOX + 1 \1Species:: ds MONS_PER_BOX + 1
\1Mons:: \1Mons::
\1Mon1:: box_struct \1Mon1 \1Mon1:: box_struct \1Mon1
\1Mon2:: ds BOXMON_STRUCT_LENGTH * (MONS_PER_BOX + -1) \1Mon2:: ds BOXMON_STRUCT_LENGTH * (MONS_PER_BOX - 1)
\1MonOT:: ds NAME_LENGTH * MONS_PER_BOX \1MonOT:: ds NAME_LENGTH * MONS_PER_BOX
\1MonNicknames:: ds MON_NAME_LENGTH * MONS_PER_BOX \1MonNicknames:: ds MON_NAME_LENGTH * MONS_PER_BOX
\1MonNicknamesEnd:: \1MonNicknamesEnd::
@ -171,7 +171,7 @@ channel_struct: MACRO
ENDM ENDM
battle_tower_struct: MACRO battle_tower_struct: MACRO
\1Name:: ds NAME_LENGTH + -1 \1Name:: ds NAME_LENGTH - 1
\1TrainerClass:: ds 1 \1TrainerClass:: ds 1
\1Mon1:: party_struct \1Mon1 \1Mon1:: party_struct \1Mon1
\1Mon1Name:: ds MON_NAME_LENGTH \1Mon1Name:: ds MON_NAME_LENGTH
@ -217,7 +217,7 @@ hof_mon: MACRO
\1ID:: dw \1ID:: dw
\1DVs:: dw \1DVs:: dw
\1Level:: db \1Level:: db
\1Nickname:: ds MON_NAME_LENGTH + -1 \1Nickname:: ds MON_NAME_LENGTH - 1
\1End:: \1End::
ENDM ENDM
@ -233,7 +233,7 @@ hall_of_fame: MACRO
ENDM ENDM
link_battle_record: MACRO link_battle_record: MACRO
\1Name:: ds NAME_LENGTH + -1 \1Name:: ds NAME_LENGTH - 1
\1ID:: dw \1ID:: dw
\1Wins:: dw \1Wins:: dw
\1Losses:: dw \1Losses:: dw

View File

@ -4059,7 +4059,7 @@ macro_11f220: MACRO
; 12 words per page (0-based indexing) ; 12 words per page (0-based indexing)
x = \1 / 12 x = \1 / 12
if \1 % 12 == 0 if \1 % 12 == 0
x = x + -1 x = x - 1
endc endc
db x db x
ENDM ENDM