Adds support for non-1:1 screen ratios (Doesn't add widescreen) (#32950)
* adds support for non-1:1 screen ratios for fullscreen overlays * prevents future copypasta, adds widescreen support to clickcatchers * oops, makes it actually compile * HOPEFULLY makes it actually compile, makes projectiles and mouse_angle_from_client support widescreen * i need shittier shitcode * !!!HOPEFULLY!!! fixes the screen fuckery * Fixes compiling errors. Tested locally, it seems like it works * fixes runtime in mouse_angle_from_client * Fixes non-1:1 TGUI runtimes for borgs and ghosts * adds actual defines for fullscreen overlay resolution * makes varediting view call change_view to make clickcatcher regenerate proper * testmerge toggle widescreen verb and fixes vving view * FUCK - fixes test verb to properly use change_view, so clickcatchers regenerate and such * fixes parallax runtimes - how'd i miss this * removes debug verb
This commit is contained in:
committed by
CitadelStationBot
parent
bbfd36aace
commit
c56003f6ff
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user