Advertisement
Dessyreqt

Super Metroid Info Script

Feb 25th, 2012
514
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.47 KB | None | 0 0
  1. runningTimerSpeed = 3
  2.  
  3. --Game-specific RAM addresses
  4. RAM = {
  5.     words = {
  6.         hour = 0x7e09e0,
  7.         min = 0x7e09de,
  8.         sec = 0x7e09dc,
  9.         mil = 0x7e09da,
  10.         missiles = 0x7e09c8,
  11.         superMissiles = 0x7e09cc,
  12.         powerBombs = 0x7e09d0,
  13.         energyTanks = 0x7e09c4,
  14.         reserveTanks = 0x7e09d4,
  15.         items = 0x7e09a4,
  16.         weapons = 0x7e09a8,
  17.         health = 0x7e09c2,
  18.         reserve = 0x7e09d6,
  19.         roomNumber = 0x7e079c,
  20.         enemyHealth1 = 0x7e0f8c,
  21.         enemyHealth2 = 0x7e0fcc
  22.     },
  23.     bytes = {
  24.         finalBossState = 0x7e0e4b,
  25.         runningAnimation = 0x7e0aca,
  26.         items1 = 0x7ed870,
  27.         items2 = 0x7ed871,
  28.         items3 = 0x7ed872,
  29.         items4 = 0x7ed873,
  30.         items5 = 0x7ed874,
  31.         items6 = 0x7ed875,
  32.         items7 = 0x7ed876,
  33.         items8 = 0x7ed877,
  34.         items9 = 0x7ed878,
  35.         items10 = 0x7ed879,
  36.         items11 = 0x7ed87a,
  37.         items12 = 0x7ed880,
  38.         items13 = 0x7ed881,
  39.         items14 = 0x7ed882,
  40.         items15 = 0x7ed883,
  41.         beamCharge = 0x7e0dc2
  42.     }
  43. }
  44.  
  45. --Locations to output text
  46. output = {
  47.     x = 0,
  48.     y = 210,
  49.     yOffset = 0,
  50.     boxX = 0,
  51.     boxY = 0
  52. }
  53.  
  54. showOptions = {
  55.     time = true,
  56.     pct = true,
  57.     bossHealth = true,
  58.     shortCharge = true,
  59.     beamCharge = true,
  60.     forgotItems = false,
  61.     forgotMode = 0
  62. }
  63.  
  64. whiteBox = false
  65.  
  66. function OutputTime(outOffset)
  67.     --set in-game time
  68.     local hour = memory.readword(RAM.words.hour)
  69.     local minute = memory.readword(RAM.words.min)
  70.     local sec = memory.readword(RAM.words.sec)
  71.     local mil = math.floor(memory.readword(RAM.words.mil) * 100 / 60)
  72.  
  73.     gui.text(output.x, output.y - output.yOffset, "(T) Time: " .. hour .. ":" .. string.format("%02d",minute) .. ":" .. string.format("%02d",sec) .. "." .. string.format("%02d",mil))
  74.     output.yOffset = output.yOffset + 10
  75. end
  76.  
  77. function OutputPct(outOffset)
  78.     local missiles = math.floor(memory.readbyte(RAM.words.missiles) / 5)
  79.     local superMissiles = math.floor(memory.readbyte(RAM.words.superMissiles) / 5)
  80.     local powerBombs = math.floor(memory.readbyte(RAM.words.powerBombs) / 5)
  81.     local energyTanks = math.floor((memory.readword(RAM.words.energyTanks) - 99) / 100)
  82.     local reserveTanks = math.floor(memory.readword(RAM.words.reserveTanks) / 100)
  83.  
  84.     local items = memory.readword(RAM.words.items)
  85.     local variaSuit = items % 2
  86.     local springBall = math.floor((items % 4) / 2)
  87.     local morphBall = math.floor((items % 8) / 4)
  88.     local screwAttack = math.floor((items % 16) / 8)
  89.     local gravitySuit = math.floor((items % 64) / 32)
  90.     local hiJumpBoots = math.floor((items % 512) / 256)
  91.     local spaceJump = math.floor((items % 1024) / 512)
  92.     local bomb = math.floor((items % 8192) / 4096)
  93.     local speedBooster = math.floor((items % 16384) / 8192)
  94.     local grappleBeam = math.floor((items % 32768) / 16384)
  95.     local xRayScope = math.floor(items / 32768)
  96.  
  97.     local weapons = memory.readword(RAM.words.weapons)
  98.     local waveBeam = weapons % 2
  99.     local iceBeam = math.floor((weapons % 4) / 2)
  100.     local spazerBeam = math.floor((weapons % 8) / 4)
  101.     local plasmaBeam = math.floor((weapons % 16) / 8)
  102.     local chargeBeam = math.floor((weapons % 8192) / 4096)
  103.  
  104.     local pct = missiles + superMissiles + powerBombs + energyTanks + reserveTanks + variaSuit + springBall + morphBall + screwAttack + gravitySuit + hiJumpBoots + spaceJump + bomb + speedBooster + grappleBeam + xRayScope + waveBeam + iceBeam + spazerBeam + plasmaBeam + chargeBeam
  105.  
  106.     gui.text(output.x, output.y - output.yOffset, "(P) Pct: " .. pct .. "%")
  107.     output.yOffset = output.yOffset + 10
  108. end
  109.  
  110. function OutputBossHealth()
  111.     local roomNumber = memory.readword(RAM.words.roomNumber)
  112.     local bossRoom = false
  113.     local finalBoss = false
  114.     local maxHealth = 0
  115.     local boxX = output.x + 90
  116.     local boxY = output.y - output.yOffset - 2
  117.    
  118.     if roomNumber == 13017 then --Botwoon
  119.         bossRoom = true
  120.         maxHealth = 3000
  121.     end
  122.    
  123.     if roomNumber == 5528 then --Chozo
  124.         bossRoom = true
  125.         maxHealth = 800
  126.     end
  127.  
  128.     if roomNumber == 2729 then --Crocomire
  129.         bossRoom = true
  130.     end
  131.  
  132.     if roomNumber == 14298 then --Draygon
  133.         bossRoom = true
  134.         maxHealth = 6000
  135.     end
  136.    
  137.     if roomNumber == 14258 then --Golden Torizo
  138.         bossRoom = true
  139.         maxHealth = 13500
  140.     end
  141.  
  142.     if roomNumber == 12197 then --Kraid
  143.         bossRoom = true
  144.         maxHealth = 1000
  145.     end
  146.    
  147.     if roomNumber == 2781 then --Mother Brain
  148.         finalBoss = true
  149.         local finalBossState = memory.readbyte(RAM.bytes.finalBossState)
  150.        
  151.         if finalBossState == 3 then
  152.             maxHealth = 3000
  153.         elseif finalBossState == 1 then
  154.             maxHealth = 18000
  155.         elseif finalBossState == 0 then
  156.             maxHealth = 36000
  157.         end
  158.     end
  159.    
  160.     if roomNumber == 2765 then --Phantoon
  161.         bossRoom = true
  162.         maxHealth = 2500
  163.     end
  164.  
  165.     if roomNumber == 1504 then --Ridley (Ceres)
  166.         bossRoom = true
  167.     end
  168.    
  169.     if roomNumber == 15027 then --Ridley
  170.         bossRoom = true
  171.         maxHealth = 18000
  172.     end
  173.    
  174.     if roomNumber == 2973 then --Spore Spawn
  175.         bossRoom = true
  176.         maxHealth = 960
  177.     end
  178.    
  179.     if bossRoom then
  180.         local bossHealth = memory.readword(RAM.words.enemyHealth1)
  181.         local bossPct = 100
  182.         local boxPct = 100
  183.        
  184.         if bossHealth == 32767 then
  185.             gui.text(output.x, output.y - output.yOffset, "(H) Boss Health: Infinite")
  186.         else           
  187.             if maxHealth ~= 0 then
  188.                 bossPct = math.floor(bossHealth / maxHealth * 100)
  189.                 boxPct = math.floor(bossHealth / maxHealth * 100)
  190.             end
  191.            
  192.             gui.box(boxX, boxY, boxX + 100, boxY + 10, "#00000080")
  193.             if bossHealth > 0 then
  194.                 gui.box(boxX, boxY, boxX + boxPct, boxY + 10, "#80000080")
  195.             end
  196.            
  197.             gui.text(output.x, output.y - output.yOffset, "(H) Boss Health: " .. bossHealth)
  198.             gui.text(boxX + 2, boxY+ 2, bossPct .. "%")
  199.         end
  200.     elseif finalBoss then
  201.         local bossHealth = memory.readword(RAM.words.enemyHealth2)
  202.    
  203.         if maxHealth ~= 0 then
  204.             bossPct = math.floor(bossHealth / maxHealth * 100)
  205.             boxPct = math.floor(bossHealth / maxHealth * 100)
  206.         end
  207.        
  208.         gui.box(boxX, boxY, boxX + 100, boxY + 10, "#00000080")
  209.         if bossHealth > 0 then
  210.             gui.box(boxX, boxY, boxX + boxPct, boxY + 10, "#80000080")
  211.         end
  212.        
  213.         gui.text(output.x, output.y - output.yOffset, "(H) Boss Health: " .. bossHealth)
  214.         gui.text(boxX + 2, boxY+ 2, bossPct .. "%")
  215.     else
  216.         gui.text(output.x, output.y - output.yOffset, "(H) Boss Health: --No Boss--")
  217.     end
  218.     output.yOffset = output.yOffset + 10
  219. end
  220.  
  221. function OutputShortCharge()
  222.     local runningAnimation = memory.readbyte(RAM.bytes.runningAnimation)
  223.     local boxX = output.x + 95
  224.     local boxY = output.y - output.yOffset
  225.  
  226.     gui.box(boxX + runningTimerSpeed * 9, boxY, boxX + runningTimerSpeed * 11, boxY + 6, "#00808080")
  227.    
  228.     if runningAnimation == 227 or runningAnimation == 245 then
  229.         gui.box(boxX + runningTimerSpeed, boxY, boxX + runningTimerSpeed, boxY + 6, "#FFFFFF80")
  230.         gui.box(boxX + runningTimerSpeed * 11, boxY, boxX + runningTimerSpeed * 11, boxY + 6, "#FFFFFF80")
  231.     elseif runningAnimation == 228 or runningAnimation == 244 then
  232.         gui.box(boxX + runningTimerSpeed * 2, boxY, boxX + runningTimerSpeed * 2, boxY + 6, "#FFFFFF80")
  233.         gui.box(boxX + runningTimerSpeed * 12, boxY, boxX + runningTimerSpeed * 12, boxY + 6, "#FFFFFF80")
  234.     elseif runningAnimation == 229 or runningAnimation == 243 then
  235.         gui.box(boxX + runningTimerSpeed * 3, boxY, boxX + runningTimerSpeed * 3, boxY + 6, "#FFFFFF80")
  236.         gui.box(boxX + runningTimerSpeed * 13, boxY, boxX + runningTimerSpeed * 13, boxY + 6, "#FFFFFF80")
  237.     elseif runningAnimation == 230 or runningAnimation == 242 then
  238.         gui.box(boxX + runningTimerSpeed * 4, boxY, boxX + runningTimerSpeed * 4, boxY + 6, "#FFFFFF80")
  239.         gui.box(boxX + runningTimerSpeed * 14, boxY, boxX + runningTimerSpeed * 14, boxY + 6, "#FFFFFF80")
  240.     elseif runningAnimation == 231 or runningAnimation == 241 then
  241.         gui.box(boxX + runningTimerSpeed * 5, boxY, boxX + runningTimerSpeed * 5, boxY + 6, "#FFFFFF80")
  242.         gui.box(boxX + runningTimerSpeed * 15, boxY, boxX + runningTimerSpeed * 15, boxY + 6, "#FFFFFF80")
  243.     elseif runningAnimation == 232 or runningAnimation == 240 then
  244.         gui.box(boxX + runningTimerSpeed * 6, boxY, boxX + runningTimerSpeed * 6, boxY + 6, "#FFFFFF80")
  245.         gui.box(boxX + runningTimerSpeed * 16, boxY, boxX + runningTimerSpeed * 16, boxY + 6, "#FFFFFF80")
  246.     elseif runningAnimation == 233 or runningAnimation == 239 then
  247.         gui.box(boxX + runningTimerSpeed * 7, boxY, boxX + runningTimerSpeed * 7, boxY + 6, "#FFFFFF80")
  248.         gui.box(boxX + runningTimerSpeed * 17, boxY, boxX + runningTimerSpeed * 17, boxY + 6, "#FFFFFF80")
  249.     elseif runningAnimation == 234 or runningAnimation == 238 then
  250.         gui.box(boxX + runningTimerSpeed * 8, boxY, boxX + runningTimerSpeed * 8, boxY + 6, "#FFFFFF80")
  251.         gui.box(boxX + runningTimerSpeed * 18, boxY, boxX + runningTimerSpeed * 18, boxY + 6, "#FFFFFF80")
  252.     elseif runningAnimation == 235 or runningAnimation == 237 then
  253.         gui.box(boxX + runningTimerSpeed * 9, boxY, boxX + runningTimerSpeed * 9, boxY + 6, "#FFFFFF80")
  254.         gui.box(boxX + runningTimerSpeed * 19, boxY, boxX + runningTimerSpeed * 19, boxY + 6, "#FFFFFF80")
  255.     elseif runningAnimation == 236 or runningAnimation == 246 then
  256.         gui.box(boxX + runningTimerSpeed * 10, boxY, boxX + runningTimerSpeed * 10, boxY + 6, "#FFFFFF80")
  257.     else
  258.         gui.box(boxX, boxY, boxX, boxY + 6, "#FFFFFF80")
  259.         gui.box(boxX + runningTimerSpeed * 10, boxY, boxX + runningTimerSpeed * 10, boxY + 6, "#FFFFFF80")
  260.         gui.box(boxX + runningTimerSpeed * 20, boxY, boxX + runningTimerSpeed * 20, boxY + 6, "#FFFFFF80")
  261.     end
  262.         gui.text(output.x, output.y - output.yOffset, "(S) Short Charge Timer:")
  263.  
  264.     output.yOffset = output.yOffset + 10
  265. end
  266.  
  267. function OutputBeamCharge()
  268.     local boxX = output.x + 90
  269.     local boxY = output.y - output.yOffset - 2
  270.     local beamCharge = math.min(memory.readbyte(RAM.bytes.beamCharge), 60)
  271.    
  272.     gui.box(boxX, boxY, boxX + 60, boxY + 10, "#00000080")
  273.  
  274.     if beamCharge > 0 then
  275.         if beamCharge < 60 or not whiteBox then
  276.             gui.box(boxX, boxY, boxX + beamCharge, boxY + 10, "#80800080")
  277.             whiteBox = true
  278.         else
  279.             gui.box(boxX, boxY, boxX + beamCharge, boxY + 10, "#ffffff80")
  280.             whiteBox = false
  281.         end
  282.     end
  283.            
  284.     gui.text(output.x, output.y - output.yOffset, "(B) Beam Charge: " .. beamCharge)
  285.     output.yOffset = output.yOffset + 10
  286. end
  287.  
  288.  
  289. function ContainsBit(number, bit)
  290.     return math.floor((number % (bit * 2)) / bit) == 1
  291. end
  292.  
  293. function values(t)
  294.     local i = 0
  295.     return function() i = i + 1; return t[i] end
  296. end
  297.  
  298. function GetCrateriaItems()
  299.     local retVal = {}
  300.     local items1 = memory.readbyte(RAM.bytes.items1)
  301.     local items2 = memory.readbyte(RAM.bytes.items2)
  302.     local i = 1
  303.    
  304.     if not ContainsBit(items1,128) then
  305.         retVal[i] = "Bomb"
  306.         i = i + 1
  307.     end
  308.     if not ContainsBit(items1,64) then
  309.         retVal[i] = "Missile (Crateria bottom)"
  310.         i = i + 1
  311.     end
  312.     if not ContainsBit(items1,32) then
  313.         retVal[i] = "Energy Tank (Crateria gauntlet)"
  314.         i = i + 1
  315.     end
  316.     if not ContainsBit(items1,16) then
  317.         retVal[i] = "Missile (Crateria moat)"
  318.         i = i + 1
  319.     end
  320.     if not ContainsBit(items1,8) then
  321.         retVal[i] = "Missile (outside Wrecked Ship middle)"
  322.         i = i + 1
  323.     end
  324.     if not ContainsBit(items1,4) then
  325.         retVal[i] = "Missile (outside Wrecked Ship top)"
  326.         i = i + 1
  327.     end
  328.     if not ContainsBit(items1,2) then
  329.         retVal[i] = "Missile (outside Wrecked Ship bottom)"
  330.         i = i + 1
  331.     end
  332.     if not ContainsBit(items1,1) then
  333.         retVal[i] = "Power Bomb (Crateria surface)"
  334.         i = i + 1
  335.     end
  336.     if not ContainsBit(items2,16) then
  337.         retVal[i] = "Missile (Crateria middle)"
  338.         i = i + 1
  339.     end
  340.     if not ContainsBit(items2,8) then
  341.         retVal[i] = "Super Missile (Crateria middle)"
  342.         i = i + 1
  343.     end
  344.     if not ContainsBit(items2,4) then
  345.         retVal[i] = "Missile (Crateria gauntlet left)"
  346.         i = i + 1
  347.     end
  348.     if not ContainsBit(items2,2) then
  349.         retVal[i] = "Missile (Crateria guantlet right)"
  350.         i = i + 1
  351.     end
  352.  
  353.     return retVal
  354. end
  355.  
  356. function GetBrinstarItems()
  357.     local retVal = {}
  358.     local items2 = memory.readbyte(RAM.bytes.items2)
  359.     local items3 = memory.readbyte(RAM.bytes.items3)
  360.     local items4 = memory.readbyte(RAM.bytes.items4)
  361.     local items5 = memory.readbyte(RAM.bytes.items5)
  362.     local items6 = memory.readbyte(RAM.bytes.items6)
  363.     local items7 = memory.readbyte(RAM.bytes.items7)
  364.     local i = 1
  365.    
  366.     if not ContainsBit(items2,128) then
  367.         retVal[i] = "Missile (green Brinstar below super missile) "
  368.         i = i + 1
  369.     end
  370.     if not ContainsBit(items2,64) then
  371.         retVal[i] = "Super Missile (pink Brinstar)"
  372.         i = i + 1
  373.     end
  374.     if not ContainsBit(items2,32) then
  375.         retVal[i] = "Power Bomb (green Brinstar bottom)"
  376.         i = i + 1
  377.     end
  378.     if not ContainsBit(items2,1) then
  379.         retVal[i] = "Energy Tank (tunnel to Brinstar)"
  380.         i = i + 1
  381.     end
  382.     if not ContainsBit(items3,128) then
  383.         retVal[i] = "Charge Beam "
  384.         i = i + 1
  385.     end
  386.     if not ContainsBit(items3,64) then
  387.         retVal[i] = "Missile (pink Brinstar bottom)"
  388.         i = i + 1
  389.     end
  390.     if not ContainsBit(items3,32) then
  391.         retVal[i] = "Missile (pink Brinstar top)"
  392.         i = i + 1
  393.     end
  394.     if not ContainsBit(items3,8) then
  395.         retVal[i] = "Missile (green Brinstar behind reserve tank) "
  396.         i = i + 1
  397.     end
  398.     if not ContainsBit(items3,4) then
  399.         retVal[i] = "Missile (green Brinstar behind missile)"
  400.         i = i + 1
  401.     end
  402.     if not ContainsBit(items3,2) then
  403.         retVal[i] = "Reserve Tank (green Brinstar)"
  404.         i = i + 1
  405.     end
  406.     if not ContainsBit(items3,1) then
  407.         retVal[i] = "Super Missile (green Brinstar)"
  408.         i = i + 1
  409.     end
  410.     if not ContainsBit(items4,128) then
  411.         retVal[i] = "Super Missile (green Brinstar bottom)"
  412.         i = i + 1
  413.     end
  414.     if not ContainsBit(items4,64) then
  415.         retVal[i] = "Energy Tank (green Brinstar bottom)"
  416.         i = i + 1
  417.     end
  418.     if not ContainsBit(items4,32) then
  419.         retVal[i] = "Energy Tank (blue Brinstar)"
  420.         i = i + 1
  421.     end
  422.     if not ContainsBit(items4,16) then
  423.         retVal[i] = "Missile (blue Brinstar middle)"
  424.         i = i + 1
  425.     end
  426.     if not ContainsBit(items4,8) then
  427.         retVal[i] = "Power Bomb (blue Brinstar)"
  428.         i = i + 1
  429.     end
  430.     if not ContainsBit(items4,4) then
  431.         retVal[i] = "Morphing Ball"
  432.         i = i + 1
  433.     end
  434.     if not ContainsBit(items4,2) then
  435.         retVal[i] = "Missile (green Brinstar pipe)"
  436.         i = i + 1
  437.     end
  438.     if not ContainsBit(items4,1) then
  439.         retVal[i] = "Power Bomb (pink Brinstar)"
  440.         i = i + 1
  441.     end
  442.     if not ContainsBit(items5,128) then
  443.         retVal[i] = "Power Bomb (red Brinstar sidehopper room)"
  444.         i = i + 1
  445.     end
  446.     if not ContainsBit(items5,64) then
  447.         retVal[i] = "X-Ray Scope"
  448.         i = i + 1
  449.     end
  450.     if not ContainsBit(items5,32) then
  451.         retVal[i] = "Missile (blue Brinstar behind missile)"
  452.         i = i + 1
  453.     end
  454.     if not ContainsBit(items5,16) then
  455.         retVal[i] = "Missile (blue Brinstar top)"
  456.         i = i + 1
  457.     end
  458.     if not ContainsBit(items5,8) then
  459.         retVal[i] = "Energy Tank (pink Brinstar top)"
  460.         i = i + 1
  461.     end
  462.     if not ContainsBit(items5,4) then
  463.         retVal[i] = "Missile (blue Brinstar bottom) "
  464.         i = i + 1
  465.     end
  466.     if not ContainsBit(items5,2) then
  467.         retVal[i] = "Energy Tank (pink Brinstar bottom)"
  468.         i = i + 1
  469.     end
  470.     if not ContainsBit(items6,16) then
  471.         retVal[i] = "Missile (Kraid)"
  472.         i = i + 1
  473.     end
  474.     if not ContainsBit(items6,8) then
  475.         retVal[i] = "Energy Tank (Kraid)"
  476.         i = i + 1
  477.     end
  478.     if not ContainsBit(items6,4) then
  479.         retVal[i] = "Spazer"
  480.         i = i + 1
  481.     end
  482.     if not ContainsBit(items6,2) then
  483.         retVal[i] = "Missile (red Brinstar spike room)"
  484.         i = i + 1
  485.     end
  486.     if not ContainsBit(items6,1) then
  487.         retVal[i] = "Power Bomb (red Brinstar spike room)"
  488.         i = i + 1
  489.     end
  490.     if not ContainsBit(items7,1) then
  491.         retVal[i] = "Varia Suit"
  492.         i = i + 1
  493.     end
  494.  
  495.     return retVal
  496. end
  497.  
  498. function GetNorfairItems()
  499.     local retVal = {}
  500.     local items7 = memory.readbyte(RAM.bytes.items7)
  501.     local items8 = memory.readbyte(RAM.bytes.items8)
  502.     local items9 = memory.readbyte(RAM.bytes.items9)
  503.     local items10 = memory.readbyte(RAM.bytes.items10)
  504.     local items11 = memory.readbyte(RAM.bytes.items11)
  505.     local i = 1
  506.  
  507.     if not ContainsBit(items7,128) then
  508.         retVal[i] = "Missile (Hi-Jump Boots)"
  509.         i = i + 1
  510.     end
  511.     if not ContainsBit(items7,64) then
  512.         retVal[i] = "Missile (above Crocomire)"
  513.         i = i + 1
  514.     end
  515.     if not ContainsBit(items7,32) then
  516.         retVal[i] = "Hi-Jump Boots"
  517.         i = i + 1
  518.     end
  519.     if not ContainsBit(items7,16) then
  520.         retVal[i] = "Energy Tank (Crocomire)"
  521.         i = i + 1
  522.     end
  523.     if not ContainsBit(items7,8) then
  524.         retVal[i] = "Missile (below Ice Beam)"
  525.         i = i + 1
  526.     end
  527.     if not ContainsBit(items7,4) then
  528.         retVal[i] = "Ice Beam "
  529.         i = i + 1
  530.     end
  531.     if not ContainsBit(items7,2) then
  532.         retVal[i] = "Missile (lava room)"
  533.         i = i + 1
  534.     end
  535.     if not ContainsBit(items8,128) then
  536.         retVal[i] = "Missile (bubble Norfair green door)"
  537.         i = i + 1
  538.     end
  539.     if not ContainsBit(items8,64) then
  540.         retVal[i] = "Missile (Norfair reserve tank)"
  541.         i = i + 1
  542.     end
  543.     if not ContainsBit(items8,32) then
  544.         retVal[i] = "Reserve Tank (Norfair)"
  545.         i = i + 1
  546.     end
  547.     if not ContainsBit(items8,16) then
  548.         retVal[i] = "Grapple Beam"
  549.         i = i + 1
  550.     end
  551.     if not ContainsBit(items8,8) then
  552.         retVal[i] = "Missile (Grapple Beam)"
  553.         i = i + 1
  554.     end
  555.     if not ContainsBit(items8,4) then
  556.         retVal[i] = "Missile (below Crocomire)"
  557.         i = i + 1
  558.     end
  559.     if not ContainsBit(items8,2) then
  560.         retVal[i] = "Power Bomb (Crocomire)"
  561.         i = i + 1
  562.     end
  563.     if not ContainsBit(items8,1) then
  564.         retVal[i] = "Energy Tank (Hi-Jump Boots)"
  565.         i = i + 1
  566.     end
  567.     if not ContainsBit(items9,128) then
  568.         retVal[i] = "Super Missile (Gold Torizo)"
  569.         i = i + 1
  570.     end
  571.     if not ContainsBit(items9,64) then
  572.         retVal[i] = "Missile (Gold Torizo)"
  573.         i = i + 1
  574.     end
  575.     if not ContainsBit(items9,16) then
  576.         retVal[i] = "Wave Beam"
  577.         i = i + 1
  578.     end
  579.     if not ContainsBit(items9,8) then
  580.         retVal[i] = "Missile (Wave Beam)"
  581.         i = i + 1
  582.     end
  583.     if not ContainsBit(items9,4) then
  584.         retVal[i] = "Speed Booster "
  585.         i = i + 1
  586.     end
  587.     if not ContainsBit(items9,2) then
  588.         retVal[i] = "Missile (Speed Booster)"
  589.         i = i + 1
  590.     end
  591.     if not ContainsBit(items9,1) then
  592.         retVal[i] = "Missile (bubble Norfair)"
  593.         i = i + 1
  594.     end
  595.     if not ContainsBit(items10,128) then
  596.         retVal[i] = "Screw Attack"
  597.         i = i + 1
  598.     end
  599.     if not ContainsBit(items10,64) then
  600.         retVal[i] = "Energy Tank (Ridley)"
  601.         i = i + 1
  602.     end
  603.     if not ContainsBit(items10,32) then
  604.         retVal[i] = "Missile (lower Norfair near Wave Beam)"
  605.         i = i + 1
  606.     end
  607.     if not ContainsBit(items10,16) then
  608.         retVal[i] = "Power Bomb (above Ridley)"
  609.         i = i + 1
  610.     end
  611.     if not ContainsBit(items10,8) then
  612.         retVal[i] = "Power Bomb (lower Norfair above fire flea room)"
  613.         i = i + 1
  614.     end
  615.     if not ContainsBit(items10,4) then
  616.         retVal[i] = "Missile (lower Norfair above fire flea room)"
  617.         i = i + 1
  618.     end
  619.     if not ContainsBit(items10,2) then
  620.         retVal[i] = "Missile (Mickey Mouse room)"
  621.         i = i + 1
  622.     end
  623.     if not ContainsBit(items11,1) then
  624.         retVal[i] = "Energy Tank (lower Norfair fire flea room)"
  625.         i = i + 1
  626.     end
  627.    
  628.  
  629.     return retVal
  630. end
  631.  
  632. function GetWreckedShipItems()
  633.     local retVal = {}
  634.     local items12 = memory.readbyte(RAM.bytes.items12)
  635.     local i = 1
  636.    
  637.     if not ContainsBit(items12,128) then
  638.         retVal[i] = "Gravity Suit"
  639.         i = i + 1
  640.     end
  641.     if not ContainsBit(items12,64) then
  642.         retVal[i] = "Super Missile (Wrecked Ship right)"
  643.         i = i + 1
  644.     end
  645.     if not ContainsBit(items12,32) then
  646.         retVal[i] = "Super Missile (Wrecked Ship left)"
  647.         i = i + 1
  648.     end
  649.     if not ContainsBit(items12,16) then
  650.         retVal[i] = "Energy Tank (Wrecked Ship)"
  651.         i = i + 1
  652.     end
  653.     if not ContainsBit(items12,8) then
  654.         retVal[i] = "Missile (Wrecked Ship top)"
  655.         i = i + 1
  656.     end
  657.     if not ContainsBit(items12,4) then
  658.         retVal[i] = "Missile (Gravity Suit)"
  659.         i = i + 1
  660.     end
  661.     if not ContainsBit(items12,2) then
  662.         retVal[i] = "Reserve Tank (Wrecked Ship)"
  663.         i = i + 1
  664.     end
  665.     if not ContainsBit(items12,1) then
  666.         retVal[i] = "Missile (Wrecked Ship middle)"
  667.         i = i + 1
  668.     end
  669.    
  670.     return retVal
  671. end
  672.  
  673. function GetMaridiaItems()
  674.     local retVal = {}
  675.     local items13 = memory.readbyte(RAM.bytes.items13)
  676.     local items14 = memory.readbyte(RAM.bytes.items14)
  677.     local items15 = memory.readbyte(RAM.bytes.items15)
  678.     local i = 1
  679.    
  680.     if not ContainsBit(items13,128) then
  681.         retVal[i] = "Plasma Beam"
  682.         i = i + 1
  683.     end
  684.     if not ContainsBit(items13,64) then
  685.         retVal[i] = "Missile (yellow Maridia false wall)"
  686.         i = i + 1
  687.     end
  688.     if not ContainsBit(items13,32) then
  689.         retVal[i] = "Missile (yellow Maridia super missile)"
  690.         i = i + 1
  691.     end
  692.     if not ContainsBit(items13,16) then
  693.         retVal[i] = "Super Missile (yellow Maridia)"
  694.         i = i + 1
  695.     end
  696.     if not ContainsBit(items13,8) then
  697.         retVal[i] = "Missile (green Maridia turtle room)"
  698.         i = i + 1
  699.     end
  700.     if not ContainsBit(items13,4) then
  701.         retVal[i] = "Energy Tank (green Maridia)"
  702.         i = i + 1
  703.     end
  704.     if not ContainsBit(items13,2) then
  705.         retVal[i] = "Super Missile (green Maridia)"
  706.         i = i + 1
  707.     end
  708.     if not ContainsBit(items13,1) then
  709.         retVal[i] = "Missile (green Maridia Shinespark)"
  710.         i = i + 1
  711.     end
  712.     if not ContainsBit(items14,128) then
  713.         retVal[i] = "Missile (Draygon)"
  714.         i = i + 1
  715.     end
  716.     if not ContainsBit(items14,64) then
  717.         retVal[i] = "Spring Ball"
  718.         i = i + 1
  719.     end
  720.     if not ContainsBit(items14,32) then
  721.         retVal[i] = "Super Missile (pink Maridia)"
  722.         i = i + 1
  723.     end
  724.     if not ContainsBit(items14,16) then
  725.         retVal[i] = "Missile (pink Maridia)"
  726.         i = i + 1
  727.     end
  728.     if not ContainsBit(items14,8) then
  729.         retVal[i] = "Power Bomb (right Maridia sand pit room)"
  730.         i = i + 1
  731.     end
  732.     if not ContainsBit(items14,4) then
  733.         retVal[i] = "Missile (right Maridia sand pit room)"
  734.         i = i + 1
  735.     end
  736.     if not ContainsBit(items14,2) then
  737.         retVal[i] = "Reserve Tank (Maridia)"
  738.         i = i + 1
  739.     end
  740.     if not ContainsBit(items14,1) then
  741.         retVal[i] = "Missile (left Maridia sand pit room)"
  742.         i = i + 1
  743.     end
  744.     if not ContainsBit(items15,4) then
  745.         retVal[i] = "Space Jump"
  746.         i = i + 1
  747.     end
  748.     if not ContainsBit(items15,1) then
  749.         retVal[i] = "Energy tank (Botwoon)"
  750.         i = i + 1
  751.     end
  752.  
  753.     return retVal
  754. end
  755.  
  756.  
  757. function OutputForgotItems()
  758.     if not showOptions.forgotItems then
  759.         gui.text(output.x + 188, output.y, "(F) Forgot Items?")
  760.     else
  761.         gui.text(output.x + 188, output.y - 60, "(C) Crateria")
  762.         gui.text(output.x + 188, output.y - 50, "(B) Brinstar")
  763.         gui.text(output.x + 188, output.y - 40, "(N) Norfair") 
  764.         gui.text(output.x + 188, output.y - 30, "(W) Wrecked Ship")
  765.         gui.text(output.x + 188, output.y - 20, "(M) Maridia") 
  766.         gui.text(output.x + 188, output.y, "(F) Found Them!")  
  767.    
  768.         if showOptions.forgotMode == 0 then
  769.             local crateriaItems = GetCrateriaItems()
  770.             OutputList(0, 0, crateriaItems, "Crateria\n-----\n")
  771.         end
  772.         if showOptions.forgotMode == 1 then
  773.             local brinstarItems = GetBrinstarItems()
  774.             OutputList(0, 0, brinstarItems, "Brinstar\n-----\n")
  775.         end
  776.         if showOptions.forgotMode == 2 then
  777.             local norfairItems = GetNorfairItems()
  778.             OutputList(0, 0, norfairItems, "Norfair\n-----\n")
  779.         end
  780.         if showOptions.forgotMode == 3 then
  781.             local wreckedShipItems = GetWreckedShipItems()
  782.             OutputList(0, 0, wreckedShipItems, "Wrecked Ship\n-----\n")
  783.         end
  784.         if showOptions.forgotMode == 4 then
  785.             local maridiaItems = GetMaridiaItems()
  786.             OutputList(0, 0, maridiaItems, "Maridia\n-----\n")
  787.         end
  788.     end
  789. end
  790.  
  791. function OutputList(xPos, yPos, list, prefix)
  792.     local output = prefix
  793.     local firstPass = true
  794.    
  795.     for item in values(list) do
  796.         if not firstPass then
  797.             output = output .. "\n"
  798.         end
  799.        
  800.         output = output .. item
  801.         firstPass = false
  802.     end
  803.    
  804.     gui.text(xPos, yPos, output)
  805. end
  806.  
  807. --Outputs relevant game information
  808. function OutputGameInfo()
  809.     output.yOffset = 0
  810.    
  811.     OutputForgotItems()
  812.    
  813.     if not showOptions.forgotItems then
  814.         if showOptions.time then
  815.             OutputTime()
  816.         end
  817.  
  818.         if showOptions.pct then
  819.             OutputPct()
  820.         end
  821.  
  822.         if showOptions.bossHealth then
  823.             OutputBossHealth()
  824.         end
  825.  
  826.         if showOptions.shortCharge then
  827.             OutputShortCharge()
  828.         end
  829.        
  830.         if showOptions.beamCharge then
  831.             OutputBeamCharge()
  832.         end
  833.     end
  834. end
  835.  
  836. --Handles all the hotkey stuff
  837. function HandleKeys()
  838.     keys = input.get()
  839.  
  840.     if press('F') then
  841.         showOptions.forgotItems = not showOptions.forgotItems
  842.     end
  843.    
  844.     if not showOptions.forgotItems then
  845.         if press('T') then
  846.             showOptions.time = not showOptions.time
  847.         end
  848.        
  849.         if press('P') then
  850.             showOptions.pct = not showOptions.pct
  851.         end
  852.        
  853.         if press('H') then
  854.             showOptions.bossHealth = not showOptions.bossHealth
  855.         end
  856.        
  857.         if press('S') then
  858.             showOptions.shortCharge = not showOptions.shortCharge
  859.         end
  860.  
  861.         if press('B') then
  862.             showOptions.beamCharge = not showOptions.beamCharge
  863.         end
  864.     else
  865.         if press('C') then
  866.             showOptions.forgotMode = 0
  867.         end
  868.         if press('B') then
  869.             showOptions.forgotMode = 1
  870.         end
  871.         if press('N') then
  872.             showOptions.forgotMode = 2
  873.         end
  874.         if press('W') then
  875.             showOptions.forgotMode = 3
  876.         end
  877.         if press('M') then
  878.             showOptions.forgotMode = 4
  879.         end
  880.     end
  881.    
  882.     last_keys = keys                                              
  883. end
  884.  
  885. function press(button)
  886.     if keys[button] and not last_keys[button] then
  887.         return true
  888.     end
  889.     return false
  890. end
  891.    
  892. while true do
  893.     OutputGameInfo()
  894.     HandleKeys()
  895.     snes9x.frameadvance()
  896. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement