diff --git a/code/__DEFINES/preferences.dm b/code/__DEFINES/preferences.dm
index 87f761016d2..3bf2f330cdd 100644
--- a/code/__DEFINES/preferences.dm
+++ b/code/__DEFINES/preferences.dm
@@ -47,6 +47,16 @@
#define PARALLAX_LOW 2
#define PARALLAX_DISABLE 3 //this option must be the highest number
+#define PIXEL_SCALING_AUTO 0
+#define PIXEL_SCALING_1X 1
+#define PIXEL_SCALING_1_2X 1.5
+#define PIXEL_SCALING_2X 2
+#define PIXEL_SCALING_3X 3
+
+#define SCALING_METHOD_NORMAL "normal"
+#define SCALING_METHOD_DISTORT "distort"
+#define SCALING_METHOD_BLUR "blur"
+
#define PARALLAX_DELAY_DEFAULT world.tick_lag
#define PARALLAX_DELAY_MED 1
#define PARALLAX_DELAY_LOW 2
diff --git a/code/__HELPERS/view.dm b/code/__HELPERS/view.dm
index 48e68be20fb..1c92971802e 100644
--- a/code/__HELPERS/view.dm
+++ b/code/__HELPERS/view.dm
@@ -2,7 +2,7 @@
var/viewX
var/viewY
if(isnum(view))
- var/totalviewrange = 1 + 2 * view
+ var/totalviewrange = (view < 0 ? -1 : 1) + 2 * view
viewX = totalviewrange
viewY = totalviewrange
else
diff --git a/code/datums/components/riding.dm b/code/datums/components/riding.dm
index 96c32112f59..98f4d5afe06 100644
--- a/code/datums/components/riding.dm
+++ b/code/datums/components/riding.dm
@@ -153,7 +153,7 @@
buckled_mob.pixel_x = 0
buckled_mob.pixel_y = 0
if(buckled_mob.client)
- buckled_mob.client.change_view(CONFIG_GET(string/default_view))
+ buckled_mob.client.view_size.resetToDefault()
//MOVEMENT
/datum/component/riding/proc/turf_check(turf/next, turf/current)
diff --git a/code/datums/view.dm b/code/datums/view.dm
new file mode 100644
index 00000000000..41757b74d38
--- /dev/null
+++ b/code/datums/view.dm
@@ -0,0 +1,124 @@
+//This is intended to be a full wrapper. DO NOT directly modify its values
+///Container for client viewsize
+/datum/viewData
+ var/width = 0
+ var/height = 0
+ var/default = ""
+ var/is_suppressed = FALSE
+ var/client/chief = null
+
+/datum/viewData/New(client/owner, view_string)
+ default = view_string
+ chief = owner
+ apply()
+
+/datum/viewData/proc/setDefault(string)
+ default = string
+ apply()
+
+/datum/viewData/proc/safeApplyFormat()
+ if(isZooming())
+ assertFormat()
+ return
+ resetFormat()
+
+/datum/viewData/proc/assertFormat()//T-Pose
+ winset(chief, "mapwindow.map", "zoom=0")
+
+/datum/viewData/proc/resetFormat()//Cuck
+ winset(chief, "mapwindow.map", "zoom=[chief.prefs.pixel_size]")
+
+/datum/viewData/proc/setZoomMode()
+ winset(chief, "mapwindow.map", "zoom-mode=[chief.prefs.scaling_method]")
+
+/datum/viewData/proc/isZooming()
+ return (width || height)
+
+/datum/viewData/proc/resetToDefault()
+ width = 0
+ height = 0
+ apply()
+
+/datum/viewData/proc/add(toAdd)
+ width += toAdd
+ height += toAdd
+ apply()
+
+/datum/viewData/proc/addTo(toAdd)
+ var/list/shitcode = getviewsize(toAdd)
+ width += shitcode[1]
+ height += shitcode[2]
+ apply()
+
+/datum/viewData/proc/setTo(toAdd)
+ var/list/shitcode = getviewsize(toAdd) //Backward compatability to account
+ width = shitcode[1] //for a change in how sizes get calculated. we used to include world.view in
+ height = shitcode[2] //this, but it was jank, so I had to move it
+ apply()
+
+/datum/viewData/proc/setBoth(wid, hei)
+ width = wid
+ height = hei
+ apply()
+
+/datum/viewData/proc/setWidth(wid)
+ width = wid
+ apply()
+
+/datum/viewData/proc/setHeight(hei)
+ width = hei
+ apply()
+
+/datum/viewData/proc/addToWidth(toAdd)
+ width += toAdd
+ apply()
+
+/datum/viewData/proc/addToHeight(screen, toAdd)
+ height += toAdd
+ apply()
+
+/datum/viewData/proc/apply()
+ chief.change_view(getView())
+ safeApplyFormat()
+ if(chief.prefs.auto_fit_viewport)
+ chief.fit_viewport()
+
+/datum/viewData/proc/supress()
+ is_suppressed = TRUE
+ apply()
+
+/datum/viewData/proc/unsupress()
+ is_suppressed = FALSE
+ apply()
+
+/datum/viewData/proc/getView()
+ var/list/temp = getviewsize(default)
+ if(is_suppressed)
+ return "[temp[1]]x[temp[2]]"
+ return "[width + temp[1]]x[height + temp[2]]"
+
+/datum/viewData/proc/zoomIn()
+ resetToDefault()
+ animate(chief, pixel_x = 0, pixel_y = 0, 0, FALSE, LINEAR_EASING, ANIMATION_END_NOW)
+
+/datum/viewData/proc/zoomOut(radius = 0, offset = 0, direction = FALSE)
+ if(direction)
+ var/_x = 0
+ var/_y = 0
+ switch(direction)
+ if(NORTH)
+ _y = offset
+ if(EAST)
+ _x = offset
+ if(SOUTH)
+ _y = -offset
+ if(WEST)
+ _x = -offset
+ animate(chief, pixel_x = world.icon_size*_x, pixel_y = world.icon_size*_y, 0, FALSE, LINEAR_EASING, ANIMATION_END_NOW)
+ //Ready for this one?
+ setTo(radius)
+
+/proc/getScreenSize(widescreen)
+ if(widescreen)
+ return CONFIG_GET(string/default_view)
+ return CONFIG_GET(string/default_view_square)
diff --git a/code/game/machinery/computer/camera_advanced.dm b/code/game/machinery/computer/camera_advanced.dm
index b09a50cf29f..b558879fe7c 100644
--- a/code/game/machinery/computer/camera_advanced.dm
+++ b/code/game/machinery/computer/camera_advanced.dm
@@ -76,6 +76,7 @@
current_user = null
user.unset_machine()
+ user.client.view_size.unsupress()
playsound(src, 'sound/machines/terminal_off.ogg', 25, FALSE)
/obj/machinery/computer/camera_advanced/check_eye(mob/user)
@@ -161,6 +162,7 @@
user.remote_control = eyeobj
user.reset_perspective(eyeobj)
eyeobj.setLoc(eyeobj.loc)
+ user.client.view_size.supress()
/mob/camera/aiEye/remote
name = "Inactive Camera Eye"
diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm
index dc964eb6d14..c3d79aa9484 100644
--- a/code/game/mecha/mecha.dm
+++ b/code/game/mecha/mecha.dm
@@ -1080,7 +1080,7 @@
if(L && L.client)
L.update_mouse_pointer()
- L.client.change_view(CONFIG_GET(string/default_view))
+ L.client.view_size.resetToDefault()
zoom_mode = 0
/////////////////////////
diff --git a/code/game/mecha/mecha_actions.dm b/code/game/mecha/mecha_actions.dm
index 11c063ae015..a3cdff769c6 100644
--- a/code/game/mecha/mecha_actions.dm
+++ b/code/game/mecha/mecha_actions.dm
@@ -215,10 +215,10 @@
chassis.log_message("Toggled zoom mode.", LOG_MECHA)
chassis.occupant_message("Zoom mode [chassis.zoom_mode?"en":"dis"]abled.")
if(chassis.zoom_mode)
- owner.client.change_view(12)
+ owner.client.view_size.setTo(4.5)
SEND_SOUND(owner, sound('sound/mecha/imag_enh.ogg',volume=50))
else
- owner.client.change_view(CONFIG_GET(string/default_view)) //world.view - default mob view size
+ owner.client.view_size.resetToDefault() //Let's not let this stack shall we?
UpdateButtonIcon()
/datum/action/innate/mecha/mech_switch_damtype
diff --git a/code/game/objects/items/binoculars.dm b/code/game/objects/items/binoculars.dm
index 347f0ad3a79..5e89e426b3b 100644
--- a/code/game/objects/items/binoculars.dm
+++ b/code/game/objects/items/binoculars.dm
@@ -8,7 +8,7 @@
slot_flags = ITEM_SLOT_BELT
w_class = WEIGHT_CLASS_SMALL
var/mob/listeningTo
- var/zoom_out_amt = 6
+ var/zoom_out_amt = 5.5
var/zoom_amt = 10
/obj/item/binoculars/Initialize()
@@ -25,41 +25,29 @@
return ..()
/obj/item/binoculars/proc/on_wield(obj/item/source, mob/user)
- RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/unwield)
+ RegisterSignal(user, COMSIG_MOVABLE_MOVED, .proc/on_walk)
+ RegisterSignal(user, COMSIG_ATOM_DIR_CHANGE, .proc/rotate)
listeningTo = user
user.visible_message("[user] holds [src] up to [user.p_their()] eyes.", "You hold [src] up to your eyes.")
item_state = "binoculars_wielded"
user.regenerate_icons()
- if(!user?.client)
- return
- var/client/C = user.client
- var/_x = 0
- var/_y = 0
- switch(user.dir)
- if(NORTH)
- _y = zoom_amt
- if(EAST)
- _x = zoom_amt
- if(SOUTH)
- _y = -zoom_amt
- if(WEST)
- _x = -zoom_amt
- C.change_view(world.view + zoom_out_amt)
- C.pixel_x = world.icon_size*_x
- C.pixel_y = world.icon_size*_y
-/obj/item/binoculars/proc/on_unwield(obj/item/source, mob/user)
- unwield(user)
+ user.client.view_size.zoomOut(zoom_out_amt, zoom_amt, user.dir)
-/obj/item/binoculars/proc/unwield(mob/user)
+/obj/item/binoculars/proc/rotate(atom/thing, old_dir, new_dir)
+ if(ismob(thing))
+ var/mob/lad = thing
+ lad.regenerate_icons()
+ lad.client.view_size.zoomOut(zoom_out_amt, zoom_amt, new_dir)
+
+/obj/item/binoculars/proc/on_walk()
+ attack_self(listeningTo) //Yes I have sinned, why do you ask?
+
+/obj/item/binoculars/proc/on_unwield(obj/item/source, mob/user)
if(listeningTo)
- UnregisterSignal(listeningTo, COMSIG_MOVABLE_MOVED)
+ UnregisterSignal(user, COMSIG_MOVABLE_MOVED)
+ UnregisterSignal(user, COMSIG_ATOM_DIR_CHANGE)
listeningTo = null
user.visible_message("[user] lowers [src].", "You lower [src].")
item_state = "binoculars"
user.regenerate_icons()
- if(user && user.client)
- user.regenerate_icons()
- var/client/C = user.client
- C.change_view(CONFIG_GET(string/default_view))
- user.client.pixel_x = 0
- user.client.pixel_y = 0
+ user.client.view_size.zoomIn()
diff --git a/code/game/objects/structures/manned_turret.dm b/code/game/objects/structures/manned_turret.dm
index 4a71e4f26b7..4cce22f8232 100644
--- a/code/game/objects/structures/manned_turret.dm
+++ b/code/game/objects/structures/manned_turret.dm
@@ -11,7 +11,7 @@
max_integrity = 100
buckle_lying = FALSE
layer = ABOVE_MOB_LAYER
- var/view_range = 10
+ var/view_range = 2.5
var/cooldown = 0
var/projectile_type = /obj/projectile/bullet/manned_turret
var/rate_of_fire = 1
@@ -38,7 +38,7 @@
buckled_mob.pixel_x = 0
buckled_mob.pixel_y = 0
if(buckled_mob.client)
- buckled_mob.client.change_view(CONFIG_GET(string/default_view))
+ buckled_mob.client.view_size.resetToDefault()
anchored = FALSE
. = ..()
STOP_PROCESSING(SSfastprocess, src)
@@ -65,7 +65,7 @@
playsound(src,'sound/mecha/mechmove01.ogg', 50, TRUE)
anchored = TRUE
if(M.client)
- M.client.change_view(view_range)
+ M.client.view_size.setTo(view_range)
START_PROCESSING(SSfastprocess, src)
/obj/machinery/manned_turret/process()
diff --git a/code/modules/admin/verbs/randomverbs.dm b/code/modules/admin/verbs/randomverbs.dm
index 3340502f93e..cc8a179bf73 100644
--- a/code/modules/admin/verbs/randomverbs.dm
+++ b/code/modules/admin/verbs/randomverbs.dm
@@ -715,10 +715,10 @@ Traitors and the like can also be revived with the previous role mostly intact.
set name = "Change View Range"
set desc = "switches between 1x and custom views"
- if(view == CONFIG_GET(string/default_view))
- change_view(input("Select view range:", "FUCK YE", 7) in list(1,2,3,4,5,6,7,8,9,10,11,12,13,14,128))
+ if(view_size.getView() == view_size.default)
+ view_size.setTo(input("Select view range:", "FUCK YE", 7) in list(1,2,3,4,5,6,7,8,9,10,11,12,13,14,128) - 7)
else
- change_view(CONFIG_GET(string/default_view))
+ view_size.resetToDefault(getScreenSize(prefs.widescreenpref))
log_admin("[key_name(usr)] changed their view range to [view].")
//message_admins("\blue [key_name_admin(usr)] changed their view range to [view].") //why? removed by order of XSI
diff --git a/code/modules/antagonists/fugitive/fugitive_ship.dm b/code/modules/antagonists/fugitive/fugitive_ship.dm
index 11f9e5ec8ba..674b40503b3 100644
--- a/code/modules/antagonists/fugitive/fugitive_ship.dm
+++ b/code/modules/antagonists/fugitive/fugitive_ship.dm
@@ -45,7 +45,7 @@
shuttlePortId = "huntership_custom"
see_hidden = FALSE
jumpto_ports = list("huntership_home" = 1, "whiteship_home" = 1, "syndicate_nw" = 1)
- view_range = 12
+ view_range = 4.5
/obj/structure/closet/crate/eva
name = "EVA crate"
diff --git a/code/modules/client/client_defines.dm b/code/modules/client/client_defines.dm
index 4506208662d..526636f6a04 100644
--- a/code/modules/client/client_defines.dm
+++ b/code/modules/client/client_defines.dm
@@ -141,3 +141,4 @@
/// Messages currently seen by this client
var/list/seen_messages
+ var/datum/viewData/view_size
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 062332c2499..5456bbf0e86 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -447,6 +447,10 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
if (menuitem)
menuitem.Load_checked(src)
+ view_size = new(src, getScreenSize(prefs.widescreenpref))
+ view_size.resetFormat()
+ view_size.setZoomMode()
+ fit_viewport()
Master.UpdateTickRate()
//////////////
@@ -881,7 +885,7 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
if ("key")
return FALSE
if("view")
- change_view(var_value)
+ view_size.setDefault(var_value)
return TRUE
. = ..()
@@ -891,7 +895,7 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
var/y = viewscale[2]
x = clamp(x+change, min, max)
y = clamp(y+change, min,max)
- change_view("[x]x[y]")
+ view_size.setDefault("[x]x[y]")
/client/proc/update_movement_keys(datum/preferences/direct_prefs)
var/datum/preferences/D = prefs || direct_prefs
@@ -914,9 +918,6 @@ 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()
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 135313b0307..c7f553e7fda 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -102,9 +102,14 @@ GLOBAL_LIST_EMPTY(preferences_datums)
var/parallax
var/ambientocclusion = TRUE
+ ///Should we automatically fit the viewport?
var/auto_fit_viewport = FALSE
+ ///Should we be in the widescreen mode set by the config?
var/widescreenpref = TRUE
-
+ ///What size should pixels be displayed as? 0 is strech to fit
+ var/pixel_size = 0
+ ///What scaling method should we use?
+ var/scaling_method = "normal"
var/uplink_spawn_loc = UPLINK_PDA
var/list/exp = list()
@@ -596,6 +601,18 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if (CONFIG_GET(string/default_view) != CONFIG_GET(string/default_view_square))
dat += "Widescreen: [widescreenpref ? "Enabled ([CONFIG_GET(string/default_view)])" : "Disabled ([CONFIG_GET(string/default_view_square)])"]
"
+ button_name = pixel_size
+ dat += "Pixel Scaling: [(button_name) ? "Pixel Perfect [button_name]x" : "Stretch to fit"]
"
+
+ switch(scaling_method)
+ if(SCALING_METHOD_NORMAL)
+ button_name = "Nearest Neighbor"
+ if(SCALING_METHOD_DISTORT)
+ button_name = "Point Sampling"
+ if(SCALING_METHOD_BLUR)
+ button_name = "Bilinear"
+ dat += "Scaling Method: [button_name]
"
+
if (CONFIG_GET(flag/maprotation))
var/p_map = preferred_map
if (!p_map)
@@ -1729,7 +1746,31 @@ GLOBAL_LIST_EMPTY(preferences_datums)
if("widescreenpref")
widescreenpref = !widescreenpref
- user.client.change_view(CONFIG_GET(string/default_view))
+ user.client.view_size.setDefault(getScreenSize(widescreenpref))
+
+ if("pixel_size")
+ switch(pixel_size)
+ if(PIXEL_SCALING_AUTO)
+ pixel_size = PIXEL_SCALING_1X
+ if(PIXEL_SCALING_1X)
+ pixel_size = PIXEL_SCALING_1_2X
+ if(PIXEL_SCALING_1_2X)
+ pixel_size = PIXEL_SCALING_2X
+ if(PIXEL_SCALING_2X)
+ pixel_size = PIXEL_SCALING_3X
+ if(PIXEL_SCALING_3X)
+ pixel_size = PIXEL_SCALING_AUTO
+ user.client.view_size.apply() //Let's winset() it so it actually works
+
+ if("scaling_method")
+ switch(scaling_method)
+ if(SCALING_METHOD_NORMAL)
+ scaling_method = SCALING_METHOD_DISTORT
+ if(SCALING_METHOD_DISTORT)
+ scaling_method = SCALING_METHOD_BLUR
+ if(SCALING_METHOD_BLUR)
+ scaling_method = SCALING_METHOD_NORMAL
+ user.client.view_size.setZoomMode()
if("save")
save_preferences()
diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm
index fe8d41ff217..a76aea68dac 100644
--- a/code/modules/client/preferences_savefile.dm
+++ b/code/modules/client/preferences_savefile.dm
@@ -195,6 +195,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
S["ambientocclusion"] >> ambientocclusion
S["auto_fit_viewport"] >> auto_fit_viewport
S["widescreenpref"] >> widescreenpref
+ S["pixel_size"] >> pixel_size
+ S["scaling_method"] >> scaling_method
S["menuoptions"] >> menuoptions
S["enable_tips"] >> enable_tips
S["tip_delay"] >> tip_delay
@@ -232,6 +234,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car
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))
+ pixel_size = sanitize_integer(pixel_size, PIXEL_SCALING_AUTO, PIXEL_SCALING_3X, initial(pixel_size))
+ scaling_method = sanitize_text(scaling_method, initial(scaling_method))
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)
diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm
index f55339fa350..fa853f16024 100644
--- a/code/modules/mob/dead/observer/observer.dm
+++ b/code/modules/mob/dead/observer/observer.dm
@@ -341,7 +341,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(mind.current.key && mind.current.key[1] != "@") //makes sure we don't accidentally kick any clients
to_chat(usr, "Another consciousness is in your body...It is resisting you.")
return
- client.change_view(CONFIG_GET(string/default_view))
+ client.view_size.setDefault(getScreenSize(client.prefs.widescreenpref))//Let's reset so people can't become allseeing gods
SStgui.on_transfer(src, mind.current) // Transfer NanoUIs.
mind.current.key = key
return TRUE
@@ -498,15 +498,15 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
set desc = "Change your view range."
var/max_view = client.prefs.unlock_content ? GHOST_MAX_VIEW_RANGE_MEMBER : GHOST_MAX_VIEW_RANGE_DEFAULT
- if(client.view == CONFIG_GET(string/default_view))
+ if(client.view_size.getView() == client.view_size.default)
var/list/views = list()
for(var/i in 7 to max_view)
views |= i
- var/new_view = input("Choose your new view", "Modify view range", 7) as null|anything in views
+ var/new_view = input("Choose your new view", "Modify view range", 0) as null|anything in views
if(new_view)
- client.change_view(clamp(new_view, 7, max_view))
+ client.view_size.setTo(clamp(new_view, 7, max_view) - 7)
else
- client.change_view(CONFIG_GET(string/default_view))
+ client.view_size.resetToDefault()
/mob/dead/observer/verb/add_view_range(input as num)
set name = "Add View Range"
diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm
index 7c663413c7c..b39278756be 100644
--- a/code/modules/mob/login.dm
+++ b/code/modules/mob/login.dm
@@ -74,7 +74,7 @@
update_client_colour()
update_mouse_pointer()
if(client)
- client.change_view(CONFIG_GET(string/default_view)) // Resets the client.view in case it was changed.
+ client.view_size.resetToDefault() // Resets the client.view in case it was changed.
if(client.player_details.player_actions.len)
for(var/datum/action/A in client.player_details.player_actions)
diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm
index 0951ce54d94..05e5cca2bc6 100644
--- a/code/modules/power/singularity/emitter.dm
+++ b/code/modules/power/singularity/emitter.dm
@@ -376,7 +376,7 @@
icon_state_underpowered = "protoemitter_+u"
can_buckle = TRUE
buckle_lying = FALSE
- var/view_range = 12
+ var/view_range = 4.5
var/datum/action/innate/protoemitter/firing/auto
//BUCKLE HOOKS
@@ -391,7 +391,7 @@
buckled_mob.pixel_x = 0
buckled_mob.pixel_y = 0
if(buckled_mob.client)
- buckled_mob.client.change_view(CONFIG_GET(string/default_view))
+ buckled_mob.client.view_size.resetToDefault()
auto.Remove(buckled_mob)
. = ..()
@@ -407,7 +407,7 @@
M.pixel_y = 14
layer = 4.1
if(M.client)
- M.client.change_view(view_range)
+ M.client.view_size.setTo(view_range)
if(!auto)
auto = new()
auto.Grant(M, src)
diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm
index 8b1cada07b7..403a9e16140 100644
--- a/code/modules/projectiles/gun.dm
+++ b/code/modules/projectiles/gun.dm
@@ -131,7 +131,7 @@
/obj/item/gun/equipped(mob/living/user, slot)
. = ..()
if(zoomed && user.get_active_held_item() != src)
- zoom(user, FALSE) //we can only stay zoomed in if it's in our hands //yeah and we only unzoom if we're actually zoomed using the gun!!
+ zoom(user, user.dir, FALSE) //we can only stay zoomed in if it's in our hands //yeah and we only unzoom if we're actually zoomed using the gun!!
//called after the gun has successfully fired its chambered ammo.
/obj/item/gun/proc/process_chamber()
@@ -535,7 +535,7 @@
if(azoom)
azoom.Remove(user)
if(zoomed)
- zoom(user,FALSE)
+ zoom(user, user.dir)
/obj/item/gun/update_overlays()
. = ..()
@@ -615,19 +615,23 @@
var/obj/item/gun/gun = null
/datum/action/toggle_scope_zoom/Trigger()
- gun.zoom(owner)
+ gun.zoom(owner, owner.dir)
/datum/action/toggle_scope_zoom/IsAvailable()
. = ..()
if(!. && gun)
- gun.zoom(owner, FALSE)
+ gun.zoom(owner, owner.dir, FALSE)
/datum/action/toggle_scope_zoom/Remove(mob/living/L)
- gun.zoom(L, FALSE)
+ gun.zoom(L, L.dir, FALSE)
..()
+/obj/item/gun/proc/rotate(atom/thing, old_dir, new_dir)
+ if(ismob(thing))
+ var/mob/lad = thing
+ lad.client.view_size.zoomOut(zoom_out_amt, zoom_amt, new_dir)
-/obj/item/gun/proc/zoom(mob/living/user, forced_zoom)
+/obj/item/gun/proc/zoom(mob/living/user, direc, forced_zoom)
if(!user || !user.client)
return
@@ -637,25 +641,11 @@
zoomed = forced_zoom
if(zoomed)
- var/_x = 0
- var/_y = 0
- switch(user.dir)
- if(NORTH)
- _y = zoom_amt
- if(EAST)
- _x = zoom_amt
- if(SOUTH)
- _y = -zoom_amt
- if(WEST)
- _x = -zoom_amt
-
- user.client.change_view(zoom_out_amt)
- user.client.pixel_x = world.icon_size*_x
- user.client.pixel_y = world.icon_size*_y
+ RegisterSignal(user, COMSIG_ATOM_DIR_CHANGE, .proc/rotate)
+ user.client.view_size.zoomOut(zoom_out_amt, zoom_amt, direc)
else
- user.client.change_view(CONFIG_GET(string/default_view))
- user.client.pixel_x = 0
- user.client.pixel_y = 0
+ UnregisterSignal(user, COMSIG_ATOM_DIR_CHANGE)
+ user.client.view_size.zoomIn()
return zoomed
//Proc, so that gun accessories/scopes/etc. can easily add zooming.
diff --git a/code/modules/projectiles/guns/ballistic/automatic.dm b/code/modules/projectiles/guns/ballistic/automatic.dm
index 574674b7e58..317c5eac004 100644
--- a/code/modules/projectiles/guns/ballistic/automatic.dm
+++ b/code/modules/projectiles/guns/ballistic/automatic.dm
@@ -298,7 +298,7 @@
w_class = WEIGHT_CLASS_NORMAL
zoomable = TRUE
zoom_amt = 10 //Long range, enough to see in front of you, but no tiles behind you.
- zoom_out_amt = 13
+ zoom_out_amt = 5
slot_flags = ITEM_SLOT_BACK
actions_types = list()
mag_display = TRUE
diff --git a/code/modules/projectiles/guns/misc/beam_rifle.dm b/code/modules/projectiles/guns/misc/beam_rifle.dm
index 76ad01fb763..82279668d58 100644
--- a/code/modules/projectiles/guns/misc/beam_rifle.dm
+++ b/code/modules/projectiles/guns/misc/beam_rifle.dm
@@ -64,7 +64,8 @@
//ZOOMING
var/zoom_current_view_increase = 0
- var/zoom_target_view_increase = 10
+ ///The radius you want to zoom by
+ var/zoom_target_view_increase = 9.5
var/zooming = FALSE
var/zoom_lock = ZOOM_LOCK_OFF
var/zooming_angle
@@ -120,7 +121,7 @@
/obj/item/gun/energy/beam_rifle/proc/handle_zooming()
if(!zooming || !check_user())
return
- current_user.client.change_view(world.view + zoom_target_view_increase)
+ current_user.client.view_size.setTo(zoom_target_view_increase)
zoom_current_view_increase = zoom_target_view_increase
set_autozoom_pixel_offsets_immediate(zooming_angle)
@@ -139,9 +140,8 @@
user = current_user
if(!user || !user.client)
return FALSE
- animate(user.client, pixel_x = 0, pixel_y = 0, 0, FALSE, LINEAR_EASING, ANIMATION_END_NOW)
+ user.client.view_size.zoomIn()
zoom_current_view_increase = 0
- user.client.change_view(CONFIG_GET(string/default_view))
zooming_angle = 0
current_zoom_x = 0
current_zoom_y = 0
diff --git a/code/modules/ruins/spaceruin_code/caravanambush.dm b/code/modules/ruins/spaceruin_code/caravanambush.dm
index a7d89f3324b..740850524cf 100644
--- a/code/modules/ruins/spaceruin_code/caravanambush.dm
+++ b/code/modules/ruins/spaceruin_code/caravanambush.dm
@@ -68,7 +68,7 @@
lock_override = NONE
shuttlePortId = "caravantrade1_custom"
jumpto_ports = list("whiteship_away" = 1, "whiteship_home" = 1, "whiteship_z4" = 1, "caravantrade1_ambush" = 1)
- view_range = 14
+ view_range = 6.5
x_offset = -5
y_offset = -5
designate_time = 100
@@ -92,7 +92,7 @@
lock_override = NONE
shuttlePortId = "caravanpirate_custom"
jumpto_ports = list("caravanpirate_ambush" = 1)
- view_range = 14
+ view_range = 6.5
x_offset = 3
y_offset = -6
@@ -116,7 +116,7 @@
lock_override = NONE
shuttlePortId = "caravansyndicate1_custom"
jumpto_ports = list("caravansyndicate1_ambush" = 1, "caravansyndicate1_listeningpost" = 1)
- view_range = 7
+ view_range = 0
x_offset = 2
y_offset = 0
@@ -140,7 +140,7 @@
lock_override = NONE
shuttlePortId = "caravansyndicate2_custom"
jumpto_ports = list("caravansyndicate2_ambush" = 1, "caravansyndicate1_listeningpost" = 1)
- view_range = 7
+ view_range = 0
x_offset = 0
y_offset = 2
@@ -164,6 +164,6 @@
lock_override = NONE
shuttlePortId = "caravansyndicate3_custom"
jumpto_ports = list("caravansyndicate3_ambush" = 1, "caravansyndicate3_listeningpost" = 1)
- view_range = 10
+ view_range = 2.5
x_offset = -1
y_offset = -3
diff --git a/code/modules/shuttle/navigation_computer.dm b/code/modules/shuttle/navigation_computer.dm
index 7e1d37ce645..98c729b5d1a 100644
--- a/code/modules/shuttle/navigation_computer.dm
+++ b/code/modules/shuttle/navigation_computer.dm
@@ -11,7 +11,7 @@
var/obj/docking_port/stationary/my_port //the custom docking port placed by this console
var/obj/docking_port/mobile/shuttle_port //the mobile docking port of the connected shuttle
var/list/locked_traits = list(ZTRAIT_RESERVED, ZTRAIT_CENTCOM, ZTRAIT_AWAY) //traits forbided for custom docking
- var/view_range = 7
+ var/view_range = 0
var/x_offset = 0
var/y_offset = 0
var/list/whitelist_turfs = list(/turf/open/space, /turf/open/floor/plating, /turf/open/lava)
@@ -94,7 +94,7 @@
to_add += SSshuttle.hidden_shuttle_turf_images
user.client.images += to_add
- user.client.change_view(view_range)
+ user.client.view_size.setTo(view_range)
/obj/machinery/computer/camera_advanced/shuttle_docker/remove_eye_control(mob/living/user)
..()
@@ -107,7 +107,7 @@
to_remove += SSshuttle.hidden_shuttle_turf_images
user.client.images -= to_remove
- user.client.change_view(CONFIG_GET(string/default_view))
+ user.client.view_size.resetToDefault()
/obj/machinery/computer/camera_advanced/shuttle_docker/proc/placeLandingSpot()
if(designating_target_loc || !current_user)
diff --git a/code/modules/shuttle/syndicate.dm b/code/modules/shuttle/syndicate.dm
index ec03f772be8..7ce9a4af09a 100644
--- a/code/modules/shuttle/syndicate.dm
+++ b/code/modules/shuttle/syndicate.dm
@@ -58,7 +58,7 @@
lock_override = CAMERA_LOCK_STATION
shuttlePortId = "syndicate_custom"
jumpto_ports = list("syndicate_ne" = 1, "syndicate_nw" = 1, "syndicate_n" = 1, "syndicate_se" = 1, "syndicate_sw" = 1, "syndicate_s" = 1)
- view_range = 13
+ view_range = 5.5
x_offset = -7
y_offset = -1
whitelist_turfs = list(/turf/open/space, /turf/open/floor/plating, /turf/open/lava, /turf/closed/mineral)
diff --git a/code/modules/shuttle/white_ship.dm b/code/modules/shuttle/white_ship.dm
index 537872ed0cb..8e290f79d1a 100644
--- a/code/modules/shuttle/white_ship.dm
+++ b/code/modules/shuttle/white_ship.dm
@@ -25,7 +25,7 @@
lock_override = NONE
shuttlePortId = "whiteship_custom"
jumpto_ports = list("whiteship_away" = 1, "whiteship_home" = 1, "whiteship_z4" = 1)
- view_range = 18
+ view_range = 10
x_offset = -6
y_offset = -10
designate_time = 100
@@ -36,7 +36,7 @@
shuttleId = "whiteship_pod"
shuttlePortId = "whiteship_pod_custom"
jumpto_ports = list("whiteship_pod_home" = 1)
- view_range = 7
+ view_range = 0
x_offset = -2
y_offset = 0
designate_time = 0
diff --git a/code/modules/spells/spell_types/devil_boons.dm b/code/modules/spells/spell_types/devil_boons.dm
index 6201bbd13c7..01ea14b15fa 100644
--- a/code/modules/spells/spell_types/devil_boons.dm
+++ b/code/modules/spells/spell_types/devil_boons.dm
@@ -43,7 +43,7 @@
for(var/mob/C in targets)
if(!C.client)
continue
- C.client.change_view(input("Select view range:", "Range", 4) in ranges)
+ C.client.view_size.setTo((input("Select view range:", "Range", 4) in ranges) - 7)
/obj/effect/proc_holder/spell/targeted/summon_friend
name = "Summon Friend"
diff --git a/code/modules/tooltip/tooltip.html b/code/modules/tooltip/tooltip.html
index 67b60a037e9..c9e031ccc2e 100644
--- a/code/modules/tooltip/tooltip.html
+++ b/code/modules/tooltip/tooltip.html
@@ -62,12 +62,12 @@
.hisgrace .wrap {border-color: #7C1414;}
.hisgrace .content {color: #15D512; border-color: #9D1414; background-color: #861414;}
-
+
/* TG: Themes */
/* ScreenUI */
.midnight .wrap {border-color: #2B2B33;}
.midnight .content {color: #6087A0; border-color: #2B2B33; background-color: #36363C;}
-
+
.plasmafire .wrap {border-color: #21213D;}
.plasmafire .content {color: #FFA800 ; border-color: #21213D; background-color:#1D1D36;}
@@ -114,12 +114,17 @@
window.location = 'byond://winset?id='+tooltip.control+';anchor1=0,0;size=999x999';
//Get the real icon size according to the client view
+ //FYI, this bit is even more borrowed from goon, our widescreen broke tooltips so I took a look at how they do it
+ //To improve our code. Thanks gooncoders, very cool
var mapWidth = map['view-size'].x,
mapHeight = map['view-size'].y,
- tilesShown = tooltip.client_view_w
- realIconSize = mapWidth / tilesShown,
- resizeRatio = realIconSize / tooltip.tileSize,
- //Calculate letterboxing offsets
+ tilesShownX = tooltip.client_view_w
+ tilesShownY = tooltip.client_view_h
+ realIconSizeX = mapWidth / tilesShownX,
+ realIconSizeY = mapHeight / tilesShownY,
+ resizeRatioX = realIconSizeX / tooltip.tileSize,
+ resizeRatioY = realIconSizeY / tooltip.tileSize,
+ //Calculate letterboxing offsets
leftOffset = (map.size.x - mapWidth) / 2,
topOffset = (map.size.y - mapHeight) / 2;
@@ -162,7 +167,7 @@
if ((iconX + westOffset) !== enteredX) { //Cursor entered on the offset tile
left = left + (westOffset < 0 ? 1 : -1);
}
- leftOffset = leftOffset + (westOffset * resizeRatio);
+ leftOffset = leftOffset + (westOffset * resizeRatioX);
}
}
@@ -173,13 +178,13 @@
if (northOffset !== 0) {
if ((iconY + northOffset) === enteredY) { //Cursor entered on the original tile
top--;
- topOffset = topOffset - ((tooltip.tileSize + northOffset) * resizeRatio);
+ topOffset = topOffset - ((tooltip.tileSize + northOffset) * resizeRatioY);
} else { //Cursor entered on the offset tile
if (northOffset < 0) { //Offset southwards
- topOffset = topOffset - ((tooltip.tileSize + northOffset) * resizeRatio);
+ topOffset = topOffset - ((tooltip.tileSize + northOffset) * resizeRatioY);
} else { //Offset northwards
top--;
- topOffset = topOffset - (northOffset * resizeRatio);
+ topOffset = topOffset - (northOffset * resizeRatioY);
}
}
}
@@ -192,12 +197,12 @@
}
//Clamp values
- left = (left < 0 ? 0 : (left > tilesShown ? tilesShown : left));
- top = (top < 0 ? 0 : (top > tilesShown ? tilesShown : top));
+ left = (left < 0 ? 0 : (left > tilesShownX ? tilesShownX : left));
+ top = (top < 0 ? 0 : (top > tilesShownY ? tilesShownY : top));
//Calculate where on the screen the popup should appear (below the hovered tile)
- var posX = Math.round(((left - 1) * realIconSize) + leftOffset + tooltip.padding); //-1 to position at the left of the target tile
- var posY = Math.round(((tilesShown - top + 1) * realIconSize) + topOffset + tooltip.padding); //+1 to position at the bottom of the target tile
+ var posX = Math.round(((left - 1) * realIconSizeX) + leftOffset + tooltip.padding); //-1 to position at the left of the target tile
+ var posY = Math.round(((tilesShownY - top + 1) * realIconSizeY) + topOffset + tooltip.padding); //+1 to position at the bottom of the target tile
//alert(mapWidth+' | '+mapHeight+' | '+tilesShown+' | '+realIconSize+' | '+leftOffset+' | '+topOffset+' | '+left+' | '+top+' | '+posX+' | '+posY); //DEBUG
@@ -215,7 +220,7 @@
docHeight = $wrap.outerHeight();
if (posY + docHeight > map.size.y) { //Is the bottom edge below the window? Snap it up if so
- posY = (posY - docHeight) - realIconSize - tooltip.padding;
+ posY = (posY - docHeight) - realIconSizeY - tooltip.padding;
}
//Actually size, move and show the tooltip box
diff --git a/interface/menu.dm b/interface/menu.dm
index 2e54fa32a43..2923910713d 100644
--- a/interface/menu.dm
+++ b/interface/menu.dm
@@ -62,57 +62,3 @@ GLOBAL_LIST_EMPTY(menulist)
if (!(verbpath in typesof("[menutype]/verb")))
return
M.Set_checked(src, verbpath)
-
-
-/datum/verbs/menu/Icon/Load_checked(client/C) //So we can be lazy, we invoke the "checked" menu item on menu load.
- var/procpath/verbpath = Get_checked(C)
- if (!verbpath || !(verbpath in typesof("[type]/verb")))
- return
-
- if(verbpath.name[1] == "@")
- winset(C, null, list2params(list("command" = copytext(verbpath.name, length(verbpath.name[1]) + 1))))
- else
- winset(C, null, list2params(list("command" = replacetext(verbpath.name, " ", "-"))))
-
-/datum/verbs/menu/Icon/Size
- checkbox = CHECKBOX_GROUP
- default = /datum/verbs/menu/Icon/Size/verb/iconstretchtofit
-
-/datum/verbs/menu/Icon/Size/verb/iconstretchtofit()
- set name = "@.winset \"mapwindow.map.icon-size=0\""
- set desc = "&Auto (stretch-to-fit)"
-
-/datum/verbs/menu/Icon/Size/verb/icon96()
- set name = "@.winset \"mapwindow.map.icon-size=96\""
- set desc = "&96x96 (3x)"
-
-/datum/verbs/menu/Icon/Size/verb/icon64()
- set name = "@.winset \"mapwindow.map.icon-size=64\""
- set desc = "&64x64 (2x)"
-
-/datum/verbs/menu/Icon/Size/verb/icon48()
- set name = "@.winset \"mapwindow.map.icon-size=48\""
- set desc = "&48x48 (1.5x)"
-
-/datum/verbs/menu/Icon/Size/verb/icon32()
- set name = "@.winset \"mapwindow.map.icon-size=32\""
- set desc = "&32x32 (1x)"
-
-
-/datum/verbs/menu/Icon/Scaling
- checkbox = CHECKBOX_GROUP
- name = "Scaling Mode"
- default = /datum/verbs/menu/Icon/Scaling/verb/NN
-
-/datum/verbs/menu/Icon/Scaling/verb/NN()
- set name = "@.winset \"mapwindow.map.zoom-mode=distort\""
- set desc = "Nearest Neighbor"
-
-/datum/verbs/menu/Icon/Scaling/verb/PS()
- set name = "@.winset \"mapwindow.map.zoom-mode=normal\""
- set desc = "Point Sampling"
-
-/datum/verbs/menu/Icon/Scaling/verb/BL()
- set name = "@.winset \"mapwindow.map.zoom-mode=blur\""
- set desc = "Bilinear"
-
diff --git a/interface/skin.dmf b/interface/skin.dmf
index 5e09d759e0e..abbadb4bd41 100644
--- a/interface/skin.dmf
+++ b/interface/skin.dmf
@@ -145,8 +145,6 @@ window "mapwindow"
font-size = 7
text-color = none
is-default = true
- saved-params = "icon-size"
- zoom-mode = distort
style=".center { text-align: center; } .maptext { font-family: 'Small Fonts'; font-size: 7px; -dm-text-outline: 1px black; color: white; line-height: 1.1; } .command_headset { font-weight: bold; font-size: 8px; } .small { font-size: 6px; } .big { font-size: 8px; } .reallybig { font-size: 8px; } .extremelybig { font-size: 8px; } .greentext { color: #00FF00; font-size: 7px; } .redtext { color: #FF0000; font-size: 7px; } .clown { color: #FF69Bf; font-size: 7px; font-weight: bold; } .his_grace { color: #15D512; } .hypnophrase { color: #0d0d0d; font-weight: bold; } .yell { font-weight: bold; } .italics { font-size: 6px; }"
window "infowindow"
diff --git a/tgstation.dme b/tgstation.dme
index c53c9562862..ff9b03d86cf 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -351,6 +351,7 @@
#include "code\datums\spawners_menu.dm"
#include "code\datums\tgs_event_handler.dm"
#include "code\datums\verbs.dm"
+#include "code\datums\view.dm"
#include "code\datums\weakrefs.dm"
#include "code\datums\world_topic.dm"
#include "code\datums\achievements\_achievement_data.dm"