Advertisement
Guest User

The Firemen Hitbox Viewer

a guest
Feb 20th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.15 KB | None | 0 0
  1. -- The Firemen Hitbox Viewer
  2. -- Author: Omnigamer
  3. -- 2/20/16
  4.  
  5. function draw_cross(x_pos,y_pos, color)
  6.     gui.drawLine(x_pos-3,y_pos,x_pos+3,y_pos, color)
  7.     gui.drawLine(x_pos,y_pos-3,x_pos,y_pos+3, color)
  8. end
  9.  
  10. while true do
  11.  
  12.     camx = mainmemory.read_u16_le(0x0008A7) - 128;
  13.     camy = mainmemory.read_u16_le(0x0008DB) - 128;
  14.    
  15.     hp = mainmemory.read_u8(0x0015C3)
  16.     gui.drawText(3,30,string.format("HP: %d",hp))
  17.  
  18.     memory.usememorydomain("CARTROM")
  19.    
  20.     --Pete Coords
  21.     x_coord = mainmemory.read_u16_le(0x0008A7)
  22.     y_coord = mainmemory.read_u16_le(0x0008DB)
  23.    
  24.     draw_cross(x_coord - camx,y_coord-camy, "blue");
  25.    
  26.    
  27.     --Danny Coords
  28.     x_coord = mainmemory.read_u16_le(0x00091c)
  29.     y_coord = mainmemory.read_u16_le(0x000920)
  30.    
  31.     draw_cross(x_coord - camx,y_coord-camy, "green");
  32.    
  33.     --Water hitboxes
  34.     for i = 0x00,10 do
  35.        
  36.         ID = mainmemory.read_u16_le(0x0009D4+i*0x10);
  37.         active = mainmemory.read_u16_le(0x0009D2+i*0x10);
  38.         active2 = mainmemory.read_u16_le(0x0009c8+i*0x10);
  39.         if((active ==0) and (active2 == 0)) then
  40.        
  41.             x_coord = mainmemory.read_u16_le(0x0009ca+i*0x10)
  42.             y_coord = mainmemory.read_u16_le(0x0009cc+i*0x10)
  43.            
  44.             if(ID == 0) then
  45.                 gui.drawRectangle(x_coord-camx-5,y_coord-camy-5,5*2, 5*2,"white")
  46.             elseif(ID==1) then
  47.                 if(mainmemory.read_u16_le(0x0009D6+i*0x10)==1)then
  48.                     gui.drawRectangle(x_coord-camx-0xf,y_coord-camy-0xf,0xf*2, 0xf*2,"white")
  49.                 end
  50.             end
  51.            
  52.         end
  53.     end
  54.    
  55.    
  56.     --Fire hitboxes
  57.     for i = 0x00,0x0C do
  58.        
  59.         ID = mainmemory.read_u16_le(0x000BE9+i*0x20);
  60.         HP = mainmemory.read_u16_le(0x000BFB+i*0x20)
  61.        
  62.         if((ID <0x8000) and (HP <0x8000)) then
  63.        
  64.             x_coord = mainmemory.read_u16_le(0x000BEB+i*0x20)
  65.             y_coord = mainmemory.read_u16_le(0x000BEF+i*0x20)
  66.            
  67.             gui.drawText(x_coord-camx,y_coord-20-camy,string.format("%X", HP));
  68.  
  69.             offset = mainmemory.read_u16_le(0x000BF9+i*0x20)*32;
  70.  
  71.             start_address = memory.read_u16_le(0x012ad5+ID*2)+offset+0x8000;
  72.            
  73.             hitbox_x = memory.read_u16_le(start_address+10);
  74.             hitbox_y = memory.read_u16_le(start_address+12);
  75.  
  76.             gui.drawRectangle(x_coord-camx-hitbox_x,y_coord-camy-hitbox_y,hitbox_x*2, hitbox_y*2,"red")
  77.         end
  78.     end
  79.  
  80.     emu.frameadvance()
  81. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement