[MIRROR] [READY] Refactor icon smoothing to use 8-bit bitmasking (#1053)

* Merge pull request #53906 from Rohesie/smoothing

[READY] Refactor icon smoothing to use 8-bit bitmasking

* [READY] Refactor icon smoothing to use 8-bit bitmasking

Co-authored-by: nemvar <47324920+nemvar@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-09-29 22:55:58 +01:00
committed by GitHub
co-authored by nemvar
parent f5ae2cd993
commit b96909fb02
146 changed files with 760 additions and 423 deletions
+39 -28
View File
@@ -317,7 +317,7 @@
//This proc is used to update the icons of nearby windows.
/obj/structure/window/proc/update_nearby_icons()
update_icon()
if(smoothing_flags)
if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
QUEUE_SMOOTH_NEIGHBORS(src)
//merges adjacent full-tile windows into one
@@ -330,7 +330,7 @@
var/ratio = obj_integrity / max_integrity
ratio = CEILING(ratio*4, 1) * 25
if(smoothing_flags)
if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
QUEUE_SMOOTH(src)
cut_overlay(crack_overlay)
@@ -598,12 +598,13 @@
/obj/structure/window/fulltile
icon = 'icons/obj/smooth_structures/window.dmi'
icon_state = "window"
icon_state = "window-0"
base_icon_state = "window"
dir = FULLTILE_WINDOW_DIR
max_integrity = 50
fulltile = TRUE
flags_1 = PREVENT_CLICK_UNDER_1
smoothing_flags = SMOOTH_CORNERS
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = list(SMOOTH_GROUP_WINDOW_FULLTILE)
canSmoothWith = list(SMOOTH_GROUP_WINDOW_FULLTILE)
glass_amount = 2
@@ -613,12 +614,13 @@
/obj/structure/window/plasma/fulltile
icon = 'icons/obj/smooth_structures/plasma_window.dmi'
icon_state = "plasmawindow"
icon_state = "plasma_window-0"
base_icon_state = "plasma_window"
dir = FULLTILE_WINDOW_DIR
max_integrity = 300
fulltile = TRUE
flags_1 = PREVENT_CLICK_UNDER_1
smoothing_flags = SMOOTH_CORNERS
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = list(SMOOTH_GROUP_WINDOW_FULLTILE)
canSmoothWith = list(SMOOTH_GROUP_WINDOW_FULLTILE)
glass_amount = 2
@@ -628,13 +630,14 @@
/obj/structure/window/plasma/reinforced/fulltile
icon = 'icons/obj/smooth_structures/rplasma_window.dmi'
icon_state = "rplasmawindow"
icon_state = "rplasma_window-0"
base_icon_state = "rplasma_window"
dir = FULLTILE_WINDOW_DIR
state = RWINDOW_SECURE
max_integrity = 1000
fulltile = TRUE
flags_1 = PREVENT_CLICK_UNDER_1
smoothing_flags = SMOOTH_CORNERS
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = list(SMOOTH_GROUP_WINDOW_FULLTILE)
canSmoothWith = list(SMOOTH_GROUP_WINDOW_FULLTILE)
glass_amount = 2
@@ -645,13 +648,14 @@
/obj/structure/window/reinforced/fulltile
icon = 'icons/obj/smooth_structures/reinforced_window.dmi'
icon_state = "r_window"
icon_state = "reinforced_window-0"
base_icon_state = "reinforced_window"
dir = FULLTILE_WINDOW_DIR
max_integrity = 150
fulltile = TRUE
flags_1 = PREVENT_CLICK_UNDER_1
state = RWINDOW_SECURE
smoothing_flags = SMOOTH_CORNERS
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = list(SMOOTH_GROUP_WINDOW_FULLTILE)
canSmoothWith = list(SMOOTH_GROUP_WINDOW_FULLTILE)
glass_amount = 2
@@ -662,18 +666,20 @@
/obj/structure/window/reinforced/tinted/fulltile
icon = 'icons/obj/smooth_structures/tinted_window.dmi'
icon_state = "tinted_window"
icon_state = "tinted_window-0"
base_icon_state = "tinted_window"
dir = FULLTILE_WINDOW_DIR
fulltile = TRUE
flags_1 = PREVENT_CLICK_UNDER_1
smoothing_flags = SMOOTH_CORNERS
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = list(SMOOTH_GROUP_WINDOW_FULLTILE)
canSmoothWith = list(SMOOTH_GROUP_WINDOW_FULLTILE)
glass_amount = 2
/obj/structure/window/reinforced/fulltile/ice
icon = 'icons/obj/smooth_structures/rice_window.dmi'
icon_state = "ice_window"
icon_state = "rice_window-0"
base_icon_state = "rice_window"
max_integrity = 150
glass_amount = 2
@@ -681,7 +687,8 @@
name = "shuttle window"
desc = "A reinforced, air-locked pod window."
icon = 'icons/obj/smooth_structures/shuttle_window.dmi'
icon_state = "shuttle_window"
icon_state = "shuttle_window-0"
base_icon_state = "shuttle_window"
dir = FULLTILE_WINDOW_DIR
max_integrity = 150
wtype = "shuttle"
@@ -690,9 +697,9 @@
reinf = TRUE
heat_resistance = 1600
armor = list(MELEE = 90, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 50, BIO = 100, RAD = 100, FIRE = 80, ACID = 100)
smoothing_flags = SMOOTH_CORNERS
smoothing_groups = list(SMOOTH_GROUP_SHUTTLE_PARTS)
canSmoothWith = null
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = list(SMOOTH_GROUP_SHUTTLE_PARTS, SMOOTH_GROUP_WINDOW_FULLTILE_SHUTTLE)
canSmoothWith = list(SMOOTH_GROUP_WINDOW_FULLTILE_SHUTTLE)
explosion_block = 3
glass_type = /obj/item/stack/sheet/titaniumglass
glass_amount = 2
@@ -711,7 +718,8 @@
name = "plastitanium window"
desc = "A durable looking window made of an alloy of of plasma and titanium."
icon = 'icons/obj/smooth_structures/plastitanium_window.dmi'
icon_state = "plastitanium_window"
icon_state = "plastitanium_window-0"
base_icon_state = "plastitanium_window"
dir = FULLTILE_WINDOW_DIR
max_integrity = 1200
wtype = "shuttle"
@@ -719,9 +727,9 @@
flags_1 = PREVENT_CLICK_UNDER_1
heat_resistance = 1600
armor = list(MELEE = 95, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 50, BIO = 100, RAD = 100, FIRE = 80, ACID = 100)
smoothing_flags = SMOOTH_CORNERS
smoothing_groups = list(SMOOTH_GROUP_SHUTTLE_PARTS)
canSmoothWith = null
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = list(SMOOTH_GROUP_SHUTTLE_PARTS, SMOOTH_GROUP_WINDOW_FULLTILE_PLASTITANIUM)
canSmoothWith = list(SMOOTH_GROUP_WINDOW_FULLTILE_PLASTITANIUM)
explosion_block = 3
damage_deflection = 21 //The same as reinforced plasma windows.3
glass_type = /obj/item/stack/sheet/plastitaniumglass
@@ -736,13 +744,14 @@
name = "paper frame"
desc = "A fragile separator made of thin wood and paper."
icon = 'icons/obj/smooth_structures/paperframes.dmi'
icon_state = "frame"
icon_state = "paperframes-0"
base_icon_state = "paperframes"
dir = FULLTILE_WINDOW_DIR
opacity = TRUE
max_integrity = 15
fulltile = TRUE
flags_1 = PREVENT_CLICK_UNDER_1
smoothing_flags = SMOOTH_CORNERS
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = list(SMOOTH_GROUP_PAPERFRAME)
canSmoothWith = list(SMOOTH_GROUP_PAPERFRAME)
glass_amount = 2
@@ -791,7 +800,8 @@
cut_overlay(torn)
add_overlay(paper)
set_opacity(TRUE)
QUEUE_SMOOTH(src)
if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))
QUEUE_SMOOTH(src)
/obj/structure/window/paperframe/attackby(obj/item/W, mob/user)
@@ -823,10 +833,11 @@
anchored = FALSE
/obj/structure/window/bronze/fulltile
icon_state = "clockwork_window"
smoothing_flags = SMOOTH_CORNERS
smoothing_groups = list(SMOOTH_GROUP_WINDOW_FULLTILE)
canSmoothWith = null
icon_state = "clockwork_window-0"
base_icon_state = "clockwork_window"
smoothing_flags = SMOOTH_BITMASK
smoothing_groups = list(SMOOTH_GROUP_WINDOW_FULLTILE, SMOOTH_GROUP_WINDOW_FULLTILE_BRONZE)
canSmoothWith = list(SMOOTH_GROUP_WINDOW_FULLTILE_BRONZE)
fulltile = TRUE
flags_1 = PREVENT_CLICK_UNDER_1
dir = FULLTILE_WINDOW_DIR