Advertisement
Guest User

SGnG chest hitbox display for bizhawk

a guest
Dec 13th, 2017
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. memory.usememorydomain("CARTROM")
  2.  
  3.  
  4. local function chestHitbox()
  5. cam_x = mainmemory.read_u16_le(0x15DD)
  6. cam_y = mainmemory.read_u16_le(0x15E1)
  7.  
  8. offset = 0x90F
  9. slots = 0x1F
  10.  
  11. for i = 0, slots, 1 do
  12. asd = mainmemory.read_u16_le(offset)
  13. asd2 = mainmemory.read_u16_le(offset+4)
  14. if asd == 0x0101 and asd2 == 0x02B6 then
  15. type = bit.lshift(mainmemory.readbyte(offset + 0x06), 1)
  16. x_rad = memory.read_u8(0x5BDE + type)
  17. y_rad = memory.read_u8(0x5BDE + type + 1)
  18. x_pos = mainmemory.read_u16_le(offset + 0x1F)
  19. y_pos = mainmemory.read_u16_le(offset + 0x22)
  20. gui.drawRectangle(x_pos - cam_x - x_rad, y_pos - cam_y - y_rad, x_rad * 2, y_rad * 2, 0x9900FF00, 0) --hitbox
  21.  
  22. chestNumber = mainmemory.read_u8(0x0337)
  23. gui.drawText(x_pos - cam_x - x_rad, y_pos - cam_y - y_rad, chestNumber + 1, 0xBBFFFFFF, 0, 10)
  24. end
  25. offset = offset + 0x41
  26. end
  27. end
  28.  
  29.  
  30. while true do
  31. chestHitbox()
  32.  
  33. emu.frameadvance()
  34. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement