ref: 865d37e02ad6af386e7f596659ebec12266be3ce
parent: 64e2b66a610d330bfdad108a603027be9652a7e7
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Tue Nov 23 15:56:57 EST 2021
Use compound assignment operators
--- a/constants/item_constants.asm
+++ b/constants/item_constants.asm
@@ -122,7 +122,7 @@
add_tmnum: MACRO
\1_TMNUM EQU __tmhm_value__
-__tmhm_value__ = __tmhm_value__ + 1
+__tmhm_value__ += 1
ENDM
add_hm: MACRO
--- a/data/trainers/move_choices.asm
+++ b/data/trainers/move_choices.asm
@@ -3,7 +3,7 @@
db \# ; all args
ENDC
db 0 ; end
-list_index = list_index + 1
+list_index += 1
ENDM
; move choice modification methods that are applied for each trainer class
--- a/macros/asserts.asm
+++ b/macros/asserts.asm
@@ -29,7 +29,7 @@
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
@@ -52,7 +52,7 @@
nybble: MACRO
ASSERT 0 <= (\1) && (\1) < $10, "nybbles must be 0-15"
CURRENT_NYBBLE_ARRAY_VALUE = (\1) | (CURRENT_NYBBLE_ARRAY_VALUE << 4)
-CURRENT_NYBBLE_ARRAY_LENGTH = CURRENT_NYBBLE_ARRAY_LENGTH + 1
+CURRENT_NYBBLE_ARRAY_LENGTH += 1
IF CURRENT_NYBBLE_ARRAY_LENGTH % 2 == 0
db CURRENT_NYBBLE_ARRAY_VALUE
CURRENT_NYBBLE_ARRAY_VALUE = 0
@@ -86,8 +86,8 @@
dbit: MACRO
ASSERT (\1) == 0 || (\1) == 1, "bits must be 0 or 1"
-CURRENT_BIT_ARRAY_VALUE = CURRENT_BIT_ARRAY_VALUE | ((\1) << (CURRENT_BIT_ARRAY_LENGTH % 8))
-CURRENT_BIT_ARRAY_LENGTH = CURRENT_BIT_ARRAY_LENGTH + 1
+CURRENT_BIT_ARRAY_VALUE |= (\1) << (CURRENT_BIT_ARRAY_LENGTH % 8)
+CURRENT_BIT_ARRAY_LENGTH += 1
IF CURRENT_BIT_ARRAY_LENGTH % 8 == 0
db CURRENT_BIT_ARRAY_VALUE
CURRENT_BIT_ARRAY_VALUE = 0
--- a/macros/const.asm
+++ b/macros/const.asm
@@ -15,19 +15,19 @@
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
--- a/macros/data.asm
+++ b/macros/data.asm
@@ -24,7 +24,7 @@
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 or HM move"
ENDC
--- a/macros/scripts/events.asm
+++ b/macros/scripts/events.asm
@@ -261,8 +261,8 @@
event_fill_count = event_end_byte - event_start_byte - 1
IF ((\1) % 8) == 0
-event_fill_start = event_fill_start - 1
-event_fill_count = event_fill_count + 1
+event_fill_start -= 1
+event_fill_count += 1
ELSE
ld a, [wEventFlags + event_start_byte]
or $ff - ((1 << ((\1) % 8)) - 1)
@@ -270,7 +270,7 @@
ENDC
IF ((\2) % 8) == 7
-event_fill_count = event_fill_count + 1
+event_fill_count += 1
ENDC
IF event_fill_count == 1
@@ -323,8 +323,8 @@
event_fill_count = event_end_byte - event_start_byte - 1
IF ((\1) % 8) == 0
-event_fill_start = event_fill_start - 1
-event_fill_count = event_fill_count + 1
+event_fill_start -= 1
+event_fill_count += 1
ELSE
ld a, [wEventFlags + event_start_byte]
and ~($ff - ((1 << ((\1) % 8)) - 1)) & $ff
@@ -332,7 +332,7 @@
ENDC
IF ((\2) % 8) == 7
-event_fill_count = event_fill_count + 1
+event_fill_count += 1
ENDC
IF event_fill_count == 1
--- a/macros/scripts/maps.asm
+++ b/macros/scripts/maps.asm
@@ -29,7 +29,7 @@
ELSE
db \6
ENDC
-{_NUM_OBJECT_EVENTS} = {_NUM_OBJECT_EVENTS} + 1
+{_NUM_OBJECT_EVENTS} += 1
ENDM
def_warp_events: MACRO
@@ -46,7 +46,7 @@
db \2, \1, \4 - 1, \3
_WARP_{d:{_NUM_WARP_EVENTS}}_X = \1
_WARP_{d:{_NUM_WARP_EVENTS}}_Y = \2
-{_NUM_WARP_EVENTS} = {_NUM_WARP_EVENTS} + 1
+{_NUM_WARP_EVENTS} += 1
ENDM
def_bg_events: MACRO
@@ -60,7 +60,7 @@
;\3 sign id
bg_event: MACRO
db \2, \1, \3
-{_NUM_BG_EVENTS} = {_NUM_BG_EVENTS} + 1
+{_NUM_BG_EVENTS} += 1
ENDM
;\1 source map
@@ -101,7 +101,7 @@
db \2 << 4
dw wEventFlags + (\1 - CURRENT_TRAINER_BIT) / 8
dw \3, \5, \4, \4
-CURRENT_TRAINER_BIT = CURRENT_TRAINER_BIT + 1
+CURRENT_TRAINER_BIT += 1
ENDM
;\1 x position
--- a/sram.asm
+++ b/sram.asm
@@ -27,7 +27,7 @@
box_n = 0
boxes: MACRO
REPT \1
-box_n = box_n + 1
+box_n += 1
sBox{d:box_n}:: ds wBoxDataEnd - wBoxDataStart
ENDR
ENDM