Guest User

TTTHUD.lua

a guest
Jun 30th, 2014
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 36.44 KB | None | 0 0
  1.  
  2. if SERVER then
  3.     AddCSLuaFile("TTTHUD.lua")
  4.     resource.AddSingleFile( "resource/fonts/Aero_Matics_Display.ttf" )
  5.     resource.AddSingleFile( "materials/fc_ttthud/fc_ttthud_health.png" )
  6.     resource.AddSingleFile( "materials/fc_ttthud/fc_ttthud_health_small.png" )
  7.     resource.AddSingleFile( "materials/fc_ttthud/fc_ttthud_armor.png" )
  8.     resource.AddSingleFile( "materials/fc_ttthud/fc_ttthud_armor_small.png" )
  9. else
  10.  
  11.     hook.Add("PostGamemodeLoaded", "FC_HUD", function()
  12.    
  13.         FC_HUD = {}
  14.        
  15.         ------------------
  16.         -- CONFIG START --
  17.         ------------------
  18.        
  19.         FC_HUD.TeamBasedHP = false
  20.         FC_HUD.DefaultTargetInfo = false
  21.         FC_HUD.LargerStatus = false
  22.         FC_HUD.ColoredRoleBack = false
  23.         FC_HUD.ColoredRoleText = false
  24.         FC_HUD.ShowOnlyHP = false
  25.        
  26.         ------------------
  27.         -- CONFIG START --
  28.         ------------------
  29.        
  30.         surface.CreateFont( "FC_HUD_10", { font = "Aero Matics Display Regular", antialias = true, size = 10 } )
  31.         surface.CreateFont( "FC_HUD_20", { font = "Aero Matics Display Regular", antialias = true, size = 20 } )
  32.         surface.CreateFont( "FC_HUD_30", { font = "Aero Matics Display Regular", antialias = true, size = 30 } )
  33.         surface.CreateFont( "FC_HUD_40", { font = "Aero Matics Display Regular", antialias = true, size = 40 } )
  34.  
  35.         FC_HUD.White = Material("vgui/white")
  36.         FC_HUD.SmallHP = Material("fc_ttthud/fc_ttthud_health_small.png")
  37.         FC_HUD.BigHP = Material("fc_ttthud/fc_ttthud_health.png")
  38.         FC_HUD.SmallAR = Material("fc_ttthud/fc_ttthud_armor_small.png")
  39.         FC_HUD.BigAR = Material("fc_ttthud/fc_ttthud_armor.png")
  40.        
  41.         FC_HUD.LastHP = nil
  42.         FC_HUD.HPFallout = {}
  43.        
  44.         -- speeds
  45.         local insert = table.insert
  46.  
  47.         -- clamp func, to prevent going outside of the square
  48.         local function clamp(v) if (v > 1) then return 1 else return v end end
  49.  
  50.         local function NiceUV(x, y, w, h, perc, flipped)
  51.            
  52.             if flipped then
  53.            
  54.                 if (prec == 0) then return {} end
  55.  
  56.                 local tbl = {} -- our pizza
  57.                 insert(tbl, {x = x, y = y, u = 0.5, v = 0.5}) -- add center point in the middle to make a pizza shape
  58.                
  59.                 -- v = up/down
  60.                 -- u = left/right
  61.                
  62.                 -- top right, first we move from the middle to the right
  63.                 if (perc >= 315) then
  64.                     insert(tbl, {x = x + w - clamp((perc - 315) / 45) * w, y = y - h, u = 1 - clamp((perc - 315) / 45) / 2, v = 0})
  65.                 end
  66.                
  67.                 -- down right, then from right corner to bottom, it's easier in 90's
  68.                 if (perc >= 225) then
  69.                     insert(tbl, {x = x + w, y = y + h - clamp((perc - 225) / 90) * h * 2, u = 1, v = 1 - clamp((perc - 225) / 90)})
  70.                 end
  71.                
  72.                 -- down left
  73.                 if (perc >= 135) then
  74.                     insert(tbl, {x = x - w + clamp((perc - 135) / 90) * h * 2, y = y + h, u = clamp((perc - 135) / 90), v = 1})
  75.                 end
  76.                
  77.                 -- top left, and from bottom to up!
  78.                 if (perc >= 45) then
  79.                     insert(tbl, {x = x - w, y = y - h + clamp((perc - 45) / 90) * h * 2, u = 0, v = clamp((perc - 45) / 90)})
  80.                 end
  81.                
  82.                 -- top center, now go back to close our pizza up. We dont need to do an if here, as this is the last peice of this godly meal.
  83.                 insert(tbl, {x = x - clamp(perc / 45) * w, y = y - h, u = 0.5 - clamp(perc / 45) / 2, v = 0})
  84.                
  85.                 insert(tbl, {x = x, y = y - h, u = 0.5, v = 0}) -- add our startpoint for the pizza
  86.                
  87.                 -- aparently, we got a full pizza! lets return this lovly meal.
  88.                 return tbl
  89.            
  90.             else
  91.  
  92.                 local tbl = {} -- our pizza
  93.                 insert(tbl, {x = x, y = y, u = 0.5, v = 0.5}) -- add center point in the middle to make a pizza shape
  94.                 insert(tbl, {x = x, y = y - h, u = 0.5, v = 0}) -- add our startpoint for the pizza
  95.                
  96.                 -- v = up/down
  97.                 -- u = left/right
  98.                
  99.                  -- top right, first we move from the middle to the right
  100.                 if (perc > 45) then insert(tbl, {x = x + w, y = y - h, u = 1, v = 0})
  101.                 else                insert(tbl, {x = x + perc / 45 * w, y = y - h, u = 0.5 + clamp(perc / 45) / 2, v = 0}) return tbl
  102.                 end
  103.                
  104.                 -- down right, then from right corner to bottom, it's easier in 90's
  105.                 perc = perc - 45 -- remove the perc, this makes math easier later on
  106.                 if (perc > 90) then
  107.                     insert(tbl, {x = x + w, y = y + h, u = 1, v = 1})
  108.                 else
  109.                     insert(tbl, {x = x + w, y = y - h + perc / 90 * h * 2, u = 1, v = clamp(perc / 90)}) return tbl
  110.                 end
  111.                
  112.                 -- down left, then from right to left
  113.                 perc = perc - 90
  114.                 if (perc > 90) then
  115.                     insert(tbl, {x = x - w, y = y + h, u = 0, v = 1})
  116.                 else
  117.                     insert(tbl, {x = x + w - perc / 90 * h * 2, y = y + h, u = 1 - clamp(perc / 90), v = 1}) return tbl
  118.                 end
  119.                
  120.                 -- top left, and from bottom to up!
  121.                 perc = perc - 90
  122.                 if (perc > 90) then
  123.                     insert(tbl, {x = x - w, y = y - h, u = 0, v = 0})
  124.                 else
  125.                     insert(tbl, {x = x - w, y = y + h - perc / 90 * h * 2, u = 0, v = 1 - clamp(perc / 90)}) return tbl
  126.                 end
  127.                
  128.                 -- top center, now go back to close our pizza up. We dont need to do an if here, as this is the last peice of this godly meal.
  129.                 perc = perc - 90
  130.                 insert(tbl, {x = x - w + perc / 45 * w, y = y - h, u = clamp(perc / 45) / 2, v = 0})
  131.                
  132.                 -- aparently, we got a full pizza! lets return this lovly meal.
  133.                 return tbl
  134.             end
  135.         end
  136.  
  137.         function CreateBorderedCircle(x, y, size, border, perc, addrot, parts)
  138.  
  139.             local sin = math.sin
  140.             local cos = math.cos
  141.             local rad = math.rad
  142.  
  143.             local parts = parts or 100
  144.  
  145.             local tbl = {}
  146.             local onerad = rad(360) / parts
  147.             local fixpos = rad(90)
  148.             local ret = false
  149.             local ending = perc * 3.6 * (parts / 360)
  150.             local innersize = size - border
  151.             local i = 0
  152.            
  153.             if (addrot != nil) then
  154.                 fixpos = fixpos + rad(addrot)
  155.             end
  156.            
  157.             while(true) do
  158.                 if (not ret) then
  159.                     -- outside
  160.                     table.insert(tbl, {
  161.                         x = x - cos(i * onerad - fixpos) * innersize,
  162.                         y = y + sin(i * onerad - fixpos) * innersize
  163.                     })
  164.                
  165.                     i = i + 1
  166.                    
  167.                     if (i > ending) then
  168.                         ret = true
  169.                         i = i - 1
  170.                     end
  171.                 else
  172.                     -- inside
  173.                     table.insert(tbl, {
  174.                         x = x - cos(i * onerad - fixpos) * size,
  175.                         y = y + sin(i * onerad - fixpos) * size
  176.                     })
  177.                    
  178.                     i = i - 1
  179.                    
  180.                     if (i < 0) then
  181.                         table.insert(tbl, {
  182.                             x = x + cos(fixpos) * size,
  183.                             y = y + sin(fixpos) * size
  184.                         })
  185.                        
  186.                         break
  187.                     end
  188.                 end
  189.             end
  190.            
  191.             return tbl
  192.         end
  193.  
  194.         function DrawCorrectFuckingPoly(tbl, fade)
  195.             local len = #tbl
  196.  
  197.             for i = 1, #tbl do
  198.                
  199.                 if fade and (i < 5 or i >= (len-5)) then
  200.                     local col = i / 5
  201.                    
  202.                     if i > len/2 then
  203.                         col = (len-i-1) / 5
  204.                     end
  205.                    
  206.                     surface.SetDrawColor( 175 * col, 225 * col, 100 * col, 200 * col )
  207.                 elseif fade then
  208.                     surface.SetDrawColor( 175, 225, 100, 200 )
  209.                 end
  210.                
  211.                 surface.DrawPoly({tbl[i], tbl[len - (i - 1)], tbl[len - i]})
  212.                 surface.DrawPoly({tbl[i], tbl[i + 1], tbl[len - i]})
  213.             end
  214.         end
  215.  
  216.         local roundstate_string = {
  217.            [ROUND_WAIT]   = "round_wait",
  218.            [ROUND_PREP]   = "round_prep",
  219.            [ROUND_ACTIVE] = "round_active",
  220.            [ROUND_POST]   = "round_post"
  221.         }
  222.  
  223.         local role_string = {
  224.            ["innocent"]   = Color(170,225,100,200),
  225.            ["traitor"]   = Color(205,60,40,200),
  226.            ["detective"] = Color(115,180,200,200),
  227.            ["round"]   = Color(200,200,200,200)
  228.         }
  229.  
  230.         local role_string_2 = {
  231.            ["innocent"]   = Color(150,205,80,200),
  232.            ["traitor"]   = Color(180,40,20,200),
  233.            ["detective"] = Color(95,160,180,200),
  234.            ["round"]   = Color(180,180,180,200)
  235.         }
  236.  
  237.         local function GetAmmo()
  238.             local ply = LocalPlayer()
  239.             local weap = ply:GetActiveWeapon()
  240.             if !IsValid(weap) or not ply:Alive() then return -1 end
  241.  
  242.             local ammo_inv = weap:Ammo1() or 0
  243.             local ammo_clip = weap:Clip1() or 0
  244.             local ammo_max = weap.Primary.ClipSize or 0
  245.             local ammo_invmax = weap.Primary.ClipMax or 0
  246.            
  247.             return ammo_clip, ammo_max, ammo_inv, ammo_invmax
  248.         end
  249.  
  250.         local GetPTranslation = LANG.GetParamTranslation
  251.         local GetRaw = LANG.GetRawTranslation
  252.  
  253.         local key_params = {usekey = Key("+use", "USE"), walkkey = Key("+walk", "WALK")}
  254.  
  255.         local ClassHint = {
  256.            prop_ragdoll = {
  257.               name= "corpse",
  258.               hint= "corpse_hint",
  259.  
  260.               fmt = function(ent, txt) return GetPTranslation(txt, key_params) end
  261.            }
  262.         };
  263.  
  264.         ---- "T" indicator above traitors
  265.  
  266.         local indicator_mat = Material("VGUI/ttt/sprite_traitor")
  267.         local indicator_col = Color(255, 255, 255, 130)
  268.  
  269.         local client, plys, ply, pos, dir, tgt
  270.         local GetPlayers = player.GetAll
  271.  
  272.         local propspec_outline = Material("models/props_combine/portalball001_sheet")
  273.  
  274.  
  275.         local function DrawPropSpecLabels(client)
  276.            if (not client:IsSpec()) and (GetRoundState() != ROUND_POST) then return end
  277.  
  278.            surface.SetFont("TabLarge")
  279.  
  280.            local tgt = nil
  281.            local scrpos = nil
  282.            local text = nil
  283.            local w = 0
  284.            for _, ply in pairs(player.GetAll()) do
  285.               if ply:IsSpec() then
  286.                  surface.SetTextColor(220,200,0,120)
  287.  
  288.                  tgt = ply:GetObserverTarget()
  289.  
  290.                  if IsValid(tgt) and tgt:GetNWEntity("spec_owner", nil) == ply then
  291.  
  292.                     scrpos = tgt:GetPos():ToScreen()
  293.                  else
  294.                     scrpos = nil
  295.                  end
  296.               else
  297.                  local _, healthcolor = util.HealthToString(ply:Health())
  298.                  surface.SetTextColor(clr(healthcolor))
  299.  
  300.                  scrpos = ply:EyePos()
  301.                  scrpos.z = scrpos.z + 20
  302.  
  303.                  scrpos = scrpos:ToScreen()
  304.               end
  305.  
  306.               if scrpos and (not IsOffScreen(scrpos)) then
  307.                  text = ply:Nick()
  308.                  w, _ = surface.GetTextSize(text)
  309.  
  310.                  surface.SetTextPos(scrpos.x - w / 2, scrpos.y)
  311.                  surface.DrawText(text)
  312.               end
  313.            end
  314.         end
  315.  
  316.  
  317.         ---- Crosshair affairs
  318.  
  319.         surface.CreateFont("TargetIDSmall2", {font = "TargetID",
  320.                                               size = 16,
  321.                                               weight = 1000})
  322.  
  323.         local minimalist = CreateConVar("ttt_minimal_targetid", "0", FCVAR_ARCHIVE)
  324.  
  325.         local magnifier_mat = Material("icon16/magnifier.png")
  326.         local ring_tex = surface.GetTextureID("effects/select_ring")
  327.  
  328.         local rag_color = Color(200,200,200,255)
  329.  
  330.         local GetLang = LANG.GetUnsafeLanguageTable
  331.        
  332.         if FC_HUD.DefaultTargetInfo == false then
  333.        
  334.             GAMEMODE.HUDDrawTargetID = function()
  335.                local client = LocalPlayer()
  336.  
  337.                local L = GetLang()
  338.  
  339.                DrawPropSpecLabels(client)
  340.  
  341.                local trace = client:GetEyeTrace(MASK_SHOT)
  342.                local ent = trace.Entity
  343.                if (not IsValid(ent)) or ent.NoTarget then return end
  344.  
  345.                -- some bools for caching what kind of ent we are looking at
  346.                local target_traitor = false
  347.                local target_detective = false
  348.                local target_corpse = false
  349.  
  350.                local text = nil
  351.                local color = COLOR_WHITE
  352.  
  353.                -- if a vehicle, we identify the driver instead
  354.                if IsValid(ent:GetNWEntity("ttt_driver", nil)) then
  355.                   ent = ent:GetNWEntity("ttt_driver", nil)
  356.  
  357.                   if ent == client then return end
  358.                end
  359.  
  360.                local cls = ent:GetClass()
  361.                local minimal = minimalist:GetBool()
  362.                local hint = (not minimal) and (ent.TargetIDHint or ClassHint[cls])
  363.  
  364.                if ent:IsPlayer() then
  365.                   if ent:GetNWBool("disguised", false) then
  366.                      client.last_id = nil
  367.  
  368.                      if client:IsTraitor() or client:IsSpec() then
  369.                         text = ent:Nick() .. L.target_disg
  370.                      else
  371.                         -- Do not show anything
  372.                         return
  373.                      end
  374.  
  375.                      color = COLOR_RED
  376.                   else
  377.                      text = ent:Nick()
  378.                      client.last_id = ent
  379.                   end
  380.  
  381.                   -- in minimalist targetID, colour nick with health level
  382.                   if minimal then
  383.                      _, color = util.HealthToString(ent:Health())
  384.                   end
  385.  
  386.                   if client:IsTraitor() and GAMEMODE.round_state == ROUND_ACTIVE then
  387.                      target_traitor = ent:IsTraitor()
  388.                   end
  389.  
  390.                   target_detective = ent:IsDetective()
  391.  
  392.                elseif cls == "prop_ragdoll" then
  393.                   -- only show this if the ragdoll has a nick, else it could be a mattress
  394.                   if CORPSE.GetPlayerNick(ent, false) == false then return end
  395.  
  396.                   target_corpse = true
  397.  
  398.                   if CORPSE.GetFound(ent, false) or not DetectiveMode() then
  399.                      text = CORPSE.GetPlayerNick(ent, "A Terrorist")
  400.                   else
  401.                      text  = L.target_unid
  402.                      color = COLOR_YELLOW
  403.                   end
  404.                elseif not hint then
  405.                   -- Not something to ID and not something to hint about
  406.                   return
  407.                end
  408.  
  409.                local x_orig = ScrW() / 2.0
  410.                local x = x_orig
  411.                local y = ScrH() / 2.0
  412.  
  413.                local w, h = 0,0 -- text width/height, reused several times
  414.  
  415.                if target_traitor or target_detective then
  416.                   surface.SetTexture(ring_tex)
  417.  
  418.                   if target_traitor then
  419.                      surface.SetDrawColor(255, 0, 0, 200)
  420.                   else
  421.                      surface.SetDrawColor(0, 0, 255, 220)
  422.                   end
  423.                   surface.DrawTexturedRect(x-32, y-32, 64, 64)
  424.                end
  425.  
  426.                y = y + 30
  427.                local font = "FC_HUD_20"
  428.                surface.SetFont( font )
  429.  
  430.                -- Draw main title, ie. nickname
  431.                if text then
  432.                   w1, h1 = surface.GetTextSize( string.upper(text) )
  433.                   w2, h2 = surface.GetTextSize( string.upper(text) )
  434.  
  435.                   x = x - w1 / 2
  436.                    
  437.                     local width = w1 + 32
  438.                    
  439.                     surface.SetDrawColor( 0, 0, 0, 200 )
  440.                     surface.SetMaterial( FC_HUD.White )
  441.                    
  442.                     local tab = CreateBorderedCircle((ScrW()-width)/2 + 14, ScrH()/2 + 30 + 14, 10, 10, 100, 0, 20)
  443.                     DrawCorrectFuckingPoly(tab)
  444.                    
  445.                     if ent:IsPlayer() then
  446.                         if LocalPlayer():IsTraitor() and ent:IsTraitor() then
  447.                             surface.SetDrawColor( role_string["traitor"] )
  448.                         elseif ent:IsDetective() then
  449.                             surface.SetDrawColor( role_string["detective"] )
  450.                         else
  451.                             surface.SetDrawColor( role_string["innocent"] )
  452.                         end
  453.                     else
  454.                         surface.SetDrawColor( role_string["round"] )
  455.                     end
  456.                    
  457.                     local tab = CreateBorderedCircle((ScrW()-width)/2 + 14, ScrH()/2 + 30 + 14, 8, 8, 100, 0, 20)
  458.                     DrawCorrectFuckingPoly(tab)
  459.                    
  460.                    
  461.                     draw.RoundedBox(2, (ScrW()-width)/2 + 26, ScrH()/2 + 34, w1 + 4, h1, Color(0,0,0,200))
  462.                   draw.SimpleText( string.upper(text), "FC_HUD_20", (ScrW()-width)/2 + 28, ScrH()/2 + 44, color, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
  463.  
  464.                   -- for ragdolls searched by detectives, add icon
  465.                   /*if ent.search_result and client:IsDetective() then
  466.                      -- if I am detective and I know a search result for this corpse, then I
  467.                      -- have searched it or another detective has
  468.                      surface.SetMaterial(magnifier_mat)
  469.                      surface.SetDrawColor(200, 200, 255, 255)
  470.                      surface.DrawTexturedRect(x + w + 5, y, 16, 16)
  471.                   end*/
  472.  
  473.                   y = y + h + 4
  474.                end
  475.  
  476.                -- Minimalist target ID only draws a health-coloured nickname, no hints, no
  477.                -- karma, no tag
  478.                if minimal then return end
  479.  
  480.                
  481.                -- Draw subtitle: health or type
  482.                local clr = rag_color
  483.                if ent:IsPlayer() then
  484.                   text, clr = util.HealthToString(ent:Health())
  485.  
  486.                   -- HealthToString returns a string id, need to look it up
  487.                   text = L[text]
  488.                elseif hint then
  489.                   text = GetRaw(hint.name) or hint.name
  490.                else
  491.                   return
  492.                end
  493.                font = "TargetIDSmall2"
  494.  
  495.                surface.SetFont( font )
  496.                w, h = surface.GetTextSize( text )
  497.                x = x_orig - w / 2
  498.  
  499.                //draw.SimpleText( text, font, x+1, y+1, COLOR_BLACK )
  500.                //draw.SimpleText( text, font, x, y, clr )
  501.                
  502.                font = "TargetIDSmall"
  503.                surface.SetFont( font )
  504.  
  505.                 local h_karma, h_hint, h_karma_color, h_hint_color = "", "", Color(255,255,255,200), Color(255,255,255,200)
  506.                
  507.                -- Draw second subtitle: karma
  508.                if ent:IsPlayer() and KARMA.IsEnabled() then
  509.                   text, clr = util.KarmaToString(ent:GetBaseKarma())
  510.  
  511.                   text = L[text]
  512.  
  513.                   w, h = surface.GetTextSize( text )
  514.                   y = y + h + 5
  515.                   x = x_orig - w / 2
  516.  
  517.                   h_karma = text
  518.                   h_karma_color = clr
  519.                end
  520.  
  521.                -- Draw key hint
  522.                if hint and hint.hint then
  523.                   if not hint.fmt then
  524.                      text = GetRaw(hint.hint) or hint.hint
  525.                   else
  526.                      text = hint.fmt(ent, hint.hint)
  527.                   end
  528.  
  529.                   w, h = surface.GetTextSize(text)
  530.                   x = x_orig - w / 2
  531.                   y = y + h + 5
  532.                   h_hint = text
  533.                 elseif ent:IsPlayer() and ent.sb_tag then
  534.                     h_hint = LANG.GetTranslation(ent.sb_tag.txt) or ""
  535.                     h_hint_color = ent.sb_tag.color
  536.                 end
  537.                
  538.                surface.SetFont( "FC_HUD_20" )
  539.                
  540.                 w1, h1 = surface.GetTextSize( string.upper(h_karma) )
  541.                 w2, h2 = surface.GetTextSize( string.upper(h_hint) )
  542.                
  543.                 local addw, addh = 0, 0
  544.                
  545.                 if ent:IsPlayer() and ent:Alive() then
  546.                     addw = 48
  547.                     addh = 24
  548.                
  549.                     if FC_HUD.ShowOnlyHP then w1, w2 = -4, -4 end
  550.                 end
  551.                
  552.                 local width = math.max(w1, w2) + 4 + addw
  553.                
  554.                 draw.RoundedBox(2, (ScrW()-width)/2, ScrH()/2 + 58, width, 24 + addh, Color(0,0,0,200))
  555.                
  556.                 if ent:IsPlayer() and ent:Alive() then
  557.                    
  558.                     local y1,y2 = ScrH()/2 + 70, ScrH()/2 + 94
  559.                    
  560.                     if h_karma == "" then y2 = ScrH()/2 + 82 end
  561.                     if h_hint == "" then y1 = ScrH()/2 + 82 end
  562.                    
  563.                     if !FC_HUD.ShowOnlyHP then
  564.                        
  565.                         draw.SimpleText( string.upper(h_karma), "FC_HUD_20", (ScrW()-width)/2 + 48, y1, h_karma_color, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
  566.                         draw.SimpleText( string.upper(h_hint), "FC_HUD_20", (ScrW()-width)/2 + 48, y2, h_hint_color, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
  567.                    
  568.                     end
  569.                    
  570.                     surface.SetDrawColor( 255, 0, 0, 200 )
  571.                     surface.SetMaterial( FC_HUD.White )
  572.                    
  573.                     local parts = NiceUV((ScrW()-width)/2 + 24, ScrH()/2 + 82, 32, 32, math.Clamp(ent:Health(), 0, 100) / 100 * 360, true )
  574.  
  575.                     surface.SetMaterial( FC_HUD.SmallHP )
  576.                     if FC_HUD.TeamBasedHP and (target_traitor or target_detective) then
  577.                         if target_traitor then
  578.                             surface.SetDrawColor( role_string["traitor"] )
  579.                         else
  580.                             surface.SetDrawColor( role_string["detective"] )
  581.                         end
  582.                     else
  583.                         surface.SetDrawColor( role_string["innocent"] )
  584.                     end
  585.                     surface.SetDrawColor(160, 205, 95, 200)
  586.                     surface.DrawPoly(parts)
  587.                    
  588.                     if ent:Armor() > 0 then
  589.                        
  590.                         local parts = NiceUV((ScrW()-width)/2 + 24, ScrH()/2 + 82, 32, 32, math.Clamp(ent:Armor(), 0, 100) / 100 * 360, true )
  591.  
  592.                         surface.SetMaterial( FC_HUD.SmallAR )
  593.                         surface.SetDrawColor(255,255,255,200)
  594.                         surface.DrawPoly(parts)
  595.                        
  596.                     end
  597.                
  598.                 else
  599.                     draw.SimpleText( string.upper(h_hint), "FC_HUD_20", ScrW()/2, ScrH()/2 + 70, h_hint_color, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
  600.                 end
  601.  
  602.                text = nil
  603.  
  604.                
  605.             end
  606.            
  607.         end
  608.        
  609.         local delay = 0.075
  610.         local showtime = 3
  611.  
  612.         local margin = 10
  613.         local width = 350
  614.         local height = 22
  615.  
  616.         local barcorner = surface.GetTextureID( "gui/corner8" )
  617.  
  618.         local col_active = {
  619.            tip = {
  620.               [ROLE_INNOCENT]  = role_string["innocent"],
  621.               [ROLE_TRAITOR]   = role_string["traitor"],
  622.               [ROLE_DETECTIVE] = role_string["detective"]
  623.            },
  624.  
  625.            bg = Color(0, 0, 0, 250),
  626.  
  627.            text_empty = Color(200, 20, 20, 255),
  628.            text_empty_2 = Color(200, 200, 20, 255),
  629.            text = Color(255, 255, 255, 255),
  630.  
  631.            shadow = 255
  632.         };
  633.  
  634.         local col_dark = {
  635.            tip = {
  636.               [ROLE_INNOCENT]  = role_string_2["innocent"],
  637.               [ROLE_TRAITOR]   = role_string_2["traitor"],
  638.               [ROLE_DETECTIVE] = role_string_2["detective"]
  639.            },
  640.  
  641.            bg = Color(0, 0, 0, 200),
  642.  
  643.            text_empty = Color(200, 20, 20, 100),
  644.            text_empty_2 = Color(200, 200, 20, 100),
  645.            text = Color(255, 255, 255, 100),
  646.  
  647.            shadow = 100
  648.         };
  649.  
  650.         -- Draw a bar in the style of the the weapon pickup ones
  651.         local round = math.Round
  652.         function WSWITCH:DrawBarBg(x, y, w, h, col)
  653.            draw.RoundedBoxEx( 2, x + 20, y - 15, w - 20, 30, col.bg, false, true, false, true )
  654.            draw.RoundedBoxEx( 2, x, y - 15, 20, 30, Color(255,255,255,200), true, false, true, false )
  655.         end
  656.  
  657.         local TryTranslation = LANG.TryTranslation
  658.         function WSWITCH:DrawWeapon(x, y, c, wep)
  659.            if not IsValid(wep) then return false end
  660.  
  661.            local name = TryTranslation(wep:GetPrintName() or wep.PrintName or "...")
  662.            local cl1, am1 = wep:Clip1(), wep:Ammo1()
  663.            local ammo = false
  664.  
  665.            -- Clip1 will be -1 if a melee weapon
  666.            -- Ammo1 will be false if weapon has no owner (was just dropped)
  667.            if cl1 != -1 and am1 != false then
  668.               ammo = Format("%i + %02i", cl1, am1)
  669.            end
  670.  
  671.            -- Slot
  672.            local spec = {text=wep.Slot+1, font="FC_HUD_30", pos={x+4, y}, yalign=TEXT_ALIGN_CENTER, yalign=TEXT_ALIGN_CENTER, color=c.text}
  673.  
  674.             draw.SimpleText( wep.Slot + 1, "FC_HUD_30", x+10, y, Color(0,0,0,200), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  675.            
  676.            -- Name
  677.            spec.text  = string.upper(name)
  678.            spec.pos[1] = x + 10 + height
  679.            draw.Text(spec)
  680.  
  681.             local clip, max, inv, invmax = wep:Clip1() or 0, wep.Primary.ClipSize or 0, wep:Ammo1() or 0, wep.ClipMax or 0
  682.            
  683.             if clip != -1 then
  684.                 local col1, col2 = c.text, c.text
  685.                
  686.                 if clip == 0 then
  687.                     col1 = c.text_empty
  688.                 elseif clip/max <= 0.25 then
  689.                     col1 = c.text_empty_2
  690.                 end
  691.                
  692.                 if inv == 0 then
  693.                     col2 = c.text_empty
  694.                 elseif inv/invmax <= 0.25 then
  695.                     col2 = c.text_empty_2
  696.                 end
  697.                
  698.                 if clip < 10 then
  699.                     clip = "0"..clip
  700.                 end
  701.                
  702.                 if inv < 10 then
  703.                     inv = "0"..inv
  704.                 end
  705.                
  706.                 local w, h = draw.SimpleText(inv, "FC_HUD_30", ScrW() - margin*3, y, col2, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER)
  707.                 local w2, h2 = draw.SimpleText("+", "FC_HUD_30", ScrW() - margin*3 - w - 4, y, c.text, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER)
  708.                 draw.SimpleText(clip, "FC_HUD_30", ScrW() - margin*3 - w - w2 - 8, y, col1, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER)
  709.                
  710.            end
  711.  
  712.            return true
  713.         end
  714.  
  715.         function WSWITCH:Draw(client)
  716.            if not self.Show then return end
  717.  
  718.            local weps = self.WeaponCache
  719.  
  720.            local x = ScrW() - width - margin*2
  721.            local y = ScrH() - (#weps * (height + margin))
  722.  
  723.            local col = col_dark
  724.            for k, wep in pairs(weps) do
  725.               if self.Selected == k then
  726.                  col = col_active
  727.               else
  728.                  col = col_dark
  729.               end
  730.  
  731.               self:DrawBarBg(x, y, width, height, col)
  732.               if not self:DrawWeapon(x, y, col, wep) then
  733.                  
  734.                  self:UpdateWeaponCache()
  735.                  return
  736.               end
  737.  
  738.               y = y + height + margin
  739.            end
  740.         end
  741.        
  742.         function GAMEMODE:HUDDrawPickupHistory()
  743.             if (GAMEMODE.PickupHistory == nil) then return end
  744.  
  745.             local x, y = ScrW() - GAMEMODE.PickupHistoryWide - 20, GAMEMODE.PickupHistoryTop
  746.             local tall = 0
  747.             local wide = 0
  748.  
  749.             for k, v in pairs( GAMEMODE.PickupHistory ) do
  750.  
  751.                 if v.time < CurTime() then
  752.  
  753.                     if (v.y == nil) then v.y = y end
  754.  
  755.                     v.x = x
  756.                     v.y = (v.y*5 + y) / 6
  757.  
  758.                     local delta = (v.time + v.holdtime) - CurTime()
  759.                     delta = delta / v.holdtime
  760.                     delta = math.Clamp( delta, 0, 1 )
  761.                    
  762.                     local nam = v.name
  763.                    
  764.                     if v.amount then
  765.                         nam = v.name.." ["..v.amount.."]"
  766.                     end
  767.                    
  768.                     nam = string.upper(nam)
  769.                    
  770.                     surface.SetFont("FC_HUD_20")
  771.                     local fw, fh = surface.GetTextSize(v.name)
  772.                     local fw2 = 0
  773.                    
  774.                     if v.amount then
  775.                         fw2 = surface.GetTextSize(" ["..v.amount.."]")
  776.                         fw = fw + fw2
  777.                     end
  778.                    
  779.                     local clampw = 0
  780.                     local al = 0
  781.                    
  782.                     if delta >= 0.85 then
  783.                         clampw = 0
  784.                     elseif delta < 0.85 and delta > 0.8 then
  785.                         clampw = fw * ( 1 - ((delta - 0.8)*20) )
  786.                     elseif delta > 0.2 then
  787.                         clampw = fw * 1
  788.                     elseif delta <= 0.2 and delta > 0.15 then
  789.                         clampw = fw * ((delta - 0.15)*20)
  790.                     elseif delta <= 0.1 then
  791.                         clampw = 0
  792.                     end
  793.                    
  794.                     if delta > 0.9 then
  795.                         al = 1 - ((delta - 0.9) * 10)
  796.                     elseif delta < 0.1 then
  797.                         al = (delta) * 10
  798.                     else
  799.                         al = 1
  800.                     end
  801.                    
  802.                     local boxw = math.max( clampw, 0 )
  803.                    
  804.                     draw.RoundedBox( 0, ScrW() - 40 - boxw, v.y - 18, boxw + 20, 24, Color(0,0,0,200 * al) )
  805.                    
  806.                     draw.RoundedBox( 0, ScrW() - 40 - boxw, v.y - 18, 6, 2, Color(255,255,255,200 * al) )
  807.                     draw.RoundedBox( 0, ScrW() - 40 - boxw, v.y - 16, 2, 4, Color(255,255,255,200 * al) )
  808.                    
  809.                     draw.RoundedBox( 0, ScrW() - 40 - boxw, v.y + 4, 6, 2, Color(255,255,255,200 * al) )
  810.                     draw.RoundedBox( 0, ScrW() - 40 - boxw, v.y, 2, 4, Color(255,255,255,200 * al) )
  811.                    
  812.                     draw.RoundedBox( 0, ScrW() - 26, v.y - 18, 6, 2, Color(255,255,255,200 * al) )
  813.                     draw.RoundedBox( 0, ScrW() - 22, v.y - 16, 2, 4, Color(255,255,255,200 * al) )
  814.                    
  815.                     draw.RoundedBox( 0, ScrW() - 26, v.y + 4, 6, 2, Color(255,255,255,200 * al) )
  816.                     draw.RoundedBox( 0, ScrW() - 22, v.y, 2, 4, Color(255,255,255,200 * al) )
  817.                    
  818.                     render.SetScissorRect( ScrW() - 40 - boxw + 10, v.y - 18, ScrW() - 30, v.y + 6, true )
  819.                         draw.SimpleText( v.name, "FC_HUD_20", ScrW() - 30 - fw2, v.y - (v.height/2), Color( 255, 255, 255, 200 * al ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER )
  820.                         if v.amount then
  821.                             draw.SimpleText( " ["..v.amount.."]", "FC_HUD_20", ScrW() - 30, v.y - (v.height/2), Color( 255, 255, 255, 200 * al ), TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER )
  822.                         end
  823.                     render.SetScissorRect( ScrW() - 40 - boxw, v.y - 18, boxw, 24, false )
  824.  
  825.                     y = y + (v.height + 16)
  826.                     tall = tall + v.height + 18
  827.                     wide = math.Max( wide, v.width + v.height + 24 )
  828.  
  829.                     if delta == 0 then GAMEMODE.PickupHistory[k] = nil end
  830.                 end
  831.             end
  832.  
  833.             GAMEMODE.PickupHistoryTop = (GAMEMODE.PickupHistoryTop * 5 + ( ScrH() * 0.75 - tall ) / 2 ) / 6
  834.             GAMEMODE.PickupHistoryWide = (GAMEMODE.PickupHistoryWide * 5 + wide) / 6
  835.         end
  836.  
  837.         GAMEMODE.HUDPaint = function()
  838.            local client = LocalPlayer()
  839.  
  840.            GAMEMODE:HUDDrawTargetID()
  841.  
  842.            MSTACK:Draw(client)
  843.  
  844.            if (not client:Alive()) or client:Team() == TEAM_SPEC then
  845.               return
  846.            end
  847.  
  848.  
  849.            RADAR:Draw(client)
  850.            TBHUD:Draw(client)
  851.            WSWITCH:Draw(client)
  852.  
  853.            VOICE.Draw(client)
  854.            DISGUISE.Draw(client)
  855.  
  856.            GAMEMODE:HUDDrawPickupHistory()
  857.         end
  858.  
  859.         hook.Add("HUDPaint", "FC_HUD", function()
  860.            
  861.             local y = ScrH()
  862.             local L = LANG.GetUnsafeLanguageTable()
  863.            
  864.                        
  865.             local is_haste = HasteMode() and GetRoundState() == ROUND_ACTIVE
  866.             local is_traitor = LocalPlayer():IsTraitor() or !LocalPlayer():Alive()
  867.  
  868.             local endtime = GetGlobalFloat("ttt_round_end", 0) - CurTime()
  869.            
  870.             local overtime = false
  871.             local text
  872.             local color = Color(255,255,255,200)
  873.  
  874.             -- Time displays differently depending on whether haste mode is on,
  875.             -- whether the player is traitor or not, and whether it is overtime.
  876.             if is_haste then
  877.                 local hastetime = GetGlobalFloat("ttt_haste_end", 0) - CurTime()
  878.                 if hastetime < 0 then
  879.                     if (not is_traitor) or (math.ceil(CurTime()) % 7 <= 2) then
  880.                         -- innocent or blinking "overtime"
  881.                         text = L.overtime
  882.                         overtime = true
  883.                     else
  884.                         -- traitor and not blinking "overtime" right now, so standard endtime display
  885.                         text  = string.ToMinutesSeconds(math.max(0, endtime))
  886.                         color = Color(255,0,0,200)
  887.                     end
  888.                 else
  889.                     -- still in starting period
  890.                     local t = hastetime
  891.                     if is_traitor and math.ceil(CurTime()) % 6 < 2 then
  892.                         t = endtime
  893.                         color = Color(255,0,0,200)
  894.                     end
  895.                     text = string.ToMinutesSeconds(math.max(0, t))
  896.                 end
  897.             else
  898.                 -- bog standard time when haste mode is off (or round not active)
  899.                 text = string.ToMinutesSeconds(math.max(0, endtime))
  900.             end
  901.        
  902.            
  903.             if LocalPlayer():Alive() and LocalPlayer():Team() != TEAM_SPECTATOR and GetRoundState() != ROUND_WAIT then
  904.            
  905.                 draw.RoundedBox(2, 20, y - 114, 94, 94, Color(0,0,0,200))
  906.                
  907.                 if FC_HUD.LastHP == nil then FC_HUD.LastHP = LocalPlayer():Health() end
  908.                
  909.                 if LocalPlayer():Health() != FC_HUD.LastHP then
  910.                    
  911.                     local tab = {}
  912.                     tab.time = CurTime() + 0.5
  913.                     tab.last = FC_HUD.LastHP
  914.                     tab.new = LocalPlayer():Health()
  915.                    
  916.                     table.insert(FC_HUD.HPFallout, tab)
  917.                    
  918.                     print("NEW", FC_HUD.LastHP, LocalPlayer():Health())
  919.                 end
  920.                
  921.                 for k, v in pairs(FC_HUD.HPFallout) do
  922.                    
  923.                     if CurTime() >= v.time then
  924.                         FC_HUD.HPFallout[k] = nil
  925.                         continue
  926.                     end
  927.                    
  928.                     local parts = NiceUV(67, y - 67, 64, 64, math.Clamp(v.last, 0, 100) / 100 * 360, true )
  929.                    
  930.                     local alpha = (v.time - CurTime()) * 510
  931.                    
  932.                     surface.SetMaterial( FC_HUD.BigHP )
  933.                     surface.SetDrawColor( 205, 0, 0, alpha )
  934.                     surface.DrawPoly(parts)
  935.                    
  936.                 end
  937.                
  938.                 FC_HUD.LastHP = LocalPlayer():Health()
  939.                
  940.                 surface.SetDrawColor( 255, 0, 0, 200 )
  941.                 surface.SetMaterial( FC_HUD.White )
  942.                
  943.                 local parts = NiceUV(67, y - 67, 64, 64, math.Clamp(LocalPlayer():Health(), 0, 100) / 100 * 360, true )
  944.  
  945.                 surface.SetMaterial( FC_HUD.BigHP )
  946.                
  947.                 if FC_HUD.TeamBasedHP then
  948.                     surface.SetDrawColor( role_string[string.lower(LocalPlayer():GetRoleString())] or role_string["innocent"])
  949.                 else
  950.                     if LocalPlayer():Health() >= 25 then
  951.                         surface.SetDrawColor(role_string["innocent"])
  952.                     else
  953.                         surface.SetDrawColor(role_string["traitor"])
  954.                     end            
  955.                 end
  956.                
  957.                 surface.DrawPoly(parts)
  958.                
  959.                 if LocalPlayer():HasEquipment(EQUIP_ARMOR) then
  960.                    
  961.                     local parts = NiceUV(67, y - 67, 64, 64, 360, true )
  962.  
  963.                     surface.SetMaterial( FC_HUD.BigAR )
  964.                     surface.SetDrawColor(255, 255, 255, 200)
  965.                     surface.DrawPoly(parts)
  966.                    
  967.                 end
  968.            
  969.                 draw.SimpleText(LocalPlayer():Health(), "FC_HUD_40", 67, y - 67, Color(255,255,255,200), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  970.                
  971.                 draw.RoundedBoxEx(2, 118, y - 114, 20, 30, Color(255,255,255,200), true, false, true, false)
  972.                 draw.RoundedBoxEx(2, 138, y - 114, 120, 30, Color(0,0,0,200), false, true, false, true)
  973.                
  974.                 surface.SetMaterial( FC_HUD.White )
  975.                 local tab = CreateBorderedCircle(128, y - 99, 8, 8, 85, 0, 10)
  976.                 surface.SetDrawColor( 0, 0, 0, 200 )
  977.                 surface.SetMaterial( FC_HUD.White )
  978.                 DrawCorrectFuckingPoly(tab)
  979.                
  980.                 draw.SimpleText(text, "FC_HUD_30", 198, y - 99, color, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  981.                
  982.                 local y2 = 0
  983.                
  984.                 //if LocalPlayer():IsActiveTraitor() or LocalPlayer():IsActiveDetective() then
  985.                     draw.RoundedBoxEx(2, 138, y - 82 + y2, 120, 30, Color(0,0,0,200), false, true, false, true)
  986.                     draw.RoundedBoxEx(2, 118, y - 82 + y2, 20, 30, Color(255,255,255,200), true, false, true, false)
  987.                     draw.SimpleText("$", "FC_HUD_20", 128, y - 67 + y2, Color(0,0,0,200), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  988.                    
  989.                     local cred = LocalPlayer():GetCredits()
  990.                    
  991.                     draw.SimpleText(cred.." CREDITS", "FC_HUD_30", 198, y - 67 + y2, Color(255,255,255,200), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  992.                     y2 = 32
  993.                 //end
  994.                 local clip, max, inv, invmax = GetAmmo()
  995.                
  996.                 if clip != -1 then
  997.                     draw.RoundedBoxEx(2, 138, y - 82 + y2, 120, 30, Color(0,0,0,200), false, true, false, true)
  998.                    
  999.                     local col1, col2 = Color(255,255,255,200), Color(255,255,255,200)
  1000.                    
  1001.                     if clip == 0 then
  1002.                         col1 = Color(200,20,20,200)
  1003.                     elseif clip/max <= 0.25 then
  1004.                         col1 = Color(200,200,20,200)
  1005.                     end
  1006.                    
  1007.                     if inv == 0 then
  1008.                         col2 = Color(200,20,20,200)
  1009.                     elseif inv/invmax <= 0.25 then
  1010.                         col2 = Color(200,200,20,200)
  1011.                     end
  1012.                    
  1013.                     if clip < 10 then
  1014.                         clip = "0"..clip
  1015.                     end
  1016.                    
  1017.                     if inv < 10 then
  1018.                         inv = "0"..inv
  1019.                     end
  1020.                    
  1021.                     draw.SimpleText("+", "FC_HUD_30", 198, y - 67 + y2, Color(255,255,255,200), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  1022.                     draw.SimpleText(clip, "FC_HUD_30", 198 - 8, y - 67 + y2, col1, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER)
  1023.                     draw.SimpleText(inv, "FC_HUD_30", 198 + 10, y - 67 + y2, col2, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1024.                    
  1025.                     draw.RoundedBoxEx(2, 118, y - 82 + y2, 20, 30, Color(255,255,255,200), true, false, true, false)
  1026.                    
  1027.                     surface.SetDrawColor( 0, 0, 0, 200 )
  1028.                     surface.SetMaterial( FC_HUD.White )
  1029.                     local tab = CreateBorderedCircle(128, y - 67 + y2, 8, 8, 100, 0, 10)
  1030.                     surface.SetMaterial( FC_HUD.White )
  1031.                     DrawCorrectFuckingPoly(tab)
  1032.                    
  1033.                     draw.RoundedBox(0, 126, y - 75 + y2, 4, 16, Color(255,255,255,200))
  1034.                     draw.RoundedBox(0, 120, y - 69 + y2, 16, 4, Color(255,255,255,200))
  1035.                 end
  1036.                
  1037.                 y = y - 130
  1038.            
  1039.             else
  1040.            
  1041.                 surface.SetFont("FC_HUD_20")
  1042.                
  1043.                 local text = ""
  1044.                 local punch = false
  1045.                 local w, h = surface.GetTextSize( text )
  1046.                 w = w + 16
  1047.                
  1048.                 local tgt = LocalPlayer():GetObserverTarget()
  1049.  
  1050.                 if IsValid(tgt) and tgt:IsPlayer() then
  1051.                    
  1052.                     text = string.upper(tgt:Nick())
  1053.                     w, h = surface.GetTextSize( text )
  1054.                     w = w + 16
  1055.                 elseif IsValid(tgt) and tgt:GetNWEntity("spec_owner", nil) == LocalPlayer() then
  1056.                     punch = true
  1057.                     text = string.upper((LANG.GetUnsafeLanguageTable().punch_title or "PUNCH-O-METER"))
  1058.                     w, h = surface.GetTextSize( text )
  1059.                     w = w + 16
  1060.                 else
  1061.                     text = string.upper(string.Interp(LANG.GetUnsafeLanguageTable().spec_help, { usekey = Key("+use", "USE") }))
  1062.                     w, h = surface.GetTextSize( text )
  1063.                     w = w + 16
  1064.                 end
  1065.                
  1066.                 draw.RoundedBox(0, ScrW()/2 - w/2, 20, w, 30, Color(0,0,0,200))
  1067.                
  1068.                 draw.RoundedBox(0, ScrW()/2 - w/2 + 2, 20, 6, 2, Color(255,255,255,200))
  1069.                 draw.RoundedBox(0, ScrW()/2 - w/2, 20, 2, 8, Color(255,255,255,200))
  1070.                
  1071.                 draw.RoundedBox(0, ScrW()/2 - w/2 + 2, 48, 6, 2, Color(255,255,255,200))
  1072.                 draw.RoundedBox(0, ScrW()/2 - w/2, 42, 2, 8, Color(255,255,255,200))
  1073.                
  1074.                 draw.RoundedBox(0, ScrW()/2 + w/2 - 8, 20, 6, 2, Color(255,255,255,200))
  1075.                 draw.RoundedBox(0, ScrW()/2 + w/2 - 2, 20, 2, 8, Color(255,255,255,200))
  1076.                
  1077.                 draw.RoundedBox(0, ScrW()/2 + w/2 - 8, 48, 6, 2, Color(255,255,255,200))
  1078.                 draw.RoundedBox(0, ScrW()/2 + w/2 - 2, 42, 2, 8, Color(255,255,255,200))
  1079.                
  1080.                 if punch then
  1081.                     punches = LocalPlayer():GetNWFloat("specpunches", 0)
  1082.                    
  1083.                     local w2 = (w-4) * punches
  1084.                    
  1085.                     render.SetScissorRect( ScrW()/2 - w/2, 20, ScrW()/2 - w/2 + w2, 50, true )
  1086.                         draw.RoundedBox( 0, ScrW()/2 - w/2 + 4, 24, w - 8, 22, Color(255,255,255,200) )
  1087.                         draw.SimpleText( text, "FC_HUD_20", ScrW()/2, 35, Color(0,0,0,200), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
  1088.                     render.SetScissorRect( ScrW()/2 - w/2, 20, 0, 50, false )
  1089.                    
  1090.                     render.SetScissorRect( ScrW()/2 - w/2 + w2, 20, ScrW()/2 + w/2 - 4, 50, true )
  1091.                         draw.SimpleText( text, "FC_HUD_20", ScrW()/2, 35, Color(255,255,255,200), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
  1092.                     render.SetScissorRect( ScrW()/2 - w/2, 20, 0, 50, false )
  1093.                    
  1094.                 else
  1095.                     draw.SimpleText( text, "FC_HUD_20", ScrW()/2, 35, Color(255,255,255,200), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
  1096.                 end
  1097.            
  1098.                 y = y - 30
  1099.            
  1100.             end
  1101.            
  1102.             local t = ""
  1103.             local col = role_string["round"]
  1104.            
  1105.             if GetRoundState() == ROUND_WAIT or LocalPlayer():Alive() == false or LocalPlayer():Team() == TEAM_SPECTATOR then
  1106.                
  1107.             else
  1108.                 text = ""
  1109.             end
  1110.            
  1111.             if GetRoundState() == ROUND_ACTIVE and LocalPlayer():Alive() and LocalPlayer():Team() != TEAM_SPECTATOR then
  1112.                 t = L[ LocalPlayer():GetRoleStringRaw() ]
  1113.                 col = role_string[ LocalPlayer():GetRoleStringRaw() ]
  1114.                 text = ""
  1115.             else
  1116.                 t = L[ roundstate_string[GetRoundState()] ]
  1117.             end
  1118.                
  1119.             surface.SetDrawColor( 0, 0, 0, 200 )
  1120.            
  1121.             local mul = 0
  1122.             local font = "FC_HUD_20"
  1123.            
  1124.             if FC_HUD.LargerStatus then
  1125.                 mul = 4
  1126.                 font = "FC_HUD_30"
  1127.             end
  1128.            
  1129.             surface.SetMaterial( FC_HUD.White )
  1130.             local tab = CreateBorderedCircle(30, y - mul, 10 + mul, 10 + mul, 100, 0, 20)
  1131.             surface.SetMaterial( FC_HUD.White )
  1132.             DrawCorrectFuckingPoly(tab)
  1133.            
  1134.             surface.SetDrawColor( col )
  1135.            
  1136.             surface.SetMaterial( FC_HUD.White )
  1137.             local tab = CreateBorderedCircle(30, y - mul, 8 + mul, 8 + mul, 100, 0, 20)
  1138.             surface.SetMaterial( FC_HUD.White )
  1139.             DrawCorrectFuckingPoly(tab)
  1140.            
  1141.             surface.SetFont(font)
  1142.             local w, h = surface.GetTextSize(string.upper(t))
  1143.             local w2, h2 = surface.GetTextSize(string.upper(text))
  1144.             local w3 = 0
  1145.            
  1146.             if text != "" then
  1147.                 w3 = surface.GetTextSize(" - ")
  1148.             end
  1149.            
  1150.             local BoxCol = Color(0,0,0,200)
  1151.            
  1152.             if FC_HUD.ColoredRoleBack and GetRoundState() == ROUND_ACTIVE and LocalPlayer():Alive() and LocalPlayer():Team() != TEAM_SPECTATOR then
  1153.                 if LocalPlayer():IsActiveTraitor() then
  1154.                     BoxCol = Color(150, 0, 0, 200)
  1155.                 elseif LocalPlayer():IsActiveDetective() then
  1156.                     BoxCol = Color(0, 0, 150, 200)
  1157.                 else
  1158.                     BoxCol = Color(0, 150, 0, 200)
  1159.                 end
  1160.             end
  1161.            
  1162.             local TextColor = Color(255,255,255,200)
  1163.            
  1164.             if FC_HUD.ColoredRoleText and GetRoundState() == ROUND_ACTIVE and LocalPlayer():Alive() and LocalPlayer():Team() != TEAM_SPECTATOR then
  1165.                 if LocalPlayer():IsActiveTraitor() then
  1166.                     TextColor = role_string["traitor"]
  1167.                 elseif LocalPlayer():IsActiveDetective() then
  1168.                     TextColor = role_string["detective"]
  1169.                 else
  1170.                     TextColor = role_string["innocent"]
  1171.                 end
  1172.             end
  1173.            
  1174.             draw.RoundedBox(2, 50 - 2, y-10 - mul * 2, w + 8 + w2 + w3, 20 + mul * 2, BoxCol)
  1175.             local xz, yz = draw.SimpleText(string.upper(t), font, 52, y - mul, TextColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1176.             if text != "" then
  1177.                 xz = draw.SimpleText(" - ", font, 52 + xz, y - mul, TextColor, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER) + xz
  1178.             end
  1179.             draw.SimpleText(string.upper(text), font, 52 + xz, y - mul, color, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER)
  1180.         end)
  1181.     end)
  1182. end
Advertisement
Add Comment
Please, Sign In to add comment