Advertisement
Guest User

Toki hitbox viewer

a guest
Aug 28th, 2012
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.96 KB | None | 0 0
  1. -- Player
  2. local pbase = 0xFF1CD4
  3. local px = pbase + 0x19
  4. local py = pbase + 0x1D
  5.  
  6. local camx = 0xFF1BC5
  7. local camy = 0xFF1BC9
  8.  
  9. --Player projectiles
  10.  
  11. local projbase = 0xFF1D34
  12.  
  13. --Enemies
  14. local ebase = 0xFF21B4
  15.  
  16. --Bosses
  17. local bbase = 0xFF35F4
  18.  
  19.  
  20.  
  21.  
  22. local function endian(address)
  23.     local result = memory.readbyte(address) + (memory.readbyte(address-1) * 256)
  24.     return result
  25. end
  26.  
  27. local function Toki()
  28.     local cx = endian(camx)
  29.     local cy = endian(camy)
  30.     local x = endian(px) - cx
  31.     local y = endian(py) - cy
  32.     local xoff = memory.readbytesigned(pbase + 0x11)
  33.     local yoff = memory.readbytesigned(pbase + 0x15)
  34.     local xrad = memory.readbyte(pbase +0x13)
  35.     local yrad = memory.readbyte(pbase +0x17)
  36.     local flip = memory.readbyte(pbase +1)
  37.     if flip == 1 then
  38.         xoff = xoff * -1
  39.     end
  40.     gui.box(x+xoff-xrad,y+yoff-yrad,x+xoff+xrad,y+yoff+yrad,"#0000FF30","#0000FFFF")
  41. end
  42.  
  43. local function enemies()
  44.     local cx = endian(camx)
  45.     local cy = endian(camy)
  46.     local x
  47.     local y
  48.     local xoff
  49.     local xrad
  50.     local yoff
  51.     local yrad
  52.     local oend = 44
  53.     local base = ebase 
  54.     local flip
  55.     local hp
  56.     for i = 0,oend,1 do
  57.         if i > 0 then
  58.             base = ebase + (i * 0x60)
  59.         end
  60.         flip = memory.readbyte(base +1)
  61.         if memory.readbyte(base) > 0 then
  62.             hp = memory.readbyte(base + 0xD)
  63.             x = endian(base + 0x19) - cx
  64.             xrad = memory.readbyte(base + 0x13)
  65.             xoff = memory.readbytesigned(base + 0x11)
  66.             yrad = memory.readbyte(base + 0x17)
  67.             yoff = memory.readbytesigned(base + 0x15)
  68.            
  69.             if flip == 1 then
  70.                 xoff = xoff * -1
  71.             end
  72.             y = endian(base + 0x1D) - cy
  73.             if hp > 0 then
  74.                 gui.text(x,y-10, "HP: " .. hp)
  75.             end
  76.             gui.box(x+xoff-xrad,y+yoff-yrad,x+xoff+xrad,y+yoff+yrad,"#FF000035","#FF0000FF")
  77.         end
  78.     end
  79. end
  80.  
  81. local function boss()
  82.     local cx = endian(camx)
  83.     local cy = endian(camy)
  84.     local x = endian(bbase + 0x19) - cx
  85.     local y = endian(bbase + 0x1D) - cy
  86.     local xrad = memory.readbyte(bbase + 0x11)
  87.     local yrad = memory.readbyte(bbase + 0x15)
  88.     local flip = memory.readbyte(bbase +1)
  89.     gui.text(x-10,y-10,"HP: " .. memory.readbyte(bbase + 0x0D))
  90.     gui.box(x-xrad,y-yrad,x+xrad,y+yrad,"#FF000035","#FF0000FF")
  91. end
  92.  
  93. local function projectiles()
  94.     local cx = endian(camx)
  95.     local cy = endian(camy)
  96.     local x
  97.     local y
  98.     local xoff
  99.     local xrad
  100.     local yoff
  101.     local yrad
  102.     local oend = 11
  103.     local base = projbase
  104.     local flip
  105.    
  106.     for i = 0,oend,1 do
  107.         if i > 0 then
  108.             base = projbase + (i * 0x60)
  109.         end
  110.         flip = memory.readbyte(base +1)
  111.        
  112.         if memory.readbyte(base) > 0 then
  113.             x = endian(base + 0x19) - cx
  114.             y = endian(base + 0x1D) - cy
  115.             xoff = memory.readbytesigned(base + 0x11)
  116.             yoff = memory.readbytesigned(base + 0x15)
  117.             xrad = memory.readbyte(base + 0x13)
  118.             yrad = memory.readbyte(base + 0x17)
  119.            
  120.             if flip == 1 then
  121.                 xoff = xoff * -1
  122.             end
  123.             gui.box(x+xoff-xrad,y+yoff-yrad,x+xoff+xrad,y+yoff+yrad,"#FFFFFF40","#FFFFFFFF")
  124.         end
  125.     end
  126.  
  127. end
  128.  
  129.  
  130.  
  131. while true do
  132.     Toki()
  133.     enemies()
  134.     projectiles()
  135.     boss()
  136.     emu.frameadvance()
  137. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement