Clip big monster combat frame at window edge

This commit is contained in:
2025-08-09 11:44:22 -05:00
parent 820b5f6a6e
commit a645057ed7

View File

@@ -208,6 +208,11 @@ void draw_monsters() {
target_rect.right = target_rect.left + 28 * monst.x_width;
target_rect.top = 13 + 36 * where_draw.y;
target_rect.bottom = target_rect.top + 36 * monst.y_width;
// clip the frame at the window boundaries
target_rect.top = max(13, target_rect.top);
target_rect.left = max(13, target_rect.left);
target_rect.bottom = min(target_rect.bottom, terrain_screen_gworld().getSize().y - 13);
target_rect.right = min(target_rect.right, terrain_screen_gworld().getSize().x - 13);
frame_rect(terrain_screen_gworld(), target_rect, monst.is_friendly() ? sf::Color(0, 0, 255, 127) : sf::Color(255, 0, 0, 127));
}
}