mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-11-16 11:27:33 -08:00
71 lines
866 B
NASM
71 lines
866 B
NASM
LoadObjectMasks:
|
|
ld hl, wObjectMasks
|
|
xor a
|
|
ld bc, NUM_OBJECTS
|
|
call ByteFill
|
|
nop
|
|
ld bc, wMapObjects
|
|
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
|
|
ld hl, MAPOBJECT_LENGTH
|
|
add hl, bc
|
|
ld b, h
|
|
ld c, l
|
|
pop af
|
|
inc a
|
|
cp NUM_OBJECTS
|
|
jr nz, .loop
|
|
ret
|
|
|
|
CheckObjectFlag:
|
|
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
|
|
cp HIGH(ALWAYS_SHOWN) ; HIGH(ALWAYS_HIDDEN)
|
|
jr nz, .check
|
|
ld a, e
|
|
cp LOW(ALWAYS_SHOWN)
|
|
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
|
|
|
|
GetObjectTimeMask:
|
|
call CheckObjectTime
|
|
ld a, -1
|
|
ret c
|
|
xor a
|
|
ret
|