Created
April 14, 2015 06:45
-
-
Save lucab/b18c32405ebacd4cc1fb to your computer and use it in GitHub Desktop.
Workaround large X values in MAME draw_text()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() | |
camx = band(mem:read_i16(0x2034E2),0xFF80)/0x80 | |
--Sprites | |
--spradr 0x20869A, 72 offset | |
adr = 0x20869A - 0x72 | |
for a = 0,0x60,1 do | |
adr = adr + 0x72 | |
local active = band(mem:read_u8(adr),0x80)/0x80 | |
local y = band(mem:read_i16(adr + 0x2A),0xFF80)/0x80 | |
local x = band(mem:read_i16(adr + 0x2C),0xFF80)/0x80 | |
local boxpnt = mem:read_u32(adr + 0x1A) | |
local hp = mem:read_u16(adr + 0x50) | |
if active == 1 then | |
boxes = 0 | |
if ((y-8) < (gui:width()-9)) then | |
gui:draw_text(y-8,x-camx,hp) | |
end | |
repeat boxes = boxes + 1 | |
until mem:read_i16(boxpnt + (boxes * 8)) == 0x00 | |
for nbox = 0,boxes-1,1 do | |
colbox(boxpnt+(nbox*8),y,x-camx) | |
end | |
drawaxis(y,x - camx,2,0xFFFFFFFF) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment