local showhp = true
local showother = true
local showpiyobar = true
local showsprite = false
local showmechnames = false
local boxoneposx = 0
local boxoneposy = 20
local textoneposx = 91
local textoneposy = 18
local lineoneposx = boxoneposx+1
local lineoneposy = boxoneposy+1
local boxtwoposx = 165
local boxtwoposy = 20
local linetwoposx = boxtwoposx+1
local linetwoposy = boxtwoposy+1
local boxonepiyoposx = 0
local boxonepiyoposy = 30
local boxtwopiyoposx = 160
local boxtwopiyoposy = 30
local othertextposx = 0
local othertextposy = 8
local nametextposx = 91
local nametextposy = 28
local hpframecolor = "#000000"
local hpcolor = "#0000FF"
local hpcolor2 = "#0000FF"
local piyoframecolor = "#000000"
local piyocolor = "#00FF00"
local piyocolor2 = "#FF0000"
local spritecolor = "#00FF00"
function gui.fillbox(x1, y1, x2, y2, color)
for y = y1, y2 do
gui.drawline(x1, y, x2, y, color)
end
end
function transpset()
gui.transparency(1)
end
function showluaversion()
gui.text(0, 180, "Joy Mech Fight Lua v1")
end
function showhpInfo()
local onehp = memory.readbyte(0x0529)
local twohp = memory.readbyte(0x0629)
gui.text(textoneposx, textoneposy, "1P:")
gui.text(textoneposx+16, textoneposy, onehp)
gui.text(textoneposx+42, textoneposy, "2P:")
gui.text(textoneposx+58, textoneposy, twohp)
gui.drawbox(boxoneposx, boxoneposy, boxoneposx+90, boxoneposy+6, hpframecolor)
gui.drawbox(boxtwoposx, boxtwoposy, boxtwoposx+90, boxtwoposy+6, hpframecolor)
if (onehp > 0) then
gui.fillbox(lineoneposx, lineoneposy , boxoneposx+onehp+1, lineoneposy+4 , hpcolor)
end
if (twohp > 0) then
gui.fillbox(linetwoposx, linetwoposy , boxtwoposx+twohp+1, linetwoposy+4 , hpcolor)
end
end
function showpiyobar()
local onepiyo = memory.readbyte(0x052B)
local twopiyo = memory.readbyte(0x062B)
local onepiyomax = memory.readbyte(0x052c)
local twopiyomax = memory.readbyte(0x062c)
if (onepiyomax ~= 255) then
gui.drawbox(boxonepiyoposx,boxonepiyoposy,onepiyomax+boxonepiyoposx+2,boxonepiyoposy+6,piyoframecolor)
if (onepiyo > 0) then
if (onepiyo < onepiyomax) then
gui.fillbox(boxonepiyoposx+1,boxonepiyoposy+1,onepiyo+boxonepiyoposx+1,boxonepiyoposy+5,piyocolor)
else
gui.fillbox(boxonepiyoposx+1,boxonepiyoposy+1,onepiyomax+boxonepiyoposx-1,boxonepiyoposy+5,piyocolor2)
end
end
gui.drawbox(boxtwopiyoposx,boxtwopiyoposy,twopiyomax+boxtwopiyoposx,boxtwopiyoposy+6,piyoframecolor)
if (twopiyo > 0) then
if (twopiyo < twopiyomax) then
gui.fillbox(boxtwopiyoposx+1,boxtwopiyoposy+1,twopiyo+boxtwopiyoposx+1,boxtwopiyoposy+5,piyocolor)
else
gui.fillbox(boxtwopiyoposx+1,boxtwopiyoposy+1,twopiyomax+boxtwopiyoposx-1,boxtwopiyoposy+5,piyocolor2)
end
end
end
end
function showotherInfo()
local onepiyo = memory.readbyte(0x052B)
local twopiyo = memory.readbyte(0x062B)
local onepiyomax = memory.readbyte(0x052c)
local twopiyomax = memory.readbyte(0x062c)
local onestock = memory.readbyte(0x0540)
local twostock = memory.readbyte(0x0640)
gui.text (othertextposx,othertextposy,"Stk:")
gui.text (othertextposx+20,othertextposy,onestock)
gui.text (othertextposx+31,othertextposy,"MAX:")
if (onepiyomax ~= 255) then
gui.text (othertextposx+54,othertextposy,onepiyomax)
end
gui.text (othertextposx+70,othertextposy,"piyori:")
gui.text (othertextposx+99,othertextposy,onepiyo)
gui.text (othertextposx+142,othertextposy,"piyori:")
gui.text (othertextposx+172,othertextposy,twopiyo)
gui.text (othertextposx+187,othertextposy,"MAX:")
if (onepiyomax ~= 255) then
gui.text (othertextposx+210,othertextposy,twopiyomax)
end
gui.text (othertextposx+226,othertextposy,"Stk:")
gui.text (othertextposx+246,othertextposy,twostock)
end
function showspritebox()
local lefthandposx = memory.readbyte(0x0500)
local lefthandposy = memory.readbyte(0x0501)
if (lefthandposx <= 249) then
if (lefthandposy <= 241) then
gui.drawbox(lefthandposx,lefthandposy,lefthandposx+5,lefthandposy+5,spritecolor)
end
end
end
local onemechnametable = { "Honoo", "Tiger", "Neo", "Senju", "Sasuke", "Eye", "Giant", "Skapon" }
function showmechname()
local onemechnamemem = memory.readbyte(0x053F)
local twomechnamemem = memory.readbyte(0x063F)
if (onemechnamemem >= 0 and onemechnamemem <= 7) then
local onemechname = onemechnametable[onemechnamemem+1]
gui.text (nametextposx,nametextposy,onemechname)
end
end
while true do
if transp then
transpset()
end
if showluaver then
showluaversion()
end
if showhp then
showhpInfo()
end
if showpiyobar then
showpiyobar()
end
if showother then
showotherInfo()
end
if showmechnames then
showmechname()
end
if showsprite then
showspritebox()
end
FCEU.frameadvance()
end