Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further player height fixes and improvements #4229

Merged
merged 6 commits into from
Nov 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,8 @@ GLOBAL_LIST_INIT(human_heights_to_offsets, list(
"[HUMAN_HEIGHT_SHORT]" = list(-1, -1),
"[HUMAN_HEIGHT_MEDIUM]" = list(0, 0),
"[HUMAN_HEIGHT_TALL]" = list(1, 1),
"[HUMAN_HEIGHT_TALLEST]" = list(2, 2),
"[HUMAN_HEIGHT_TALLER]" = list(2, 1),
"[HUMAN_HEIGHT_TALLEST]" = list(3, 2),
))

// Mob Overlays Indexes
Expand Down Expand Up @@ -779,9 +780,13 @@ GLOBAL_LIST_INIT(layers_to_offset, list(
"[ID_LAYER]" = UPPER_BODY,
"[FACEMASK_LAYER]" = UPPER_BODY,
monkestation end */
/* monkestation edit start
it's okay for these layers to use shared appearences so long as the filters are reset before adding them as overlays
this is because adding an appearence to `overlays` copies it
// These two are cached, and have their appearance shared(?), so it's safer to just not touch it
"[MUTATIONS_LAYER]" = NO_MODIFY,
"[FRONT_MUTATIONS_LAYER]" = NO_MODIFY,
monkestation edit end */
// These DO get a filter, I'm leaving them here as reference,
// to show how many filters are added at a glance
// BACK_LAYER (backpacks are big)
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/~monkestation/lists/flavor_misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ GLOBAL_LIST_INIT(body_heights, list(
"Short" = HUMAN_HEIGHT_SHORT,
"Normal" = HUMAN_HEIGHT_MEDIUM,
"Tall" = HUMAN_HEIGHT_TALL,
"Taller" = HUMAN_HEIGHT_TALLER,
"Tallest" = HUMAN_HEIGHT_TALLEST,
))
1 change: 1 addition & 0 deletions code/modules/mob/living/carbon/human/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@
HUMAN_HEIGHT_SHORT,
HUMAN_HEIGHT_MEDIUM,
HUMAN_HEIGHT_TALL,
HUMAN_HEIGHT_TALLER,
HUMAN_HEIGHT_TALLEST
)
if(ismonkey(src))
Expand Down
30 changes: 23 additions & 7 deletions code/modules/mob/living/carbon/human/human_update_icons.dm
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,10 @@ generate/load female uniform sprites matching all previously decided variables
// Some overlays can't be displaced as they're too close to the edge of the sprite or cross the middle point in a weird way.
// So instead we have to pass them through an offset, which is close enough to look good.
/mob/living/carbon/human/apply_overlay(cache_index)
if(get_mob_height() == HUMAN_HEIGHT_MEDIUM)
/* MONKESTATION EDIT: made it so that MUTATIONS_LAYER and FRONT_MUTATIONS_LAYER always get their filters updated
This is required because they use cached / shared appearences
if(get_mob_height() == HUMAN_HEIGHT_MEDIUM) - original */
if(get_mob_height() == HUMAN_HEIGHT_MEDIUM && cache_index != MUTATIONS_LAYER && cache_index != FRONT_MUTATIONS_LAYER)
return ..()

var/raw_applied = overlays_standing[cache_index]
Expand Down Expand Up @@ -914,29 +917,35 @@ generate/load female uniform sprites matching all previously decided variables
* Applies a filter to an appearance according to mob height
*/
/mob/living/carbon/human/proc/apply_height_filters(image/appearance, only_apply_in_prefs = FALSE)
//MONKESTATION EDIT START : Pick a displacement mask depending on the height of the icon, 32x48 icons are used for features which would otherwise get clipped when tall players use them
//MONKESTATION EDIT START
// Pick a displacement mask depending on the height of the icon, ?x48 icons are used for features which would otherwise get clipped when tall players use them
// Note: Due to how this system works it's okay to use a mask which is wider than the appearence but NOT okay if the mask is thinner, taller or shorter
var/dims = get_icon_dimensions(appearance.icon)
var/icon_width = dims["width"]
var/icon_height = dims["height"]

var/mask_icon = 'icons/effects/cut.dmi'
if(icon_width != 0 && icon_height != 0)
if(icon_width != 32)
throw EXCEPTION("Bad dimensions ([icon_width]x[icon_height]) for icon '[appearance.icon]'")
if(icon_height == 48)
mask_icon = 'monkestation/icons/effects/cut_32x48.dmi'
mask_icon = 'monkestation/icons/effects/cut_96x48.dmi'
if(icon_width > 96)
stack_trace("Bad dimensions (w[icon_width],h[icon_height]) for icon '[appearance.icon]'")
else if(icon_height != 32)
throw EXCEPTION("Bad dimensions ([icon_width]x[icon_height]) for icon '[appearance.icon]'")
stack_trace("Bad dimensions (w[icon_width],h[icon_height]) for icon '[appearance.icon]'")
else if(icon_width > 32)
stack_trace("Bad dimensions (w[icon_width],h[icon_height]) for icon '[appearance.icon]'")

var/icon/cut_torso_mask = icon(mask_icon, "Cut1")
var/icon/cut_legs_mask = icon(mask_icon, "Cut2")
var/icon/lenghten_torso_mask = icon(mask_icon, "Cut3")
var/icon/lenghten_legs_mask = icon(mask_icon, "Cut4")
var/icon/lenghten_ankles_mask = icon(mask_icon, "Cut5")
//MONKESTATION EDIT END

appearance.remove_filter(list(
"Cut_Torso",
"Cut_Legs",
"Lenghten_Ankles", // MONKESTATION ADDITION
"Lenghten_Legs",
"Lenghten_Torso",
"Gnome_Cut_Torso",
Expand Down Expand Up @@ -1029,8 +1038,15 @@ generate/load female uniform sprites matching all previously decided variables
list(
"name" = "Lenghten_Legs",
"priority" = 1,
"params" = displacement_map_filter(lenghten_legs_mask, x = 0, y = 0, size = 2),
"params" = displacement_map_filter(lenghten_legs_mask, x = 0, y = 0, size = 1 /* monke edit: 2 -> 1 */),
),
// MONKESTATION EDIT START
list(
"name" = "Lenghten_Ankles",
"priority" = 1,
"params" = displacement_map_filter(lenghten_ankles_mask, x = 0, y = 0, size = 1),
),
// MONKESTATION EDIT END
))

// Kinda gross but because many humans overlays do not use KEEP_TOGETHER we need to manually propogate the filter
Expand Down
Binary file modified icons/effects/cut.dmi
Binary file not shown.
Binary file modified icons/mob/species/wings.dmi
Binary file not shown.
Binary file removed monkestation/icons/effects/cut_32x48.dmi
Binary file not shown.
Binary file added monkestation/icons/effects/cut_96x48.dmi
Binary file not shown.
Loading