From def10a09acabedff27a7d4c85c05bffda6ae68c7 Mon Sep 17 00:00:00 2001 From: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Date: Thu, 16 Nov 2023 17:40:48 +0100 Subject: [PATCH] Simplify crop_image_zoom calls --- game/scripts/interface/brewing.rpy | 14 ++------------ game/scripts/interface/inventory.rpy | 13 ++----------- game/scripts/shops/item/menu.rpy | 20 ++++++++------------ 3 files changed, 12 insertions(+), 35 deletions(-) diff --git a/game/scripts/interface/brewing.rpy b/game/scripts/interface/brewing.rpy index 97b94b8e..a208c21f 100644 --- a/game/scripts/interface/brewing.rpy +++ b/game/scripts/interface/brewing.rpy @@ -185,12 +185,7 @@ screen brewing_menuitem(xx, yy): xysize (48, 48) add gui.format("interface/achievements/{}/iconbox.webp") - if ingredient.owned > 0: - $ image_zoom = crop_image_zoom(ingredient.get_image(), 42, 42) - else: - $ image_zoom = crop_image_zoom(ingredient.get_image(), 42, 42, True) - - add image_zoom align (0.5, 0.5) + add crop_image_zoom(ingredient.get_image(), 42, 42, ingredient.owned <= 0) align (0.5, 0.5) button: style gui.theme("overlay_button") @@ -214,12 +209,7 @@ screen brewing_menuitem(xx, yy): add gui.format("interface/achievements/{}/iconbox.webp") size (64, 64) - if current_item.owned > 0: - $ image_zoom = crop_image_zoom(current_item.get_image(), 52, 52) - else: - $ image_zoom = crop_image_zoom(current_item.get_image(), 52, 52, True) - - add image_zoom align (0.5, 0.5) + add crop_image_zoom(current_item.get_image(), 52, 52, current_item.owned <= 0) align (0.5, 0.5) button: style gui.theme("overlay_button") diff --git a/game/scripts/interface/inventory.rpy b/game/scripts/interface/inventory.rpy index d22f265c..e1a1f5e0 100644 --- a/game/scripts/interface/inventory.rpy +++ b/game/scripts/interface/inventory.rpy @@ -340,12 +340,7 @@ screen inventory_menuitem(xx, yy): if not current_item == None and current_item.id == menu_items[i].id: add "interface/achievements/glow.webp" align (0.5, 0.5) zoom 0.105 alpha 0.7 at rotate_circular - if menu_items[i].owned > 0: - $ image_zoom = crop_image_zoom(menu_items[i].get_image(), 42, 42) - else: - $ image_zoom = crop_image_zoom(menu_items[i].get_image(), 42, 42, True) - - add image_zoom align (0.5, 0.5) + add crop_image_zoom(menu_items[i].get_image(), 42, 42, menu_items[i].owned <= 0) align (0.5, 0.5) button: style gui.theme("overlay_button") @@ -379,11 +374,7 @@ screen inventory_menuitem(xx, yy): ysize 96 pos (24, 375) add gui.format("interface/achievements/{}/icon_selected.webp") - if current_item.owned > 0: - $ image_zoom = crop_image_zoom(current_item.get_image(), 84, 84) - else: - $ image_zoom = crop_image_zoom(current_item.get_image(), 84, 84, True) - add image_zoom align (0.5, 0.5) + add crop_image_zoom(current_item.get_image(), 84, 84, current_item.owned <= 0) align (0.5, 0.5) add "interface/achievements/glass_selected.webp" pos (6, 6) if current_category in {"Gifts", "Ingredients", "Potions"}: diff --git a/game/scripts/shops/item/menu.rpy b/game/scripts/shops/item/menu.rpy index 8e8b2fe6..8cc8759d 100644 --- a/game/scripts/shops/item/menu.rpy +++ b/game/scripts/shops/item/menu.rpy @@ -210,12 +210,10 @@ screen shop_item_menuitem(xx, yy): if not current_item == None and current_item.id == menu_items[i].id: add "interface/achievements/glow.webp" align (0.5, 0.5) zoom 0.105 alpha 0.7 at rotate_circular - if (menu_items[i].currency == "tokens" and tokens >= menu_items[i].price) or (menu_items[i].owned < 99 and game.gold >= menu_items[i].price): - $ image_zoom = crop_image_zoom(menu_items[i].get_image(), 42, 42) - else: - $ image_zoom = crop_image_zoom(menu_items[i].get_image(), 42, 42, True) - - add image_zoom align (0.5, 0.5) + add crop_image_zoom( + menu_items[i].get_image(), 42, 42, + (menu_items[i].currency != "tokens" or tokens < menu_items[i].price) and (menu_items[i].owned >= 99 or game.gold < menu_items[i].price) + ) align (0.5, 0.5) button: style gui.theme("overlay_button") @@ -249,12 +247,10 @@ screen shop_item_menuitem(xx, yy): pos (24, 375) add gui.format("interface/achievements/{}/icon_selected.webp") - if (current_item.currency == "tokens" and tokens >= current_item.price) or (current_item.owned < 99 and game.gold >= current_item.price): - $ image_zoom = crop_image_zoom(current_item.get_image(), 84, 84) - else: - $ image_zoom = crop_image_zoom(current_item.get_image(), 84, 84, True) - - add image_zoom align (0.5, 0.5) + add crop_image_zoom( + current_item.get_image(), 84, 84, + (current_item.currency != "tokens" or tokens < current_item.price) and (current_item.owned >= 99 or game.gold < current_item.price) + ) align (0.5, 0.5) add "interface/achievements/glass_selected.webp" pos (6, 6) if current_item.owned > 0: