Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- initialization code (if any) goes here
- gens.registerafter( function()
- -- draw code
- local spritesenabled
- local actorsenabled
- local playerx, playery
- local actorcount
- local actorindex
- local actormemory
- local actorx, actory
- local actorwidth, actorheight
- local actorscreenx, actorscreeny
- local actorspritedata
- local actorhealth
- local actoralive
- local camerax, cameray
- local boxcolor
- local boxopacity
- local bordercolor
- -- enable/disable features
- spritesenabled = 1
- actorsenabled = 1
- -- init
- actorcount = 64 -- memory.readbyte(0xFF3FFB)
- camerax = memory.readword(0xFF010C)
- cameray = memory.readword(0xFF010E)
- playerx = memory.readword(0xFF0106)
- playery = memory.readword(0xFF0108)
- -- exit if not valid actor count (title screen, etc)
- if (actorcount == 255) then
- return 0
- end
- actorindex = 0
- -- hitbox total
- actorcount = 200
- -- draw hitboxes
- while (actorindex < actorcount and actorsenabled == 1) do
- actormemory = 0xFF0E72 + (actorindex * 8)
- actorx = memory.readword(actormemory + 0x00)
- actory = memory.readword(actormemory + 0x02)
- if (actorindex == 124) then
- -- player
- boxcolor = 0x00FF0044
- bordercolor = 0x00FF0088
- elseif (actorindex == 126) then
- -- player attack
- boxcolor = 0x00000000
- bordercolor = 0xFFFFFFFF
- elseif (actorindex > 126) then
- -- projectiles, stuff that hurts
- boxcolor = 0x00000088
- bordercolor = 0xFF0000FF
- else
- boxcolor = 0xFF00FF33
- bordercolor = 0xFF00FF55
- end
- if (actorx < 0x7FFF and actory < 0x7FFF) then
- actorwidth = memory.readword(actormemory + 0x04) - actorx
- actorheight = memory.readword(actormemory + 0x06) - actory
- actorscreenx = actorx - (camerax + 16)
- actorscreeny = actory - (cameray + 16)
- gui.box(actorscreenx, actorscreeny, actorscreenx + actorwidth, actorscreeny + actorheight, boxcolor, bordercolor)
- if (actorscreenx >= 0) and (actorscreenx < 320) and (actorscreeny >= 0) and (actorscreeny < 224) then
- -- gui.text(actorscreenx, (actorscreeny+actorheight)-6, actorindex, 0xFFFF00CC,0x000000CC)
- end
- end
- actorindex = actorindex + 1
- end
- actorindex = 0
- -- box color
- boxcolor = 0xFFFFFF00
- -- hitbox opacity
- boxopacity = 96
- -- draw actor info
- while (actorindex < actorcount and spritesenabled == 1) do
- -- actor data offset
- actormemory = 0xFF1076 + (actorindex * 128)
- -- get actor sprite data
- actorspritedata = memory.readdword(actormemory + 0x38)
- -- get actor dimensions
- -- actorwidth = -memory.readwordsigned(actorspritedata+2)
- -- actorheight = -memory.readwordsigned(actorspritedata+4)
- -- get actor coords
- actorx = memory.readword(actormemory + 0x00)
- actory = memory.readword(actormemory + 0x02)
- actorscreenx = (actorx - (camerax + 16)) -- + (actorwidth/2)
- actorscreeny = actory - (cameray + 16)
- actorhealth = memory.readword(actormemory + 0x50)
- actoralive = (memory.readword(actormemory + 0x5E) > 0) or (memory.readword(actormemory + 0x22) > 0) or (memory.readword(actormemory + 0x48) > 0)
- -- only draw text if actor is on screen
- if (actorscreenx >= 0) and (actorscreenx < 320) and (actorscreeny >= 0) and (actorscreeny < 224) and (actoralive) then
- if (actorhealth > 0) then
- gui.text((actorx-camerax)-16, (actory-cameray)-24, actorhealth, 0x00FFFFFF, clear)
- end
- end
- -- post
- actorindex = actorindex + 1
- end
- -- useful info
- gui.text(145,203,"HP " .. memory.readword(0xFF2CC6), 0xFFFF00FF, clear)
- gui.text(145,209,"IV " .. memory.readword(0xFF16D2), 0xFFFF00FF, clear)
- gui.text(145,215,"RUN " .. memory.readbyte(0xFF1699), 0xFFFF00FF, clear)
- gui.text(10,0,"XY " .. playerx .. ", " .. playery, 0xFFFFFFFF, clear)
- return 0
- end)
- gens.registerexit( function()
- -- cleanup code (if any) goes here
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement