ref: 41d5ea0482f4ef577df600d2d8b5cad70f74a396
parent: 4c239a6f65bb995be8f400c05f0c9cb38beae326
author: Rangi <[email protected]>
date: Mon Sep 12 05:15:44 EDT 2022
Rename the `object_struct` field labels and constants (#1005) Fixes #990
--- a/constants/map_object_constants.asm
+++ b/constants/map_object_constants.asm
@@ -1,43 +1,43 @@
; object_struct members (see macros/ram.asm)
rsreset
-DEF OBJECT_SPRITE rb ; 00
-DEF OBJECT_MAP_OBJECT_INDEX rb ; 01
-DEF OBJECT_SPRITE_TILE rb ; 02
-DEF OBJECT_MOVEMENTTYPE rb ; 03
-DEF OBJECT_FLAGS1 rb ; 04
-DEF OBJECT_FLAGS2 rb ; 05
-DEF OBJECT_PALETTE rb ; 06
-DEF OBJECT_DIRECTION_WALKING rb ; 07
-DEF OBJECT_FACING rb ; 08
-DEF OBJECT_STEP_TYPE rb ; 09
-DEF OBJECT_STEP_DURATION rb ; 0a
-DEF OBJECT_ACTION rb ; 0b
-DEF OBJECT_STEP_FRAME rb ; 0c
-DEF OBJECT_FACING_STEP rb ; 0d
-DEF OBJECT_NEXT_TILE rb ; 0e
-DEF OBJECT_STANDING_TILE rb ; 0f
-DEF OBJECT_NEXT_MAP_X rb ; 10
-DEF OBJECT_NEXT_MAP_Y rb ; 11
-DEF OBJECT_MAP_X rb ; 12
-DEF OBJECT_MAP_Y rb ; 13
-DEF OBJECT_INIT_X rb ; 14
-DEF OBJECT_INIT_Y rb ; 15
-DEF OBJECT_RADIUS rb ; 16
-DEF OBJECT_SPRITE_X rb ; 17
-DEF OBJECT_SPRITE_Y rb ; 18
-DEF OBJECT_SPRITE_X_OFFSET rb ; 19
-DEF OBJECT_SPRITE_Y_OFFSET rb ; 1a
-DEF OBJECT_MOVEMENT_BYTE_INDEX rb ; 1b
-DEF OBJECT_1C rb ; 1c
-DEF OBJECT_1D rb ; 1d
-DEF OBJECT_1E rb ; 1e
-DEF OBJECT_1F rb ; 1f
-DEF OBJECT_RANGE rb ; 20
- rb_skip 7
+DEF OBJECT_SPRITE rb ; 00
+DEF OBJECT_MAP_OBJECT_INDEX rb ; 01
+DEF OBJECT_SPRITE_TILE rb ; 02
+DEF OBJECT_MOVEMENT_TYPE rb ; 03
+DEF OBJECT_FLAGS1 rb ; 04
+DEF OBJECT_FLAGS2 rb ; 05
+DEF OBJECT_PALETTE rb ; 06
+DEF OBJECT_WALKING rb ; 07
+DEF OBJECT_DIRECTION rb ; 08
+DEF OBJECT_STEP_TYPE rb ; 09
+DEF OBJECT_STEP_DURATION rb ; 0a
+DEF OBJECT_ACTION rb ; 0b
+DEF OBJECT_STEP_FRAME rb ; 0c
+DEF OBJECT_FACING rb ; 0d
+DEF OBJECT_TILE rb ; 0e
+DEF OBJECT_LAST_TILE rb ; 0f
+DEF OBJECT_MAP_X rb ; 10
+DEF OBJECT_MAP_Y rb ; 11
+DEF OBJECT_LAST_MAP_X rb ; 12
+DEF OBJECT_LAST_MAP_Y rb ; 13
+DEF OBJECT_INIT_X rb ; 14
+DEF OBJECT_INIT_Y rb ; 15
+DEF OBJECT_RADIUS rb ; 16
+DEF OBJECT_SPRITE_X rb ; 17
+DEF OBJECT_SPRITE_Y rb ; 18
+DEF OBJECT_SPRITE_X_OFFSET rb ; 19
+DEF OBJECT_SPRITE_Y_OFFSET rb ; 1a
+DEF OBJECT_MOVEMENT_INDEX rb ; 1b
+DEF OBJECT_STEP_INDEX rb ; 1c
+DEF OBJECT_1D rb ; 1d
+DEF OBJECT_1E rb ; 1e
+DEF OBJECT_JUMP_HEIGHT rb ; 1f
+DEF OBJECT_RANGE rb ; 20
+ rb_skip 7
DEF OBJECT_LENGTH EQU _RS
DEF NUM_OBJECT_STRUCTS EQU 13 ; see wObjectStructs
-; object_struct OBJECT_FACING values
+; object_struct OBJECT_DIRECTION values
DEF OW_DOWN EQU DOWN << 2
DEF OW_UP EQU UP << 2
DEF OW_LEFT EQU LEFT << 2
--- a/constants/script_constants.asm
+++ b/constants/script_constants.asm
@@ -145,13 +145,14 @@
DEF NUM_OBJECT_TYPES EQU const_value
; command queue members
-DEF CMDQUEUE_TYPE EQU 0
-DEF CMDQUEUE_ADDR EQU 1
-DEF CMDQUEUE_02 EQU 2
-DEF CMDQUEUE_03 EQU 3
-DEF CMDQUEUE_04 EQU 4
-DEF CMDQUEUE_05 EQU 5
-DEF CMDQUEUE_ENTRY_SIZE EQU 6
+rsreset
+DEF CMDQUEUE_TYPE rb
+DEF CMDQUEUE_ADDR rb
+DEF CMDQUEUE_02 rb
+DEF CMDQUEUE_03 rb
+DEF CMDQUEUE_04 rb
+DEF CMDQUEUE_JUMPTABLE_INDEX rb
+DEF CMDQUEUE_ENTRY_SIZE EQU _RS
DEF CMDQUEUE_CAPACITY EQU 4
; HandleQueuedCommand.Jumptable indexes (see engine/overworld/events.asm)
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -2074,7 +2074,7 @@
ld d, 0
ld hl, .EdgeWarps
add hl, de
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
cp [hl]
jr nz, .not_warp
--- a/engine/events/field_moves.asm
+++ b/engine/events/field_moves.asm
@@ -234,12 +234,12 @@
Cut_GetLeafSpawnCoords:
ld de, 0
- ld a, [wMetatileStandingX]
+ ld a, [wPlayerMetatileX]
bit 0, a
jr z, .left_side
set 0, e
.left_side
- ld a, [wMetatileStandingY]
+ ld a, [wPlayerMetatileY]
bit 0, a
jr z, .top_side
set 1, e
--- a/engine/events/overworld.asm
+++ b/engine/events/overworld.asm
@@ -686,7 +686,7 @@
.CheckContinueWaterfall:
xor a
ld [wScriptVar], a
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
call CheckWaterfallTile
ret z
farcall StubbedTrainerRankings_Waterfall
@@ -1693,7 +1693,7 @@
jr .nope
.ok
- call GetPlayerStandingTile
+ call GetPlayerTile
and $f ; lo nybble only
jr nz, .nope ; not FLOOR_TILE
xor a
--- a/engine/overworld/cmd_queue.asm
+++ b/engine/overworld/cmd_queue.asm
@@ -135,7 +135,7 @@
dba CmdQueue_Type4
CmdQueues_AnonJumptable:
- ld hl, CMDQUEUE_05
+ ld hl, CMDQUEUE_JUMPTABLE_INDEX
add hl, bc
ld a, [hl]
pop hl
@@ -143,13 +143,13 @@
ret
CmdQueues_IncAnonJumptableIndex:
- ld hl, CMDQUEUE_05
+ ld hl, CMDQUEUE_JUMPTABLE_INDEX
add hl, bc
inc [hl]
ret
CmdQueues_DecAnonJumptableIndex:
- ld hl, CMDQUEUE_05
+ ld hl, CMDQUEUE_JUMPTABLE_INDEX
add hl, bc
dec [hl]
ret
@@ -241,7 +241,7 @@
.PlayerNotFacingDown:
ld a, $7f
ld [wd173], a
- ld hl, CMDQUEUE_05
+ ld hl, CMDQUEUE_JUMPTABLE_INDEX
add hl, bc
ld [hl], 0
ret
@@ -266,19 +266,19 @@
and a
jr z, .next
- ld hl, OBJECT_MOVEMENTTYPE
+ ld hl, OBJECT_MOVEMENT_TYPE
add hl, de
ld a, [hl]
cp SPRITEMOVEDATA_STRENGTH_BOULDER
jr nz, .next
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, de
ld a, [hl]
call CheckPitTile
jr nz, .next
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, de
ld a, [hl]
cp STANDING
--- a/engine/overworld/events.asm
+++ b/engine/overworld/events.asm
@@ -349,7 +349,7 @@
ret
.warp_tile
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
call CheckPitTile
jr nz, .not_pit
ld a, PLAYEREVENT_FALL
@@ -1191,7 +1191,7 @@
jr nc, .no
.ice_check
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
call CheckIceTile
jr z, .no
scf
@@ -1262,7 +1262,7 @@
ret
TryWildEncounter_BugContest:
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
call CheckSuperTallGrassTile
ld b, 40 percent
jr z, .ok
--- a/engine/overworld/load_map_part.asm
+++ b/engine/overworld/load_map_part.asm
@@ -1,6 +1,6 @@
_LoadMapPart::
ld hl, wSurroundingTiles
- ld a, [wMetatileStandingY]
+ ld a, [wPlayerMetatileY]
and a
jr z, .top_row
ld bc, SURROUNDING_WIDTH * 2
@@ -7,7 +7,7 @@
add hl, bc
.top_row
- ld a, [wMetatileStandingX]
+ ld a, [wPlayerMetatileX]
and a
jr z, .left_column
inc hl
--- a/engine/overworld/map_object_action.asm
+++ b/engine/overworld/map_object_action.asm
@@ -22,7 +22,7 @@
assert_table_length NUM_OBJECT_ACTIONS
SetFacingStanding:
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], STANDING
ret
@@ -30,13 +30,13 @@
SetFacingCurrent:
call GetSpriteDirection
or FACING_STEP_DOWN_0 ; useless
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
SetFacingStandAction:
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld a, [hl]
and 1
@@ -64,7 +64,7 @@
call GetSpriteDirection
or FACING_STEP_DOWN_0 ; useless
or d
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
@@ -90,7 +90,7 @@
call GetSpriteDirection
or FACING_STEP_DOWN_0 ; useless
or d
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
@@ -115,7 +115,7 @@
call GetSpriteDirection
or FACING_STEP_DOWN_0 ; useless
or d
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
@@ -122,11 +122,11 @@
SetFacingCounterclockwiseSpin:
call CounterclockwiseSpinAction
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, bc
ld a, [hl]
or FACING_STEP_DOWN_0 ; useless
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
@@ -169,7 +169,7 @@
ld hl, .facings
add hl, de
ld a, [hl]
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, bc
ld [hl], a
ret
@@ -185,25 +185,25 @@
rrca
rrca
add FACING_FISH_DOWN
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
SetFacingShadow:
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], FACING_SHADOW
ret
SetFacingEmote:
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], FACING_EMOTE
ret
SetFacingBigDollSym:
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], FACING_BIG_DOLL_SYM
ret
@@ -217,13 +217,13 @@
ld [hl], a
and %00001000
jr z, SetFacingFreezeBounce
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], FACING_STEP_UP_0
ret
SetFacingFreezeBounce:
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], FACING_STEP_DOWN_0
ret
@@ -238,13 +238,13 @@
rrca
rrca
add FACING_WEIRD_TREE_0
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
ret
SetFacingBigDollAsym:
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], FACING_BIG_DOLL_ASYM
ret
@@ -259,7 +259,7 @@
ld d, FACING_BIG_DOLL_ASYM ; asymmetric
.ok
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], d
ret
@@ -270,7 +270,7 @@
inc [hl]
ld a, [hl]
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
and 2
ld a, FACING_BOULDER_DUST_1
@@ -286,7 +286,7 @@
add hl, bc
inc [hl]
ld a, [hl]
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
and 4
ld a, FACING_GRASS_1
--- a/engine/overworld/map_objects.asm
+++ b/engine/overworld/map_objects.asm
@@ -39,7 +39,7 @@
res OBJ_FLAGS2_6, [hl]
ld a, [wXCoord]
ld e, a
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
add 1
@@ -49,7 +49,7 @@
jr nc, .ok
ld a, [wYCoord]
ld e, a
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
add 1
@@ -182,43 +182,43 @@
INCLUDE "engine/overworld/map_object_action.asm"
-CopyNextCoordsTileToStandingCoordsTile:
- ld hl, OBJECT_NEXT_MAP_X
+CopyCoordsTileToLastCoordsTile:
+ ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
- ld hl, OBJECT_MAP_X
+ ld hl, OBJECT_LAST_MAP_X
add hl, bc
ld [hl], a
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
- ld hl, OBJECT_MAP_Y
+ ld hl, OBJECT_LAST_MAP_Y
add hl, bc
ld [hl], a
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, bc
ld a, [hl]
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_LAST_TILE
add hl, bc
ld [hl], a
call SetTallGrassFlags
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, bc
ld a, [hl]
call UselessAndA
ret
-CopyStandingCoordsTileToNextCoordsTile:
- ld hl, OBJECT_MAP_X
+CopyLastCoordsToCoords:
+ ld hl, OBJECT_LAST_MAP_X
add hl, bc
ld a, [hl]
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld [hl], a
- ld hl, OBJECT_MAP_Y
+ ld hl, OBJECT_LAST_MAP_Y
add hl, bc
ld a, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld [hl], a
ret
@@ -228,17 +228,17 @@
add hl, bc
bit OVERHEAD_F, [hl]
jr z, .ok
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, bc
ld a, [hl]
call SetTallGrassFlags
.ok
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, bc
ld a, [hl]
call UselessAndA
ret c ; never happens
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_LAST_TILE
add hl, bc
ld a, [hl]
call UselessAndA
@@ -270,19 +270,19 @@
ld hl, OBJECT_STEP_FRAME
add hl, bc
ld [hl], a
- ld hl, OBJECT_MOVEMENT_BYTE_INDEX
+ ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc
ld [hli], a
- ld [hli], a ; OBJECT_1C
+ ld [hli], a ; OBJECT_STEP_INDEX
ld [hli], a ; OBJECT_1D
ld [hl], a ; OBJECT_1E
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ret
InitStep:
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], a
ld hl, OBJECT_FLAGS1
@@ -292,7 +292,7 @@
add a
add a
and %00001100
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, bc
ld [hl], a
; fallthrough
@@ -304,19 +304,19 @@
ld [hl], a
ld a, d
call GetStepVectorSign
- ld hl, OBJECT_MAP_X
+ ld hl, OBJECT_LAST_MAP_X
add hl, bc
add [hl]
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld [hl], a
ld d, a
ld a, e
call GetStepVectorSign
- ld hl, OBJECT_MAP_Y
+ ld hl, OBJECT_LAST_MAP_Y
add hl, bc
add [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld [hl], a
ld e, a
@@ -323,7 +323,7 @@
push bc
call GetCoordTile
pop bc
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, bc
ld [hl], a
ret
@@ -344,7 +344,7 @@
GetStepVector:
; Return (x, y, duration, speed) in (d, e, a, h).
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld a, [hl]
and %00001111
@@ -389,7 +389,7 @@
ret ; -127 to -1
UpdatePlayerStep:
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld a, [hl]
and %00000011
@@ -436,26 +436,26 @@
ld a, SPRITEMOVEDATA_STANDING_DOWN
ret
-ObjectMovementByte_ZeroAnonJumptableIndex: ; unreferenced
- ld hl, OBJECT_MOVEMENT_BYTE_INDEX
+ObjectMovement_ZeroAnonJumptableIndex: ; unreferenced
+ ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc
ld [hl], 0
ret
-ObjectMovementByte_IncAnonJumptableIndex:
- ld hl, OBJECT_MOVEMENT_BYTE_INDEX
+ObjectMovement_IncAnonJumptableIndex:
+ ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc
inc [hl]
ret
-ObjectMovementByte_DecAnonJumptableIndex:
- ld hl, OBJECT_MOVEMENT_BYTE_INDEX
+ObjectMovement_DecAnonJumptableIndex:
+ ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc
dec [hl]
ret
-ObjectMovementByte_AnonJumptable:
- ld hl, OBJECT_MOVEMENT_BYTE_INDEX
+ObjectMovement_AnonJumptable:
+ ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc
ld a, [hl]
pop hl
@@ -462,20 +462,20 @@
rst JumpTable
ret
-Field1c_ZeroAnonJumptableIndex:
- ld hl, OBJECT_1C
+ObjectStep_ZeroAnonJumptableIndex:
+ ld hl, OBJECT_STEP_INDEX
add hl, bc
ld [hl], 0
ret
-Field1c_IncAnonJumptableIndex:
- ld hl, OBJECT_1C
+ObjectStep_IncAnonJumptableIndex:
+ ld hl, OBJECT_STEP_INDEX
add hl, bc
inc [hl]
ret
-Field1c_AnonJumptable:
- ld hl, OBJECT_1C
+ObjectStep_AnonJumptable:
+ ld hl, OBJECT_STEP_INDEX
add hl, bc
ld a, [hl]
pop hl
@@ -482,32 +482,32 @@
rst JumpTable
ret
-Field1c_GetAnonJumptableIndex: ; unreferenced
- ld hl, OBJECT_1C
+ObjectStep_GetAnonJumptableIndex: ; unreferenced
+ ld hl, OBJECT_STEP_INDEX
add hl, bc
ld a, [hl]
ret
-Field1c_SetAnonJumptableIndex: ; unreferenced
- ld hl, OBJECT_1C
+ObjectStep_SetAnonJumptableIndex: ; unreferenced
+ ld hl, OBJECT_STEP_INDEX
add hl, bc
ld [hl], a
ret
StepFunction_Reset:
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
push bc
call GetCoordTile
pop bc
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, bc
ld [hl], a
- call CopyNextCoordsTileToStandingCoordsTile
+ call CopyCoordsTileToLastCoordsTile
call EndSpriteMovement
ld hl, OBJECT_STEP_TYPE
add hl, bc
@@ -515,7 +515,7 @@
ret
StepFunction_FromMovement:
- call Field1c_ZeroAnonJumptableIndex
+ call ObjectStep_ZeroAnonJumptableIndex
call GetSpriteMovementFunction
ld a, [hl]
ld hl, .Pointers
@@ -581,13 +581,13 @@
call Random
ldh a, [hRandomAdd]
and %00001100
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, bc
ld [hl], a
jp RandomStepDuration_Slow
MovementFunction_RandomSpinFast:
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, bc
ld a, [hl]
and %00001100
@@ -603,7 +603,7 @@
jp RandomStepDuration_Fast
MovementFunction_Standing:
- call CopyStandingCoordsTileToNextCoordsTile
+ call CopyLastCoordsToCoords
call EndSpriteMovement
ld hl, OBJECT_ACTION
add hl, bc
@@ -614,15 +614,15 @@
ret
MovementFunction_ObeyDPad:
- ld hl, GetPlayerNextMovementByte
+ ld hl, GetPlayerNextMovementIndex
jp HandleMovementData
MovementFunction_Indexed1:
- ld hl, GetIndexedMovementByte1
+ ld hl, GetIndexedMovementIndex1
jp HandleMovementData
MovementFunction_Indexed2:
- ld hl, GetIndexedMovementByte2
+ ld hl, GetIndexedMovementIndex2
jp HandleMovementData
MovementFunction_0a:
@@ -635,7 +635,7 @@
jp _GetMovementObject
MovementFunction_0d:
- ld hl, GetPlayerNextMovementByte
+ ld hl, GetPlayerNextMovementIndex
jp HandleMovementData
MovementFunction_0e:
@@ -642,21 +642,21 @@
jp _GetMovementObject
MovementFunction_Follow:
- ld hl, GetFollowerNextMovementByte
+ ld hl, GetFollowerNextMovementIndex
jp HandleMovementData
MovementFunction_Script:
- ld hl, GetMovementByte
+ ld hl, GetMovementIndex
jp HandleMovementData
MovementFunction_Strength:
- call ObjectMovementByte_AnonJumptable
+ call ObjectMovement_AnonJumptable
.anon_dw
dw .start
dw .stop
.start:
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, bc
ld a, [hl]
call CheckPitTile
@@ -684,26 +684,26 @@
ret
.ok2
- call CopyStandingCoordsTileToNextCoordsTile
+ call CopyLastCoordsToCoords
.ok
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ret
.on_pit
- call ObjectMovementByte_IncAnonJumptableIndex
+ call ObjectMovement_IncAnonJumptableIndex
.stop:
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ret
MovementFunction_FollowNotExact:
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
ld hl, OBJECT_RANGE
@@ -711,12 +711,12 @@
ld a, [hl]
push bc
call GetObjectStruct
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld a, [hl]
cp STANDING
jr z, .standing
- ld hl, OBJECT_MAP_X
+ ld hl, OBJECT_LAST_MAP_X
add hl, bc
ld a, [hl]
cp d
@@ -730,7 +730,7 @@
jr .done
.equal
- ld hl, OBJECT_MAP_Y
+ ld hl, OBJECT_LAST_MAP_Y
add hl, bc
ld a, [hl]
cp e
@@ -743,7 +743,7 @@
ld a, 1
.done
ld d, a
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld a, [hl]
and %00001100
@@ -753,7 +753,7 @@
.standing
pop bc
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ld hl, OBJECT_ACTION
@@ -763,7 +763,7 @@
MovementFunction_BigStanding:
call EndSpriteMovement
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ld hl, OBJECT_ACTION
@@ -776,7 +776,7 @@
MovementFunction_Bouncing:
call EndSpriteMovement
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ld hl, OBJECT_ACTION
@@ -788,7 +788,7 @@
ret
MovementFunction_SpinCounterclockwise:
- call ObjectMovementByte_AnonJumptable
+ call ObjectMovement_AnonJumptable
.anon_dw
dw _MovementSpinInit
dw _MovementSpinRepeat
@@ -795,7 +795,7 @@
dw _MovementSpinTurnLeft
MovementFunction_SpinClockwise:
- call ObjectMovementByte_AnonJumptable
+ call ObjectMovement_AnonJumptable
.anon_dw
dw _MovementSpinInit
dw _MovementSpinRepeat
@@ -803,7 +803,7 @@
_MovementSpinInit:
call EndSpriteMovement
- call ObjectMovementByte_IncAnonJumptableIndex
+ call ObjectMovement_IncAnonJumptableIndex
; fallthrough
_MovementSpinRepeat:
@@ -820,7 +820,7 @@
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_SLEEP
- call ObjectMovementByte_IncAnonJumptableIndex
+ call ObjectMovement_IncAnonJumptableIndex
ret
_MovementSpinTurnLeft:
@@ -846,7 +846,7 @@
db OW_DOWN
_MovementSpinNextFacing:
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, bc
ld a, [hl]
and %00001100
@@ -859,7 +859,7 @@
ld a, [hl]
pop hl
ld [hl], a
- call ObjectMovementByte_DecAnonJumptableIndex
+ call ObjectMovement_DecAnonJumptableIndex
ret
MovementFunction_Shadow:
@@ -876,7 +876,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, de
ld a, [hl]
maskbits NUM_DIRECTIONS
@@ -932,7 +932,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, de
ld a, [hl]
and %00000011
@@ -992,7 +992,7 @@
ld hl, OBJECT_1D
add hl, bc
ld [hl], e
- inc hl
+ inc hl ; OBJECT_1E
ld [hl], d
ret
@@ -1058,7 +1058,7 @@
.new_duration:
call EndSpriteMovement
- call CopyStandingCoordsTileToNextCoordsTile
+ call CopyLastCoordsToCoords
; fallthrough
RandomStepDuration_Slow:
@@ -1075,7 +1075,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ld hl, OBJECT_ACTION
@@ -1128,7 +1128,7 @@
ret
StepFunction_NPCJump:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
.anon_dw
dw .Jump
dw .Land
@@ -1140,12 +1140,12 @@
add hl, bc
dec [hl]
ret nz
- call CopyNextCoordsTileToStandingCoordsTile
+ call CopyCoordsTileToLastCoordsTile
call GetNextTile
ld hl, OBJECT_FLAGS2
add hl, bc
res OVERHEAD_F, [hl]
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
ret
.Land:
@@ -1155,7 +1155,7 @@
add hl, bc
dec [hl]
ret nz
- call CopyNextCoordsTileToStandingCoordsTile
+ call CopyCoordsTileToLastCoordsTile
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_FROM_MOVEMENT
@@ -1162,7 +1162,7 @@
ret
StepFunction_PlayerJump:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
.anon_dw
dw .initjump
dw .stepjump
@@ -1172,7 +1172,7 @@
.initjump
ld hl, wPlayerStepFlags
set PLAYERSTEP_START_F, [hl]
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.stepjump
call UpdateJumpPosition
call UpdatePlayerStep
@@ -1180,7 +1180,7 @@
add hl, bc
dec [hl]
ret nz
- call CopyNextCoordsTileToStandingCoordsTile
+ call CopyCoordsTileToLastCoordsTile
ld hl, OBJECT_FLAGS2
add hl, bc
res OVERHEAD_F, [hl]
@@ -1187,7 +1187,7 @@
ld hl, wPlayerStepFlags
set PLAYERSTEP_STOP_F, [hl]
set PLAYERSTEP_MIDAIR_F, [hl]
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
ret
.initland
@@ -1194,7 +1194,7 @@
call GetNextTile
ld hl, wPlayerStepFlags
set PLAYERSTEP_START_F, [hl]
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.stepland
call UpdateJumpPosition
call UpdatePlayerStep
@@ -1204,7 +1204,7 @@
ret nz
ld hl, wPlayerStepFlags
set PLAYERSTEP_STOP_F, [hl]
- call CopyNextCoordsTileToStandingCoordsTile
+ call CopyCoordsTileToLastCoordsTile
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_FROM_MOVEMENT
@@ -1211,7 +1211,7 @@
ret
StepFunction_TeleportFrom:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
.anon_dw
dw .InitSpin
dw .DoSpin
@@ -1225,7 +1225,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.DoSpin:
ld hl, OBJECT_ACTION
add hl, bc
@@ -1234,7 +1234,7 @@
add hl, bc
dec [hl]
ret nz
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
ret
.InitSpinRise:
@@ -1241,7 +1241,7 @@
ld hl, OBJECT_STEP_FRAME
add hl, bc
ld [hl], 0
- ld hl, OBJECT_1F
+ ld hl, OBJECT_JUMP_HEIGHT
add hl, bc
ld [hl], $10
ld hl, OBJECT_STEP_DURATION
@@ -1250,12 +1250,12 @@
ld hl, OBJECT_FLAGS2
add hl, bc
res OVERHEAD_F, [hl]
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.DoSpinRise:
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], OBJECT_ACTION_SPIN
- ld hl, OBJECT_1F
+ ld hl, OBJECT_JUMP_HEIGHT
add hl, bc
inc [hl]
ld a, [hl]
@@ -1279,7 +1279,7 @@
ret
StepFunction_TeleportTo:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
.anon_dw
dw .InitWait
dw .DoWait
@@ -1296,7 +1296,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
ret
.DoWait:
@@ -1304,18 +1304,18 @@
add hl, bc
dec [hl]
ret nz
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.InitDescent:
ld hl, OBJECT_STEP_FRAME
add hl, bc
ld [hl], 0
- ld hl, OBJECT_1F
+ ld hl, OBJECT_JUMP_HEIGHT
add hl, bc
ld [hl], 0
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
ret
.DoDescent:
@@ -1322,7 +1322,7 @@
ld hl, OBJECT_ACTION
add hl, bc
ld [hl], OBJECT_ACTION_SPIN
- ld hl, OBJECT_1F
+ ld hl, OBJECT_JUMP_HEIGHT
add hl, bc
inc [hl]
ld a, [hl]
@@ -1337,12 +1337,12 @@
add hl, bc
dec [hl]
ret nz
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.InitFinalSpin:
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
ret
.DoFinalSpin:
@@ -1366,7 +1366,7 @@
ret
StepFunction_Skyfall:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
.anon_dw
dw .Init
dw .Step
@@ -1380,7 +1380,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.Step:
ld hl, OBJECT_STEP_DURATION
add hl, bc
@@ -1392,15 +1392,15 @@
ld hl, OBJECT_STEP_FRAME
add hl, bc
ld [hl], 0
- ld hl, OBJECT_1F
+ ld hl, OBJECT_JUMP_HEIGHT
add hl, bc
ld [hl], 0
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.Fall:
- ld hl, OBJECT_1F
+ ld hl, OBJECT_JUMP_HEIGHT
add hl, bc
inc [hl]
ld a, [hl]
@@ -1415,7 +1415,7 @@
add hl, bc
dec [hl]
ret nz
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.Finish:
ld hl, OBJECT_STEP_FRAME
add hl, bc
@@ -1429,7 +1429,7 @@
ret
StepFunction_GotBite:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
.anon_dw
dw .Init
dw .Run
@@ -1441,7 +1441,7 @@
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], 0
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.Run:
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
@@ -1493,7 +1493,7 @@
jp WaitStep_InPlace
StepFunction_Sleep:
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ld hl, OBJECT_STEP_DURATION
@@ -1506,7 +1506,7 @@
ret
StepFunction_Delete:
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ld hl, OBJECT_STEP_DURATION
@@ -1526,7 +1526,7 @@
ret
StepFunction_Restore:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
.anon_dw
dw .Reset
dw StepFunction_Standing
@@ -1534,15 +1534,15 @@
.Reset:
call RestoreDefaultMovement
call GetInitialFacing
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, bc
ld [hl], a
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
; fallthrough
StepFunction_Standing:
call Stubbed_UpdateYOffset
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ret
@@ -1554,8 +1554,8 @@
add hl, bc
dec [hl]
ret nz
- call CopyNextCoordsTileToStandingCoordsTile
- ld hl, OBJECT_DIRECTION_WALKING
+ call CopyCoordsTileToLastCoordsTile
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ld hl, OBJECT_STEP_TYPE
@@ -1569,11 +1569,11 @@
add hl, bc
dec [hl]
ret nz
- call CopyNextCoordsTileToStandingCoordsTile
+ call CopyCoordsTileToLastCoordsTile
jp RandomStepDuration_Slow
StepFunction_PlayerWalk:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
.anon_dw
dw .init
dw .step
@@ -1581,7 +1581,7 @@
.init
ld hl, wPlayerStepFlags
set PLAYERSTEP_START_F, [hl]
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.step
call UpdatePlayerStep
ld hl, OBJECT_STEP_DURATION
@@ -1590,8 +1590,8 @@
ret nz
ld hl, wPlayerStepFlags
set PLAYERSTEP_STOP_F, [hl]
- call CopyNextCoordsTileToStandingCoordsTile
- ld hl, OBJECT_DIRECTION_WALKING
+ call CopyCoordsTileToLastCoordsTile
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ld hl, OBJECT_STEP_TYPE
@@ -1600,7 +1600,7 @@
ret
StepFunction_Turn:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
.anon_dw
dw .init1
dw .step1
@@ -1608,7 +1608,7 @@
dw .step2
.init1
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ld hl, OBJECT_STEP_FRAME
@@ -1618,24 +1618,24 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 2
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.step1
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
ret nz
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.init2
ld hl, OBJECT_1D ; new facing
add hl, bc
ld a, [hl]
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, bc
ld [hl], a
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 2
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.step2
ld hl, OBJECT_STEP_DURATION
add hl, bc
@@ -1653,10 +1653,10 @@
dec [hl]
ret nz
push bc
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
ld hl, OBJECT_MAP_OBJECT_INDEX
@@ -1668,8 +1668,8 @@
ld hl, OBJECT_FLAGS2
add hl, bc
res OBJ_FLAGS2_2, [hl]
- call CopyNextCoordsTileToStandingCoordsTile
- ld hl, OBJECT_DIRECTION_WALKING
+ call CopyCoordsTileToLastCoordsTile
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ld hl, OBJECT_STEP_TYPE
@@ -1712,7 +1712,7 @@
StepFunction_14:
StepFunction_ScreenShake:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
.anon_dw
dw .Init
dw .Run
@@ -1722,7 +1722,7 @@
ld hl, OBJECT_1D
add hl, bc
ld [hl], a
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.Run:
ld hl, OBJECT_1D
add hl, bc
@@ -1760,11 +1760,11 @@
ret
StepFunction_16:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
; jumptable was dummied out here
StepFunction_17:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
.anon_dw
dw .null
dw .null
@@ -1772,7 +1772,7 @@
.null
StepFunction_SkyfallTop:
- call Field1c_AnonJumptable
+ call ObjectStep_AnonJumptable
.anon_dw
dw .Init
dw .Run
@@ -1784,7 +1784,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 16
- call Field1c_IncAnonJumptableIndex
+ call ObjectStep_IncAnonJumptableIndex
.Run:
ld hl, OBJECT_STEP_DURATION
@@ -1828,7 +1828,7 @@
UpdateJumpPosition:
call GetStepVector
ld a, h
- ld hl, OBJECT_1F
+ ld hl, OBJECT_JUMP_HEIGHT
add hl, bc
ld e, [hl]
add e
@@ -1848,7 +1848,7 @@
db -4, -6, -8, -10, -11, -12, -12, -12
db -11, -10, -9, -8, -6, -4, 0, 0
-GetPlayerNextMovementByte:
+GetPlayerNextMovementIndex:
; copy [wPlayerNextMovement] to [wPlayerMovement]
ld a, [wPlayerNextMovement]
ld hl, wPlayerMovement
@@ -1860,13 +1860,13 @@
ld a, [hl]
ret
-GetMovementByte:
+GetMovementIndex:
ld hl, wMovementDataBank
- call _GetMovementByte
+ call _GetMovementIndex
ret
-GetIndexedMovementByte1:
- ld hl, OBJECT_MOVEMENT_BYTE_INDEX
+GetIndexedMovementIndex1:
+ ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc
ld e, [hl]
inc [hl]
@@ -1879,8 +1879,8 @@
ld a, [hl]
ret
-GetIndexedMovementByte2:
- ld hl, OBJECT_MOVEMENT_BYTE_INDEX
+GetIndexedMovementIndex2:
+ ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc
ld e, [hl]
inc [hl]
@@ -1905,10 +1905,10 @@
call .StorePointer
.loop
xor a
- ld [wMovementByteWasControlSwitch], a
+ ld [wContinueReadingMovement], a
call JumpMovementPointer
call DoMovementFunction
- ld a, [wMovementByteWasControlSwitch]
+ ld a, [wContinueReadingMovement]
and a
jr nz, .loop
ret
@@ -1928,8 +1928,8 @@
jp hl
ContinueReadingMovement:
- ld a, 1
- ld [wMovementByteWasControlSwitch], a
+ ld a, TRUE
+ ld [wContinueReadingMovement], a
ret
DoMovementFunction:
@@ -1974,7 +1974,7 @@
ld [hl], a
ret
-GetFollowerNextMovementByte:
+GetFollowerNextMovementIndex:
ld hl, wFollowerMovementQueueLength
ld a, [hl]
and a
@@ -2152,10 +2152,10 @@
ldh a, [hMapObjectIndex]
ld [hli], a
push hl
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
pop hl
@@ -2251,7 +2251,7 @@
jr c, SetFacing_Standing
call CheckObjectOnScreen
jr c, SetFacing_Standing
- call UpdateObjectNextTile
+ call UpdateObjectTile
farcall HandleFrozenObjectAction ; no need to farcall
xor a
ret
@@ -2264,23 +2264,23 @@
ret
SetFacing_Standing:
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld [hl], STANDING
scf
ret
-UpdateObjectNextTile:
+UpdateObjectTile:
push bc
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
call GetCoordTile
pop bc
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, bc
ld [hl], a
farcall UpdateTallGrassFlags ; no need to farcall
@@ -2287,10 +2287,10 @@
ret
CheckObjectOnScreen:
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
inc d
@@ -2477,7 +2477,7 @@
ld [wPlayerMovement], a
xor a
ld [wPlayerTurningDirection], a
- ld [wPlayerObjectStepFrame], a
+ ld [wPlayerStepFrame], a
call TryResetPlayerAction
farcall CheckWarpFacingDown
call c, SpawnInFacingDown
@@ -2517,7 +2517,7 @@
and 1 << 7
ret z
ld bc, 0 ; debug?
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, bc
ld a, [hl]
or d
@@ -2569,7 +2569,7 @@
pop af
call CheckObjectVisibility
ret c
- ld hl, OBJECT_MOVEMENTTYPE
+ ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc
ld [hl], SPRITEMOVEDATA_FOLLOWING
ld hl, OBJECT_STEP_TYPE
@@ -2696,7 +2696,7 @@
add hl, bc
ld a, [hl]
pop bc
- ld hl, OBJECT_MOVEMENTTYPE
+ ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc
ld [hl], a
ld hl, OBJECT_STEP_TYPE
@@ -2713,7 +2713,7 @@
ld hl, .standing_movefns
add hl, de
ld a, [hl]
- ld hl, OBJECT_MOVEMENTTYPE
+ ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc
ld [hl], a
ld hl, OBJECT_STEP_TYPE
@@ -2831,7 +2831,7 @@
push hl
call DoesObjectHaveASprite
jr z, .skip
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld a, [hl]
cp STANDING
@@ -2948,7 +2948,7 @@
ld a, [wPlayerBGMapOffsetY]
add e
ldh [hCurSpriteYPixel], a
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, bc
ld a, [hl]
cp STANDING
--- a/engine/overworld/movement.asm
+++ b/engine/overworld/movement.asm
@@ -134,7 +134,7 @@
ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], STEP_TYPE_SLEEP
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ret
@@ -150,7 +150,7 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ld hl, OBJECT_STEP_TYPE
@@ -190,7 +190,7 @@
ret
Movement_step_loop:
- ld hl, OBJECT_MOVEMENT_BYTE_INDEX
+ ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc
ld [hl], $0
jp ContinueReadingMovement
@@ -197,11 +197,11 @@
Movement_step_end:
call RestoreDefaultMovement
- ld hl, OBJECT_MOVEMENTTYPE
+ ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc
ld [hl], a
- ld hl, OBJECT_MOVEMENT_BYTE_INDEX
+ ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc
ld [hl], $0
@@ -215,11 +215,11 @@
Movement_48:
call RestoreDefaultMovement
- ld hl, OBJECT_MOVEMENTTYPE
+ ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc
ld [hl], a
- ld hl, OBJECT_MOVEMENT_BYTE_INDEX
+ ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc
ld [hl], $0
@@ -314,7 +314,7 @@
add hl, bc
ld [hl], OBJECT_ACTION_STAND
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ret
@@ -333,7 +333,7 @@
add hl, bc
ld [hl], OBJECT_ACTION_BUMP
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ret
@@ -352,7 +352,7 @@
add hl, bc
ld [hl], OBJECT_ACTION_WEIRD_TREE
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ret
@@ -426,7 +426,7 @@
jr TurnHead
TurnHead:
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, bc
ld [hl], a
@@ -434,7 +434,7 @@
add hl, bc
ld [hl], OBJECT_ACTION_STAND
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld [hl], STANDING
ret
@@ -668,7 +668,7 @@
add hl, bc
ld [hl], OBJECT_ACTION_STEP
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, bc
ld a, [hl]
call CheckSuperTallGrassTile
@@ -747,7 +747,7 @@
JumpStep:
call InitStep
- ld hl, OBJECT_1F
+ ld hl, OBJECT_JUMP_HEIGHT
add hl, bc
ld [hl], $0
--- a/engine/overworld/npc_movement.asm
+++ b/engine/overworld/npc_movement.asm
@@ -60,10 +60,10 @@
WillObjectBumpIntoWater:
call CanObjectLeaveTile
ret c
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
ld hl, OBJECT_PALETTE
@@ -70,7 +70,7 @@
add hl, bc
bit OAM_PRIORITY, [hl]
jp nz, WillObjectRemainOnWater
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, bc
ld a, [hl]
ld d, a
@@ -83,7 +83,7 @@
WillObjectBumpIntoLand:
call CanObjectLeaveTile
ret c
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, bc
ld a, [hl]
call GetTileCollision
@@ -93,13 +93,13 @@
ret
WillObjectBumpIntoTile:
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_TILE
add hl, bc
ld a, [hl]
call GetSideWallDirectionMask
ret nc
push af
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld a, [hl]
maskbits NUM_DIRECTIONS
@@ -120,13 +120,13 @@
db LEFT_MASK ; RIGHT
CanObjectLeaveTile:
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_LAST_TILE
add hl, bc
ld a, [hl]
call GetSideWallDirectionMask
ret nc
push af
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
maskbits NUM_DIRECTIONS
ld e, a
@@ -177,7 +177,7 @@
db DOWN_MASK | LEFT_MASK ; COLL_UP_LEFT_WALL/BUOY
WillObjectRemainOnWater:
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld a, [hl]
maskbits NUM_DIRECTIONS
@@ -233,7 +233,7 @@
call CheckCounterTile
jr nz, .not_counter
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
sub d
cpl
inc a
@@ -240,7 +240,7 @@
add d
ld d, a
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
sub e
cpl
inc a
@@ -253,7 +253,7 @@
ldh [hMapObjectIndex], a
call IsNPCAtCoord
ret nc
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld a, [hl]
cp STANDING
@@ -266,10 +266,10 @@
ret
WillObjectBumpIntoSomeoneElse:
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
jr IsNPCAtCoord
@@ -282,10 +282,10 @@
ret
.GetFacingCoords:
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
call GetSpriteDirection
@@ -333,12 +333,12 @@
jr .continue
.not_big
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
cp d
jr nz, .check_current_coords
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
cp e
@@ -352,12 +352,12 @@
jr nz, .yes
.check_current_coords
- ld hl, OBJECT_MAP_X
+ ld hl, OBJECT_LAST_MAP_X
add hl, bc
ld a, [hl]
cp d
jr nz, .next
- ld hl, OBJECT_MAP_Y
+ ld hl, OBJECT_LAST_MAP_Y
add hl, bc
ld a, [hl]
cp e
@@ -402,7 +402,7 @@
ld a, [hl]
add e
ld e, a
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
cp d
@@ -427,7 +427,7 @@
ld a, [hl]
add e
ld e, a
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
cp d
@@ -444,7 +444,7 @@
ret
IsObjectMovingOffEdgeOfScreen:
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld a, [wXCoord]
cp [hl]
@@ -455,7 +455,7 @@
jr c, .yes
.check_y
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [wYCoord]
cp [hl]
@@ -474,9 +474,9 @@
ret
IsNPCAtPlayerCoord: ; unreferenced
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
ld d, a
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
ld e, a
ld bc, wObjectStructs
xor a
@@ -485,7 +485,7 @@
call DoesObjectHaveASprite
jr z, .next
- ld hl, OBJECT_MOVEMENTTYPE
+ ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc
ld a, [hl]
cp SPRITEMOVEDATA_BIGDOLLSYM
@@ -495,12 +495,12 @@
jr .next
.not_big
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld a, [hl]
cp e
jr nz, .check_current_coords
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
cp d
@@ -511,12 +511,12 @@
jr .yes
.check_current_coords
- ld hl, OBJECT_MAP_Y
+ ld hl, OBJECT_LAST_MAP_Y
add hl, bc
ld a, [hl]
cp e
jr nz, .next
- ld hl, OBJECT_MAP_X
+ ld hl, OBJECT_LAST_MAP_X
add hl, bc
ld a, [hl]
cp d
@@ -540,7 +540,7 @@
ret
WillObjectIntersectBigObject:
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld a, d
sub [hl]
@@ -547,7 +547,7 @@
jr c, .nope
cp 2 ; big doll width
jr nc, .nope
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld a, e
sub [hl]
--- a/engine/overworld/player_movement.asm
+++ b/engine/overworld/player_movement.asm
@@ -114,7 +114,7 @@
; Tiles such as waterfalls and warps move the player
; in a given direction, overriding input.
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
ld c, a
call CheckWhirlpoolTile
jr c, .not_whirlpool
@@ -270,7 +270,7 @@
cp 2
jr z, .bump
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
call CheckIceTile
jr nc, .ice
@@ -352,7 +352,7 @@
ret
.TryJump:
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
ld e, a
and $f0
cp HI_NYBBLE_LEDGES
@@ -398,7 +398,7 @@
ld d, 0
ld hl, .EdgeWarps
add hl, de
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
cp [hl]
jr nz, .not_warp
@@ -603,7 +603,7 @@
.action_table:
.action_table_1
- player_action STANDING, FACE_CURRENT, 0, 0, wPlayerStandingTile
+ player_action STANDING, FACE_CURRENT, 0, 0, wPlayerTile
.action_table_1_end
player_action RIGHT, FACE_RIGHT, 1, 0, wTileRight
player_action LEFT, FACE_LEFT, -1, 0, wTileLeft
@@ -617,13 +617,13 @@
ld a, 0
ldh [hMapObjectIndex], a
; Load the next X coordinate into d
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
ld d, a
ld a, [wWalkingX]
add d
ld d, a
; Load the next Y coordinate into e
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
ld e, a
ld a, [wWalkingY]
add e
@@ -651,7 +651,7 @@
bit BIKEFLAGS_STRENGTH_ACTIVE_F, [hl]
jr z, .not_boulder
- ld hl, OBJECT_DIRECTION_WALKING
+ ld hl, OBJECT_WALKING
add hl, bc
ld a, [hl]
cp STANDING
@@ -788,7 +788,7 @@
jr z, .not_ice
cp $f0
jr z, .not_ice
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
call CheckIceTile
jr nc, .yep
ld a, [wPlayerState]
--- a/engine/overworld/player_object.asm
+++ b/engine/overworld/player_object.asm
@@ -87,10 +87,10 @@
call CheckObjectVisibility
ret c
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
ldh a, [hMapObjectIndex]
@@ -103,7 +103,7 @@
ld a, [wXCoord]
add 4
ld d, a
- ld hl, wPlayerStandingMapX
+ ld hl, wPlayerMapX
sub [hl]
ld [hl], d
ld hl, wMapObjects + MAPOBJECT_X_COORD
@@ -114,7 +114,7 @@
ld a, [wYCoord]
add 4
ld e, a
- ld hl, wPlayerStandingMapY
+ ld hl, wPlayerMapY
sub [hl]
ld [hl], e
ld hl, wMapObjects + MAPOBJECT_Y_COORD
@@ -447,7 +447,7 @@
add hl, de
ld [hl], STEP_TYPE_RESET
- ld hl, OBJECT_FACING_STEP
+ ld hl, OBJECT_FACING
add hl, de
ld [hl], STANDING
@@ -467,7 +467,7 @@
add hl, de
ld [hl], a
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, de
ld [hl], a
@@ -486,7 +486,7 @@
ld hl, OBJECT_INIT_X
add hl, de
ld [hl], a
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, de
ld [hl], a
ld hl, wXCoord
@@ -557,19 +557,19 @@
call GetObjectStruct
; get last talked coords, load to bc
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld c, [hl]
ld b, a
; get player coords, load to de
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, de
ld a, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, de
ld e, [hl]
ld d, a
@@ -618,15 +618,15 @@
ret c
; object 2 is now in bc, object 1 is now in de
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld c, [hl]
ld b, a
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, de
ld a, [hl]
cp b
@@ -640,7 +640,7 @@
jr .continue
.same_x
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, de
ld a, [hl]
cp c
@@ -653,7 +653,7 @@
dec c
.continue
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, de
ld [hl], b
ld a, b
@@ -666,7 +666,7 @@
ld hl, OBJECT_SPRITE_X
add hl, de
ld [hl], a
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, de
ld [hl], c
ld a, c
@@ -683,7 +683,7 @@
ld hl, OBJECT_RANGE
add hl, de
ld [hl], a
- ld hl, OBJECT_MOVEMENTTYPE
+ ld hl, OBJECT_MOVEMENT_TYPE
add hl, de
ld [hl], SPRITEMOVEDATA_FOLLOWNOTEXACT
ld hl, OBJECT_STEP_TYPE
@@ -721,10 +721,10 @@
; load the coordinates of object d into bc
ld a, d
call GetObjectStruct
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld a, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld c, [hl]
ld b, a
@@ -732,10 +732,10 @@
; load the coordinates of object e into de
ld a, e
call GetObjectStruct
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
pop bc
@@ -813,15 +813,15 @@
.QueueFirstStep:
ld a, [wObjectFollow_Leader]
call GetObjectStruct
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld e, [hl]
ld a, [wObjectFollow_Follower]
call GetObjectStruct
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, bc
ld a, d
cp [hl]
@@ -837,7 +837,7 @@
ret
.check_y
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, bc
ld a, e
cp [hl]
--- a/engine/overworld/player_step.asm
+++ b/engine/overworld/player_step.asm
@@ -158,7 +158,7 @@
or HIGH(vBGMap0)
ld [wBGMapAnchor + 1], a
.not_overflowed
- ld hl, wMetatileStandingY
+ ld hl, wPlayerMetatileY
inc [hl]
ld a, [hl]
cp 2 ; was 1
@@ -189,7 +189,7 @@
or HIGH(vBGMap0)
ld [wBGMapAnchor + 1], a
.not_underflowed
- ld hl, wMetatileStandingY
+ ld hl, wPlayerMetatileY
dec [hl]
ld a, [hl]
cp -1 ; was 0
@@ -221,7 +221,7 @@
and $1f
or d
ld [wBGMapAnchor], a
- ld hl, wMetatileStandingX
+ ld hl, wPlayerMetatileX
dec [hl]
ld a, [hl]
cp -1
@@ -250,7 +250,7 @@
and $1f
or d
ld [wBGMapAnchor], a
- ld hl, wMetatileStandingX
+ ld hl, wPlayerMetatileX
inc [hl]
ld a, [hl]
cp 2
--- a/engine/overworld/tile_events.asm
+++ b/engine/overworld/tile_events.asm
@@ -1,6 +1,6 @@
CheckWarpCollision::
; Is this tile a warp?
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
cp COLL_PIT
jr z, .warp
cp COLL_PIT_68
@@ -18,7 +18,7 @@
CheckDirectionalWarp::
; If this is a directional warp, clear carry (press the designated button to warp).
; Else, set carry (immediate warp).
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
cp COLL_WARP_CARPET_DOWN
jr z, .directional
cp COLL_WARP_CARPET_LEFT
@@ -37,7 +37,7 @@
CheckWarpFacingDown:
ld de, 1
ld hl, .blocks
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
call IsInArray
ret
@@ -54,7 +54,7 @@
db -1
CheckGrassCollision::
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
ld hl, .blocks
ld de, 1
call IsInArray
@@ -90,7 +90,7 @@
db -1
GetWarpSFX::
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
ld de, SFX_ENTER_DOOR
cp COLL_DOOR
ret z
--- a/engine/overworld/warp_connection.asm
+++ b/engine/overworld/warp_connection.asm
@@ -346,7 +346,7 @@
ret
.down
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
sub 4
ld b, a
ld a, [wMapHeight]
@@ -357,7 +357,7 @@
ret
.up
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
sub 4
cp -1
jr z, .ok
@@ -365,7 +365,7 @@
ret
.left
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
sub 4
cp -1
jr z, .ok
@@ -373,7 +373,7 @@
ret
.right
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
sub 4
ld b, a
ld a, [wMapWidth]
@@ -425,8 +425,8 @@
ld [wOverworldMapAnchor + 1], a
ld a, [wYCoord]
and 1
- ld [wMetatileStandingY], a
+ ld [wPlayerMetatileY], a
ld a, [wXCoord]
and 1
- ld [wMetatileStandingX], a
+ ld [wPlayerMetatileX], a
ret
--- a/home/map.asm
+++ b/home/map.asm
@@ -246,10 +246,10 @@
ret
.GetDestinationWarpNumber:
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
sub 4
ld e, a
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
sub 4
ld d, a
ld a, [wCurMapWarpCount]
@@ -1514,16 +1514,16 @@
call .LeftRight
call .UpDown
; get coords of current tile
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
ld d, a
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
ld e, a
call GetCoordTile
- ld [wPlayerStandingTile], a
+ ld [wPlayerTile], a
call .CheckHiNybble
ret nz
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
and 7
ld hl, .MovementPermissionsData
add l
@@ -1548,9 +1548,9 @@
db UP_MASK | LEFT_MASK
.UpDown:
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
ld d, a
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
ld e, a
push de
@@ -1567,9 +1567,9 @@
ret
.LeftRight:
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
ld d, a
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
ld e, a
push de
@@ -1688,10 +1688,10 @@
ld h, [hl]
ld l, a
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
add d
ld d, a
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
add e
ld e, a
ld a, [hl]
@@ -1861,10 +1861,10 @@
call CheckScenes
ld b, a
; Load your current coordinates into de. This will be used to check if your position is in the coord event table for the current map.
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
sub 4
ld d, a
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
sub 4
ld e, a
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -71,14 +71,14 @@
pop de
ret
-GetPlayerStandingTile::
- ld a, [wPlayerStandingTile]
+GetPlayerTile::
+ ld a, [wPlayerTile]
call GetTileCollision
ld b, a
ret
CheckOnWater::
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
call GetTileCollision
sub WATER_TILE
ret z
@@ -189,7 +189,7 @@
ret
CheckStandingOnEntrance::
- ld a, [wPlayerStandingTile]
+ ld a, [wPlayerTile]
cp COLL_DOOR
ret z
cp COLL_DOOR_79
@@ -404,7 +404,7 @@
call CheckObjectVisibility
ret c
- ld hl, OBJECT_MOVEMENTTYPE
+ ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc
ld [hl], SPRITEMOVEDATA_SCRIPTED
@@ -447,7 +447,7 @@
ret
GetSpriteMovementFunction::
- ld hl, OBJECT_MOVEMENTTYPE
+ ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc
ld a, [hl]
cp NUM_SPRITEMOVEDATA
@@ -500,7 +500,7 @@
ret
.CopyData:
- ld hl, OBJECT_MOVEMENTTYPE
+ ld hl, OBJECT_MOVEMENT_TYPE
add hl, de
ld [hl], a
@@ -520,7 +520,7 @@
rlca
rlca
maskbits NUM_DIRECTIONS, 2
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, de
ld [hl], a
@@ -549,16 +549,16 @@
ld [hl], a
ret
-_GetMovementByte::
+_GetMovementIndex::
; Switch to the movement data bank
ldh a, [hROMBank]
push af
ld a, [hli]
rst Bankswitch
-; Load the current script byte as given by OBJECT_MOVEMENT_BYTE_INDEX, and increment OBJECT_MOVEMENT_BYTE_INDEX
+; Load the current script byte as given by OBJECT_MOVEMENT_INDEX, and increment OBJECT_MOVEMENT_INDEX
ld a, [hli]
ld d, [hl]
- ld hl, OBJECT_MOVEMENT_BYTE_INDEX
+ ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc
add [hl]
ld e, a
@@ -611,7 +611,7 @@
SetSpriteDirection::
; preserves other flags
push af
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, bc
ld a, [hl]
and %11110011
@@ -623,7 +623,7 @@
ret
GetSpriteDirection::
- ld hl, OBJECT_FACING
+ ld hl, OBJECT_DIRECTION
add hl, bc
ld a, [hl]
maskbits NUM_DIRECTIONS, 2
--- a/home/stone_queue.asm
+++ b/home/stone_queue.asm
@@ -38,10 +38,10 @@
.IsObjectOnWarp:
push de
- ld hl, OBJECT_NEXT_MAP_X
+ ld hl, OBJECT_MAP_X
add hl, de
ld a, [hl]
- ld hl, OBJECT_NEXT_MAP_Y
+ ld hl, OBJECT_MAP_Y
add hl, de
ld e, [hl]
--- a/home/trainers.asm
+++ b/home/trainers.asm
@@ -138,19 +138,19 @@
; Return carry if the sprite at bc is facing the player,
; its distance in d, and its direction in e.
- ld hl, OBJECT_NEXT_MAP_X ; x
+ ld hl, OBJECT_MAP_X ; x
add hl, bc
ld d, [hl]
- ld hl, OBJECT_NEXT_MAP_Y ; y
+ ld hl, OBJECT_MAP_Y ; y
add hl, bc
ld e, [hl]
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
cp d
jr z, .CheckY
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
cp e
jr z, .CheckX
@@ -158,7 +158,7 @@
ret
.CheckY:
- ld a, [wPlayerStandingMapY]
+ ld a, [wPlayerMapY]
sub e
jr z, .NotFacing
jr nc, .Above
@@ -176,7 +176,7 @@
jr .CheckFacing
.CheckX:
- ld a, [wPlayerStandingMapX]
+ ld a, [wPlayerMapX]
sub d
jr z, .NotFacing
jr nc, .Left
--- a/macros.asm
+++ b/macros.asm
@@ -1,7 +1,7 @@
INCLUDE "macros/asserts.asm"
INCLUDE "macros/const.asm"
INCLUDE "macros/predef.asm"
-INCLUDE "macros/rst.asm"
+INCLUDE "macros/farcall.asm"
INCLUDE "macros/data.asm"
INCLUDE "macros/code.asm"
INCLUDE "macros/gfx.asm"
--- a/macros/coords.asm
+++ b/macros/coords.asm
@@ -1,3 +1,5 @@
+; Coordinate macros
+
DEF hlcoord EQUS "coord hl,"
DEF bccoord EQUS "coord bc,"
DEF decoord EQUS "coord de,"
--- /dev/null
+++ b/macros/farcall.asm
@@ -1,0 +1,23 @@
+; Far calls to another bank
+
+MACRO farcall ; bank, address
+ ld a, BANK(\1)
+ ld hl, \1
+ rst FarCall
+ENDM
+
+MACRO callfar ; address, bank
+ ld hl, \1
+ ld a, BANK(\1)
+ rst FarCall
+ENDM
+
+MACRO homecall
+ ldh a, [hROMBank]
+ push af
+ ld a, BANK(\1)
+ rst Bankswitch
+ call \1
+ pop af
+ rst Bankswitch
+ENDM
--- a/macros/gfx.asm
+++ b/macros/gfx.asm
@@ -1,3 +1,5 @@
+; Graphics macros
+
MACRO assert_valid_rgb
rept _NARG
assert 0 <= (\1) && (\1) <= 31, "RGB channel must be 0-31"
--- a/macros/legacy.asm
+++ b/macros/legacy.asm
@@ -2,7 +2,7 @@
; Allows porting scripts with as few edits as possible.
; Legacy support not in this file can be found by looking for the keyword: "LEGACY"
-; macros/rst.asm
+; macros/farcall.asm
DEF callba EQUS "farcall"
DEF callab EQUS "callfar"
--- a/macros/predef.asm
+++ b/macros/predef.asm
@@ -1,3 +1,5 @@
+; Predef function calls
+
MACRO lda_predef
; Some functions load the predef id
; without immediately calling Predef.
--- a/macros/ram.asm
+++ b/macros/ram.asm
@@ -1,4 +1,4 @@
-; Used in wram.asm
+; Structures in RAM
MACRO flag_array
ds ((\1) + 7) / 8
@@ -283,38 +283,38 @@
ENDM
MACRO object_struct
-\1Sprite:: db
-\1MapObjectIndex:: db
-\1SpriteTile:: db
-\1MovementType:: db
-\1Flags:: dw
-\1Palette:: db
-\1Walking:: db
-\1Direction:: db
-\1StepType:: db
-\1StepDuration:: db
-\1Action:: db
-\1ObjectStepFrame:: db
-\1Facing:: db
-\1StandingTile:: db ; collision
-\1LastTile:: db ; collision
-\1StandingMapX:: db
-\1StandingMapY:: db
-\1LastMapX:: db
-\1LastMapY:: db
-\1ObjectInitX:: db
-\1ObjectInitY:: db
-\1Radius:: db
-\1SpriteX:: db
-\1SpriteY:: db
-\1SpriteXOffset:: db
-\1SpriteYOffset:: db
-\1MovementByteIndex:: db
-\1Field1c:: ds 1
-\1Field1d:: ds 1
-\1Field1e:: ds 1
-\1Field1f:: ds 1
-\1Range:: db
+\1Sprite:: db
+\1MapObjectIndex:: db
+\1SpriteTile:: db
+\1MovementType:: db
+\1Flags:: dw
+\1Palette:: db
+\1Walking:: db
+\1Direction:: db
+\1StepType:: db
+\1StepDuration:: db
+\1Action:: db
+\1StepFrame:: db
+\1Facing:: db
+\1Tile:: db
+\1LastTile:: db
+\1MapX:: db
+\1MapY:: db
+\1LastMapX:: db
+\1LastMapY:: db
+\1InitX:: db
+\1InitY:: db
+\1Radius:: db
+\1SpriteX:: db
+\1SpriteY:: db
+\1SpriteXOffset:: db
+\1SpriteYOffset:: db
+\1MovementIndex:: db
+\1StepIndex:: db
+\1Field1d:: ds 1
+\1Field1e:: ds 1
+\1JumpHeight:: db
+\1Range:: db
ds 7
\1StructEnd::
ENDM
--- a/macros/rst.asm
+++ /dev/null
@@ -1,21 +1,0 @@
-MACRO farcall ; bank, address
- ld a, BANK(\1)
- ld hl, \1
- rst FarCall
-ENDM
-
-MACRO callfar ; address, bank
- ld hl, \1
- ld a, BANK(\1)
- rst FarCall
-ENDM
-
-MACRO homecall
- ldh a, [hROMBank]
- push af
- ld a, BANK(\1)
- rst Bankswitch
- call \1
- pop af
- rst Bankswitch
-ENDM
--- a/macros/vc.asm
+++ b/macros/vc.asm
@@ -1,3 +1,5 @@
+; Virtual Console macros
+
MACRO vc_hook
if DEF(_CRYSTAL11_VC)
.VC_\1::
--- a/ram/wram.asm
+++ b/ram/wram.asm
@@ -160,7 +160,7 @@
ds 2
-wMovementByteWasControlSwitch:: db
+wContinueReadingMovement:: db
UNION
wObjectPriorities:: ds NUM_OBJECT_STRUCTS
@@ -2381,8 +2381,8 @@
ENDU
wOverworldMapAnchor:: dw
-wMetatileStandingY:: db
-wMetatileStandingX:: db
+wPlayerMetatileY:: db
+wPlayerMetatileX:: db
wMapPartial::
wMapAttributesBank:: db