projects
/
gbrg
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
822cbb8
)
Moved animation load macro to macro defs
author
Lukas Krickl
<lukas@krickl.dev>
Tue, 26 Nov 2024 13:33:12 +0000
(14:33 +0100)
committer
Lukas Krickl
<lukas@krickl.dev>
Tue, 26 Nov 2024 13:33:12 +0000
(14:33 +0100)
src/macros.inc
patch
|
blob
|
history
diff --git
a/src/macros.inc
b/src/macros.inc
index e2ac287e4f9cacce6a41ac248db13750ea5254c1..a0fd3c86e111fc8b658f6c58df966b69806d9ea5 100644
(file)
--- a/
src/macros.inc
+++ b/
src/macros.inc
@@
-56,3
+56,21
@@
ld a, 1
ld [end_turn], a
#endmacro
+
+ ; loads an animation frame
+ ; from a table
+ ; uses hl and a
+ ; inputs:
+ ; $1: table
+ ; $2: max frames (mask)
+ ; returns:
+ ; a: the frame
+#macro load_anim_frame
+ ld hl, $1
+ ld a, [frame_count]
+ and a, $2 ; max frames
+ ld d, 0
+ ld e, a
+ add hl, de ; hl = correct tile index
+ ld a, [hl]
+#endmacro