mirror of
https://github.com/thornAvery/kep-hack.git
synced 2026-02-06 15:45:24 +13:00
The 'def_trainers' macro checks that trainers' event flag bits are correct (#318)
This commit is contained in:
parent
2954013da1
commit
506a14084e
71 changed files with 274 additions and 149 deletions
|
|
@ -242,28 +242,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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue