mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 12:35:33 +01:00
Implements Cardinal Smoothing Support, Misc Smoothing Cleanup (#84402)
## About The Pull Request [Implements a new cardinal only bitmask smoothing mode](https://github.com/tgstation/tgstation/commit/d56556491813657e5ba794ec856649f01291c39a) The icon cutter supports generating cardinal only dmis, we should support using them. This is fairly trivial, just involves skipping a step to handle diagonals. While I'm here, makes adding new smoothing modes easier by creating a "using smoothing" group define [Removes undef for smoothing junctions](https://github.com/tgstation/tgstation/pull/84402/commits/4c0a4d6e34f79769ab20c989620f396f4b4a3fe0) It is useful to be able to reference these in the general codebase, they should not be considered scoped to just icon smoothing [Fixes a copypasta issue breaking burn states for asteroid snow](https://github.com/tgstation/tgstation/commit/a41b31dbe21676aa95cb6a625d8f4deb3233faba) [Removes SMOOTH_BROKEN_TURF and SMOOTH_BURNT_TURF](https://github.com/tgstation/tgstation/commit/8a9a340728680b2988abd19631495e955de9ebf1) Bitflags should not be this specific, this should be a var on /turf/open, so that's what I'm making it. ## Why It's Good For The Game Upstreams a bit of wallening work, cleans up the codebase some ## Changelog 🆑 fix: Some varieties of snow now visually melt properly again when burned /🆑
This commit is contained in:
@@ -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)}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ..()
|
||||
|
||||
|
||||
@@ -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 ..()
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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 ..()
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ..()
|
||||
|
||||
|
||||
@@ -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 ..()
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user