obj/hud is now datum/hud. There was no need for it to be an object.

Moved some of the static overlays such as the dither effects, druggy effect and blurry-eyes into datum/global_hud. Meaning that only one object is instanced per server rather than per mob. It reduces on code.
Commented out a green and red overlay which aren't used, which were being instanced for every mob.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4767 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
elly1989@rocketmail.com
2012-09-28 23:02:11 +00:00
parent b903680fbd
commit eb10f04ea3
26 changed files with 212 additions and 547 deletions
+117 -25
View File
@@ -1,4 +1,3 @@
//Upper left action buttons, displayed when you pick up an item that has this enabled.
#define ui_action_slot1 "1:6,14:26"
#define ui_action_slot2 "2:8,14:26"
@@ -55,18 +54,15 @@
#define ui_alien_fire "14:28,12:25"
#define ui_alien_oxygen "14:28,11:25"
//Middle right (status indicators)
#define ui_nutrition "14:28,5:11"
#define ui_temp "14:28,6:13"
#define ui_health "14:28,7:15"
#define ui_internal "14:28,8:17"
//borgs
#define ui_borg_health "14:28,6:13" //borgs have the health display where humans have the pressure damage indicator.
#define ui_alien_health "14:28,6:13" //aliens have the health display where humans have the pressure damage indicator.
//Pop-up inventory
#define ui_shoes "2:8,1:5"
@@ -80,20 +76,14 @@
#define ui_head "2:8,4:11"
//Intent small buttons
#define ui_help_small "12:8,1:1"
#define ui_disarm_small "12:15,1:18"
#define ui_grab_small "12:32,1:18"
#define ui_harm_small "12:39,1:1"
//#define ui_swapbutton "6:-16,1:5" //Unused
//#define ui_headset "SOUTH,8"
#define ui_hand "6:14,1:5"
#define ui_hstore1 "5,5"
@@ -105,16 +95,126 @@
#define ui_iarrowleft "SOUTH-1,11"
#define ui_iarrowright "SOUTH-1,13"
var/datum/global_hud/global_hud = new()
/datum/global_hud
var/h_type = /obj/screen
var/obj/screen/druggy
var/obj/screen/blurry
// var/obj/screen/alien_view
// var/obj/screen/g_dither
var/list/vimpaired
var/list/darkMask
New()
//420erryday psychedellic colours screen overlay for when you are high
druggy = new h_type()
druggy.screen_loc = "WEST,SOUTH to EAST,NORTH"
druggy.icon_state = "druggy"
druggy.layer = 17
druggy.mouse_opacity = 0
//that white blurry effect you get when you eyes are damaged
blurry = new h_type()
blurry.screen_loc = "WEST,SOUTH to EAST,NORTH"
blurry.icon_state = "blurry"
blurry.layer = 17
blurry.mouse_opacity = 0
var/obj/screen/O
var/i
//that nasty looking dither you get when you're short-sighted
vimpaired = newlist(h_type,h_type,h_type,h_type)
O = vimpaired[1]
O.screen_loc = "1,1 to 5,15"
O = vimpaired[2]
O.screen_loc = "5,1 to 10,5"
O = vimpaired[3]
O.screen_loc = "6,11 to 10,15"
O = vimpaired[4]
O.screen_loc = "11,1 to 15,15"
//welding mask overlay black/dither
darkMask = newlist(h_type,h_type,h_type,h_type,h_type,h_type,h_type,h_type)
O = darkMask[1]
O.screen_loc = "3,3 to 5,13"
O = darkMask[2]
O.screen_loc = "5,3 to 10,5"
O = darkMask[3]
O.screen_loc = "6,11 to 10,13"
O = darkMask[4]
O.screen_loc = "11,3 to 13,13"
O = darkMask[5]
O.screen_loc = "1,1 to 15,2"
O = darkMask[6]
O.screen_loc = "1,3 to 2,15"
O = darkMask[7]
O.screen_loc = "14,3 to 15,15"
O = darkMask[8]
O.screen_loc = "3,14 to 13,15"
for(i=1,i<=4,i++)
O = vimpaired[i]
O.icon_state = "dither50"
O.layer = 17
O.mouse_opacity = 0
O = darkMask[i]
O.icon_state = "dither50"
O.layer = 17
O.mouse_opacity = 0
for(i=5,i<=8,i++)
O = darkMask[i]
O.icon_state = "black"
O.layer = 17
O.mouse_opacity = 0
/*
//not used
alien_view = new h_type()
alien_view.screen_loc = "WEST,SOUTH to EAST,NORTH"
alien_view.icon_state = "alien"
alien_view.layer = 18
alien_view.mouse_opacity = 0
g_dither = new h_type()
g_dither.screen_loc = "WEST,SOUTH to EAST,NORTH"
g_dither.icon_state = "dither12g"
g_dither.layer = 18
g_dither.mouse_opacity = 0
*/
obj/hud/New(var/type = 0)
instantiate(type)
/datum/hud
var/mob/mymob
var/h_type = /obj/screen //this is like...the most pointless thing ever. Use a god damn define!
var/hud_shown = 1 //Used for the HUD toggle (F12)
var/inventory_shown = 1 //the inventory
var/show_intent_icons = 0
var/hotkey_ui_hidden = 0 //This is to hide the buttons that can be used via hotkeys. (hotkeybuttons list of buttons)
var/obj/screen/r_hand_hud_object
var/obj/screen/l_hand_hud_object
var/obj/screen/action_intent
var/obj/screen/move_intent
var/list/adding
var/list/other
var/list/obj/screen/hotkeybuttons
var/list/obj/screen/item_action/item_action_list //Used for the item action ui buttons.
datum/hud/New(mob/owner)
mymob = owner
instantiate()
..()
return
/obj/hud/proc/hidden_inventory_update()
/datum/hud/proc/hidden_inventory_update()
if(!mymob) return
if(inventory_shown && hud_shown)
if(ishuman(mymob))
@@ -137,7 +237,7 @@ obj/hud/New(var/type = 0)
if(mymob:wear_mask) mymob:wear_mask:screen_loc = null
if(mymob:head) mymob:head:screen_loc = null
/obj/hud/proc/persistant_inventory_update()
/datum/hud/proc/persistant_inventory_update()
if(!mymob) return
if(hud_shown)
if(ishuman(mymob))
@@ -157,16 +257,8 @@ obj/hud/New(var/type = 0)
if(mymob:r_store) mymob:r_store:screen_loc = null
/obj/hud
var/obj/screen/action_intent
var/obj/screen/move_intent
var/hud_shown = 1 //Used for the HUD toggle (F12)
var/inventory_shown = 1 //the inventory
/obj/hud/proc/instantiate(var/type = 0)
mymob = loc
if(!istype(mymob, /mob)) return 0
/datum/hud/proc/instantiate()
if(!ismob(mymob)) return 0
if(ishuman(mymob))
human_hud(mymob.UI) // Pass the player the UI style chosen in preferences
@@ -204,4 +296,4 @@ obj/hud/New(var/type = 0)
else if(isobserver(mymob))
ghost_hud()
return
return
-21
View File
@@ -1,21 +0,0 @@
/obj/hud
name = "hud"
unacidable = 1
var/mob/mymob = null
var/list/adding = null
var/list/other = null
var/obj/screen/druggy = null
var/vimpaired = null
var/obj/screen/alien_view = null
var/obj/screen/g_dither = null
var/obj/screen/blurry = null
var/list/darkMask = null
var/obj/screen/r_hand_hud_object = null
var/obj/screen/l_hand_hud_object = null
var/show_intent_icons = 0
var/list/obj/screen/hotkeybuttons = null
var/hotkey_ui_hidden = 0 //This is to hide the buttons that can be used via hotkeys. (hotkeybuttons list of buttons)
var/list/obj/screen/item_action/item_action_list = null //Used for the item action ui buttons.
var/h_type = /obj/screen //this is like...the most pointless thing ever. Use a god damn define!
@@ -201,7 +201,7 @@
return
/obj/structure/closet/MouseDrop_T(atom/movable/O as mob|obj, mob/user as mob)
if(istype(O, /obj/screen) || istype(O, /obj/hud)) //fix for HUD elements making their way into the world -Pete
if(istype(O, /obj/screen)) //fix for HUD elements making their way into the world -Pete
return
if(O.loc == user)
return