shithub: pokecrystal

Download patch

ref: aba038a4a4b5a1ef9ab683a3683849809ef95467
parent: 434c97a146d4416829a44955d325d023dacf9e54
author: PikalaxALT <PikalaxALT@gmail.com>
date: Sun Nov 15 16:28:15 EST 2015

Fix some movement macro/function names

--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -530,7 +530,7 @@
 	const OBJECT_STEP_TYPE
 	const OBJECT_STEP_DURATION
 	const OBJECT_ACTION
-	const OBJECT_12
+	const OBJECT_STEP_FRAME
 	const OBJECT_FACING_STEP
 	const OBJECT_NEXT_TILE
 	const OBJECT_STANDING_TILE
@@ -652,7 +652,10 @@
 	const PALETTE_MORN
 	const PALETTE_DARK
 
+INVISIBLE    EQU 0
 FIXED_FACING EQU 2
+SLIDING      EQU 3
+EMOTE_OBJECT EQU 7
 
 	const_def
 	const PERSONTYPE_SCRIPT
--- a/constants/sprite_constants.asm
+++ b/constants/sprite_constants.asm
@@ -269,9 +269,9 @@
 
 	const_def
 	const STEP_TYPE_00
-	const STEP_TYPE_01 ; standing
+	const STEP_TYPE_01
 	const STEP_TYPE_02 ; walking
-	const STEP_TYPE_03 ; bumping
+	const STEP_TYPE_03 ; stationary
 	const STEP_TYPE_04
 	const STEP_TYPE_05
 	const STEP_TYPE_06
@@ -278,11 +278,11 @@
 	const STEP_TYPE_07
 	const STEP_TYPE_08
 	const STEP_TYPE_09
-	const STEP_TYPE_0A
-	const STEP_TYPE_0B
-	const STEP_TYPE_0C
-	const STEP_TYPE_0D
-	const STEP_TYPE_0E
+	const STEP_TYPE_0A ; half step
+	const STEP_TYPE_0B ; bump
+	const STEP_TYPE_TELEPORT_FROM
+	const STEP_TYPE_TELEPORT_TO
+	const STEP_TYPE_SKYFALL
 	const STEP_TYPE_0F
 	const STEP_TYPE_10
 	const STEP_TYPE_11
@@ -313,3 +313,37 @@
 	const PERSON_ACTION_0E
 	const PERSON_ACTION_0F
 	const PERSON_ACTION_10
+
+	const_def
+	const FACING_00
+	const FACING_01
+	const FACING_02
+	const FACING_03
+	const FACING_04
+	const FACING_05
+	const FACING_06
+	const FACING_07
+	const FACING_08
+	const FACING_09
+	const FACING_0A
+	const FACING_0B
+	const FACING_0C
+	const FACING_0D
+	const FACING_0E
+	const FACING_0F
+	const FACING_10
+	const FACING_11
+	const FACING_12
+	const FACING_13
+	const FACING_14
+	const FACING_15
+	const FACING_16
+	const FACING_17
+	const FACING_18
+	const FACING_19
+	const FACING_1A
+	const FACING_1B
+	const FACING_1C
+	const FACING_1D
+	const FACING_1E
+	const FACING_1F
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -245,7 +245,7 @@
 ; 967e1
 
 Function967e1: ; 967e1
-	callba RefreshMapAppearDisappear
+	callba _UpdateSprites
 	callba Functiond4d2
 	callba PlaceMapNameSign
 	ret
--- a/engine/facings.asm
+++ b/engine/facings.asm
@@ -185,7 +185,7 @@
 	db  0,  8, 4 | X_FLIP, $fc
 ; 41a3
 
-Facing23: ; big doll
+Facing23: ; big snorlax or lapras doll
 	db 16 ; #
 	db  0,  0, 0, $00
 	db  0,  8, 0, $01
@@ -221,7 +221,7 @@
 	db  8,  0, X_FLIP, $07
 ; 4206
 
-Facing22: ; 4206
+Facing22: ; big doll other than snorlax or lapras
 	db 14 ; #
 	db  0,  0, 0, $00
 	db  0,  8, 0, $01
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -196,7 +196,7 @@
 Function4427: ; 4427
 	ld hl, OBJECT_FLAGS1
 	add hl, bc
-	bit 0, [hl]
+	bit INVISIBLE, [hl]
 	jr nz, SetFacingStanding
 
 	ld hl, OBJECT_FLAGS2
@@ -214,11 +214,8 @@
 Function4440: ; 4440
 	ld hl, OBJECT_FLAGS1
 	add hl, bc
-	bit 0, [hl]
+	bit INVISIBLE, [hl]
 	jr nz, SetFacingStanding
-	; fallthrough
-; 4448
-
 Function4448: ; 4448
 	ld de, Pointers445f + 2
 	jr Function444d
@@ -290,10 +287,10 @@
 Function44c1: ; 44c1
 	ld hl, OBJECT_FLAGS1
 	add hl, bc
-	bit 3, [hl]
+	bit SLIDING, [hl]
 	jp nz, SetFacingCurrent
 
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld a, [hl]
 	inc a
@@ -304,6 +301,7 @@
 	rrca
 	and %00000011
 	ld d, a
+
 	call GetSpriteDirection
 	or 0 ; useless
 	or d
@@ -316,18 +314,21 @@
 Function44e4: ; 44e4
 	ld hl, OBJECT_FLAGS1
 	add hl, bc
-	bit 3, [hl]
+	bit SLIDING, [hl]
 	jp nz, SetFacingCurrent
-	ld hl, OBJECT_12
+
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld a, [hl]
 	add 2
 	and %00001111
 	ld [hl], a
+
 	rrca
 	rrca
 	and %00000011
 	ld d, a
+
 	call GetSpriteDirection
 	or 0 ; useless
 	or d
@@ -340,11 +341,13 @@
 Function4508: ; 4508
 	ld hl, OBJECT_FLAGS1
 	add hl, bc
-	bit 3, [hl]
+	bit SLIDING, [hl]
 	jp nz, SetFacingCurrent
-	ld hl, OBJECT_12
+
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	inc [hl]
+
 	ld a, [hl]
 	rrca
 	rrca
@@ -351,6 +354,7 @@
 	rrca
 	and %00000011
 	ld d, a
+
 	call GetSpriteDirection
 	or 0 ; useless
 	or d
@@ -378,11 +382,12 @@
 ; 453f
 
 Function453f: ; 453f
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld a, [hl]
 	and %11110000
 	ld e, a
+
 	ld a, [hl]
 	inc a
 	and %00001111
@@ -389,6 +394,7 @@
 	ld d, a
 	cp 4
 	jr c, .ok
+
 	ld d, 0
 	ld a, e
 	add $10
@@ -399,6 +405,7 @@
 	ld a, d
 	or e
 	ld [hl], a
+
 	swap e
 	ld d, 0
 	ld hl, .Directions
@@ -428,7 +435,7 @@
 Function457b: ; 457b
 	ld hl, OBJECT_FACING_STEP
 	add hl, bc
-	ld [hl], $15
+	ld [hl], FACING_15
 	ret
 ; 4582
 
@@ -435,7 +442,7 @@
 Function4582: ; 4582
 	ld hl, OBJECT_FACING_STEP
 	add hl, bc
-	ld [hl], $14
+	ld [hl], FACING_14
 	ret
 ; 4589
 
@@ -442,12 +449,12 @@
 Function4589: ; 4589
 	ld hl, OBJECT_FACING_STEP
 	add hl, bc
-	ld [hl], $17
+	ld [hl], FACING_17
 	ret
 ; 4590
 
 Function4590: ; 4590
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld a, [hl]
 	inc a
@@ -457,7 +464,7 @@
 	jr z, Function45a4
 	ld hl, OBJECT_FACING_STEP
 	add hl, bc
-	ld [hl], $4
+	ld [hl], FACING_04
 	ret
 ; 45a4
 
@@ -469,7 +476,7 @@
 ; 45ab
 
 Function45ab: ; 45ab
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld a, [hl]
 	inc a
@@ -487,18 +494,18 @@
 Function45be: ; 45be
 	ld hl, OBJECT_FACING_STEP
 	add hl, bc
-	ld [hl], $16
+	ld [hl], FACING_16
 	ret
 ; 45c5
 
 Function45c5: ; 45c5
 	ld a, [VariableSprites + SPRITE_BIG_DOLL - SPRITE_VARS]
-	ld d, $17
+	ld d, FACING_17
 	cp SPRITE_BIG_SNORLAX
 	jr z, .ok
 	cp SPRITE_BIG_LAPRAS
 	jr z, .ok
-	ld d, $16
+	ld d, FACING_16
 
 .ok
 	ld hl, OBJECT_FACING_STEP
@@ -508,7 +515,7 @@
 ; 45da
 
 Function45da: ; 45da
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	inc [hl]
 	ld a, [hl]
@@ -516,9 +523,9 @@
 	ld hl, OBJECT_FACING_STEP
 	add hl, bc
 	and 2
-	ld a, $1c
+	ld a, FACING_1C
 	jr z, .ok
-	inc a
+	inc a ; FACING_1D
 .ok
 	ld [hl], a
 	ret
@@ -525,7 +532,7 @@
 ; 45ed
 
 Function45ed: ; 45ed
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	inc [hl]
 	ld a, [hl]
@@ -532,9 +539,9 @@
 	ld hl, OBJECT_FACING_STEP
 	add hl, bc
 	and 4
-	ld a, $1e
+	ld a, FACING_1E
 	jr z, .ok
-	inc a
+	inc a ; FACING_1F
 
 .ok
 	ld [hl], a
@@ -641,7 +648,7 @@
 
 Function467b: ; 467b
 	xor a
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld [hl], a
 	ld hl, OBJECT_MOVEMENT_BYTE_INDEX
@@ -1300,7 +1307,7 @@
 ; 49e5
 
 .MovementShadow: ; 49e5
-	call ._MovementShadow_14_1a_1b
+	call ._MovementShadow_Grass_Emote_BoulderDust
 	ld hl, OBJECT_ACTION
 	add hl, bc
 	ld [hl], PERSON_ACTION_07
@@ -1339,7 +1346,7 @@
 
 .MovementEmote: ; 4a21
 	call Function467b
-	call ._MovementShadow_14_1a_1b
+	call ._MovementShadow_Grass_Emote_BoulderDust
 	ld hl, OBJECT_ACTION
 	add hl, bc
 	ld [hl], PERSON_ACTION_08
@@ -1360,7 +1367,7 @@
 
 .MovementBoulderDust: ; 4a46
 	call Function467b
-	call ._MovementShadow_14_1a_1b
+	call ._MovementShadow_Grass_Emote_BoulderDust
 	ld hl, OBJECT_ACTION
 	add hl, bc
 	ld [hl], PERSON_ACTION_0E
@@ -1407,7 +1414,7 @@
 
 .MovementShakingGrass: ; 4a89
 	call Function467b
-	call ._MovementShadow_14_1a_1b
+	call ._MovementShadow_Grass_Emote_BoulderDust
 	ld hl, OBJECT_ACTION
 	add hl, bc
 	ld [hl], PERSON_ACTION_0F
@@ -1424,7 +1431,7 @@
 	ret
 ; 4aa8
 
-._MovementShadow_14_1a_1b: ; 4aa8
+._MovementShadow_Grass_Emote_BoulderDust: ; 4aa8
 	ld hl, OBJECT_RANGE
 	add hl, bc
 	ld a, [hl]
@@ -1520,9 +1527,6 @@
 	call Random
 	ld a, [hRandomAdd]
 	and %00011111
-	; fallthrough
-; 4b2d
-
 SetRandomStepDuration: ; 4b2d
 	ld hl, OBJECT_STEP_DURATION
 	add hl, bc
@@ -1630,9 +1634,6 @@
 	ld hl, wPlayerStepFlags
 	set 7, [hl]
 	call IncrementObjectStructField28
-;	fallthrough
-; 4bd2
-
 Function4bd2: ; 4bd2
 	call UpdateJumpPosition
 	call Function4738
@@ -1656,9 +1657,6 @@
 	ld hl, wPlayerStepFlags
 	set 7, [hl]
 	call IncrementObjectStructField28
-;	fallthrough
-; 4bfd
-
 Function4bfd: ; 4bfd
 	call UpdateJumpPosition
 	call Function4738
@@ -1685,7 +1683,7 @@
 ; 4c23
 
 Function4c23: ; 4c23
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld [hl], 0
 	ld hl, OBJECT_STEP_DURATION
@@ -1692,9 +1690,6 @@
 	add hl, bc
 	ld [hl], $10
 	call IncrementObjectStructField28
-;	fallthrough
-; 4c32
-
 Function4c32: ; 4c32
 	ld hl, OBJECT_ACTION
 	add hl, bc
@@ -1708,7 +1703,7 @@
 ; 4c42
 
 Function4c42: ; 4c42
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld [hl], 0
 	ld hl, OBJECT_31
@@ -1721,9 +1716,6 @@
 	add hl, bc
 	res 3, [hl]
 	call IncrementObjectStructField28
-;	fallthrough
-; 4c5d
-
 Function4c5d: ; 4c5d
 	ld hl, OBJECT_ACTION
 	add hl, bc
@@ -1743,7 +1735,7 @@
 	add hl, bc
 	dec [hl]
 	ret nz
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld [hl], 0
 	ld hl, OBJECT_STEP_TYPE
@@ -1781,11 +1773,8 @@
 	dec [hl]
 	ret nz
 	call IncrementObjectStructField28
-;	fallthrough
-; 4cb3
-
 Function4cb3: ; 4cb3
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld [hl], 0
 	ld hl, OBJECT_31
@@ -1818,9 +1807,6 @@
 	dec [hl]
 	ret nz
 	call IncrementObjectStructField28
-;	fallthrough
-; 4ceb
-
 Function4ceb: ; 4ceb
 	ld hl, OBJECT_STEP_DURATION
 	add hl, bc
@@ -1837,10 +1823,8 @@
 	add hl, bc
 	dec [hl]
 	ret nz
-; 4d01
-
 Function4d01: ; 4d01
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld [hl], 0
 	ld hl, OBJECT_SPRITE_Y_OFFSET
@@ -1869,9 +1853,6 @@
 	add hl, bc
 	ld [hl], $10
 	call IncrementObjectStructField28
-;	fallthrough
-; 4d2e
-
 Function4d2e: ; 4d2e
 	ld hl, OBJECT_STEP_DURATION
 	add hl, bc
@@ -1880,7 +1861,7 @@
 	ld hl, OBJECT_ACTION
 	add hl, bc
 	ld [hl], PERSON_ACTION_02
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld [hl], 0
 	ld hl, OBJECT_31
@@ -1890,9 +1871,6 @@
 	add hl, bc
 	ld [hl], $10
 	call IncrementObjectStructField28
-;	fallthrough
-; 4d4f
-
 Function4d4f: ; 4d4f
 	ld hl, OBJECT_31
 	add hl, bc
@@ -1910,11 +1888,8 @@
 	dec [hl]
 	ret nz
 	call IncrementObjectStructField28
-;	fallthrough
-; 4d6b
-
 Function4d6b: ; 4d6b
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld [hl], 0
 	ld hl, OBJECT_SPRITE_Y_OFFSET
@@ -1941,9 +1916,6 @@
 	add hl, bc
 	ld [hl], 0
 	call IncrementObjectStructField28
-	; fallthrough
-; 4d94
-
 Function4d94: ; 4d94
 	ld hl, OBJECT_SPRITE_Y_OFFSET
 	add hl, bc
@@ -2050,9 +2022,6 @@
 	add hl, bc
 	ld [hl], a
 	call IncrementObjectStructField28
-	; fallthrough
-; 4e21
-
 Function4e21: ; 4e21
 	call Function4fb2
 	ld hl, OBJECT_DIRECTION_WALKING
@@ -2100,9 +2069,6 @@
 	ld hl, wPlayerStepFlags
 	set 7, [hl]
 	call IncrementObjectStructField28
-	; fallthrough
-; 4e65
-
 Function4e65: ; 4e65
 	call Function4738
 	ld hl, OBJECT_STEP_DURATION
@@ -2135,7 +2101,7 @@
 	ld hl, OBJECT_DIRECTION_WALKING
 	add hl, bc
 	ld [hl], STANDING
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld a, [hl]
 	ld [hl], 2
@@ -2143,9 +2109,6 @@
 	add hl, bc
 	ld [hl], 2
 	call IncrementObjectStructField28
-	; fallthrough
-; 4ea4
-
 Function4ea4: ; 4ea4
 	ld hl, OBJECT_STEP_DURATION
 	add hl, bc
@@ -2152,9 +2115,6 @@
 	dec [hl]
 	ret nz
 	call IncrementObjectStructField28
-	; fallthrough
-; 4ead
-
 Function4ead: ; 4ead
 	ld hl, OBJECT_29
 	add hl, bc
@@ -2166,9 +2126,6 @@
 	add hl, bc
 	ld [hl], $2
 	call IncrementObjectStructField28
-	; fallthrough
-; 4ec0
-
 Function4ec0: ; 4ec0
 	ld hl, OBJECT_STEP_DURATION
 	add hl, bc
@@ -2260,9 +2217,6 @@
 	add hl, bc
 	ld [hl], a
 	call IncrementObjectStructField28
-	; fallthrough
-; 4f43
-
 Function4f43: ; 4f43
 	ld hl, OBJECT_29
 	add hl, bc
@@ -2338,7 +2292,7 @@
 	ld hl, OBJECT_SPRITE_Y_OFFSET
 	add hl, bc
 	ld [hl], $60
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld [hl], 0
 	ld hl, OBJECT_STEP_TYPE
@@ -2674,7 +2628,7 @@
 	push af
 	ld hl, OBJECT_FLAGS1
 	add hl, de
-	bit 7, [hl]
+	bit EMOTE_OBJECT, [hl]
 	jr z, .next
 	ld hl, OBJECT_SPRITE
 	add hl, de
@@ -2784,7 +2738,7 @@
 	call Function5629
 
 .ok
-	call RefreshMapAppearDisappear
+	call _UpdateSprites
 	ret
 ; 561d
 
@@ -2792,7 +2746,7 @@
 	call Function5645
 	ld a, 0
 	call Function5629
-	call RefreshMapAppearDisappear
+	call _UpdateSprites
 	ret
 ; 5629
 
@@ -3076,11 +3030,11 @@
 	ld [wc2df], a
 	xor a
 	ld [wd04e], a
-	ld [PlayerObject12], a
+	ld [PlayerObjectStepFrame], a
 	call Function57bc
 	callba CheckWarpCollision
 	call c, SpawnInFacingDown
-	call Function57ca
+	call SpawnInCustomFacing
 	ret
 ; 57bc
 
@@ -3096,7 +3050,7 @@
 	ret
 ; 57ca
 
-Function57ca: ; 57ca
+SpawnInCustomFacing: ; 57ca
 	ld hl, wPlayerSpriteSetupFlags
 	bit 5, [hl]
 	ret z
@@ -3105,15 +3059,12 @@
 rept 2
 	add a
 endr
-	jr Function57db
+	jr ContinueSpawnFacing
 ; 57d9
 
 SpawnInFacingDown: ; 57d9
 	ld a, 0
-	; fallthrough
-; 57db
-
-Function57db: ; 57db
+ContinueSpawnFacing: ; 57db
 	ld bc, PlayerStruct
 	call SetSpriteDirection
 	ret
@@ -3355,7 +3306,7 @@
 	db SPRITEMOVEDATA_STANDING_RIGHT
 ; 5920
 
-RefreshMapAppearDisappear:: ; 5920
+_UpdateSprites:: ; 5920
 	ld a, [VramState]
 	bit 0, a
 	ret z
@@ -3365,19 +3316,19 @@
 	push af
 	ld a, 1
 	ld [hOAMUpdate], a
-	call Function5991
-	call Function593a
+	call InitSprites
+	call .fill
 	pop af
 	ld [hOAMUpdate], a
 	ret
 ; 593a
 
-Function593a: ; 593a
+.fill: ; 593a
 	ld a, [VramState]
 	bit 1, a
-	ld b, $a0
+	ld b, SpritesEnd % $100
 	jr z, .ok
-	ld b, $70
+	ld b, 28 * 4
 
 .ok
 	ld a, [hUsedSpriteIndex]
@@ -3384,10 +3335,10 @@
 	cp b
 	ret nc
 	ld l, a
-	ld h, $c4
-	ld de, OBJECT_FLAGS1
+	ld h, Sprites / $100
+	ld de, 4
 	ld a, b
-	ld c, $a0
+	ld c, SCREEN_HEIGHT_PX + 16
 .loop
 	ld [hl], c
 	add hl, de
@@ -3442,26 +3393,29 @@
 	ret
 ; 5991
 
-Function5991: ; 5991
-	call Function59a4
-	ld c, $30
-	call Function59f3
-	ld c, $20
-	call Function59f3
-	ld c, $10
-	call Function59f3
+InitSprites: ; 5991
+PRIORITY_LOW  EQU $10
+PRIORITY_NORM EQU $20
+PRIORITY_HIGH EQU $30
+	call .DeterminePriorities
+	ld c, PRIORITY_HIGH
+	call .InitSpritesByPriority
+	ld c, PRIORITY_NORM
+	call .InitSpritesByPriority
+	ld c, PRIORITY_LOW
+	call .InitSpritesByPriority
 	ret
 ; 59a4
 
-Function59a4: ; 59a4
+.DeterminePriorities: ; 59a4
 	xor a
-	ld hl, wMovementPointer
-	ld bc, 13
+	ld hl, wc2eb
+	ld bc, NUM_OBJECT_STRUCTS
 	call ByteFill
 
 	ld d, 0
 	ld bc, ObjectStructs
-	ld hl, wMovementPointer
+	ld hl, wc2eb
 .loop
 	push hl
 	call GetObjectSprite
@@ -3470,19 +3424,19 @@
 	ld hl, OBJECT_FACING_STEP
 	add hl, bc
 	ld a, [hl]
-	cp -1
+	cp STANDING
 	jr z, .skip
 
 ; Define the sprite priority.
-	ld e, $10
+	ld e, PRIORITY_LOW
 	ld hl, OBJECT_FLAGS2
 	add hl, bc
 	bit 0, [hl]
 	jr nz, .add
-	ld e, $20
+	ld e, PRIORITY_NORM
 	bit 1, [hl]
 	jr z, .add
-	ld e, $30
+	ld e, PRIORITY_HIGH
 	jr .add
 
 .skip
@@ -3511,15 +3465,15 @@
 	ret
 ; 59f3
 
-Function59f3: ; 59f3
+.InitSpritesByPriority: ; 59f3
 	ld hl, wMovementPointer
-.next
+.next_sprite
 	ld a, [hli]
 	ld d, a
 	and $f0
 	ret z
 	cp c
-	jr nz, .next
+	jr nz, .next_sprite
 
 	push bc
 	push hl
@@ -3526,13 +3480,13 @@
 	ld a, d
 	and $f
 	call .GetObjectStructPointer
-	call .asm_5a0d
+	call .InitSprite
 	pop hl
 	pop bc
-	jr .next
+	jr .next_sprite
 ; 5a0d
 
-.asm_5a0d: ; 5a0d
+.InitSprite: ; 5a0d
 	ld hl, OBJECT_SPRITE_TILE
 	add hl, bc
 	ld a, [hl]
--- a/engine/movement.asm
+++ b/engine/movement.asm
@@ -59,7 +59,7 @@
 	dw Movement_39                    ; 39
 	dw Movement_remove_fixed_facing   ; 3a
 	dw Movement_fix_facing            ; 3b
-	dw Movement_3c                    ; 3c
+	dw Movement_show_person           ; 3c
 	dw Movement_hide_person           ; 3d
 	dw Movement_step_sleep_1          ; 3e
 	dw Movement_step_sleep_2          ; 3f
@@ -78,8 +78,8 @@
 	dw Movement_teleport_from         ; 4c
 	dw Movement_teleport_to           ; 4d
 	dw Movement_skyfall               ; 4e
-	dw Movement_step_wait5            ; 4f
-	dw Movement_step_bump                    ; 50
+	dw Movement_step_dig              ; 4f
+	dw Movement_step_bump             ; 50
 	dw Movement_fish_got_bite         ; 51
 	dw Movement_fish_cast_rod         ; 52
 	dw Movement_hide_emote            ; 53
@@ -87,7 +87,7 @@
 	dw Movement_step_shake            ; 55
 	dw Movement_56                    ; 56
 	dw Movement_rock_smash            ; 57
-	dw Movement_58                    ; 58
+	dw Movement_return_dig                    ; 58
 	dw Movement_59                    ; 59
 ; 5129
 
@@ -95,7 +95,7 @@
 Movement_teleport_from: ; 5129
 	ld hl, OBJECT_STEP_TYPE
 	add hl, bc
-	ld [hl], STEP_TYPE_0C
+	ld [hl], STEP_TYPE_TELEPORT_FROM
 	ret
 ; 5130
 
@@ -102,7 +102,7 @@
 Movement_teleport_to: ; 5130
 	ld hl, OBJECT_STEP_TYPE
 	add hl, bc
-	ld [hl], STEP_TYPE_0D
+	ld [hl], STEP_TYPE_TELEPORT_TO
 	ret
 ; 5137
 
@@ -109,7 +109,7 @@
 Movement_skyfall: ; 5137
 	ld hl, OBJECT_STEP_TYPE
 	add hl, bc
-	ld [hl], STEP_TYPE_0E
+	ld [hl], STEP_TYPE_SKYFALL
 	ret
 ; 513e
 
@@ -120,11 +120,11 @@
 	ret
 ; 5145
 
-Movement_step_wait5: ; 5145
+Movement_step_dig: ; 5145
 	call GetSpriteDirection
 	rlca
 	rlca
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld [hl], a
 	ld hl, OBJECT_ACTION
@@ -143,11 +143,11 @@
 	ret
 ; 516a
 
-Movement_58: ; 516a
+Movement_return_dig: ; 516a
 	call GetSpriteDirection
 	rlca
 	rlca
-	ld hl, OBJECT_12
+	ld hl, OBJECT_STEP_FRAME
 	add hl, bc
 	ld [hl], a
 	call GetMovementByte
@@ -334,16 +334,19 @@
 ; 525f
 
 Movement_step_bump: ; 525f
-	ld a, $1
+	ld a, 1
 	ld hl, OBJECT_STEP_DURATION
 	add hl, bc
 	ld [hl], a
+
 	ld hl, OBJECT_STEP_TYPE
 	add hl, bc
 	ld [hl], STEP_TYPE_0B
+
 	ld hl, OBJECT_ACTION
 	add hl, bc
 	ld [hl], PERSON_ACTION_03
+
 	ld hl, OBJECT_DIRECTION_WALKING
 	add hl, bc
 	ld [hl], STANDING
@@ -373,7 +376,7 @@
 Movement_38: ; 5293
 	ld hl, OBJECT_FLAGS1
 	add hl, bc
-	res 3, [hl]
+	res SLIDING, [hl]
 	jp ContinueReadingMovement
 ; 529c
 
@@ -380,7 +383,7 @@
 Movement_39: ; 529c
 	ld hl, OBJECT_FLAGS1
 	add hl, bc
-	set 3, [hl]
+	set SLIDING, [hl]
 	jp ContinueReadingMovement
 ; 52a5
 
@@ -398,10 +401,10 @@
 	jp ContinueReadingMovement
 ; 52b7
 
-Movement_3c: ; 52b7
+Movement_show_person: ; 52b7
 	ld hl, OBJECT_FLAGS1
 	add hl, bc
-	res 0, [hl]
+	res INVISIBLE, [hl]
 	jp ContinueReadingMovement
 ; 52c0
 
@@ -408,7 +411,7 @@
 Movement_hide_person: ; 52c0
 	ld hl, OBJECT_FLAGS1
 	add hl, bc
-	set 0, [hl]
+	set INVISIBLE, [hl]
 	jp ContinueReadingMovement
 ; 52c9
 
@@ -760,7 +763,7 @@
 	ld hl, wd4cf
 	ld a, [hMapObjectIndexBuffer]
 	cp [hl]
-	jr z, .asm_543f
+	jr z, .step_type_06
 
 	ld hl, OBJECT_STEP_TYPE
 	add hl, bc
@@ -767,7 +770,7 @@
 	ld [hl], STEP_TYPE_02
 	ret
 
-.asm_543f
+.step_type_06
 	ld hl, OBJECT_STEP_TYPE
 	add hl, bc
 	ld [hl], STEP_TYPE_06
@@ -777,19 +780,22 @@
 TurningStep: ; 5446
 	call Function4690
 	call Function463f
+
 	ld hl, OBJECT_ACTION
 	add hl, bc
 	ld [hl], PERSON_ACTION_04
+
 	ld hl, wd4cf
 	ld a, [hMapObjectIndexBuffer]
 	cp [hl]
-	jr z, .asm_5461
+	jr z, .step_type_06
+
 	ld hl, OBJECT_STEP_TYPE
 	add hl, bc
 	ld [hl], STEP_TYPE_02
 	ret
 
-.asm_5461
+.step_type_06
 	ld hl, OBJECT_STEP_TYPE
 	add hl, bc
 	ld [hl], STEP_TYPE_06
@@ -800,19 +806,22 @@
 SlideStep: ; 5468
 	call Function4690
 	call Function463f
+
 	ld hl, OBJECT_ACTION
 	add hl, bc
 	ld [hl], PERSON_ACTION_01
+
 	ld hl, wd4cf
 	ld a, [hMapObjectIndexBuffer]
 	cp [hl]
-	jr z, .asm_5483
+	jr z, .step_type_06
+
 	ld hl, OBJECT_STEP_TYPE
 	add hl, bc
 	ld [hl], STEP_TYPE_02
 	ret
 
-.asm_5483
+.step_type_06
 	ld hl, OBJECT_STEP_TYPE
 	add hl, bc
 	ld [hl], STEP_TYPE_06
@@ -825,23 +834,28 @@
 	ld hl, OBJECT_31
 	add hl, bc
 	ld [hl], $0
+
 	ld hl, OBJECT_FLAGS2
 	add hl, bc
 	res 3, [hl]
+
 	ld hl, OBJECT_ACTION
 	add hl, bc
 	ld [hl], PERSON_ACTION_02
+
 	call SpawnShadow
+
 	ld hl, wd4cf
 	ld a, [hMapObjectIndexBuffer]
 	cp [hl]
-	jr z, .asm_54b1
+	jr z, .step_type_09
+
 	ld hl, OBJECT_STEP_TYPE
 	add hl, bc
 	ld [hl], STEP_TYPE_08
 	ret
 
-.asm_54b1
+.step_type_09
 	ld hl, OBJECT_STEP_TYPE
 	add hl, bc
 	ld [hl], STEP_TYPE_09
--- a/engine/scripting.asm
+++ b/engine/scripting.asm
@@ -1284,7 +1284,7 @@
 	ld a, [hMapObjectIndexBuffer]
 	ld b, 1 ; set
 	call ApplyEventActionAppearDisappear
-	callba RefreshMapAppearDisappear
+	callba _UpdateSprites
 	ret
 ; 0x9730b
 
--- a/event/forced_movement.asm
+++ b/event/forced_movement.asm
@@ -28,41 +28,33 @@
 ; 0x12564
 
 .MovementData_up: ; 0x12564
-	step_wait5
-	big_step_down
+	step_dig 16
 	turn_in_down
-	step_wait5
-	big_step_down
+	step_dig 16
 	turn_head_down
 	step_end
 ; 0x1256b
 
 .MovementData_down: ; 0x1256b
-	step_wait5
-	big_step_down
+	step_dig 16
 	turn_in_up
-	step_wait5
-	big_step_down
+	step_dig 16
 	turn_head_up
 	step_end
 ; 0x12572
 
 .MovementData_right: ; 0x12572
-	step_wait5
-	big_step_down
+	step_dig 16
 	turn_in_left
-	step_wait5
-	big_step_down
+	step_dig 16
 	turn_head_left
 	step_end
 ; 0x12579
 
 .MovementData_left: ; 0x12579
-	step_wait5
-	big_step_down
+	step_dig 16
 	turn_in_right
-	step_wait5
-	big_step_down
+	step_dig 16
 	turn_head_right
 	step_end
 ; 0x12580
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -649,7 +649,7 @@
 	bit 0, a
 	ret z
 	callba Function55e0
-	callba RefreshMapAppearDisappear
+	callba _UpdateSprites
 	ret
 ; 1ae5
 
--- a/macros/movement.asm
+++ b/macros/movement.asm
@@ -292,10 +292,9 @@
 	db movement_fix_facing ; $3b
 	endm
 
-	enum movement_return_dig
-return_dig: macro
-	db movement_return_dig
-	db \1
+	enum movement_show_person
+show_person: macro
+	db movement_show_person ; $3c
 	endm
 
 	enum movement_hide_person
@@ -354,6 +353,8 @@
 	db movement_step_end ; $47
 	endm
 
+; Whatever Movement_48 is, it takes a one-byte parameter
+
 __enum__ = $49
 
 	enum movement_remove_person
@@ -383,9 +384,10 @@
 	db movement_skyfall ; $4e
 	endm
 
-	enum movement_step_wait5
-step_wait5: macro
-	db movement_step_wait5 ; $4f
+	enum movement_step_dig
+step_dig: macro
+	db movement_step_dig ; $4f
+	db \1
 	endm
 
 	enum movement_step_bump
@@ -423,5 +425,11 @@
 	enum movement_rock_smash
 rock_smash: macro
 	db movement_rock_smash ; $57
+	db \1
+	endm
+
+	enum movement_return_dig
+return_dig: macro
+	db movement_return_dig ; $58
 	db \1
 	endm
--- a/main.asm
+++ b/main.asm
@@ -1522,7 +1522,7 @@
 	xor a
 	ld [hBGMapMode], a
 	ld [hWY], a
-	callba Function64db ; no need to callba
+	callba Function64db ; no need to farcall
 	ld a, VBGMap0 / $100
 	call Function64b9
 	xor a
@@ -5571,26 +5571,25 @@
 	closetext
 	loadmovesprites
 	playsound SFX_WARP_TO
-	applymovement PLAYER, MovementData_0xcc59
+	applymovement PLAYER, .DigOut
 	farscall Script_AbortBugContest
 	special WarpToSpawnPoint
 	writecode VAR_MOVEMENT, $0
 	newloadmap MAPSETUP_DOOR
 	playsound SFX_WARP_FROM
-	applymovement PLAYER, MovementData_0xcc5d
+	applymovement PLAYER, .DigReturn
 	end
 ; 0xcc59
 
-MovementData_0xcc59: ; 0xcc59
-	step_wait5
-	turn_away_down
+.DigOut: ; 0xcc59
+	step_dig 32
 	hide_person
 	step_end
 ; 0xcc5d
 
-MovementData_0xcc5d: ; 0xcc5d
-	return_dig $58
-	turn_away_down
+.DigReturn: ; 0xcc5d
+	show_person
+	return_dig 32
 	step_end
 ; 0xcc61
 
@@ -5669,22 +5668,22 @@
 	reloadmappart
 	loadmovesprites
 	playsound SFX_WARP_TO
-	applymovement PLAYER, MovementData_0xcce1
+	applymovement PLAYER, .TeleportFrom
 	farscall Script_AbortBugContest
 	special WarpToSpawnPoint
 	writecode VAR_MOVEMENT, $0
 	newloadmap MAPSETUP_TELEPORT
 	playsound SFX_WARP_FROM
-	applymovement PLAYER, MovementData_0xcce3
+	applymovement PLAYER, .TeleportTo
 	end
 ; 0xcce1
 
-MovementData_0xcce1: ; cce1
+.TeleportFrom: ; cce1
 	teleport_from
 	step_end
 ; cce3
 
-MovementData_0xcce3: ; cce3
+.TeleportTo: ; cce3
 	teleport_to
 	step_end
 ; cce5
@@ -50690,7 +50689,7 @@
 	ret
 
 Function104770: ; 104770 (41:4770)
-	ld a, $98
+	ld a, VBGMap0 / $100
 	ld [wBGMapAnchor + 1], a
 	xor a
 	ld [wBGMapAnchor], a
--- a/wram.asm
+++ b/wram.asm
@@ -325,6 +325,7 @@
 wMovementDataPointer:: ds 3 ; dba
 wc2e6:: ds 4
 wc2ea:: ds 1
+wc2eb::
 wMovementPointer:: ds 2 ; c2eb
 	ds 3
 
@@ -2219,7 +2220,7 @@
 \1StepType:: ds 1
 \1StepDuration:: ds 1
 \1Action:: ds 1
-\1Object12:: ds 1
+\1ObjectStepFrame:: ds 1
 \1Facing:: ds 1
 \1NextTile:: ds 1     ; collision
 \1StandingTile:: ds 1 ; collision