Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Player
- local px = 0x0086
- local py = 0x008A
- local projxbase = 0x4BB -- Object X speed base is 0x4C1
- local projybase = 0x4Be -- Object Y speed base ix 0x4C4
- --Enemies
- local ex = 0x0460
- local ey = 0x0480
- local efacing = 0x440
- local etype = 0x0438
- --Objects
- local ox = 0x4D9
- local oy = 0x4E1
- local otype
- -- Enemy box arrays, since the ROM values are bankswitched very quickly, it's impossible to load
- -- All these values real time without double drawing the boxes on a breakpoint, instead
- -- I've created an array that contains all the values the game uses and reads from this
- -- This provides the same effect. They're located at 0x3310 for the xradius's in Rom
- -- And 0x3410 for the Yradius's.
- local xradarray = {0x0A,0x0A,0x14,0x0A,0x0A,0x10,0x10,0x0A,0x14,0x14,0x0A,0x0C,0x0C,0x0C,0x0C,0x14,
- 0x14,0x14,0x14,0x0C,0x0C,0x14,0x14,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0C,0x0A,0x0A,0x16,0x16,0x16,0x0C,
- 0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0C,0x0A,0x0A,0x0A,0x0A,0x14,0x0A,0x14,0x14,0x14,0x14,0x0A,0x0A,0x0A,
- 0x0A,0x0A,0x14,0x14,0x0A,0x0A,0x0C,0x0C,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x1C,0x18,0x0A,0x0A,
- 0x0A,0x0A,0x1C,0x1C,0x1C,0x1C,0x18,0x18,0x0C,0x14,0x14,0x14,0x0C,0x10,0x10,0x18,0x18,0x18,0x18,0x18,
- 0x10,0x10,0x10,0x0C,0x10,0x18,0x10,0x18,0x00,0x10,0x18,0x18,0x1C,0x20,0x20,0x1C,0x1C,0x10,0x10,0x10,
- 0x10,0x10,0x10,0x0C,0x00,0x00,0x00,0x00,0x18,0x18,0x10,0x10,0x10,0x10,0x18,0x10,0x1C,0x10}
- local yradarray = {0x18,0x18,0x18,0x10,0x10,0x18,0x18,0x28,0x18,0x18,0x20,0x10,0x10,0x10,0x10,0x10,
- 0x10,0x10,0x10,0x08,0x04,0x08,0x08,0x18,0x18,0x18,0x18,0x10,0x10,0x08,0x18,0x18,0x18,0x18,0x18,0x08,
- 0x08,0x08,0x18,0x18,0x18,0x18,0x08,0x08,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x10,0x18,
- 0x18,0x18,0x18,0x18,0x18,0x18,0x08,0x08,0x00,0x00,0x00,0x00,0x00,0x28,0x28,0x28,0x28,0x28,0x28,0x28,
- 0x28,0x28,0x18,0x18,0x18,0x18,0x28,0x38,0x08,0x14,0x14,0x20,0x08,0x08,0x08,0x38,0x38,0x38,0x38,0x38,
- 0x63,0x48,0x08,0x18,0x08,0x10,0x08,0x10,0x00,0x08,0x38,0x38,0x18,0x38,0x38,0x48,0x48,0x08,0x08,0x08,
- 0x08,0x08,0x08,0x08,0x00,0x00,0x00,0x00,0x38,0x38,0x08,0x08,0x18,0x18,0x18,0x18,0x18,0x08}
- local function Ryu()
- local x = memory.readbyte(px)
- local y = memory.readbyte(py)
- local yrad = memory.readbyte(0x90)
- local act = memory.readbyte(0x83)
- local subwep = memory.readbyte(0xC9)
- local flip = 0
- local swdactive = memory.readbyte(0x83)
- if bit.band(memory.readbyte(0x84),0x40) == 0x40 then
- flip = 1
- end
- --Spin slash check
- if subwep == 0x85 then
- if memory.readbyte(0x83) >= 0x0C and memory.readbyte(0x83) <= 0x0F then
- gui.box(x+9,y,x-9,y-yrad,"#FFFF0060","#FFFF00FF")
- end
- end
- --Check if Ryu is attacking with sword 7 = stand/jump, A = crouching
- if swdactive == 7 or swdactive == 0x0A then
- if flip == 0 then
- gui.box(x,y-yrad,x+0x20,y-yrad+0x10)
- else
- gui.box(x,y-yrad,x-0x20,y-yrad+0x10)
- end
- end
- -- Check spinning flame subweapon
- if subwep == 0x84 then
- if memory.readbyte(0x4C8) > 0 then
- gui.box(x+9,y,x-9,y-yrad,"#FFFF0060","#FFFF00FF")
- end
- end
- gui.line(x,y,x,y-yrad,"#0000FFFF")
- end
- local function weapons()
- for i = 0,2,1 do
- active = bit.band(memory.readbyte(0xC8),memory.readbyte(0xE66F + i))
- if active > 0 then
- local wtype = bit.band(memory.readbyte(0xC9),0x7F)
- local x = memory.readbyte(projxbase + i)
- local y = memory.readbyte(projybase + i)
- local xrad = memory.readbyte(0xE605 + wtype)
- gui.box(x+xrad,y,x-xrad,y-xrad,"#FF00FF60","#FF00FFFF")
- end
- end
- end
- local function enemies()
- for i = 0,8,1 do
- local active = bit.band(memory.readbyte(0x73),memory.readbyte(0xE66F + i))
- if active > 0 then
- local offset = memory.readbyte(etype + i)
- local x = memory.readbyte(ex + i)
- local y = memory.readbyte(ey + i)
- local xrad = xradarray[offset+1]
- local yrad = yradarray[offset+1]
- gui.box(x+xrad,y,x-xrad,y-yrad,"#FF000060","#FF0000FF")
- gui.line(x,y,x,y-yrad,"#FFFF00FF")
- end
- end
- end
- local function objects()
- for i = 0,3,1 do
- local active = bit.band(memory.readbyte(0xC0),memory.readbyte(0xE66F + i))
- if active > 0 then
- active = bit.band(memory.readbyte(0x4D1 + i),8)
- if active == 0 then
- x = memory.readbyte(ox + i)
- y = memory.readbyte(oy + i)
- gui.line(x,y,x,y-0x10,"#00FFF0FF")
- gui.box(x-0x0C,y,x+0x0C,y-0x10,"#00FFF060","#00FFF0FF")
- end
- end
- end
- end
- emu.registerbefore(function()
- Ryu()
- enemies()
- weapons()
- objects()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement