- Full revert of r3803, approved by project leads.

r3803:
- Contained many bugs, first of which was that it didn't really... work.
- Split the HUD and code into separate objects, thus creating a fork in code. This implies that any changes need to be mirrored on the fork objects, thus doubling the amount of code maintenance we have to do.
- The UI should be one of the most standardized things around. Giving choices here is bad design practice.
- Double the amount of defines does not equal to double the amount of fun.
- The revision does not adhere to our coding standard. See the changes to  /trunk/code/modules/mob/hud.dm in r3803 as an example.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3804 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2012-06-12 12:31:14 +00:00
parent 91a4708544
commit 2296cfd331
32 changed files with 910 additions and 2775 deletions

184
code/game/hud.dm Normal file
View File

@@ -0,0 +1,184 @@
//Lower left, persistant menu
#define ui_inventory "1:6,1:5"
//Inventory close areas. When you pass your mouse over these areas they close the inventory.
#define ui_invclosearea1 "1,1 to 1:6,5"
#define ui_invclosearea2 "1,1 to 4,1:16"
#define ui_invclosearea3 "4:16,1 to 5:16,5"
#define ui_invclosearea4 "1,5:16 to 4,5:16"
//Lower center, persistant menu
#define ui_sstore1 "3:10,1:5"
#define ui_id "4:12,1:5"
#define ui_belt "5:14,1:5"
#define ui_back "6:14,1:5"
#define ui_rhand "7:16,1:5"
#define ui_lhand "8:16,1:5"
#define ui_equip "7:16,2:5"
#define ui_swaphand1 "7:16,2:5"
#define ui_swaphand2 "8:16,2:5"
#define ui_storage1 "9:18,1:5"
#define ui_storage2 "10:20,1:5"
#define ui_alien_head "4:12,1:5" //aliens
#define ui_alien_oclothing "5:14,1:5" //aliens
#define ui_inv1 "6:16,1:5" //borgs
#define ui_inv2 "7:16,1:5" //borgs
#define ui_inv3 "8:16,1:5" //borgs
#define ui_borg_store "9:14,1:5" //borgs
#define ui_monkey_mask "5:14,1:5" //monkey
#define ui_monkey_back "6:14,1:5" //monkey
//Lower right, persistant menu
#define ui_drop_throw "14:28,2:7"
#define ui_pull_resist "13:26,2:7"
#define ui_acti "13:26,1:5"
#define ui_movi "12:24,1:5"
#define ui_zonesel "14:28,1:5"
#define ui_borg_pull "12:24,2:7"
#define ui_borg_module "13:26,2:7"
#define ui_borg_panel "14:28,2:7"
//Upper-middle right (damage indicators)
#define ui_toxin "14:28,13:27"
#define ui_fire "14:28,12:25"
#define ui_oxygen "14:28,11:23"
#define ui_pressure "14:28,10:21"
//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"
#define ui_iclothing "1:6,2:7"
#define ui_oclothing "2:8,2:7"
#define ui_gloves "3:10,2:7"
#define ui_glasses "1:6,3:9"
#define ui_mask "2:8,3:9"
#define ui_ears "3:10,3:9"
#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"
//#define ui_resist "EAST+1,SOUTH-1"
#define ui_sleep "EAST+1, NORTH-13"
#define ui_rest "EAST+1, NORTH-14"
#define ui_iarrowleft "SOUTH-1,11"
#define ui_iarrowright "SOUTH-1,13"
obj/hud/New(var/type = 0)
instantiate(type)
..()
return
/obj/hud/proc/other_update()
if(!mymob) return
if(show_otherinventory)
if(mymob:shoes) mymob:shoes:screen_loc = ui_shoes
if(mymob:gloves) mymob:gloves:screen_loc = ui_gloves
if(mymob:ears) mymob:ears:screen_loc = ui_ears
//if(mymob:s_store) mymob:s_store:screen_loc = ui_sstore1
if(mymob:glasses) mymob:glasses:screen_loc = ui_glasses
if(mymob:w_uniform) mymob:w_uniform:screen_loc = ui_iclothing
if(mymob:wear_suit) mymob:wear_suit:screen_loc = ui_oclothing
if(mymob:wear_mask) mymob:wear_mask:screen_loc = ui_mask
if(mymob:head) mymob:head:screen_loc = ui_head
else
if(ishuman(mymob))
if(mymob:shoes) mymob:shoes:screen_loc = null
if(mymob:gloves) mymob:gloves:screen_loc = null
if(mymob:ears) mymob:ears:screen_loc = null
//if(mymob:s_store) mymob:s_store:screen_loc = null
if(mymob:glasses) mymob:glasses:screen_loc = null
if(mymob:w_uniform) mymob:w_uniform:screen_loc = null
if(mymob:wear_suit) mymob:wear_suit:screen_loc = null
if(mymob:wear_mask) mymob:wear_mask:screen_loc = null
if(mymob:head) mymob:head:screen_loc = null
/obj/hud/var/show_otherinventory = 1
/obj/hud/var/obj/screen/action_intent
/obj/hud/var/obj/screen/move_intent
/obj/hud/proc/instantiate(var/type = 0)
mymob = loc
if(!istype(mymob, /mob)) return 0
if(ishuman(mymob))
human_hud(mymob.UI) // Pass the player the UI style chosen in preferences
spawn()
if((RADAR in mymob.augmentations) && mymob.radar_open)
mymob:start_radar()
else if(RADAR in mymob.augmentations)
mymob:place_radar_closed()
else if(ismonkey(mymob))
monkey_hud(mymob.UI)
else if(isbrain(mymob))
brain_hud(mymob.UI)
else if(islarva(mymob))
larva_hud()
else if(isalien(mymob))
alien_hud()
else if(isAI(mymob))
ai_hud()
else if(isrobot(mymob))
robot_hud()
// else if(ishivebot(mymob))
// hivebot_hud()
// else if(ishivemainframe(mymob))
// hive_mainframe_hud()
else if(isobserver(mymob))
ghost_hud()
return

View File

@@ -111,7 +111,7 @@
//Clonepod
//Start growing a human clone in the pod!
/obj/machinery/clonepod/proc/growclone(mob/ghost as mob, var/clonename, var/ui, var/se, var/mindref, var/mrace, var/UI, var/hud_type, var/datum/changeling/changelingClone)
/obj/machinery/clonepod/proc/growclone(mob/ghost as mob, var/clonename, var/ui, var/se, var/mindref, var/mrace, var/UI, var/datum/changeling/changelingClone)
if(((!ghost) || (!ghost.client)) || src.mess || src.attempting)
return 0
@@ -124,12 +124,11 @@
src.occupant = new /mob/living/carbon/human(src)
occupant:hud_type = hud_type
occupant:UI = UI // set interface preference
ghost.client.mob = src.occupant
new/obj/hud(src.occupant,src.occupant.hud_type)
src.occupant.hud_used = new/obj/hud( src.occupant )
// probably redundant because previous line calls mob/Login() which does this line of code
// but until this is proven useless keep it for safety - Doohl

View File

@@ -372,7 +372,7 @@
//Can't clone without someone to clone. Or a pod. Or if the pod is busy. Or full of gibs.
if ((!selected) || (!src.pod1) || (src.pod1.occupant) || (src.pod1.mess) || !config.revival_cloning)
src.temp = "Unable to initiate cloning cycle." // most helpful error message in THE HISTORY OF THE WORLD
else if (src.pod1.growclone(selected, C.fields["name"], C.fields["UI"], C.fields["SE"], C.fields["mind"], C.fields["mrace"], C.fields["interface"],C.fields["interfaceType"],C.fields["changeling"]))
else if (src.pod1.growclone(selected, C.fields["name"], C.fields["UI"], C.fields["SE"], C.fields["mind"], C.fields["mrace"], C.fields["interface"],C.fields["changeling"]))
src.temp = "Cloning cycle activated."
src.records.Remove(C)
del(C)
@@ -418,7 +418,7 @@
// Preferences stuff
R.fields["interface"] = subject.UI
R.fields["interfaceType"] = subject.hud_type
//Add an implant if needed

View File

@@ -97,20 +97,7 @@
return
/obj/item/weapon/secstorage/proc/orient2hud(mob/user as mob)
if(istype(user.hud_used,/obj/hud/slim))
standard_orient_objs()
if(istype(user.hud_used,/obj/hud/retro))
if (src == user.l_hand)
src.orient_objs(3, 11, 3, 4)
else
if (src == user.r_hand)
src.orient_objs(1, 11, 1, 4)
else
if (src == user.back)
src.orient_objs(4, 10, 4, 3)
else
src.orient_objs(7, 8, 10, 7)
standard_orient_objs()
return
/obj/item/weapon/secstorage/attackby(obj/item/weapon/W as obj, mob/user as mob)

View File

@@ -66,7 +66,7 @@
/obj/item/weapon/storage/proc/orient_objs(tx, ty, mx, my)
var/cx = tx
var/cy = ty
src.boxes.screen_loc = "[tx],[ty] to [mx],[my]"
src.boxes.screen_loc = "[tx]:,[ty] to [mx],[my]"
for(var/obj/O in src.contents)
O.screen_loc = "[cx],[cy]"
O.layer = 20
@@ -94,36 +94,13 @@
//This proc determins the size of the inventory to be displayed. Please touch it only if you know what you're doing.
/obj/item/weapon/storage/proc/orient2hud(mob/user as mob)
//var/mob/living/carbon/human/H = user
var/row_num = 0
var/col_num = 0
if(istype(user.hud_used,/obj/hud/slim))
col_num = min(7,storage_slots) -1
if (contents.len > 7)
row_num = round((contents.len-1) / 7) // 7 is the maximum allowed width.
src.standard_orient_objs(row_num,col_num)
return
if(istype(user.hud_used,/obj/hud/retro))
row_num = min(7,storage_slots) -1 //For belts, the meanings of the two variables are inverted, so we don't have to declare new ones
if (contents.len > 7)
col_num = round((contents.len-1) / 7) // 7 is the maximum allowed column height for r_hand, l_hand and back storage items.
if (src == user.l_hand)
src.orient_objs(3-col_num, 3+row_num, 3, 3)
else if(src == user.r_hand)
src.orient_objs(1, 3+row_num, 1+col_num, 3)
else if(src == user.back)
src.orient_objs(4-col_num, 3+row_num, 4, 3)
else if(ishuman(user) && src == user:belt)//only humans have belts
src.orient_objs(1, 3+col_num, 1+row_num, 3)
else
src.orient_objs(5, 10+col_num, 5 + row_num, 10)
return
var/col_count = min(7,storage_slots) -1
if (contents.len > 7)
row_num = round((contents.len-1) / 7) // 7 is the maximum allowed width.
src.standard_orient_objs(row_num,col_count)
return
//This proc is called when you want to place an item into the storage item.
/obj/item/weapon/storage/attackby(obj/item/W as obj, mob/user as mob)
@@ -212,12 +189,6 @@
return
/obj/item/weapon/storage/dropped(mob/user as mob)
if(istype(user.hud_used,/obj/hud/retro))
var/col_num = 0
var/row_count = min(7,storage_slots) -1
if (contents.len > 7)
col_num = round((contents.len-1) / 7) // 7 is the maximum allowed column height for r_hand, l_hand and back storage items.
src.orient_objs(5, 10+col_num, 5 + row_count, 10)
return
/obj/item/weapon/storage/MouseDrop(over_object, src_location, over_location)
@@ -272,7 +243,7 @@
src.closer.master = src
src.closer.icon_state = "x"
src.closer.layer = 20
//orient2hud()
orient2hud()
return
/obj/item/weapon/storage/emp_act(severity)