Skip to content

Commit

Permalink
fix(skybox): skybox no longer offsets beyond screen size
Browse files Browse the repository at this point in the history
  • Loading branch information
intercepti0n authored Apr 23, 2024
1 parent 5dcfae7 commit c4e008e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions code/_onclick/hud/skybox.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,18 @@
var/atom/position = owner.client.eye
var/normalized_x = (position.x - TRANSITION_EDGE) / (world.maxx - (TRANSITION_EDGE * 2))
var/normalized_y = (position.y - TRANSITION_EDGE) / (world.maxy - (TRANSITION_EDGE * 2))

var/result_x = round(view_maxx * WORLD_ICON_SIZE * normalized_x)
var/result_y = round(view_maxy * WORLD_ICON_SIZE * normalized_y)

var/max_offset = abs(view_sizes[1] - view_sizes[2]) * WORLD_ICON_SIZE

if(view_maxx > view_maxy)
result_x = min(max_offset, result_x)

if(view_maxy > view_maxx)
result_y = min(max_offset, result_y)

screen_loc = "BOTTOM:[-result_y],LEFT:[-result_x]"

/obj/skybox/proc/DoRotate()
Expand Down

0 comments on commit c4e008e

Please sign in to comment.