diff options
Diffstat (limited to 'engine/overworld/movement.asm')
-rw-r--r-- | engine/overworld/movement.asm | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/engine/overworld/movement.asm b/engine/overworld/movement.asm index bbfbbc39..3b351e58 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -444,6 +444,7 @@ InitializeSpriteStatus: ld a, $8 ld [hli], a ; $c2x2: set Y displacement to 8 ld [hl], a ; $c2x3: set X displacement to 8 + call InitializeSpriteScreenPosition ; could have done fallthrough here ret ; calculates the sprite's screen position form its map position and the player position @@ -456,7 +457,7 @@ InitializeSpriteScreenPosition: ld b, a ld a, [hl] ; c2x4 (Y position + 4) sub b ; relative to player position - swap a ; * 16 + call Func_515D sub $4 ; - 4 dec h ld [hli], a ; c1x4 (screen Y position) @@ -465,11 +466,23 @@ InitializeSpriteScreenPosition: ld b, a ld a, [hli] ; c2x6 (X position + 4) sub b ; relative to player position - swap a ; * 16 + call Func_515D dec h ld [hl], a ; c1x6 (screen X position) ret +Func_515D: ; 515D (1: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 @@ -695,7 +708,7 @@ GetTileSpriteStandsOn: ld l, a ld a, [hli] ; c1x4: screen Y position add $4 ; align to 2*2 tile blocks (Y position is always off 4 pixels to the top) - and $f0 ; in case object is currently moving + and $f8 ; in case object is currently moving srl a ; screen Y tile * 4 ld c, a ld b, $0 |