diff --git a/code/__DEFINES/icon_smoothing.dm b/code/__DEFINES/icon_smoothing.dm index 94e9105f4a3..a853fde0c5d 100644 --- a/code/__DEFINES/icon_smoothing.dm +++ b/code/__DEFINES/icon_smoothing.dm @@ -3,34 +3,33 @@ #define SMOOTH_CORNERS (1<<0) /// Smoothing system in where adjacencies are calculated and used to select a pre-baked icon_state, encoded by bitmasking. #define SMOOTH_BITMASK (1<<1) +/// Limits SMOOTH_BITMASK to only cardinal directions, for use with cardinal smoothing +#define SMOOTH_BITMASK_CARDINALS (1<<2) /// Atom has diagonal corners, with underlays under them. -#define SMOOTH_DIAGONAL_CORNERS (1<<2) +#define SMOOTH_DIAGONAL_CORNERS (1<<3) /// Atom will smooth with the borders of the map. -#define SMOOTH_BORDER (1<<3) +#define SMOOTH_BORDER (1<<4) /// Atom is currently queued to smooth. -#define SMOOTH_QUEUED (1<<4) +#define SMOOTH_QUEUED (1<<5) /// Smooths with objects, and will thus need to scan turfs for contents. -#define SMOOTH_OBJ (1<<5) +#define SMOOTH_OBJ (1<<6) /// Uses directional object smoothing, so we care not only about something being on the right turf, but also its direction /// Changes the meaning of smoothing_junction, instead of representing the directions we are smoothing in /// it represents the sides of our directional border object that have a neighbor /// Is incompatible with SMOOTH_CORNERS because border objects don't have corners -#define SMOOTH_BORDER_OBJECT (1<<6) -/// Has a smooth broken sprite, used to decide whether to apply an offset to the broken overlay or not. For /turf/open only. -#define SMOOTH_BROKEN_TURF (1<<7) -/// Has a smooth burnt sprite, used to decide whether to apply an offset to the burnt overlay or not. For /turf/open only. -#define SMOOTH_BURNT_TURF (1<<8) +#define SMOOTH_BORDER_OBJECT (1<<7) + +#define USES_SMOOTHING (SMOOTH_CORNERS|SMOOTH_BITMASK|SMOOTH_BITMASK_CARDINALS) DEFINE_BITFIELD(smoothing_flags, list( "SMOOTH_CORNERS" = SMOOTH_CORNERS, "SMOOTH_BITMASK" = SMOOTH_BITMASK, + "SMOOTH_BITMASK_CARDINALS" = SMOOTH_BITMASK_CARDINALS, "SMOOTH_DIAGONAL_CORNERS" = SMOOTH_DIAGONAL_CORNERS, "SMOOTH_BORDER" = SMOOTH_BORDER, "SMOOTH_QUEUED" = SMOOTH_QUEUED, "SMOOTH_OBJ" = SMOOTH_OBJ, "SMOOTH_BORDER_OBJECT" = SMOOTH_BORDER_OBJECT, - "SMOOTH_BROKEN_TURF" = SMOOTH_BROKEN_TURF, - "SMOOTH_BURNT_TURF" = SMOOTH_BURNT_TURF, )) /// Components of a smoothing junction @@ -44,6 +43,9 @@ DEFINE_BITFIELD(smoothing_flags, list( #define SOUTHWEST_JUNCTION (1<<6) #define NORTHWEST_JUNCTION (1<<7) +#define CARDINAL_SMOOTHING_JUNCTIONS (NORTH_JUNCTION|SOUTH_JUNCTION|EAST_JUNCTION|WEST_JUNCTION) +#define ALL_SMOOTHING_JUNCTIONS (NORTH_JUNCTION|SOUTH_JUNCTION|EAST_JUNCTION|WEST_JUNCTION|NORTHEAST_JUNCTION|SOUTHEAST_JUNCTION|SOUTHWEST_JUNCTION|NORTHWEST_JUNCTION) + DEFINE_BITFIELD(smoothing_junction, list( "NORTH_JUNCTION" = NORTH_JUNCTION, "SOUTH_JUNCTION" = SOUTH_JUNCTION, @@ -57,7 +59,7 @@ DEFINE_BITFIELD(smoothing_junction, list( /*smoothing macros*/ -#define QUEUE_SMOOTH(thing_to_queue) if(thing_to_queue.smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) {SSicon_smooth.add_to_queue(thing_to_queue)} +#define QUEUE_SMOOTH(thing_to_queue) if(thing_to_queue.smoothing_flags & USES_SMOOTHING) {SSicon_smooth.add_to_queue(thing_to_queue)} #define QUEUE_SMOOTH_NEIGHBORS(thing_to_queue) for(var/atom/atom_neighbor as anything in orange(1, thing_to_queue)) {QUEUE_SMOOTH(atom_neighbor)} diff --git a/code/__HELPERS/icon_smoothing.dm b/code/__HELPERS/icon_smoothing.dm index 5c5ff5a059a..c53d9df2d2c 100644 --- a/code/__HELPERS/icon_smoothing.dm +++ b/code/__HELPERS/icon_smoothing.dm @@ -177,7 +177,7 @@ xxx xxx xxx corners_diagonal_smooth(calculate_adjacencies()) else corners_cardinal_smooth(calculate_adjacencies()) - else if(smoothing_flags & SMOOTH_BITMASK) + else if(smoothing_flags & (SMOOTH_BITMASK|SMOOTH_BITMASK_CARDINALS)) bitmask_smooth() else CRASH("smooth_icon called for [src] with smoothing_flags == [smoothing_flags]") @@ -430,7 +430,7 @@ xxx xxx xxx SET_ADJ_IN_DIR(WEST, WEST) // If there's nothing going on already - if(!(new_junction & (NORTH|SOUTH)) || !(new_junction & (EAST|WEST))) + if(smoothing_flags & SMOOTH_BITMASK_CARDINALS || !(new_junction & (NORTH|SOUTH)) || !(new_junction & (EAST|WEST))) set_smoothed_icon_state(new_junction) return @@ -518,13 +518,13 @@ xxx xxx xxx /proc/smooth_zlevel(zlevel, now = FALSE) var/list/away_turfs = Z_TURFS(zlevel) for(var/turf/turf_to_smooth as anything in away_turfs) - if(turf_to_smooth.smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(turf_to_smooth.smoothing_flags & USES_SMOOTHING) if(now) turf_to_smooth.smooth_icon() else QUEUE_SMOOTH(turf_to_smooth) for(var/atom/movable/movable_to_smooth as anything in turf_to_smooth) - if(movable_to_smooth.smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(movable_to_smooth.smoothing_flags & USES_SMOOTHING) if(now) movable_to_smooth.smooth_icon() else @@ -655,15 +655,6 @@ xxx xxx xxx smoothing_groups = null canSmoothWith = null -#undef NORTH_JUNCTION -#undef SOUTH_JUNCTION -#undef EAST_JUNCTION -#undef WEST_JUNCTION -#undef NORTHEAST_JUNCTION -#undef NORTHWEST_JUNCTION -#undef SOUTHEAST_JUNCTION -#undef SOUTHWEST_JUNCTION - #undef NO_ADJ_FOUND #undef ADJ_FOUND #undef NULLTURF_BORDER diff --git a/code/game/objects/effects/decals/cleanable/misc.dm b/code/game/objects/effects/decals/cleanable/misc.dm index fcc4afa1494..04da0c517b0 100644 --- a/code/game/objects/effects/decals/cleanable/misc.dm +++ b/code/game/objects/effects/decals/cleanable/misc.dm @@ -81,11 +81,11 @@ if(T.tiled_dirt) smoothing_flags = SMOOTH_BITMASK QUEUE_SMOOTH(src) - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH_NEIGHBORS(src) /obj/effect/decal/cleanable/dirt/Destroy() - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH_NEIGHBORS(src) return ..() diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index f43cc8dfa1c..ff6e6e171bb 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -19,7 +19,7 @@ /obj/structure/Initialize(mapload) . = ..() - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH(src) QUEUE_SMOOTH_NEIGHBORS(src) if(smoothing_flags & SMOOTH_CORNERS) @@ -28,7 +28,7 @@ /obj/structure/Destroy(force) GLOB.cameranet.updateVisibility(src) - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH_NEIGHBORS(src) return ..() diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 37b894e2773..3bd3e00cc27 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -42,7 +42,7 @@ return . = ..() - if((updates & UPDATE_SMOOTHING) && (smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))) + if((updates & UPDATE_SMOOTHING) && (smoothing_flags & USES_SMOOTHING)) QUEUE_SMOOTH(src) /obj/structure/grille/update_icon_state() diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index d794f24dd08..d67f61e9442 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -300,7 +300,7 @@ /obj/structure/mineral_door/paperframe/Initialize(mapload) . = ..() - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH_NEIGHBORS(src) /obj/structure/mineral_door/paperframe/examine(mob/user) @@ -333,6 +333,6 @@ return ..() /obj/structure/mineral_door/paperframe/Destroy() - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH_NEIGHBORS(src) return ..() diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 0a499440d4e..69c6aca505f 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -92,7 +92,7 @@ /obj/structure/table/update_icon(updates=ALL) . = ..() - if((updates & UPDATE_SMOOTHING) && (smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))) + if((updates & UPDATE_SMOOTHING) && (smoothing_flags & USES_SMOOTHING)) QUEUE_SMOOTH(src) QUEUE_SMOOTH_NEIGHBORS(src) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 00760195321..6c41b2f8b15 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -393,7 +393,7 @@ //This proc is used to update the icons of nearby windows. /obj/structure/window/proc/update_nearby_icons() update_appearance() - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH_NEIGHBORS(src) //merges adjacent full-tile windows into one @@ -402,7 +402,7 @@ if(QDELETED(src) || !fulltile) return - if((updates & UPDATE_SMOOTHING) && (smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))) + if((updates & UPDATE_SMOOTHING) && (smoothing_flags & USES_SMOOTHING)) QUEUE_SMOOTH(src) var/ratio = atom_integrity / max_integrity @@ -901,7 +901,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/structure/window/reinforced/tinted/frosted/spaw /obj/structure/window/paperframe/update_icon(updates=ALL) . = ..() - if((updates & UPDATE_SMOOTHING) && (smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK))) + if((updates & UPDATE_SMOOTHING) && (smoothing_flags & USES_SMOOTHING)) QUEUE_SMOOTH(src) /obj/structure/window/paperframe/update_overlays() diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm index 1d5b5671c2c..7297f843326 100644 --- a/code/game/turfs/open/_open.dm +++ b/code/game/turfs/open/_open.dm @@ -11,7 +11,11 @@ /// Determines the type of damage overlay that will be used for the tile var/damaged_dmi = null var/broken = FALSE + /// Are broken overlays smoothed? if they are we have to change a little bit about how we render them + var/smooth_broken = FALSE var/burnt = FALSE + /// Are burnt overlays smoothed? if they are we have to change a little bit about how we render them + var/smooth_burnt = FALSE /// Returns a list of every turf state considered "broken". @@ -47,7 +51,7 @@ if(broken) var/mutable_appearance/broken_appearance = mutable_appearance(damaged_dmi, pick(broken_states())) - if(smoothing_flags && !(smoothing_flags & SMOOTH_BROKEN_TURF)) + if(smoothing_flags && !smooth_broken) var/matrix/translation = new translation.Translate(-LARGE_TURF_SMOOTHING_X_OFFSET, -LARGE_TURF_SMOOTHING_Y_OFFSET) broken_appearance.transform = translation @@ -62,7 +66,7 @@ else burnt_appearance = mutable_appearance(damaged_dmi, pick(broken_states())) - if(smoothing_flags && !(smoothing_flags & SMOOTH_BURNT_TURF)) + if(smoothing_flags && !smooth_burnt) var/matrix/translation = new translation.Translate(-LARGE_TURF_SMOOTHING_X_OFFSET, -LARGE_TURF_SMOOTHING_Y_OFFSET) burnt_appearance.transform = translation diff --git a/code/game/turfs/open/asteroid.dm b/code/game/turfs/open/asteroid.dm index aa295e1e834..8db5753a719 100644 --- a/code/game/turfs/open/asteroid.dm +++ b/code/game/turfs/open/asteroid.dm @@ -223,7 +223,7 @@ GLOBAL_LIST_EMPTY(dug_up_basalt) return TRUE return FALSE -/turf/open/misc/grass/burnt_states() +/turf/open/misc/asteroid/snow/burnt_states() return list("snow_dug") /turf/open/misc/asteroid/snow/icemoon diff --git a/code/game/turfs/open/floor/fancy_floor.dm b/code/game/turfs/open/floor/fancy_floor.dm index 935cb3b1f2c..4d79e6b1b31 100644 --- a/code/game/turfs/open/floor/fancy_floor.dm +++ b/code/game/turfs/open/floor/fancy_floor.dm @@ -276,11 +276,11 @@ if(!. || !(updates & UPDATE_SMOOTHING)) return if(!broken && !burnt) - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH(src) else make_plating() - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH_NEIGHBORS(src) /turf/open/floor/carpet/lone diff --git a/code/game/turfs/open/grass.dm b/code/game/turfs/open/grass.dm index d1779ad7499..4dd5946a7ed 100644 --- a/code/game/turfs/open/grass.dm +++ b/code/game/turfs/open/grass.dm @@ -10,9 +10,11 @@ barefootstep = FOOTSTEP_GRASS clawfootstep = FOOTSTEP_GRASS heavyfootstep = FOOTSTEP_GENERIC_HEAVY - smoothing_flags = SMOOTH_BITMASK | SMOOTH_BROKEN_TURF | SMOOTH_BURNT_TURF + smoothing_flags = SMOOTH_BITMASK smoothing_groups = SMOOTH_GROUP_TURF_OPEN + SMOOTH_GROUP_FLOOR_GRASS canSmoothWith = SMOOTH_GROUP_FLOOR_GRASS + SMOOTH_GROUP_CLOSED_TURFS + smooth_broken = TRUE + smooth_burnt = TRUE layer = HIGH_TURF_LAYER rust_resistance = RUST_RESISTANCE_ORGANIC damaged_dmi = 'icons/turf/floors/grass_damaged.dmi' @@ -24,13 +26,13 @@ var/base_burnt_icon_state = "grass_damaged" /turf/open/misc/grass/broken_states() - if (!smoothing_junction || !(smoothing_flags & SMOOTH_BROKEN_TURF)) + if (!smoothing_junction || !smooth_broken) return list("[base_broken_icon_state]-255") return list("[base_broken_icon_state]-[smoothing_junction]") /turf/open/misc/grass/burnt_states() - if (!smoothing_junction || !(smoothing_flags & SMOOTH_BURNT_TURF)) + if (!smoothing_junction || !smooth_burnt) return list("[base_burnt_icon_state]-255") return list("[base_burnt_icon_state]-[smoothing_junction]") diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 565adb22dbc..10165f86917 100644 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -153,7 +153,7 @@ GLOBAL_LIST_EMPTY(station_turfs) SETUP_SMOOTHING() - if (smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if (smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH(src) for(var/atom/movable/content as anything in src) diff --git a/code/modules/holodeck/turfs.dm b/code/modules/holodeck/turfs.dm index 7432de69517..0eb05fcdc30 100644 --- a/code/modules/holodeck/turfs.dm +++ b/code/modules/holodeck/turfs.dm @@ -164,7 +164,7 @@ /turf/open/floor/holofloor/carpet/update_icon(updates=ALL) . = ..() - if((updates & UPDATE_SMOOTHING) && overfloor_placed && smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if((updates & UPDATE_SMOOTHING) && overfloor_placed && smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH(src) /turf/open/floor/holofloor/wood diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm index b4cafdb6d53..4156d9678bc 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm @@ -538,12 +538,12 @@ Difficulty: Hard /obj/effect/temp_visual/hierophant/wall/Initialize(mapload, new_caster) . = ..() - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH_NEIGHBORS(src) QUEUE_SMOOTH(src) /obj/effect/temp_visual/hierophant/wall/Destroy() - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH_NEIGHBORS(src) return ..() diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm index 8558601f124..623e18e0494 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm @@ -408,12 +408,12 @@ While using this makes the system rely on OnFire, it still gives options for tim /obj/effect/temp_visual/elite_tumor_wall/Initialize(mapload, new_caster) . = ..() - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH_NEIGHBORS(src) QUEUE_SMOOTH(src) /obj/effect/temp_visual/elite_tumor_wall/Destroy() - if(smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH_NEIGHBORS(src) return ..() diff --git a/code/modules/shuttle/shuttle_rotate.dm b/code/modules/shuttle/shuttle_rotate.dm index 734e2337df5..cb7cad65b6b 100644 --- a/code/modules/shuttle/shuttle_rotate.dm +++ b/code/modules/shuttle/shuttle_rotate.dm @@ -12,7 +12,7 @@ If ever any of these procs are useful for non-shuttles, rename it to proc/rotate setDir(angle2dir(rotation+dir2angle(dir))) //resmooth if need be. - if(params & ROTATE_SMOOTH && smoothing_flags & (SMOOTH_CORNERS|SMOOTH_BITMASK)) + if(params & ROTATE_SMOOTH && smoothing_flags & USES_SMOOTHING) QUEUE_SMOOTH(src) //rotate the pixel offsets too.