From 8a731a8bc80c8e1d373ae578088f44b939f46a1d Mon Sep 17 00:00:00 2001 From: Verkister Date: Sun, 18 Feb 2018 21:47:27 +0200 Subject: [PATCH] Another attempt at leg icon generation fixes. (#4839) -Makes leg icon cache code little more robust in the hunt of the dreaded bugson dismemberment crash. -The old leg layer direction caching code was pretty slippery to grasp and basically the only thing left separating it from the other well behaving limbs at this point. -The cache blending runs each limb on its own so there is no practical need to (con)fuse the left and right legs together like that. -Not entirely sure how exactly the old code did the stuff(itjustworks.ogg), but the new one goes straight to the point, picking the side of the processing limb, grabbing its overlay appropriate direction icons onto one temp, blending the overlay set onto base before grabbing the underlay appropriate dir by itself into a separate(free of the overlay temp shenanigans) and underlay blending it onto the base. --- .../mob/living/carbon/human/update_icons.dm | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/code/modules/mob/living/carbon/human/update_icons.dm b/code/modules/mob/living/carbon/human/update_icons.dm index 3b8702e03ac..21ed6c0b027 100644 --- a/code/modules/mob/living/carbon/human/update_icons.dm +++ b/code/modules/mob/living/carbon/human/update_icons.dm @@ -417,20 +417,24 @@ var/global/list/damage_icon_parts = list() var/icon/temp = part.get_icon(skeleton) //That part makes left and right legs drawn topmost and lowermost when human looks WEST or EAST //And no change in rendering for other parts (they icon_position is 0, so goes to 'else' part) - if(part.icon_position & (LEFT | RIGHT)) + if(part.icon_position == RIGHT) var/icon/temp2 = new('icons/mob/human.dmi',"blank") + var/icon/temp3 = new('icons/mob/human.dmi',"blank") temp2.Insert(new/icon(temp,dir=NORTH),dir=NORTH) temp2.Insert(new/icon(temp,dir=SOUTH),dir=SOUTH) - if(!(part.icon_position & LEFT)) - temp2.Insert(new/icon(temp,dir=EAST),dir=EAST) - if(!(part.icon_position & RIGHT)) - temp2.Insert(new/icon(temp,dir=WEST),dir=WEST) + temp2.Insert(new/icon(temp,dir=EAST),dir=EAST) base_icon.Blend(temp2, ICON_OVERLAY) - if(part.icon_position & LEFT) - temp2.Insert(new/icon(temp,dir=EAST),dir=EAST) - if(part.icon_position & RIGHT) - temp2.Insert(new/icon(temp,dir=WEST),dir=WEST) - base_icon.Blend(temp2, ICON_UNDERLAY) + temp3.Insert(new/icon(temp,dir=WEST),dir=WEST) + base_icon.Blend(temp3, ICON_UNDERLAY) + else if(part.icon_position == LEFT) + var/icon/temp2 = new('icons/mob/human.dmi',"blank") + var/icon/temp3 = new('icons/mob/human.dmi',"blank") + temp2.Insert(new/icon(temp,dir=NORTH),dir=NORTH) + temp2.Insert(new/icon(temp,dir=SOUTH),dir=SOUTH) + temp2.Insert(new/icon(temp,dir=WEST),dir=WEST) + base_icon.Blend(temp2, ICON_OVERLAY) + temp3.Insert(new/icon(temp,dir=EAST),dir=EAST) + base_icon.Blend(temp3, ICON_UNDERLAY) else if(part.icon_position & UNDER) base_icon.Blend(temp, ICON_UNDERLAY) else