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.asm113
1 files changed, 37 insertions, 76 deletions
diff --git a/home/map_objects.asm b/home/map_objects.asm
index 5acea7822..6bc30d571 100644
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -1,6 +1,6 @@
; Functions handling map objects.
-GetSpritePalette:: ; 17ff
+GetSpritePalette::
push hl
push de
push bc
@@ -13,9 +13,8 @@ GetSpritePalette:: ; 17ff
pop de
pop hl
ret
-; 180e
-GetSpriteVTile:: ; 180e
+GetSpriteVTile::
push hl
push bc
ld hl, wUsedSprites + 2
@@ -49,9 +48,8 @@ GetSpriteVTile:: ; 180e
pop bc
pop hl
ret
-; 1836
-DoesSpriteHaveFacings:: ; 1836
+DoesSpriteHaveFacings::
push de
push hl
@@ -72,25 +70,22 @@ DoesSpriteHaveFacings:: ; 1836
pop hl
pop de
ret
-; 184a
-GetPlayerStandingTile:: ; 184a
+GetPlayerStandingTile::
ld a, [wPlayerStandingTile]
call GetTileCollision
ld b, a
ret
-; 1852
-CheckOnWater:: ; 1852
+CheckOnWater::
ld a, [wPlayerStandingTile]
call GetTileCollision
sub WATERTILE
ret z
and a
ret
-; 185d
-GetTileCollision:: ; 185d
+GetTileCollision::
; Get the collision type of tile a.
push de
@@ -115,9 +110,8 @@ GetTileCollision:: ; 185d
pop hl
pop de
ret
-; 1875
-CheckGrassTile:: ; 1875
+CheckGrassTile::
ld d, a
and $f0
cp HI_NYBBLE_TALL_GRASS
@@ -140,53 +134,46 @@ CheckGrassTile:: ; 1875
ret z
scf
ret
-; 188e
-CheckSuperTallGrassTile:: ; 188e
+CheckSuperTallGrassTile::
cp COLL_LONG_GRASS
ret z
cp COLL_LONG_GRASS_1C
ret
-; 1894
-CheckCutTreeTile:: ; 1894
+CheckCutTreeTile::
cp COLL_CUT_TREE
ret z
cp COLL_CUT_TREE_1A
ret
-; 189a
-CheckHeadbuttTreeTile:: ; 189a
+CheckHeadbuttTreeTile::
cp COLL_HEADBUTT_TREE
ret z
cp COLL_HEADBUTT_TREE_1D
ret
-; 18a0
-CheckCounterTile:: ; 18a0
+CheckCounterTile::
cp COLL_COUNTER
ret z
cp COLL_COUNTER_98
ret
-; 18a6
-CheckPitTile:: ; 18a6
+CheckPitTile::
cp COLL_PIT
ret z
cp COLL_PIT_68
ret
-; 18ac
-CheckIceTile:: ; 18ac
+CheckIceTile::
cp COLL_ICE
ret z
cp COLL_ICE_2B
ret z
scf
ret
-; 18b4
-CheckWhirlpoolTile:: ; 18b4
+CheckWhirlpoolTile::
nop
cp COLL_WHIRLPOOL
ret z
@@ -194,16 +181,14 @@ CheckWhirlpoolTile:: ; 18b4
ret z
scf
ret
-; 18bd
-CheckWaterfallTile:: ; 18bd
+CheckWaterfallTile::
cp COLL_WATERFALL
ret z
cp COLL_CURRENT_DOWN
ret
-; 18c3
-CheckStandingOnEntrance:: ; 18c3
+CheckStandingOnEntrance::
ld a, [wPlayerStandingTile]
cp COLL_DOOR
ret z
@@ -213,9 +198,8 @@ CheckStandingOnEntrance:: ; 18c3
ret z
cp COLL_CAVE
ret
-; 18d2
-GetMapObject:: ; 18d2
+GetMapObject::
; Return the location of map object a in bc.
ld hl, wMapObjects
ld bc, OBJECT_LENGTH
@@ -223,9 +207,8 @@ GetMapObject:: ; 18d2
ld b, h
ld c, l
ret
-; 18de
-CheckObjectVisibility:: ; 18de
+CheckObjectVisibility::
; Sets carry if the object is not visible on the screen.
ld [hMapObjectIndexBuffer], a
call GetMapObject
@@ -242,9 +225,8 @@ CheckObjectVisibility:: ; 18de
.not_visible
scf
ret
-; 18f5
-CheckObjectTime:: ; 18f5
+CheckObjectTime::
ld hl, MAPOBJECT_HOUR
add hl, bc
ld a, [hl]
@@ -317,25 +299,22 @@ CheckObjectTime:: ; 18f5
.no
scf
ret
-; 194d
; unused
ld [hMapObjectIndexBuffer], a
call GetMapObject
call CopyObjectStruct
ret
-; 1956
-_CopyObjectStruct:: ; 1956
+_CopyObjectStruct::
ld [hMapObjectIndexBuffer], a
call UnmaskObject
ld a, [hMapObjectIndexBuffer]
call GetMapObject
farcall CopyObjectStruct
ret
-; 1967
-ApplyDeletionToMapObject:: ; 1967
+ApplyDeletionToMapObject::
ld [hMapObjectIndexBuffer], a
call GetMapObject
ld hl, MAPOBJECT_OBJECT_STRUCT_ID
@@ -364,15 +343,13 @@ ApplyDeletionToMapObject:: ; 1967
ld [wObjectFollow_Leader], a
ld [wObjectFollow_Follower], a
ret
-; 199f
-DeleteObjectStruct:: ; 199f
+DeleteObjectStruct::
call ApplyDeletionToMapObject
call MaskObject
ret
-; 19a6
-CopyPlayerObjectTemplate:: ; 19a6
+CopyPlayerObjectTemplate::
push hl
call GetMapObject
ld d, b
@@ -384,7 +361,6 @@ CopyPlayerObjectTemplate:: ; 19a6
ld bc, OBJECT_LENGTH - 1
call CopyBytes
ret
-; 19b8
Unreferenced_Function19b8:
call GetMapObject
@@ -414,9 +390,8 @@ Unreferenced_Function19b8:
call GetObjectStruct
farcall DeleteMapObject
ret
-; 19e9
-LoadMovementDataPointer:: ; 19e9
+LoadMovementDataPointer::
; Load the movement data pointer for object a.
ld [wMovementObject], a
ld a, [hROMBank]
@@ -441,9 +416,8 @@ LoadMovementDataPointer:: ; 19e9
set 7, [hl]
and a
ret
-; 1a13
-FindFirstEmptyObjectStruct:: ; 1a13
+FindFirstEmptyObjectStruct::
; 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.
@@ -471,9 +445,8 @@ FindFirstEmptyObjectStruct:: ; 1a13
pop de
pop bc
ret
-; 1a2f
-GetSpriteMovementFunction:: ; 1a2f
+GetSpriteMovementFunction::
ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld a, [hl]
@@ -490,9 +463,8 @@ rept NUM_SPRITEMOVEDATA_FIELDS
endr
ld a, [hl]
ret
-; 1a47
-GetInitialFacing:: ; 1a47
+GetInitialFacing::
push bc
push de
ld e, a
@@ -509,9 +481,8 @@ endr
pop de
pop bc
ret
-; 1a61
-CopySpriteMovementData:: ; 1a61
+CopySpriteMovementData::
ld l, a
ld a, [hROMBank]
push af
@@ -527,9 +498,8 @@ CopySpriteMovementData:: ; 1a61
rst Bankswitch
ret
-; 1a71
-.CopyData: ; 1a71
+.CopyData:
ld hl, OBJECT_MOVEMENTTYPE
add hl, de
ld [hl], a
@@ -578,9 +548,8 @@ endr
add hl, de
ld [hl], a
ret
-; 1aae
-_GetMovementByte:: ; 1aae
+_GetMovementByte::
; Switch to the movement data bank
ld a, [hROMBank]
push af
@@ -604,21 +573,18 @@ _GetMovementByte:: ; 1aae
ld a, h
ret
-; 1ac6
-SetVramState_Bit0:: ; 1ac6
+SetVramState_Bit0::
ld hl, wVramState
set 0, [hl]
ret
-; 1acc
-ResetVramState_Bit0:: ; 1acc
+ResetVramState_Bit0::
ld hl, wVramState
res 0, [hl]
ret
-; 1ad2
-UpdateSprites:: ; 1ad2
+UpdateSprites::
ld a, [wVramState]
bit 0, a
ret z
@@ -626,26 +592,23 @@ UpdateSprites:: ; 1ad2
farcall Function55e0
farcall _UpdateSprites
ret
-; 1ae5
-GetObjectStruct:: ; 1ae5
+GetObjectStruct::
ld bc, OBJECT_STRUCT_LENGTH
ld hl, wObjectStructs
call AddNTimes
ld b, h
ld c, l
ret
-; 1af1
-DoesObjectHaveASprite:: ; 1af1
+DoesObjectHaveASprite::
ld hl, OBJECT_SPRITE
add hl, bc
ld a, [hl]
and a
ret
-; 1af8
-SetSpriteDirection:: ; 1af8
+SetSpriteDirection::
; preserves other flags
push af
ld hl, OBJECT_FACING
@@ -658,12 +621,10 @@ SetSpriteDirection:: ; 1af8
or e
ld [hl], a
ret
-; 1b07
-GetSpriteDirection:: ; 1b07
+GetSpriteDirection::
ld hl, OBJECT_FACING
add hl, bc
ld a, [hl]
maskbits NUM_DIRECTIONS, 2
ret
-; 1b0f