pokegold-spaceworld/engine/overworld/spawn_points.asm
DrippingYellow e384ea25ec
Some checks failed
CI / build (push) Has been cancelled
Finish labelling and split off bank03, bank09, and bank0b (#119)
* Fully labelled bank09.asm, started bank03.asm

* Finished labelling bank03.asm and bank0b.asm

* Tying up loose ends, splitting most of the completely labelled bank dumps

* Moved pokedex letter graphics out of charmap
2025-07-30 17:35:58 -04:00

75 lines
1.0 KiB
NASM
Executable File

INCLUDE "constants.asm"
SECTION "engine/overworld/spawn_points.asm", ROMX
GetFlyPointMapLocation:
ld a, [wFlyDestination]
ld l, a
ld h, $00
add hl, hl
add hl, hl
ld de, SpawnPoints
add hl, de
ld b, [hl] ; SpawnPoints + (wFlyDestination * 4)
inc hl
ld c, [hl]
call GetWorldMapLocation
ld e, a
ret
LoadSpawnPoint:
; loads the spawn point in wDefaultSpawnPoint
push hl
push de
ld a, [wDefaultSpawnPoint]
and a
jr z, .skip
dec a
ld l, a
ld h, 0
add hl, hl
add hl, hl
ld de, SpawnPoints
add hl, de
ld a, [hli]
ld [wMapGroup], a
ld a, [hli]
ld [wMapId], a
ld a, [hli]
ld [wXCoord], a
ld a, [hli]
ld [wYCoord], a
.skip
pop de
pop hl
ret
IsSpawnPoint:
; Checks if the map loaded in de is a spawn point.
; Returns carry if it's a spawn point.
ld hl, SpawnPoints
ld c, 1
.loop
ld a, [hl]
cp SPAWN_N_A
jr z, .fail
cp d
jr nz, .next
inc hl
ld a, [hld]
cp e
jr z, .succeed
.next
push bc
ld bc, SPAWN_POINT_SIZE
add hl, bc
pop bc
inc c
jr .loop
.fail
and a
ret
.succeed
scf
ret