diff options
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 c89406d1..05c73213 100644 --- a/engine/overworld/movement.asm +++ b/engine/overworld/movement.asm @@ -445,6 +445,7 @@ InitializeSpriteStatus: ; 50ad (1:50ad) 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 spprite's scrren position form its map position and the player position @@ -457,7 +458,7 @@ InitializeSpriteScreenPosition: ; 50bd (1:50bd) 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) @@ -466,11 +467,23 @@ InitializeSpriteScreenPosition: ; 50bd (1:50bd) 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: ; 50dc (1:50dc) predef IsObjectHidden |