pokered/engine/overworld/turn_sprite.asm

26 lines
568 B
NASM
Raw Normal View History

UpdateSpriteFacingOffsetAndDelayMovement::
2014-05-22 22:13:20 +00:00
ld h, $c2
ldh a, [hCurrentSpriteOffset]
2014-05-22 22:13:20 +00:00
add $8
ld l, a
ld a, $7f ; maximum movement delay
ld [hl], a ; c2x8 (movement delay)
2014-05-22 22:13:20 +00:00
dec h
ldh a, [hCurrentSpriteOffset]
2014-05-22 22:13:20 +00:00
add $9
ld l, a
ld a, [hld] ; c1x9 (facing direction)
2014-05-22 22:13:20 +00:00
ld b, a
xor a
ld [hld], a
ld [hl], a ; c1x8 (walk animation frame)
ldh a, [hCurrentSpriteOffset]
2014-05-22 22:13:20 +00:00
add $2
ld l, a
ld a, [hl] ; c1x2 (facing and animation table offset)
or b ; or in the facing direction
2014-05-22 22:13:20 +00:00
ld [hld], a
ld a, $2 ; delayed movement status
ld [hl], a ; c1x1 (movement status)
2014-05-22 22:13:20 +00:00
ret