diff --git a/audio/engine.asm b/audio/engine.asm index 50ce3104d..645c121a8 100644 --- a/audio/engine.asm +++ b/audio/engine.asm @@ -1294,7 +1294,7 @@ GetNoiseSample: ; load ptr to sample header in wNoiseSampleAddress ; are we on the last channel? ld a, [wCurChannel] - and NUM_MUSIC_CHANS + -1 + and NUM_MUSIC_CHANS - 1 cp CHAN4 ; ret if not ret nz diff --git a/constants/battle_constants.asm b/constants/battle_constants.asm index a8a249a5b..7e444059d 100644 --- a/constants/battle_constants.asm +++ b/constants/battle_constants.asm @@ -61,10 +61,10 @@ MOVE_LENGTH EQU const_value const STAT_DEF const STAT_SPD const STAT_SATK -NUM_EXP_STATS EQU const_value + -1 +NUM_EXP_STATS EQU const_value - 1 const STAT_SDEF -NUM_STATS EQU const_value + -1 -NUM_BATTLE_STATS EQU NUM_STATS + -1 ; don't count HP +NUM_STATS EQU const_value - 1 +NUM_BATTLE_STATS EQU NUM_STATS - 1 ; don't count HP ; stat formula constants STAT_MIN_NORMAL EQU 5 diff --git a/constants/item_constants.asm b/constants/item_constants.asm index 4f7888c4b..32dcab831 100644 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -287,7 +287,7 @@ ENDM add_mt FLAMETHROWER add_mt THUNDERBOLT add_mt ICE_BEAM -NUM_TM_HM_TUTOR EQU __enum__ + -1 +NUM_TM_HM_TUTOR EQU __enum__ - 1 const ITEM_FA ; fa diff --git a/constants/move_constants.asm b/constants/move_constants.asm index 472ff2d0b..b26f86d03 100644 --- a/constants/move_constants.asm +++ b/constants/move_constants.asm @@ -257,7 +257,7 @@ const ROCK_SMASH ; f9 const WHIRLPOOL ; fa 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_FD ; fd diff --git a/constants/pokemon_constants.asm b/constants/pokemon_constants.asm index 939ac72f2..c28657b83 100644 --- a/constants/pokemon_constants.asm +++ b/constants/pokemon_constants.asm @@ -271,7 +271,7 @@ JOHTO_POKEMON EQU const_value const LUGIA ; f9 const HO_OH ; fa const CELEBI ; fb -NUM_POKEMON EQU const_value + -1 +NUM_POKEMON EQU const_value - 1 const MON_FC ; fc const EGG ; fd const MON_FE ; fe @@ -311,4 +311,4 @@ NUM_POKEMON EQU const_value + -1 const UNOWN_X ; 24 const UNOWN_Y ; 25 const UNOWN_Z ; 26 -NUM_UNOWN EQU const_value + -1 ; 26 +NUM_UNOWN EQU const_value - 1 ; 26 diff --git a/constants/pokemon_data_constants.asm b/constants/pokemon_data_constants.asm index cbdbbd17b..c789f40fb 100644 --- a/constants/pokemon_data_constants.asm +++ b/constants/pokemon_data_constants.asm @@ -124,7 +124,7 @@ MONS_PER_BOX EQU 20 NUM_BOXES EQU 14 ; 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 NUM_HOF_TEAMS EQU 30 diff --git a/constants/script_constants.asm b/constants/script_constants.asm index 30935e632..8d5cc46f7 100644 --- a/constants/script_constants.asm +++ b/constants/script_constants.asm @@ -224,7 +224,7 @@ EMOTE_FROM_MEM EQU -1 const FRUITTREE_PEWTER_CITY_1 ; 1c const FRUITTREE_PEWTER_CITY_2 ; 1d const FRUITTREE_FUCHSIA_CITY ; 1e -NUM_FRUIT_TREES EQU const_value + -1 +NUM_FRUIT_TREES EQU const_value - 1 ; describedecoration arguments ; DescribeDecoration.JumpTable indexes (see engine/overworld/decorations.asm) diff --git a/data/maps/attributes.asm b/data/maps/attributes.asm index 0b49a351a..d149f59ce 100644 --- a/data/maps/attributes.asm +++ b/data/maps/attributes.asm @@ -38,7 +38,7 @@ _tgt = 0 endc if "\1" == "north" -_blk = \3_WIDTH * (\3_HEIGHT + -3) + _src +_blk = \3_WIDTH * (\3_HEIGHT - 3) + _src _map = _tgt _win = (\3_WIDTH + 6) * \3_HEIGHT + 1 _y = \3_HEIGHT * 2 - 1 @@ -60,9 +60,9 @@ _len = \3_WIDTH endc elif "\1" == "west" -_blk = (\3_WIDTH * _src) + \3_WIDTH + -3 +_blk = (\3_WIDTH * _src) + \3_WIDTH - 3 _map = (CURRENT_MAP_WIDTH + 6) * _tgt -_win = (\3_WIDTH + 6) * 2 + -6 +_win = (\3_WIDTH + 6) * 2 - 6 _y = (\4) * -2 _x = \3_WIDTH * 2 - 1 _len = CURRENT_MAP_HEIGHT + 3 - (\4) diff --git a/data/wild/roammon_maps.asm b/data/wild/roammon_maps.asm index 747dffae1..628a26795 100644 --- a/data/wild/roammon_maps.asm +++ b/data/wild/roammon_maps.asm @@ -4,7 +4,7 @@ roam_map: MACRO map_id \1 db _NARG - 1 -rept _NARG + -1 +rept _NARG - 1 map_id \2 shift endr diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index abb1e524f..faeaa471f 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -1840,8 +1840,8 @@ This bug can allow you to talk to Eusine in Celadon City and encounter Ho-Oh wit ld hl, wPlayerName --rept NAME_LENGTH_JAPANESE + -2 ; should be PLAYER_NAME_LENGTH + -2 -+rept PLAYER_NAME_LENGTH + -2 +-rept NAME_LENGTH_JAPANESE - 2 ; should be PLAYER_NAME_LENGTH - 2 ++rept PLAYER_NAME_LENGTH - 2 ld a, [de] cp [hl] jr nz, .notfound diff --git a/engine/battle_anims/anim_commands.asm b/engine/battle_anims/anim_commands.asm index c0424088e..bbfc1240e 100644 --- a/engine/battle_anims/anim_commands.asm +++ b/engine/battle_anims/anim_commands.asm @@ -244,7 +244,7 @@ BattleAnim_ClearOAM: ld a, [hl] and $ff ^ (PALETTE_MASK | VRAM_BANK_1) ; PAL_BATTLE_OB_ENEMY (0) ld [hli], a -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl endr dec c diff --git a/engine/events/battle_tower/battle_tower.asm b/engine/events/battle_tower/battle_tower.asm index 3e3bbb57f..9d10d7289 100644 --- a/engine/events/battle_tower/battle_tower.asm +++ b/engine/events/battle_tower/battle_tower.asm @@ -395,10 +395,10 @@ ValidateBTParty: ld a, [hl] and a x = $ff -rept ($ff + -NUM_POKEMON) +rept ($ff - NUM_POKEMON) jr z, .invalid cp x -x = x + -1 +x = x - 1 endr jr nz, .valid diff --git a/engine/events/bug_contest/judging.asm b/engine/events/bug_contest/judging.asm index 9f8c0c5c2..9945f2031 100644 --- a/engine/events/bug_contest/judging.asm +++ b/engine/events/bug_contest/judging.asm @@ -211,7 +211,7 @@ DetermineContestWinners: CopyTempContestant: ; Could've just called CopyBytes. ld de, wBugContestTempWinnerID -rept BUG_CONTESTANT_SIZE + -1 +rept BUG_CONTESTANT_SIZE - 1 ld a, [de] inc de ld [hli], a diff --git a/engine/events/celebi.asm b/engine/events/celebi.asm index 2e497c86e..d53fa8589 100644 --- a/engine/events/celebi.asm +++ b/engine/events/celebi.asm @@ -57,7 +57,7 @@ CelebiShrineEvent: ld c, 4 .OAMloop: ld [hli], a ; tile id -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl endr inc a diff --git a/engine/events/field_moves.asm b/engine/events/field_moves.asm index c898c6690..6413840cc 100644 --- a/engine/events/field_moves.asm +++ b/engine/events/field_moves.asm @@ -383,7 +383,7 @@ FlyToAnim: ld c, 4 .OAMloop ld [hli], a ; tile id -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl endr inc a diff --git a/engine/events/print_unown_2.asm b/engine/events/print_unown_2.asm index 77eb050a1..5dc7b1b94 100644 --- a/engine/events/print_unown_2.asm +++ b/engine/events/print_unown_2.asm @@ -98,10 +98,10 @@ RotateUnownFrontpic: gbprinterrect: MACRO y = 0 rept \1 -x = \1 * (\2 + -1) + y +x = \1 * (\2 - 1) + y rept \2 dw wGameboyPrinterRAM tile x -x = x + -\2 +x = x - \2 endr y = y + 1 endr diff --git a/engine/games/slot_machine.asm b/engine/games/slot_machine.asm index 2765dd870..eaf7999bd 100644 --- a/engine/games/slot_machine.asm +++ b/engine/games/slot_machine.asm @@ -261,7 +261,7 @@ Unreferenced_Function9282c: ld a, [hl] xor %00100000 ld [hli], a ; tile id -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl endr dec c diff --git a/engine/gfx/pic_animation.asm b/engine/gfx/pic_animation.asm index 8eff13ad1..fda39e5c6 100644 --- a/engine/gfx/pic_animation.asm +++ b/engine/gfx/pic_animation.asm @@ -538,7 +538,7 @@ PokeAnim_CopyBitmaskToBuffer: poke_anim_box: MACRO y = 7 rept \1 -x = 7 + -\1 +x = 7 - \1 rept \1 db x + y x = x + 1 diff --git a/engine/menus/options_menu.asm b/engine/menus/options_menu.asm index d1aa563f6..9a6b0fdc7 100644 --- a/engine/menus/options_menu.asm +++ b/engine/menus/options_menu.asm @@ -114,7 +114,7 @@ Options_TextSpeed: ld a, c ; right pressed cp OPT_TEXT_SPEED_SLOW jr c, .Increase - ld c, OPT_TEXT_SPEED_FAST + -1 + ld c, OPT_TEXT_SPEED_FAST - 1 .Increase: inc c diff --git a/engine/movie/crystal_intro.asm b/engine/movie/crystal_intro.asm index eeab51062..9fbd67078 100644 --- a/engine/movie/crystal_intro.asm +++ b/engine/movie/crystal_intro.asm @@ -1796,16 +1796,16 @@ endr hue = 31 rept 8 RGB hue, hue, hue -hue = hue + -1 +hue = hue - 1 RGB hue, hue, hue -hue = hue + -2 +hue = hue - 2 endr .SlowFadePalettes: hue = 31 rept 16 RGB hue, hue, hue -hue = hue + -1 +hue = hue - 1 endr Intro_LoadTilemap: diff --git a/engine/movie/evolution_animation.asm b/engine/movie/evolution_animation.asm index ed500d1f8..0960fb3e7 100644 --- a/engine/movie/evolution_animation.asm +++ b/engine/movie/evolution_animation.asm @@ -339,7 +339,7 @@ EvolutionAnimation: ld a, [hl] or b ld [hli], a ; attributes -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl endr dec c diff --git a/engine/movie/title.asm b/engine/movie/title.asm index 50c8721d0..dce02804f 100644 --- a/engine/movie/title.asm +++ b/engine/movie/title.asm @@ -356,7 +356,7 @@ AnimateTitleCrystal: ld a, [hl] add 2 ld [hli], a ; y -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 inc hl endr dec c diff --git a/engine/pokemon/bills_pc.asm b/engine/pokemon/bills_pc.asm index dd4977f1b..d3d7c9922 100644 --- a/engine/pokemon/bills_pc.asm +++ b/engine/pokemon/bills_pc.asm @@ -1472,7 +1472,7 @@ BillsPC_UpdateSelectionCursor: inc hl ld [de], a ; y inc de -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 ld a, [hli] ld [de], a inc de @@ -1520,7 +1520,7 @@ BillsPC_UpdateInsertCursor: inc hl ld [de], a ; y inc de -rept SPRITEOAMSTRUCT_LENGTH + -1 +rept SPRITEOAMSTRUCT_LENGTH - 1 ld a, [hli] ld [de], a inc de diff --git a/engine/pokemon/move_mon.asm b/engine/pokemon/move_mon.asm index 8133e2671..bfd2f91f2 100644 --- a/engine/pokemon/move_mon.asm +++ b/engine/pokemon/move_mon.asm @@ -117,7 +117,7 @@ GeneratePartyMonStats: and a jr nz, .randomlygeneratemoves ld de, wEnemyMonMoves -rept NUM_MOVES + -1 +rept NUM_MOVES - 1 ld a, [de] inc de ld [hli], a @@ -128,7 +128,7 @@ endr .randomlygeneratemoves xor a -rept NUM_MOVES + -1 +rept NUM_MOVES - 1 ld [hli], a endr ld [hl], a diff --git a/engine/pokemon/search.asm b/engine/pokemon/search.asm index 2ea1beacf..bc3e6ae3b 100644 --- a/engine/pokemon/search.asm +++ b/engine/pokemon/search.asm @@ -216,7 +216,7 @@ CheckOwnMon: 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] cp [hl] jr nz, .notfound diff --git a/engine/pokemon/stats_screen.asm b/engine/pokemon/stats_screen.asm index ae7e71cf2..62db2e851 100644 --- a/engine/pokemon/stats_screen.asm +++ b/engine/pokemon/stats_screen.asm @@ -2,7 +2,7 @@ const PINK_PAGE ; 1 const GREEN_PAGE ; 2 const BLUE_PAGE ; 3 -NUM_STAT_PAGES EQU const_value + -1 +NUM_STAT_PAGES EQU const_value - 1 STAT_PAGE_MASK EQU %00000011 diff --git a/gfx/tileset_palette_maps.asm b/gfx/tileset_palette_maps.asm index 110e48941..df751c311 100644 --- a/gfx/tileset_palette_maps.asm +++ b/gfx/tileset_palette_maps.asm @@ -2,7 +2,7 @@ tilepal: MACRO ; used in gfx/tilesets/*_palette_map.asm ; vram bank, pals x = \1 << OAM_TILE_BANK -rept (_NARG + -1) / 2 +rept (_NARG - 1) / 2 dn (x | PAL_BG_\3), (x | PAL_BG_\2) shift shift diff --git a/home/map.asm b/home/map.asm index a2268d51a..ebcf7f879 100644 --- a/home/map.asm +++ b/home/map.asm @@ -163,7 +163,7 @@ LoadMetatiles:: ld h, a ; copy the 4x4 metatile -rept METATILE_WIDTH + -1 +rept METATILE_WIDTH - 1 rept METATILE_WIDTH ld a, [hli] ld [de], a diff --git a/macros/data.asm b/macros/data.asm index 59f518b8d..76a5d31de 100644 --- a/macros/data.asm +++ b/macros/data.asm @@ -51,7 +51,7 @@ dx: MACRO x = 8 * ((\1) - 1) rept \1 db ((\2) >> x) & $ff -x = x + -8 +x = x - 8 endr ENDM diff --git a/macros/scripts/gfx_anims.asm b/macros/scripts/gfx_anims.asm index 3756481dd..a6241a0d8 100644 --- a/macros/scripts/gfx_anims.asm +++ b/macros/scripts/gfx_anims.asm @@ -4,7 +4,7 @@ frame: MACRO db \1 x = \2 if _NARG > 2 -rept _NARG + -2 +rept _NARG - 2 x = x | (1 << (\3 + 1)) shift endr diff --git a/macros/wram.asm b/macros/wram.asm index af306d1f8..abc7df48e 100644 --- a/macros/wram.asm +++ b/macros/wram.asm @@ -106,7 +106,7 @@ box: MACRO \1Species:: ds MONS_PER_BOX + 1 \1Mons:: \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 \1MonNicknames:: ds MON_NAME_LENGTH * MONS_PER_BOX \1MonNicknamesEnd:: @@ -171,7 +171,7 @@ channel_struct: MACRO ENDM battle_tower_struct: MACRO -\1Name:: ds NAME_LENGTH + -1 +\1Name:: ds NAME_LENGTH - 1 \1TrainerClass:: ds 1 \1Mon1:: party_struct \1Mon1 \1Mon1Name:: ds MON_NAME_LENGTH @@ -217,7 +217,7 @@ hof_mon: MACRO \1ID:: dw \1DVs:: dw \1Level:: db -\1Nickname:: ds MON_NAME_LENGTH + -1 +\1Nickname:: ds MON_NAME_LENGTH - 1 \1End:: ENDM @@ -233,7 +233,7 @@ hall_of_fame: MACRO ENDM link_battle_record: MACRO -\1Name:: ds NAME_LENGTH + -1 +\1Name:: ds NAME_LENGTH - 1 \1ID:: dw \1Wins:: dw \1Losses:: dw diff --git a/mobile/fixed_words.asm b/mobile/fixed_words.asm index acbd318e8..3567e6b54 100644 --- a/mobile/fixed_words.asm +++ b/mobile/fixed_words.asm @@ -4059,7 +4059,7 @@ macro_11f220: MACRO ; 12 words per page (0-based indexing) x = \1 / 12 if \1 % 12 == 0 -x = x + -1 +x = x - 1 endc db x ENDM