From 7f5b6e3b34342e55149479c3bc6d4eec9bb34112 Mon Sep 17 00:00:00 2001 From: nemvar <47324920+nemvar@users.noreply.github.com> Date: Wed, 12 Aug 2020 03:25:29 +0200 Subject: [PATCH] Adds a recommended fps option. (#52850) Adds a recommended fps option. Setting fps to -1 now sets client.fps to RECOMMENDED_FPS. Sets recommended fps as the default option for new players. Current value for recommended fps is 40. --- code/__DEFINES/preferences.dm | 3 +++ code/modules/client/client_procs.dm | 2 +- code/modules/client/preferences.dm | 8 ++++---- code/modules/client/preferences_savefile.dm | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm index 842fc4c7e99..192d04f1c84 100644 --- a/code/__DEFINES/preferences.dm +++ b/code/__DEFINES/preferences.dm @@ -118,3 +118,6 @@ #define RANDOM_FACIAL_HAIRSTYLE "random_facial_hairstyle" #define RANDOM_SKIN_TONE "random_skin_tone" #define RANDOM_EYE_COLOR "random_eye_color" + +//recommened client FPS +#define RECOMMENDED_FPS 40 diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index 05fc47c16a7..1a8baf65ef1 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -255,7 +255,7 @@ GLOBAL_LIST_EMPTY(external_rsc_urls) GLOB.preferences_datums[ckey] = prefs prefs.last_ip = address //these are gonna be used for banning prefs.last_id = computer_id //these are gonna be used for banning - fps = prefs.clientfps + fps = (prefs.clientfps < 0) ? RECOMMENDED_FPS : prefs.clientfps if(fexists(roundend_report_file())) verbs += /client/proc/show_previous_roundend_report diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm index 95169764734..40004e4a491 100644 --- a/code/modules/client/preferences.dm +++ b/code/modules/client/preferences.dm @@ -102,7 +102,7 @@ GLOBAL_LIST_EMPTY(preferences_datums) var/list/ignoring = list() - var/clientfps = 0 + var/clientfps = -1 var/parallax @@ -1532,10 +1532,10 @@ GLOBAL_LIST_EMPTY(preferences_datums) preferred_map = maplist[pickedmap] if ("clientfps") - var/desiredfps = input(user, "Choose your desired fps. (0 = synced with server tick rate (currently:[world.fps]))", "Character Preference", clientfps) as null|num + var/desiredfps = input(user, "Choose your desired fps.\n-1 means recommended value (currently:[RECOMMENDED_FPS])\n0 means world fps (currently:[world.fps])", "Character Preference", clientfps) as null|num if (!isnull(desiredfps)) - clientfps = desiredfps - parent.fps = desiredfps + clientfps = sanitize_integer(desiredfps, -1, 1000, clientfps) + parent.fps = (clientfps < 0) ? RECOMMENDED_FPS : clientfps if("ui") var/pickedui = input(user, "Choose your UI style.", "Character Preference", UI_style) as null|anything in sortList(GLOB.available_ui_styles) if(pickedui) diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index b06110b33ee..13dab9e9fcd 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -172,7 +172,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car windowflashing = sanitize_integer(windowflashing, FALSE, TRUE, initial(windowflashing)) default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot)) toggles = sanitize_integer(toggles, 0, (2**24)-1, initial(toggles)) - clientfps = sanitize_integer(clientfps, 0, 1000, 0) + clientfps = sanitize_integer(clientfps, -1, 1000, 0) parallax = sanitize_integer(parallax, PARALLAX_INSANE, PARALLAX_DISABLE, null) ambientocclusion = sanitize_integer(ambientocclusion, FALSE, TRUE, initial(ambientocclusion)) auto_fit_viewport = sanitize_integer(auto_fit_viewport, FALSE, TRUE, initial(auto_fit_viewport))