SCOREBOARD, better text function
This commit is contained in:
parent
32d7bee0ec
commit
79d9b040f3
|
@ -29,6 +29,9 @@ end
|
|||
|
||||
|
||||
function hCol( r, g, b, a )
|
||||
if IsColor(r) and g then
|
||||
return surface.SetDrawColor( ColorAlpha( r, g ) )
|
||||
end
|
||||
return surface.SetDrawColor( r, g, b, a )
|
||||
end
|
||||
|
||||
|
@ -100,6 +103,21 @@ function qt( text, font, x, y, col, xalign, yalign, col2 )
|
|||
draw.SimpleText( text, font, x, y, col, xalign, yalign )
|
||||
end
|
||||
|
||||
function hText( text, font, x, y, col, xalign, yalign )
|
||||
local x, y = hXY( x, y )
|
||||
draw.SimpleText( text, font, x, y, col, xalign, yalign )
|
||||
end
|
||||
|
||||
function hTextQ( text, font, x, y, col, xalign, yalign, col2 )
|
||||
local x, y = hXY( x, y )
|
||||
qt( text, font, x, y, col, xalign, yalign, col2 )
|
||||
end
|
||||
|
||||
function hTextS( text, font, x, y, col, xalign, yalign, col2 )
|
||||
local x, y = hXY( x, y )
|
||||
draw.SimpleText( text, font, x+1, y+1, col2, xalign, yalign )
|
||||
draw.SimpleText( text, font, x, y, col, xalign, yalign )
|
||||
end
|
||||
|
||||
local sizes = {
|
||||
8, 10, 16, 24, 36, 48
|
||||
|
@ -227,17 +245,11 @@ local function QuickDrawBar( BARWIDE, BARTALL, RealTeamID, TeamID, way )
|
|||
end
|
||||
|
||||
if way then
|
||||
local x, y = hXY( BARWIDE - 5, 0 )
|
||||
qt( faction_info.CHARNAME, "HUD_36", x, y, faction_info.COLOR_DARK, TEXT_ALIGN_RIGHT, nil, faction_info.COLOR_MAIN )
|
||||
|
||||
local x, y = hXY( BARWIDE, BARTALL )
|
||||
qt( Score_Current .. " / " .. Score_ToWin, "HUD_24", x, y, faction_info.COLOR_MAIN, TEXT_ALIGN_RIGHT, nil, faction_info.COLOR_DARK )
|
||||
hTextQ( faction_info.CHARNAME, "HUD_36", BARWIDE - 5, 0, faction_info.COLOR_DARK, TEXT_ALIGN_RIGHT, nil, faction_info.COLOR_MAIN )
|
||||
hTextQ( Score_Current .. " / " .. Score_ToWin, "HUD_24", BARWIDE, BARTALL, faction_info.COLOR_MAIN, TEXT_ALIGN_RIGHT, nil, faction_info.COLOR_DARK )
|
||||
else
|
||||
local x, y = hXY( 5, 0 )
|
||||
qt( faction_info.CHARNAME, "HUD_36", x, y, faction_info.COLOR_DARK, nil, nil, faction_info.COLOR_MAIN )
|
||||
|
||||
local x, y = hXY( 0, BARTALL )
|
||||
qt( Score_Current .. " / " .. Score_ToWin, "HUD_24", x, y, faction_info.COLOR_MAIN, nil, nil, faction_info.COLOR_DARK )
|
||||
hTextQ( faction_info.CHARNAME, "HUD_36", 5, 0, faction_info.COLOR_DARK, nil, nil, faction_info.COLOR_MAIN )
|
||||
hTextQ( Score_Current .. " / " .. Score_ToWin, "HUD_24", 0, BARTALL, faction_info.COLOR_MAIN, nil, nil, faction_info.COLOR_DARK )
|
||||
end
|
||||
|
||||
-- Players alive
|
||||
|
@ -285,8 +297,7 @@ function GM:HUDPaint()
|
|||
hCol( COLOR_DARK )
|
||||
hRect( 0, 0, 328, 65 )
|
||||
|
||||
local x, y = hXY( 10, 4 )
|
||||
qt( CHARNAME, "HUD_48", x, y, COLOR_DARK, nil, nil, COLOR_MAIN )
|
||||
hTextQ( CHARNAME, "HUD_48", 10, 4, COLOR_DARK, nil, nil, COLOR_MAIN )
|
||||
|
||||
local HEALTHPER = p:GetHealth_Blood()/1000
|
||||
--HEALTHPER = 11/100
|
||||
|
@ -299,8 +310,7 @@ function GM:HUDPaint()
|
|||
|
||||
hCol( COLOR_MAIN )
|
||||
hScis( 8, 8, (320-4-4) * HEALTHPER, 41-4-4 )
|
||||
local x, y = hXY( 10, 4 )
|
||||
draw.SimpleText( CHARNAME, "HUD_48", x, y, COLOR_DARK )
|
||||
hText( CHARNAME, "HUD_48", 10, 4, COLOR_DARK )
|
||||
hScisoff()
|
||||
|
||||
local slen = (320-4-4-4-4-4)
|
||||
|
@ -349,51 +359,36 @@ function GM:HUDPaint()
|
|||
end
|
||||
end
|
||||
|
||||
local x, y = hXY( 0, -14 )
|
||||
qt( p:GetLevel_XP() .. " / 15000", "HUD_16", x, y, COLOR_MAIN, nil, nil, COLOR_DARK )
|
||||
--qt( "", "HUD_24", x+328, y, COLOR_MAIN, TEXT_ALIGN_RIGHT, nil, COLOR_DARK )
|
||||
|
||||
hTextQ( p:GetLevel_XP() .. " / 15000", "HUD_16", 0, -14, COLOR_MAIN, nil, nil, COLOR_DARK )
|
||||
S_Pop()
|
||||
end
|
||||
S_Pop()
|
||||
|
||||
if handler then
|
||||
-- Inventory
|
||||
S_Push( 20, 20 )
|
||||
local x, y = hXY( 5, 65+16*0 )
|
||||
draw.SimpleText( "SelectedNumber: " .. (p.SelectedNumber or 0), "HUD_16", x, y, COLOR_MAIN )
|
||||
local x, y = hXY( 5, 65+16*1 )
|
||||
draw.SimpleText( "DesireR: " .. tostring(handler:GetDesireR()), "HUD_16", x, y, COLOR_MAIN )
|
||||
local x, y = hXY( 5, 65+16*2 )
|
||||
draw.SimpleText( "ActiveR: " .. tostring(handler:GetActiveR()), "HUD_16", x, y, COLOR_MAIN )
|
||||
local x, y = hXY( 5, 65+16*3 )
|
||||
draw.SimpleText( "DesireL: " .. tostring(handler:GetDesireL()), "HUD_16", x, y, COLOR_MAIN )
|
||||
local x, y = hXY( 5, 65+16*4 )
|
||||
draw.SimpleText( "ActiveL: " .. tostring(handler:GetActiveL()), "HUD_16", x, y, COLOR_MAIN )
|
||||
|
||||
local Pw, Ph, Pg = 110, 30, 10
|
||||
local thespace = 0
|
||||
for i, v in ipairs( p:GetInventory():GetWeighted() ) do
|
||||
hCol( v == handler:GetActiveR() and COLOR_BRIGHT or COLOR_DARK )
|
||||
hRect( (i-1)*(120+10), 0, 120, 60 )
|
||||
local x, y = hXY( (i-1)*(120+10), 0 )
|
||||
draw.SimpleText( l8( v.Class.PrintName ), "HUD_24", x + 120/2, y + 60/2 - (10), COLOR_MAIN, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
|
||||
if v.GetClip2 then
|
||||
draw.SimpleText( v:GetClip2() .. "/" .. v.Class.ClipSize2, "HUD_16", x + 10, y + 60/2 + (4), COLOR_MAIN, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
|
||||
thespace = thespace + Pw + Pg
|
||||
end
|
||||
thespace = thespace - Pg
|
||||
thespace = thespace/2
|
||||
|
||||
|
||||
if v.GetClip then
|
||||
local drawer = ""
|
||||
|
||||
drawer = drawer .. v:GetClip()
|
||||
drawer = drawer .. "/"
|
||||
drawer = drawer .. v.Class.ClipSize
|
||||
draw.SimpleText( drawer, "HUD_16", x + 10, y + 60/2 + (16), COLOR_MAIN, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
|
||||
draw.SimpleText( v:GetFiremode(), "HUD_16", x + 120 - 10, y + 60/2 + (16), COLOR_MAIN, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER )
|
||||
S_Push( ScrW()/2 - thespace, ScrH() - 20 - Ph )
|
||||
for i, v in ipairs( p:GetInventory():GetWeighted() ) do
|
||||
hCol( v == handler:GetDesireR() and COLOR_BRIGHT or COLOR_DARK )
|
||||
hRect( (i-1)*(Pw+Pg), 0, Pw, Ph )
|
||||
if v == handler:GetActiveR() then
|
||||
hCol( COLOR_MAIN )
|
||||
hORect( (i-1)*(Pw+Pg)+1, 1, Pw-2, Ph-2, 1 )
|
||||
end
|
||||
local x, y = (i-1)*(Pw+Pg), 0
|
||||
hText( l8( v.Class.PrintName ), "HUD_24", x + Pw/2, y + 5, COLOR_MAIN, TEXT_ALIGN_CENTER )
|
||||
hText( i, "HUD_16", x + 4, y + 2, COLOR_MAIN )
|
||||
end
|
||||
S_Pop()
|
||||
|
||||
local wep = handler:GetActiveR()
|
||||
local wep = handler:GetDesireR()
|
||||
if wep and wep.GetClip then
|
||||
local Bw, Bh = 8+(8+2)*30-2+8, 160
|
||||
S_Push( w - 20 - Bw, h - 20 - Bh )
|
||||
|
@ -405,23 +400,37 @@ function GM:HUDPaint()
|
|||
local leng = Bw-8-8
|
||||
hRect( 8, 8, leng-70, 26 )
|
||||
hRect( 8 + leng - 70 + 4, 8, leng-(leng-70)-4, 26 )
|
||||
local x, y = hXY( 12, 6 )
|
||||
draw.SimpleText( l8( wep.Class.PrintName ), "HUD_36", x, y, COLOR_DARK )
|
||||
local x, y = hXY( 10 + (leng - 70) + 70/2, 11 )
|
||||
hText( l8( wep.Class.PrintName ), "HUD_36", 12, 6, COLOR_DARK )
|
||||
local bc = wep.Class.BurstCount
|
||||
draw.SimpleText( fmlookup[bc] or bc .. "RND", "HUD_24", x, y, COLOR_DARK, TEXT_ALIGN_CENTER )
|
||||
hText( fmlookup[bc] or bc .. "RND", "HUD_24", 10 + (leng - 70) + 70/2, 11, COLOR_DARK, TEXT_ALIGN_CENTER )
|
||||
S_Pop()
|
||||
|
||||
S_Push( Bw - 8 - 8, Bh - 18 - 8 )
|
||||
local Tw, Th = 6, 18
|
||||
|
||||
if wep.Class.ClipSize>45 then
|
||||
Tw = 3
|
||||
Th = 13
|
||||
elseif wep.Class.ClipSize<14 then
|
||||
Tw = 8
|
||||
Th = 22
|
||||
end
|
||||
|
||||
S_Push( Bw - Tw - 8, Bh - Th - 8 )
|
||||
for i=0, wep.Class.ClipSize-1 do
|
||||
if i>29 then
|
||||
hCol( COLOR_DARK )
|
||||
hRect( (0 - Tw - 2)*i-4, -4, Tw+2, Th+8 )
|
||||
end
|
||||
end
|
||||
for i=0, wep.Class.ClipSize-1 do
|
||||
if wep:GetClip() >= (i+1) then
|
||||
hCol( COLOR_MAIN )
|
||||
hRect( (0 - 8 - 2)*i, 0, 8, 18 )
|
||||
hRect( (0 - Tw - 2)*i, 0, Tw, Th )
|
||||
hCol( COLOR_DARK )
|
||||
hRect( (0 - 8 - 2)*i, 14, 8, 2 )
|
||||
hRect( (0 - Tw - 2)*i, Th-4, Tw, 2 )
|
||||
else
|
||||
hCol( COLOR_BRIGHT )
|
||||
hORect( (0 - 8 - 2)*i, 0, 8, 18 )
|
||||
hORect( (0 - Tw - 2)*i, 0, Tw, Th )
|
||||
--hORect( (0 - 8 - 2)*i+1, 1, 8-2, 18-2 )
|
||||
end
|
||||
end
|
||||
|
@ -472,12 +481,10 @@ function GM:HUDPaint()
|
|||
if BennyGame:GetState() != BG_STATE_WAITINGFORPLAYERS then
|
||||
local d1, d2
|
||||
local tt = string.FormattedTime( math.max( stupidtime, 0 ) )
|
||||
if tt.m > 0 then
|
||||
d1 = string.format( "%01i:%02i", tt.m, tt.s )
|
||||
d2 = false--tt.s
|
||||
if tt.h > 0 then
|
||||
d1 = tt.h .. ":" .. d1
|
||||
end
|
||||
d1 = string.format( "%01i:%02i:%02i", tt.h, tt.m, tt.s )
|
||||
elseif tt.m > 0 then
|
||||
d1 = string.format( "%01i:%02i", tt.m, tt.s )
|
||||
else
|
||||
d1 = string.format( "%02i", tt.s )
|
||||
d2 = string.format( ".%02i", tt.ms )
|
||||
|
@ -490,16 +497,13 @@ function GM:HUDPaint()
|
|||
twid = twid + surface.GetTextSize(".00")
|
||||
end
|
||||
|
||||
local x, y = hXY( DISPLAYWIDE/2 + 0 - twid/2, 4 )
|
||||
draw.SimpleText( d1, "HUD_48", x, y, COLOR_MAIN )
|
||||
hText( d1, "HUD_48", DISPLAYWIDE/2 + 0 - twid/2, 4, COLOR_MAIN )
|
||||
local twid2 = surface.GetTextSize(d1)
|
||||
if d2 then
|
||||
local x, y = hXY( DISPLAYWIDE/2 + twid2 - twid/2, 11 )
|
||||
draw.SimpleText( d2, "HUD_36", x, y, COLOR_MAIN )
|
||||
hText( d2, "HUD_36", DISPLAYWIDE/2 + twid2 - twid/2, 11, COLOR_MAIN )
|
||||
end
|
||||
end
|
||||
|
||||
local x, y = hXY( DISPLAYWIDE/2, -16 )
|
||||
local TITLE
|
||||
if BennyGame:GetState() == BG_STATE_PRE then
|
||||
TITLE = "PREGAME"
|
||||
|
@ -509,7 +513,7 @@ function GM:HUDPaint()
|
|||
TITLE = "WAITING FOR PLAYERS"
|
||||
end
|
||||
if TITLE then
|
||||
qt( TITLE, "HUD_16", x, y, COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
|
||||
hTextS( TITLE, "HUD_24", DISPLAYWIDE/2, -18, COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
|
||||
end
|
||||
|
||||
if false then
|
||||
|
@ -582,8 +586,7 @@ function GM:HUDPaint()
|
|||
hORect( 1, 1, 48-2, 48-2, math.floor(23 * capturepercent) )
|
||||
end
|
||||
|
||||
local x, y = hXY( 48/2, 9 )
|
||||
qt( alphabet[i] or i, "HUD_36", x, y, faction_info.COLOR_MAIN, TEXT_ALIGN_CENTER, nil, faction_info.COLOR_DARK )
|
||||
hTextQ( alphabet[i] or i, "HUD_36", 48/2, 9, faction_info.COLOR_MAIN, TEXT_ALIGN_CENTER, nil, faction_info.COLOR_DARK )
|
||||
S_Pop()
|
||||
end
|
||||
S_Pop()
|
||||
|
@ -637,12 +640,9 @@ function GM:HUDPaint()
|
|||
hORect( -100+1, 35+1, 200-2, 76-2 )
|
||||
hCol( BARCOLOR_MAIN )
|
||||
hORect( -80+1, 1, 160-2, 38-2, 1 )
|
||||
local x, y = hXY( 0, 4 )
|
||||
qt( "POINT " .. (alphabet[ AllFlagFlip[obj] ] or AllFlagFlip[obj]), "HUD_36", x, y, BARCOLOR_MAIN, TEXT_ALIGN_CENTER, nil, BARCOLOR_DARK )
|
||||
|
||||
|
||||
local x, y = hXY( 0, TITLE=="SECURE" and 62 or 40 )
|
||||
qt( TITLE, "HUD_24", x, y, obj:GetContested() and CONTOLER_MAIN or COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
|
||||
hTextQ( "POINT " .. (alphabet[ AllFlagFlip[obj] ] or AllFlagFlip[obj]), "HUD_36", 0, 4, BARCOLOR_MAIN, TEXT_ALIGN_CENTER, nil, BARCOLOR_DARK )
|
||||
hTextQ( TITLE, "HUD_24", 0, TITLE=="SECURE" and 62 or 40, obj:GetContested() and CONTOLER_MAIN or COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
|
||||
|
||||
if TITLE!="SECURE" then
|
||||
S_Push( -BWIDE/2, 62 )
|
||||
|
@ -653,8 +653,7 @@ function GM:HUDPaint()
|
|||
hCol( TAKCOLOR_MAIN )
|
||||
hRect( 3, 3, math.floor((BWIDE-6) * PERCENT), BTALL-6 )
|
||||
S_Pop()
|
||||
local x, y = hXY( 0, 78 )
|
||||
qt( math.floor(PERCENT*100) .. "%", "HUD_36", x, y, obj:GetContested() and CONTOLER_MAIN or COLOR_MAIN, TEXT_ALIGN_CENTER, nil, obj:GetContested() and CONTOLER_DARK or COLOR_DARK )
|
||||
hTextQ( math.floor(PERCENT*100) .. "%", "HUD_36", 0, 78, obj:GetContested() and CONTOLER_MAIN or COLOR_MAIN, TEXT_ALIGN_CENTER, nil, obj:GetContested() and CONTOLER_DARK or COLOR_DARK )
|
||||
end
|
||||
S_Pop()
|
||||
end
|
||||
|
@ -683,19 +682,11 @@ function GM:HUDPaint()
|
|||
-- table.insert( hints, { "[E]", "PICK UP" } )
|
||||
end
|
||||
|
||||
local x, y = hXY( 0, 0 )
|
||||
for i, v in ipairs( hints ) do
|
||||
draw.SimpleText( v[1], "HUD_24", x - 150 + 1, y + (24*(i-1)) + 1, COLOR_DARK, TEXT_ALIGN_CENTER )
|
||||
draw.SimpleText( v[2], "HUD_24", x + 1, y + (24*(i-1)) + 1, COLOR_DARK, TEXT_ALIGN_RIGHT )
|
||||
hTextS( v[1], "HUD_24", -150, (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
|
||||
hTextS( v[2], "HUD_24", 0, (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_RIGHT, nil, COLOR_DARK )
|
||||
if v[3] then
|
||||
draw.SimpleText( v[3], "HUD_16", x - 150 + 1, y+3 + (24*(i-1)) + 1, COLOR_DARK, TEXT_ALIGN_CENTER )
|
||||
end
|
||||
end
|
||||
for i, v in ipairs( hints ) do
|
||||
draw.SimpleText( v[1], "HUD_24", x - 150, y + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_CENTER )
|
||||
draw.SimpleText( v[2], "HUD_24", x, y + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_RIGHT )
|
||||
if v[3] then
|
||||
draw.SimpleText( v[3], "HUD_16", x - 150, y+3 + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_CENTER )
|
||||
hTextS( v[3], "HUD_16", -150, 3 + (24*(i-1)), COLOR_MAIN, TEXT_ALIGN_CENTER, nil, COLOR_DARK )
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -779,3 +770,164 @@ function GM:HUDShouldDraw( name )
|
|||
return true
|
||||
end
|
||||
end
|
||||
|
||||
--local players = {
|
||||
-- { name = "Jim", Team = "mp_arng" },
|
||||
-- { name = "Sas", Team = "mp_arng" },
|
||||
-- { name = "Greg", Team = "mp_arng" },
|
||||
-- { name = "Nate", Team = "mp_arng" },
|
||||
--
|
||||
-- { name = "Ion", Team = "mp_plasof" },
|
||||
-- { name = "Beo", Team = "mp_plasof" },
|
||||
-- { name = "Poe", Team = "mp_plasof" },
|
||||
-- { name = "Zio", Team = "mp_plasof" },
|
||||
--}
|
||||
|
||||
local things = {
|
||||
{ name = "Score", size = 100,
|
||||
get = function( ply )
|
||||
return 0
|
||||
end,},
|
||||
{ name = "Kills", size = 50,
|
||||
get = function( ply )
|
||||
return ply:Frags()
|
||||
end,},
|
||||
{ name = "Deaths", size = 50,
|
||||
get = function( ply )
|
||||
return ply:Deaths()
|
||||
end,},
|
||||
{ name = "Time", size = 50,
|
||||
get = function( ply )
|
||||
return ":00"
|
||||
end,},
|
||||
{ name = "Ping", size = 50,
|
||||
get = function( ply )
|
||||
return ply:Ping()
|
||||
end,} -- Ping
|
||||
}
|
||||
|
||||
local function QuickDrawStat( wide, data, first )
|
||||
local gap = 0
|
||||
local teamd = TEAMS[data.id]
|
||||
local faction = FACTIONS[teamd.factionid]
|
||||
|
||||
local TeamName = l8( teamd.name )
|
||||
hTextQ( TeamName, "HUD_36", 0, 0, faction.COLOR_MAIN, nil, nil, faction.COLOR_DARK )
|
||||
gap = gap + 30
|
||||
|
||||
hCol( faction.COLOR_DARK )
|
||||
hRect( -5+1, gap+1, wide+10, 2 )
|
||||
hCol( faction.COLOR_MAIN )
|
||||
hRect( -5, gap, wide+10, 2 )
|
||||
gap = gap + 6
|
||||
|
||||
local blep = wide
|
||||
for i, v in ipairs(things) do blep = blep - v.size end
|
||||
|
||||
if first then
|
||||
local bloop = 0
|
||||
for i, v in ipairs(things) do
|
||||
hCol( 127, 127, 127, 80 )
|
||||
local x, y = blep+bloop, 12
|
||||
if v.name then
|
||||
hTextS( v.name, "HUD_16", x+(v.size/2), y, color_white, TEXT_ALIGN_CENTER, nil, color_black )
|
||||
end
|
||||
bloop = bloop + v.size
|
||||
end
|
||||
end
|
||||
|
||||
for i, ply in ipairs( data.players ) do
|
||||
local bloop = 0
|
||||
hCol( faction.COLOR_MAIN, 30 )
|
||||
hRect( 0, gap, wide, 30 )
|
||||
hCol( faction.COLOR_DARK )
|
||||
hORect( 3, gap+3, wide-4, 30-4, 1 )
|
||||
hCol( faction.COLOR_MAIN )
|
||||
hORect( 2, gap+2, wide-4, 30-4, 1 )
|
||||
|
||||
hTextQ( ply:GetLevel(), "HUD_16", 18, gap+8, Color( 255, 255, 0 ), TEXT_ALIGN_CENTER, nil, color_black )
|
||||
hTextQ( ply:Nick(), "HUD_24", 32, gap+5, color_white, nil, nil, color_black )
|
||||
|
||||
local bloop = 0
|
||||
for i, v in ipairs(things) do
|
||||
hCol( 255, 0, 0 )
|
||||
local x, y = blep+bloop, gap+8
|
||||
hTextS( v.get( ply ), "HUD_16", x+(v.size/2), y, color_white, TEXT_ALIGN_CENTER, nil, color_black )
|
||||
bloop = bloop + v.size
|
||||
end
|
||||
|
||||
gap = gap + 32
|
||||
end
|
||||
|
||||
return gap
|
||||
end
|
||||
|
||||
local ScoreWide = 600
|
||||
function GM:ScoreboardShow()
|
||||
drawscoreboard = true
|
||||
end
|
||||
function GM:ScoreboardHide()
|
||||
drawscoreboard = false
|
||||
end
|
||||
function GM:HUDDrawScoreBoard()
|
||||
if !drawscoreboard then return end
|
||||
local p = LocalPlayer()
|
||||
local w, h = ScrW(), ScrH()
|
||||
local handler = p:HandlerCheck()
|
||||
stack = util.Stack()
|
||||
|
||||
local myteam = p:Team()
|
||||
local CURRCHAR
|
||||
if BennyGame:GetType() == BG_GTYPE_CAMPAIGN then
|
||||
CURRCHAR = "benny"
|
||||
else
|
||||
CURRCHAR = TEAMS[myteam].factionid
|
||||
end
|
||||
local COLOR_MAIN = FACTIONS[CURRCHAR].COLOR_MAIN
|
||||
local COLOR_DARK = FACTIONS[CURRCHAR].COLOR_DARK
|
||||
local CHARNAME = FACTIONS[CURRCHAR].CHARNAME
|
||||
|
||||
local MP = BennyGame:GetType() == BG_GTYPE_MP
|
||||
|
||||
if MP then
|
||||
S_Push( w/2 - ScoreWide/2, h/2 - 400/2 )
|
||||
local OrganizedTeams = {}
|
||||
local IDtoOrg = {}
|
||||
|
||||
local MyCreation = { id = myteam, players = {} }
|
||||
table.insert( OrganizedTeams, MyCreation )
|
||||
IDtoOrg[myteam] = MyCreation
|
||||
|
||||
for TeamID, RealTeamID in ipairs( BennyGame.TeamsInPlay ) do
|
||||
if RealTeamID == myteam then continue end
|
||||
|
||||
local MyCreation = { id = RealTeamID, players = {} }
|
||||
table.insert( OrganizedTeams, MyCreation )
|
||||
IDtoOrg[RealTeamID] = MyCreation
|
||||
end
|
||||
|
||||
for _, ply in player.Iterator() do
|
||||
local thisteam = ply:Team()
|
||||
if !IDtoOrg[thisteam] then
|
||||
local MyCreation = { id = thisteam, players = {} }
|
||||
table.insert( OrganizedTeams, MyCreation )
|
||||
IDtoOrg[thisteam] = MyCreation
|
||||
end
|
||||
|
||||
table.insert( IDtoOrg[thisteam].players, ply )
|
||||
end
|
||||
|
||||
local gap = 0
|
||||
for index, data in ipairs( OrganizedTeams ) do
|
||||
S_Push( 0, 0 + gap )
|
||||
gap = gap + QuickDrawStat( ScoreWide, data, index==1 )
|
||||
S_Pop()
|
||||
end
|
||||
S_Pop()
|
||||
else
|
||||
-- Timer, player & team score
|
||||
end
|
||||
|
||||
if stack:Size() != 0 then print("Stack unfinished.") end
|
||||
return
|
||||
end
|
Loading…
Reference in New Issue