summaryrefslogtreecommitdiffhomepage
path: root/draw
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-07 16:31:31 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-07 16:31:31 +0100
commit8df4de4557ea49ff39462505a0662aacca447bf3 (patch)
treef2620bc4d9337f32bbc009c0bc77b40ee9370f76 /draw
parent151e1f9a56bce31c2703610980c00fc8f527aa6a (diff)
animations kinda work
Diffstat (limited to 'draw')
-rw-r--r--draw/wall.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/draw/wall.cpp b/draw/wall.cpp
index 68f78821..353925f6 100644
--- a/draw/wall.cpp
+++ b/draw/wall.cpp
@@ -72,9 +72,12 @@ void wall_mesh::draw(tile_shader& shader, chunk& c)
tex.bind(0);
last_texture = &a.atlas->texture();
auto frame = a.frame;
-#if 0
- static std::uint8_t f = 0;
- frame.frame = f++ % a.atlas->info().nframes;
+#if 1
+ static std::size_t f = 0;
+ f++;
+ if (f > a.atlas->info().nframes * 3)
+ f = 0;
+ frame.frame = (scenery::frame_t)std::min(f, a.atlas->info().nframes - 1);
#endif
_anim_mesh.draw(shader, *a.atlas, a.atlas->frame(a.frame.r, frame.frame), local_coords{idx});
}