diff options
author | klektron <klektron@users.noreply.github.com> | 2020-12-29 21:54:33 +0100 |
---|---|---|
committer | klektron <klektron@users.noreply.github.com> | 2020-12-29 21:54:33 +0100 |
commit | af2eb191837e9c2921b7e8015874568675f32e9f (patch) | |
tree | d72f094ed69238f89297ce031c4b14eed14515a8 /engine/overworld/movement.asm | |
parent | 0c92d318cce58a42fa15d7989f9999d324c7475d (diff) |
more changes
Diffstat (limited to 'engine/overworld/movement.asm')
-rw-r--r-- | engine/overworld/movement.asm | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index 2fb8c384..5dcef8ec 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -448,6 +448,7 @@ InitializeSpriteStatus: ld a, $8 ld [hli], a ; [x#SPRITESTATEDATA2_YDISPLACEMENT] = 8 ld [hl], a ; [x#SPRITESTATEDATA2_XDISPLACEMENT] = 8 + call InitializeSpriteScreenPosition ; could have done fallthrough here ret ; calculates the sprite's screen position from its map position and the player position @@ -460,7 +461,7 @@ InitializeSpriteScreenPosition: ld b, a ld a, [hl] ; x#SPRITESTATEDATA2_MAPY sub b ; relative to player position - swap a ; * 16 + call Func_515D sub $4 ; - 4 dec h ld [hli], a ; [x#SPRITESTATEDATA1_YPIXELS] @@ -469,11 +470,23 @@ InitializeSpriteScreenPosition: ld b, a ld a, [hli] ; x#SPRITESTATEDATA2_MAPX sub b ; relative to player position - swap a ; * 16 + call Func_515D dec h ld [hl], a ; [x#SPRITESTATEDATA1_XPIXELS] ret +Func_515D: + jr nc, .asm_5166 + cpl + inc a + swap a + cpl + inc a + ret +.asm_5166 + swap a + ret + ; tests if sprite is off screen or otherwise unable to do anything CheckSpriteAvailability: predef IsObjectHidden |