Fix rat sprite strip artifact inside internal tunnel cells

After merging new-newnassets, the rat sprite assets are now horizontal
4-frame sprite sheets (e.g. BMP_MALE_UP.png is 80x40 instead of 20x40).
The drawing path for rats inside internal tunnel passages still called
draw_image() without source_rect, so the engine rendered all 4 frames
side by side as a single wide strip (the visual artifact shown in
/tmp/pi-clipboard-...png).

This brings the tunnel-internal rendering in line with the non-tunnel
path, which already used source_rect = (frame * w, 0, w, h).
This commit is contained in:
Matteo Benedetto
2026-06-27 18:42:46 +02:00
parent f348d7e0d9
commit 1627f58103
+3 -1
View File
@@ -202,7 +202,9 @@ class Rat(Unit):
return
# Internal tunnel passage or crossroad: draw the rat normally
# so it stays visible while walking through the tunnel.
self.game.render_engine.draw_image(self.render_x, self.render_y, image, anchor="nw", tag="unit")
frame = min(3, int(self.partial_move * 4))
source_rect = (frame * image_size[0], 0, image_size[0], image_size[1])
self.game.render_engine.draw_image(self.render_x, self.render_y, image, anchor="nw", tag="unit", source_rect=source_rect)
return
if not self.game.map.is_empty(cell_x, cell_y):
return