2024-07-16 17:02:54 +00:00
|
|
|
|
; only used for setting BIT_STANDING_ON_WARP of wMovementFlags upon entering a new map
|
2020-06-27 19:32:24 +00:00
|
|
|
|
IsPlayerStandingOnWarp::
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld a, [wNumberOfWarps]
|
|
|
|
|
and a
|
|
|
|
|
ret z
|
|
|
|
|
ld c, a
|
|
|
|
|
ld hl, wWarpEntries
|
|
|
|
|
.loop
|
|
|
|
|
ld a, [wYCoord]
|
|
|
|
|
cp [hl]
|
|
|
|
|
jr nz, .nextWarp1
|
|
|
|
|
inc hl
|
|
|
|
|
ld a, [wXCoord]
|
|
|
|
|
cp [hl]
|
|
|
|
|
jr nz, .nextWarp2
|
|
|
|
|
inc hl
|
|
|
|
|
ld a, [hli] ; target warp
|
|
|
|
|
ld [wDestinationWarpID], a
|
|
|
|
|
ld a, [hl] ; target map
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh [hWarpDestinationMap], a
|
2024-07-16 17:02:54 +00:00
|
|
|
|
ld hl, wMovementFlags
|
|
|
|
|
set BIT_STANDING_ON_WARP, [hl]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ret
|
|
|
|
|
.nextWarp1
|
|
|
|
|
inc hl
|
|
|
|
|
.nextWarp2
|
|
|
|
|
inc hl
|
|
|
|
|
inc hl
|
|
|
|
|
inc hl
|
|
|
|
|
dec c
|
|
|
|
|
jr nz, .loop
|
|
|
|
|
ret
|
|
|
|
|
|
2020-06-27 19:32:24 +00:00
|
|
|
|
CheckForceBikeOrSurf::
|
2024-07-16 17:02:54 +00:00
|
|
|
|
ld hl, wStatusFlags6
|
|
|
|
|
bit BIT_ALWAYS_ON_BIKE, [hl]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ret nz
|
|
|
|
|
ld hl, ForcedBikeOrSurfMaps
|
|
|
|
|
ld a, [wYCoord]
|
|
|
|
|
ld b, a
|
|
|
|
|
ld a, [wXCoord]
|
|
|
|
|
ld c, a
|
|
|
|
|
ld a, [wCurMap]
|
|
|
|
|
ld d, a
|
|
|
|
|
.loop
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
cp $ff
|
2024-07-16 17:02:54 +00:00
|
|
|
|
ret z ; if we reach FF then it's not part of the list
|
|
|
|
|
cp d ; compare to current map
|
2017-01-01 01:23:54 +00:00
|
|
|
|
jr nz, .incorrectMap
|
|
|
|
|
ld a, [hli]
|
2024-07-16 17:02:54 +00:00
|
|
|
|
cp b ; compare y-coord
|
2017-01-01 01:23:54 +00:00
|
|
|
|
jr nz, .incorrectY
|
|
|
|
|
ld a, [hli]
|
2024-07-16 17:02:54 +00:00
|
|
|
|
cp c ; compare x-coord
|
2017-01-01 01:23:54 +00:00
|
|
|
|
jr nz, .loop ; incorrect x-coord, check next item
|
|
|
|
|
ld a, [wCurMap]
|
2019-01-01 20:06:23 +00:00
|
|
|
|
cp SEAFOAM_ISLANDS_B3F
|
2023-07-14 01:27:56 +00:00
|
|
|
|
ld a, SCRIPT_SEAFOAMISLANDSB3F_MOVE_OBJECT
|
2019-01-01 20:06:23 +00:00
|
|
|
|
ld [wSeafoamIslandsB3FCurScript], a
|
2017-01-01 01:23:54 +00:00
|
|
|
|
jr z, .forceSurfing
|
|
|
|
|
ld a, [wCurMap]
|
2019-01-01 20:06:23 +00:00
|
|
|
|
cp SEAFOAM_ISLANDS_B4F
|
2023-07-14 01:27:56 +00:00
|
|
|
|
ld a, SCRIPT_SEAFOAMISLANDSB4F_MOVE_OBJECT
|
2019-01-01 20:06:23 +00:00
|
|
|
|
ld [wSeafoamIslandsB4FCurScript], a
|
2017-01-01 01:23:54 +00:00
|
|
|
|
jr z, .forceSurfing
|
2024-07-16 17:02:54 +00:00
|
|
|
|
ld hl, wStatusFlags6
|
|
|
|
|
set BIT_ALWAYS_ON_BIKE, [hl]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld a, $1
|
|
|
|
|
ld [wWalkBikeSurfState], a
|
|
|
|
|
ld [wWalkBikeSurfStateCopy], a
|
|
|
|
|
jp ForceBikeOrSurf
|
|
|
|
|
.incorrectMap
|
|
|
|
|
inc hl
|
|
|
|
|
.incorrectY
|
|
|
|
|
inc hl
|
|
|
|
|
jr .loop
|
|
|
|
|
.forceSurfing
|
|
|
|
|
ld a, $2
|
|
|
|
|
ld [wWalkBikeSurfState], a
|
|
|
|
|
ld [wWalkBikeSurfStateCopy], a
|
|
|
|
|
jp ForceBikeOrSurf
|
|
|
|
|
|
2020-07-03 15:51:00 +00:00
|
|
|
|
INCLUDE "data/maps/force_bike_surf.asm"
|
2017-01-01 01:23:54 +00:00
|
|
|
|
|
2020-06-27 19:32:24 +00:00
|
|
|
|
IsPlayerFacingEdgeOfMap::
|
2017-01-01 01:23:54 +00:00
|
|
|
|
push hl
|
|
|
|
|
push de
|
|
|
|
|
push bc
|
2020-07-05 21:29:11 +00:00
|
|
|
|
ld a, [wSpritePlayerStateData1FacingDirection]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
srl a
|
|
|
|
|
ld c, a
|
|
|
|
|
ld b, $0
|
|
|
|
|
ld hl, .functionPointerTable
|
|
|
|
|
add hl, bc
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld h, [hl]
|
|
|
|
|
ld l, a
|
|
|
|
|
ld a, [wYCoord]
|
|
|
|
|
ld b, a
|
|
|
|
|
ld a, [wXCoord]
|
|
|
|
|
ld c, a
|
2022-07-11 01:11:03 +00:00
|
|
|
|
ld de, .return
|
2017-01-01 01:23:54 +00:00
|
|
|
|
push de
|
2017-06-09 21:54:09 +00:00
|
|
|
|
jp hl
|
2022-07-11 01:11:03 +00:00
|
|
|
|
.return
|
2017-01-01 01:23:54 +00:00
|
|
|
|
pop bc
|
|
|
|
|
pop de
|
|
|
|
|
pop hl
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
.functionPointerTable
|
|
|
|
|
dw .facingDown
|
|
|
|
|
dw .facingUp
|
|
|
|
|
dw .facingLeft
|
|
|
|
|
dw .facingRight
|
|
|
|
|
|
|
|
|
|
.facingDown
|
|
|
|
|
ld a, [wCurMapHeight]
|
|
|
|
|
add a
|
|
|
|
|
dec a
|
|
|
|
|
cp b
|
|
|
|
|
jr z, .setCarry
|
|
|
|
|
jr .resetCarry
|
|
|
|
|
|
|
|
|
|
.facingUp
|
|
|
|
|
ld a, b
|
|
|
|
|
and a
|
|
|
|
|
jr z, .setCarry
|
|
|
|
|
jr .resetCarry
|
|
|
|
|
|
|
|
|
|
.facingLeft
|
|
|
|
|
ld a, c
|
|
|
|
|
and a
|
|
|
|
|
jr z, .setCarry
|
|
|
|
|
jr .resetCarry
|
|
|
|
|
|
|
|
|
|
.facingRight
|
|
|
|
|
ld a, [wCurMapWidth]
|
|
|
|
|
add a
|
|
|
|
|
dec a
|
|
|
|
|
cp c
|
|
|
|
|
jr z, .setCarry
|
|
|
|
|
jr .resetCarry
|
|
|
|
|
.resetCarry
|
|
|
|
|
and a
|
|
|
|
|
ret
|
|
|
|
|
.setCarry
|
|
|
|
|
scf
|
|
|
|
|
ret
|
|
|
|
|
|
2020-06-27 19:32:24 +00:00
|
|
|
|
IsWarpTileInFrontOfPlayer::
|
2017-01-01 01:23:54 +00:00
|
|
|
|
push hl
|
|
|
|
|
push de
|
|
|
|
|
push bc
|
|
|
|
|
call _GetTileAndCoordsInFrontOfPlayer
|
|
|
|
|
ld a, [wCurMap]
|
2019-01-01 20:06:23 +00:00
|
|
|
|
cp SS_ANNE_BOW
|
2020-06-23 21:50:50 +00:00
|
|
|
|
jr z, IsSSAnneBowWarpTileInFrontOfPlayer
|
2020-07-05 21:29:11 +00:00
|
|
|
|
ld a, [wSpritePlayerStateData1FacingDirection]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
srl a
|
|
|
|
|
ld c, a
|
|
|
|
|
ld b, 0
|
2020-06-23 21:50:50 +00:00
|
|
|
|
ld hl, WarpTileListPointers
|
2017-01-01 01:23:54 +00:00
|
|
|
|
add hl, bc
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld h, [hl]
|
|
|
|
|
ld l, a
|
|
|
|
|
ld a, [wTileInFrontOfPlayer]
|
|
|
|
|
ld de, $1
|
|
|
|
|
call IsInArray
|
|
|
|
|
.done
|
|
|
|
|
pop bc
|
|
|
|
|
pop de
|
|
|
|
|
pop hl
|
|
|
|
|
ret
|
|
|
|
|
|
2020-07-03 15:51:00 +00:00
|
|
|
|
INCLUDE "data/tilesets/warp_carpet_tile_ids.asm"
|
2017-01-01 01:23:54 +00:00
|
|
|
|
|
2020-06-23 21:50:50 +00:00
|
|
|
|
IsSSAnneBowWarpTileInFrontOfPlayer:
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld a, [wTileInFrontOfPlayer]
|
|
|
|
|
cp $15
|
|
|
|
|
jr nz, .notSSAnne5Warp
|
|
|
|
|
scf
|
2020-06-23 21:50:50 +00:00
|
|
|
|
jr IsWarpTileInFrontOfPlayer.done
|
2017-01-01 01:23:54 +00:00
|
|
|
|
.notSSAnne5Warp
|
|
|
|
|
and a
|
2020-06-23 21:50:50 +00:00
|
|
|
|
jr IsWarpTileInFrontOfPlayer.done
|
2017-01-01 01:23:54 +00:00
|
|
|
|
|
2020-06-27 19:32:24 +00:00
|
|
|
|
IsPlayerStandingOnDoorTileOrWarpTile::
|
2017-01-01 01:23:54 +00:00
|
|
|
|
push hl
|
|
|
|
|
push de
|
|
|
|
|
push bc
|
2020-07-07 01:18:22 +00:00
|
|
|
|
farcall IsPlayerStandingOnDoorTile
|
2017-01-01 01:23:54 +00:00
|
|
|
|
jr c, .done
|
|
|
|
|
ld a, [wCurMapTileset]
|
|
|
|
|
add a
|
|
|
|
|
ld c, a
|
|
|
|
|
ld b, $0
|
|
|
|
|
ld hl, WarpTileIDPointers
|
|
|
|
|
add hl, bc
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld h, [hl]
|
|
|
|
|
ld l, a
|
|
|
|
|
ld de, $1
|
2020-07-07 15:30:10 +00:00
|
|
|
|
lda_coord 8, 9
|
2017-01-01 01:23:54 +00:00
|
|
|
|
call IsInArray
|
|
|
|
|
jr nc, .done
|
2024-07-16 17:02:54 +00:00
|
|
|
|
ld hl, wMovementFlags
|
|
|
|
|
res BIT_STANDING_ON_WARP, [hl]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
.done
|
|
|
|
|
pop bc
|
|
|
|
|
pop de
|
|
|
|
|
pop hl
|
|
|
|
|
ret
|
|
|
|
|
|
2020-07-03 15:51:00 +00:00
|
|
|
|
INCLUDE "data/tilesets/warp_tile_ids.asm"
|
2017-01-01 01:23:54 +00:00
|
|
|
|
|
2020-06-27 19:32:24 +00:00
|
|
|
|
PrintSafariZoneSteps::
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld a, [wCurMap]
|
|
|
|
|
cp SAFARI_ZONE_EAST
|
|
|
|
|
ret c
|
2019-01-01 20:06:23 +00:00
|
|
|
|
cp CERULEAN_CAVE_2F
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ret nc
|
2020-07-07 15:30:10 +00:00
|
|
|
|
hlcoord 0, 0
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld b, 3
|
|
|
|
|
ld c, 7
|
|
|
|
|
call TextBoxBorder
|
2020-07-07 15:30:10 +00:00
|
|
|
|
hlcoord 1, 1
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld de, wSafariSteps
|
|
|
|
|
lb bc, 2, 3
|
|
|
|
|
call PrintNumber
|
2020-07-07 15:30:10 +00:00
|
|
|
|
hlcoord 4, 1
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld de, SafariSteps
|
|
|
|
|
call PlaceString
|
2020-07-07 15:30:10 +00:00
|
|
|
|
hlcoord 1, 3
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld de, SafariBallText
|
|
|
|
|
call PlaceString
|
|
|
|
|
ld a, [wNumSafariBalls]
|
|
|
|
|
cp 10
|
2022-07-11 01:11:03 +00:00
|
|
|
|
jr nc, .tenOrMore
|
2020-07-07 15:30:10 +00:00
|
|
|
|
hlcoord 5, 3
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld a, " "
|
|
|
|
|
ld [hl], a
|
2022-07-11 01:11:03 +00:00
|
|
|
|
.tenOrMore
|
2020-07-07 15:30:10 +00:00
|
|
|
|
hlcoord 6, 3
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld de, wNumSafariBalls
|
|
|
|
|
lb bc, 1, 2
|
|
|
|
|
jp PrintNumber
|
|
|
|
|
|
|
|
|
|
SafariSteps:
|
|
|
|
|
db "/500@"
|
|
|
|
|
|
|
|
|
|
SafariBallText:
|
|
|
|
|
db "BALL×× @"
|
|
|
|
|
|
|
|
|
|
GetTileAndCoordsInFrontOfPlayer:
|
|
|
|
|
call GetPredefRegisters
|
|
|
|
|
|
|
|
|
|
_GetTileAndCoordsInFrontOfPlayer:
|
|
|
|
|
ld a, [wYCoord]
|
|
|
|
|
ld d, a
|
|
|
|
|
ld a, [wXCoord]
|
|
|
|
|
ld e, a
|
2020-07-05 21:29:11 +00:00
|
|
|
|
ld a, [wSpritePlayerStateData1FacingDirection]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
and a ; cp SPRITE_FACING_DOWN
|
|
|
|
|
jr nz, .notFacingDown
|
|
|
|
|
; facing down
|
2020-07-07 15:30:10 +00:00
|
|
|
|
lda_coord 8, 11
|
2017-01-01 01:23:54 +00:00
|
|
|
|
inc d
|
|
|
|
|
jr .storeTile
|
|
|
|
|
.notFacingDown
|
|
|
|
|
cp SPRITE_FACING_UP
|
|
|
|
|
jr nz, .notFacingUp
|
|
|
|
|
; facing up
|
2020-07-07 15:30:10 +00:00
|
|
|
|
lda_coord 8, 7
|
2017-01-01 01:23:54 +00:00
|
|
|
|
dec d
|
|
|
|
|
jr .storeTile
|
|
|
|
|
.notFacingUp
|
|
|
|
|
cp SPRITE_FACING_LEFT
|
|
|
|
|
jr nz, .notFacingLeft
|
|
|
|
|
; facing left
|
2020-07-07 15:30:10 +00:00
|
|
|
|
lda_coord 6, 9
|
2017-01-01 01:23:54 +00:00
|
|
|
|
dec e
|
|
|
|
|
jr .storeTile
|
|
|
|
|
.notFacingLeft
|
|
|
|
|
cp SPRITE_FACING_RIGHT
|
|
|
|
|
jr nz, .storeTile
|
|
|
|
|
; facing right
|
2020-07-07 15:30:10 +00:00
|
|
|
|
lda_coord 10, 9
|
2017-01-01 01:23:54 +00:00
|
|
|
|
inc e
|
|
|
|
|
.storeTile
|
|
|
|
|
ld c, a
|
|
|
|
|
ld [wTileInFrontOfPlayer], a
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
GetTileTwoStepsInFrontOfPlayer:
|
|
|
|
|
xor a
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh [hPlayerFacing], a
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld hl, wYCoord
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld d, a
|
|
|
|
|
ld e, [hl]
|
2020-07-05 21:29:11 +00:00
|
|
|
|
ld a, [wSpritePlayerStateData1FacingDirection]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
and a ; cp SPRITE_FACING_DOWN
|
|
|
|
|
jr nz, .notFacingDown
|
|
|
|
|
; facing down
|
2020-07-04 02:11:35 +00:00
|
|
|
|
ld hl, hPlayerFacing
|
2017-01-01 01:23:54 +00:00
|
|
|
|
set 0, [hl]
|
2020-07-07 15:30:10 +00:00
|
|
|
|
lda_coord 8, 13
|
2017-01-01 01:23:54 +00:00
|
|
|
|
inc d
|
|
|
|
|
jr .storeTile
|
|
|
|
|
.notFacingDown
|
|
|
|
|
cp SPRITE_FACING_UP
|
|
|
|
|
jr nz, .notFacingUp
|
|
|
|
|
; facing up
|
2020-07-04 02:11:35 +00:00
|
|
|
|
ld hl, hPlayerFacing
|
2017-01-01 01:23:54 +00:00
|
|
|
|
set 1, [hl]
|
2020-07-07 15:30:10 +00:00
|
|
|
|
lda_coord 8, 5
|
2017-01-01 01:23:54 +00:00
|
|
|
|
dec d
|
|
|
|
|
jr .storeTile
|
|
|
|
|
.notFacingUp
|
|
|
|
|
cp SPRITE_FACING_LEFT
|
|
|
|
|
jr nz, .notFacingLeft
|
|
|
|
|
; facing left
|
2020-07-04 02:11:35 +00:00
|
|
|
|
ld hl, hPlayerFacing
|
2017-01-01 01:23:54 +00:00
|
|
|
|
set 2, [hl]
|
2020-07-07 15:30:10 +00:00
|
|
|
|
lda_coord 4, 9
|
2017-01-01 01:23:54 +00:00
|
|
|
|
dec e
|
|
|
|
|
jr .storeTile
|
|
|
|
|
.notFacingLeft
|
|
|
|
|
cp SPRITE_FACING_RIGHT
|
|
|
|
|
jr nz, .storeTile
|
|
|
|
|
; facing right
|
2020-07-04 02:11:35 +00:00
|
|
|
|
ld hl, hPlayerFacing
|
2017-01-01 01:23:54 +00:00
|
|
|
|
set 3, [hl]
|
2020-07-07 15:30:10 +00:00
|
|
|
|
lda_coord 12, 9
|
2017-01-01 01:23:54 +00:00
|
|
|
|
inc e
|
|
|
|
|
.storeTile
|
|
|
|
|
ld c, a
|
|
|
|
|
ld [wTileInFrontOfBoulderAndBoulderCollisionResult], a
|
|
|
|
|
ld [wTileInFrontOfPlayer], a
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
CheckForCollisionWhenPushingBoulder:
|
|
|
|
|
call GetTileTwoStepsInFrontOfPlayer
|
|
|
|
|
ld hl, wTilesetCollisionPtr
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld h, [hl]
|
|
|
|
|
ld l, a
|
|
|
|
|
.loop
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
cp $ff
|
|
|
|
|
jr z, .done ; if the tile two steps ahead is not passable
|
|
|
|
|
cp c
|
|
|
|
|
jr nz, .loop
|
|
|
|
|
ld hl, TilePairCollisionsLand
|
|
|
|
|
call CheckForTilePairCollisions2
|
|
|
|
|
ld a, $ff
|
|
|
|
|
jr c, .done ; if there is an elevation difference between the current tile and the one two steps ahead
|
|
|
|
|
ld a, [wTileInFrontOfBoulderAndBoulderCollisionResult]
|
|
|
|
|
cp $15 ; stairs tile
|
|
|
|
|
ld a, $ff
|
|
|
|
|
jr z, .done ; if the tile two steps ahead is stairs
|
|
|
|
|
call CheckForBoulderCollisionWithSprites
|
|
|
|
|
.done
|
|
|
|
|
ld [wTileInFrontOfBoulderAndBoulderCollisionResult], a
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
; sets a to $ff if there is a collision and $00 if there is no collision
|
|
|
|
|
CheckForBoulderCollisionWithSprites:
|
|
|
|
|
ld a, [wBoulderSpriteIndex]
|
|
|
|
|
dec a
|
|
|
|
|
swap a
|
|
|
|
|
ld d, 0
|
|
|
|
|
ld e, a
|
2020-07-05 21:29:11 +00:00
|
|
|
|
ld hl, wSprite01StateData2MapY
|
2017-01-01 01:23:54 +00:00
|
|
|
|
add hl, de
|
|
|
|
|
ld a, [hli] ; map Y position
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh [hPlayerYCoord], a
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld a, [hl] ; map X position
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh [hPlayerXCoord], a
|
2017-01-01 01:23:54 +00:00
|
|
|
|
ld a, [wNumSprites]
|
|
|
|
|
ld c, a
|
|
|
|
|
ld de, $f
|
2020-07-05 21:29:11 +00:00
|
|
|
|
ld hl, wSprite01StateData2MapY
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh a, [hPlayerFacing]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
and $3 ; facing up or down?
|
|
|
|
|
jr z, .pushingHorizontallyLoop
|
|
|
|
|
.pushingVerticallyLoop
|
|
|
|
|
inc hl
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh a, [hPlayerXCoord]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
cp [hl]
|
|
|
|
|
jr nz, .nextSprite1 ; if X coordinates don't match
|
|
|
|
|
dec hl
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld b, a
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh a, [hPlayerFacing]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
rrca
|
|
|
|
|
jr c, .pushingDown
|
|
|
|
|
; pushing up
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh a, [hPlayerYCoord]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
dec a
|
|
|
|
|
jr .compareYCoords
|
|
|
|
|
.pushingDown
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh a, [hPlayerYCoord]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
inc a
|
|
|
|
|
.compareYCoords
|
|
|
|
|
cp b
|
|
|
|
|
jr z, .failure
|
|
|
|
|
.nextSprite1
|
|
|
|
|
dec c
|
|
|
|
|
jr z, .success
|
|
|
|
|
add hl, de
|
|
|
|
|
jr .pushingVerticallyLoop
|
|
|
|
|
.pushingHorizontallyLoop
|
|
|
|
|
ld a, [hli]
|
|
|
|
|
ld b, a
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh a, [hPlayerYCoord]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
cp b
|
|
|
|
|
jr nz, .nextSprite2
|
|
|
|
|
ld b, [hl]
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh a, [hPlayerFacing]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
bit 2, a
|
|
|
|
|
jr nz, .pushingLeft
|
|
|
|
|
; pushing right
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh a, [hPlayerXCoord]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
inc a
|
|
|
|
|
jr .compareXCoords
|
|
|
|
|
.pushingLeft
|
2020-07-06 23:03:05 +00:00
|
|
|
|
ldh a, [hPlayerXCoord]
|
2017-01-01 01:23:54 +00:00
|
|
|
|
dec a
|
|
|
|
|
.compareXCoords
|
|
|
|
|
cp b
|
|
|
|
|
jr z, .failure
|
|
|
|
|
.nextSprite2
|
|
|
|
|
dec c
|
|
|
|
|
jr z, .success
|
|
|
|
|
add hl, de
|
|
|
|
|
jr .pushingHorizontallyLoop
|
|
|
|
|
.failure
|
|
|
|
|
ld a, $ff
|
|
|
|
|
ret
|
|
|
|
|
.success
|
|
|
|
|
xor a
|
|
|
|
|
ret
|