Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cev_eris.dme
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@
#include "code\_onclick\hud\HUD_element\types\custom_buttons.dm"
#include "code\_onclick\hud\HUD_element\types\layout.dm"
#include "code\_onclick\hud\HUD_element\types\threePartBox.dm"
#include "code\_onclick\hud\rendering\render_plate.dm"
#include "code\_onclick\hud\screen_objects\base_screen_objects.dm"
#include "code\_onclick\hud\screen_objects\robot_screen_objects.dm"
#include "code\ATMOSPHERICS\_atmos_setup.dm"
Expand Down
70 changes: 52 additions & 18 deletions code/__DEFINES/_planes+layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,44 @@ What is the naming convention for planes or layers?
*/

//Defines for atom layers and planes
//KEEP THESE IN A NICE ACSCENDING ORDER, PLEASE
//KEEP THESE IN A NICE ACSCENDING ORDER, PLEASE //lol

//DISCLAIMER: ALL PLANES WHICH WILL BE RENDERED INGAME -MUST- HAVE AN ASSOCIATED PLANE MASTER.
//This is because plane masters collect plane content, send it to render plates
//which then relay it to a master render plate which renders 'above' everything
//unclaimed planes are left behind outside that master plate and WILL NOT be visible ingame

//NEVER HAVE ANYTHING BELOW THIS PLANE ADJUST IF YOU NEED MORE SPACE
#define LOWEST_EVER_PLANE -200

#define CLICKCATCHER_PLANE -99

#define PLANE_SPACE -95
#define PLANE_SPACE_PARALLAX -80

#define GRAVITY_PULSE_PLANE -12
#define GRAVITY_PULSE_RENDER_TARGET "*GRAVPULSE_RENDER_TARGET"

#define OPENSPACE_PLANE -10
#define OVER_OPENSPACE_PLANE -8

#define FLOOR_PLANE -2
#define GAME_PLANE -1
#define FLOOR_PLANE -5
#define GAME_PLANE -4


//whoever did this should be drawn and quartered
//Partial porting of bay defines, with our own values reinserted as placeholder
//The full list of planes and layers needs ported
#define HIDING_MOB_PLANE -1//-16 on bay.

//#define HIDING_MOB_PLANE -1//-16 on bay.

#define HIDING_MOB_LAYER 2.54 //-0 on bay

#define LYING_MOB_PLANE -1 //-14 on bay// other mobs that are lying down.
#define LYING_MOB_PLANE -4 //-14 on bay// other mobs that are lying down.

#define LYING_MOB_LAYER 3.8 //0 on bay

#define LYING_HUMAN_PLANE -1 //-13 on bay// humans that are lying down
//#define LYING_HUMAN_PLANE -1 //-13 on bay// humans that are lying down

#define LYING_HUMAN_LAYER 3.8 //0 on bay

Expand Down Expand Up @@ -156,37 +169,58 @@ What is the naming convention for planes or layers?
#define MASSIVE_OBJ_LAYER 11
#define POINT_LAYER 12

#define LIGHTING_PLANE 15
#define LIGHTING_PLANE 100
#define LIGHTING_LAYER 15

#define ABOVE_LIGHTING_PLANE 16
#define ABOVE_LIGHTING_PLANE 110
#define ABOVE_LIGHTING_LAYER 16

#define BYOND_LIGHTING_PLANE 17
#define BYOND_LIGHTING_PLANE 120
#define BYOND_LIGHTING_LAYER 17

#define WEATHER_PLANE 150

//HUD layer defines

#define FULLSCREEN_PLANE 9900
//-------------------- Rendering ---------------------
#define RENDER_PLANE_GAME 990
#define RENDER_PLANE_NON_GAME 995
#define RENDER_PLANE_MASTER 999

#define FULLSCREEN_PLANE 2000

#define FLASH_LAYER 18
#define FULLSCREEN_LAYER 18.1
#define UI_DAMAGE_LAYER 18.2

#define HUD_PLANE 9910
#define HUD_LAYER 19
#define ABOVE_HUD_PLANE 9920
#define ABOVE_HUD_LAYER 20
#define BELOW_HUD_PLANE 2900
#define BELOW_HUD_LAYER 19
#define HUD_PLANE 3000
#define HUD_LAYER 20
#define ABOVE_HUD_PLANE 4000
#define ABOVE_HUD_LAYER 21

#define RUNECHAT_PLANE 9930
#define RUNECHAT_PLANE 5000

#define BALLOON_CHAT_PLANE 9935
#define BALLOON_CHAT_PLANE 6000

#define CINEMATIC_PLANE 9950
#define CINEMATIC_LAYER 22
#define CINEMATIC_PLANE 8000
#define CINEMATIC_LAYER 24

#define BELOW_PLATING_LEVEL 1
#define ABOVE_PLATING_LEVEL 2


//---------- Plane Master multi_z_flags -------------
// Describes how different plane masters behave regarding being offset by z-levels
/// This plane master will not be duped, existing only once at the 'base' z-level
/// Mostly used for planes that really don't need to be duplicated
#define BLOCKS_PLANE_OFFSETTING (1<<0)
/// This plane master will offset relays to match the highest possible rendering Z
/// Mainly used for effects that need to render above all z's
#define OFFSET_RELAYS_MATCH_HIGHEST (1<<1)


/atom/proc/reset_plane_and_layer()
set_plane(original_plane)
layer = initial(layer)
Expand Down
173 changes: 167 additions & 6 deletions code/__HELPERS/filters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,14 @@ GLOBAL_LIST_INIT(master_filter_info, list(
if(!isnull(flags))
.["flags"] = flags

/proc/apply_wibbly_filters(atom/in_atom, length)


//filter procs & elements, including distortion elements(using the distortion filter on the game plate. See render_plate.dm)


///produces a heavy warping effect that displaces an object across multiple axes simutaneously.
///incredibly necrotic old code I don't fully understand. But tg uses it so it must be fine :D
/atom/proc/apply_wibbly_filters(length)
for(var/i in 1 to 7)
//This is a very baffling and strange way of doing this but I am just preserving old functionality
var/X
Expand All @@ -306,14 +313,168 @@ GLOBAL_LIST_INIT(master_filter_info, list(
rsq = X*X + Y*Y
while(rsq<100 || rsq>900) // Yeah let's just loop infinitely due to bad luck what's the worst that could happen?
var/random_roll = rand()
in_atom.add_filter("wibbly-[i]", 5, wave_filter(x = X, y = Y, size = rand() * 2.5 + 0.5, offset = random_roll))
var/filter = in_atom.get_filter("wibbly-[i]")
add_filter("wibbly-[i]", 5, wave_filter(x = X, y = Y, size = rand() * 2.5 + 0.5, offset = random_roll))
var/filter = get_filter("wibbly-[i]")
animate(filter, offset = random_roll, time = 0, loop = -1, flags = ANIMATION_PARALLEL)
animate(offset = random_roll - 1, time = rand() * 20 + 10)

/proc/remove_wibbly_filters(atom/in_atom)
///removes the 'wibbling' effect(see apply_wibbly_filters)
/atom/proc/remove_wibbly_filters()
var/filter
for(var/i in 1 to 7)
filter = in_atom.get_filter("wibbly-[i]")
filter = get_filter("wibbly-[i]")
animate(filter)
in_atom.remove_filter("wibbly-[i]")
remove_filter("wibbly-[i]")

///normal map used for advanced wibbling
/obj/effect/abstract/normalmap_bumpy
icon = 'icons/effects/light_overlays/normalmap_bumpy.dmi'
icon_state = "normalmap_bumpy"
appearance_flags = RESET_COLOR|RESET_TRANSFORM|NO_CLIENT_COLOR|RESET_ALPHA|PIXEL_SCALE
plane = GRAVITY_PULSE_PLANE


///Proc which replaces an atom's visual appearance with a wobbly distortion mask, using render target
/atom/movable/proc/apply_wibble_invisible(strength=50)
var/obj/effect/abstract/normalmap_bumpy/normal_bumpy = new(src)
var/render_tgt = "*warped_invis_[REF(normal_bumpy)]"
if(render_target)
render_tgt += "_oldtgt_" + render_target
normal_bumpy.alpha = (255/100) * strength
render_target = render_tgt
normal_bumpy.apply_wibbly_filters()
normal_bumpy.add_filter("wibble_mask", 1, alpha_mask_filter(-48, -48, render_source = render_target))
vis_contents += normal_bumpy
update_overlays()
update_icon()
update_filters()

/atom/movable/proc/remove_wibble_invisible()
var/list/split_result = splittext(render_target, "_oldtgt_")
var/ref_part = split_result[1]
if(length(split_result) > 1)
var/old_part = split_result[2]
render_target = old_part
else
render_target = null
ref_part = copytext(ref_part, 15)
var/obj/effect/abstract/normalmap_bumpy/normal_bumpy = locate(ref_part) in vis_contents
vis_contents -= normal_bumpy
qdel(normal_bumpy)

///Applies a subtle, vapour-like distortion effect to an atom, but keeps it visible.
/atom/movable/proc/add_mirage_mask(strength=50)
var/obj/effect/abstract/normalmap_bumpy/normal_bumpy = new(src)
// var/render_tgt = "*warped_invis_[REF(normal_bumpy)]"
// if(render_target)
// render_tgt += "_oldtgt_" + render_target
normal_bumpy.alpha = (255/100) * strength
// render_target = render_tgt
normal_bumpy.apply_wibbly_filters()
normal_bumpy.add_filter("wibble_mask", 1, alpha_mask_filter(-48, -48, render_source="*[REF(src)]"))
var/mutable_appearance/mask = mutable_appearance()
mask.appearance = src.appearance
mask.render_target = "*[REF(src)]"
//mask.alpha = 125
normal_bumpy.overlays += mask
//note: because this doesn't currently produce a searchable ref, it'll need to be manually tracked and removed.
vis_contents += normal_bumpy

//notes on looping an animate() sequence:
//the inherent 'loop' function on animate() will not directly 'reset' the conditions it created
//in this case, radius = 1 > radius = 32 && size = 2 > size = 4
//a second, immediately following animate command is needed to reset these back to their original conditions
//to make the loop actually do anything the second time onwards
//second animate() will be treated as an extension of the first, if it does not have an obj target

///applies a repeating rippling effect to a target atom.
///args: length(duration of ripple), strength(intensity of ripple)
/atom/proc/apply_ripple_filter(length = 1.5 SECONDS, strength = 4)
add_filter("basic_ripple", 3, ripple_filter(1, strength, flags = WAVE_BOUNDED))
animate(get_filter("basic_ripple"), radius = 32, time = length, size = (strength * 2), loop = -1, easing = LINEAR_EASING)
animate(radius = 0, size = 2)

///removes the affect of apply_ripple_filter()
/atom/proc/remove_ripple_filter()
remove_filter("basic_ripple")

///A basic temporary displacement effect
/obj/effect/temp_visual/space_warp
icon = 'icons/effects/light_overlays/light_128.dmi'
icon_state = "light"
plane = GRAVITY_PULSE_PLANE
pixel_x = -48
pixel_y = -48
duration = 4

/obj/effect/temp_visual/space_warp/Initialize()
. = ..()
animate(src, time=duration, transform=matrix().Scale(0.1,0.1))

///A distortion effect which remains in place and effects a wide area through walls. Useful for large, dramatic distortions
/atom/movable/static_distortion
plane = GRAVITY_PULSE_PLANE
appearance_flags = PIXEL_SCALE|LONG_GLIDE // no tile bound so you can see it around corners and so
icon = 'icons/effects/light_overlays/light_352.dmi'
icon_state = "light"
pixel_x = -176
pixel_y = -176

/obj/effect/temp_visual/blink_drive
icon = 'icons/effects/light_overlays/light_128.dmi'
icon_state = "light"
plane = GRAVITY_PULSE_PLANE
duration = 8
appearance_flags = PIXEL_SCALE|LONG_GLIDE
alpha = 0

/obj/effect/temp_visual/blink_drive/Initialize(mapload)
. = ..()
src.transform *= 0
var/image/I = image(icon, src, icon_state, 10, pixel_x = -48, pixel_y = -48)
overlays += I //we use an overlay so the icon and light source are both in the correct location
icon_state = null
animate(src, time=(duration), transform=matrix().Scale(1,1))
// animate(src, time=(duration / 2), alpha = 255)
// animate(time=(duration / 2), alpha = 0)

/obj/effect/temp_visual/bluespace_pulse
icon = 'icons/effects/light_overlays/normalmap_bumpy.dmi'
icon_state = "normalmap_bumpy_circle"
plane = GRAVITY_PULSE_PLANE
duration = 4
alpha = 125

/obj/effect/temp_visual/bluespace_pulse/Initialize(mapload)
. = ..()
var/image/I = image(icon, src, icon_state, 10, pixel_x = -144, pixel_y = -144)
overlays += I //we use an overlay so the icon and light source are both in the correct location
icon_state = null
animate(src, time=(duration+0.1), transform=matrix().Scale(0.1,0.1))
set_light(4, 4, COLOR_LIGHTING_BLUE_DARK)


/**
* Visual shockwave effect using a displacement filter applied to the game world plate
* Args:
* * radius: visual max radius of the effect
* * speed_rate: propagation rate of the effect as a ratio (0.5 is twice as fast)
* * easing_type: easing type to use in the anim
* * y_offset: additional pixel_y offsets
* * x_offset: additional pixel_x offsets
*/
/obj/effect/temp_visual/shockwave
icon = 'icons/effects/light_overlays/normalmap_shockwave.dmi'
icon_state = "shockwave"
plane = GRAVITY_PULSE_PLANE
pixel_x = -496
pixel_y = -496

/obj/effect/temp_visual/shockwave/Initialize(mapload, radius=12, direction, speed_rate=1, easing_type = LINEAR_EASING, y_offset=0, x_offset=0)
. = ..()
pixel_x += x_offset
pixel_y += y_offset
duration = 0.5 * radius * speed_rate
transform = matrix().Scale(32 / 1024, 32 / 1024)
animate(src, time = 1/2 * radius * speed_rate, transform=matrix().Scale((32 / 1024) * radius * 1.5, (32 / 1024) * radius * 1.5), easing=easing_type)

Loading
Loading