From 602124566b348d461b037121bdbe46c3fb8e8b58 Mon Sep 17 00:00:00 2001 From: Drulikar Date: Mon, 25 Sep 2023 03:32:00 -0700 Subject: [PATCH] RESET_COLOR and RESET_ALPHA fixes --- code/__HELPERS/icons.dm | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/code/__HELPERS/icons.dm b/code/__HELPERS/icons.dm index 0cb07db47ffc..535dfed3ac1a 100644 --- a/code/__HELPERS/icons.dm +++ b/code/__HELPERS/icons.dm @@ -435,11 +435,19 @@ world if(layer_image.alpha == 0) continue + var/apply_color = TRUE + var/apply_alpha = TRUE + if(layer_image == copy) // 'layer_image' is an /image based on the object being flattened. curblend = BLEND_OVERLAY add = icon(layer_image.icon, layer_image.icon_state, base_icon_dir) else // 'I' is an appearance object. - add = getFlatIcon(image(layer_image), curdir, curicon, curstate, curblend, FALSE, no_anim) + var/image/layer_as_image = image(layer_image) + if(layer_as_image.appearance_flags & RESET_COLOR) + apply_color = FALSE + if(layer_as_image.appearance_flags & RESET_ALPHA) + apply_alpha = FALSE + add = getFlatIcon(layer_as_image, curdir, curicon, curstate, curblend, FALSE, no_anim) if(!add) continue @@ -468,17 +476,17 @@ world flatY1 = addY1 flatY2 = addY2 - // Blend the overlay into the flattened icon - flat.Blend(add, blendMode2iconMode(curblend), layer_image.pixel_x + 2 - flatX1, layer_image.pixel_y + 2 - flatY1) + if(apply_color && appearance.color) + if(islist(appearance.color)) + add.MapColors(arglist(appearance.color)) + else + add.Blend(appearance.color, ICON_MULTIPLY) - if(appearance.color) - if(islist(appearance.color)) - flat.MapColors(arglist(appearance.color)) - else - flat.Blend(appearance.color, ICON_MULTIPLY) + if(apply_alpha && appearance.alpha < 255) + add.Blend(rgb(255, 255, 255, appearance.alpha), ICON_MULTIPLY) - if(appearance.alpha < 255) - flat.Blend(rgb(255, 255, 255, appearance.alpha), ICON_MULTIPLY) + // Blend the overlay into the flattened icon + flat.Blend(add, blendMode2iconMode(curblend), layer_image.pixel_x + 2 - flatX1, layer_image.pixel_y + 2 - flatY1) if(no_anim) //Clean up repeated frames