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

Preferences for a darker crit overlay and a black flash overlay #5997

Merged
Merged
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
9 changes: 9 additions & 0 deletions code/__DEFINES/mode.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@
#define PAIN_OVERLAY_LEGACY 2 //Creates a legacy blurring effect over your screen if you have any eye_blur at all. Not recommended.
//=================================================

//=================================================
#define FLASH_OVERLAY_WHITE 0 //Flashes your screen white.
#define FLASH_OVERLAY_DARK 1 //Flashes your screen a dark grey.
//=================================================

//=================================================
#define CRIT_OVERLAY_WHITE 0 //Overlays your screen white.
#define CRIT_OVERLAY_DARK 1 //Overlays your screen a dark grey.
//=================================================

/// Number of weighted marine players for 1 gear_scale. gear_scale is clamped to 1 minimum
#define MARINE_GEAR_SCALING_NORMAL 50
Expand Down
6 changes: 6 additions & 0 deletions code/_onclick/hud/fullscreen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@
icon_state = "passage"
layer = FULLSCREEN_CRIT_LAYER

/atom/movable/screen/fullscreen/crit/dark
color = COLOR_GRAY

/atom/movable/screen/fullscreen/blind
icon_state = "blackimageoverlay"
layer = FULLSCREEN_BLIND_LAYER
Expand All @@ -127,6 +130,9 @@
screen_loc = "WEST,SOUTH to EAST,NORTH"
icon_state = "noise"

/atom/movable/screen/fullscreen/flash/dark
icon_state = "black"

/atom/movable/screen/fullscreen/high
icon = 'icons/mob/hud/screen1.dmi'
screen_loc = "WEST,SOUTH to EAST,NORTH"
Expand Down
2 changes: 2 additions & 0 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
/client/proc/toggle_admin_sound_types,
/client/proc/receive_random_tip,
/client/proc/set_eye_blur_type,
/client/proc/set_flash_type,
/client/proc/set_crit_type,
))

/client/proc/reduce_minute_count()
Expand Down
4 changes: 4 additions & 0 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ GLOBAL_LIST_INIT(bgstate_options, list(
var/chat_display_preferences = CHAT_TYPE_ALL
var/item_animation_pref_level = SHOW_ITEM_ANIMATIONS_ALL
var/pain_overlay_pref_level = PAIN_OVERLAY_BLURRY
var/flash_overlay_pref = FLASH_OVERLAY_WHITE
var/crit_overlay_pref = CRIT_OVERLAY_WHITE
var/UI_style_color = "#ffffff"
var/UI_style_alpha = 255
var/View_MC = FALSE
Expand Down Expand Up @@ -593,6 +595,8 @@ GLOBAL_LIST_INIT(bgstate_options, list(
dat += "<b>Play Announcement Sounds As Ghost:</b> <a href='?_src_=prefs;preference=hear_observer_announcements'><b>[(toggles_sound & SOUND_OBSERVER_ANNOUNCEMENTS) ? "Yes" : "No"]</b></a><br>"
dat += "<b>Toggle Meme or Atmospheric Sounds:</b> <a href='?src=\ref[src];action=proccall;procpath=/client/proc/toggle_admin_sound_types'>Toggle</a><br>"
dat += "<b>Set Eye Blur Type:</b> <a href='?src=\ref[src];action=proccall;procpath=/client/proc/set_eye_blur_type'>Set</a><br>"
dat += "<b>Set Flash Type:</b> <a href='?src=\ref[src];action=proccall;procpath=/client/proc/set_flash_type'>Set</a><br>"
dat += "<b>Set Crit Type:</b> <a href='?src=\ref[src];action=proccall;procpath=/client/proc/set_crit_type'>Set</a><br>"
dat += "<b>Play Lobby Music:</b> <a href='?_src_=prefs;preference=lobby_music'><b>[(toggles_sound & SOUND_LOBBY) ? "Yes" : "No"]</b></a><br>"
dat += "<b>Play VOX Announcements:</b> <a href='?_src_=prefs;preference=sound_vox'><b>[(hear_vox) ? "Yes" : "No"]</b></a><br>"
dat += "<b>Default Ghost Night Vision Level:</b> <a href='?_src_=prefs;preference=ghost_vision_pref;task=input'><b>[ghost_vision_pref]</b></a><br>"
Expand Down
6 changes: 6 additions & 0 deletions code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@
S["UI_style_alpha"] >> UI_style_alpha
S["item_animation_pref_level"] >> item_animation_pref_level
S["pain_overlay_pref_level"] >> pain_overlay_pref_level
S["flash_overlay_pref"] >> flash_overlay_pref
S["crit_overlay_pref"] >> crit_overlay_pref
S["stylesheet"] >> stylesheet
S["window_skin"] >> window_skin
S["fps"] >> fps
Expand Down Expand Up @@ -233,6 +235,8 @@
UI_style_alpha = sanitize_integer(UI_style_alpha, 0, 255, initial(UI_style_alpha))
item_animation_pref_level = sanitize_integer(item_animation_pref_level, SHOW_ITEM_ANIMATIONS_NONE, SHOW_ITEM_ANIMATIONS_ALL, SHOW_ITEM_ANIMATIONS_ALL)
pain_overlay_pref_level = sanitize_integer(pain_overlay_pref_level, PAIN_OVERLAY_BLURRY, PAIN_OVERLAY_LEGACY, PAIN_OVERLAY_BLURRY)
flash_overlay_pref = sanitize_integer(flash_overlay_pref, FLASH_OVERLAY_WHITE, FLASH_OVERLAY_DARK)
crit_overlay_pref = sanitize_integer(crit_overlay_pref, CRIT_OVERLAY_WHITE, CRIT_OVERLAY_DARK)
window_skin = sanitize_integer(window_skin, 0, SHORT_REAL_LIMIT, initial(window_skin))
ghost_vision_pref = sanitize_inlist(ghost_vision_pref, list(GHOST_VISION_LEVEL_NO_NVG, GHOST_VISION_LEVEL_MID_NVG, GHOST_VISION_LEVEL_FULL_NVG), GHOST_VISION_LEVEL_MID_NVG)
ghost_orbit = sanitize_inlist(ghost_orbit, GLOB.ghost_orbits, initial(ghost_orbit))
Expand Down Expand Up @@ -327,6 +331,8 @@
S["tgui_say"] << tgui_say
S["item_animation_pref_level"] << item_animation_pref_level
S["pain_overlay_pref_level"] << pain_overlay_pref_level
S["flash_overlay_pref"] << flash_overlay_pref
S["crit_overlay_pref"] << crit_overlay_pref
S["stylesheet"] << stylesheet
S["be_special"] << be_special
S["default_slot"] << default_slot
Expand Down
25 changes: 25 additions & 0 deletions code/modules/client/preferences_toggles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,8 @@
"<a href='?src=\ref[src];action=proccall;procpath=/client/proc/switch_item_animations'>Toggle Item Animations</a><br>",
"<a href='?src=\ref[src];action=proccall;procpath=/client/proc/toggle_admin_sound_types'>Toggle Admin Sound Types</a><br>",
"<a href='?src=\ref[src];action=proccall;procpath=/client/proc/set_eye_blur_type'>Set Eye Blur Type</a><br>",
"<a href='?src=\ref[src];action=proccall;procpath=/client/proc/set_flash_type'>Set Flash Type</a><br>",
"<a href='?src=\ref[src];action=proccall;procpath=/client/proc/set_crit_type'>Set Crit Type</a><br>",
)

var/dat = ""
Expand Down Expand Up @@ -451,6 +453,7 @@
else
CRASH("receive_random_tip() failed: null message")

/// Toggle in character preferences and toggle preferences to configure what kind of blur overlay is used in game; Either blurry, impaired, or legacy.
/client/proc/set_eye_blur_type()
var/result = tgui_alert(src, "What type of eye blur do you want?", "What type of eye blur do you want?", list("Blurry", "Impair", "Legacy"))
if(result == "Blurry")
Expand All @@ -464,6 +467,28 @@
to_chat(src, SPAN_NOTICE("Your vision will now have a legacy blurring effect. This is not recommended!"))
prefs.save_preferences()

/// Toggle in character preferences and toggle preferences to configure what kind of flash overlay is used in game; Either white or black.
/client/proc/set_flash_type()
var/result = tgui_alert(src, "What type of flash overlay do you want?", "What type of flash overlay do you want?", list("White", "Dark"))
if(result == "White")
prefs.flash_overlay_pref = FLASH_OVERLAY_WHITE
to_chat(src, SPAN_NOTICE("If flashed your vision will now be white."))
else if(result == "Dark")
prefs.flash_overlay_pref = FLASH_OVERLAY_DARK
to_chat(src, SPAN_NOTICE("If flashed your vision will now be dark."))
prefs.save_preferences()

/// Toggle in character preferences and toggle preferences to configure what kind of crit overlay is used in game; Either white or grey.
/client/proc/set_crit_type()
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
var/result = tgui_alert(src, "What type of crit overlay do you want?", "What type of crit overlay do you want?", list("White", "Dark"))
if(result == "White")
prefs.crit_overlay_pref = CRIT_OVERLAY_WHITE
to_chat(src, SPAN_NOTICE("If in critical condition your vision will now be white."))
else if(result == "Dark")
prefs.crit_overlay_pref = CRIT_OVERLAY_DARK
to_chat(src, SPAN_NOTICE("If in critical condition your vision will now be dark."))
prefs.save_preferences()

/client/verb/toggle_tgui_say()
set name = "Toggle Say Input Style"
set category = "Preferences.UI"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
if(-90 to -80) severity = 8
if(-95 to -90) severity = 9
if(-INFINITY to -95) severity = 10
overlay_fullscreen("crit", /atom/movable/screen/fullscreen/crit, severity)
if(client.prefs?.crit_overlay_pref == CRIT_OVERLAY_DARK)
overlay_fullscreen("crit", /atom/movable/screen/fullscreen/crit/dark, severity)
else
overlay_fullscreen("crit", /atom/movable/screen/fullscreen/crit, severity)
else
clear_fullscreen("crit")
if(oxyloss)
Expand Down
9 changes: 6 additions & 3 deletions code/modules/mob/living/living.dm
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,12 @@
/mob/proc/flash_eyes()
return

/mob/living/flash_eyes(intensity = EYE_PROTECTION_FLASH, bypass_checks, type = /atom/movable/screen/fullscreen/flash, flash_timer = 40)
if( bypass_checks || (get_eye_protection() < intensity && !(sdisabilities & DISABILITY_BLIND)))
overlay_fullscreen("flash", type)
/mob/living/flash_eyes(intensity = EYE_PROTECTION_FLASH, bypass_checks, flash_timer = 40, type = /atom/movable/screen/fullscreen/flash, dark_type = /atom/movable/screen/fullscreen/flash/dark)
if(bypass_checks || (get_eye_protection() < intensity && !(sdisabilities & DISABILITY_BLIND)))
if(client?.prefs?.flash_overlay_pref == FLASH_OVERLAY_DARK)
Drulikar marked this conversation as resolved.
Show resolved Hide resolved
overlay_fullscreen("flash", dark_type)
else
overlay_fullscreen("flash", type)
spawn(flash_timer)
clear_fullscreen("flash", 20)
return TRUE
Expand Down
Loading