Advertisement
Guest User

Untitled

a guest
Sep 1st, 2012
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.41 KB | None | 0 0
  1. --Player
  2. local px = 0x0086
  3. local py = 0x008A
  4.  
  5. local projxbase = 0x4BB  -- Object X speed base is 0x4C1
  6. local projybase = 0x4Be  -- Object Y speed base ix 0x4C4
  7.  
  8. --Enemies
  9. local ex = 0x0460
  10. local ey = 0x0480
  11. local efacing = 0x440
  12. local etype = 0x0438
  13.  
  14. --Objects
  15. local ox = 0x4D9
  16. local oy = 0x4E1
  17. local otype
  18.  
  19. --  Enemy box arrays, since the ROM values are bankswitched very quickly, it's impossible to load
  20. --  All these values real time without double drawing the boxes on a breakpoint, instead
  21. --  I've created an array that contains all the values the game uses and reads from this
  22. --  This provides the same effect.  They're located at 0x3310 for the xradius's in Rom
  23. --  And 0x3410 for the Yradius's.
  24.  
  25. local xradarray = {0x0A,0x0A,0x14,0x0A,0x0A,0x10,0x10,0x0A,0x14,0x14,0x0A,0x0C,0x0C,0x0C,0x0C,0x14,
  26. 0x14,0x14,0x14,0x0C,0x0C,0x14,0x14,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0C,0x0A,0x0A,0x16,0x16,0x16,0x0C,
  27. 0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0C,0x0A,0x0A,0x0A,0x0A,0x14,0x0A,0x14,0x14,0x14,0x14,0x0A,0x0A,0x0A,
  28. 0x0A,0x0A,0x14,0x14,0x0A,0x0A,0x0C,0x0C,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x1C,0x18,0x0A,0x0A,
  29. 0x0A,0x0A,0x1C,0x1C,0x1C,0x1C,0x18,0x18,0x0C,0x14,0x14,0x14,0x0C,0x10,0x10,0x18,0x18,0x18,0x18,0x18,
  30. 0x10,0x10,0x10,0x0C,0x10,0x18,0x10,0x18,0x00,0x10,0x18,0x18,0x1C,0x20,0x20,0x1C,0x1C,0x10,0x10,0x10,
  31. 0x10,0x10,0x10,0x0C,0x00,0x00,0x00,0x00,0x18,0x18,0x10,0x10,0x10,0x10,0x18,0x10,0x1C,0x10}
  32.  
  33. local yradarray = {0x18,0x18,0x18,0x10,0x10,0x18,0x18,0x28,0x18,0x18,0x20,0x10,0x10,0x10,0x10,0x10,
  34. 0x10,0x10,0x10,0x08,0x04,0x08,0x08,0x18,0x18,0x18,0x18,0x10,0x10,0x08,0x18,0x18,0x18,0x18,0x18,0x08,
  35. 0x08,0x08,0x18,0x18,0x18,0x18,0x08,0x08,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x10,0x18,
  36. 0x18,0x18,0x18,0x18,0x18,0x18,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x28,0x28,0x28,0x28,0x28,0x28,0x28,
  37. 0x28,0x28,0x18,0x18,0x18,0x18,0x28,0x38,0x08,0x14,0x14,0x20,0x08,0x08,0x08,0x38,0x38,0x38,0x38,0x38,
  38. 0x63,0x48,0x08,0x18,0x08,0x10,0x08,0x10,0x00,0x08,0x38,0x38,0x18,0x38,0x38,0x48,0x48,0x08,0x08,0x08,
  39. 0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x38,0x38,0x08,0x08,0x18,0x18,0x18,0x18,0x18,0x08}
  40.  
  41. local function Ryu()
  42.         local x = memory.readbyte(px)
  43.         local y = memory.readbyte(py)
  44.         local yrad = memory.readbyte(0x90)
  45.         local act = memory.readbyte(0x83)
  46.         local subwep = memory.readbyte(0xC9)
  47.         local flip = 0
  48.         local swdactive = memory.readbyte(0x83)
  49.        
  50.         if bit.band(memory.readbyte(0x84),0x40) == 0x40 then
  51.             flip = 1
  52.         end
  53.         --Spin slash check
  54.         if subwep == 0x85 then
  55.             if memory.readbyte(0x83) >= 0x0C and memory.readbyte(0x83) <= 0x0F then
  56.                 gui.box(x+9,y,x-9,y-yrad,"#FFFF0060","#FFFF00FF")
  57.             end
  58.         end
  59.         --Check if Ryu is attacking with sword 7 = stand/jump, A = crouching
  60.         if swdactive == 7 or swdactive == 0x0A then
  61.             if flip == 0 then
  62.                 gui.box(x,y-yrad,x+0x20,y-yrad+0x10)
  63.             else
  64.                 gui.box(x,y-yrad,x-0x20,y-yrad+0x10)
  65.             end
  66.         end
  67.         -- Check spinning flame subweapon
  68.         if subwep == 0x84 then
  69.             if memory.readbyte(0x4C8) > 0 then
  70.                 gui.box(x+9,y,x-9,y-yrad,"#FFFF0060","#FFFF00FF")
  71.             end
  72.         end
  73.         gui.line(x,y,x,y-yrad,"#0000FFFF")
  74. end
  75.  
  76. local function weapons()
  77.     for i = 0,2,1 do
  78.         active = bit.band(memory.readbyte(0xC8),memory.readbyte(0xE66F + i))
  79.         if active > 0 then
  80.             local wtype = bit.band(memory.readbyte(0xC9),0x7F)
  81.             local x = memory.readbyte(projxbase + i)
  82.             local y = memory.readbyte(projybase + i)
  83.             local xrad = memory.readbyte(0xE605 + wtype)
  84.             gui.box(x+xrad,y,x-xrad,y-xrad,"#FF00FF60","#FF00FFFF")
  85.         end
  86.     end
  87. end
  88.  
  89. local function enemies()
  90.     for i = 0,8,1 do
  91.         local active = bit.band(memory.readbyte(0x73),memory.readbyte(0xE66F + i))
  92.         if active > 0 then
  93.             local offset = memory.readbyte(etype + i)
  94.             local x = memory.readbyte(ex + i)
  95.             local y = memory.readbyte(ey + i)
  96.             local xrad = xradarray[offset+1]
  97.             local yrad = yradarray[offset+1]
  98.             gui.box(x+xrad,y,x-xrad,y-yrad,"#FF000060","#FF0000FF")
  99.             gui.line(x,y,x,y-yrad,"#FFFF00FF")
  100.         end
  101.     end
  102. end
  103.  
  104. local function objects()
  105.     for i = 0,3,1 do
  106.         local active = bit.band(memory.readbyte(0xC0),memory.readbyte(0xE66F + i))
  107.         if active > 0 then
  108.             active = bit.band(memory.readbyte(0x4D1 + i),8)
  109.             if active == 0 then
  110.                 x = memory.readbyte(ox + i)
  111.                 y = memory.readbyte(oy + i)
  112.                 gui.line(x,y,x,y-0x10,"#00FFF0FF")
  113.                 gui.box(x-0x0C,y,x+0x0C,y-0x10,"#00FFF060","#00FFF0FF")
  114.             end
  115.         end
  116.     end
  117. end
  118.  
  119. emu.registerbefore(function()
  120.     Ryu()
  121.     enemies()
  122.     weapons()
  123.     objects()
  124. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement