Browse Source

Datum view and some other things (#51208)

* Datumizes all uses of change_view

* Cleanup and helper procs

* tweaks values to match the format, hint hint, (value - 0.5) works just fine

* And there's the rest

* woop, braindamage

* and one more

* fuck you menu file

* woops

* we should apply that

* fixes tooltip drift, thank you goon coders

* you can shake but you can't zoom
pride
LemonInTheDark 2 months ago
committed by GitHub
parent
commit
1614501d23
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 280 additions and 169 deletions
  1. +10
    -0
      code/__DEFINES/preferences.dm
  2. +1
    -1
      code/__HELPERS/view.dm
  3. +1
    -1
      code/datums/components/riding.dm
  4. +124
    -0
      code/datums/view.dm
  5. +2
    -0
      code/game/machinery/computer/camera_advanced.dm
  6. +1
    -1
      code/game/mecha/mecha.dm
  7. +2
    -2
      code/game/mecha/mecha_actions.dm
  8. +17
    -29
      code/game/objects/items/binoculars.dm
  9. +3
    -3
      code/game/objects/structures/manned_turret.dm
  10. +3
    -3
      code/modules/admin/verbs/randomverbs.dm
  11. +1
    -1
      code/modules/antagonists/fugitive/fugitive_ship.dm
  12. +1
    -0
      code/modules/client/client_defines.dm
  13. +6
    -5
      code/modules/client/client_procs.dm
  14. +43
    -2
      code/modules/client/preferences.dm
  15. +4
    -0
      code/modules/client/preferences_savefile.dm
  16. +5
    -5
      code/modules/mob/dead/observer/observer.dm
  17. +1
    -1
      code/modules/mob/login.dm
  18. +3
    -3
      code/modules/power/singularity/emitter.dm
  19. +14
    -24
      code/modules/projectiles/gun.dm
  20. +1
    -1
      code/modules/projectiles/guns/ballistic/automatic.dm
  21. +4
    -4
      code/modules/projectiles/guns/misc/beam_rifle.dm
  22. +5
    -5
      code/modules/ruins/spaceruin_code/caravanambush.dm
  23. +3
    -3
      code/modules/shuttle/navigation_computer.dm
  24. +1
    -1
      code/modules/shuttle/syndicate.dm
  25. +2
    -2
      code/modules/shuttle/white_ship.dm
  26. +1
    -1
      code/modules/spells/spell_types/devil_boons.dm
  27. +20
    -15
      code/modules/tooltip/tooltip.html
  28. +0
    -54
      interface/menu.dm
  29. +0
    -2
      interface/skin.dmf
  30. +1
    -0
      tgstation.dme

+ 10
- 0
code/__DEFINES/preferences.dm View File

@@ -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


+ 1
- 1
code/__HELPERS/view.dm View File

@@ -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


+ 1
- 1
code/datums/components/riding.dm View File

@@ -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)


+ 124
- 0
code/datums/view.dm View File

@@ -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)

+ 2
- 0
code/game/machinery/computer/camera_advanced.dm View File

@@ -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"


+ 1
- 1
code/game/mecha/mecha.dm View File

@@ -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
/////////////////////////


+ 2
- 2
code/game/mecha/mecha_actions.dm View File

@@ -215,10 +215,10 @@
chassis.log_message("Toggled zoom mode.", LOG_MECHA)
chassis.occupant_message("<font color='[chassis.zoom_mode?"blue":"red"]'>Zoom mode [chassis.zoom_mode?"en":"dis"]abled.</font>")
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


+ 17
- 29
code/game/objects/items/binoculars.dm View File

@@ -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("<span class='notice'>[user] holds [src] up to [user.p_their()] eyes.</span>", "<span class='notice'>You hold [src] up to your eyes.</span>")
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/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/unwield(mob/user)
/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("<span class='notice'>[user] lowers [src].</span>", "<span class='notice'>You lower [src].</span>")
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()

+ 3
- 3
code/game/objects/structures/manned_turret.dm View File

@@ -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()


+ 3
- 3
code/modules/admin/verbs/randomverbs.dm View File

@@ -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


+ 1
- 1
code/modules/antagonists/fugitive/fugitive_ship.dm View File

@@ -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"


+ 1
- 0
code/modules/client/client_defines.dm View File

@@ -141,3 +141,4 @@
/// Messages currently seen by this client
var/list/seen_messages
var/datum/viewData/view_size

+ 6
- 5
code/modules/client/client_procs.dm View File

@@ -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()


+ 43
- 2
code/modules/client/preferences.dm View File

@@ -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 += "<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>"
button_name = pixel_size
dat += "<b>Pixel Scaling:</b> <a href='?_src_=prefs;preference=pixel_size'>[(button_name) ? "Pixel Perfect [button_name]x" : "Stretch to fit"]</a><br>"
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 += "<b>Scaling Method:</b> <a href='?_src_=prefs;preference=scaling_method'>[button_name]</a><br>"
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()


+ 4
- 0
code/modules/client/preferences_savefile.dm View File

@@ -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)


+ 5
- 5
code/modules/mob/dead/observer/observer.dm View File

@@ -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, "<span class='warning'>Another consciousness is in your body...It is resisting you.</span>")
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"


+ 1
- 1
code/modules/mob/login.dm View File

@@ -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)


+ 3
- 3
code/modules/power/singularity/emitter.dm View File

@@ -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)


+ 14
- 24
code/modules/projectiles/gun.dm View File

@@ -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.


+ 1
- 1
code/modules/projectiles/guns/ballistic/automatic.dm View File

@@ -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


+ 4
- 4
code/modules/projectiles/guns/misc/beam_rifle.dm View File

@@ -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


+ 5
- 5
code/modules/ruins/spaceruin_code/caravanambush.dm View File

@@ -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

+ 3
- 3
code/modules/shuttle/navigation_computer.dm View File

@@ -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)


+ 1
- 1
code/modules/shuttle/syndicate.dm View File

@@ -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)


+ 2
- 2
code/modules/shuttle/white_ship.dm View File

@@ -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


+ 1
- 1
code/modules/spells/spell_types/devil_boons.dm View File

@@ -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"


+ 20
- 15
code/modules/tooltip/tooltip.html View File

@@ -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


+ 0
- 54
interface/menu.dm View File

@@ -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"


+ 0
- 2
interface/skin.dmf View File

@@ -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"


+ 1
- 0
tgstation.dme View File

@@ -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"


Loading…
Cancel
Save