Path: blob/master/Assets/Lua/SNES/Super Castlevania 4.lua
2 views
----------------------------1----Super Castlevania IV----2----------------------------34--Author Pasky1356---------------7----TOGGLES----8---------------910--Box type toggles11local candle = true12local enemy = true13local player = true141516--Center axis toggles17local player_axis = false18local whip_axis = false19local projectile_axis = true20local enemy_axis = true21local candle_axis = false2223--Hitpoint display24local playerhp = true25local enemyhp = true2627--Cheats28local cheats = false2930------------------31---END TOGGLES----32------------------333435---------------36----GLOBALS----37---------------3839local pbase = 0x54040local ebase = 0x58041local wbase = 0x20042local pjbase = 0x4404344local ux = 0xA45local uy = 0xE4647local uxrad = 0x2848local uyrad = 0x2A4950local eactive = 0x105152local camx = 0x128053local camy = 0x12985455local elife = 0x065657local plife = 0x13F458local hearts = 0x13F259local facing = 0x057860local timer = 0x13F06162local xs = client.screenwidth() / 25663local ys = client.screenheight() / 22464-------------------65----END GLOBALS----66-------------------6768local function centeraxis(x,y)69gui.drawLine(x,y+2,x,y-2,0xFFFFFFFF)70gui.drawLine(x+2,y,x-2,y,0xFFFFFFFF)71end7273local function player_hitbox()74local x = mainmemory.read_u16_le(pbase+ux) - mainmemory.read_u16_le(camx)75local y = mainmemory.read_u16_le(pbase+uy) - mainmemory.read_u16_le(camy)76local cr = mainmemory.read_u8(0x576)7778if cr ~= 0x0F then79gui.drawBox(x+7,y+27,x-7,y-19,0xFF0000FF,0x400000FF)80if playerhp == true then81gui.text((x-10) * xs,(y-26) * ys,"HP:" .. mainmemory.read_u8(plife))82end83else84gui.drawBox(x+7,y+cr,x-7,y-cr,0xFF0000FF,0x400000FF)85if playerhp == true then86gui.text((x-10) * xs,(y-cr-7) * ys,"HP:" .. mainmemory.read_u8(plife))87end88end89909192if player_axis == true then93centeraxis(x,y)94end9596end9798local function player_projectiles()99local base = 0100local x101local y102local xrad103local yrad104local oend = 3105106for i = 0,oend,1 do107108base = pjbase + (i * 0x40)109110if i == 0 then111base = pjbase112end113114if mainmemory.read_u16_le(base) ~= 0 then115x = mainmemory.read_u16_le(base+ux) - mainmemory.read_u16_le(camx)116y = mainmemory.read_u16_le(base+uy) - mainmemory.read_u16_le(camy)117xrad = mainmemory.read_u16_le(base+uxrad)118yrad = mainmemory.read_u16_le(base+uyrad)119gui.drawBox(x-xrad,y-yrad,x+xrad,y+yrad,0xFFFFFFFF,0x40FFFFFF)120121if projectile_axis == true then122centeraxis(x,y)123end124125end126127end128end129130local function player_whip()131132local base = 0133local x134local y135local xrad136local yrad137local oend = 8138139for i = 0,oend,1 do140141base = wbase + (i * 0x40)142143if i == 0 then144base = wbase145end146147if mainmemory.read_u16_le(base) ~= 0 then148x = mainmemory.read_u16_le(base+ux) - mainmemory.read_u16_le(camx)149y = mainmemory.read_u16_le(base+uy) - mainmemory.read_u16_le(camy)150xrad = mainmemory.read_u16_le(base+uxrad)151yrad = mainmemory.read_u16_le(base+uyrad)152153if xrad == 0 and yrad == 0 then154if base == 0x0400 then155gui.drawBox(x-0x10,y-0x04,x+0x10,y+0x04,0xFFFFFFFF,0x40FFFFFF)156else157gui.drawBox(x-0x04,y-0x04,x+0x04,y+0x04,0xFFFFFFFF,0x40FFFFFF)158end159else160gui.drawBox(x-xrad,y-yrad,x+xrad,y+yrad,0xFFFFFFFF,0x40FFFFFF)161end162163if whip_axis == true then164centeraxis(x,y)165end166end167168end169end170171local function object_hitbox()172local base = 0173local x174local y175local xrad176local yrad177local oend = 36178local drawn179local life180for i = 0,oend,1 do181182base = ebase + (i * 0x40)183drawn = false184185if i == 0 then186base = ebase187elseif188base == 0x540 then189drawn = true190end191192if mainmemory.read_u16_le(base+0x10) == 0x0E then193if candle == true then194x = mainmemory.read_u16_le(base+ux) - mainmemory.read_u16_le(camx)195y = mainmemory.read_u16_le(base+uy) - mainmemory.read_u16_le(camy)196xrad = mainmemory.read_u16_le(base+uxrad)197yrad = mainmemory.read_u16_le(base+uyrad)198gui.drawBox(x-xrad,y-yrad,x+xrad,y+yrad,0xFFFFD000,0x40FFD000)199drawn = true200201if candle_axis == true then202centeraxis(x,y)203end204end205206end207208if mainmemory.read_u16_le(base+0x10) ~= 0 and drawn == false then209210x = mainmemory.read_u16_le(base+ux) - mainmemory.read_u16_le(camx)211y = mainmemory.read_u16_le(base+uy) - mainmemory.read_u16_le(camy)212xrad = mainmemory.read_u16_le(base+uxrad)213yrad = mainmemory.read_u16_le(base+uyrad)214life = mainmemory.read_u16_le(base+elife)215216gui.drawBox(x-xrad,y-yrad,x+xrad,y+yrad,0xFFFF0000,0x40FF0000)217drawn = true218219if enemyhp == true then220if life > 0 and life ~= 255 then221gui.text((x-10) * xs,(y-yrad-7) * ys,"HP:" .. life)222end223end224if enemy_axis == true then225centeraxis(x,y)226end227end228229230end231end232233local function cheat()234memory.writebyte(plife,16)235memory.writeword(timer,1024)236memory.writebyte(hearts,32)237end238239local function scaler()240xs = client.screenwidth() / 256241ys = client.screenheight() / 224242end243244while true do245scaler()246if player == true then247player_hitbox()248player_whip()249player_projectiles()250end251252if enemy == true then253object_hitbox()254end255if cheats == true then256cheat()257end258emu.frameadvance()259end260261