diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 55b29e64a5..f5cb701290 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -490,3 +490,7 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE #define FRIENDLY_SPAWN 2 #define RIDING_OFFSET_ALL "ALL" + +//Fullscreen overlay resolution in tiles. +#define FULLSCREEN_OVERLAY_RESOLUTION_X 15 +#define FULLSCREEN_OVERLAY_RESOLUTION_Y 15 diff --git a/code/__HELPERS/maths.dm b/code/__HELPERS/maths.dm index f1c901ab9a..9b071d0143 100644 --- a/code/__HELPERS/maths.dm +++ b/code/__HELPERS/maths.dm @@ -192,15 +192,17 @@ GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4, /proc/mouse_angle_from_client(client/client) var/list/mouse_control = params2list(client.mouseParams) - if(mouse_control["screen-loc"]) + if(mouse_control["screen-loc"] && client) var/list/screen_loc_params = splittext(mouse_control["screen-loc"], ",") var/list/screen_loc_X = splittext(screen_loc_params[1],":") var/list/screen_loc_Y = splittext(screen_loc_params[2],":") var/x = (text2num(screen_loc_X[1]) * 32 + text2num(screen_loc_X[2]) - 32) var/y = (text2num(screen_loc_Y[1]) * 32 + text2num(screen_loc_Y[2]) - 32) - var/screenview = (client.view * 2 + 1) * world.icon_size //Refer to http://www.byond.com/docs/ref/info.html#/client/var/view for mad maths - var/ox = round(screenview/2) - client.pixel_x //"origin" x - var/oy = round(screenview/2) - client.pixel_y //"origin" y + var/list/screenview = getviewsize(client) + var/screenviewX = screenview[1] * world.icon_size + var/screenviewY = screenview[2] * world.icon_size + var/ox = round(screenviewX/2) - client.pixel_x //"origin" x + var/oy = round(screenviewY/2) - client.pixel_y //"origin" y var/angle = NORM_ROT(Atan2(y - oy, x - ox)) return angle diff --git a/code/__HELPERS/view.dm b/code/__HELPERS/view.dm new file mode 100644 index 0000000000..85819a5ef0 --- /dev/null +++ b/code/__HELPERS/view.dm @@ -0,0 +1,12 @@ +/proc/getviewsize(view) + var/viewX + var/viewY + if(isnum(view)) + var/totalviewrange = 1 + 2 * view + viewX = totalviewrange + viewY = totalviewrange + else + var/list/viewrangelist = splittext(view,"x") + viewX = text2num(viewrangelist[1]) + viewY = text2num(viewrangelist[2]) + return list(viewX, viewY) \ No newline at end of file diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index c9e97726b3..0cc24607f4 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -440,20 +440,20 @@ mouse_opacity = MOUSE_OPACITY_OPAQUE screen_loc = "CENTER" -/obj/screen/click_catcher/proc/UpdateGreed(view_size_x = 7, view_size_y = 7) +/obj/screen/click_catcher/proc/UpdateGreed(view_size_x = 15, view_size_y = 15) var/icon/newicon = icon('icons/mob/screen_gen.dmi', "flash") - if(view_size_x > 16 || view_size_y > 16) - newicon.Scale((16 * 2 + 1) * world.icon_size,(16 * 2 + 1) * world.icon_size) + if(view_size_x > 32 || view_size_y > 32) + newicon.Scale(16 * world.icon_size,16 * world.icon_size) icon = newicon - var/tx = view_size_x/16 - var/ty = view_size_y/16 + var/tx = ((view_size_x - 1)*0.5)/16 + var/ty = ((view_size_y - 1)*0.5)/16 var/matrix/M = new M.Scale(tx, ty) transform = M screen_loc = "CENTER-16,CENTER-16" else - screen_loc = "CENTER-[view_size_x],CENTER-[view_size_y]" - newicon.Scale((view_size_x * 2 + 1) * world.icon_size,(view_size_y * 2 + 1) * world.icon_size) + screen_loc = "CENTER-[(view_size_x-1)*0.5],CENTER-[(view_size_y-1)*0.5]" + newicon.Scale(view_size_x * world.icon_size,view_size_y * world.icon_size) icon = newicon /obj/screen/click_catcher/Click(location, control, params) diff --git a/code/_onclick/hud/fullscreen.dm b/code/_onclick/hud/fullscreen.dm index 58f0fb18a2..2047225589 100644 --- a/code/_onclick/hud/fullscreen.dm +++ b/code/_onclick/hud/fullscreen.dm @@ -16,9 +16,9 @@ if (client && screen.should_show_to(src)) client.screen += screen if (screen.screen_loc == "CENTER-7,CENTER-7" && screen.view != client.view) - var/scale = (1 + 2 * client.view) / 15 + var/list/actualview = getviewsize(client.view) screen.view = client.view - screen.transform = matrix(scale, 0, 0, 0, scale, 0) + screen.transform = matrix(actualview[1]/FULLSCREEN_OVERLAY_RESOLUTION_X, 0, 0, 0, actualview[2]/FULLSCREEN_OVERLAY_RESOLUTION_Y, 0) return screen diff --git a/code/_onclick/hud/parallax.dm b/code/_onclick/hud/parallax.dm index a9971895a7..ff38107bfb 100755 --- a/code/_onclick/hud/parallax.dm +++ b/code/_onclick/hud/parallax.dm @@ -255,11 +255,13 @@ /obj/screen/parallax_layer/proc/update_o(view) if (!view) view = world.view - - var/count = Ceiling(view/(480/world.icon_size))+1 + + var/list/viewscales = getviewsize(view) + var/countx = Ceiling((viewscales[1]/2)/(480/world.icon_size))+1 + var/county = Ceiling((viewscales[2]/2)/(480/world.icon_size))+1 var/list/new_overlays = new - for(var/x in -count to count) - for(var/y in -count to count) + for(var/x in -countx to countx) + for(var/y in -county to county) if(x == 0 && y == 0) continue var/mutable_appearance/texture_overlay = mutable_appearance(icon, icon_state) diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index d9b25939a5..7b9e2ee4e7 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -663,6 +663,9 @@ GLOBAL_LIST(external_rsc_urls) return FALSE if ("key") return FALSE + if("view") + change_view(var_value) + return TRUE . = ..() @@ -683,7 +686,8 @@ GLOBAL_LIST(external_rsc_urls) /client/proc/apply_clickcatcher() generate_clickcatcher() - void.UpdateGreed(view,view) + var/list/actualview = getviewsize(view) + void.UpdateGreed(actualview[1],actualview[2]) /client/proc/AnnouncePR(announcement) if(prefs && prefs.chat_toggles & CHAT_PULLR) diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index a01db82752..9ae82d441d 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -396,10 +396,12 @@ var/y = text2num(screen_loc_Y[1]) * 32 + text2num(screen_loc_Y[2]) - 32 //Calculate the "resolution" of screen based on client's view and world's icon size. This will work if the user can view more tiles than average. - var/screenview = (user.client.view * 2 + 1) * world.icon_size //Refer to http://www.byond.com/docs/ref/info.html#/client/var/view for mad maths + var/list/screenview = getviewsize(user.client.view) + var/screenviewX = screenview[1] * world.icon_size + var/screenviewY = screenview[2] * world.icon_size - var/ox = round(screenview/2) - user.client.pixel_x //"origin" x - var/oy = round(screenview/2) - user.client.pixel_y //"origin" y + var/ox = round(screenviewX/2) - user.client.pixel_x //"origin" x + var/oy = round(screenviewY/2) - user.client.pixel_y //"origin" y angle = Atan2(y - oy, x - ox) return list(angle, p_x, p_y) diff --git a/code/modules/tgui/states.dm b/code/modules/tgui/states.dm index c3e7d9b0c9..831f829154 100644 --- a/code/modules/tgui/states.dm +++ b/code/modules/tgui/states.dm @@ -26,7 +26,8 @@ . = max(., UI_INTERACTIVE) // Regular ghosts can always at least view if in range. - if(get_dist(src_object, user) < user.client.view) + var/clientviewlist = getviewsize(user.client.view) + if(get_dist(src_object, user) < max(clientviewlist[1],clientviewlist[2])) . = max(., UI_UPDATE) // Check if the state allows interaction diff --git a/code/modules/tgui/states/default.dm b/code/modules/tgui/states/default.dm index 3ae48c7bc7..e61f61bc4a 100644 --- a/code/modules/tgui/states/default.dm +++ b/code/modules/tgui/states/default.dm @@ -33,7 +33,8 @@ GLOBAL_DATUM_INIT(default_state, /datum/ui_state/default, new) return // Robots can interact with anything they can see. - if(get_dist(src, src_object) <= client.view) + var/list/clientviewlist = getviewsize(client.view) + if(get_dist(src, src_object) <= min(clientviewlist[1],clientviewlist[2])) return UI_INTERACTIVE return UI_DISABLED // Otherwise they can keep the UI open. diff --git a/tgstation.dme b/tgstation.dme index d8094b1744..e8b81cbbb8 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -116,6 +116,7 @@ #include "code\__HELPERS\type2type.dm" #include "code\__HELPERS\type2type_vr.dm" #include "code\__HELPERS\unsorted.dm" +#include "code\__HELPERS\view.dm" #include "code\__HELPERS\sorts\__main.dm" #include "code\__HELPERS\sorts\InsertSort.dm" #include "code\__HELPERS\sorts\MergeSort.dm"