Adds alternate_worn_layer, like alternate_worn_icon it allows an item to slightly bend the rules of worn item rendering, DOES NOT MODIFY THE STANDING_ICONS INDEXES, BECAUSE THAT WOULD BREAK THINGS

This commit is contained in:
Remie Richards
2015-08-02 22:45:18 +01:00
parent 72d7f0afd4
commit 47fe31346e
5 changed files with 143 additions and 19 deletions
+59
View File
@@ -51,6 +51,65 @@
#define FIRE_LAYER 1 //If you're on fire
#define TOTAL_LAYERS 26 //KEEP THIS UP-TO-DATE OR SHIT WILL BREAK ;_;
//Human Overlay Index Shortcuts for alternate_worn_layer, layers
//Because I *KNOW* somebody will think layer+1 means "above"
//IT DOESN'T OK, IT MEANS "UNDER"
#define UNDER_SPECIES_LAYER SPECIES_LAYER+1
#define UNDER_BODY_BEHIND_LAYER BODY_BEHIND_LAYER+1
#define UNDER_BODY_LAYER BODY_LAYER+1
#define UNDER_BODY_ADJ_LAYER BODY_ADJ_LAYER+1
#define UNDER_MUTATIONS_LAYER MUTATIONS_LAYER+1
#define UNDER_AUGMENTS_LAYER AUGMENTS_LAYER+1
#define UNDER_DAMAGE_LAYER DAMAGE_LAYER+1
#define UNDER_UNIFORM_LAYER UNIFORM_LAYER+1
#define UNDER_ID_LAYER ID_LAYER+1
#define UNDER_SHOES_LAYER SHOES_LAYER+1
#define UNDER_GLOVES_LAYER GLOVES_LAYER+1
#define UNDER_EARS_LAYER EARS_LAYER+1
#define UNDER_SUIT_LAYER SUIT_LAYER+1
#define UNDER_GLASSES_LAYER GLASSES_LAYER+1
#define UNDER_BELT_LAYER BELT_LAYER+1
#define UNDER_SUIT_STORE_LAYER SUIT_STORE_LAYER+1
#define UNDER_BACK_LAYER BACK_LAYER+1
#define UNDER_HAIR_LAYER HAIR_LAYER+1
#define UNDER_FACEMASK_LAYER FACEMASK_LAYER+1
#define UNDER_HEAD_LAYER HEAD_LAYER+1
#define UNDER_HANDCUFF_LAYER HANDCUFF_LAYER+1
#define UNDER_LEGCUFF_LAYER LEGCUFF_LAYER+1
#define UNDER_L_HAND_LAYER L_HAND_LAYER+1
#define UNDER_R_HAND_LAYER R_HAND_LAYER+1
#define UNDER_BODY_FRONT_LAYER BODY_FRONT_LAYER+1
#define UNDER_FIRE_LAYER FIRE_LAYER+1
//AND -1 MEANS "ABOVE", OK?, OK!?!
#define ABOVE_SPECIES_LAYER SPECIES_LAYER-1
#define ABOVE_BODY_BEHIND_LAYER BODY_BEHIND_LAYER-1
#define ABOVE_BODY_LAYER BODY_LAYER-1
#define ABOVE_BODY_ADJ_LAYER BODY_ADJ_LAYER-1
#define ABOVE_MUTATIONS_LAYER MUTATIONS_LAYER-1
#define ABOVE_AUGMENTS_LAYER AUGMENTS_LAYER-1
#define ABOVE_DAMAGE_LAYER DAMAGE_LAYER-1
#define ABOVE_UNIFORM_LAYER UNIFORM_LAYER-1
#define ABOVE_ID_LAYER ID_LAYER-1
#define ABOVE_SHOES_LAYER SHOES_LAYER-1
#define ABOVE_GLOVES_LAYER GLOVES_LAYER-1
#define ABOVE_EARS_LAYER EARS_LAYER-1
#define ABOVE_SUIT_LAYER SUIT_LAYER-1
#define ABOVE_GLASSES_LAYER GLASSES_LAYER-1
#define ABOVE_BELT_LAYER BELT_LAYER-1
#define ABOVE_SUIT_STORE_LAYER SUIT_STORE_LAYER-1
#define ABOVE_BACK_LAYER BACK_LAYER-1
#define ABOVE_HAIR_LAYER HAIR_LAYER-1
#define ABOVE_FACEMASK_LAYER FACEMASK_LAYER-1
#define ABOVE_HEAD_LAYER HEAD_LAYER-1
#define ABOVE_HANDCUFF_LAYER HANDCUFF_LAYER-1
#define ABOVE_LEGCUFF_LAYER LEGCUFF_LAYER-1
#define ABOVE_L_HAND_LAYER L_HAND_LAYER-1
#define ABOVE_R_HAND_LAYER R_HAND_LAYER-1
#define ABOVE_BODY_FRONT_LAYER BODY_FRONT_LAYER-1
#define ABOVE_FIRE_LAYER FIRE_LAYER-1
//Security levels
#define SEC_LEVEL_GREEN 0
#define SEC_LEVEL_BLUE 1
+1
View File
@@ -9,6 +9,7 @@ var/global/image/fire_overlay = image("icon" = 'icons/effects/fire.dmi', "icon_s
//Not on /clothing because for some reason any /obj/item can technically be "worn" with enough fuckery.
var/icon/alternate_worn_icon = null//If this is set, update_icons() will find on mob (WORN, NOT INHANDS) states in this file instead, primary use: badminnery/events
var/alternate_worn_layer = null//If this is set, update_icons() will force the on mob state (WORN, NOT INHANDS) onto this layer, instead of it's default
var/hitsound = null
var/throwhitsound = null
@@ -205,6 +205,7 @@
/obj/item/weapon/gun/projectile/revolver,
/obj/item/ammo_box,
)
alternate_worn_layer = UNDER_SUIT_LAYER
/obj/item/weapon/storage/belt/fannypack
name = "fannypack"
@@ -212,13 +212,18 @@ Please contact me on #coderbus IRC. ~Carnie x
var/image/standing
var/iconfile2use //Which icon file to use to generate the overlay and any female alterations.
var/layer2use
if(U.alternate_worn_icon)
iconfile2use = U.alternate_worn_icon
if(!iconfile2use)
iconfile2use = 'icons/mob/uniform.dmi'
if(U.alternate_worn_layer)
layer2use = U.alternate_worn_layer
if(!layer2use)
layer2use = UNIFORM_LAYER
standing = image("icon"=iconfile2use, "icon_state"="[t_color]_s", "layer"=-UNIFORM_LAYER)
standing = image("icon"=iconfile2use, "icon_state"="[t_color]_s", "layer"=-layer2use)
overlays_standing[UNIFORM_LAYER] = standing
@@ -266,11 +271,17 @@ Please contact me on #coderbus IRC. ~Carnie x
var/t_state = gloves.item_state
if(!t_state) t_state = gloves.icon_state
var/layer2use
if(gloves.alternate_worn_layer)
layer2use = gloves.alternate_worn_layer
if(!layer2use)
layer2use = GLOVES_LAYER
var/image/standing
if(gloves.alternate_worn_icon)
standing = image("icon"=gloves.alternate_worn_icon, "icon_state"="[t_state]", "layer"=-GLOVES_LAYER)
standing = image("icon"=gloves.alternate_worn_icon, "icon_state"="[t_state]", "layer"=-layer2use)
if(!standing)
standing = image("icon"='icons/mob/hands.dmi', "icon_state"="[t_state]", "layer"=-GLOVES_LAYER)
standing = image("icon"='icons/mob/hands.dmi', "icon_state"="[t_state]", "layer"=-layer2use)
overlays_standing[GLOVES_LAYER] = standing
@@ -294,11 +305,17 @@ Please contact me on #coderbus IRC. ~Carnie x
glasses.screen_loc = ui_glasses //...draw the item in the inventory screen
client.screen += glasses //Either way, add the item to the HUD
var/layer2use
if(glasses.alternate_worn_layer)
layer2use = glasses.alternate_worn_layer
if(!layer2use)
layer2use = GLASSES_LAYER
var/image/standing
if(glasses.alternate_worn_icon)
standing = image("icon"=glasses.alternate_worn_icon, "icon_state"="[glasses.icon_state]","layer"=-GLASSES_LAYER)
standing = image("icon"=glasses.alternate_worn_icon, "icon_state"="[glasses.icon_state]","layer"=-layer2use)
if(!standing)
standing = image("icon"='icons/mob/eyes.dmi', "icon_state"="[glasses.icon_state]", "layer"=-GLASSES_LAYER)
standing = image("icon"='icons/mob/eyes.dmi', "icon_state"="[glasses.icon_state]", "layer"=-layer2use)
overlays_standing[GLASSES_LAYER] = standing
@@ -314,11 +331,17 @@ Please contact me on #coderbus IRC. ~Carnie x
ears.screen_loc = ui_ears //...draw the item in the inventory screen
client.screen += ears //Either way, add the item to the HUD
var/layer2use
if(ears.alternate_worn_layer)
layer2use = ears.alternate_worn_layer
if(!layer2use)
layer2use = EARS_LAYER
var/image/standing
if(ears.alternate_worn_icon)
standing = image("icon"=ears.alternate_worn_icon, "icon_state"="[ears.icon_state]", "layer"=-EARS_LAYER)
standing = image("icon"=ears.alternate_worn_icon, "icon_state"="[ears.icon_state]", "layer"=-layer2use)
if(!standing)
standing = image("icon"='icons/mob/ears.dmi', "icon_state"="[ears.icon_state]", "layer"=-EARS_LAYER)
standing = image("icon"='icons/mob/ears.dmi', "icon_state"="[ears.icon_state]", "layer"=-layer2use)
overlays_standing[EARS_LAYER] = standing
@@ -334,11 +357,17 @@ Please contact me on #coderbus IRC. ~Carnie x
shoes.screen_loc = ui_shoes //...draw the item in the inventory screen
client.screen += shoes //Either way, add the item to the HUD
var/layer2use
if(shoes.alternate_worn_layer)
layer2use = shoes.alternate_worn_layer
if(!layer2use)
layer2use = SHOES_LAYER
var/image/standing
if(shoes.alternate_worn_icon)
standing = image("icon"=shoes.alternate_worn_icon, "icon_state"="[shoes.icon_state]","layer"=-SHOES_LAYER)
standing = image("icon"=shoes.alternate_worn_icon, "icon_state"="[shoes.icon_state]","layer"=-layer2use)
if(!standing)
standing = image("icon"='icons/mob/feet.dmi', "icon_state"="[shoes.icon_state]", "layer"=-SHOES_LAYER)
standing = image("icon"='icons/mob/feet.dmi', "icon_state"="[shoes.icon_state]", "layer"=-layer2use)
overlays_standing[SHOES_LAYER] = standing
if(shoes.blood_DNA)
@@ -384,11 +413,17 @@ Please contact me on #coderbus IRC. ~Carnie x
var/t_state = belt.item_state
if(!t_state) t_state = belt.icon_state
var/layer2use
if(belt.alternate_worn_layer)
layer2use = belt.alternate_worn_layer
if(!layer2use)
layer2use = BELT_LAYER
var/image/standing
if(belt.alternate_worn_icon)
standing = image("icon"=belt.alternate_worn_icon, "icon_state"="[t_state]", "layer"=-BELT_LAYER)
standing = image("icon"=belt.alternate_worn_icon, "icon_state"="[t_state]", "layer"=-layer2use)
if(!standing)
standing = image("icon"='icons/mob/belt.dmi', "icon_state"="[t_state]", "layer"=-BELT_LAYER)
standing = image("icon"='icons/mob/belt.dmi', "icon_state"="[t_state]", "layer"=-layer2use)
overlays_standing[BELT_LAYER] = standing
@@ -405,11 +440,18 @@ Please contact me on #coderbus IRC. ~Carnie x
wear_suit.screen_loc = ui_oclothing //TODO //...draw the item in the inventory screen
client.screen += wear_suit //Either way, add the item to the HUD
var/layer2use
if(wear_suit.alternate_worn_layer)
layer2use = wear_suit.alternate_worn_layer
if(!layer2use)
layer2use = SUIT_LAYER
var/image/standing
if(wear_suit.alternate_worn_icon)
standing = image("icon"=wear_suit.alternate_worn_icon, "icon_state"="[wear_suit.icon_state]", "layer"=-SUIT_LAYER)
standing = image("icon"=wear_suit.alternate_worn_icon, "icon_state"="[wear_suit.icon_state]", "layer"=-layer2use)
if(!standing)
standing = image("icon"='icons/mob/suit.dmi', "icon_state"="[wear_suit.icon_state]", "layer"=-SUIT_LAYER)
standing = image("icon"='icons/mob/suit.dmi', "icon_state"="[wear_suit.icon_state]", "layer"=-layer2use)
overlays_standing[SUIT_LAYER] = standing
if(istype(wear_suit, /obj/item/clothing/suit/straight_jacket))
+27 -6
View File
@@ -96,11 +96,18 @@
/mob/living/carbon/update_inv_wear_mask()
remove_overlay(FACEMASK_LAYER)
if(istype(wear_mask, /obj/item/clothing/mask))
var/layer2use
if(wear_mask.alternate_worn_layer)
layer2use = wear_mask.alternate_worn_layer
if(!layer2use)
layer2use = FACEMASK_LAYER
var/image/standing
if(wear_mask.alternate_worn_icon)
standing = image("icon"=wear_mask.alternate_worn_icon, "icon_state"="[wear_mask.icon_state]", "layer"=-FACEMASK_LAYER)
standing = image("icon"=wear_mask.alternate_worn_icon, "icon_state"="[wear_mask.icon_state]", "layer"=-layer2use)
if(!standing)
standing = image("icon"='icons/mob/mask.dmi', "icon_state"="[wear_mask.icon_state]", "layer"=-FACEMASK_LAYER)
standing = image("icon"='icons/mob/mask.dmi', "icon_state"="[wear_mask.icon_state]", "layer"=-layer2use)
overlays_standing[FACEMASK_LAYER] = standing
@@ -111,11 +118,18 @@
/mob/living/carbon/update_inv_back()
remove_overlay(BACK_LAYER)
if(back)
var/layer2use
if(back.alternate_worn_layer)
layer2use = back.alternate_worn_layer
if(!layer2use)
layer2use = BACK_LAYER
var/image/standing
if(back.alternate_worn_icon)
standing = image("icon"=back.alternate_worn_icon, "icon_state"="[back.icon_state]", "layer"=-BACK_LAYER)
standing = image("icon"=back.alternate_worn_icon, "icon_state"="[back.icon_state]", "layer"=-layer2use)
if(!standing)
standing = image("icon"='icons/mob/back.dmi', "icon_state"="[back.icon_state]", "layer"=-BACK_LAYER)
standing = image("icon"='icons/mob/back.dmi', "icon_state"="[back.icon_state]", "layer"=-layer2use)
overlays_standing[BACK_LAYER] = standing
return back
@@ -124,11 +138,18 @@
/mob/living/carbon/update_inv_head()
remove_overlay(HEAD_LAYER)
if(head)
var/layer2use
if(head.alternate_worn_layer)
layer2use = head.alternate_worn_layer
if(!layer2use)
layer2use = HEAD_LAYER
var/image/standing
if(head.alternate_worn_icon)
standing = image("icon"=head.alternate_worn_icon, "icon_state"="[head.icon_state]", "layer"=-HEAD_LAYER)
standing = image("icon"=head.alternate_worn_icon, "icon_state"="[head.icon_state]", "layer"=-layer2use)
if(!standing)
standing = image("icon"='icons/mob/head.dmi', "icon_state"="[head.icon_state]", "layer"=-HEAD_LAYER)
standing = image("icon"='icons/mob/head.dmi', "icon_state"="[head.icon_state]", "layer"=-layer2use)
standing.color = head.color // For now, this is here solely for kitty ears, but everything should do this eventually
standing.alpha = head.alpha