Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fancy lighting #4229

Merged
merged 108 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
37e9aa8
kinda works actually
harryob Jan 29, 2023
60a3714
Merge remote-tracking branch 'upstream/master' into lighting-v3-kill-me
harryob Mar 31, 2023
2d71ae6
compile
harryob Mar 31, 2023
99a935e
ok
harryob Jun 19, 2023
dca3f33
Merge remote-tracking branch 'upstream/master' into lighting-v3-kill-me
harryob Jun 19, 2023
0d210a3
changed stuff
harryob Jun 19, 2023
2b9903b
Merge remote-tracking branch 'upstream/master' into lighting-v3-kill-me
harryob Aug 5, 2023
7693b95
actually fr mostly working again
harryob Aug 5, 2023
7b77729
fixes the hardhat
harryob Aug 5, 2023
83322c1
unfucked lumcount -> get_lumcount() and fixed flashlight and armor lamp
harryob Aug 17, 2023
815c6e6
flare fix
harryob Aug 17, 2023
23527d8
fix muzzle flash
harryob Aug 17, 2023
0610470
fixes the smartpack
harryob Aug 17, 2023
ca869e2
set_light() audit
harryob Aug 18, 2023
7994f88
fixes guns light_range/light_power not resetting properly
harryob Aug 18, 2023
7cceb1e
more pickup/dropped cleanout
harryob Aug 18, 2023
babde33
Merge remote-tracking branch 'upstream/master' into fancy-lighting
harryob Aug 18, 2023
d573793
yautja alpha define
harryob Aug 18, 2023
d3e8e72
apc fix
harryob Aug 18, 2023
b853d9f
redundant apc pixel shift code
harryob Aug 18, 2023
260970c
515-ening
harryob Aug 18, 2023
5f07c3e
matches and welders
morrowwolf Aug 18, 2023
72e375b
floodlights
morrowwolf Aug 18, 2023
c9db0f9
dropship lights
morrowwolf Aug 18, 2023
8aeaa5a
fixes infinite loop
Zonespace27 Aug 19, 2023
9624ce6
fix compile warn
Zonespace27 Aug 19, 2023
63b638d
Flames and unbreaks compiling
morrowwolf Aug 19, 2023
d02ff6b
OK put it back that shit is angry
morrowwolf Aug 19, 2023
c6ec8b0
changes flamer to be static
harryob Aug 19, 2023
e974b22
deletion fixes for lights and flamer fire fix
harryob Aug 19, 2023
53df081
dynamic lights update post shuttle move
harryob Aug 19, 2023
e894971
floodlight fix
harryob Aug 19, 2023
6877a49
big shuttle lighting fix
harryob Aug 19, 2023
ebdc582
fixes base lighting alpha and xeno lights
harryob Aug 19, 2023
649efed
misc fixes and cleanup
harryob Aug 19, 2023
03061f0
luminosity audit
harryob Aug 19, 2023
0a38b92
pylon core being funny
harryob Aug 19, 2023
e4beeb3
these should very much be dense
harryob Aug 19, 2023
5f03850
flashlight icons should update
harryob Aug 19, 2023
5bcb123
rip that one cc (fixes the maps dock location)
harryob Aug 19, 2023
6b2ef62
should be able to see the techweb nodes
harryob Aug 19, 2023
eb7e95e
shuttles are full bright now
harryob Aug 19, 2023
2a77bd3
fixes the camera console
harryob Aug 22, 2023
3cd1f22
Merge branch 'master' into fancy-lighting
harryob Aug 22, 2023
fdc33d6
cigarettes, lighters and sentries
harryob Aug 22, 2023
6f1df11
don't touch the dview singleton
harryob Aug 22, 2023
ca4caa3
lets wipe these out
harryob Aug 22, 2023
ffcad78
changes to movable destroy
harryob Aug 22, 2023
9b97138
dropship transparency and density
harryob Aug 22, 2023
992e1db
unbreaks hijack
harryob Aug 22, 2023
629741c
mannn
harryob Aug 22, 2023
22a8453
dropship 2
harryob Aug 22, 2023
3132f89
mortar should launch static lights and cigarettes need to be a little…
harryob Aug 22, 2023
c596140
i fucking hate the `:` operator
harryob Aug 22, 2023
f033356
i forgot to revert this hack
harryob Aug 22, 2023
0f92ebd
changes layer for attach points, flamers should use the correct color
harryob Aug 22, 2023
a43c8e7
experiment to see if ci is less angry
harryob Aug 22, 2023
3f78871
typo var
harryob Aug 22, 2023
1d08b9e
unroll this too
harryob Aug 22, 2023
a88a10b
ci pleaaase
harryob Aug 22, 2023
d001608
camera changes
harryob Aug 22, 2023
c2a6852
ci is gonna love this
harryob Aug 22, 2023
831fba7
whoops
harryob Aug 22, 2023
fa93875
i wonder
harryob Aug 22, 2023
5285944
zzz
harryob Aug 22, 2023
2bba696
what is this man
harryob Aug 22, 2023
451eb0f
alr
harryob Aug 23, 2023
6351b36
this is a nightmate
harryob Aug 23, 2023
37205cd
force arg
harryob Aug 23, 2023
00d6b1b
extends atom destroy arguments
harryob Aug 23, 2023
7a2b8a4
Light on Camera fixes dropships
Nanu308 Aug 23, 2023
3dd3d09
Shivas LZ2 fix
morrowwolf Aug 23, 2023
963430a
unfucks cameras
harryob Aug 23, 2023
997dafa
fixes techwebs and darkness through walls
harryob Aug 23, 2023
d16d701
alright
harryob Aug 23, 2023
8a52a69
sorry xenos
harryob Aug 23, 2023
ecd9edc
lets just do this huh
harryob Aug 23, 2023
78e3b07
weapon attach points are still on the wrong layer
harryob Aug 23, 2023
eb89821
Update code/datums/components/overlay_lighting.dm
harryob Aug 24, 2023
8b89afa
unwraps this
harryob Aug 24, 2023
6089696
firaview
harryob Aug 24, 2023
7f5e2bc
Revert "Update code/datums/components/overlay_lighting.dm"
harryob Aug 24, 2023
52a089e
dir lighting
harryob Aug 24, 2023
6d4c82e
macro args
harryob Aug 24, 2023
573659c
unfucks pickup of guns
harryob Aug 24, 2023
f3beb1d
light turns off when it should
harryob Aug 24, 2023
a6d446e
this should be here
harryob Aug 24, 2023
7d3d38f
don't always gotta access this
harryob Aug 24, 2023
7a45ffc
Merge remote-tracking branch 'upstream/master' into fancy-lighting
harryob Aug 24, 2023
31e44bd
light numbers
morrowwolf Aug 25, 2023
5e1b8e0
flare buff
morrowwolf Aug 25, 2023
c851223
and this
morrowwolf Aug 25, 2023
343a08c
Merge branch 'fancy-lighting' of https://github.com/cmss13-devs/cmss1…
harryob Aug 25, 2023
c82b96b
fix boiler light
harryob Aug 25, 2023
628da81
humans are now lit on fire
harryob Aug 25, 2023
b54aca6
Fiorina LZ1 fix
morrowwolf Aug 26, 2023
2232657
Fixes permalit xenos after fire
morrowwolf Aug 26, 2023
de17e54
Increases light max size to 7
morrowwolf Aug 26, 2023
0402549
de-relatening of areas
harryob Aug 26, 2023
3161fb8
removes that one sticky tile on the dropships
harryob Aug 26, 2023
e69a266
Merge branch 'fancy-lighting' of https://github.com/cmss13-devs/cmss1…
morrowwolf Aug 26, 2023
cc3017d
New Varadero LZ fix
morrowwolf Aug 26, 2023
c729da0
Merge remote-tracking branch 'upstream/master' into fancy-lighting
harryob Aug 26, 2023
649661c
vehicles fullbright, observers no underlays and xenos less glowey
harryob Aug 28, 2023
9eabccc
gun freedom
harryob Aug 28, 2023
a52cef5
Removes dropship lights
morrowwolf Aug 28, 2023
2bb76db
Possible fix for tiny lasting lights on xenos
morrowwolf Aug 28, 2023
cc69c84
helmet rail light tweaks
morrowwolf Aug 28, 2023
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
3 changes: 3 additions & 0 deletions code/__DEFINES/colours.dm
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@
*
* Important note: colours can end up significantly different from the basic html picture, especially when saturated
*/

/// Full white. rgb(255, 255, 255)
#define LIGHT_COLOR_WHITE "#FFFFFF"
/// Bright but quickly dissipating neon green. rgb(100, 200, 100)
#define LIGHT_COLOUR_GREEN "#64C864"
/// Electric green. rgb(0, 255, 0)
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/cooldowns.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#define COOLDOWN_HIJACK_BARRAGE "gamemode_explosive_barrage"
#define COOLDOWN_HIJACK_GROUND_CHECK "gamemode_ground_check"
#define COOLDOWN_ITEM_HOOD_SOUND "item_hood_sound"
#define COOLDOWN_LIGHT "cooldown_light"

//Define for ship alt
#define COOLDOWN_ALTITUDE_CHANGE "altitude_change"
Expand Down
17 changes: 17 additions & 0 deletions code/__DEFINES/dcs/signals/atom/signals_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,22 @@
///from /turf/ChangeTurf
#define COMSIG_ATOM_TURF_CHANGE "movable_turf_change"

//from atom/set_light(): (l_range, l_power, l_color)
#define COMSIG_ATOM_SET_LIGHT "atom_set_light"

///Called right before the atom changes the value of light_range to a different one, from base atom/set_light_range(): (new_range)
#define COMSIG_ATOM_SET_LIGHT_RANGE "atom_set_light_range"
///Called right before the atom changes the value of light_power to a different one, from base atom/set_light_power(): (new_power)
#define COMSIG_ATOM_SET_LIGHT_POWER "atom_set_light_power"
///Called right before the atom changes the value of light_color to a different one, from base atom/set_light_color(): (new_color)
#define COMSIG_ATOM_SET_LIGHT_COLOR "atom_set_light_color"
///Called right before the atom changes the value of light_on to a different one, from base atom/set_light_on(): (new_value)
#define COMSIG_ATOM_SET_LIGHT_ON "atom_set_light_on"
///Called right before the atom changes the value of light_flags to a different one, from base atom/set_light_flags(): (new_value)
#define COMSIG_ATOM_SET_LIGHT_FLAGS "atom_set_light_flags"

///from base of atom/set_opacity(): (new_opacity)
#define COMSIG_ATOM_SET_OPACITY "atom_set_opacity"

///When the transform or an atom is varedited through vv topic.
#define COMSIG_ATOM_VV_MODIFY_TRANSFORM "atom_vv_modify_transform"
40 changes: 36 additions & 4 deletions code/__DEFINES/layers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@

#define ABOVE_FLY_LAYER 6

#define ABOVE_LIGHTING_PLANE 16

/// blip from motion detector
#define BELOW_FULLSCREEN_LAYER 16.9
#define FULLSCREEN_LAYER 17
Expand All @@ -163,11 +161,44 @@

#define CINEMATIC_LAYER 21

#define TYPING_LAYER 500

/// for areas, so they appear above everything else on map file.
#define AREAS_LAYER 999

//---------- EMISSIVES -------------
//Layering order of these is not particularly meaningful.
//Important part is the seperation of the planes for control via plane_master

/// This plane masks out lighting to create an "emissive" effect, ie for glowing lights in otherwise dark areas.
#define EMISSIVE_PLANE 90
/// The render target used by the emissive layer.
#define EMISSIVE_RENDER_TARGET "*EMISSIVE_PLANE"
/// The layer you should use if you _really_ don't want an emissive overlay to be blocked.
#define EMISSIVE_LAYER_UNBLOCKABLE 9999

#define LIGHTING_BACKPLANE_LAYER 14.5

#define LIGHTING_RENDER_TARGET "LIGHT_PLANE"

#define SHADOW_RENDER_TARGET "SHADOW_RENDER_TARGET"

/// Plane for balloon text (text that fades up)
#define BALLOON_CHAT_PLANE 110
/// Bubble for typing indicators
#define TYPING_LAYER 500

#define O_LIGHTING_VISUAL_PLANE 120
#define O_LIGHTING_VISUAL_LAYER 16
#define O_LIGHTING_VISUAL_RENDER_TARGET "O_LIGHT_VISUAL_PLANE"

#define LIGHTING_PRIMARY_LAYER 15 //The layer for the main lights of the station
#define LIGHTING_PRIMARY_DIMMER_LAYER 15.1 //The layer that dims the main lights of the station
#define LIGHTING_SECONDARY_LAYER 16 //The colourful, usually small lights that go on top

#define LIGHTING_SHADOW_LAYER 17 //Where the shadows happen

#define ABOVE_LIGHTING_PLANE 150
#define ABOVE_LIGHTING_LAYER 18

/*=============================*\
| |
| PLANE DEFINES |
Expand All @@ -189,6 +220,7 @@

#define GHOST_PLANE 80

///--------------- FULLSCREEN RUNECHAT BUBBLES ------------
#define LIGHTING_PLANE 100
#define EXTERIOR_LIGHTING_PLANE 101

Expand Down
104 changes: 104 additions & 0 deletions code/__DEFINES/lighting.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,109 @@
///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
///A mix of the above, cheaper on moving items than dynamic, but heavier on rendering than movable
#define HYBRID_LIGHT 3
///Pointy light
#define DIRECTIONAL_LIGHT 4

#define LIGHT_ATTACHED (1<<0)

#define MINIMUM_USEFUL_LIGHT_RANGE 1.4

#define LIGHTING_ICON 'icons/effects/lighting_object.dmi' // icon used for lighting shading effects
#define LIGHTING_ICON_BIG 'icons/effects/lighting_object_big.dmi' //! icon used for lighting shading effects

#define ALPHA_TO_INTENSITY(alpha) (-(((clamp(alpha, 0, 22) - 22) / 6) ** 4) + 255)


#define LIGHT_RANGE_FIRE 3 //How many tiles standard fires glow.

#define LIGHTING_PLANE_ALPHA_VISIBLE 255
///The dim natural vision of Yautja
#define LIGHTING_PLANE_ALPHA_YAUTJA 235
#define LIGHTING_PLANE_ALPHA_MOSTLY_VISIBLE 192
#define LIGHTING_PLANE_ALPHA_MOSTLY_INVISIBLE 127
#define LIGHTING_PLANE_ALPHA_INVISIBLE 0


#define FLASH_LIGHT_DURATION 2
#define FLASH_LIGHT_POWER 3
#define FLASH_LIGHT_RANGE 3.8

// Emissive blocking.
/// Uses vis_overlays to leverage caching so that very few new items need to be made for the overlay. For anything that doesn't change outline or opaque area much or at all.
#define EMISSIVE_BLOCK_GENERIC 1
/// Uses a dedicated render_target object to copy the entire appearance in real time to the blocking layer. For things that can change in appearance a lot from the base state, like humans.
#define EMISSIVE_BLOCK_UNIQUE 2

/// The color matrix applied to all emissive overlays. Should be solely dependent on alpha and not have RGB overlap with [EM_BLOCK_COLOR].
#define EMISSIVE_COLOR list(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1, 1,1,1,0)
/// A globaly cached version of [EMISSIVE_COLOR] for quick access.
GLOBAL_LIST_INIT(emissive_color, EMISSIVE_COLOR)
/// The color matrix applied to all emissive blockers. Should be solely dependent on alpha and not have RGB overlap with [EMISSIVE_COLOR].
#define EM_BLOCK_COLOR list(0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,1, 0,0,0,0)
/// A globaly cached version of [EM_BLOCK_COLOR] for quick access.
GLOBAL_LIST_INIT(em_block_color, EM_BLOCK_COLOR)
/// A set of appearance flags applied to all emissive and emissive blocker overlays.
#define EMISSIVE_APPEARANCE_FLAGS (KEEP_APART|KEEP_TOGETHER|RESET_COLOR|RESET_TRANSFORM)
/// The color matrix used to mask out emissive blockers on the emissive plane. Alpha should default to zero, be solely dependent on the RGB value of [EMISSIVE_COLOR], and be independant of the RGB value of [EM_BLOCK_COLOR].
#define EM_MASK_MATRIX list(0,0,0,1/3, 0,0,0,1/3, 0,0,0,1/3, 0,0,0,0, 1,1,1,0)
/// A globaly cached version of [EM_MASK_MATRIX] for quick access.
GLOBAL_LIST_INIT(em_mask_matrix, EM_MASK_MATRIX)

/// Returns the red part of a #RRGGBB hex sequence as number
#define GETREDPART(hexa) hex2num(copytext(hexa, 2, 4))

/// Returns the green part of a #RRGGBB hex sequence as number
#define GETGREENPART(hexa) hex2num(copytext(hexa, 4, 6))

/// Returns the blue part of a #RRGGBB hex sequence as number
#define GETBLUEPART(hexa) hex2num(copytext(hexa, 6, 8))

/// Parse the hexadecimal color into lumcounts of each perspective.
#define PARSE_LIGHT_COLOR(source) \
do { \
if (source.light_color != COLOR_WHITE) { \
var/__light_color = source.light_color; \
source.lum_r = GETREDPART(__light_color) / 255; \
source.lum_g = GETGREENPART(__light_color) / 255; \
source.lum_b = GETBLUEPART(__light_color) / 255; \
} else { \
source.lum_r = 1; \
source.lum_g = 1; \
source.lum_b = 1; \
}; \
} while (FALSE)


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

#define MOVABLE_MAX_RANGE 7

#define LIGHTING_FALLOFF 1 // type of falloff to use for lighting; 1 for circular, 2 for square
#define LIGHTING_LAMBERTIAN 0 // use lambertian shading for light sources
#define LIGHTING_HEIGHT 1 // height off the ground of light sources on the pseudo-z-axis, you should probably leave this alone
#define LIGHTING_ROUND_VALUE (1 / 64) //Value used to round lumcounts, values smaller than 1/129 don't matter (if they do, thanks sinking points), greater values will make lighting less precise, but in turn increase performance, VERY SLIGHTLY.

/// If the max of the lighting lumcounts of each spectrum drops below this, disable luminosity on the lighting objects. Set to zero to disable soft lighting. Luminosity changes then work if it's lit at all.
#define LIGHTING_SOFT_THRESHOLD 0

// If I were you I'd leave this alone.
#define LIGHTING_BASE_MATRIX \
list \
( \
1, 1, 1, 0, \
1, 1, 1, 0, \
1, 1, 1, 0, \
1, 1, 1, 0, \
0, 0, 0, 1 \
) \

#define LIGHTING_NO_UPDATE 0
#define LIGHTING_VIS_UPDATE 1
#define LIGHTING_CHECK_UPDATE 2
#define LIGHTING_FORCE_UPDATE 3
5 changes: 5 additions & 0 deletions code/__DEFINES/objects.dm
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,8 @@ var/list/RESTRICTED_CAMERA_NETWORKS = list( //Those networks can only be accesse
// For reinforced table status
#define RTABLE_WEAKENED 1
#define RTABLE_NORMAL 2

//Lights define
#define CHECKS_PASSED 1
#define STILL_ON_COOLDOWN 2
#define NO_LIGHT_STATE_CHANGE 3
1 change: 1 addition & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@

// GUN TRAITS
#define TRAIT_GUN_SILENCED "t_gun_silenced"
#define TRAIT_GUN_LIGHT_DEACTIVATED "t_gun_light_deactivated"

// Miscellaneous item traits.
// Do NOT bloat this category, if needed make a new category (like shoe traits, xeno item traits...)
Expand Down
26 changes: 26 additions & 0 deletions code/__HELPERS/_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,32 @@
};\
} while(FALSE)

// binary search sorted insert
// IN: Object to be inserted
// LIST: List to insert object into
#define BINARY_INSERT_NUM(IN, LIST) \
var/__BIN_CTTL = length(LIST);\
if(!__BIN_CTTL) {\
LIST += IN;\
} else {\
var/__BIN_LEFT = 1;\
var/__BIN_RIGHT = __BIN_CTTL;\
var/__BIN_MID = (__BIN_LEFT + __BIN_RIGHT) >> 1;\
var/__BIN_ITEM;\
while(__BIN_LEFT < __BIN_RIGHT) {\
__BIN_ITEM = LIST[__BIN_MID];\
if(__BIN_ITEM <= IN) {\
__BIN_LEFT = __BIN_MID + 1;\
} else {\
__BIN_RIGHT = __BIN_MID;\
};\
__BIN_MID = (__BIN_LEFT + __BIN_RIGHT) >> 1;\
};\
__BIN_ITEM = LIST[__BIN_MID];\
__BIN_MID = __BIN_ITEM > IN ? __BIN_MID : __BIN_MID + 1;\
LIST.Insert(__BIN_MID, IN);\
}

//Like typesof() or subtypesof(), but returns a typecache instead of a list
/proc/typecacheof(path, ignore_root_path, only_root_path = FALSE)
if(ispath(path))
Expand Down
Loading