Advertisement
Jimmie1717

BizHawk: Majora's Mask (U) Explosive Positions

Jan 22nd, 2017
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.04 KB | None | 0 0
  1. -- Majora's Mask (U): Explosives Positions Script
  2. -- by Jimmie1717
  3. -- BizHawk 1.11.8.2
  4.  
  5. -- Setup for 640x480 Display.
  6. -- Positions will be shown in the bottle right corner.
  7. -- Adjust "anchor_x/y" on lines 24/25 if you want it to display somewhere else on screen.
  8.  
  9. console.clear();
  10. gui.defaultTextBackground(0x00000000);
  11.  
  12. -- Global
  13. readDWord               = memory.read_u32_be;
  14. readFloat               = memory.readfloat;
  15. writeDWord              = memory.write_u32_be;
  16. writeFloat              = memory.writefloat;
  17. drawText                = gui.drawText;
  18.  
  19. -- Explosive Pointer
  20. local explosive_pointer = 0x3E87F8;
  21.  
  22. function explosivesPositionsDisplay()
  23.  
  24.     local anchor_x      = 579;
  25.     local anchor_y      = 320;
  26.    
  27.     local pointer       = readDWord(explosive_pointer);
  28.    
  29.     -- Loop through current explosives out.
  30.     for i = 1, 3, 1 do
  31.    
  32.         if (pointer ~= 0x00000000 and pointer > 0x80000000) then
  33.             local x     = pointer - 0x80000000 + 0x00000024;
  34.             local y     = pointer - 0x80000000 + 0x00000028;
  35.             local z     = pointer - 0x80000000 + 0x0000002C;
  36.            
  37.             drawText(anchor_x + 1, anchor_y + 1, string.format("%s %d:", "Bomb ", i), "BLACK");
  38.             drawText(anchor_x + 0, anchor_y + 0, string.format("%s %d:", "Bomb ", i));
  39.             drawText(anchor_x + 6, anchor_y + 13, string.format("% 7.1f", readFloat(x, true)), "BLACK");
  40.             drawText(anchor_x + 5, anchor_y + 12, string.format("% 7.1f", readFloat(x, true)));
  41.             drawText(anchor_x + 6, anchor_y + 25, string.format("% 7.1f", readFloat(y, true)), "BLACK");
  42.             drawText(anchor_x + 5, anchor_y + 24, string.format("% 7.1f", readFloat(y, true)));
  43.             drawText(anchor_x + 6, anchor_y + 37, string.format("% 7.1f", readFloat(z, true)), "BLACK");
  44.             drawText(anchor_x + 5, anchor_y + 36, string.format("% 7.1f", readFloat(z, true)));
  45.            
  46.             anchor_y    = anchor_y + 54;
  47.            
  48.             pointer     = readDWord(pointer - 0x80000000 + 0x0000012C);
  49.         else
  50.             break;
  51.         end
  52.        
  53.     end
  54. end
  55.  
  56. -- Core Loop
  57. while true do
  58.        
  59.     -- Call Display Function if the pointer is not null.
  60.     if (readDWord(explosive_pointer) ~= 0x00000000) then
  61.         explosivesPositionsDisplay();
  62.     end
  63.    
  64.     emu.frameadvance()
  65.        
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement