SHARE
TWEET

ctinfoscope20160217

redslash Feb 4th, 2016 (edited) 229 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Chrono Trigger Infoscope for Snes9x(1.51-rr)
  2. -- 2016/02/17 Redslash
  3.  
  4. --HOW TO USE:
  5. -- 1. get the emulator here http://tasvideos.org/EmulatorResources/Snes9x.html (it's the top link)
  6. -- 2. download this paste (.LUA file), and open it from Snes9x (File > Lua Scripting > New Lua Script Window)
  7.  
  8. -- older version here: http://pastebin.com/J0C5kDnF (2015/10/30)
  9.  
  10. local dispbox = 1   -- press Select to toggle
  11. local dispboxID = 0     -- CHANGE THIS TO SEE NPC IDs
  12. local dispCronobox = 0  -- CHANGE THIS TO TO SEE PC BOXES
  13.  
  14. local infade = "80"
  15. local outfade = "c0"
  16.  
  17. local inputs = joypad.get()
  18. local button =  {'R','L','X','A','right','left','down','up','start','select','Y','B'}
  19. local btnlabel= {'  r','l','X','A','>','<','v','^','S','-','Y','B'}
  20. local xcoords = { 8.6, 0.4, 9,10, 2, 0, 1, 1, 6, 4, 8, 9}
  21. local ycoords = {  1,   1,  2, 3, 3, 3, 4, 2, 3, 3, 3, 4}
  22. local press= {  0,   0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
  23. local unpress = {  0,   0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
  24. local turbo   = {  0,   0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
  25. local selectheld = 0
  26.  
  27. local dispy = 191
  28. local yoffset = 168
  29. local xoffset = 70  -- 89 = button display centered
  30. local regcolor = {"#CCCCCC","#00CCCC","#CCCCCC"}
  31. local regshade = {"#444444","#004444","#444444"}
  32. local nocolor = "#00000000"
  33. local charname = {"C","M","L","R","F","A","J"}
  34. local charcolor = {"#CCCC00","#0000FF","#CC0000","#808080","#00CC00","#CC4400","#808080","#808080","#808080"}
  35. local charshade = {"#444400","#000044","#440000","#444400","#004400","#441100","#404040"}
  36.  
  37. local BATTLE_FLAG = 0x7e0117
  38. local battleflag = 0
  39. local battlecopy = 0
  40.  
  41. local FACING = 0x7e1600
  42. local MOVING = 0x7e1680
  43. local facing = {}
  44. local moving = {}
  45. local faceoffset = 5    -- experimental
  46. local MAP_X = 0x7e1800
  47. local MAP_Y = 0x7e1880
  48. local mapx = {}
  49. local mapy = {}
  50. local mapoffsetx = 0
  51. local mapoffsety = 0
  52. local SCREEN_X = 0x7e0A00
  53. local SCREEN_Y = 0x7e0A80
  54. local mainsprite = 0
  55. local farsprite = 0
  56. local xsign,ysign = "",""
  57. local xcolor,ycolor = 0,0
  58.  
  59. local LOCATION = 0x7e0100
  60. local loc = memory.readword(LOCATION)
  61.  
  62. local locs = {} --http://datacrystal.romhacking.net/wiki/Chrono_Trigger/List_of_Locations
  63. locs[0x000] = "Load Screen"
  64. locs[0x001] = "Crono's Kitchen"
  65. locs[0x002] = "Crono's Room"
  66. locs[0x003] = "Lucca's Kitchen"
  67. locs[0x004] = "Lucca's Workshop"
  68. locs[0x005] = "Millenial Fair"
  69. locs[0x006] = "Gato's Exhibit"
  70. locs[0x007] = "Prehistoric Exhibit"
  71. locs[0x008] = "Telepod Exhibit"
  72. locs[0x009] = "Lara's Room"
  73. locs[0x00A] = "Lucca's Room"
  74. locs[0x00B] = "Ending Selector"
  75. locs[0x00C] = "Truce Inn (Present)"
  76. locs[0x00D] = "Truce Mayor's Manor 1F"
  77. locs[0x00E] = "Truce Mayor's Manor 2F"
  78. locs[0x00F] = "Truce Single Woman Residence"
  79. locs[0x010] = "Truce Happy Screaming Couple Residence"
  80. locs[0x011] = "Truce Market (Present)"
  81. locs[0x012] = "Truce Ticket Office"
  82. locs[0x013] = "Guardia Forest (Present)"
  83. locs[0x014] = "Guardia Forest Dead End"
  84. locs[0x015] = "Guardia Throneroom (Present)"
  85. locs[0x016] = "King's Chamber (Present)"
  86. locs[0x017] = "Queen's Chamber (Present)"
  87. locs[0x018] = "Guardia Kitchen (Present)"
  88. locs[0x019] = "Guardia Barracks (Present)"
  89. locs[0x01A] = "Guardia Basement"
  90. locs[0x01B] = "Courtroom"
  91. locs[0x01C] = "Prison Catwalks"
  92. locs[0x01D] = "Prison Supervisor's Office"
  93. locs[0x01E] = "Prison Torture Storage Room"
  94. locs[0x01F] = "Medina Square"
  95. locs[0x020] = "Zenan Bridge (Present)"
  96. locs[0x021] = "Medina Elder's House 1F"
  97. locs[0x022] = "Medina Elder's House 2F"
  98. locs[0x023] = "Medina Inn"
  99. locs[0x024] = "Medina Portal"
  100. locs[0x025] = "Ending: Legendary Hero"
  101. locs[0x026] = "Guardia Throneroom (Ending: Legendary Hero)"
  102. locs[0x027] = "Medina Market"
  103. locs[0x028] = "Melchior's Kitchen"
  104. locs[0x029] = "Melchior's Workshop"
  105. locs[0x02A] = "Forest Ruins"
  106. locs[0x02B] = "Cursed Woods (Ending: The Unknown Past)"
  107. locs[0x02C] = "Leene Square (Future)"
  108. locs[0x02D] = "Denadoro Mountain Vista (Ending: Legendary Hero)"
  109. locs[0x02E] = "Castle Magus Throne of Defense (Ending: Legendary Hero)"
  110. locs[0x02F] = "Heckran Cave Passageways"
  111. locs[0x030] = "Heckran Cave Entrance"
  112. locs[0x031] = "Heckran Cave Underground River"
  113. locs[0x032] = "Porre Mayor's Manor 1F (Present)"
  114. locs[0x033] = "Porre Mayor's Manor 2F (Present)"
  115. locs[0x034] = "Porre Residence (Present)"
  116. locs[0x035] = "Snail Stop"
  117. locs[0x036] = "Porre Market (Present)"
  118. locs[0x037] = "Porre Inn (Present)"
  119. locs[0x038] = "Porre Ticket Office"
  120. locs[0x039] = "Fiona's Shrine"
  121. locs[0x03A] = "Choras Mayor's Manor 1F"
  122. locs[0x03B] = "Choras Mayor's Manor 2F"
  123. locs[0x03C] = "Castle Magus Hall of Aggression (Ending: Legendary Hero)"
  124. locs[0x03D] = "Choras Carpenter's Residence (Present)"
  125. locs[0x03E] = "Choras Inn (Present)"
  126. locs[0x03F] = "West Cape"
  127. locs[0x040] = "Sun Keep (Present)"
  128. locs[0x041] = "Northern Ruins Entrance (Present)"
  129. locs[0x042] = "Northern Ruins Basement Corridor (Present)"
  130. locs[0x043] = "Northern Ruins Landing (Present)"
  131. locs[0x044] = "Northern Ruins Antechamber (Present)"
  132. locs[0x045] = "Northern Ruins Vestibule (Present)"
  133. locs[0x046] = "Northern Ruins Back Room (Present)"
  134. locs[0x047] = "Prison Cells"
  135. locs[0x048] = "Prison Stairwells"
  136. locs[0x049] = "Northern Ruins Hero's Grave (Present)"
  137. locs[0x04A] = "Unknown"
  138. locs[0x04B] = "Prison Exterior"
  139. locs[0x04C] = "Unknown (Lavos Spawn)"
  140. locs[0x04D] = "Unknown (Lavos Spawn)"
  141. locs[0x04E] = "Unknown (Lavos Spawn)"
  142. locs[0x04F] = "Guardia Throneroom (Ending: Moonlight Parade)"
  143. locs[0x050] = "Millenial Fair (Ending: Moonlight Parade)"
  144. locs[0x051] = "Leene Square (Ending: Moonlight Parade)"
  145. locs[0x052] = "Ending Selector"
  146. locs[0x053] = "Fiona's Forest Recriminations"
  147. locs[0x054] = "End of Time (Ending: Moonlight Parade)"
  148. locs[0x055] = "Telepod Exhibit (Ending: Moonlight Parade)"
  149. locs[0x056] = "Death Peak Summit (Ending: Moonlight Parade)"
  150. locs[0x057] = "Manoria Sanctuary (Ending: The Successor of Guardia)"
  151. locs[0x058] = "The End"
  152. locs[0x059] = "Zenan Bridge (Ending: Moonlight Parade)"
  153. locs[0x05A] = "Prison Catwalks (Ending: Moonlight Parade)"
  154. locs[0x05B] = "Ending: People of the Times (Part 1)"
  155. locs[0x05C] = "Ending: People of the Times (Part 2)"
  156. locs[0x05D] = "Ending: People of the Times (Part 3)"
  157. locs[0x05E] = "Ending: People of the Times (Part 4)"
  158. locs[0x05F] = "Ending: People of the Times (Part 5)"
  159. locs[0x060] = "Black Omen Lavos Spawn"
  160. locs[0x061] = "Black Omen 3F Teleporter (no exits)"
  161. locs[0x062] = "Black Omen 45F Teleporter"
  162. locs[0x063] = "Black Omen Platform (no exit)"
  163. locs[0x064] = "Black Omen Platform Shaft (Downward)"
  164. locs[0x065] = "Black Omen Platform Shaft (Upward)"
  165. locs[0x066] = "Black Omen Celestial Gate (no map)"
  166. locs[0x067] = "Black Omen Celestial Gate (no map)"
  167. locs[0x068] = "Black Omen Celestial Gate (no map)"
  168. locs[0x069] = "Black Omen Celestial Gate (no map)"
  169. locs[0x06A] = "Black Omen Celestial Gate (no map)"
  170. locs[0x06B] = "Black Omen Celestial Gate"
  171. locs[0x06C] = "Lucca Explains Paradoxes"
  172. locs[0x06D] = "Ancient Tyrano Lair"
  173. locs[0x06E] = "Ancient Tyrano Lair Traps"
  174. locs[0x06F] = "Ancient Tyrano Lair Nizbel's Room"
  175. locs[0x070] = "Truce Canyon"
  176. locs[0x071] = "Truce Canyon Portal"
  177. locs[0x072] = "Truce Couple's Residence (Middle Ages)"
  178. locs[0x073] = "Truce Smithy's Residence"
  179. locs[0x074] = "Truce Inn 1F (Middle Ages)"
  180. locs[0x075] = "Truce Inn 2F (Middle Ages)"
  181. locs[0x076] = "Truce Market (Middle Ages)"
  182. locs[0x077] = "Guardia Forest (Middle Ages)"
  183. locs[0x078] = "Guardia Throneroom (Middle Ages)"
  184. locs[0x079] = "Guardia King's Chamber (Middle Ages)"
  185. locs[0x07A] = "Guardia Queen's Chamber (Middle Ages)"
  186. locs[0x07B] = "Guardia Kitchen (Middle Ages)"
  187. locs[0x07C] = "Guardia Barracks (Middle Ages)"
  188. locs[0x07D] = "Castle Magus Doppleganger Corridor"
  189. locs[0x07E] = "Geno Dome Main Conveyor"
  190. locs[0x07F] = "Geno Dome Elevator"
  191. locs[0x080] = "Geno Dome Long Corridor"
  192. locs[0x081] = "Manoria Sanctuary"
  193. locs[0x082] = "Manoria Main Hall"
  194. locs[0x083] = "Manoria Headquarters"
  195. locs[0x084] = "Manoria Royal Guard Hall"
  196. locs[0x085] = "Zenan Bridge (Wrecked)"
  197. locs[0x086] = "Zenan Bridge (Middle Ages, no map)"
  198. locs[0x087] = "Zenan Bridge (Middle Ages)"
  199. locs[0x088] = "Sandorino Pervert Residence"
  200. locs[0x089] = "Sandorino Elder's House"
  201. locs[0x08A] = "Sandorino Inn"
  202. locs[0x08B] = "Sandorino Market"
  203. locs[0x08C] = "Cursed Woods"
  204. locs[0x08D] = "Frog's Burrow"
  205. locs[0x08E] = "Denadoro South Face"
  206. locs[0x08F] = "Denadoro Cave of the Masamune Exterior"
  207. locs[0x090] = "Denadoro North Face"
  208. locs[0x091] = "Denadoro Entrance"
  209. locs[0x092] = "Denadoro Lower East Face"
  210. locs[0x093] = "Denadoro Upper East Face"
  211. locs[0x094] = "Denadoro Mountain Vista"
  212. locs[0x095] = "Denadoro West Face"
  213. locs[0x096] = "Denadoro Gauntlet"
  214. locs[0x097] = "Denadoro Cave of the Masamune"
  215. locs[0x098] = "Tata's House 1F"
  216. locs[0x099] = "Tata's House 2F"
  217. locs[0x09A] = "Porre Elder's House (Middle Ages)"
  218. locs[0x09B] = "Porre Cafe (Middle Ages)"
  219. locs[0x09C] = "Porre Inn (Middle Ages)"
  220. locs[0x09D] = "Porre Market (Middle Ages)"
  221. locs[0x09E] = "Fiona's Villa"
  222. locs[0x09F] = "Sunken Desert Entrance"
  223. locs[0x0A0] = "Sunken Desert Parasytes"
  224. locs[0x0A1] = "Sunken Desert Devourer"
  225. locs[0x0A2] = "Ozzie's Fort Entrance (no map)"
  226. locs[0x0A3] = "Magic Cave Exterior"
  227. locs[0x0A4] = "Magic Cave Interior"
  228. locs[0x0A5] = "Castle Magus Exterior"
  229. locs[0x0A6] = "Castle Magus Entrance"
  230. locs[0x0A7] = "Castle Magus Chamber of Guillotines"
  231. locs[0x0A8] = "Castle Magus Chamber of Pits"
  232. locs[0x0A9] = "Castle Magus Throne of Strength"
  233. locs[0x0AA] = "Castle Magus Hall of Aggression"
  234. locs[0x0AB] = "Castle Magus Hall of Deceit"
  235. locs[0x0AC] = "Castle Magus Inner Sanctum"
  236. locs[0x0AD] = "Castle Magus Throne of Magic"
  237. locs[0x0AE] = "Castle Magus Throne of Defense"
  238. locs[0x0AF] = "Castle Magus Hall of Apprehension"
  239. locs[0x0B0] = "Castle Magus Lower Battlements"
  240. locs[0x0B1] = "Ozzie's Fort Entrance"
  241. locs[0x0B2] = "Ozzie's Fort Hall of Disregard"
  242. locs[0x0B3] = "Ozzie's Fort Chamber of Kitchen Knives"
  243. locs[0x0B4] = "Ozzie's Fort Last Stand"
  244. locs[0x0B5] = "Ozzie's Fort Throne of Incompetence"
  245. locs[0x0B6] = "Ozzie's Fort Throne of Impertinence (wrong map)"
  246. locs[0x0B7] = "Ozzie's Fort Throne of Impertinence"
  247. locs[0x0B8] = "Ozzie's Fort Throne of Ineptitude"
  248. locs[0x0B9] = "Choras Old Couple Residence (Middle Ages)"
  249. locs[0x0BA] = "Choras Carpenter's Residence 1F (Middle Ages)"
  250. locs[0x0BB] = "Choras Carpenter's Residence 2F (Middle Ages)"
  251. locs[0x0BC] = "Choras Cafe"
  252. locs[0x0BD] = "Choras Inn (Middle Ages)"
  253. locs[0x0BE] = "Choras Market (Middle Ages)"
  254. locs[0x0BF] = "Sun Keep (Middle Ages)"
  255. locs[0x0C0] = "(empty map)"
  256. locs[0x0C1] = "(empty map)"
  257. locs[0x0C2] = "(empty map)"
  258. locs[0x0C3] = "Giant's Claw Entrance"
  259. locs[0x0C4] = "Giant's Claw Caverns"
  260. locs[0x0C5] = "Giant's Claw Last Tyranno"
  261. locs[0x0C6] = "Manoria Command"
  262. locs[0x0C7] = "Manoria Confinement"
  263. locs[0x0C8] = "Manoria Shrine Antechamber"
  264. locs[0x0C9] = "Manoria Storage"
  265. locs[0x0CA] = "Manoria Kitchen"
  266. locs[0x0CB] = "Manoria Shrine"
  267. locs[0x0CC] = "Guardia Forest Frog King Battle"
  268. locs[0x0CD] = "Denadoro Cyrus's Last Battle"
  269. locs[0x0CE] = "Guardia Throneroom Cyrus's Final Mission"
  270. locs[0x0CF] = "Schala's Room (no map)"
  271. locs[0x0D0] = "Bangor Dome"
  272. locs[0x0D1] = "Bangor Dome Sealed Room"
  273. locs[0x0D2] = "Trann Dome"
  274. locs[0x0D3] = "Trann Dome Sealed Room"
  275. locs[0x0D4] = "Lab 16 West"
  276. locs[0x0D5] = "Lab 16 East"
  277. locs[0x0D6] = "Arris Dome"
  278. locs[0x0D7] = "Arris Dome Infestation"
  279. locs[0x0D8] = "Arris Dome Auxiliary Console"
  280. locs[0x0D9] = "Arris Dome Lower Commons"
  281. locs[0x0DA] = "Arris Dome Command Central"
  282. locs[0x0DB] = "Arris Dome Guardian Chamber"
  283. locs[0x0DC] = "Arris Dome Sealed Room"
  284. locs[0x0DD] = "Arris Dome Rafters"
  285. locs[0x0DE] = "Reptite Lair 2F"
  286. locs[0x0DF] = "Lab 32 West Entrance"
  287. locs[0x0E0] = "Lab 32"
  288. locs[0x0E1] = "Lab 32 East Entrance"
  289. locs[0x0E2] = "Proto Dome"
  290. locs[0x0E3] = "Proto Dome Portal"
  291. locs[0x0E4] = "Factory Ruins Entrance"
  292. locs[0x0E5] = "Factory Ruins Auxiliary Console"
  293. locs[0x0E6] = "Factory Ruins Security Center"
  294. locs[0x0E7] = "Factory Ruins Crane Room"
  295. locs[0x0E8] = "Factory Ruins Infestation"
  296. locs[0x0E9] = "Factory Ruins Crane Control Room"
  297. locs[0x0EA] = "Factory Ruins Information Archive"
  298. locs[0x0EB] = "Factory Ruins Power Core"
  299. locs[0x0EC] = "Sewer Access B1"
  300. locs[0x0ED] = "Sewer Access B2"
  301. locs[0x0EE] = "Ending: Dream Team (no map) (TBD)"
  302. locs[0x0EF] = "Ending: A Slide Show?"
  303. locs[0x0F0] = "Ending: Goodnight"
  304. locs[0x0F1] = "Keeper's Dome"
  305. locs[0x0F2] = "Keeper's Dome Corridor"
  306. locs[0x0F3] = "Keeper's Dome Hanger"
  307. locs[0x0F4] = "Death Peak Entrance"
  308. locs[0x0F5] = "Death Peak South Face"
  309. locs[0x0F6] = "Death Peak Southeast Face"
  310. locs[0x0F7] = "Death Peak Northeast Face"
  311. locs[0x0F8] = "Geno Dome Entrance"
  312. locs[0x0F9] = "Geno Dome Conveyor Entrance"
  313. locs[0x0FA] = "Geno Dome Conveyor Exit"
  314. locs[0x0FB] = "Sun Palace"
  315. locs[0x0FC] = "Millenial Fair (Ending: Dino Age)"
  316. locs[0x0FD] = "Sun Keep (Last Village)"
  317. locs[0x0FE] = "Skill Tutorial"
  318. locs[0x0FF] = "Sun Keep (Future)"
  319. locs[0x100] = "Geno Dome Labs"
  320. locs[0x101] = "Geno Dome Storage"
  321. locs[0x102] = "Geno Dome Robot Hub"
  322. locs[0x103] = "Factory Ruins Data Core"
  323. locs[0x104] = "Death Peak Northwest Face"
  324. locs[0x105] = "Prehistoric Canyon"
  325. locs[0x106] = "Death Peak Upper North Face"
  326. locs[0x107] = "Death Peak Lower North Face"
  327. locs[0x108] = "Death Peak Cave"
  328. locs[0x109] = "Death Peak Summit"
  329. locs[0x10A] = "Ending: Dream Team (no map) (TBD)"
  330. locs[0x10B] = "Geno Dome Robot Elevator Access"
  331. locs[0x10C] = "Geno Dome Mainframe"
  332. locs[0x10D] = "Geno Dome Waste Disposal"
  333. locs[0x10E] = "Leene's Square (Ending: Dino Age)"
  334. locs[0x10F] = "Special Purpose Area"
  335. locs[0x110] = "Mystic Mtn Portal"
  336. locs[0x111] = "Mystic Mtn Base"
  337. locs[0x112] = "Mystic Mtn Gulch"
  338. locs[0x113] = "Chief's Hut"
  339. locs[0x114] = "Ioka Southwestern Hut"
  340. locs[0x115] = "Ioka Trading Post"
  341. locs[0x116] = "Ioka Sweet Water Hut"
  342. locs[0x117] = "Ioka Meeting Site"
  343. locs[0x118] = "Ioka Meeting Site (Party)"
  344. locs[0x119] = "Forest Maze Entrance"
  345. locs[0x11A] = "Forest Maze"
  346. locs[0x11B] = "Reptite Lair Entrance"
  347. locs[0x11C] = "Reptite Lair 1F"
  348. locs[0x11D] = "Reptite Lair Weevil Burrows B1"
  349. locs[0x11E] = "Reptite Lair Weevil Burrows B2"
  350. locs[0x11F] = "Reptite Lair Commons"
  351. locs[0x120] = "Reptite Lair Tunnel"
  352. locs[0x121] = "Reptite Lair Azala's Room"
  353. locs[0x122] = "Reptite Lair Access Shaft"
  354. locs[0x123] = "Hunting Range"
  355. locs[0x124] = "Laruba Ruins"
  356. locs[0x125] = "Dactyl Nest, Lower"
  357. locs[0x126] = "Dactyl Nest, Upper"
  358. locs[0x127] = "Dactyl Nest Summit"
  359. locs[0x128] = "Giant's Claw Lair Entrance"
  360. locs[0x129] = "Giant's Claw Lair Throneroom"
  361. locs[0x12A] = "Tyrano Lair Exterior"
  362. locs[0x12B] = "Tyrano Lair Entrance"
  363. locs[0x12C] = "Tyrano Lair Throneroom"
  364. locs[0x12D] = "Tyrano Lair Keep"
  365. locs[0x12E] = "Tyrano Lair Antechambers"
  366. locs[0x12F] = "Tyrano Lair Storage"
  367. locs[0x130] = "Tyrano Lair Nizbel's Room"
  368. locs[0x131] = "Tyrano Lair Room of Vertigo"
  369. locs[0x132] = "Debug Room?"
  370. locs[0x133] = "Lair Ruins Portal"
  371. locs[0x134] = "Black Omen 1F Entrance"
  372. locs[0x135] = "Black Omen 1F Walkway"
  373. locs[0x136] = "Black Omen 1F Defense Corridor"
  374. locs[0x137] = "Black Omen 1F Stairway"
  375. locs[0x138] = "Black Omen 3F Walkway"
  376. locs[0x139] = "Black Omen Auxilary Command"
  377. locs[0x13A] = "Black Omen (TBD)"
  378. locs[0x13B] = "Black Omen (TBD)"
  379. locs[0x13C] = "Black Omen (TBD)"
  380. locs[0x13D] = "Black Omen (TBD)"
  381. locs[0x13E] = "Black Omen (TBD)"
  382. locs[0x13F] = "Black Omen (TBD)"
  383. locs[0x140] = "Black Omen (TBD)"
  384. locs[0x141] = "Black Omen (TBD)"
  385. locs[0x142] = "Black Omen (TBD)"
  386. locs[0x143] = "Black Omen (TBD)"
  387. locs[0x144] = "Black Omen (TBD)"
  388. locs[0x145] = "Black Omen (TBD)"
  389. locs[0x146] = "Black Omen (TBD)"
  390. locs[0x147] = "Sunkeep (Prehistoric)"
  391. locs[0x148] = "Zeal Palace Schala's Room"
  392. locs[0x149] = "Zeal Palace Regal Hall"
  393. locs[0x14A] = "Zeal Palace Corridor to the Mammon Machine"
  394. locs[0x14B] = "Zeal Palace Hall of the Mammon Machine"
  395. locs[0x14C] = "Zeal Palace Zeal Throneroom"
  396. locs[0x14D] = "Zeal Palace Hall of the Mammon Machine (Night)"
  397. locs[0x14E] = "Zeal Palace Zeal Throneroom (Night)"
  398. locs[0x14F] = "Enhasa (wrong map)"
  399. locs[0x150] = "Land Bridge (TBD)"
  400. locs[0x151] = "Skyway? (TBD)"
  401. locs[0x152] = "Present Age Home Room (Ending: The Dream Project)"
  402. locs[0x153] = "Prehistoric Age Jungle (Ending: The Dream Project)"
  403. locs[0x154] = "Dark Age Ocean Palace Room (Ending: The Dream Project)"
  404. locs[0x155] = "Present Age Jail Cell (Ending: The Dream Project)"
  405. locs[0x156] = "Dark Age Earthbound Room (Ending: The Dream Project)"
  406. locs[0x157] = "Present Age Northern Ruins Room (Ending: The Dream Project)"
  407. locs[0x158] = "Arris Dome Food Locker"
  408. locs[0x159] = "Lucca's Workshop (Ending: The Oath)"
  409. locs[0x15A] = "Arris Dome Guardian Chamber (Battle with Lavos)"
  410. locs[0x15B] = "Prison Catwalks (Battle with Lavos)"
  411. locs[0x15C] = "Heckran Cave (Battle with Lavos)"
  412. locs[0x15D] = "Zenan Bridge (Battle with Lavos)"
  413. locs[0x15E] = "Cave of the Masamune (Battle with Lavos)"
  414. locs[0x15F] = "Dark Ages Portal"
  415. locs[0x160] = "Land Bridge (TBD)"
  416. locs[0x161] = "Land Bridge (TBD)"
  417. locs[0x162] = "Skyway (TBD)"
  418. locs[0x163] = "Enhasa"
  419. locs[0x164] = "Skyway (TBD)"
  420. locs[0x165] = "Kajar"
  421. locs[0x166] = "Kajar Study"
  422. locs[0x167] = "Kajar Belthasar's Private Room"
  423. locs[0x168] = "Kajar Magic Lab"
  424. locs[0x169] = "Zeal Palace Belthasar's Private Room"
  425. locs[0x16A] = "Blackbird Scaffolding"
  426. locs[0x16B] = "Blackbird Left Wing"
  427. locs[0x16C] = "Blackbird Right Port"
  428. locs[0x16D] = "Blackbird Left Port"
  429. locs[0x16E] = "Blackbird Overhead"
  430. locs[0x16F] = "Blackbird Hanger"
  431. locs[0x170] = "Blackbird Rear Halls"
  432. locs[0x171] = "Blackbird Forward Halls"
  433. locs[0x172] = "Blackbird Treasury"
  434. locs[0x173] = "Blackbird Cell"
  435. locs[0x174] = "Blackbird Barracks"
  436. locs[0x175] = "Blackbird Armory 3"
  437. locs[0x176] = "Blackbird Inventory"
  438. locs[0x177] = "Blackbird Lounge"
  439. locs[0x178] = "Blackbird Ducts"
  440. locs[0x179] = "Reborn Epoch"
  441. locs[0x17A] = "Future Age Room (Ending: The Dream Project)"
  442. locs[0x17B] = "End of Time (Ending: The Dream Project)"
  443. locs[0x17C] = "Algetty"
  444. locs[0x17D] = "Algetty Inn"
  445. locs[0x17E] = "Algetty Elder's Grotto"
  446. locs[0x17F] = "Algetty Commoner Grotto"
  447. locs[0x180] = "Algetty Shop"
  448. locs[0x181] = "Algetty Tsunami (wrong map)"
  449. locs[0x182] = "Algetty Entrance"
  450. locs[0x183] = "The Beast's Nest (wrong map)"
  451. locs[0x184] = "The Beast's Nest"
  452. locs[0x185] = "Zeal Teleporters"
  453. locs[0x186] = "Prehistoric Hut (Ending: The Dream Project)"
  454. locs[0x187] = "Castle Magus Room (Ending: The Dream Project)"
  455. locs[0x188] = "Mt. Woe Western Face"
  456. locs[0x189] = "Mt. Woe Lower Eastern Face"
  457. locs[0x18A] = "Mt. Woe Middle Eastern Face"
  458. locs[0x18B] = "Mt. Woe Upper Eastern Face"
  459. locs[0x18C] = "Mt. Woe Summit (wrong map)"
  460. locs[0x18D] = "Mt. Woe Summit"
  461. locs[0x18E] = "Leene Square (Ending: What the Prophet Seeks)"
  462. locs[0x18F] = "Crono's Kitchen (Ending: What the Prophet Seeks)"
  463. locs[0x190] = "The End (Ending: Multiple?)"
  464. locs[0x191] = "Zeal Palace"
  465. locs[0x192] = "Zeal Palace Hallway"
  466. locs[0x193] = "Zeal Palace Study"
  467. locs[0x194] = "Ocean Palace Entrance"
  468. locs[0x195] = "Ocean Palace Piazza"
  469. locs[0x196] = "Ocean Palace Side Rooms"
  470. locs[0x197] = "Ocean Palace Forward Area"
  471. locs[0x198] = "Ocean Palace B3 Landing"
  472. locs[0x199] = "Ocean Palace Grand Stairwell"
  473. locs[0x19A] = "Ocean Palace B20 Landing"
  474. locs[0x19B] = "Ocean Palace Southern Access Lift"
  475. locs[0x19C] = "Ocean Palace Security Pool"
  476. locs[0x19D] = "Ocean Palace Security Esplanade"
  477. locs[0x19E] = "Ocean Palace Regal Antechamber"
  478. locs[0x19F] = "Ocean Palace Throneroom"
  479. locs[0x1A0] = "Ocean Palace (TBD)"
  480. locs[0x1A1] = "Ocean Palace Eastern Access Lift"
  481. locs[0x1A2] = "Ocean Palace Western Access Lift"
  482. locs[0x1A3] = "Ocean Palace Time Freeze (wrong map)"
  483. locs[0x1A4] = "Ocean Palace Time Freeze (wrong map)"
  484. locs[0x1A5] = "Ocean Palace Time Freeze (wrong map)"
  485. locs[0x1A6] = "Time Distortion Mammon Machine"
  486. locs[0x1A7] = "Ocean Palace Time Freeze"
  487. locs[0x1A8] = "Last Village Commons"
  488. locs[0x1A9] = "Last Village Empty Hut"
  489. locs[0x1AA] = "Last Village Shop"
  490. locs[0x1AB] = "Last Village Residence"
  491. locs[0x1AC] = "North Cape"
  492. locs[0x1AD] = "Death Peak Summit"
  493. locs[0x1AE] = "Tyrano Lair Main Cell"
  494. locs[0x1AF] = "Title Screen (wrong map)"
  495. locs[0x1B0] = "Flying Epoch"
  496. locs[0x1B1] = "Title Screen"
  497. locs[0x1B2] = "Bekkler's Lab"
  498. locs[0x1B3] = "Magic Cave Exterior (after cutscene)"
  499. locs[0x1B4] = "Fiona's Forest Campfire"
  500. locs[0x1B5] = "Factory Ruins (TBD)"
  501. locs[0x1B6] = "Courtroom King's Trial"
  502. locs[0x1B7] = "Leene Square"
  503. locs[0x1B8] = "Guardia Rear Storage"
  504. locs[0x1B9] = "Courtroom Lobby"
  505. locs[0x1BA] = "Blackbird Access Shaft"
  506. locs[0x1BB] = "Blackbird Armory 2"
  507. locs[0x1BC] = "Blackbird Armory 1"
  508. locs[0x1BD] = "Blackbird Storage"
  509. locs[0x1BE] = "Castle Magus Upper Battlements"
  510. locs[0x1BF] = "Castle Magus Grand Stairway"
  511. locs[0x1C0] = "(Bad Event Data Packet)"
  512. locs[0x1C1] = "Black Omen Entrance"
  513. locs[0x1C2] = "Black Omen Omega Defense"
  514. locs[0x1C3] = "Black Omen Seat of Agelessness"
  515. locs[0x1C4] = "(Bad Event Data Packet)"
  516. locs[0x1C5] = "(Bad Event Data Packet)"
  517. locs[0x1C6] = "(Bad Event Data Packet)"
  518. locs[0x1C7] = "(Bad Event Data Packet)"
  519. locs[0x1C8] = "Reptite Lair (Battle with Lavos)"
  520. locs[0x1C9] = "Castle Magus Inner Sanctum (Battle with Lavos)"
  521. locs[0x1CA] = "Tyrano Lair Keep (Battle with Lavos)"
  522. locs[0x1CB] = "Mt. Woe Summit (Battle with Lavos)"
  523. locs[0x1CC] = "Credits (TBD)"
  524. locs[0x1CD] = "(Empty Data)"
  525. locs[0x1CE] = "(Empty Data)"
  526. locs[0x1CF] = "(Empty Data)"
  527. locs[0x1D0] = "End of Time"
  528. locs[0x1D1] = "Spekkio"
  529. locs[0x1D2] = "Apocalypse Lavos"
  530. locs[0x1D3] = "Lavos"
  531. locs[0x1D4] = "Guardia Queen's Tower (Middle Ages)"
  532. locs[0x1D5] = "Castle Magus Corridor of Combat"
  533. locs[0x1D6] = "Castle Magus Hall of Ambush"
  534. locs[0x1D7] = "Castle Magus Dungeon"
  535. locs[0x1D8] = "Apocalypse Epoch"
  536. locs[0x1D9] = "End of Time Epoch"
  537. locs[0x1DA] = "Lavos Tunnel"
  538. locs[0x1DB] = "Lavos Core"
  539. locs[0x1DC] = "Truce Dome"
  540. locs[0x1DD] = "Emergence of the Black Omen"
  541. locs[0x1DE] = "Blackbird Wing Access"
  542. locs[0x1DF] = "Tesseract"
  543. locs[0x1E0] = "Guardia King's Tower (Middle Ages)"
  544. locs[0x1E1] = "Death of the Blackbird"
  545. locs[0x1E2] = "Blackbird (no exits)"
  546. locs[0x1E3] = "Blackbird (no exits)"
  547. locs[0x1E4] = "Blackbird (no exits)"
  548. locs[0x1E5] = "Blackbird (no exits)"
  549. locs[0x1E6] = "Guardia King's Tower (Present)"
  550. locs[0x1E7] = "Guardia Queen's Tower (Present)"
  551. locs[0x1E8] = "Guardia Lawgiver's Tower"
  552. locs[0x1E9] = "Guardia Prison Tower"
  553. locs[0x1EA] = "Ancient Tyrano Lair Room of Vertigo"
  554. locs[0x1EB] = "(empty map)"
  555. locs[0x1EC] = "(empty map)"
  556. locs[0x1ED] = "Algetty Tsunami"
  557. locs[0x1EE] = "Paradise Lost"
  558. locs[0x1EF] = "Death Peak Guardian Spawn"
  559. locs[0x1F0] = "Present"
  560. locs[0x1F1] = "Middle Ages"
  561. locs[0x1F2] = "Future"
  562. locs[0x1F3] = "Prehistoric"
  563. locs[0x1F4] = "Dark Ages"
  564. locs[0x1F5] = "Kingdom of Zeal"
  565. locs[0x1F6] = "Last Village"
  566. locs[0x1F7] = "Apocalypse"
  567. locs[0x1F8] = "(empty map)"
  568. locs[0x1F9] = "(empty map)"
  569. locs[0x1FA] = "(empty map)"
  570. locs[0x1FB] = "(empty map)"
  571. locs[0x1FC] = "(empty map)"
  572. locs[0x1FD] = "(empty map)"
  573. locs[0x1FE] = "(empty map)"
  574. locs[0x1FF] = "(empty map)"
  575.  
  576. local frame,locstart = 0,0
  577. local timesav,locsav = 0,0
  578. local timeend = 0
  579. local recentload = 0
  580. local second = 0
  581. local segcount = 0
  582.  
  583. function displayTime()
  584.     frame = frame + 1
  585.    
  586. --Catch battleflag change
  587.     if battleflag ~= memory.readbyte(BATTLE_FLAG) % 2 then
  588.         timeend = frame - locstart
  589.         second = timeend / 60
  590.         print(string.format("%6.2f",second).."\t"..locs[loc].." ("..segcount..")")
  591.         segcount = segcount + 1
  592.  
  593.         battleflag = memory.readbyte(BATTLE_FLAG) % 2
  594.         if recentload == 0 then locstart = frame end       
  595.     end
  596.    
  597. --Catch location change
  598.     if loc ~= memory.readword(LOCATION) then
  599.         timeend = frame - locstart
  600.         second = timeend / 60      
  601.         print(string.format("%6.2f",second).."\t"..locs[loc].." ("..segcount..")")
  602.         segcount = 0
  603.  
  604.         loc = memory.readword(LOCATION)
  605.         if recentload == 0 then locstart = frame end
  606.     end
  607.     recentload = 0
  608.  
  609.     gui.text(xoffset+146,yoffset+36,"  "..string.format("%6.2f",second), "#808080","#00000000")
  610. end
  611.  
  612. function Saving()
  613.     timesav = frame
  614.     locsav = locstart
  615.     batsav = batstart
  616. end
  617. savestate.registersave(Saving) -- for room timing, only works with MOST RECENT state
  618.  
  619. function Reload()
  620.     frame = timesav
  621.     locstart = locsav
  622.     batstart = batsav
  623.     recentload = 1
  624. end
  625. savestate.registerload(Reload)
  626.  
  627.  
  628. local redbox = {}
  629. redbox[0x70] = {0x14,0x2e,0x30,0x32,0x28}
  630. redbox[0x77] = {0x32,0x34,0x3c,0x3e,0x28,0x2a,0x46,0x1c,0x1e}
  631. redbox[0x91] = {0x14,0x16}
  632. redbox[0x8c] = {0x20,0x22,0x24,0x2e,0x30,0x1e,0x1a} --3 frogs are friendly
  633. redbox[0x1d5] = {0x1c,0x26}
  634. redbox[0xb0] = {0x20,0x22}
  635. --redbox[0xa8] = {0x14,0x16,0x18,0x1a,0x1c,0x1e} --ozzie pits
  636. redbox[0x8e] = {0x24}
  637. redbox[0x92] = {0x10,0x18}
  638. redbox[0x93] = {0x10,0x18,0x1a}
  639. redbox[0x96] = {0x10}
  640. redbox[0x90] = {0x10,0x12,0x1a}
  641. redbox[0x94] = {0x10,0x12}
  642. redbox[0x8f] = {0x28,0x2a,0x1c,0x2c}
  643. redbox[0x82] = {0x3c,0x44,0x40,0x26,0x28,0X32,0x38,0x24,0x30,0x34,0x36,0x10,0x16,0x18}
  644. redbox[0x83] = {0x66,0x68,0x5e,0x1c,0x2c,0x32,0x40,0x4c,0x4e,0x50}
  645. redbox[0x84] = {0x1a,0x1c,0x1e,0x20,0x22,0x24,}
  646. redbox[0x78] = {0x16}
  647. redbox[0x13] = {0x1c,0x24,0x26,0x28,0x2a,0x2c,0x2e,0x30,0x3c,0x3e,0x40}
  648. redbox[0x1C] = {0x4}
  649. redbox[0x15] = {0x22}
  650. redbox[0xd4] = {0x24,0x26,0x28,0x2a,0x3a,0x3c,0x3e,0x40,0x42,0x12,0x14,0x16,0x18,0x1a,0x1c}
  651. redbox[0xd7] = {0x10,0x12,0x14,0x16,0x18,0x1a,0x1c}
  652. redbox[0xd9] = {0x20,0x22,0x24,0x26,0x18,0x1a,0x1c,0x1e,0x14,0x16}
  653. redbox[0xe4] = {0x16,0x18,0x1a}
  654. redbox[0x1d1] = {0x20,0x22,0x24,0x26,0x28}
  655. redbox[0x112] = {0x12,0x14,0x16,0x18,0x1c,0x1e,0x22,0x24,0x26,0x28,0x2a,0x2c}
  656. redbox[0x11a] = {0x2a,0x2c,0x2e,0x30,0x32,0x34,0x36,0x38}
  657. redbox[0x11d] = {0x20,0x22}
  658. redbox[0x11e] = {0x10}
  659. redbox[0x11f] = {0x1a,0x1c,0x1e,0x20,0x22,0x24}
  660. redbox[0x120] = {0x14,0x16,0x18}
  661. redbox[0x11c] = {0x12,0x14,0x16,0x18}
  662. redbox[0xa4] = {0x16,0x18,0x1a}
  663. redbox[0x7d] = {0x12,0x22,0x1e}
  664. redbox[0x1be] = {0x24,0x26,0x28,0x2a,0x2c,0x2e}
  665. redbox[0x1bf] = {0x30,0x32,0x34,0x36,0x38,0x3a}
  666. redbox[0x125] = {0x18,0x1a,0x1c,0x1e,0x22,0x24,0x28,0x2c,0x26,0x30}
  667. redbox[0x126] = {0x16,0x1a,0x1c,0x28}
  668. redbox[0x12a] = {0x22,0x24,0x26,0x28,0x2c,0x2e,0x30,0x3e,0x42,0x40,0x5c,0x5e,0x60,0x62,0x6e,0x70,0x72}
  669. redbox[0x12b] = {0x14,0x12,0x16,0x18}
  670. redbox[0x131] = {0x10,0x12,0x14,0x1c,0x24,0x20}
  671. redbox[0x130] = {0x12,0x14}
  672. redbox[0x12f] = {0x1a,0x18}
  673. redbox[0xdb] = {0x10,0x12}
  674. redbox[0xa0] = {0x02,0x04,0x06,0x08,0x0a}
  675. redbox[0xa1] = {0x20}
  676. redbox[0xec] = {0x1c,0x36,0x3c,0x22,0x24,0x26,0x3e,0x46,0x28,0x16,0x18,0x14}    --sewer
  677. redbox[0xed] = {0x2c}   --sewer
  678. redbox[0x18a]= {0x16}   --woe
  679. redbox[0x188]= {0x32,0x34}  --woe
  680. redbox[0x189]= {0x2c}   --woe
  681. redbox[0x195]= {0x14,0x16,0x1e,0x20,0x2a,0x18,0x1a,0x1c}    --op
  682. redbox[0x196]= {0x14,0x1a,0x1c,0x2e,0x30,0x32,0x36,0x38,0x3a}   --op
  683. redbox[0x197]= {0x1c,0x1e,0x30,0x36,0x24,0x2a}  --op
  684. redbox[0x198]= {0x0e,0x10,0x12} --op
  685. redbox[0x199]= {0x26,0x28,0x2a,0x2c,0x30,0x32,0x34,0x36}    --op
  686. redbox[0x19a]= {0x0e,0x10}  --op
  687. redbox[0x171]= {0x1e}   --blackbird
  688. redbox[0x16b]= {0x30,0x32,0x34,0x36,0x38,0x3a}   -- giant's claw
  689. redbox[0xc3] = {0x1c,0x1e}   -- giant's claw
  690. redbox[0x139]= {0x10,0x18,0x1e,0x26,0x28,0x2a,0x2c,0x2e}     -- omen
  691. redbox[0x13a]= {0x10,0x12,0x14,0x1a,0x1c,0x1e,0x24,0x2c,0x2e,0x30,0x32,0x34,0x36,0x38,0x3e,0x40,0x42,0x44,0x46,0x48,0x4a}    -- omen
  692. redbox[0x13d]= {0x1a,0x26,0x28,0x2a,0x2c}
  693. redbox[0x142]= {0x10,0x12,0x14,0x2a,0x2c,0x2e}
  694. redbox[0x143]= {0x12,0x14} -- gigamute
  695. redbox[0x144]= {0x1a,0x1c}
  696. redbox[0xf5]= {0x10,0x12,0x14,0x16,0x18} -- deathpeak
  697. redbox[0xf6]= {0x16,0x12,0x14,0x1a,0x1c} -- deathpeak
  698. redbox[0x107]= {0x10,0x12,0x14} -- deathpeak
  699. redbox[0x108]= {0x16,0x18,0x14,0x20} -- deathpeak
  700. redbox[0x104]= {0x10,0x12,0x14,0x16,0x18,0x1a,0x1c,0x1e} -- deathpeak
  701. redbox[0x1a]= {0x18} -- yakra13
  702. redbox[0x1b8]= {0x1a,0x1c} -- yakra13
  703.  
  704. local trigger = {}
  705. trigger[0xc6] = {0x010d,0x020d,0x030d,0x040d,0x050d,0x060d,0x070d,0x080d,0x090d,0x0a0d,0x0b0d,0x0c0d,0x0d0d}
  706. trigger[0xd4] = {0x0c34,0x0d34,0x0e34,0x0f34,0x1034,
  707.                  0x0c33,0x0d33,0x0e33,0x0f33,0x1033,
  708.                  0x0c32,0x0d32,0x0e32,0x0f32,0x1032,
  709.                  0x0c31,0x0d31,0x0e31,0x0f31,0x1031,
  710.                  0x0c30,0x0d30,0x0e30,0x0f30,0x1030,
  711.                  0x1727,0x1827,0x1927,
  712.                  0x0714,0x0715,0x0716,0x0717,0x0718,0x0719,0x071a,0x071b,0x071c}
  713. trigger[0xd5] = {0x2622,0x2623,0x2624,0x2625,0x2626,
  714.                  0x2d37,0x2d38,0x2d39,0x2d3a,0x2d3b,
  715.                  0x2e31,0x2e30,
  716.                  0x3925,0x3a25,0x3b25,0x3c25,0x3d25,
  717.                  0x3437,0x3438,0x3439,0x343a,0x343b}
  718. trigger[0xda] = {0x352a,0x362a,0x372a,0x382a,0x392a,0x3a2a}
  719. trigger[0xe2] = {0x3424,0x3524,0x3624,0x3724,0x3824,0x3924,0x3a24,
  720.                  0x3423,0x3523,0x3623,0x3723,0x3823,0x3923,0x3a23,0x3b23,
  721.                  0x3422,0x3522,0x3622,0x3722,0x3822,0x3922,0x3a22,0x3b22,
  722.                  0x3421,0x3521,0x3621,0x3721,0x3821,0x3921,0x3a21}
  723. trigger[0xe6] = {0x1323,0x1324,0x1325,0x1326,
  724.                  0x0d23,0x0d24,0x0d25,0x0d26,0x0431,0x0d3d,0x0d3c}
  725. trigger[0x30] = {0x0914,0x0915,0x0916,0x0917,0x0918,0x0919,0x091a}
  726. trigger[0x31] = {0x1f2f,0x202f,0x212f,0x222f,0x232f,0x242f,0x252f,0x262f,0x272f,
  727.                  0x1f30,0x1f31,0x1f32,0x1f33,0x1f34,
  728.                  0x122b,0x122c,0x122d,0x122e,0x122f}
  729. trigger[0x2f] = {0x3235,0x3335,0x3435,0x3535,0x3635,0x3735,0x3835,0x3935,0x3a35,0x3b35,0x3c35,
  730.                  0x2933,0x2932,0x2931,0x2833,0x2832,0x2831,0x2a33,0x2a32,0x2a31,
  731.                  0x102c,0x0f2c,0x0e2c,0x0d2c,0x0c2c,0x0b2c,
  732.                  0x301f,0x311f,0x321f,0x331f,0x341f,0x351f,0x361f,0x371f,0x381f,0x391f}
  733. trigger[0x87] = {0x3308,0x3309,0x330a,0x2a07,0x2a08,0x2a09,0x2a0a}
  734. trigger[0x91] = {0x0e02,0x0e03,0x0e04,0x0e05,0x0d05,0x0c05,0x0b05,0x0a05,0x0905}
  735. trigger[0x8e] = {0x0518,0x0618,0x0418,0x0318,0x0218}
  736. trigger[0x2a] = {0x0712,0x0612,0x0512,0x0812,0x1012,0x0912}
  737. trigger[0xa8] = {0x320a,0x3310,0x390f,0x390c,0x3a08,0x3c0b,
  738.                  0x320b,0x3311,0x3910,0x390d,0x3a09,0x3c0c,
  739.                  0x330a,0x3410,0x3a0f,0x3a0c,0x3b08,0x3d0b,
  740.                  0x330b,0x3411,0x3a10,0x3a0d,0x3b09,0x3d0c}
  741. trigger[0x124] = {0x080e,0x090e,0x0a0e,0x0b0e,0x070e,0x060e,0x050e,0x030e,0x020e,0x010e,0x000e,0x0d0e,0x0e0e}
  742. trigger[0x12e] = {0x0f0d,0x0f0e,0x0f0f,0x0f10,0x0f11}
  743. trigger[0xa0] = {0x0e10,0x0d10,0x0c10,0x0b10,0x0a10,0x0910,0x0f10,0x1010,0x1110,0x1210,0x1310,0x1410,0x1510,
  744.                  0x0909,0x090a,0x090b,0x090c,0x090d,0x090e,0x090f}
  745. trigger[0x1d6] = {0x252e,0x262e,0x272e,0x282e,0x292e,
  746.                  0x2522,0x2622,0x2722,0x2822,0x2922,
  747.                  0x2516,0x2616,0x2716,0x2816,0x2916,
  748.                  0x250a,0x260a,0x270a,0x280a,0x290a,0x2705}              
  749. trigger[0xe0] = {0x0707,0x0708,0x0709,0x070a,0x070b,0x070c,0x070d,0x1d0a,0x1d0b,0x1d0c,0x1d0d}
  750. trigger[0x184]= {0x072f,0x062f,0x052f,0x082f,0x092f,0x0a2f,
  751.                  0x061d,0x051d,0x041d,0x031d,
  752.                  0x0811,0x0911,0x0a11,0x0b11} --beasts
  753. trigger[0x18a]= {0x232d,0x242d,0x252d,0x262d,0x272d,0x282d,0x292d}
  754. trigger[0x188]= {0x2407,0x2408,0x2409,0x240a,0x240b,
  755.                  0x0f13,0x1013,0x1113,0x1213,0x1313,0x1413,
  756.                  0x3210,0x3211,0x3212,0x3213,0x3214,0x3215,0x3216,
  757.                  0x2e1e,0x2e1f,0x2e20,0x2e21,0x2e22,0x2e23,0x2e24,0x2e25,
  758.                  0x302d,0x302d,0x302e,0x302f,0x302d,0x3030,0x3031,0x3032,0x3033,0x3034,0x3035,0x3036,0x3037,0x3038,0x3039}
  759. trigger[0x189]= {0x0c29,0x0d29,0x0e29,0x0f29,0x1029,0x1129,0x1229,
  760.                  0x1911,0x1912}
  761. trigger[0x199]= {0x010d,0x020d,0x030d,0x040d,0x050d,0x060d,0x070d,0x080d,0x090d,0x0a0d,0x0b0d,0x0c0d,0x0d0d,0x0e0d,
  762.                  0x116d,0x126d,0x136d,0x146d,0x156d,0x166d,0x176d,0x186d,0x196d,0x1a6d,0x1b6d,0x1c6d,0x1d6d,0x1e6d}
  763. trigger[0x19b]= {0x0013,0x0113,0x0213,0x0313,0x0413,0x0513,0x0613,0x0713,0x0813,0x0913,0x0a13,0x0b13,0x0c13,0x0d13,0x0e13,0x0f13}
  764. trigger[0x16b]= {0x1019,0x0f19,0x0e19,0x0d19,0x0c19} -- giant's claw
  765. trigger[0xc4] = {0x163a,0x163b,0x163c,0x0a3a,0x0a3b,0x0a3c} -- giant's claw
  766. trigger[0x128]= {0x3338,0x3438,0x3538,0x3638,0x3738,0x3838} -- giant's claw
  767. trigger[0x6d] = {0x1c0d,0x1c0e,0x1c0f,0x1c10,0x1c11} -- giant's claw
  768. trigger[0xc5] = {0x0b29,0x0c29,0x0d29} -- giant's claw
  769. trigger[0xb7] = {0x2128,0x2228,0x2328,0x2428,0x2528,0x2628,0x2728,0x2828,0x2928,0x2a28,0x2b28,0x2c28,0x2d28} -- ozzie
  770. trigger[0xb2] = {0x1411,0x1511,0x1611,0x1711,0x1811,0x1911,0x1a11} -- ozzie
  771. trigger[0xb8] = {0x2128,0x2228,0x2328,0x2428,0x2528,0x2628,0x2728,0x2828,0x2928,0x2a28,0x2b28,0x2c28,0x2d28} -- ozzie
  772. trigger[0xb3] = {0x0124,0x0224,0x0324,0x0824,0x0924,0x0a24,0x0b24,0x0c24,0x0d24} -- ozzie
  773. --final ozzie
  774. trigger[0x13e]= {0x1808,0x1809,0x180a,0x180b,0x180c,0x1b08,0x1b09,0x1b0a,0x1b0b,0x1b0c, -- omen
  775.                  0x3508,0x3509,0x350a,0x350b,0x350c,0x3808,0x3809,0x380a,0x380b,0x380c}
  776.  
  777.  
  778. local warning = {}
  779. warning[0x92] = {0x081b}
  780. warning[0x70] = {0x0d09,0x0c09,0x0b09,0x0e09,0x0712,0x0912,0x0812,0x0b0d,0x0c0d}
  781. warning[0x7a] = {0x30,0x32,0x34}
  782. warning[0x48] = {0x1211,0x1212,0x1213,0x1207,0x1208,0x1209}
  783. warning[0x8e] = {0x1235,0x0f35,0x0e35,0x0d35,
  784.                  0x1234,0x1134,0x1034,0x0f34,0x0d34}
  785. warning[0x120] ={0x0622,0x0623,0x0624,0x0625,0x0626,0x0627,0x0628,0x0629,0x062a,0x062b,0x062c,0x062d,0x062e,0x062f,0x0630,0x0631,0x0632,
  786.                  0x0722,0x0723,0x0724,0x0725,0x0726,0x0727,0x0728,0x0729,0x072a,0x072b,0x072c,0x072d,0x072e,0x072f,0x0730,0x0731,0x0732,
  787.                  0x0822,0x0823,0x0824,0x0825,0x0826,0x0827,0x0828,0x0829,0x082a,0x082b,0x082c,0x082d,0x082e,0x082f,0x0830,0x0831,0x0832,
  788.                  0x0436,0x0536,0x0636,0x0736,
  789.                  0x0437,0x0537,0x0637,0x0737,
  790.                  0x0438,0x0538,0x0638,0x0738}
  791. warning[0x196]= {0x240a,0x240b,0x240c,0x240d,0x240e,0x240f,0x2410}
  792. warning[0x135]= {0x0727,0x0827,0x0927,0x0a27,0x0627,0x0628,0x0629,0x062a,0x062b,0x062c,0x062d,0x071b,0x081b} --omen
  793. warning[0x137]= {0x071a,0x081a,0x0706,0x0806} --omen
  794. warning[0x138]= {0x061e,0x061d,0x061c,0x071e,0x071d,0x071c,0x081e,0x081d,0x081c,0x091e,0x091d,0x091c,0x0a1e,0x0a1d,0x0a1c,0x0b1d,0x0b1c,
  795.                  0x031f,0x041f,0x051f,0x061f,0x071f,0x081f,0x091f,0x0a1f,0x0b1f,
  796.                  0x0320,0x0420,0x0520,0x0620,0x0720,0x0820,0x0920,0x0a20,0x0b20,0x0c20, --omen
  797.                  0x0421,0x0521,0x0621,0x0721,0x0821,0x0921,0x0a21,0x0b21,0x0c21,0x0d21, --omen
  798.                  0x0522,0x0622,0x0722,0x0822,0x0922,0x0a22,0x0b22,0x0c22,0x0d22,0x0e22, --omen
  799.                  0x0623,0x0723,0x0823,0x0923,0x0a23,0x0b23,0x0c23,0x0d23,0x0e23, --omen
  800.                  0x0724,0x0824,0x0924,0x0a24,0x0b24,0x0c24,0x0d24,0x0e24, --omen
  801.                  0x0825,0x0925,0x0a25,0x0b25,0x0c25,0x0d25,0x0e25,
  802.                  0x0926,0x0a26,0x0b26,0x0c26,0x0d26,
  803.                  0x0927,0x0a27,0x0b27}
  804. warning[0x13f]= {0x3735,0x3835,0x3636,0x3736,0x3836,0x3936,0x3637,0x3737,0x3837,0x3937} -- omen
  805. warning[0xf4]= {0x3731,0x3732,0x3820,0x3821} -- deathpeak
  806.                  
  807. function displayHitbox()
  808.  
  809.     for i = 1,64 do
  810.         mapx[i] = math.floor(memory.readword(MAP_X + 2*(i-1))/16)
  811.         mapy[i] = math.floor(memory.readword(MAP_Y + 2*(i-1))/16)
  812.         facing[i] = memory.readbyte(FACING + 2*(i-1))
  813.         if memory.readbyte(MOVING + 2*(i-1)) > 0 then
  814.             moving[i] = 1
  815.         else moving[i] = 0 end
  816.     end
  817.        
  818.     spritex = {}
  819.     spritey = {}
  820.     mainsprite = 0
  821.     farsprite = 0
  822.     for i = 1,16 do     -- get one sprite to compare
  823.         spritex[i] = memory.readword(SCREEN_X + 2*(i-1))
  824.         spritey[i] = memory.readword(SCREEN_Y + 2*(i-1))
  825.         if loc == 0xa0 then mainsprite = 7
  826.         elseif loc == 0xa1 then mainsprite = 8
  827.         elseif mainsprite == 0 and spritex[i] > 0 and spritey[i] > 0 and mapx[i] ~= 0xFF0 and
  828.             (mapy[i] ~= 0xff0 and mapx[i] ~= 0x178) and
  829.             (mapy[i] ~= 0xff0 and mapx[i] ~= 0x088) and
  830.             (mapy[i] ~= 0xff0 and mapx[i] ~= 0x298) and
  831.             (mapy[i] ~= 0xff0 and mapx[i] ~= 0x368) and
  832.             (mapy[i] ~= 0xff0 and mapx[i] ~= 0x268) and
  833.             (mapy[i] ~= 0xff0 and mapx[i] ~= 0x2b8) and
  834.             (mapy[i] ~= 0xff0 and mapx[i] ~= 0x0c8) and
  835.             (mapy[i] ~= 0xff0 and mapx[i] ~= 0xff8) then
  836.                 mainsprite = i
  837.         end
  838.     end
  839.     if mainsprite ~= 0 then
  840.         mapoffsetx = mapx[mainsprite] - spritex[mainsprite]
  841.         mapoffsety = mapy[mainsprite] - spritey[mainsprite]
  842.     end
  843.  
  844.     if warning[loc] ~= nil then
  845.         if table.getn(warning[loc]) ~= nil then
  846.             for j = 1,table.getn(warning[loc]) do
  847.                 screenx = math.floor(warning[loc][j] / 0x100)*0x10 - mapoffsetx
  848.                 screeny = (warning[loc][j] % 0x100)*0x10 - mapoffsety
  849.                 gui.box(screenx,screeny,screenx+16,screeny+16,"#ffff0020","#ffff00"..outfade)
  850.             end
  851.         end
  852.     end
  853.     if mainsprite ~= 0 and trigger[loc] ~= nil then
  854.         special = 0
  855.         if loc == 0xa8 then special = 8 end
  856.         if table.getn(trigger[loc]) ~= nil then
  857.             for j = 1,table.getn(trigger[loc]) do
  858.                 screenx = math.floor(trigger[loc][j] / 0x100)*0x10 - mapoffsetx --+ special
  859.                 screeny = (trigger[loc][j] % 0x100)*0x10 - mapoffsety
  860.                 gui.box(screenx,screeny,screenx+15,screeny+7,"#404040"..infade,"#404040"..outfade)
  861.                 if screenx -1 < spritex[mainsprite] then
  862.                     gui.box(screenx,screeny,screenx+7,screeny+7,"#ff0000"..infade,"#ff0000"..outfade)
  863.                 else gui.box(screenx+8,screeny,screenx+15,screeny+7,"#ff0000"..infade,"#ff0000"..outfade) end
  864.             end
  865.         end
  866.     end
  867.     boxlimit = 64
  868.     if loc == 0xa8 then boxlimit = 8 end
  869.     for i = 1,boxlimit do
  870.         isred = 0
  871.         screenx = mapx[i] - mapoffsetx - 8
  872.         screeny = mapy[i] - mapoffsety - 16
  873.         if screenx < 260 and screeny < 216 then
  874.             if i < 9 then color = "#0000ff00" else color = "#00ff0000" end
  875.             if redbox[loc] ~= nil then
  876.                 if table.getn(redbox[loc]) ~= nil then
  877.                     for j = 1,table.getn(redbox[loc]) do
  878.                         if i == redbox[loc][j]/2+1 then
  879.                             color = "#ff0000"..infade
  880.                             isred = 1
  881.                         end
  882.                     end
  883.                 end
  884.             end
  885.             if isred == 1 or dispCronobox == 1 then
  886.                 screenx2 = screenx + 15
  887.                 screeny2 = screeny + 15
  888.                 if     facing[i] == 0 then --up
  889.                     screeny = screeny - faceoffset*moving[i]
  890.                     screeny2= screeny2- faceoffset
  891.                 elseif facing[i] == 1 then --down
  892.                     screeny = screeny + faceoffset
  893.                     screeny2= screeny2+ faceoffset*moving[i]
  894.                 elseif facing[i] == 2 then --left
  895.                     screenx = screenx - faceoffset*moving[i]
  896.                     screenx2= screenx2- faceoffset
  897.                 elseif facing[i] == 3 then  --right
  898.                     screenx = screenx + faceoffset
  899.                     screenx2= screenx2+ faceoffset*moving[i]
  900.                 end
  901.            
  902.                 gui.box(screenx-7,screeny-7,screenx2+7,screeny2+7, "#40804020","#C0C040"..outfade)
  903.                 gui.box(screenx,screeny,screenx2,screeny2,color,"#ff0000"..outfade)
  904.             end
  905.             if (dispboxID == 1) then
  906.                 gui.text(screenx+faceoffset, screeny+faceoffset, string.format("%x",2*(i-1)),"#FFFFFF","#00000000")
  907.             end
  908.         end
  909.     end
  910.     gui.box(0,211,256,224,"#000000")
  911. end
  912.  
  913.  
  914. local BATTLE_VALUE = 0x7e0026
  915. local BATTLE_STORE = 0x7e29AD
  916. local CRIT_VALUE = 0x7eB3E6
  917. local MENU_TIME = 0x7e0D00
  918. local menutime = 0
  919. local menuopen = 0
  920. local CHAR_ID = 0x7e2980  -- 3 in-party, 6 reserve
  921. local chars = {}
  922. local ATB = 0x7eAFAB
  923. local atb = {}
  924. for i = 0,10 do atb[i] = memory.readbyte(ATB+i) end
  925.  
  926. local windowname = {}
  927.     windowname[0] = {"00","01","02","05","07","09","11","14","18","23","26","28","33","36","39","41"}
  928.     windowname[1] = {"00","01","02","05","09","12","15","16","19","22","25","28","31","35","39","42"}
  929.     windowname[2] = {"00","02","03","05","07","11","15","16","18","20","24","28","32","35","39","41"}
  930.  
  931. local battlewindow = {} --set of windows for 0, 1, and 2 empty characters
  932.     battlewindow[0] = { 0,0x09,0x0d,0x1d,0x2e,0x37,0x3e,0x58,0x61,0x88,0x98,0xab,0xb9,0xdc,0xe3,0xfb,256}
  933.     battlewindow[1] = { 0,0x0d,0x12,0x17,0x35,0x40,0x5c,0x67,0x6a,0x88,0x8f,0xad,0xb3,0xd0,0xe4,0xfd,256}
  934.     battlewindow[2] = { 0,0x0b,0x18,0x1d,0x2c,0x33,0x64,0x66,0x6d,0x79,0x85,0xa7,0xb6,0xd3,0xe6,0xf7,256}
  935.  
  936. local bvrec = {}
  937. local bvsave = 0
  938. function Reload()
  939.     bvrec = {}
  940. end
  941. savestate.registerload(Reload)
  942. bvreccolor = {}
  943. for i = 0,255 do bvreccolor[i] = 8 end
  944.  
  945.     secrange = {"0",".5","1","1.5","2","2.5","3","3.5","4"}
  946.     rulecolors={"#A00000","#FF0000",
  947.                 "#008000","#00FF00",
  948.                 "#0000FF","#2020FF",
  949.                 "#A0A0A0","#FFFFFF",
  950.                 "#A000A0","#FF00FF",
  951.                 "#808000","#FFFF00",
  952.                 "#008080","#00FFFF",
  953.                 "#404040","#808080"}
  954.                
  955. function getValues()
  956.    
  957. --Catch the BV copy
  958.     if battlecopy == 0 and battleflag == 1 and memory.readbyte(BATTLE_VALUE) == memory.readbyte(BATTLE_STORE) then
  959.             battlecopy = 1
  960.     elseif battleflag == 0 then
  961.         battlecopy = 0
  962.     end
  963.  
  964. --Get the active PCs
  965.     mtchars = 0
  966.     for i = 1,3 do
  967.         chars[i] = memory.readbyte(CHAR_ID+i-1)
  968.         if chars[i] >= 0x07 then mtchars = mtchars + 1 end
  969.     end
  970.    
  971. --Value is at different address for in-battle, out-of-battle, & load menu:
  972.     if battlecopy == 1 then
  973.         bv = memory.readbyte(BATTLE_VALUE)
  974.         cv = memory.readbyte(CRIT_VALUE)
  975.     else
  976.         if (memory.readbyte(MENU_TIME) > 0 and memory.readbyte(BATTLE_STORE) == 0 and mtchars == 0) then
  977.         --menutime is for ALL menus, BV is 0 for entire beginning... but load menu has "3 Crono's" (000000)
  978.             bv = memory.readbyte(MENU_TIME)
  979.             bvrec = {}
  980.         else bv = memory.readbyte(BATTLE_STORE) end
  981.         cv = bv
  982.     end
  983.    
  984.     if bv > bvsave then
  985.         for i = bvsave+1,bv-1 do bvrec[i] = 0 end
  986.         bvrec[bv] = 1
  987.         bvsave = bv
  988.         bvreccolor[bv] = 8
  989.     elseif bv < bvsave then
  990.         for i = bvsave+1,255 do bvrec[i] = 0 end
  991.         for i = 0,bv-1 do bvrec[i] = 0 end
  992.         bvrec[bv] = 1
  993.         bvsave = bv
  994.         bvreccolor[bv] = 8
  995.     end
  996.  
  997. --catch ATB reset
  998.     newatb = {}
  999.     for i = 0,10 do
  1000.         newatb[i] = memory.readbyte(ATB+i)
  1001.         if atb[i] == 0 and newatb[i] ~= 0 and newatb[i] ~= 0x80 then
  1002.             if bvreccolor[bv] == 8 then
  1003.                 if i < 3 then
  1004.                     bvreccolor[bv] = chars[i+1]
  1005.                 else
  1006.                     bvreccolor[bv] = 7
  1007.                 end
  1008.             end
  1009.         end
  1010.         atb[i] = newatb[i]
  1011.     end
  1012. end
  1013.  
  1014. function displayValues()
  1015.  
  1016.     rulecolor = 1
  1017.     for j = 1,16 do
  1018.         if bv >= battlewindow[mtchars][j] and bv < battlewindow[mtchars][j+1] then
  1019.             rulecolor = j
  1020.         end
  1021.     end
  1022.     gui.text(bv,dispy+26,string.format("%x",bv),rulecolors[rulecolor],"#00000000")
  1023.    
  1024.     for i = 0,255 do
  1025.         for j = 1,16 do
  1026.             if i >= battlewindow[mtchars][j] and i < battlewindow[mtchars][j+1] then
  1027.                 rulecolor = j
  1028.             end
  1029.         end
  1030.  
  1031.         gui.pixel(i,dispy+24,rulecolors[rulecolor])
  1032.         if i%4 == 0 then gui.pixel(i,dispy+25,rulecolors[rulecolor]) end
  1033.         if i%16 == 0 then
  1034.             gui.pixel(i,dispy+26,rulecolors[rulecolor])
  1035.             gui.pixel(i,dispy+27,rulecolors[rulecolor]) end
  1036.         if bvrec[i] == 1 then
  1037.             gui.pixel(i,dispy+23,charcolor[bvreccolor[i]+1])
  1038.             if bvreccolor[i] < 7 then
  1039.                 gui.pixel(i,dispy+22,charcolor[bvreccolor[i]+1])
  1040.             end
  1041.         end
  1042.     end
  1043.     gui.pixel(bv,dispy+21,charcolor[bvreccolor[bv]+1])
  1044.     gui.pixel(bv,dispy+22,charcolor[bvreccolor[bv]+1])
  1045.     gui.pixel(bv,dispy+23,charcolor[bvreccolor[bv]+1]) 
  1046. end
  1047.  
  1048.  
  1049. local CHAR_ID = 0x7e2980  -- 3 in-party then 6 reserve (e.g. for 1-on-1 bosses)
  1050. local CHAR_WEAP = 0x7e2629
  1051. local CHAR_ACC = 0x7e262A
  1052. local crits =   "0737062067712743017053012106621026206760245002737143667207070014"..
  1053.                 "1101674231747620560305126422403270125313166113731602620666773021"..
  1054.                 "1714114244363074011420427072702021156152710015037100071773030063"..
  1055.                 "3110560024303132144471071671003163600200333701061633241110004006"..
  1056.                 "0737062067" --wrap-around
  1057.                
  1058. function displayCrits()
  1059.  
  1060. --Get equipment and their crit chance
  1061.     chance = {}
  1062.     crittext = ""
  1063.     for i = 1,3 do
  1064.         if chars[i] < 0x07 then
  1065.             weap = memory.readbyte(CHAR_WEAP + 0x50*(chars[i]))
  1066.             acc = memory.readbyte(CHAR_ACC + 0x50*(chars[i]))
  1067.             if     weap == 0x55 then -- rainbow
  1068.                 chance[i] = 1      
  1069.             elseif acc  == 0xB3 and (weap == 0x42 or weap == 0x3D) then -- masamune+heromedal
  1070.                 chance[i] = 2  
  1071.             elseif weap == 0x40 or   weap == 0x19 or weap == 0x1A  then -- wonder, siren, valkerye
  1072.                 chance[i] = 3  
  1073.             elseif weap == 0x53 then -- swallow
  1074.                 chance[i] = 4      
  1075.             elseif weap == 0x54 or chars[i] == 4 then -- slasher2 (22)
  1076.                 chance[i] = 5
  1077.             elseif weap == 0x0D or chars[i] == 1 or chars[i] == 2 or chars[i] == 5 then -- kaliblade
  1078.                 chance[i] = 6
  1079.             elseif chars[i] == 0 or chars[i] == 3 or chars[i] == 6 then
  1080.                 chance[i] = 7 end
  1081.         else    chance[i] = 8 end
  1082.     end
  1083.  
  1084.     for i = 1,6 do
  1085.         cc = 7
  1086.         critconf = 0       
  1087.         cv = cv + 1
  1088.         for j = 1,3 do
  1089.             if chance[j] <= tonumber(crits:sub(cv,cv)) then
  1090.                 critconf = critconf + 1
  1091.                 if critconf == 1 then
  1092.                     cc = chars[j] + 1
  1093.                 elseif critconf > 1 then
  1094.                 end
  1095.             end
  1096.         end
  1097.         writeDigit(tonumber(crits:sub(cv,cv)),184+i*10,charcolor[cc],charshade[cc])
  1098.     end
  1099. end
  1100.  
  1101.  
  1102. local emuframe = 0
  1103. local moviedata = {}
  1104. local movieoffset = 0
  1105.  
  1106. function displayJoypad()
  1107.  
  1108.     emuframe = emu.framecount()
  1109.  
  1110. --Read in movie file:
  1111.     if movie.mode() == "playback" and movieoffset == 0 then
  1112.         f = io.open(movie.name(), "rb")
  1113.         byte = f:read(1)
  1114.         while byte ~= nil do
  1115.             byte = string.byte(byte)
  1116.             table.insert(moviedata, byte)
  1117.             byte = f:read(1)
  1118.         end
  1119.         f:close()
  1120.         for i = 0,3 do
  1121.             movieoffset = movieoffset + moviedata[0x1C+1+i]*(0x100^i)
  1122.         end
  1123.     end
  1124.    
  1125. --Get inputs either from movie or user:
  1126.     if movie.mode() == "playback" then
  1127.         word = moviedata[movieoffset + emuframe*2 + 1] + moviedata[movieoffset + emuframe*2]*0x100
  1128.         word = math.floor(word / 16)  --discard 4 lowest bits; Lua uses all doubles (floating point)
  1129.         for i = 1, 12 do
  1130.             if word % 2 == 1 then
  1131.                 inputs[ button[i] ] = true
  1132.             else inputs[ button[i] ] = nil end
  1133.             word = math.floor(word / 2)
  1134.         end
  1135.     else inputs = joypad.get() end
  1136.  
  1137. --Draw each button (color it based on hold duration):
  1138.     for i = 1, 12 do
  1139.         if inputs[button[i]] then
  1140.             if unpress[i] > 0 then
  1141.                 press[i] = 0
  1142.                 if unpress[i] == 6 then
  1143.                     turbo[i] = 1
  1144.                 else
  1145.                     turbo[i] = 0
  1146.                 end
  1147.                 unpress[i] = 0
  1148.             end
  1149.             if press[i] < 240 then
  1150.                 press[i] = press[i] + 6
  1151.             end
  1152.         else
  1153.             if unpress[i] ~= 0 then -- i.e. was pressed in previous frame
  1154.                 turbo[i] = 0
  1155.             end
  1156.             if unpress[i] < 240 then
  1157.                 unpress[i] = unpress[i] + 6
  1158.             end
  1159.         end
  1160.  
  1161.         shoulder = 0
  1162.         if i == 1 or i == 2 then shoulder = 1 end
  1163.        
  1164.         buttontext = "#000000c0"
  1165.         buttoncolor = "#00000000"
  1166.         if inputs[button[i]] then
  1167.             buttoncolor = "#"..string.format("%02x",0xF0-press[i]).."ff80".."a0"
  1168.         elseif press[i] > 0 then
  1169.             darken = string.rep(string.format("%02x",0xF0-press[i]),3)
  1170.             buttoncolor = "#"..string.format("%02x",press[i]).."00"..string.format("%02x",0xF0-press[i])..string.format("%02x",160-unpress[i]/3*2)
  1171.         end
  1172.         if turbo[i] == 1 then
  1173.             buttontext = "#ff0000c0"
  1174.             buttoncolor = "#ffffffa0"
  1175.         end
  1176.  
  1177.         bx = 10
  1178.         by = 8
  1179.         gui.box(
  1180.             xoffset+xcoords[i]*bx, yoffset+ycoords[i]*by,
  1181.             xoffset+xcoords[i]*bx+bx +shoulder*bx, yoffset+ycoords[i]*by+by -shoulder*3, buttoncolor, buttoncolor)
  1182.         gui.text(xoffset+xcoords[i]*bx+4, yoffset+ycoords[i]*by+0,btnlabel[i],buttontext,"#00000000")
  1183.     end
  1184. end
  1185.  
  1186.  
  1187. while true do
  1188.  
  1189.     inputs = joypad.get()
  1190.     getValues()
  1191.    
  1192.     --Catch <select> pressed
  1193.     if inputs[ button[10] ] then
  1194.         if selectheld == 0 then
  1195.             selectheld = 1
  1196.             if dispbox == 4 then
  1197.                 dispbox = 1
  1198.             else dispbox = dispbox + 1 end
  1199.         end
  1200.     else selectheld = 0 end
  1201.    
  1202.    
  1203.     if menutime ~= memory.readbyte(MENU_TIME) then
  1204.         if menuopen == 0 then
  1205.             menuopen = 1 end
  1206.     else menuopen = 0 end
  1207.     menutime = memory.readbyte(MENU_TIME)
  1208.  
  1209. --Display all
  1210.     if (dispbox < 3) and loc < 0x1F0 and menuopen == 0 and battleflag == 0 then
  1211.         displayHitbox()
  1212.     end
  1213.     if dispbox % 2 > 0 then
  1214.         displayJoypad()
  1215.     end
  1216.     if dispbox > 0 and mtchars < 3 then
  1217.         displayValues()
  1218.         displayTime()
  1219.     --  displayCrits()
  1220.     end
  1221.    
  1222.     emu.frameadvance()
  1223. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top