From 870d85fc2713703f6dbc760df5b2c54328f0c9c3 Mon Sep 17 00:00:00 2001 From: luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> Date: Tue, 3 Jul 2018 13:27:51 -0400 Subject: Merge branch 'master' of https://github.com/pret/pokegold-spaceworld --- engine/overworld/spawn_points.asm | 118 +++++++++++++++++++------------------- 1 file changed, 59 insertions(+), 59 deletions(-) (limited to 'engine/overworld') diff --git a/engine/overworld/spawn_points.asm b/engine/overworld/spawn_points.asm index c159a21..2476c46 100755 --- a/engine/overworld/spawn_points.asm +++ b/engine/overworld/spawn_points.asm @@ -1,59 +1,59 @@ -INCLUDE "constants.asm" - -SECTION "LoadSpawnPoint", ROMX[$4791], BANK[$03] - -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 +INCLUDE "constants.asm" + +SECTION "LoadSpawnPoint", ROMX[$4791], BANK[$03] + +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 -- cgit v1.2.3