Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local px = 0x38C
- local py = 0x354
- local pl = 0x45
- local ex = 0x38C
- local ey = 0x354
- local function hex(val)
- val = string.format("%X",val)
- return val
- end
- local function whip()
- local box = {0,0,0} -- xoff/yoff/xrad/yrad
- local wtype = memory.readbyte(0x70)
- local pos = bit.band(memory.readbyte(0x434),0x7F) -- Simons acting positon (jumping/crouching, etc...)
- box[1] = rom.readbytesigned(0x1E46D + wtype)
- wtype = wtype * 2
- box[2] = rom.readbytesigned(0x1E470 + pos)
- box[3] = rom.readbyte(0x1E474 + wtype)
- box[4] = rom.readbyte(0x1E475 + wtype)
- if memory.readbyte(0x450) == 1 then -- Simon is facing left
- box[1] = box[1] * -1
- box[3] = box[3] * -1
- end
- return box
- end
- local function player()
- local x = memory.readbyte(px)
- local y = memory.readbyte(py)
- local box
- gui.box(x+4,y+memory.readbyte(0x5F),x-4,y-memory.readbyte(0x5F),"#0000FF40","#0000FFFF")
- if memory.readbyte(0x568) == 0x11 then -- Whip is active
- box = whip()
- gui.box(x+box[1]+box[3],y+box[2]+box[4],x+box[1]-box[3],y+box[2]-box[4],"#FFFFFF40","#FFFFFFFF")
- end
- end
- local function buildbox(i)
- local box = {0,0} -- xrad/yrad
- local offset = memory.readbyte(0x434 + i)
- local dracform
- if offset == 0x1D then
- dracform = memory.readbyte(0x7A)
- if dracform == 1 then -- Dracula's 2nd form
- offset = 0x30 * 2
- else -- Dracula's 2nd form
- offset = offset * 2
- end
- else
- offset = offset * 2
- end
- box = { rom.readbyte(0x1E47A + offset),rom.readbyte(0x1E47B + offset) }
- return box
- end
- local function getcolor(x)
- local color = {0,0} -- Fill/Outline
- if x >= 0x28 and x < 0x30 then
- color = {"#FFA50040","#FFA500F0"}
- elseif x >= 0x30 and x <= 0x35 then
- return color
- elseif x == 0x17 then -- Simon subweapon
- color = {"#00FFFF40","#00FFFFFF"}
- elseif x == 0x1D then -- Dracula invuln box
- color = {"#FF000040","#FFFFFFFF"}
- else
- color = {"#FF000040","#FF0000FF"}
- end
- return color
- end
- local function objects()
- local x
- local y
- local active
- local box
- local etype
- local c
- local oob
- for i = 4,20,1 do
- oob = memory.readbyte(0x300 + i)
- if oob == 0 or oob == 0x80 then
- box = buildbox(i)
- etype = memory.readbyte(0x434 + i)
- c = getcolor(etype)
- x = memory.readbyte(ex + i)
- y = memory.readbyte(ey + i)
- gui.box(x+box[1],y+box[2],x-box[1],y-box[2],c[1],c[2])
- if etype == 0x1D then -- Dracula's invuln box
- gui.line(x+box[1],y,x-box[1],y)
- gui.line(x,y+box[2],x,y-box[2])
- end
- end
- end
- end
- emu.registerafter(function()
- player()
- objects()
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement