From 8f876de645faffa56de988e5dd61c41c701358a5 Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Mon, 7 May 2018 23:36:47 -0400 Subject: [PATCH 1/2] Adds a client FPS setting --- code/__defines/misc.dm | 3 +++ .../client/preference_setup/global/01_ui.dm | 15 ++++++++++++++- code/modules/client/preferences.dm | 1 + code/modules/mob/login.dm | 5 +++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index a84d42dd29..ce2e21f656 100644 --- a/code/__defines/misc.dm +++ b/code/__defines/misc.dm @@ -21,6 +21,9 @@ #define SEE_INVISIBLE_MINIMUM 5 #define INVISIBILITY_MAXIMUM 100 +// For the client FPS pref and anywhere else +#define MAX_CLIENT_FPS 200 + // Some arbitrary defines to be used by self-pruning global lists. (see master_controller) #define PROCESS_KILL 26 // Used to trigger removal from a processing list. #define MAX_GEAR_COST 15 // Used in chargen for accessory loadout limit. diff --git a/code/modules/client/preference_setup/global/01_ui.dm b/code/modules/client/preference_setup/global/01_ui.dm index 29502ec985..5b1314d05f 100644 --- a/code/modules/client/preference_setup/global/01_ui.dm +++ b/code/modules/client/preference_setup/global/01_ui.dm @@ -8,6 +8,7 @@ S["UI_style_alpha"] >> pref.UI_style_alpha S["ooccolor"] >> pref.ooccolor S["tooltipstyle"] >> pref.tooltipstyle + S["client_fps"] >> pref.client_fps /datum/category_item/player_setup_item/player_global/ui/save_preferences(var/savefile/S) S["UI_style"] << pref.UI_style @@ -15,6 +16,7 @@ S["UI_style_alpha"] << pref.UI_style_alpha S["ooccolor"] << pref.ooccolor S["tooltipstyle"] << pref.tooltipstyle + S["client_fps"] << pref.client_fps /datum/category_item/player_setup_item/player_global/ui/sanitize_preferences() pref.UI_style = sanitize_inlist(pref.UI_style, all_ui_styles, initial(pref.UI_style)) @@ -22,6 +24,7 @@ pref.UI_style_alpha = sanitize_integer(pref.UI_style_alpha, 0, 255, initial(pref.UI_style_alpha)) pref.ooccolor = sanitize_hexcolor(pref.ooccolor, initial(pref.ooccolor)) pref.tooltipstyle = sanitize_inlist(pref.tooltipstyle, all_tooltip_styles, initial(pref.tooltipstyle)) + pref.client_fps = sanitize_integer(pref.client_fps, 0, MAX_CLIENT_FPS, initial(pref.client_fps)) /datum/category_item/player_setup_item/player_global/ui/content(var/mob/user) . = "UI Style: [pref.UI_style]
" @@ -29,6 +32,7 @@ . += "-Color: [pref.UI_style_color] 
__
 reset
" . += "-Alpha(transparency): [pref.UI_style_alpha] reset
" . += "Tooltip Style: [pref.tooltipstyle]
" + . += "Client FPS: [pref.client_fps]
" if(can_select_ooc_color(user)) . += "OOC Color: " if(pref.ooccolor == initial(pref.ooccolor)) @@ -62,11 +66,20 @@ return TOPIC_REFRESH else if(href_list["select_tooltip_style"]) - var/tooltip_style_new = input(user, "Choose tooltip style.", "Character Preference", pref.tooltipstyle) as null|anything in all_tooltip_styles + var/tooltip_style_new = input(user, "Choose tooltip style.", "Global Preference", pref.tooltipstyle) as null|anything in all_tooltip_styles if(!tooltip_style_new || !CanUseTopic(user)) return TOPIC_NOACTION pref.tooltipstyle = tooltip_style_new return TOPIC_REFRESH + else if(href_list["select_client_fps"]) + var/fps_new = input(user, "Input Client FPS (1-200, 0 uses server FPS)", "Global Preference", pref.client_fps) as null|num + if(isnull(fps_new) || !CanUseTopic(user)) return TOPIC_NOACTION + if(fps_new < 0 || fps_new > MAX_CLIENT_FPS) return TOPIC_NOACTION + pref.client_fps = fps_new + if(pref.client) + pref.client.fps = fps_new + return TOPIC_REFRESH + else if(href_list["reset"]) switch(href_list["reset"]) if("ui") diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 0b93d1bd64..c45567e5a9 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -22,6 +22,7 @@ datum/preferences var/UI_style_color = "#ffffff" var/UI_style_alpha = 255 var/tooltipstyle = "Midnight" //Style for popup tooltips + var/client_fps = 0 //character preferences var/real_name //our character's name diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 0c6b5a5d7c..6986ea557e 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -34,6 +34,11 @@ if(hud_used) qdel(hud_used) //remove the hud objects hud_used = new /datum/hud(src) + if(client.prefs && client.prefs.client_fps) + client.fps = client.prefs.client_fps + else + client.fps = 0 // Results in using the server FPS + next_move = 1 sight |= SEE_SELF ..() From 96a96c68552773d473d9db66e7879c7cd156bb83 Mon Sep 17 00:00:00 2001 From: Arokha Sieyes Date: Tue, 8 May 2018 11:16:22 -0400 Subject: [PATCH 2/2] Changelog for client FPS setting --- html/changelogs/arokha - client fps.yml | 36 +++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 html/changelogs/arokha - client fps.yml diff --git a/html/changelogs/arokha - client fps.yml b/html/changelogs/arokha - client fps.yml new file mode 100644 index 0000000000..30bd21a046 --- /dev/null +++ b/html/changelogs/arokha - client fps.yml @@ -0,0 +1,36 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +################################# + +# Your name. +author: Arokha + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Added a 'Client FPS' setting in the Global tab of character setup for adjusting the FPS to your preference."