summaryrefslogtreecommitdiff
path: root/home/map_objects.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home/map_objects.asm')
-rw-r--r--home/map_objects.asm31
1 files changed, 17 insertions, 14 deletions
diff --git a/home/map_objects.asm b/home/map_objects.asm
index ac363b31d..07a361340 100644
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -21,7 +21,7 @@ Function180e:: ; 180e
ld hl, UsedSprites + 2
ld c, SPRITE_GFX_LIST_CAPACITY - 1
ld b, a
- ld a, [hConnectionStripLength]
+ ld a, [hMapObjectIndexBuffer1]
cp 0
jr z, .nope
ld a, b
@@ -234,14 +234,14 @@ GetMapObject:: ; 18d2
Function18de:: ; 18de
; Sets carry if the object is not visible on the screen.
- ld [hConnectionStripLength], a
+ ld [hMapObjectIndexBuffer1], a
call GetMapObject
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
ld a, [hl]
cp -1
jr z, .not_visible
- ld [hConnectedMapWidth], a
+ ld [hMapObjectIndexBuffer2], a
call GetObjectStruct
and a
ret
@@ -326,7 +326,7 @@ Function18f5:: ; 18f5
; 194d
Function194d:: ; 194d
- ld [hConnectionStripLength], a
+ ld [hMapObjectIndexBuffer1], a
call GetMapObject
call CopyObjectStruct
ret
@@ -335,16 +335,16 @@ Function194d:: ; 194d
_CopyObjectStruct:: ; 1956
- ld [hConnectionStripLength], a
+ ld [hMapObjectIndexBuffer1], a
call Function271e
- ld a, [hConnectionStripLength]
+ ld a, [hMapObjectIndexBuffer1]
call GetMapObject
callba CopyObjectStruct
ret
; 1967
Function1967:: ; 1967
- ld [hConnectionStripLength], a
+ ld [hMapObjectIndexBuffer1], a
call GetMapObject
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
add hl, bc
@@ -453,7 +453,10 @@ Function19e9:: ; 19e9
-Function1a13:: ; 1a13
+FindFirstEmptyObjectStruct:: ; 1a13
+; Returns the index of the first empty object struct in A and its address in HL, then sets carry.
+; If all object structs are occupied, A = 0 and Z is set.
+; Preserves BC and DE.
push bc
push de
ld hl, ObjectStructs
@@ -462,15 +465,15 @@ Function1a13:: ; 1a13
.loop
ld a, [hl]
and a
- jr z, .empty
+ jr z, .break
add hl, de
dec c
jr nz, .loop
xor a
jr .done
-.empty
- ld a, $d
+.break
+ ld a, NUM_OBJECT_STRUCTS
sub c
scf
@@ -547,7 +550,7 @@ Function1a71:: ; 1a71
push de
ld e, a
ld d, 0
- ld hl, ObjectStruct3_Data + 1
+ ld hl, ObjectStruct3_Data + 1 ; facing?
rept OBJECT_STRUCT_3_DATA_WIDTH
add hl, de
endr
@@ -569,12 +572,12 @@ endr
ld [hl], a
ld a, [bc]
inc bc
- ld hl, OBJECT_04
+ ld hl, OBJECT_FLAGS1
add hl, de
ld [hl], a
ld a, [bc]
inc bc
- ld hl, OBJECT_FLAGS
+ ld hl, OBJECT_FLAGS2
add hl, de
ld [hl], a
ld a, [bc]