mirror of
https://github.com/pret/pokegold-spaceworld.git
synced 2026-04-07 09:55:48 -05:00
Addresses of sections will now be added to the linkerscript via `org`, and the section name will be the path/to/file. If there is more than one section in the file, then add a @SectionName after the path/to/file to describe the section.
59 lines
809 B
NASM
Executable File
59 lines
809 B
NASM
Executable File
INCLUDE "constants.asm"
|
|
|
|
SECTION "engine/overworld/spawn_points.asm", ROMX
|
|
|
|
LoadSpawnPoint: ; 03:4791
|
|
; 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: ; 03:47b6
|
|
; 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 |