summaryrefslogtreecommitdiff
path: root/engine/spawn_points.asm
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2015-07-21 02:04:38 -0400
committeryenatch <yenatch@gmail.com>2015-07-21 02:04:38 -0400
commit0b5471f385d3cc66bb4ae7aa4191ce3af9f50cac (patch)
tree61cb1021673d8a9b7b1cdddc64d90053a8476e8b /engine/spawn_points.asm
parent006fc875971c92f2249f47b5fd120c5df76c6883 (diff)
parentd5ddd9e54ec2422d6f1cd7c561c1750512d0a81d (diff)
Merge pull request #302 from PikalaxALT/more_enum
More enum
Diffstat (limited to 'engine/spawn_points.asm')
-rw-r--r--engine/spawn_points.asm39
1 files changed, 21 insertions, 18 deletions
diff --git a/engine/spawn_points.asm b/engine/spawn_points.asm
index ce96b0ce5..eb42ab0d1 100644
--- a/engine/spawn_points.asm
+++ b/engine/spawn_points.asm
@@ -18,7 +18,7 @@ ENDM
spawn VIRIDIAN, VIRIDIAN_CITY, 23, 26
spawn PEWTER, PEWTER_CITY, 13, 26
spawn CERULEAN, CERULEAN_CITY, 19, 22
- spawn ROCK_TUNNEL, ROUTE_10A, 11, 2
+ spawn ROCK_TUNNEL, ROUTE_10_NORTH, 11, 2
spawn VERMILION, VERMILION_CITY, 9, 6
spawn LAVENDER, LAVENDER_TOWN, 5, 6
spawn SAFFRON, SAFFRON_CITY, 9, 30
@@ -41,22 +41,24 @@ ENDM
spawn BLACKTHORN, BLACKTHORN_CITY, 21, 30
spawn MT_SILVER, SILVER_CAVE_OUTSIDE, 23, 20
spawn FAST_SHIP, FAST_SHIP_CABINS_SW_SSW_NW, 6, 2
+NUM_SPAWNS EQU const_value
+const_value = -1
+ spawn N_A, N_A, -1, -1
- db -1, -1, -1, -1
-
- const NUM_SPAWNS
LoadSpawnPoint: ; 1531f
+ ; loads the spawn point in wd001
push hl
push de
ld a, [wd001]
- cp -1
- jr z, .asm_15341
+ cp SPAWN_N_A
+ jr z, .spawn_n_a
ld l, a
ld h, 0
- add hl, hl
- add hl, hl
+rept 2 ; multiply hl by 4
+ add hl,hl
+endr
ld de, SpawnPoints
add hl, de
ld a, [hli]
@@ -67,7 +69,7 @@ LoadSpawnPoint: ; 1531f
ld [XCoord], a
ld a, [hli]
ld [YCoord], a
-.asm_15341
+.spawn_n_a
pop de
pop hl
ret
@@ -75,32 +77,33 @@ LoadSpawnPoint: ; 1531f
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
-.asm_15349
+.loop
ld a, [hl]
- cp -1
- jr z, .asm_1535f
+ cp SPAWN_N_A
+ jr z, .nope
cp d
- jr nz, .asm_15356
+ jr nz, .next
inc hl
ld a, [hld]
cp e
- jr z, .asm_15361
+ jr z, .yes
-.asm_15356
+.next
push bc
ld bc, 4
add hl, bc
pop bc
inc c
- jr .asm_15349
+ jr .loop
-.asm_1535f
+.nope
and a
ret
-.asm_15361
+.yes
scf
ret
; 15363