diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-04-04 23:56:40 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2018-04-04 23:56:40 -0400 |
commit | 81306889e33c599f8015bc4e653929bb7de00967 (patch) | |
tree | 7a812968ba565a13ef400cdcb5230e6e8185a1ec /engine/overworld/spawn_points.asm | |
parent | 145efc13535fbc9d8ab2786d29209d97aebf0481 (diff) | |
parent | f750d4f4185529cfb440ac7825d202ebcf160766 (diff) |
Merge branch 'master' of https://github.com/pret/pokecrystal
Diffstat (limited to 'engine/overworld/spawn_points.asm')
-rw-r--r-- | engine/overworld/spawn_points.asm | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/engine/overworld/spawn_points.asm b/engine/overworld/spawn_points.asm new file mode 100644 index 000000000..1a3d12441 --- /dev/null +++ b/engine/overworld/spawn_points.asm @@ -0,0 +1,62 @@ +INCLUDE "data/maps/spawn_points.asm" + + +LoadSpawnPoint: ; 1531f + ; loads the spawn point in wDefaultSpawnpoint + push hl + push de + ld a, [wDefaultSpawnpoint] + cp SPAWN_N_A + jr z, .spawn_n_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 [wMapNumber], a + ld a, [hli] + ld [wXCoord], a + ld a, [hli] + ld [wYCoord], a +.spawn_n_a + pop de + pop hl + ret +; 15344 + + +IsSpawnPoint: ; 15344 +; Checks if the map loaded in de is a spawn point. Returns carry if it's a spawn point. + ld hl, SpawnPoints + ld c, 0 +.loop + ld a, [hl] + cp SPAWN_N_A + jr z, .nope + cp d + jr nz, .next + inc hl + ld a, [hld] + cp e + jr z, .yes + +.next + push bc + ld bc, 4 ; length of a spawn table entry + add hl, bc + pop bc + inc c + jr .loop + +.nope + and a + ret + +.yes + scf + ret +; 15363 |