Widescreen toggle support (doesn't actually enable it) (#43754)

cl
add: Added support for a widescreen toggle, actual widescreen will require a config change.
tweak: Auto-fit view is now the default. This will only apply to new players.
/cl
This commit is contained in:
Rob Bailey
2019-06-02 16:11:09 -07:00
committed by oranges
parent 8eead98e84
commit 0d86efdb52
7 changed files with 57 additions and 20 deletions
+3
View File
@@ -826,6 +826,9 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
if (isnull(new_size))
CRASH("change_view called without argument.")
if(prefs && !prefs.widescreenpref && new_size == CONFIG_GET(string/default_view))
new_size = CONFIG_GET(string/default_view_square)
view = new_size
apply_clickcatcher()
mob.reload_fullscreen()
+7
View File
@@ -95,6 +95,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/ambientocclusion = TRUE
var/auto_fit_viewport = FALSE
var/widescreenpref = TRUE
var/uplink_spawn_loc = UPLINK_PDA
@@ -503,6 +504,8 @@ GLOBAL_LIST_EMPTY(preferences_datums)
dat += "<b>Ambient Occlusion:</b> <a href='?_src_=prefs;preference=ambientocclusion'>[ambientocclusion ? "Enabled" : "Disabled"]</a><br>"
dat += "<b>Fit Viewport:</b> <a href='?_src_=prefs;preference=auto_fit_viewport'>[auto_fit_viewport ? "Auto" : "Manual"]</a><br>"
if (CONFIG_GET(string/default_view) != CONFIG_GET(string/default_view_square))
dat += "<b>Widescreen:</b> <a href='?_src_=prefs;preference=widescreenpref'>[widescreenpref ? "Enabled ([CONFIG_GET(string/default_view)])" : "Disabled ([CONFIG_GET(string/default_view_square)])"]</a><br>"
if (CONFIG_GET(flag/maprotation))
var/p_map = preferred_map
@@ -1442,6 +1445,10 @@ GLOBAL_LIST_EMPTY(preferences_datums)
auto_fit_viewport = !auto_fit_viewport
if(auto_fit_viewport && parent)
parent.fit_viewport()
if("widescreenpref")
widescreenpref = !widescreenpref
user.client.change_view(CONFIG_GET(string/default_view))
if("save")
save_preferences()
+20 -17
View File
@@ -112,18 +112,18 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
/datum/preferences/proc/load_preferences()
if(!path)
return 0
return FALSE
if(!fexists(path))
return 0
return FALSE
var/savefile/S = new /savefile(path)
if(!S)
return 0
return FALSE
S.cd = "/"
var/needs_update = savefile_needs_update(S)
if(needs_update == -2) //fatal, can't load any data
return 0
return FALSE
//general preferences
S["asaycolor"] >> asaycolor
@@ -154,6 +154,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["parallax"] >> parallax
S["ambientocclusion"] >> ambientocclusion
S["auto_fit_viewport"] >> auto_fit_viewport
S["widescreenpref"] >> widescreenpref
S["menuoptions"] >> menuoptions
S["enable_tips"] >> enable_tips
S["tip_delay"] >> tip_delay
@@ -173,13 +174,14 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
tgui_fancy = sanitize_integer(tgui_fancy, 0, 1, initial(tgui_fancy))
tgui_lock = sanitize_integer(tgui_lock, 0, 1, initial(tgui_lock))
buttons_locked = sanitize_integer(buttons_locked, 0, 1, initial(buttons_locked))
windowflashing = sanitize_integer(windowflashing, 0, 1, initial(windowflashing))
windowflashing = sanitize_integer(windowflashing, 0, 1, initial(windowflashing))
default_slot = sanitize_integer(default_slot, 1, max_save_slots, initial(default_slot))
toggles = sanitize_integer(toggles, 0, 65535, initial(toggles))
clientfps = sanitize_integer(clientfps, 0, 1000, 0)
parallax = sanitize_integer(parallax, PARALLAX_INSANE, PARALLAX_DISABLE, null)
ambientocclusion = sanitize_integer(ambientocclusion, 0, 1, initial(ambientocclusion))
auto_fit_viewport = sanitize_integer(auto_fit_viewport, 0, 1, initial(auto_fit_viewport))
widescreenpref = sanitize_integer(widescreenpref, 0, 1, initial(widescreenpref))
ghost_form = sanitize_inlist(ghost_form, GLOB.ghost_forms, initial(ghost_form))
ghost_orbit = sanitize_inlist(ghost_orbit, GLOB.ghost_orbits, initial(ghost_orbit))
ghost_accs = sanitize_inlist(ghost_accs, GLOB.ghost_accs_options, GHOST_ACCS_DEFAULT_OPTION)
@@ -189,14 +191,14 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
pda_style = sanitize_inlist(pda_style, GLOB.pda_styles, initial(pda_style))
pda_color = sanitize_hexcolor(pda_color, 6, 1, initial(pda_color))
return 1
return TRUE
/datum/preferences/proc/save_preferences()
if(!path)
return 0
return FALSE
var/savefile/S = new /savefile(path)
if(!S)
return 0
return FALSE
S.cd = "/"
WRITE_FILE(S["version"] , SAVEFILE_VERSION_MAX) //updates (or failing that the sanity checks) will ensure data is not invalid at load. Assume up-to-date
@@ -228,22 +230,23 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["parallax"], parallax)
WRITE_FILE(S["ambientocclusion"], ambientocclusion)
WRITE_FILE(S["auto_fit_viewport"], auto_fit_viewport)
WRITE_FILE(S["widescreenpref"], widescreenpref)
WRITE_FILE(S["menuoptions"], menuoptions)
WRITE_FILE(S["enable_tips"], enable_tips)
WRITE_FILE(S["tip_delay"], tip_delay)
WRITE_FILE(S["pda_style"], pda_style)
WRITE_FILE(S["pda_color"], pda_color)
return 1
return TRUE
/datum/preferences/proc/load_character(slot)
if(!path)
return 0
return FALSE
if(!fexists(path))
return 0
return FALSE
var/savefile/S = new /savefile(path)
if(!S)
return 0
return FALSE
S.cd = "/"
if(!slot)
slot = default_slot
@@ -255,7 +258,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S.cd = "/character[slot]"
var/needs_update = savefile_needs_update(S)
if(needs_update == -2) //fatal, can't load any data
return 0
return FALSE
//Species
var/species_id
@@ -392,14 +395,14 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
negative_quirks = SANITIZE_LIST(negative_quirks)
neutral_quirks = SANITIZE_LIST(neutral_quirks)
return 1
return TRUE
/datum/preferences/proc/save_character()
if(!path)
return 0
return FALSE
var/savefile/S = new /savefile(path)
if(!S)
return 0
return FALSE
S.cd = "/character[default_slot]"
WRITE_FILE(S["version"] , SAVEFILE_VERSION_MAX) //load_character will sanitize any bad data, so assume up-to-date.)
@@ -454,7 +457,7 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
WRITE_FILE(S["negative_quirks"] , negative_quirks)
WRITE_FILE(S["neutral_quirks"] , neutral_quirks)
return 1
return TRUE
#undef SAVEFILE_VERSION_MAX