Path: blob/master/Assets/Lua/SNES/Super Ghouls N Ghost.lua
2 views
----------------------------------------------------1--Super Ghouls n' Ghosts Hitbox Display Lua Script--2----------------------------------------------------34--Author Pasky13567---Blue = Arthur's Hitbox8---Red = If this box touches arthur's he is damaged9---Green = Projectile vulnerability for enemies10---White = Arthurs magic and weapons1112local left_edge = 0x15DD13local top_edge = 0x15E114local xm15local ym1617memory.usememorydomain("CARTROM")1819function findbit(p)20return 2 ^ (p - 1)21end2223function hasbit(x, p)24return x % (p + p) >= p25end2627local function draw_axis(x,y)28gui.drawLine(x,y-2,x,y+2,0x80FFFFFF)29gui.drawLine(x-2,y,x+2,y,0x80FFFFFF)30end3132local function draw_arthur()33local arthur = 0x43C34local pointoff = bit.lshift(bit.lshift(bit.band(mainmemory.read_u8(arthur + 0x09),0x01),1),1)35local yrad = memory.read_u8(0x3963 + pointoff)36local xrad = memory.read_u8(0x3963 + pointoff + 1)37local yoff = memory.read_s8(0x3965 + pointoff)38local xoff = memory.read_s8(0x3965 + pointoff + 1)39local x = mainmemory.read_u16_le(arthur + 0x1F)40local y = mainmemory.read_u16_le(arthur + 0x22)4142x = x - mainmemory.read_u16_le(left_edge)43y = y - mainmemory.read_u16_le(top_edge)44gui.drawBox((x+xoff) - (xrad), (y+yoff) - (yrad), (x+xoff) + (xrad), (y+yoff) + (yrad),0xF00000FF,0x300000FF)45--Comment/Uncomment out next line to Show/hide arthur's hitbox center axis46--draw_axis(x,y)47end4849local function draw_projvuln(x,y,xrad,yrad,base)50gui.drawBox(x - (xrad), y - (yrad), x + (xrad), y + (yrad),0xF02AFF00,0x402AFF00)51end52535455local function draw_enemies()5657local ostart = 0x090F58local oend = 3059local base = 060local pointoff = 061local xrad = 062local yrad = 063local x = 064local y = 06566for i = 0,oend,1 do6768if i ~= 0 then69base = ostart + (0x41 * i)70else71base = ostart72end737475if hasbit(mainmemory.read_u8(base + 0x09),findbit(7)) == true then7677if mainmemory.read_u8(base+1) ~= 0 and mainmemory.read_u8(base) ~= 0 then7879pointoff = bit.lshift(bit.band(mainmemory.read_u8(base + 0x06),0x00FF),1)80xrad = memory.read_u8(0x56E1 + pointoff)81yrad = memory.read_u8(0x56E2 + pointoff)82x = mainmemory.read_u16_le(base + 0x1F)83y = mainmemory.read_u16_le(base + 0x22)8485life = mainmemory.read_u8(base + 0x0E)8687x = x - mainmemory.read_u16_le(left_edge)88y = y - mainmemory.read_u16_le(top_edge)8990--Red boxes91gui.drawBox(x - (xrad), y - (yrad), x + (xrad), y + (yrad),0xFFFF0000,0x70FF0000)92xrad = memory.read_u8(0x585D + pointoff)93yrad = memory.read_u8(0x585E + pointoff)9495--Comment/Uncomment out next line to hide/show drawing the projectile vulnerability boxes9697draw_projvuln(x,y,xrad,yrad,base)9899if life > 0 then100--Comment out next line to hide HP display over objects101gui.text(x * xm, (y-10) * ym, life)102end103104--Comment out next line to hide box center axis105draw_axis(x,y)106107end108end109110end111end112113local function draw_weapons()114115local ostart = 0x047D116local oend = 9117local base = 0118local weapon = 0x14D3119local dmg = 0120local pointoff = 0121local wep_xrad = 0122local wep_yrad = 0123local mag_xrad = 0124local mag_yrad = 0125local x = 0126local y = 0127128pointoff = bit.lshift(mainmemory.read_u8(weapon),1)129wep_xrad = memory.read_u8(0x398b + pointoff)130wep_yrad = memory.read_u8(0x398c + pointoff)131mag_xrad = memory.read_u8(0x39ab + pointoff)132mag_yrad = memory.read_u8(0x39ac + pointoff)133134for i = 0,oend,1 do135136137if i ~= 0 then138base = ostart + (0x41 * i)139else140base = ostart141end142143if mainmemory.read_u8(base+1) ~= 0 and mainmemory.read_u8(base) ~= 0 then144x = mainmemory.read_u16_le(base + 0x1F)145y = mainmemory.read_u16_le(base + 0x22)146147dmg = mainmemory.read_u8(base + 0x0E)148149x = x - mainmemory.read_u16_le(left_edge)150y = y - mainmemory.read_u16_le(top_edge)151gui.drawBox(x - (wep_xrad), y - (wep_yrad), x + (wep_xrad), y + (wep_yrad),0xFFFFFFFF,0x40FFFFFF)152153if dmg > 0 then154--Comment out next line to hide weapon DMG display over objects155gui.text(x * xm, (y-10) * ym, dmg)156end157--Comment out next line to hide box center axis158--draw_axis(x,y)159160end161end162163-- If we have the gold armor and not the magic bracelet, check for magic hitboxes164if mainmemory.read_u8(0x14BA) == 0x04 and mainmemory.read_u8(weapon) ~= 0x0E then165166ostart = 0x0707167168for i = 0,oend-2,1 do169170if i ~= 0 then171base = ostart + (0x41 * i)172else173base = ostart174end175176if mainmemory.read_u8(base+1) ~= 0 and mainmemory.read_u8(base) ~= 0 then177x = mainmemory.read_u16_le(base + 0x1F)178y = mainmemory.read_u16_le(base + 0x22)179180dmg = mainmemory.read_u8(base + 0x0E)181182x = x - mainmemory.read_u16_le(left_edge)183y = y - mainmemory.read_u16_le(top_edge)184gui.drawBox(x - (mag_xrad), y - (mag_yrad), x + (mag_xrad), y + (mag_yrad),0xFFFFFFFF,0x40FFFFFF)185186if dmg > 0 then187--Comment out next line to hide magic DMG display over objects188gui.text(x * xm, (y-10) * ym, dmg)189end190--Comment out next line to hide box center axis191--draw_axis(x,y)192end193194end195end196197end198199local function scaler()200xm = client.screenwidth() / 256201ym = client.screenheight() / 224202end203204while true do205scaler()206draw_arthur()207draw_enemies()208draw_weapons()209emu.frameadvance()210end211212213