Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Shadowrun SNES mouse script for BizHawk
- -- Inspired by Gamachara's script for snes9x-rr which can be found
- -- here: https://github.com/Gamachara/SNES-Shadowrun-Mouse-Script/)
- -- Left click attacks, right click interacts, middle click casts spells.
- -- Reload the script to toggle mouse control on or off.
- function shadowrun_mouse()
- mouse = input.getmouse()
- if (mouse.X >= 0 and mouse.X < 256 and mouse.Y >= 0 and mouse.Y < 224) then
- if (memory.readbyte(0x0001F5) == 255) then
- offset = {X=0, Y=0}
- if (memory.readbyte(0x0001F4) == 0xFE) then
- -- Player has crosshair (attack) cursor selected
- offset = {X=-7, Y=-6}
- end
- x = math.max(3, math.min(mouse.X + offset.X, 239))
- y = math.max(3, math.min(mouse.Y + offset.Y, 206))
- memory.writebyte(0x0001F1, x)
- memory.writebyte(0x0001F3, y)
- end
- if (mouse.Left) then
- joypad.set({["P1 A"]=true}) -- Attack
- elseif (mouse.Right) then
- joypad.set({["P1 B"]=true}) -- Interact
- elseif (mouse.Middle) then
- joypad.set({["P1 X"]=true}) -- Cast
- end
- end
- end
- if (not event.unregisterbyname("Shadowrun mouse handler")) then
- event.onframestart(shadowrun_mouse, "Shadowrun mouse handler")
- console.log("* Mouse control on")
- else
- console.log("* Mouse control off")
- end
Add Comment
Please, Sign In to add comment