Skip to content

Commit

Permalink
Merge pull request Blackstone-SS13#175 from Arturlang/overlay_lighting
Browse files Browse the repository at this point in the history
Sloppily ports the lighting component
  • Loading branch information
emoats18 authored Apr 17, 2024
2 parents f373e83 + 631f2f4 commit ca4e394
Show file tree
Hide file tree
Showing 61 changed files with 903 additions and 241 deletions.
2 changes: 1 addition & 1 deletion code/__DEFINES/colors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@
if("Orange")
return CLOTHING_ORANGE
if("Majenta")
return CLOTHING_MAJENTA
return CLOTHING_MAJENTA
1 change: 0 additions & 1 deletion code/__DEFINES/components.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
#define COMSIG_ATOM_SING_PULL "atom_sing_pull" //from base of atom/singularity_pull(): (S, current_size)
#define COMSIG_ATOM_BSA_BEAM "atom_bsa_beam_pass" //from obj/machinery/bsa/full/proc/fire(): ()
#define COMSIG_ATOM_BLOCKS_BSA_BEAM 1
#define COMSIG_ATOM_SET_LIGHT "atom_set_light" //from base of atom/set_light(): (l_range, l_power, l_color)
#define COMSIG_ATOM_DIR_CHANGE "atom_dir_change" //from base of atom/setDir(): (old_dir, new_dir)
#define COMSIG_ATOM_CONTENTS_DEL "atom_contents_del" //from base of atom/handle_atom_del(): (atom/deleted)
#define COMSIG_ATOM_HAS_GRAVITY "atom_has_gravity" //from base of atom/has_gravity(): (turf/location, list/forced_gravities)
Expand Down
4 changes: 4 additions & 0 deletions code/__DEFINES/dcs/helpers.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/// Signifies that this proc is used to handle signals.
/// Every proc you pass to RegisterSignal must have this.
#define SIGNAL_HANDLER SHOULD_NOT_SLEEP(TRUE)

9 changes: 9 additions & 0 deletions code/__DEFINES/dcs/signals.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

///Called when the movable tries to change its dynamic light color setting, from base atom/movable/lighting_overlay_set_color(): (color)
#define COMSIG_MOVABLE_LIGHT_OVERLAY_SET_RANGE "movable_light_overlay_set_color"
///Called when the movable tries to change its dynamic light power setting, from base atom/movable/lighting_overlay_set_power(): (power)
#define COMSIG_MOVABLE_LIGHT_OVERLAY_SET_POWER "movable_light_overlay_set_power"
///Called when the movable tries to change its dynamic light range setting, from base atom/movable/lighting_overlay_set_range(): (range)
#define COMSIG_MOVABLE_LIGHT_OVERLAY_SET_COLOR "movable_light_overlay_set_range"
///Called when the movable tries to toggle its dynamic light LIGHTING_ON status, from base atom/movable/lighting_overlay_toggle_on(): (new_state)
#define COMSIG_MOVABLE_LIGHT_OVERLAY_TOGGLE_ON "movable_light_overlay_toggle_on"
44 changes: 44 additions & 0 deletions code/__DEFINES/dcs/signals_atom_lighting.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Atom lighting signals. Format:
// When the signal is called: (signal arguments)
// All signals send the source datum of the signal as the first argument

// Lighting:
///from base of [atom/proc/set_light]: (l_range, l_power, l_color, l_on)
#define COMSIG_ATOM_SET_LIGHT "atom_set_light"
/// Blocks [/atom/proc/set_light], [/atom/proc/set_light_power], [/atom/proc/set_light_range], [/atom/proc/set_light_color], [/atom/proc/set_light_on], and [/atom/proc/set_light_flags].
#define COMPONENT_BLOCK_LIGHT_UPDATE (1<<0)
///Called right before the atom changes the value of light_power to a different one, from base [atom/proc/set_light_power]: (new_power)
#define COMSIG_ATOM_SET_LIGHT_POWER "atom_set_light_power"
///Called right after the atom changes the value of light_power to a different one, from base of [/atom/proc/set_light_power]: (old_power)
#define COMSIG_ATOM_UPDATE_LIGHT_POWER "atom_update_light_power"
///Called right before the atom changes the value of light_range to a different one, from base [atom/proc/set_light_range]: (new_range)
#define COMSIG_ATOM_SET_LIGHT_RANGE "atom_set_light_range"
///Called right after the atom changes the value of light_range to a different one, from base of [/atom/proc/set_light_range]: (old_range)
#define COMSIG_ATOM_UPDATE_LIGHT_RANGE "atom_update_light_range"
///Called right before the atom changes the value of light_color to a different one, from base [atom/proc/set_light_color]: (new_color)
#define COMSIG_ATOM_SET_LIGHT_COLOR "atom_set_light_color"
///Called right after the atom changes the value of light_color to a different one, from base of [/atom/proc/set_light_color]: (old_color)
#define COMSIG_ATOM_UPDATE_LIGHT_COLOR "atom_update_light_color"
///Called right before the atom changes the value of light_angle to a different one, from base [atom/proc/set_light_angle]: (new_angle)
#define COMSIG_ATOM_SET_LIGHT_ANGLE "atom_set_light_angle"
///Called right after the atom changes the value of light_angle to a different one, from base of [/atom/proc/set_light_angle]: (old_angle)
#define COMSIG_ATOM_UPDATE_LIGHT_ANGLE "atom_update_light_angle"
///Called right before the atom changes the value of light_dir to a different one, from base [atom/proc/set_light_dir]: (new_dir)
#define COMSIG_ATOM_SET_LIGHT_DIR "atom_set_light_dir"
///Called right after the atom changes the value of light_dir to a different one, from base of [/atom/proc/set_light_dir]: (old_dir)
#define COMSIG_ATOM_UPDATE_LIGHT_DIR "atom_update_light_dir"
///Called right before the atom changes the value of light_on to a different one, from base [atom/proc/set_light_on]: (new_value)
#define COMSIG_ATOM_SET_LIGHT_ON "atom_set_light_on"
///Called right after the atom changes the value of light_on to a different one, from base of [/atom/proc/set_light_on]: (old_value)
#define COMSIG_ATOM_UPDATE_LIGHT_ON "atom_update_light_on"
///Called right before the atom changes the value of light_height to a different one, from base [atom/proc/set_light_height]: (new_value)
#define COMSIG_ATOM_SET_LIGHT_HEIGHT "atom_set_light_height"
///Called right after the atom changes the value of light_height to a different one, from base of [/atom/proc/set_light_height]: (old_value)
#define COMSIG_ATOM_UPDATE_LIGHT_HEIGHT "atom_update_light_height"
///Called right before the atom changes the value of light_flags to a different one, from base [atom/proc/set_light_flags]: (new_flags)
#define COMSIG_ATOM_SET_LIGHT_FLAGS "atom_set_light_flags"
///Called right after the atom changes the value of light_flags to a different one, from base of [/atom/proc/set_light_flags]: (old_flags)
#define COMSIG_ATOM_UPDATE_LIGHT_FLAGS "atom_update_light_flags"

///Called when an atom has a light template applied to it. Frombase of [/datum/light_template/proc/mirror_onto]: ()
#define COMSIG_ATOM_LIGHT_TEMPLATE_MIRRORED "atom_light_template_mirrored"
54 changes: 33 additions & 21 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -103,33 +103,45 @@
#define LIGHTING_PLANE 15
#define LIGHTING_LAYER 15 //15

#define ABOVE_LIGHTING_PLANE 16
#define ABOVE_LIGHTING_LAYER 16
#define EMISSIVE_PLANE 16
#define EMISSIVE_RENDER_TARGET "*EMISSIVE_PLANE"

#define BYOND_LIGHTING_PLANE 18
#define BYOND_LIGHTING_LAYER 18
#define EMISSIVE_UNBLOCKABLE_PLANE 17
#define EMISSIVE_UNBLOCKABLE_LAYER 17
#define EMISSIVE_UNBLOCKABLE_RENDER_TARGET "*EMISSIVE_UNBLOCKABLE_PLANE"

#define CAMERA_STATIC_PLANE 19
#define CAMERA_STATIC_LAYER 19
#define O_LIGHTING_VISUAL_PLANE 18
#define O_LIGHTING_VISUAL_LAYER 18
#define O_LIGHTING_VISUAL_RENDER_TARGET "O_LIGHT_VISUAL_PLANE"

#define ABOVE_LIGHTING_PLANE 19
#define ABOVE_LIGHTING_LAYER 19
#define ABOVE_LIGHTING_RENDER_TARGET "ABOVE_LIGHTING_PLANE"

#define BYOND_LIGHTING_PLANE 21
#define BYOND_LIGHTING_LAYER 21

#define CAMERA_STATIC_PLANE 22
#define CAMERA_STATIC_LAYER 22

//HUD layer defines


#define FULLSCREEN_PLANE 20
#define FLASH_LAYER 20
#define FULLSCREEN_LAYER 20.1
#define UI_DAMAGE_LAYER 20.2
#define BLIND_LAYER 20.3
#define CRIT_LAYER 20.4
#define CURSE_LAYER 20.5
#define BACKHUD_LAYER 20.6
#define FULLSCREEN_PLANE 23
#define FLASH_LAYER 23
#define FULLSCREEN_LAYER 23.1
#define UI_DAMAGE_LAYER 23.2
#define BLIND_LAYER 23.3
#define CRIT_LAYER 23.4
#define CURSE_LAYER 23.5
#define BACKHUD_LAYER 23.6

#define HUD_PLANE 21
#define HUD_LAYER 21
#define ABOVE_HUD_PLANE 22
#define ABOVE_HUD_LAYER 22
#define HUD_PLANE 24
#define HUD_LAYER 24
#define ABOVE_HUD_PLANE 25
#define ABOVE_HUD_LAYER 25

#define SPLASHSCREEN_LAYER 23
#define SPLASHSCREEN_PLANE 23
#define SPLASHSCREEN_LAYER 26
#define SPLASHSCREEN_PLANE 27

#define FOV_EFFECTS_LAYER 10000
#define FOV_EFFECTS_LAYER 10000
10 changes: 10 additions & 0 deletions code/__DEFINES/lighting.dm
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
///Object doesn't use any of the light systems. Should be changed to add a light source to the object.
#define NO_LIGHT_SUPPORT 0
///Light made with the lighting datums, applying a matrix.
#define STATIC_LIGHT 1
///Light made by masking the lighting darkness plane.
#define MOVABLE_LIGHT 2

///Is a movable light source attached to another movable (its loc), meaning that the lighting component should go one level deeper.
#define LIGHT_ATTACHED (1<<0)

//Bay lighting engine shit, not in /code/modules/lighting because BYOND is being shit about it
#define LIGHTING_INTERVAL 5 // frequency, in 1/10ths of a second, of the lighting process

Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/machines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define ENVIRON 3
#define TOTAL 4 //for total power used only
#define STATIC_EQUIP 5
#define STATIC_LIGHT 6
#define STATIC_LIGHT_A 6
#define STATIC_ENVIRON 7

//Power use
Expand Down
16 changes: 15 additions & 1 deletion code/_onclick/hud/plane_master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@
blend_mode = BLEND_MULTIPLY
mouse_opacity = MOUSE_OPACITY_TRANSPARENT

/obj/screen/plane_master/lighting/Initialize()
. = ..()
filters += filter(type="alpha", render_source = EMISSIVE_RENDER_TARGET, flags = MASK_INVERSE)
filters += filter(type="alpha", render_source = EMISSIVE_UNBLOCKABLE_RENDER_TARGET, flags = MASK_INVERSE)
filters += filter(type="alpha", render_source = O_LIGHTING_VISUAL_RENDER_TARGET, flags = MASK_INVERSE)

/obj/screen/plane_master/parallax
name = "parallax plane master"
// screen_loc = "CENTER-2"
Expand Down Expand Up @@ -187,4 +193,12 @@
plane = FIELD_OF_VISION_BLOCKER_PLANE
render_target = FIELD_OF_VISION_BLOCKER_RENDER_TARGET
mouse_opacity = 0
appearance_flags = PLANE_MASTER
appearance_flags = PLANE_MASTER

/obj/screen/plane_master/o_light_visual
name = "overlight light visual plane master"
layer = O_LIGHTING_VISUAL_LAYER
plane = O_LIGHTING_VISUAL_PLANE
render_target = O_LIGHTING_VISUAL_RENDER_TARGET
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
blend_mode = BLEND_MULTIPLY
Loading

0 comments on commit ca4e394

Please sign in to comment.