pokecrystal-board/engine/overworld/map_objects_2.asm
mid-kid baa0dc5a96 Organize the engine/ directory
This is an informed attempt at reorganizing the engine/ directory by
creating categorized subdirectories, in order to make it easier to
navigate and find things.

The directories created are as follows:
* engine/game: Contains all "minigames", things like the unown puzzle
and slot machine.
* engine/gfx: Contains all handling of graphics. From loading palettes
to playing animations.
* engine/link: Contains all multiplayer functionality.
* engine/menu: Contains all generic/misc. menus and menu code.
Other, more specialized menus are in their own subdirectories (pokedex,
pokegear, party menu, etc).
* engine/overworld: Contains all handling of the overworld. From loading
and connecting maps to wild encounters and the scripting engine.
* engine/pokegear: In the same vein as engine/pokedex, except it could
use some more splitting up.
* engine/pokemon: Contains everything related to manipulating pokemon
data. From the pokemon storage system to evolution and mail.
* engine/printer: Contains everything related to printing things as well
as the printer communication.
* engine/title: Contains intro sequences, title screens and credits.
2018-03-13 13:21:40 +01:00

71 lines
852 B
NASM

LoadObjectMasks: ; 2454f
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, OBJECT_LENGTH
add hl, bc
ld b, h
ld c, l
pop af
inc a
cp NUM_OBJECTS
jr nz, .loop
ret
CheckObjectFlag: ; 2457d (9:457d)
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 -1
jr nz, .check
ld a, e
cp -1
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: ; 245a7 (9:45a7)
call CheckObjectTime
ld a, -1
ret c
xor a
ret