aboutsummaryrefslogtreecommitdiffstats
path: root/engine/overworld/player_state.asm
diff options
context:
space:
mode:
authordannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
committerdannye <33dannye@gmail.com>2020-11-04 00:06:44 -0600
commit5647ca687b92954dcf37a6ea6bfbc9a341c32de4 (patch)
treedde1937a1bfdb3a835f4155e1c2eb8f1aaf86f63 /engine/overworld/player_state.asm
parentMerge pull request #55 from Deokishisu/patch-1 (diff)
downloadpokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.tar.gz
pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.tar.xz
pokeyellow-5647ca687b92954dcf37a6ea6bfbc9a341c32de4.zip
Sync with pokered
Diffstat (limited to 'engine/overworld/player_state.asm')
-rw-r--r--engine/overworld/player_state.asm122
1 files changed, 53 insertions, 69 deletions
diff --git a/engine/overworld/player_state.asm b/engine/overworld/player_state.asm
index 8cbacc61..c966c128 100644
--- a/engine/overworld/player_state.asm
+++ b/engine/overworld/player_state.asm
@@ -1,5 +1,5 @@
; only used for setting bit 2 of wd736 upon entering a new map
-IsPlayerStandingOnWarp:
+IsPlayerStandingOnWarp::
ld a, [wNumberOfWarps]
and a
ret z
@@ -17,7 +17,7 @@ IsPlayerStandingOnWarp:
ld a, [hli] ; target warp
ld [wDestinationWarpID], a
ld a, [hl] ; target map
- ld [hWarpDestinationMap], a
+ ldh [hWarpDestinationMap], a
ld hl, wd736
set 2, [hl] ; standing on warp flag
ret
@@ -31,7 +31,7 @@ IsPlayerStandingOnWarp:
jr nz, .loop
ret
-CheckForceBikeOrSurf:
+CheckForceBikeOrSurf::
ld hl, wd732
bit 5, [hl]
ret nz
@@ -84,13 +84,13 @@ CheckForceBikeOrSurf:
call ForceBikeOrSurf
ret
-INCLUDE "data/force_bike_surf.asm"
+INCLUDE "data/maps/force_bike_surf.asm"
-IsPlayerFacingEdgeOfMap:
+IsPlayerFacingEdgeOfMap::
push hl
push de
push bc
- ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction
+ ld a, [wSpritePlayerStateData1FacingDirection]
srl a
ld c, a
ld b, $0
@@ -152,19 +152,19 @@ IsPlayerFacingEdgeOfMap:
scf
ret
-IsWarpTileInFrontOfPlayer:
+IsWarpTileInFrontOfPlayer::
push hl
push de
push bc
call _GetTileAndCoordsInFrontOfPlayer
ld a, [wCurMap]
cp SS_ANNE_BOW
- jr z, .ssAnne5
- ld a, [wSpriteStateData1 + 9] ; player sprite's facing direction
+ jr z, IsSSAnneBowWarpTileInFrontOfPlayer
+ ld a, [wSpritePlayerStateData1FacingDirection]
srl a
ld c, a
ld b, 0
- ld hl, .warpTileListPointers
+ ld hl, WarpTileListPointers
add hl, bc
ld a, [hli]
ld h, [hl]
@@ -178,39 +178,23 @@ IsWarpTileInFrontOfPlayer:
pop hl
ret
-.warpTileListPointers:
- dw .facingDownWarpTiles
- dw .facingUpWarpTiles
- dw .facingLeftWarpTiles
- dw .facingRightWarpTiles
+INCLUDE "data/tilesets/warp_carpet_tile_ids.asm"
-.facingDownWarpTiles
- db $01,$12,$17,$3D,$04,$18,$33,$FF
-
-.facingUpWarpTiles
- db $01,$5C,$FF
-
-.facingLeftWarpTiles
- db $1A,$4B,$FF
-
-.facingRightWarpTiles
- db $0F,$4E,$FF
-
-.ssAnne5
+IsSSAnneBowWarpTileInFrontOfPlayer:
ld a, [wTileInFrontOfPlayer]
cp $15
jr nz, .notSSAnne5Warp
scf
- jr .done
+ jr IsWarpTileInFrontOfPlayer.done
.notSSAnne5Warp
and a
- jr .done
+ jr IsWarpTileInFrontOfPlayer.done
-IsPlayerStandingOnDoorTileOrWarpTile:
+IsPlayerStandingOnDoorTileOrWarpTile::
push hl
push de
push bc
- callba IsPlayerStandingOnDoorTile
+ farcall IsPlayerStandingOnDoorTile
jr c, .done
ld a, [wCurMapTileset]
add a
@@ -222,7 +206,7 @@ IsPlayerStandingOnDoorTileOrWarpTile:
ld h, [hl]
ld l, a
ld de, $1
- aCoord 8, 9
+ lda_coord 8, 9
call IsInArray
jr nc, .done
ld hl, wd736
@@ -233,35 +217,35 @@ IsPlayerStandingOnDoorTileOrWarpTile:
pop hl
ret
-INCLUDE "data/warp_tile_ids.asm"
+INCLUDE "data/tilesets/warp_tile_ids.asm"
-PrintSafariZoneSteps:
+PrintSafariZoneSteps::
ld a, [wCurMap]
cp SAFARI_ZONE_EAST
ret c
cp CERULEAN_CAVE_2F
ret nc
- coord hl, 0, 0
+ hlcoord 0, 0
lb bc, 3, 7
call TextBoxBorder
- coord hl, 1, 1
+ hlcoord 1, 1
ld de, wSafariSteps
lb bc, 2, 3
call PrintNumber
- coord hl, 4, 1
+ hlcoord 4, 1
ld de, SafariSteps
call PlaceString
- coord hl, 1, 3
+ hlcoord 1, 3
ld de, SafariBallText
call PlaceString
ld a, [wNumSafariBalls]
cp 10
jr nc, .numSafariBallsTwoDigits
- coord hl, 5, 3
+ hlcoord 5, 3
ld a, " "
ld [hl], a
.numSafariBallsTwoDigits
- coord hl, 6, 3
+ hlcoord 6, 3
ld de, wNumSafariBalls
lb bc, 1, 2
jp PrintNumber
@@ -280,32 +264,32 @@ _GetTileAndCoordsInFrontOfPlayer:
ld d, a
ld a, [wXCoord]
ld e, a
- ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
+ ld a, [wSpritePlayerStateData1FacingDirection]
and a ; cp SPRITE_FACING_DOWN
jr nz, .notFacingDown
; facing down
- aCoord 8, 11
+ lda_coord 8, 11
inc d
jr .storeTile
.notFacingDown
cp SPRITE_FACING_UP
jr nz, .notFacingUp
; facing up
- aCoord 8, 7
+ lda_coord 8, 7
dec d
jr .storeTile
.notFacingUp
cp SPRITE_FACING_LEFT
jr nz, .notFacingLeft
; facing left
- aCoord 6, 9
+ lda_coord 6, 9
dec e
jr .storeTile
.notFacingLeft
cp SPRITE_FACING_RIGHT
jr nz, .storeTile
; facing right
- aCoord 10, 9
+ lda_coord 10, 9
inc e
.storeTile
ld c, a
@@ -314,45 +298,45 @@ _GetTileAndCoordsInFrontOfPlayer:
GetTileTwoStepsInFrontOfPlayer:
xor a
- ld [$ffdb], a
+ ldh [hPlayerFacing], a
ld hl, wYCoord
ld a, [hli]
ld d, a
ld e, [hl]
- ld a, [wSpriteStateData1 + 9] ; player's sprite facing direction
+ ld a, [wSpritePlayerStateData1FacingDirection]
and a ; cp SPRITE_FACING_DOWN
jr nz, .notFacingDown
; facing down
- ld hl, $ffdb
+ ld hl, hPlayerFacing
set 0, [hl]
- aCoord 8, 13
+ lda_coord 8, 13
inc d
jr .storeTile
.notFacingDown
cp SPRITE_FACING_UP
jr nz, .notFacingUp
; facing up
- ld hl, $ffdb
+ ld hl, hPlayerFacing
set 1, [hl]
- aCoord 8, 5
+ lda_coord 8, 5
dec d
jr .storeTile
.notFacingUp
cp SPRITE_FACING_LEFT
jr nz, .notFacingLeft
; facing left
- ld hl, $ffdb
+ ld hl, hPlayerFacing
set 2, [hl]
- aCoord 4, 9
+ lda_coord 4, 9
dec e
jr .storeTile
.notFacingLeft
cp SPRITE_FACING_RIGHT
jr nz, .storeTile
; facing right
- ld hl, $ffdb
+ ld hl, hPlayerFacing
set 3, [hl]
- aCoord 12, 9
+ lda_coord 12, 9
inc e
.storeTile
ld c, a
@@ -384,36 +368,36 @@ CheckForBoulderCollisionWithSprites:
swap a
ld d, 0
ld e, a
- ld hl, wSpriteStateData2 + $14
+ ld hl, wSprite01StateData2MapY
add hl, de
ld a, [hli] ; map Y position
- ld [$ffdc], a
+ ldh [hPlayerYCoord], a
ld a, [hl] ; map X position
- ld [$ffdd], a
+ ldh [hPlayerXCoord], a
ld a, [wNumSprites]
ld c, a
ld de, $f
- ld hl, wSpriteStateData2 + $14
- ld a, [$ffdb]
+ ld hl, wSprite01StateData2MapY
+ ldh a, [hPlayerFacing]
and $3 ; facing up or down?
jr z, .pushingHorizontallyLoop
.pushingVerticallyLoop
inc hl
- ld a, [$ffdd]
+ ldh a, [hPlayerXCoord]
cp [hl]
jr nz, .nextSprite1 ; if X coordinates don't match
dec hl
ld a, [hli]
ld b, a
- ld a, [$ffdb]
+ ldh a, [hPlayerFacing]
rrca
jr c, .pushingDown
; pushing up
- ld a, [$ffdc]
+ ldh a, [hPlayerYCoord]
dec a
jr .compareYCoords
.pushingDown
- ld a, [$ffdc]
+ ldh a, [hPlayerYCoord]
inc a
.compareYCoords
cp b
@@ -426,19 +410,19 @@ CheckForBoulderCollisionWithSprites:
.pushingHorizontallyLoop
ld a, [hli]
ld b, a
- ld a, [$ffdc]
+ ldh a, [hPlayerYCoord]
cp b
jr nz, .nextSprite2
ld b, [hl]
- ld a, [$ffdb]
+ ldh a, [hPlayerFacing]
bit 2, a
jr nz, .pushingLeft
; pushing right
- ld a, [$ffdd]
+ ldh a, [hPlayerXCoord]
inc a
jr .compareXCoords
.pushingLeft
- ld a, [$ffdd]
+ ldh a, [hPlayerXCoord]
dec a
.compareXCoords
cp b