Skip to content

Commit

Permalink
ouch!
Browse files Browse the repository at this point in the history
  • Loading branch information
silicons committed Jun 22, 2023
1 parent d879984 commit d5c46bc
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 32 deletions.
8 changes: 4 additions & 4 deletions code/__DEFINES/inventory/rendering.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
/// _all for state on inhands
#define WORN_RENDER_INHAND_ONE_FOR_ALL (1<<1)
/// allow worn defaulting
#define WORN_RENDER_SLOT_ALLOW_DEFAULT (1<<2)
#define WORN_RENDER_SLOT_FORCE_DEFAULT (1<<2)
/// allow inhand defaulting
#define WORN_RENDER_INHAND_ALLOW_DEFAULT (1<<3)
#define WORN_RENDER_INHAND_FORCE_DEFAULT (1<<3)
/// don't render in slots; render_additional still used, others aren't
#define WORN_RENDER_SLOT_NO_RENDER (1<<4)
/// don't render in inhands; render_additional still used, others aren't
Expand All @@ -17,8 +17,8 @@
DEFINE_BITFIELD(worn_render_flags, list(
BITFIELD(WORN_RENDER_SLOT_ONE_FOR_ALL),
BITFIELD(WORN_RENDER_INHAND_ONE_FOR_ALL),
BITFIELD(WORN_RENDER_SLOT_ALLOW_DEFAULT),
BITFIELD(WORN_RENDER_INHAND_ALLOW_DEFAULT),
BITFIELD(WORN_RENDER_SLOT_FORCE_DEFAULT),
BITFIELD(WORN_RENDER_INHAND_FORCE_DEFAULT),
BITFIELD(WORN_RENDER_SLOT_NO_RENDER),
BITFIELD(WORN_RENDER_INHAND_NO_RENDER),
BITFIELD(WORN_RENDER_SLOT_USE_PLURAL),
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/weapons/cigs_lighters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ CIGARETTE PACKETS ARE IN FANCY.DM
throw_speed = 0.5
w_class = ITEMSIZE_TINY
slot_flags = SLOT_EARS | SLOT_MASK
worn_render_flags = WORN_RENDER_INHAND_NO_RENDER | WORN_RENDER_SLOT_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_INHAND_NO_RENDER | WORN_RENDER_SLOT_FORCE_DEFAULT
attack_verb = list("burnt", "singed")
type_butt = /obj/item/cigbutt
chem_volume = 15
Expand Down
2 changes: 1 addition & 1 deletion code/modules/clothing/under/miscellaneous.dm
Original file line number Diff line number Diff line change
Expand Up @@ -980,7 +980,7 @@
icon = 'icons/clothing/uniform/misc/future.dmi'
worn_has_rolldown = UNIFORM_HAS_ROLL
worn_has_rollsleeve = UNIFORM_HAS_NO_ROLL
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_NO_RENDER | WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_NO_RENDER | WORN_RENDER_INHAND_FORCE_DEFAULT
worn_bodytypes = BODYTYPE_DEFAULT
inhand_default_type = INHAND_DEFAULT_ICON_UNIFORMS
inhand_state = "jensen"
Expand Down
16 changes: 8 additions & 8 deletions code/modules/holidays/halloween_loadout_masquarade.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
icon = 'icons/antagonists/syndicate/items/clothing/sneaksuit.dmi'
inhand_default_type = INHAND_DEFAULT_ICON_UNIFORMS
inhand_state = "black"
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_FORCE_DEFAULT
body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS
cold_protection = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS

Expand All @@ -65,7 +65,7 @@
icon = 'icons/antagonists/syndicate/items/clothing/sneaksuit.dmi'
inhand_default_type = INHAND_DEFAULT_ICON_SUITS
inhand_state = "armor"
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_FORCE_DEFAULT
body_cover_flags = UPPER_TORSO|LOWER_TORSO
cold_protection = UPPER_TORSO|LOWER_TORSO

Expand All @@ -79,7 +79,7 @@
icon = 'icons/antagonists/syndicate/items/clothing/sneaksuit.dmi'
inhand_default_type = INHAND_DEFAULT_ICON_GLOVES
inhand_state = "black"
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_FORCE_DEFAULT
body_cover_flags = HANDS
cold_protection = HANDS

Expand All @@ -93,7 +93,7 @@
icon = 'icons/antagonists/syndicate/items/clothing/sneaksuit.dmi'
inhand_default_type = INHAND_DEFAULT_ICON_HATS
inhand_state = "helmet"
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_FORCE_DEFAULT
body_cover_flags = HEAD|EYES
clothing_flags = ALLOWINTERNALS
cold_protection = HEAD
Expand All @@ -108,7 +108,7 @@
icon = 'icons/antagonists/syndicate/items/clothing/sneaksuit.dmi'
inhand_default_type = INHAND_DEFAULT_ICON_SHOES
inhand_state = "cult"
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_FORCE_DEFAULT
body_cover_flags = FEET
cold_protection = FEET

Expand All @@ -122,7 +122,7 @@
icon = 'icons/antagonists/syndicate/items/clothing/sneaksuit.dmi'
inhand_default_type = INHAND_DEFAULT_ICON_MASKS
inhand_state = "gas"
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_FORCE_DEFAULT
body_cover_flags = HEAD|EYES
clothing_flags = ALLOWINTERNALS
cold_protection = HEAD
Expand All @@ -137,7 +137,7 @@
icon = 'icons/antagonists/syndicate/items/clothing/contractor.dmi'
inhand_default_type = INHAND_DEFAULT_ICON_HATS
inhand_state = "helmet"
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_FORCE_DEFAULT
body_cover_flags = HEAD|EYES
clothing_flags = ALLOWINTERNALS
cold_protection = HEAD
Expand All @@ -152,7 +152,7 @@
icon = 'icons/antagonists/syndicate/items/clothing/contractor.dmi'
inhand_default_type = INHAND_DEFAULT_ICON_GLOVES
inhand_state = "armor"
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_FORCE_DEFAULT
body_cover_flags = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET
cold_protection = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS|HANDS|FEET

Expand Down
6 changes: 3 additions & 3 deletions code/modules/mob/inventory/rendering.dm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
* pickaxe_onhand_right
* 7. Defaulting: In the case you want to default slot/inhands (usually one but not the other),
* simply add to worn_render_flags, depending on which:
* WORN_RENDER_SLOT_ALLOW_DEFAULT
* WORN_RENDER_SLOT_FORCE_DEFAULT
* WORN_RENDER_INHAND_ALLOW_DEFAULt
* 8. Congratulations, you're done!
*
Expand Down Expand Up @@ -225,7 +225,7 @@
/// bodytypes that just skip rendering (i hate teshari)
var/datum/bodytypes/worn_bodytypes_invisible = BODYTYPES_NONE
/// worn rendering flags
var/worn_render_flags = WORN_RENDER_INHAND_ALLOW_DEFAULT | WORN_RENDER_SLOT_ALLOW_DEFAULT
var/worn_render_flags = WORN_RENDER_INHAND_FORCE_DEFAULT | WORN_RENDER_SLOT_FORCE_DEFAULT
//? support for adminbus
/// vv only; slot id to icon; worn_x_dimension and worn_y_dimension will be used in this case.
VAR_PRIVATE/list/worn_icon_override
Expand Down Expand Up @@ -369,7 +369,7 @@
data[WORN_DATA_SIZE_Y] = worn_y_dimension

//* inventory slot defaults
else if(inhands? (worn_render_flags & WORN_RENDER_INHAND_ALLOW_DEFAULT) : (worn_render_flags & WORN_RENDER_SLOT_ALLOW_DEFAULT))
else if(inhands? (worn_render_flags & WORN_RENDER_INHAND_FORCE_DEFAULT) : (worn_render_flags & WORN_RENDER_SLOT_FORCE_DEFAULT))
var/list/resolved = slot_meta.resolve_default_assets(bodytype, data[WORN_DATA_STATE], M, src, inhand_default_type)
if(!resolved && (bodytype != BODYTYPE_DEFAULT) && CHECK_BODYTYPE(worn_bodytypes_fallback, bodytype))
// attempt 2 - use fallback if available
Expand Down
11 changes: 0 additions & 11 deletions code/modules/mob/inventory/slot_meta.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ GLOBAL_LIST_EMPTY(inventory_slot_type_cache)
var/render_key_plural
/// rendering default layer; first is default, rest are alt layers. can be list or just one number.
VAR_PROTECTED/list/render_layer
/// rendering icon state cache for default icons
VAR_PRIVATE/list/render_state_cache
/// rendering default icons by bodytype
VAR_PROTECTED/list/render_default_icons
/// rendering dim x
Expand Down Expand Up @@ -168,7 +166,6 @@ GLOBAL_LIST_EMPTY(inventory_slot_type_cache)

/datum/inventory_slot_meta/proc/rebuild_rendering_caches()
PROTECTED_PROC(TRUE) // if you think you need this outside you should rethink
render_state_cache = list()
render_dim_x_cache = list()
render_dim_y_cache = list()
if(!islist(render_default_icons)) // save the checks later for null
Expand All @@ -182,10 +179,6 @@ GLOBAL_LIST_EMPTY(inventory_slot_type_cache)
render_default_icons -= bodytype_str
continue
var/icon/I = render_default_icons[bodytype_str]
render_state_cache[bodytype_str] = icon_states(I)
// turn into hash
for(var/state in render_state_cache[bodytype_str])
render_state_cache[bodytype_str][state] = TRUE
render_dim_x_cache[bodytype_str] = I.Width()
render_dim_y_cache[bodytype_str] = I.Height()

Expand All @@ -194,8 +187,6 @@ GLOBAL_LIST_EMPTY(inventory_slot_type_cache)
*/
/datum/inventory_slot_meta/proc/resolve_default_assets(bodytype, state, mob/wearer, obj/item/equipped, inhand_domain)
var/bodytype_str = bodytype_to_string(bodytype)
if(!render_state_cache[bodytype_str]?[state])
return
return list(render_default_icons[bodytype_str], render_dim_x_cache[bodytype_str], render_dim_y_cache[bodytype_str])

/**
Expand Down Expand Up @@ -726,8 +717,6 @@ GLOBAL_LIST_EMPTY(inventory_slot_type_cache)
* returns (icon, dim_x, dim_y) if found in defaults, null if not
*/
/datum/inventory_slot_meta/abstract/hand/resolve_default_assets(bodytype, state, mob/wearer, obj/item/equipped, inhand_domain)
if(!render_state_cache[inhand_domain]?[state])
return
return list(render_default_icons[inhand_domain], render_dim_x_cache[inhand_domain], render_dim_y_cache[inhand_domain])

/datum/inventory_slot_meta/abstract/hand/left
Expand Down
2 changes: 1 addition & 1 deletion code/modules/photography/album.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
name = "Photo album"
icon = 'icons/modules/photography/album.dmi'
icon_state = "album"
worn_render_flags = WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_INHAND_FORCE_DEFAULT
inhand_default_type = INHAND_DEFAULT_ICON_STORAGE
inhand_state = "briefcase"
can_hold = list(/obj/item/photo)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/photography/film.dm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
desc = "A camera film cartridge. Insert it into a camera to reload it."
icon = 'icons/modules/photography/film.dmi'
icon_state = "film"
worn_render_flags = WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_INHAND_FORCE_DEFAULT
inhand_default_type = INHAND_DEFAULT_ICON_STORAGE
inhand_state = "camera"
w_class = ITEMSIZE_TINY
Expand Down
2 changes: 1 addition & 1 deletion code/modules/photography/photo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
name = "photo"
icon = 'icons/modules/photography/photo.dmi'
icon_state = "photo"
worn_render_flags = WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_INHAND_FORCE_DEFAULT
inhand_default_type = INHAND_DEFAULT_ICON_GENERAL
inhand_state = "paper"
w_class = ITEMSIZE_TINY
Expand Down
2 changes: 1 addition & 1 deletion donator/unclebourbon/pmc_mask.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
desc = "A rugged black gas mask with red lenses."
icon = 'donator/unclebourbon/pmc_mask.dmi'
icon_state = "pmc"
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_ALLOW_DEFAULT
worn_render_flags = WORN_RENDER_SLOT_ONE_FOR_ALL | WORN_RENDER_INHAND_FORCE_DEFAULT
inhand_default_type = INHAND_DEFAULT_ICON_MASKS
inhand_state = "swat"

Expand Down

0 comments on commit d5c46bc

Please sign in to comment.