Skip to content

Commit

Permalink
wall highlight improvements - 9 8 23
Browse files Browse the repository at this point in the history
  • Loading branch information
DrDuckedGoose committed Aug 9, 2023
1 parent a5d2c7a commit 2186a08
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 39 deletions.
6 changes: 2 additions & 4 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#define ZMIMIC_MAX_DEPTH 10

#define FLOOR_PLANE -7
#define WALL_PLANE -5
#define WALL_PLANE_RENDER_TARGET "*WALL_PLANE_RENDER_TARGET"
#define GAME_PLANE -4

#define SPACE_LAYER 1.8
Expand Down Expand Up @@ -157,10 +159,6 @@
//Plane for highlighting objects
#define PSYCHIC_PLANE 550
#define PSYCHIC_PLANE_RENDER_TARGET "PSYCHIC_PLANE"
//Plane for highlighting walls
#define PSYCHIC_WALL_PLANE 551
#define PSYCHIC_WALL_PLANE_RENDER_TARGET "PSYCHIC_WALL_PLANE"


//-------------------- Rendering ---------------------
#define RENDER_PLANE_GAME 990
Expand Down
27 changes: 17 additions & 10 deletions code/_onclick/hud/rendering/plane_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@
if(istype(mymob) && mymob.client?.prefs?.read_player_preference(/datum/preference/toggle/ambient_occlusion))
add_filter("openspace_shadow", 1, drop_shadow_filter(color = "#04080FAA", size = 10))

/atom/movable/screen/plane_master/wall
name = "wall plane master"
plane = WALL_PLANE
appearance_flags = PLANE_MASTER
render_target = WALL_PLANE_RENDER_TARGET
blend_mode = BLEND_OVERLAY

/atom/movable/screen/plane_master/wall/backdrop(mob/mymob)
. = ..()
remove_filter("AO")
if(istype(mymob) && mymob.client?.prefs?.read_player_preference(/datum/preference/toggle/ambient_occlusion))
add_filter("AO", 1, drop_shadow_filter(x = 0, y = -2, size = 4, color = "#04080FAA"))
remove_filter("eye_blur")
if(istype(mymob) && mymob.eye_blurry)
add_filter("eye_blur", 1, gauss_blur_filter(clamp(mymob.eye_blurry * 0.1, 0.6, 3)))


///Contains most things in the game world
/atom/movable/screen/plane_master/game_world
name = "game world plane master"
Expand Down Expand Up @@ -211,13 +228,3 @@
render_target = PSYCHIC_PLANE_RENDER_TARGET
render_relay_plane = RENDER_PLANE_NON_GAME
alpha = 0

/atom/movable/screen/plane_master/psychic/wall
name = "psychic wall plane master"
plane = PSYCHIC_WALL_PLANE
render_target = PSYCHIC_WALL_PLANE_RENDER_TARGET

/atom/movable/screen/plane_master/psychic/wall/Initialize(mapload)
. = ..()
filters += filter(type = "alpha", x = 0, y = 0, icon = icon('icons/mob/psychic.dmi', "e"))

1 change: 0 additions & 1 deletion code/game/objects/structures/window.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@

if(fulltile)
//Overlay for psychic walls - we can't assign two layers at once
add_overlay(generate_psychic_overlay(src))
setDir()

//windows only block while reinforced and fulltile, so we'll use the proc
Expand Down
6 changes: 1 addition & 5 deletions code/game/turfs/closed/_closed.dm
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
rad_flags = RAD_PROTECT_CONTENTS | RAD_NO_CONTAMINATE
rad_insulation = RAD_MEDIUM_INSULATION
pass_flags_self = PASSCLOSEDTURF

/turf/closed/Initialize(mapload)
. = ..()
//Overlay for psychic walls - we can't assign two layers at once
add_overlay(generate_psychic_overlay(src))
plane = WALL_PLANE

/turf/closed/AfterChange()
. = ..()
Expand Down
27 changes: 8 additions & 19 deletions code/modules/mob/living/carbon/human/species_types/psyphoza.dm
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,6 @@ GLOBAL_LIST_INIT(psychic_sense_blacklist, typecacheof(list(/turf/open, /obj/mach
if(B)
animate(B, alpha = 255)
animate(B, alpha = 0, time = sense_time, easing = SINE_EASING, flags = EASE_IN)
//Wall nearby highlighting
var/atom/movable/screen/plane_master/psychic/wall/PW = locate(/atom/movable/screen/plane_master/psychic/wall) in owner.client?.screen
if(PW)
animate(PW, alpha = 0)
animate(PW, alpha = 255, time = sense_time, easing = SINE_EASING, flags = EASE_IN)
//Setup timer to delete image
if(overlay_timer)
deltimer(overlay_timer)
Expand Down Expand Up @@ -340,7 +335,14 @@ GLOBAL_LIST_INIT(psychic_sense_blacklist, typecacheof(list(/turf/open, /obj/mach
var/visual_index = 0

/atom/movable/screen/fullscreen/blind/psychic_highlight/wall
plane = PSYCHIC_WALL_PLANE
plane = FULLSCREEN_PLANE
blend_mode = BLEND_DEFAULT
layer = 4.1

/atom/movable/screen/fullscreen/blind/psychic_highlight/wall/Initialize(mapload)
. = ..()
filters += filter(type = "alpha", render_source = "*WALL_PLANE_RENDER_TARGET")
filters += filter(type = "alpha", icon = icon('icons/mob/psychic.dmi', "e"))

/atom/movable/screen/fullscreen/blind/psychic_highlight/Initialize(mapload)
. = ..()
Expand Down Expand Up @@ -437,18 +439,5 @@ GLOBAL_LIST_INIT(psychic_sense_blacklist, typecacheof(list(/turf/open, /obj/mach
if(psychic_action?.auto_sense)
return FALSE

/proc/generate_psychic_overlay(atom/target)
var/mutable_appearance/M = new()
M.appearance = target.appearance
M.transform = target.transform
M.pixel_x = 0 //Reset pixel adjustments to avoid bug where overlays tower
M.pixel_y = 0
M.pixel_z = 0
M.pixel_w = 0
M.plane = PSYCHIC_WALL_PLANE //Draw overlay on this plane so we can use it as a mask
M.dir = target.dir

return M

#undef PSYCHIC_OVERLAY_UPPER
#undef PSYPHOZA_BURNMOD

0 comments on commit 2186a08

Please sign in to comment.