From ab0f9c287a45d1986985545d7ec6a2cd862e26fc Mon Sep 17 00:00:00 2001 From: Rangi Date: Tue, 23 Nov 2021 20:18:08 -0500 Subject: [PATCH] Use compound assignment operators --- constants/deco_constants.asm | 2 +- constants/item_constants.asm | 2 +- constants/map_constants.asm | 2 +- constants/trainer_constants.asm | 2 +- data/events/odd_eggs.asm | 2 +- data/pokemon/base_stats.asm | 2 +- data/wild/roammon_maps.asm | 2 +- docs/design_flaws.md | 2 +- engine/movie/intro.asm | 6 +++--- macros/asserts.asm | 2 +- macros/code.asm | 2 +- macros/const.asm | 10 +++++----- macros/data.asm | 2 +- macros/scripts/gfx_anims.asm | 2 +- macros/scripts/maps.asm | 12 ++++++------ mobile/fixed_words.asm | 2 +- sram.asm | 2 +- 17 files changed, 28 insertions(+), 28 deletions(-) diff --git a/constants/deco_constants.asm b/constants/deco_constants.asm index 8ed1b2934..ce518e0ac 100644 --- a/constants/deco_constants.asm +++ b/constants/deco_constants.asm @@ -70,7 +70,7 @@ __deco_value__ = 0 deco: MACRO const DECO_\1 DECOFLAG_\1 EQU __deco_value__ -__deco_value__ = __deco_value__ + 1 +__deco_value__ += 1 ENDM ; decorations: diff --git a/constants/item_constants.asm b/constants/item_constants.asm index 5ebfc8119..f3c3ea784 100644 --- a/constants/item_constants.asm +++ b/constants/item_constants.asm @@ -202,7 +202,7 @@ __tmhm_value__ = 1 add_tmnum: MACRO \1_TMNUM EQU __tmhm_value__ -__tmhm_value__ = __tmhm_value__ + 1 +__tmhm_value__ += 1 ENDM add_tm: MACRO diff --git a/constants/map_constants.asm b/constants/map_constants.asm index cc4112b52..aacffb96f 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -12,7 +12,7 @@ map_const: MACRO ;\3: height: in blocks GROUP_\1 EQU const_value MAP_\1 EQU __map_value__ -__map_value__ = __map_value__ + 1 +__map_value__ += 1 \1_WIDTH EQU \2 \1_HEIGHT EQU \3 ENDM diff --git a/constants/trainer_constants.asm b/constants/trainer_constants.asm index 4630c1ea8..9d080a29f 100644 --- a/constants/trainer_constants.asm +++ b/constants/trainer_constants.asm @@ -2,7 +2,7 @@ __trainer_class__ = 0 trainerclass: MACRO \1 EQU __trainer_class__ -__trainer_class__ = __trainer_class__ + 1 +__trainer_class__ += 1 const_def 1 ENDM diff --git a/data/events/odd_eggs.asm b/data/events/odd_eggs.asm index 00eaf0664..60e962e41 100644 --- a/data/events/odd_eggs.asm +++ b/data/events/odd_eggs.asm @@ -1,7 +1,7 @@ NUM_ODD_EGGS EQU 14 prob: MACRO -prob_total = prob_total + (\1) +prob_total += \1 dw prob_total * $ffff / 100 ENDM diff --git a/data/pokemon/base_stats.asm b/data/pokemon/base_stats.asm index 71b8ca95d..fdae2c020 100644 --- a/data/pokemon/base_stats.asm +++ b/data/pokemon/base_stats.asm @@ -9,7 +9,7 @@ rept _NARG if DEF(\1_TMNUM) n = (\1_TMNUM - 1) / 8 i = (\1_TMNUM - 1) % 8 -_tm{d:n} = _tm{d:n} | (1 << i) +_tm{d:n} |= 1 << i else fail "\1 is not a TM, HM, or tutor move" endc diff --git a/data/wild/roammon_maps.asm b/data/wild/roammon_maps.asm index de5b60c74..6552e041f 100644 --- a/data/wild/roammon_maps.asm +++ b/data/wild/roammon_maps.asm @@ -9,7 +9,7 @@ rept _NARG - 1 shift endr db 0 -list_index = list_index + 1 +list_index += 1 ENDM RoamMaps: diff --git a/docs/design_flaws.md b/docs/design_flaws.md index c6236338f..70f441ff2 100644 --- a/docs/design_flaws.md +++ b/docs/design_flaws.md @@ -727,7 +727,7 @@ sine_table: MACRO x = 0 rept \1 dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up -x = x + DIV(32768, \1) ; a circle has 65536 "degrees" +x += DIV(32768, \1) ; a circle has 65536 "degrees" endr ENDM ``` diff --git a/engine/movie/intro.asm b/engine/movie/intro.asm index 31ab4747a..79a715fc0 100644 --- a/engine/movie/intro.asm +++ b/engine/movie/intro.asm @@ -1441,16 +1441,16 @@ endr hue = 31 rept 8 RGB hue, hue, hue -hue = hue - 1 +hue -= 1 RGB hue, hue, hue -hue = hue - 2 +hue -= 2 endr .SlowFadePalettes: hue = 31 rept 16 RGB hue, hue, hue -hue = hue - 1 +hue -= 1 endr Intro_LoadTilemap: diff --git a/macros/asserts.asm b/macros/asserts.asm index f1c5cfdc1..e04ed0dc6 100644 --- a/macros/asserts.asm +++ b/macros/asserts.asm @@ -29,7 +29,7 @@ ENDM li: MACRO assert !STRIN(\1, "@"), STRCAT("String terminator \"@\" in list entry: ", \1) db \1, "@" -list_index = list_index + 1 +list_index += 1 ENDM assert_list_length: MACRO diff --git a/macros/code.asm b/macros/code.asm index 89e7c6e90..6e76febb8 100644 --- a/macros/code.asm +++ b/macros/code.asm @@ -38,7 +38,7 @@ maskbits: MACRO x = 1 rept 8 if x + 1 < (\1) -x = x << 1 | 1 +x = (x << 1) | 1 endc endr if _NARG == 2 diff --git a/macros/const.asm b/macros/const.asm index 11d96d179..aed8bde4a 100644 --- a/macros/const.asm +++ b/macros/const.asm @@ -15,19 +15,19 @@ ENDM const: MACRO \1 EQU const_value -const_value = const_value + const_inc +const_value += const_inc ENDM shift_const: MACRO -\1 EQU (1 << const_value) -const_value = const_value + const_inc +\1 EQU 1 << const_value +const_value += const_inc ENDM const_skip: MACRO if _NARG >= 1 -const_value = const_value + const_inc * (\1) +const_value += const_inc * (\1) else -const_value = const_value + const_inc +const_value += const_inc endc ENDM diff --git a/macros/data.asm b/macros/data.asm index d57bfdd8f..e5ebf1e64 100644 --- a/macros/data.asm +++ b/macros/data.asm @@ -98,6 +98,6 @@ sine_table: MACRO x = 0 rept \1 dw (sin(x) + (sin(x) & $ff)) >> 8 ; round up -x = x + DIV(32768, \1) ; a circle has 65536 "degrees" +x += DIV(32768, \1) ; a circle has 65536 "degrees" endr ENDM diff --git a/macros/scripts/gfx_anims.asm b/macros/scripts/gfx_anims.asm index 61c18fa8b..2c4c267b3 100644 --- a/macros/scripts/gfx_anims.asm +++ b/macros/scripts/gfx_anims.asm @@ -5,7 +5,7 @@ frame: MACRO x = \2 if _NARG > 2 rept _NARG - 2 -x = x | (1 << (\3 + 1)) +x |= 1 << (\3 + 1) shift endr endc diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index a394405d4..0621277ba 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -17,7 +17,7 @@ scene_script: MACRO ;\1: script pointer dw \1 dw 0 ; filler -{_NUM_SCENE_SCRIPTS} = {_NUM_SCENE_SCRIPTS} + 1 +{_NUM_SCENE_SCRIPTS} += 1 ENDM def_callbacks: MACRO @@ -30,7 +30,7 @@ callback: MACRO ;\1: type: a MAPCALLBACK_* constant ;\2: script pointer dbw \1, \2 -{_NUM_CALLBACKS} = {_NUM_CALLBACKS} + 1 +{_NUM_CALLBACKS} += 1 ENDM def_warp_events: MACRO @@ -46,7 +46,7 @@ warp_event: MACRO ;\4: warp destination: starts at 1 db \2, \1, \4 map_id \3 -{_NUM_WARP_EVENTS} = {_NUM_WARP_EVENTS} + 1 +{_NUM_WARP_EVENTS} += 1 ENDM def_coord_events: MACRO @@ -64,7 +64,7 @@ coord_event: MACRO db 0 ; filler dw \4 dw 0 ; filler -{_NUM_COORD_EVENTS} = {_NUM_COORD_EVENTS} + 1 +{_NUM_COORD_EVENTS} += 1 ENDM def_bg_events: MACRO @@ -80,7 +80,7 @@ bg_event: MACRO ;\4: script pointer db \2, \1, \3 dw \4 -{_NUM_BG_EVENTS} = {_NUM_BG_EVENTS} + 1 +{_NUM_BG_EVENTS} += 1 ENDM def_object_events: MACRO @@ -114,7 +114,7 @@ object_event: MACRO dw \<12>, \<13> ; the dummy PlayerObjectTemplate object_event has no def_object_events if DEF(_NUM_OBJECT_EVENTS) -{_NUM_OBJECT_EVENTS} = {_NUM_OBJECT_EVENTS} + 1 +{_NUM_OBJECT_EVENTS} += 1 endc ENDM diff --git a/mobile/fixed_words.asm b/mobile/fixed_words.asm index c2cc99ea3..0a8bfad27 100644 --- a/mobile/fixed_words.asm +++ b/mobile/fixed_words.asm @@ -4073,7 +4073,7 @@ EZChat_SortedWords: ; any Pokemon you've seen that starts with each kana. macro_11f23c: MACRO dw w3_d012 - w3_d000 + x, \1 -x = x + 2 * \1 +x += 2 * \1 ENDM x = 0 macro_11f23c $2f ; a diff --git a/sram.asm b/sram.asm index 7e2866a1a..420d34743 100644 --- a/sram.asm +++ b/sram.asm @@ -177,7 +177,7 @@ endr box_n = 0 boxes: MACRO rept \1 -box_n = box_n + 1 +box_n += 1 sBox{d:box_n}:: box sBox{d:box_n} endr ENDM