Rename the object_struct field labels and constants (#1005)

Fixes #990
This commit is contained in:
Rangi 2022-09-12 09:15:44 -04:00 committed by GitHub
parent 4c239a6f65
commit 41d5ea0482
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 442 additions and 431 deletions

View File

@ -1,43 +1,43 @@
; object_struct members (see macros/ram.asm) ; object_struct members (see macros/ram.asm)
rsreset rsreset
DEF OBJECT_SPRITE rb ; 00 DEF OBJECT_SPRITE rb ; 00
DEF OBJECT_MAP_OBJECT_INDEX rb ; 01 DEF OBJECT_MAP_OBJECT_INDEX rb ; 01
DEF OBJECT_SPRITE_TILE rb ; 02 DEF OBJECT_SPRITE_TILE rb ; 02
DEF OBJECT_MOVEMENTTYPE rb ; 03 DEF OBJECT_MOVEMENT_TYPE rb ; 03
DEF OBJECT_FLAGS1 rb ; 04 DEF OBJECT_FLAGS1 rb ; 04
DEF OBJECT_FLAGS2 rb ; 05 DEF OBJECT_FLAGS2 rb ; 05
DEF OBJECT_PALETTE rb ; 06 DEF OBJECT_PALETTE rb ; 06
DEF OBJECT_DIRECTION_WALKING rb ; 07 DEF OBJECT_WALKING rb ; 07
DEF OBJECT_FACING rb ; 08 DEF OBJECT_DIRECTION rb ; 08
DEF OBJECT_STEP_TYPE rb ; 09 DEF OBJECT_STEP_TYPE rb ; 09
DEF OBJECT_STEP_DURATION rb ; 0a DEF OBJECT_STEP_DURATION rb ; 0a
DEF OBJECT_ACTION rb ; 0b DEF OBJECT_ACTION rb ; 0b
DEF OBJECT_STEP_FRAME rb ; 0c DEF OBJECT_STEP_FRAME rb ; 0c
DEF OBJECT_FACING_STEP rb ; 0d DEF OBJECT_FACING rb ; 0d
DEF OBJECT_NEXT_TILE rb ; 0e DEF OBJECT_TILE rb ; 0e
DEF OBJECT_STANDING_TILE rb ; 0f DEF OBJECT_LAST_TILE rb ; 0f
DEF OBJECT_NEXT_MAP_X rb ; 10 DEF OBJECT_MAP_X rb ; 10
DEF OBJECT_NEXT_MAP_Y rb ; 11 DEF OBJECT_MAP_Y rb ; 11
DEF OBJECT_MAP_X rb ; 12 DEF OBJECT_LAST_MAP_X rb ; 12
DEF OBJECT_MAP_Y rb ; 13 DEF OBJECT_LAST_MAP_Y rb ; 13
DEF OBJECT_INIT_X rb ; 14 DEF OBJECT_INIT_X rb ; 14
DEF OBJECT_INIT_Y rb ; 15 DEF OBJECT_INIT_Y rb ; 15
DEF OBJECT_RADIUS rb ; 16 DEF OBJECT_RADIUS rb ; 16
DEF OBJECT_SPRITE_X rb ; 17 DEF OBJECT_SPRITE_X rb ; 17
DEF OBJECT_SPRITE_Y rb ; 18 DEF OBJECT_SPRITE_Y rb ; 18
DEF OBJECT_SPRITE_X_OFFSET rb ; 19 DEF OBJECT_SPRITE_X_OFFSET rb ; 19
DEF OBJECT_SPRITE_Y_OFFSET rb ; 1a DEF OBJECT_SPRITE_Y_OFFSET rb ; 1a
DEF OBJECT_MOVEMENT_BYTE_INDEX rb ; 1b DEF OBJECT_MOVEMENT_INDEX rb ; 1b
DEF OBJECT_1C rb ; 1c DEF OBJECT_STEP_INDEX rb ; 1c
DEF OBJECT_1D rb ; 1d DEF OBJECT_1D rb ; 1d
DEF OBJECT_1E rb ; 1e DEF OBJECT_1E rb ; 1e
DEF OBJECT_1F rb ; 1f DEF OBJECT_JUMP_HEIGHT rb ; 1f
DEF OBJECT_RANGE rb ; 20 DEF OBJECT_RANGE rb ; 20
rb_skip 7 rb_skip 7
DEF OBJECT_LENGTH EQU _RS DEF OBJECT_LENGTH EQU _RS
DEF NUM_OBJECT_STRUCTS EQU 13 ; see wObjectStructs 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_DOWN EQU DOWN << 2
DEF OW_UP EQU UP << 2 DEF OW_UP EQU UP << 2
DEF OW_LEFT EQU LEFT << 2 DEF OW_LEFT EQU LEFT << 2

View File

@ -145,13 +145,14 @@ DEF NUM_BGEVENTS EQU const_value
DEF NUM_OBJECT_TYPES EQU const_value DEF NUM_OBJECT_TYPES EQU const_value
; command queue members ; command queue members
DEF CMDQUEUE_TYPE EQU 0 rsreset
DEF CMDQUEUE_ADDR EQU 1 DEF CMDQUEUE_TYPE rb
DEF CMDQUEUE_02 EQU 2 DEF CMDQUEUE_ADDR rb
DEF CMDQUEUE_03 EQU 3 DEF CMDQUEUE_02 rb
DEF CMDQUEUE_04 EQU 4 DEF CMDQUEUE_03 rb
DEF CMDQUEUE_05 EQU 5 DEF CMDQUEUE_04 rb
DEF CMDQUEUE_ENTRY_SIZE EQU 6 DEF CMDQUEUE_JUMPTABLE_INDEX rb
DEF CMDQUEUE_ENTRY_SIZE EQU _RS
DEF CMDQUEUE_CAPACITY EQU 4 DEF CMDQUEUE_CAPACITY EQU 4
; HandleQueuedCommand.Jumptable indexes (see engine/overworld/events.asm) ; HandleQueuedCommand.Jumptable indexes (see engine/overworld/events.asm)

View File

@ -2074,7 +2074,7 @@ If `[wWalkingDirection]` is `STANDING` (`$FF`), this will check `[.EdgeWarps + $
ld d, 0 ld d, 0
ld hl, .EdgeWarps ld hl, .EdgeWarps
add hl, de add hl, de
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
cp [hl] cp [hl]
jr nz, .not_warp jr nz, .not_warp

View File

@ -234,12 +234,12 @@ Cut_SpawnLeaf:
Cut_GetLeafSpawnCoords: Cut_GetLeafSpawnCoords:
ld de, 0 ld de, 0
ld a, [wMetatileStandingX] ld a, [wPlayerMetatileX]
bit 0, a bit 0, a
jr z, .left_side jr z, .left_side
set 0, e set 0, e
.left_side .left_side
ld a, [wMetatileStandingY] ld a, [wPlayerMetatileY]
bit 0, a bit 0, a
jr z, .top_side jr z, .top_side
set 1, e set 1, e

View File

@ -686,7 +686,7 @@ Script_UsedWaterfall:
.CheckContinueWaterfall: .CheckContinueWaterfall:
xor a xor a
ld [wScriptVar], a ld [wScriptVar], a
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
call CheckWaterfallTile call CheckWaterfallTile
ret z ret z
farcall StubbedTrainerRankings_Waterfall farcall StubbedTrainerRankings_Waterfall
@ -1693,7 +1693,7 @@ BikeFunction:
jr .nope jr .nope
.ok .ok
call GetPlayerStandingTile call GetPlayerTile
and $f ; lo nybble only and $f ; lo nybble only
jr nz, .nope ; not FLOOR_TILE jr nz, .nope ; not FLOOR_TILE
xor a xor a

View File

@ -135,7 +135,7 @@ HandleQueuedCommand:
dba CmdQueue_Type4 dba CmdQueue_Type4
CmdQueues_AnonJumptable: CmdQueues_AnonJumptable:
ld hl, CMDQUEUE_05 ld hl, CMDQUEUE_JUMPTABLE_INDEX
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
pop hl pop hl
@ -143,13 +143,13 @@ CmdQueues_AnonJumptable:
ret ret
CmdQueues_IncAnonJumptableIndex: CmdQueues_IncAnonJumptableIndex:
ld hl, CMDQUEUE_05 ld hl, CMDQUEUE_JUMPTABLE_INDEX
add hl, bc add hl, bc
inc [hl] inc [hl]
ret ret
CmdQueues_DecAnonJumptableIndex: CmdQueues_DecAnonJumptableIndex:
ld hl, CMDQUEUE_05 ld hl, CMDQUEUE_JUMPTABLE_INDEX
add hl, bc add hl, bc
dec [hl] dec [hl]
ret ret
@ -241,7 +241,7 @@ CmdQueue_Type3:
.PlayerNotFacingDown: .PlayerNotFacingDown:
ld a, $7f ld a, $7f
ld [wd173], a ld [wd173], a
ld hl, CMDQUEUE_05 ld hl, CMDQUEUE_JUMPTABLE_INDEX
add hl, bc add hl, bc
ld [hl], 0 ld [hl], 0
ret ret
@ -266,19 +266,19 @@ CmdQueue_StoneTable:
and a and a
jr z, .next jr z, .next
ld hl, OBJECT_MOVEMENTTYPE ld hl, OBJECT_MOVEMENT_TYPE
add hl, de add hl, de
ld a, [hl] ld a, [hl]
cp SPRITEMOVEDATA_STRENGTH_BOULDER cp SPRITEMOVEDATA_STRENGTH_BOULDER
jr nz, .next jr nz, .next
ld hl, OBJECT_NEXT_TILE ld hl, OBJECT_TILE
add hl, de add hl, de
ld a, [hl] ld a, [hl]
call CheckPitTile call CheckPitTile
jr nz, .next jr nz, .next
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_WALKING
add hl, de add hl, de
ld a, [hl] ld a, [hl]
cp STANDING cp STANDING

View File

@ -349,7 +349,7 @@ CheckTileEvent:
ret ret
.warp_tile .warp_tile
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
call CheckPitTile call CheckPitTile
jr nz, .not_pit jr nz, .not_pit
ld a, PLAYEREVENT_FALL ld a, PLAYEREVENT_FALL
@ -1191,7 +1191,7 @@ CanUseSweetScent::
jr nc, .no jr nc, .no
.ice_check .ice_check
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
call CheckIceTile call CheckIceTile
jr z, .no jr z, .no
scf scf
@ -1262,7 +1262,7 @@ ChooseWildEncounter_BugContest::
ret ret
TryWildEncounter_BugContest: TryWildEncounter_BugContest:
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
call CheckSuperTallGrassTile call CheckSuperTallGrassTile
ld b, 40 percent ld b, 40 percent
jr z, .ok jr z, .ok

View File

@ -1,13 +1,13 @@
_LoadMapPart:: _LoadMapPart::
ld hl, wSurroundingTiles ld hl, wSurroundingTiles
ld a, [wMetatileStandingY] ld a, [wPlayerMetatileY]
and a and a
jr z, .top_row jr z, .top_row
ld bc, SURROUNDING_WIDTH * 2 ld bc, SURROUNDING_WIDTH * 2
add hl, bc add hl, bc
.top_row .top_row
ld a, [wMetatileStandingX] ld a, [wPlayerMetatileX]
and a and a
jr z, .left_column jr z, .left_column
inc hl inc hl

View File

@ -22,7 +22,7 @@ ObjectActionPairPointers:
assert_table_length NUM_OBJECT_ACTIONS assert_table_length NUM_OBJECT_ACTIONS
SetFacingStanding: SetFacingStanding:
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], STANDING ld [hl], STANDING
ret ret
@ -30,13 +30,13 @@ SetFacingStanding:
SetFacingCurrent: SetFacingCurrent:
call GetSpriteDirection call GetSpriteDirection
or FACING_STEP_DOWN_0 ; useless or FACING_STEP_DOWN_0 ; useless
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ret ret
SetFacingStandAction: SetFacingStandAction:
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
and 1 and 1
@ -64,7 +64,7 @@ SetFacingStepAction:
call GetSpriteDirection call GetSpriteDirection
or FACING_STEP_DOWN_0 ; useless or FACING_STEP_DOWN_0 ; useless
or d or d
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ret ret
@ -90,7 +90,7 @@ SetFacingSkyfall:
call GetSpriteDirection call GetSpriteDirection
or FACING_STEP_DOWN_0 ; useless or FACING_STEP_DOWN_0 ; useless
or d or d
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ret ret
@ -115,18 +115,18 @@ SetFacingBumpAction:
call GetSpriteDirection call GetSpriteDirection
or FACING_STEP_DOWN_0 ; useless or FACING_STEP_DOWN_0 ; useless
or d or d
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ret ret
SetFacingCounterclockwiseSpin: SetFacingCounterclockwiseSpin:
call CounterclockwiseSpinAction call CounterclockwiseSpinAction
ld hl, OBJECT_FACING ld hl, OBJECT_DIRECTION
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
or FACING_STEP_DOWN_0 ; useless or FACING_STEP_DOWN_0 ; useless
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ret ret
@ -169,7 +169,7 @@ CounterclockwiseSpinAction:
ld hl, .facings ld hl, .facings
add hl, de add hl, de
ld a, [hl] ld a, [hl]
ld hl, OBJECT_FACING ld hl, OBJECT_DIRECTION
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ret ret
@ -185,25 +185,25 @@ SetFacingFish:
rrca rrca
rrca rrca
add FACING_FISH_DOWN add FACING_FISH_DOWN
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ret ret
SetFacingShadow: SetFacingShadow:
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], FACING_SHADOW ld [hl], FACING_SHADOW
ret ret
SetFacingEmote: SetFacingEmote:
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], FACING_EMOTE ld [hl], FACING_EMOTE
ret ret
SetFacingBigDollSym: SetFacingBigDollSym:
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], FACING_BIG_DOLL_SYM ld [hl], FACING_BIG_DOLL_SYM
ret ret
@ -217,13 +217,13 @@ SetFacingBounce:
ld [hl], a ld [hl], a
and %00001000 and %00001000
jr z, SetFacingFreezeBounce jr z, SetFacingFreezeBounce
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], FACING_STEP_UP_0 ld [hl], FACING_STEP_UP_0
ret ret
SetFacingFreezeBounce: SetFacingFreezeBounce:
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], FACING_STEP_DOWN_0 ld [hl], FACING_STEP_DOWN_0
ret ret
@ -238,13 +238,13 @@ SetFacingWeirdTree:
rrca rrca
rrca rrca
add FACING_WEIRD_TREE_0 add FACING_WEIRD_TREE_0
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ret ret
SetFacingBigDollAsym: SetFacingBigDollAsym:
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], FACING_BIG_DOLL_ASYM ld [hl], FACING_BIG_DOLL_ASYM
ret ret
@ -259,7 +259,7 @@ SetFacingBigDoll:
ld d, FACING_BIG_DOLL_ASYM ; asymmetric ld d, FACING_BIG_DOLL_ASYM ; asymmetric
.ok .ok
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
ld [hl], d ld [hl], d
ret ret
@ -270,7 +270,7 @@ SetFacingBoulderDust:
inc [hl] inc [hl]
ld a, [hl] ld a, [hl]
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
and 2 and 2
ld a, FACING_BOULDER_DUST_1 ld a, FACING_BOULDER_DUST_1
@ -286,7 +286,7 @@ SetFacingGrassShake:
add hl, bc add hl, bc
inc [hl] inc [hl]
ld a, [hl] ld a, [hl]
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, bc add hl, bc
and 4 and 4
ld a, FACING_GRASS_1 ld a, FACING_GRASS_1

File diff suppressed because it is too large Load Diff

View File

@ -134,7 +134,7 @@ Movement_step_dig:
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
add hl, bc add hl, bc
ld [hl], STEP_TYPE_SLEEP ld [hl], STEP_TYPE_SLEEP
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_WALKING
add hl, bc add hl, bc
ld [hl], STANDING ld [hl], STANDING
ret ret
@ -150,7 +150,7 @@ Movement_return_dig:
ld hl, OBJECT_STEP_DURATION ld hl, OBJECT_STEP_DURATION
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_WALKING
add hl, bc add hl, bc
ld [hl], STANDING ld [hl], STANDING
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
@ -190,18 +190,18 @@ Movement_fish_cast_rod:
ret ret
Movement_step_loop: Movement_step_loop:
ld hl, OBJECT_MOVEMENT_BYTE_INDEX ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc add hl, bc
ld [hl], $0 ld [hl], $0
jp ContinueReadingMovement jp ContinueReadingMovement
Movement_step_end: Movement_step_end:
call RestoreDefaultMovement call RestoreDefaultMovement
ld hl, OBJECT_MOVEMENTTYPE ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ld hl, OBJECT_MOVEMENT_BYTE_INDEX ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc add hl, bc
ld [hl], $0 ld [hl], $0
@ -215,11 +215,11 @@ Movement_step_end:
Movement_48: Movement_48:
call RestoreDefaultMovement call RestoreDefaultMovement
ld hl, OBJECT_MOVEMENTTYPE ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc add hl, bc
ld [hl], a ld [hl], a
ld hl, OBJECT_MOVEMENT_BYTE_INDEX ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc add hl, bc
ld [hl], $0 ld [hl], $0
@ -314,7 +314,7 @@ Movement_step_sleep_common:
add hl, bc add hl, bc
ld [hl], OBJECT_ACTION_STAND ld [hl], OBJECT_ACTION_STAND
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_WALKING
add hl, bc add hl, bc
ld [hl], STANDING ld [hl], STANDING
ret ret
@ -333,7 +333,7 @@ Movement_step_bump:
add hl, bc add hl, bc
ld [hl], OBJECT_ACTION_BUMP ld [hl], OBJECT_ACTION_BUMP
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_WALKING
add hl, bc add hl, bc
ld [hl], STANDING ld [hl], STANDING
ret ret
@ -352,7 +352,7 @@ Movement_tree_shake:
add hl, bc add hl, bc
ld [hl], OBJECT_ACTION_WEIRD_TREE ld [hl], OBJECT_ACTION_WEIRD_TREE
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_WALKING
add hl, bc add hl, bc
ld [hl], STANDING ld [hl], STANDING
ret ret
@ -426,7 +426,7 @@ Movement_turn_head_right:
jr TurnHead jr TurnHead
TurnHead: TurnHead:
ld hl, OBJECT_FACING ld hl, OBJECT_DIRECTION
add hl, bc add hl, bc
ld [hl], a ld [hl], a
@ -434,7 +434,7 @@ TurnHead:
add hl, bc add hl, bc
ld [hl], OBJECT_ACTION_STAND ld [hl], OBJECT_ACTION_STAND
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_WALKING
add hl, bc add hl, bc
ld [hl], STANDING ld [hl], STANDING
ret ret
@ -668,7 +668,7 @@ NormalStep:
add hl, bc add hl, bc
ld [hl], OBJECT_ACTION_STEP ld [hl], OBJECT_ACTION_STEP
ld hl, OBJECT_NEXT_TILE ld hl, OBJECT_TILE
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
call CheckSuperTallGrassTile call CheckSuperTallGrassTile
@ -747,7 +747,7 @@ SlideStep:
JumpStep: JumpStep:
call InitStep call InitStep
ld hl, OBJECT_1F ld hl, OBJECT_JUMP_HEIGHT
add hl, bc add hl, bc
ld [hl], $0 ld [hl], $0

View File

@ -60,17 +60,17 @@ CanObjectMoveInDirection:
WillObjectBumpIntoWater: WillObjectBumpIntoWater:
call CanObjectLeaveTile call CanObjectLeaveTile
ret c ret c
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld d, [hl] ld d, [hl]
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld e, [hl] ld e, [hl]
ld hl, OBJECT_PALETTE ld hl, OBJECT_PALETTE
add hl, bc add hl, bc
bit OAM_PRIORITY, [hl] bit OAM_PRIORITY, [hl]
jp nz, WillObjectRemainOnWater jp nz, WillObjectRemainOnWater
ld hl, OBJECT_NEXT_TILE ld hl, OBJECT_TILE
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld d, a ld d, a
@ -83,7 +83,7 @@ WillObjectBumpIntoWater:
WillObjectBumpIntoLand: WillObjectBumpIntoLand:
call CanObjectLeaveTile call CanObjectLeaveTile
ret c ret c
ld hl, OBJECT_NEXT_TILE ld hl, OBJECT_TILE
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
call GetTileCollision call GetTileCollision
@ -93,13 +93,13 @@ WillObjectBumpIntoLand:
ret ret
WillObjectBumpIntoTile: WillObjectBumpIntoTile:
ld hl, OBJECT_NEXT_TILE ld hl, OBJECT_TILE
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
call GetSideWallDirectionMask call GetSideWallDirectionMask
ret nc ret nc
push af push af
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_WALKING
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
maskbits NUM_DIRECTIONS maskbits NUM_DIRECTIONS
@ -120,13 +120,13 @@ WillObjectBumpIntoTile:
db LEFT_MASK ; RIGHT db LEFT_MASK ; RIGHT
CanObjectLeaveTile: CanObjectLeaveTile:
ld hl, OBJECT_STANDING_TILE ld hl, OBJECT_LAST_TILE
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
call GetSideWallDirectionMask call GetSideWallDirectionMask
ret nc ret nc
push af push af
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_WALKING
add hl, bc add hl, bc
maskbits NUM_DIRECTIONS maskbits NUM_DIRECTIONS
ld e, a ld e, a
@ -177,7 +177,7 @@ GetSideWallDirectionMask:
db DOWN_MASK | LEFT_MASK ; COLL_UP_LEFT_WALL/BUOY db DOWN_MASK | LEFT_MASK ; COLL_UP_LEFT_WALL/BUOY
WillObjectRemainOnWater: WillObjectRemainOnWater:
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_WALKING
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
maskbits NUM_DIRECTIONS maskbits NUM_DIRECTIONS
@ -233,14 +233,14 @@ CheckFacingObject::
call CheckCounterTile call CheckCounterTile
jr nz, .not_counter jr nz, .not_counter
ld a, [wPlayerStandingMapX] ld a, [wPlayerMapX]
sub d sub d
cpl cpl
inc a inc a
add d add d
ld d, a ld d, a
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
sub e sub e
cpl cpl
inc a inc a
@ -253,7 +253,7 @@ CheckFacingObject::
ldh [hMapObjectIndex], a ldh [hMapObjectIndex], a
call IsNPCAtCoord call IsNPCAtCoord
ret nc ret nc
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_WALKING
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp STANDING cp STANDING
@ -266,10 +266,10 @@ CheckFacingObject::
ret ret
WillObjectBumpIntoSomeoneElse: WillObjectBumpIntoSomeoneElse:
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld d, [hl] ld d, [hl]
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld e, [hl] ld e, [hl]
jr IsNPCAtCoord jr IsNPCAtCoord
@ -282,10 +282,10 @@ IsObjectFacingSomeoneElse: ; unreferenced
ret ret
.GetFacingCoords: .GetFacingCoords:
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld d, [hl] ld d, [hl]
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld e, [hl] ld e, [hl]
call GetSpriteDirection call GetSpriteDirection
@ -333,12 +333,12 @@ IsNPCAtCoord:
jr .continue jr .continue
.not_big .not_big
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp d cp d
jr nz, .check_current_coords jr nz, .check_current_coords
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp e cp e
@ -352,12 +352,12 @@ IsNPCAtCoord:
jr nz, .yes jr nz, .yes
.check_current_coords .check_current_coords
ld hl, OBJECT_MAP_X ld hl, OBJECT_LAST_MAP_X
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp d cp d
jr nz, .next jr nz, .next
ld hl, OBJECT_MAP_Y ld hl, OBJECT_LAST_MAP_Y
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp e cp e
@ -402,7 +402,7 @@ HasObjectReachedMovementLimit:
ld a, [hl] ld a, [hl]
add e add e
ld e, a ld e, a
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp d cp d
@ -427,7 +427,7 @@ HasObjectReachedMovementLimit:
ld a, [hl] ld a, [hl]
add e add e
ld e, a ld e, a
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp d cp d
@ -444,7 +444,7 @@ HasObjectReachedMovementLimit:
ret ret
IsObjectMovingOffEdgeOfScreen: IsObjectMovingOffEdgeOfScreen:
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld a, [wXCoord] ld a, [wXCoord]
cp [hl] cp [hl]
@ -455,7 +455,7 @@ IsObjectMovingOffEdgeOfScreen:
jr c, .yes jr c, .yes
.check_y .check_y
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld a, [wYCoord] ld a, [wYCoord]
cp [hl] cp [hl]
@ -474,9 +474,9 @@ IsObjectMovingOffEdgeOfScreen:
ret ret
IsNPCAtPlayerCoord: ; unreferenced IsNPCAtPlayerCoord: ; unreferenced
ld a, [wPlayerStandingMapX] ld a, [wPlayerMapX]
ld d, a ld d, a
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
ld e, a ld e, a
ld bc, wObjectStructs ld bc, wObjectStructs
xor a xor a
@ -485,7 +485,7 @@ IsNPCAtPlayerCoord: ; unreferenced
call DoesObjectHaveASprite call DoesObjectHaveASprite
jr z, .next jr z, .next
ld hl, OBJECT_MOVEMENTTYPE ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp SPRITEMOVEDATA_BIGDOLLSYM cp SPRITEMOVEDATA_BIGDOLLSYM
@ -495,12 +495,12 @@ IsNPCAtPlayerCoord: ; unreferenced
jr .next jr .next
.not_big .not_big
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp e cp e
jr nz, .check_current_coords jr nz, .check_current_coords
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp d cp d
@ -511,12 +511,12 @@ IsNPCAtPlayerCoord: ; unreferenced
jr .yes jr .yes
.check_current_coords .check_current_coords
ld hl, OBJECT_MAP_Y ld hl, OBJECT_LAST_MAP_Y
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp e cp e
jr nz, .next jr nz, .next
ld hl, OBJECT_MAP_X ld hl, OBJECT_LAST_MAP_X
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp d cp d
@ -540,14 +540,14 @@ IsNPCAtPlayerCoord: ; unreferenced
ret ret
WillObjectIntersectBigObject: WillObjectIntersectBigObject:
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld a, d ld a, d
sub [hl] sub [hl]
jr c, .nope jr c, .nope
cp 2 ; big doll width cp 2 ; big doll width
jr nc, .nope jr nc, .nope
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld a, e ld a, e
sub [hl] sub [hl]

View File

@ -114,7 +114,7 @@ DoPlayerMovement::
; Tiles such as waterfalls and warps move the player ; Tiles such as waterfalls and warps move the player
; in a given direction, overriding input. ; in a given direction, overriding input.
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
ld c, a ld c, a
call CheckWhirlpoolTile call CheckWhirlpoolTile
jr c, .not_whirlpool jr c, .not_whirlpool
@ -270,7 +270,7 @@ DoPlayerMovement::
cp 2 cp 2
jr z, .bump jr z, .bump
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
call CheckIceTile call CheckIceTile
jr nc, .ice jr nc, .ice
@ -352,7 +352,7 @@ DoPlayerMovement::
ret ret
.TryJump: .TryJump:
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
ld e, a ld e, a
and $f0 and $f0
cp HI_NYBBLE_LEDGES cp HI_NYBBLE_LEDGES
@ -398,7 +398,7 @@ DoPlayerMovement::
ld d, 0 ld d, 0
ld hl, .EdgeWarps ld hl, .EdgeWarps
add hl, de add hl, de
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
cp [hl] cp [hl]
jr nz, .not_warp jr nz, .not_warp
@ -603,7 +603,7 @@ ENDM
.action_table: .action_table:
.action_table_1 .action_table_1
player_action STANDING, FACE_CURRENT, 0, 0, wPlayerStandingTile player_action STANDING, FACE_CURRENT, 0, 0, wPlayerTile
.action_table_1_end .action_table_1_end
player_action RIGHT, FACE_RIGHT, 1, 0, wTileRight player_action RIGHT, FACE_RIGHT, 1, 0, wTileRight
player_action LEFT, FACE_LEFT, -1, 0, wTileLeft player_action LEFT, FACE_LEFT, -1, 0, wTileLeft
@ -617,13 +617,13 @@ ENDM
ld a, 0 ld a, 0
ldh [hMapObjectIndex], a ldh [hMapObjectIndex], a
; Load the next X coordinate into d ; Load the next X coordinate into d
ld a, [wPlayerStandingMapX] ld a, [wPlayerMapX]
ld d, a ld d, a
ld a, [wWalkingX] ld a, [wWalkingX]
add d add d
ld d, a ld d, a
; Load the next Y coordinate into e ; Load the next Y coordinate into e
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
ld e, a ld e, a
ld a, [wWalkingY] ld a, [wWalkingY]
add e add e
@ -651,7 +651,7 @@ ENDM
bit BIKEFLAGS_STRENGTH_ACTIVE_F, [hl] bit BIKEFLAGS_STRENGTH_ACTIVE_F, [hl]
jr z, .not_boulder jr z, .not_boulder
ld hl, OBJECT_DIRECTION_WALKING ld hl, OBJECT_WALKING
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp STANDING cp STANDING
@ -788,7 +788,7 @@ CheckStandingOnIce::
jr z, .not_ice jr z, .not_ice
cp $f0 cp $f0
jr z, .not_ice jr z, .not_ice
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
call CheckIceTile call CheckIceTile
jr nc, .yep jr nc, .yep
ld a, [wPlayerState] ld a, [wPlayerState]

View File

@ -87,10 +87,10 @@ WriteObjectXY::
call CheckObjectVisibility call CheckObjectVisibility
ret c ret c
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld d, [hl] ld d, [hl]
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld e, [hl] ld e, [hl]
ldh a, [hMapObjectIndex] ldh a, [hMapObjectIndex]
@ -103,7 +103,7 @@ RefreshPlayerCoords:
ld a, [wXCoord] ld a, [wXCoord]
add 4 add 4
ld d, a ld d, a
ld hl, wPlayerStandingMapX ld hl, wPlayerMapX
sub [hl] sub [hl]
ld [hl], d ld [hl], d
ld hl, wMapObjects + MAPOBJECT_X_COORD ld hl, wMapObjects + MAPOBJECT_X_COORD
@ -114,7 +114,7 @@ RefreshPlayerCoords:
ld a, [wYCoord] ld a, [wYCoord]
add 4 add 4
ld e, a ld e, a
ld hl, wPlayerStandingMapY ld hl, wPlayerMapY
sub [hl] sub [hl]
ld [hl], e ld [hl], e
ld hl, wMapObjects + MAPOBJECT_Y_COORD ld hl, wMapObjects + MAPOBJECT_Y_COORD
@ -447,7 +447,7 @@ CopyTempObjectToObjectStruct:
add hl, de add hl, de
ld [hl], STEP_TYPE_RESET ld [hl], STEP_TYPE_RESET
ld hl, OBJECT_FACING_STEP ld hl, OBJECT_FACING
add hl, de add hl, de
ld [hl], STANDING ld [hl], STANDING
@ -467,7 +467,7 @@ CopyTempObjectToObjectStruct:
add hl, de add hl, de
ld [hl], a ld [hl], a
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, de add hl, de
ld [hl], a ld [hl], a
@ -486,7 +486,7 @@ CopyTempObjectToObjectStruct:
ld hl, OBJECT_INIT_X ld hl, OBJECT_INIT_X
add hl, de add hl, de
ld [hl], a ld [hl], a
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, de add hl, de
ld [hl], a ld [hl], a
ld hl, wXCoord ld hl, wXCoord
@ -557,19 +557,19 @@ TrainerWalkToPlayer:
call GetObjectStruct call GetObjectStruct
; get last talked coords, load to bc ; get last talked coords, load to bc
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld c, [hl] ld c, [hl]
ld b, a ld b, a
; get player coords, load to de ; get player coords, load to de
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, de add hl, de
ld a, [hl] ld a, [hl]
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, de add hl, de
ld e, [hl] ld e, [hl]
ld d, a ld d, a
@ -618,15 +618,15 @@ FollowNotExact::
ret c ret c
; object 2 is now in bc, object 1 is now in de ; 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 add hl, bc
ld a, [hl] ld a, [hl]
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld c, [hl] ld c, [hl]
ld b, a ld b, a
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, de add hl, de
ld a, [hl] ld a, [hl]
cp b cp b
@ -640,7 +640,7 @@ FollowNotExact::
jr .continue jr .continue
.same_x .same_x
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, de add hl, de
ld a, [hl] ld a, [hl]
cp c cp c
@ -653,7 +653,7 @@ FollowNotExact::
dec c dec c
.continue .continue
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, de add hl, de
ld [hl], b ld [hl], b
ld a, b ld a, b
@ -666,7 +666,7 @@ FollowNotExact::
ld hl, OBJECT_SPRITE_X ld hl, OBJECT_SPRITE_X
add hl, de add hl, de
ld [hl], a ld [hl], a
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, de add hl, de
ld [hl], c ld [hl], c
ld a, c ld a, c
@ -683,7 +683,7 @@ FollowNotExact::
ld hl, OBJECT_RANGE ld hl, OBJECT_RANGE
add hl, de add hl, de
ld [hl], a ld [hl], a
ld hl, OBJECT_MOVEMENTTYPE ld hl, OBJECT_MOVEMENT_TYPE
add hl, de add hl, de
ld [hl], SPRITEMOVEDATA_FOLLOWNOTEXACT ld [hl], SPRITEMOVEDATA_FOLLOWNOTEXACT
ld hl, OBJECT_STEP_TYPE ld hl, OBJECT_STEP_TYPE
@ -721,10 +721,10 @@ GetRelativeFacing::
; load the coordinates of object d into bc ; load the coordinates of object d into bc
ld a, d ld a, d
call GetObjectStruct call GetObjectStruct
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld c, [hl] ld c, [hl]
ld b, a ld b, a
@ -732,10 +732,10 @@ GetRelativeFacing::
; load the coordinates of object e into de ; load the coordinates of object e into de
ld a, e ld a, e
call GetObjectStruct call GetObjectStruct
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld d, [hl] ld d, [hl]
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld e, [hl] ld e, [hl]
pop bc pop bc
@ -813,15 +813,15 @@ QueueFollowerFirstStep:
.QueueFirstStep: .QueueFirstStep:
ld a, [wObjectFollow_Leader] ld a, [wObjectFollow_Leader]
call GetObjectStruct call GetObjectStruct
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld d, [hl] ld d, [hl]
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld e, [hl] ld e, [hl]
ld a, [wObjectFollow_Follower] ld a, [wObjectFollow_Follower]
call GetObjectStruct call GetObjectStruct
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, bc add hl, bc
ld a, d ld a, d
cp [hl] cp [hl]
@ -837,7 +837,7 @@ QueueFollowerFirstStep:
ret ret
.check_y .check_y
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, bc add hl, bc
ld a, e ld a, e
cp [hl] cp [hl]

View File

@ -158,7 +158,7 @@ UpdateOverworldMap:
or HIGH(vBGMap0) or HIGH(vBGMap0)
ld [wBGMapAnchor + 1], a ld [wBGMapAnchor + 1], a
.not_overflowed .not_overflowed
ld hl, wMetatileStandingY ld hl, wPlayerMetatileY
inc [hl] inc [hl]
ld a, [hl] ld a, [hl]
cp 2 ; was 1 cp 2 ; was 1
@ -189,7 +189,7 @@ UpdateOverworldMap:
or HIGH(vBGMap0) or HIGH(vBGMap0)
ld [wBGMapAnchor + 1], a ld [wBGMapAnchor + 1], a
.not_underflowed .not_underflowed
ld hl, wMetatileStandingY ld hl, wPlayerMetatileY
dec [hl] dec [hl]
ld a, [hl] ld a, [hl]
cp -1 ; was 0 cp -1 ; was 0
@ -221,7 +221,7 @@ UpdateOverworldMap:
and $1f and $1f
or d or d
ld [wBGMapAnchor], a ld [wBGMapAnchor], a
ld hl, wMetatileStandingX ld hl, wPlayerMetatileX
dec [hl] dec [hl]
ld a, [hl] ld a, [hl]
cp -1 cp -1
@ -250,7 +250,7 @@ UpdateOverworldMap:
and $1f and $1f
or d or d
ld [wBGMapAnchor], a ld [wBGMapAnchor], a
ld hl, wMetatileStandingX ld hl, wPlayerMetatileX
inc [hl] inc [hl]
ld a, [hl] ld a, [hl]
cp 2 cp 2

View File

@ -1,6 +1,6 @@
CheckWarpCollision:: CheckWarpCollision::
; Is this tile a warp? ; Is this tile a warp?
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
cp COLL_PIT cp COLL_PIT
jr z, .warp jr z, .warp
cp COLL_PIT_68 cp COLL_PIT_68
@ -18,7 +18,7 @@ CheckWarpCollision::
CheckDirectionalWarp:: CheckDirectionalWarp::
; If this is a directional warp, clear carry (press the designated button to warp). ; If this is a directional warp, clear carry (press the designated button to warp).
; Else, set carry (immediate warp). ; Else, set carry (immediate warp).
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
cp COLL_WARP_CARPET_DOWN cp COLL_WARP_CARPET_DOWN
jr z, .directional jr z, .directional
cp COLL_WARP_CARPET_LEFT cp COLL_WARP_CARPET_LEFT
@ -37,7 +37,7 @@ CheckDirectionalWarp::
CheckWarpFacingDown: CheckWarpFacingDown:
ld de, 1 ld de, 1
ld hl, .blocks ld hl, .blocks
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
call IsInArray call IsInArray
ret ret
@ -54,7 +54,7 @@ CheckWarpFacingDown:
db -1 db -1
CheckGrassCollision:: CheckGrassCollision::
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
ld hl, .blocks ld hl, .blocks
ld de, 1 ld de, 1
call IsInArray call IsInArray
@ -90,7 +90,7 @@ CheckCutCollision:
db -1 db -1
GetWarpSFX:: GetWarpSFX::
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
ld de, SFX_ENTER_DOOR ld de, SFX_ENTER_DOOR
cp COLL_DOOR cp COLL_DOOR
ret z ret z

View File

@ -346,7 +346,7 @@ CheckMovingOffEdgeOfMap::
ret ret
.down .down
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
sub 4 sub 4
ld b, a ld b, a
ld a, [wMapHeight] ld a, [wMapHeight]
@ -357,7 +357,7 @@ CheckMovingOffEdgeOfMap::
ret ret
.up .up
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
sub 4 sub 4
cp -1 cp -1
jr z, .ok jr z, .ok
@ -365,7 +365,7 @@ CheckMovingOffEdgeOfMap::
ret ret
.left .left
ld a, [wPlayerStandingMapX] ld a, [wPlayerMapX]
sub 4 sub 4
cp -1 cp -1
jr z, .ok jr z, .ok
@ -373,7 +373,7 @@ CheckMovingOffEdgeOfMap::
ret ret
.right .right
ld a, [wPlayerStandingMapX] ld a, [wPlayerMapX]
sub 4 sub 4
ld b, a ld b, a
ld a, [wMapWidth] ld a, [wMapWidth]
@ -425,8 +425,8 @@ GetMapScreenCoords::
ld [wOverworldMapAnchor + 1], a ld [wOverworldMapAnchor + 1], a
ld a, [wYCoord] ld a, [wYCoord]
and 1 and 1
ld [wMetatileStandingY], a ld [wPlayerMetatileY], a
ld a, [wXCoord] ld a, [wXCoord]
and 1 and 1
ld [wMetatileStandingX], a ld [wPlayerMetatileX], a
ret ret

View File

@ -246,10 +246,10 @@ GetDestinationWarpNumber::
ret ret
.GetDestinationWarpNumber: .GetDestinationWarpNumber:
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
sub 4 sub 4
ld e, a ld e, a
ld a, [wPlayerStandingMapX] ld a, [wPlayerMapX]
sub 4 sub 4
ld d, a ld d, a
ld a, [wCurMapWarpCount] ld a, [wCurMapWarpCount]
@ -1514,16 +1514,16 @@ GetMovementPermissions::
call .LeftRight call .LeftRight
call .UpDown call .UpDown
; get coords of current tile ; get coords of current tile
ld a, [wPlayerStandingMapX] ld a, [wPlayerMapX]
ld d, a ld d, a
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
ld e, a ld e, a
call GetCoordTile call GetCoordTile
ld [wPlayerStandingTile], a ld [wPlayerTile], a
call .CheckHiNybble call .CheckHiNybble
ret nz ret nz
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
and 7 and 7
ld hl, .MovementPermissionsData ld hl, .MovementPermissionsData
add l add l
@ -1548,9 +1548,9 @@ GetMovementPermissions::
db UP_MASK | LEFT_MASK db UP_MASK | LEFT_MASK
.UpDown: .UpDown:
ld a, [wPlayerStandingMapX] ld a, [wPlayerMapX]
ld d, a ld d, a
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
ld e, a ld e, a
push de push de
@ -1567,9 +1567,9 @@ GetMovementPermissions::
ret ret
.LeftRight: .LeftRight:
ld a, [wPlayerStandingMapX] ld a, [wPlayerMapX]
ld d, a ld d, a
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
ld e, a ld e, a
push de push de
@ -1688,10 +1688,10 @@ GetFacingTileCoord::
ld h, [hl] ld h, [hl]
ld l, a ld l, a
ld a, [wPlayerStandingMapX] ld a, [wPlayerMapX]
add d add d
ld d, a ld d, a
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
add e add e
ld e, a ld e, a
ld a, [hl] ld a, [hl]
@ -1861,10 +1861,10 @@ CheckCurrentMapCoordEvents::
call CheckScenes call CheckScenes
ld b, a 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. ; 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 sub 4
ld d, a ld d, a
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
sub 4 sub 4
ld e, a ld e, a

View File

@ -71,14 +71,14 @@ DoesSpriteHaveFacings::
pop de pop de
ret ret
GetPlayerStandingTile:: GetPlayerTile::
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
call GetTileCollision call GetTileCollision
ld b, a ld b, a
ret ret
CheckOnWater:: CheckOnWater::
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
call GetTileCollision call GetTileCollision
sub WATER_TILE sub WATER_TILE
ret z ret z
@ -189,7 +189,7 @@ CheckWaterfallTile::
ret ret
CheckStandingOnEntrance:: CheckStandingOnEntrance::
ld a, [wPlayerStandingTile] ld a, [wPlayerTile]
cp COLL_DOOR cp COLL_DOOR
ret z ret z
cp COLL_DOOR_79 cp COLL_DOOR_79
@ -404,7 +404,7 @@ LoadMovementDataPointer::
call CheckObjectVisibility call CheckObjectVisibility
ret c ret c
ld hl, OBJECT_MOVEMENTTYPE ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc add hl, bc
ld [hl], SPRITEMOVEDATA_SCRIPTED ld [hl], SPRITEMOVEDATA_SCRIPTED
@ -447,7 +447,7 @@ FindFirstEmptyObjectStruct::
ret ret
GetSpriteMovementFunction:: GetSpriteMovementFunction::
ld hl, OBJECT_MOVEMENTTYPE ld hl, OBJECT_MOVEMENT_TYPE
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
cp NUM_SPRITEMOVEDATA cp NUM_SPRITEMOVEDATA
@ -500,7 +500,7 @@ CopySpriteMovementData::
ret ret
.CopyData: .CopyData:
ld hl, OBJECT_MOVEMENTTYPE ld hl, OBJECT_MOVEMENT_TYPE
add hl, de add hl, de
ld [hl], a ld [hl], a
@ -520,7 +520,7 @@ endr
rlca rlca
rlca rlca
maskbits NUM_DIRECTIONS, 2 maskbits NUM_DIRECTIONS, 2
ld hl, OBJECT_FACING ld hl, OBJECT_DIRECTION
add hl, de add hl, de
ld [hl], a ld [hl], a
@ -549,16 +549,16 @@ endr
ld [hl], a ld [hl], a
ret ret
_GetMovementByte:: _GetMovementIndex::
; Switch to the movement data bank ; Switch to the movement data bank
ldh a, [hROMBank] ldh a, [hROMBank]
push af push af
ld a, [hli] ld a, [hli]
rst Bankswitch 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 a, [hli]
ld d, [hl] ld d, [hl]
ld hl, OBJECT_MOVEMENT_BYTE_INDEX ld hl, OBJECT_MOVEMENT_INDEX
add hl, bc add hl, bc
add [hl] add [hl]
ld e, a ld e, a
@ -611,7 +611,7 @@ DoesObjectHaveASprite::
SetSpriteDirection:: SetSpriteDirection::
; preserves other flags ; preserves other flags
push af push af
ld hl, OBJECT_FACING ld hl, OBJECT_DIRECTION
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
and %11110011 and %11110011
@ -623,7 +623,7 @@ SetSpriteDirection::
ret ret
GetSpriteDirection:: GetSpriteDirection::
ld hl, OBJECT_FACING ld hl, OBJECT_DIRECTION
add hl, bc add hl, bc
ld a, [hl] ld a, [hl]
maskbits NUM_DIRECTIONS, 2 maskbits NUM_DIRECTIONS, 2

View File

@ -38,10 +38,10 @@ HandleStoneQueue::
.IsObjectOnWarp: .IsObjectOnWarp:
push de push de
ld hl, OBJECT_NEXT_MAP_X ld hl, OBJECT_MAP_X
add hl, de add hl, de
ld a, [hl] ld a, [hl]
ld hl, OBJECT_NEXT_MAP_Y ld hl, OBJECT_MAP_Y
add hl, de add hl, de
ld e, [hl] ld e, [hl]

View File

@ -138,19 +138,19 @@ FacingPlayerDistance::
; Return carry if the sprite at bc is facing the player, ; Return carry if the sprite at bc is facing the player,
; its distance in d, and its direction in e. ; 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 add hl, bc
ld d, [hl] ld d, [hl]
ld hl, OBJECT_NEXT_MAP_Y ; y ld hl, OBJECT_MAP_Y ; y
add hl, bc add hl, bc
ld e, [hl] ld e, [hl]
ld a, [wPlayerStandingMapX] ld a, [wPlayerMapX]
cp d cp d
jr z, .CheckY jr z, .CheckY
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
cp e cp e
jr z, .CheckX jr z, .CheckX
@ -158,7 +158,7 @@ FacingPlayerDistance::
ret ret
.CheckY: .CheckY:
ld a, [wPlayerStandingMapY] ld a, [wPlayerMapY]
sub e sub e
jr z, .NotFacing jr z, .NotFacing
jr nc, .Above jr nc, .Above
@ -176,7 +176,7 @@ FacingPlayerDistance::
jr .CheckFacing jr .CheckFacing
.CheckX: .CheckX:
ld a, [wPlayerStandingMapX] ld a, [wPlayerMapX]
sub d sub d
jr z, .NotFacing jr z, .NotFacing
jr nc, .Left jr nc, .Left

View File

@ -1,7 +1,7 @@
INCLUDE "macros/asserts.asm" INCLUDE "macros/asserts.asm"
INCLUDE "macros/const.asm" INCLUDE "macros/const.asm"
INCLUDE "macros/predef.asm" INCLUDE "macros/predef.asm"
INCLUDE "macros/rst.asm" INCLUDE "macros/farcall.asm"
INCLUDE "macros/data.asm" INCLUDE "macros/data.asm"
INCLUDE "macros/code.asm" INCLUDE "macros/code.asm"
INCLUDE "macros/gfx.asm" INCLUDE "macros/gfx.asm"

View File

@ -1,3 +1,5 @@
; Coordinate macros
DEF hlcoord EQUS "coord hl," DEF hlcoord EQUS "coord hl,"
DEF bccoord EQUS "coord bc," DEF bccoord EQUS "coord bc,"
DEF decoord EQUS "coord de," DEF decoord EQUS "coord de,"

View File

@ -1,3 +1,5 @@
; Far calls to another bank
MACRO farcall ; bank, address MACRO farcall ; bank, address
ld a, BANK(\1) ld a, BANK(\1)
ld hl, \1 ld hl, \1

View File

@ -1,3 +1,5 @@
; Graphics macros
MACRO assert_valid_rgb MACRO assert_valid_rgb
rept _NARG rept _NARG
assert 0 <= (\1) && (\1) <= 31, "RGB channel must be 0-31" assert 0 <= (\1) && (\1) <= 31, "RGB channel must be 0-31"

View File

@ -2,7 +2,7 @@
; Allows porting scripts with as few edits as possible. ; Allows porting scripts with as few edits as possible.
; Legacy support not in this file can be found by looking for the keyword: "LEGACY" ; 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 callba EQUS "farcall"
DEF callab EQUS "callfar" DEF callab EQUS "callfar"

View File

@ -1,3 +1,5 @@
; Predef function calls
MACRO lda_predef MACRO lda_predef
; Some functions load the predef id ; Some functions load the predef id
; without immediately calling Predef. ; without immediately calling Predef.

View File

@ -1,4 +1,4 @@
; Used in wram.asm ; Structures in RAM
MACRO flag_array MACRO flag_array
ds ((\1) + 7) / 8 ds ((\1) + 7) / 8
@ -283,38 +283,38 @@ MACRO slot_reel
ENDM ENDM
MACRO object_struct MACRO object_struct
\1Sprite:: db \1Sprite:: db
\1MapObjectIndex:: db \1MapObjectIndex:: db
\1SpriteTile:: db \1SpriteTile:: db
\1MovementType:: db \1MovementType:: db
\1Flags:: dw \1Flags:: dw
\1Palette:: db \1Palette:: db
\1Walking:: db \1Walking:: db
\1Direction:: db \1Direction:: db
\1StepType:: db \1StepType:: db
\1StepDuration:: db \1StepDuration:: db
\1Action:: db \1Action:: db
\1ObjectStepFrame:: db \1StepFrame:: db
\1Facing:: db \1Facing:: db
\1StandingTile:: db ; collision \1Tile:: db
\1LastTile:: db ; collision \1LastTile:: db
\1StandingMapX:: db \1MapX:: db
\1StandingMapY:: db \1MapY:: db
\1LastMapX:: db \1LastMapX:: db
\1LastMapY:: db \1LastMapY:: db
\1ObjectInitX:: db \1InitX:: db
\1ObjectInitY:: db \1InitY:: db
\1Radius:: db \1Radius:: db
\1SpriteX:: db \1SpriteX:: db
\1SpriteY:: db \1SpriteY:: db
\1SpriteXOffset:: db \1SpriteXOffset:: db
\1SpriteYOffset:: db \1SpriteYOffset:: db
\1MovementByteIndex:: db \1MovementIndex:: db
\1Field1c:: ds 1 \1StepIndex:: db
\1Field1d:: ds 1 \1Field1d:: ds 1
\1Field1e:: ds 1 \1Field1e:: ds 1
\1Field1f:: ds 1 \1JumpHeight:: db
\1Range:: db \1Range:: db
ds 7 ds 7
\1StructEnd:: \1StructEnd::
ENDM ENDM

View File

@ -1,3 +1,5 @@
; Virtual Console macros
MACRO vc_hook MACRO vc_hook
if DEF(_CRYSTAL11_VC) if DEF(_CRYSTAL11_VC)
.VC_\1:: .VC_\1::

View File

@ -160,7 +160,7 @@ wIndexedMovement2Pointer:: dw
ds 2 ds 2
wMovementByteWasControlSwitch:: db wContinueReadingMovement:: db
UNION UNION
wObjectPriorities:: ds NUM_OBJECT_STRUCTS wObjectPriorities:: ds NUM_OBJECT_STRUCTS
@ -2381,8 +2381,8 @@ wd173:: db ; related to command queue type 3
ENDU ENDU
wOverworldMapAnchor:: dw wOverworldMapAnchor:: dw
wMetatileStandingY:: db wPlayerMetatileY:: db
wMetatileStandingX:: db wPlayerMetatileX:: db
wMapPartial:: wMapPartial::
wMapAttributesBank:: db wMapAttributesBank:: db