Skip to content

Commit

Permalink
Merge pull request #2 from Goober5000/markbox_options_and_tweaks
Browse files Browse the repository at this point in the history
add additional options to markbox
  • Loading branch information
AxemP authored Jul 7, 2020
2 parents cef53bd + ad9a178 commit 321df85
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions MarkBox/data/tables/markbox-sct.tbm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ function MarkBox:Init()
self.Enabled = false
self.List = {}
self.WeaponList = {}


self.DefaultFont = gr.Fonts[1]
self.MarkFont = gr.Fonts[3]
self.DrawSubsysDiagonals = true
self.DrawSubsysHealth = true

self.NextDistCheck = 0
self.DistCheckInterval = 1

Expand Down Expand Up @@ -328,7 +333,7 @@ function MarkBox:DrawSubsystemBracket(subsys, data)
local player = hv.Player

--[[gr.setColor(255,255,255,255)
gr.CurrentFont = gr.Fonts[1]
gr.CurrentFont = self.DefaultFont
gr.drawString("Target Data:",100*i,100)
gr.drawString("Ship: " .. player.Target.Name)
gr.drawString("Actual: " .. player.TargetSubsystem:getModelName())
Expand Down Expand Up @@ -378,41 +383,40 @@ function MarkBox:DrawSubsystemBracket(subsys, data)
gr.drawLine(nx2-1, ny2-1, nx2-lineLength, ny2)
gr.drawLine(nx2-1, ny2-1, nx2, ny2-lineLength)

gr.CurrentFont = gr.Fonts[3]

local hpPct = subsys.HitpointsLeft / subsys.HitpointsMax
local hpWidth = 100
gr.CurrentFont = self.MarkFont

if focus then
if focus and self.DrawSubsysDiagonals then
gr.drawLine(x1, y1, nx1, ny1)
gr.drawLine(x1, y2, nx1, ny2)

gr.drawLine(x2, y1, nx2, ny1)
gr.drawLine(x2, y2, nx2, ny2)

--gr.drawString(data.Text,x2+5,y2-20)
--gr.drawRectangle(x2+5,y2-5,x2+5+(hpWidth*hpPct), y2+0)
else

end

if data.Text then
gr.drawString(data.Text,nx2+5,ny2-20)
end
gr.drawRectangle(nx2+5,ny2-5,nx2+5+(hpWidth*hpPct), ny2+0)

if self.DrawSubsysHealth and subsys.HitpointsMax > 0 then
local hpPct = subsys.HitpointsLeft / subsys.HitpointsMax
local hpWidth = 100

gr.drawRectangle(nx2+5,ny2-5,nx2+5+(hpWidth*hpPct), ny2+0)
end

gr.setLineWidth(1)

end

if not x1 then gr.drawSubsystemTargetingBrackets(subsys) end
else
gr.drawSubsystemTargetingBrackets(subsys)
end

end

function MarkBox:DrawShipBracket(ship, data)

local player = hv.Player
local focus

local r,g,b = ship.Team:getColor()
gr.setColor(r,g,b,192)

Expand All @@ -426,15 +430,15 @@ function MarkBox:DrawShipBracket(ship, data)
gr.setLineWidth(1)
else
if data.Text then
gr.CurrentFont = gr.Fonts[3]
gr.CurrentFont = self.MarkFont
local x1,y1,x2,y2 = gr.drawTargetingBrackets(ship, false)
if x1 and y1 then
gr.drawString(data.Text,x1-5,y1-16)
end
gr.CurrentFont = gr.Fonts[1]
gr.CurrentFont = self.DefaultFont
end
end

end


Expand Down

0 comments on commit 321df85

Please sign in to comment.