summaryrefslogtreecommitdiff
path: root/macros/scripts
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2021-04-13 17:48:44 -0500
committerdannye <33dannye@gmail.com>2021-04-13 17:48:44 -0500
commit3af309e80584a0e2567586613f406883118d88e3 (patch)
tree9204f1351993e4679ad9ef91aa82ad1ebb4b8c4c /macros/scripts
parent3ce276892c1b97ae893d319125b13fed936d14f2 (diff)
parent506a14084e32d7532b8400a6457f46492bbc47ab (diff)
Merge branch 'master' of https://github.com/pret/pokered
Diffstat (limited to 'macros/scripts')
-rw-r--r--macros/scripts/events.asm22
-rw-r--r--macros/scripts/maps.asm27
2 files changed, 17 insertions, 32 deletions
diff --git a/macros/scripts/events.asm b/macros/scripts/events.asm
index afa9783d..83c938c0 100644
--- a/macros/scripts/events.asm
+++ b/macros/scripts/events.asm
@@ -273,28 +273,6 @@ ResetEvents: MACRO
ENDM
-;\1 = event index
-;\2 = number of bytes away from the base address (optional, for matching the ROM)
-dbEventFlagBit: MACRO
- IF _NARG > 1
- db ((\1) % 8) + ((\2) * 8)
- ELSE
- db ((\1) % 8)
- ENDC
-ENDM
-
-
-;\1 = event index
-;\2 = number of bytes away from the base address (optional, for matching the ROM)
-dwEventFlagAddress: MACRO
- IF _NARG > 1
- dw wEventFlags + ((\1) / 8) - (\2)
- ELSE
- dw wEventFlags + ((\1) / 8)
- ENDC
-ENDM
-
-
;\1 = start
;\2 = end
SetEventRange: MACRO
diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm
index a282acba..204098ad 100644
--- a/macros/scripts/maps.asm
+++ b/macros/scripts/maps.asm
@@ -92,23 +92,30 @@ warp_to: MACRO
ENDM
+;\1 first bit offset / first object id
+def_trainers: MACRO
+IF _NARG == 1
+CURRENT_TRAINER_BIT = \1
+ELSE
+CURRENT_TRAINER_BIT = 1
+ENDC
+ENDM
+
;\1 event flag
;\2 view range
;\3 TextBeforeBattle
;\4 TextAfterBattle
;\5 TextEndBattle
trainer: MACRO
- IF _NARG > 5
- dbEventFlagBit \1, \2
- db (\3 << 4)
- dwEventFlagAddress \1, \2
- SHIFT
- ELSE
- dbEventFlagBit \1
- db (\2 << 4)
- dwEventFlagAddress \1
- ENDC
+_ev_bit = \1 % 8
+_cur_bit = CURRENT_TRAINER_BIT % 8
+ ASSERT _ev_bit == _cur_bit, \
+ "Expected \1 to be bit {d:_cur_bit}, got {d:_ev_bit}"
+ db CURRENT_TRAINER_BIT
+ db \2 << 4
+ dw wEventFlags + (\1 - CURRENT_TRAINER_BIT) / 8
dw \3, \5, \4, \4
+CURRENT_TRAINER_BIT = CURRENT_TRAINER_BIT + 1
ENDM
;\1 x position