Skip to content

Commit

Permalink
Change view cleanup. (#551)
Browse files Browse the repository at this point in the history
* cleaning

* hmm

* Update fullscreen.dm

* should show to

* Update fullscreen.dm

* preds

* Update hud.dm

* Update view.dm

* Update fullscreen.dm
  • Loading branch information
Helg2 authored Oct 25, 2024
1 parent 8bc3a7b commit e697f96
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 69 deletions.
23 changes: 0 additions & 23 deletions code/_onclick/hud/_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,3 @@
#define ui_ai_bioscan "SOUTH:6,WEST+4"
#define ui_ai_multicam "SOUTH:6,WEST+17"
#define ui_ai_add_multicam "SOUTH:6,WEST+18"

// Какого хрена атомы лежат в дефайнах?!
// TODO: Уберите предовские атомы в другой И ПОДХОДЯЩИЙ файл, плиз.
/*
| | |
| | |
v v v
*/
/atom/movable/screen/fullscreen/machine/pred
alpha = 140

/atom/movable/screen/fullscreen/machine/pred/meson
icon_state = "pred_meson"
icon = 'icons/mob/screen/full.dmi'

/atom/movable/screen/fullscreen/machine/pred/night
icon_state = "robothalf"

/datum/hud/var/atom/movable/screen/pred_power_icon

/datum/hud/Destroy()
pred_power_icon = null
return ..()
61 changes: 34 additions & 27 deletions code/_onclick/hud/fullscreen.dm
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#define SHOULD_SHOW_TO(mymob, myscreen) (!(mymob.stat == DEAD && !myscreen.show_when_dead))


/mob/proc/overlay_fullscreen_timer(duration, animated, category, type, severity)
overlay_fullscreen(category, type, severity)
addtimer(CALLBACK(src, PROC_REF(clear_fullscreen), category, animated), duration)


///Applies a fullscreen overlay
/mob/proc/overlay_fullscreen(category, type, severity)
var/atom/movable/screen/fullscreen/screen = fullscreens[category]
Expand All @@ -23,7 +19,7 @@

screen.icon_state = "[initial(screen.icon_state)][severity]"
screen.severity = severity
if(client && SHOULD_SHOW_TO(src, screen))
if(client && screen.should_show_to(src))
screen.update_for_view(client.view)
client.screen += screen
return screen
Expand All @@ -48,29 +44,27 @@
fullscreens -= category
qdel(screen)


/mob/proc/clear_fullscreens()
for(var/category in fullscreens)
clear_fullscreen(category)


/mob/proc/hide_fullscreens()
if(client)
for(var/category in fullscreens)
client.screen -= fullscreens[category]

if(!client)
return
for(var/category in fullscreens)
client.screen -= fullscreens[category]

/mob/proc/reload_fullscreens()
if(client)
var/atom/movable/screen/fullscreen/screen
for(var/category in fullscreens)
screen = fullscreens[category]
if(SHOULD_SHOW_TO(src, screen))
screen.update_for_view(client.view)
client.screen |= screen
else
client.screen -= screen

if(!client)
return
var/atom/movable/screen/fullscreen/screen
for(var/category in fullscreens)
screen = fullscreens[category]
if(screen.should_show_to(src))
screen.update_for_view(client.view)
client.screen |= screen
else
client.screen -= screen

/atom/movable/screen/fullscreen
icon = 'icons/mob/screen/full/misc.dmi'
Expand All @@ -85,18 +79,23 @@
///Holder for deletion timer
var/removal_timer


/atom/movable/screen/fullscreen/Destroy()
deltimer(removal_timer)
removal_timer = null
return ..()


/atom/movable/screen/fullscreen/proc/update_for_view(client_view)
if (screen_loc == "CENTER-7,CENTER-7" && fs_view != client_view)
if(fs_view == client_view)
return
if(screen_loc != "CENTER-7,CENTER-7")
var/list/actualview = getviewsize(client_view)
fs_view = client_view
transform = matrix(actualview[1]/FULLSCREEN_OVERLAY_RESOLUTION_X, 0, 0, 0, actualview[2]/FULLSCREEN_OVERLAY_RESOLUTION_Y, 0)
transform = matrix(actualview[1] / FULLSCREEN_OVERLAY_RESOLUTION_X, 0, 0, 0, actualview[2] / FULLSCREEN_OVERLAY_RESOLUTION_Y, 0)

/atom/movable/screen/fullscreen/proc/should_show_to(mob/mob)
if(!show_when_dead && mob.stat == DEAD)
return FALSE
return TRUE

/atom/movable/screen/fullscreen/black
icon_state = "black" //just a black square, you can change this if you get better ideas
Expand Down Expand Up @@ -182,6 +181,16 @@
/atom/movable/screen/fullscreen/machine/robotlow
icon_state = "robotlow"

/atom/movable/screen/fullscreen/machine/pred
alpha = 140

/atom/movable/screen/fullscreen/machine/pred/meson
icon_state = "pred_meson"
icon = 'icons/mob/screen/full.dmi'

/atom/movable/screen/fullscreen/machine/pred/night
icon_state = "robothalf"

/atom/movable/screen/fullscreen/ivanov_display
icon_state = "ivanov"
alpha = 180
Expand Down Expand Up @@ -216,5 +225,3 @@
layer = LIGHTING_PRIMARY_LAYER
blend_mode = BLEND_ADD
show_when_dead = TRUE

#undef SHOULD_SHOW_TO
10 changes: 3 additions & 7 deletions code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@

var/list/atom/movable/screen/plane_master/plane_masters = list() // see "appearance_flags" in the ref, assoc list of "[plane]" = object

var/atom/movable/screen/pred_power_icon

/datum/hud/New(mob/owner)
mymob = owner
Expand Down Expand Up @@ -133,8 +134,9 @@

mymob = null

return ..()
pred_power_icon = null

return ..()

/mob/proc/create_mob_hud()
if(!client || hud_used)
Expand All @@ -146,7 +148,6 @@
update_sight()
SEND_SIGNAL(src, COMSIG_MOB_HUD_CREATED)


/datum/hud/proc/plane_masters_update()
// Plane masters are always shown to OUR mob, never to observers
for(var/thing in plane_masters)
Expand Down Expand Up @@ -231,10 +232,8 @@
show_hud(hud_version, M)
else if(viewmob.hud_used)
viewmob.hud_used.plane_masters_update()

return TRUE


/datum/hud/human/show_hud(version = 0, mob/viewmob)
. = ..()
if(!.)
Expand All @@ -244,7 +243,6 @@
return FALSE
hidden_inventory_update(screenmob)


/datum/hud/proc/hidden_inventory_update(mob/viewer)
return

Expand Down Expand Up @@ -287,13 +285,11 @@
return
openToolTip(usr, src, params, title = name, content = desc)


/atom/movable/screen/action_button/MouseExited()
if (!usr.client?.prefs?.tooltips)
return
closeToolTip(usr)


//Triggered when F12 is pressed (Unless someone changed something in the DMF)
/mob/verb/button_pressed_F12()
set name = "F12"
Expand Down
2 changes: 1 addition & 1 deletion code/datums/view.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
chief = owner
apply()

///sets the default view size froma string
///sets the default view size froma string
/datum/view_data/proc/set_default(string)
default = string
apply()
Expand Down
2 changes: 2 additions & 0 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -872,9 +872,11 @@
CRASH("change_view called with a number argument. Use the string format instead.")
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_fullscreens()

if(prefs.auto_fit_viewport)
INVOKE_NEXT_TICK(src, VERB_REF(fit_viewport), 1 SECONDS) //Delayed to avoid wingets from Login calls.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ GLOBAL_LIST_INIT(boiler_glob_image_list, list(
if(!do_after(X, 1 SECONDS, IGNORE_HELD_ITEM, null, BUSY_ICON_GENERIC) || X.is_zoomed)
return
X.zoom_in(11)
..()
return ..()

// ***************************************
// *********** Gas type toggle
Expand Down
2 changes: 0 additions & 2 deletions code/modules/mob/living/carbon/xenomorph/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
handle_living_sunder_updates()
handle_living_health_updates()
handle_living_plasma_updates()
//RUTGMC EDIT ADDITION BEGIN - Preds
handle_interference()
//RUTGMC EDIT ADDITION END
update_action_button_icons()
update_icons(FALSE)

Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/xenomorph/xeno_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ GLOBAL_LIST_INIT(strain_list, init_glob_strain_list())
///Stored biomass
var/biomass = 0

var/is_zoomed = 0
var/is_zoomed = FALSE
var/zoom_turf = null
var/can_walk_zoomed = FALSE

Expand Down
9 changes: 4 additions & 5 deletions code/modules/mob/living/carbon/xenomorph/xenoprocs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,10 @@

update_sight()


/mob/living/carbon/xenomorph/proc/zoom_in(tileoffset = 5, viewsize = 12)
if(stat || resting)
if(is_zoomed)
is_zoomed = 0
is_zoomed = FALSE
zoom_out()
return
return
Expand All @@ -408,8 +407,8 @@
if(!client)
return
zoom_turf = get_turf(src)
is_zoomed = 1
client.view_size.set_view_radius_to(viewsize * 0.5 - 2) //convert diameter to radius
is_zoomed = TRUE
client.view_size.set_view_radius_to((viewsize * 0.5) - 2) //convert diameter to radius
var/viewoffset = 32 * tileoffset
switch(dir)
if(NORTH)
Expand All @@ -426,7 +425,7 @@
client.pixel_y = 0

/mob/living/carbon/xenomorph/proc/zoom_out()
is_zoomed = 0
is_zoomed = FALSE
zoom_turf = null
if(!client)
return
Expand Down
2 changes: 0 additions & 2 deletions code/modules/mob/login.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@
if(!client)
return

//RUTGMC EDIT ADDITION BEGIN - Preds
if(length(client_color_matrices))
update_client_color_matrices(time = 0) //This mob has client color matrices set, apply them instantly on login.
else
update_client_color_matrices(time = 1.5 SECONDS) //Otherwise, fade any matrices from a previous mob.
//RUTGMC EDIT ADDITION END

canon_client = client
clear_important_client_contents(client)
Expand Down

0 comments on commit e697f96

Please sign in to comment.