aboutsummaryrefslogtreecommitdiffstats
path: root/engine/overworld/turn_sprite.asm
diff options
context:
space:
mode:
authorRangi <35663410+Rangi42@users.noreply.github.com>2020-07-03 09:38:52 -0400
committerGitHub <noreply@github.com>2020-07-03 09:38:52 -0400
commitc85050497c1bd062e9cd40bf5b32fa3beca366cc (patch)
tree9593ddd3ab820223ab580d5fc0ae133b485b8315 /engine/overworld/turn_sprite.asm
parentActually run .travis/webhook.sh (diff)
parentAdd engine/movie/oak_speech/ subdirectory (diff)
downloadpokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.tar.gz
pokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.tar.xz
pokeyellow-c85050497c1bd062e9cd40bf5b32fa3beca366cc.zip
Merge pull request #256 from Rangi42/master
Add subdirectories to engine/ similar to pokecrystal
Diffstat (limited to 'engine/overworld/turn_sprite.asm')
-rwxr-xr-xengine/overworld/turn_sprite.asm25
1 files changed, 25 insertions, 0 deletions
diff --git a/engine/overworld/turn_sprite.asm b/engine/overworld/turn_sprite.asm
new file mode 100755
index 00000000..c7f7712b
--- /dev/null
+++ b/engine/overworld/turn_sprite.asm
@@ -0,0 +1,25 @@
+UpdateSpriteFacingOffsetAndDelayMovement::
+ ld h, $c2
+ ld a, [H_CURRENTSPRITEOFFSET]
+ add $8
+ ld l, a
+ ld a, $7f ; maximum movement delay
+ ld [hl], a ; c2x8 (movement delay)
+ dec h
+ ld a, [H_CURRENTSPRITEOFFSET]
+ add $9
+ ld l, a
+ ld a, [hld] ; c1x9 (facing direction)
+ ld b, a
+ xor a
+ ld [hld], a
+ ld [hl], a ; c1x8 (walk animation frame)
+ ld a, [H_CURRENTSPRITEOFFSET]
+ add $2
+ ld l, a
+ ld a, [hl] ; c1x2 (facing and animation table offset)
+ or b ; or in the facing direction
+ ld [hld], a
+ ld a, $2 ; delayed movement status
+ ld [hl], a ; c1x1 (movement status)
+ ret