diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index 4bed0648ff..79848c748a 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 22d04295ad..d0aefa286f 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 9f316ba184..098a88ab42 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 disconnect_time = null //clear the disconnect time sight |= SEE_SELF