2018-06-24 07:09:41 -07:00
|
|
|
LoadObjectMasks:
|
2017-12-15 17:10:54 -08:00
|
|
|
ld hl, wObjectMasks
|
|
|
|
xor a
|
|
|
|
ld bc, NUM_OBJECTS
|
|
|
|
call ByteFill
|
|
|
|
nop
|
2018-01-23 14:39:09 -08:00
|
|
|
ld bc, wMapObjects
|
2017-12-15 17:10:54 -08:00
|
|
|
ld de, wObjectMasks
|
|
|
|
xor a
|
|
|
|
.loop
|
|
|
|
push af
|
|
|
|
push bc
|
|
|
|
push de
|
|
|
|
call GetObjectTimeMask
|
|
|
|
jr c, .next
|
|
|
|
call CheckObjectFlag
|
|
|
|
.next
|
|
|
|
pop de
|
|
|
|
ld [de], a
|
|
|
|
inc de
|
|
|
|
pop bc
|
2019-11-03 09:25:59 -08:00
|
|
|
ld hl, MAPOBJECT_LENGTH
|
2017-12-15 17:10:54 -08:00
|
|
|
add hl, bc
|
|
|
|
ld b, h
|
|
|
|
ld c, l
|
|
|
|
pop af
|
|
|
|
inc a
|
|
|
|
cp NUM_OBJECTS
|
|
|
|
jr nz, .loop
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
CheckObjectFlag:
|
2017-12-15 17:10:54 -08:00
|
|
|
ld hl, MAPOBJECT_SPRITE
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and a
|
|
|
|
jr z, .masked
|
|
|
|
ld hl, MAPOBJECT_EVENT_FLAG
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hli]
|
|
|
|
ld e, a
|
|
|
|
ld a, [hl]
|
|
|
|
ld d, a
|
2023-12-28 10:53:34 -08:00
|
|
|
cp HIGH(ALWAYS_SHOWN) ; HIGH(ALWAYS_HIDDEN)
|
2017-12-15 17:10:54 -08:00
|
|
|
jr nz, .check
|
|
|
|
ld a, e
|
2023-12-28 10:53:34 -08:00
|
|
|
cp LOW(ALWAYS_SHOWN)
|
2017-12-15 17:10:54 -08:00
|
|
|
jr z, .unmasked
|
|
|
|
jr .masked
|
|
|
|
.check
|
|
|
|
ld b, CHECK_FLAG
|
|
|
|
call EventFlagAction
|
|
|
|
ld a, c
|
|
|
|
and a
|
|
|
|
jr nz, .masked
|
|
|
|
.unmasked
|
|
|
|
xor a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.masked
|
|
|
|
ld a, -1
|
|
|
|
scf
|
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
GetObjectTimeMask:
|
2017-12-15 17:10:54 -08:00
|
|
|
call CheckObjectTime
|
|
|
|
ld a, -1
|
|
|
|
ret c
|
|
|
|
xor a
|
|
|
|
ret
|