From 8df4de4557ea49ff39462505a0662aacca447bf3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 7 Nov 2022 16:31:31 +0100 Subject: animations kinda work --- draw/wall.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'draw') 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}); } -- cgit v1.2.3