mirror of
https://github.com/notwa/mm
synced 2024-11-05 16:09:03 -08:00
add crappy old scene flag monitor
This commit is contained in:
parent
6d0bf9dbe3
commit
e6240fb72c
3 changed files with 64 additions and 0 deletions
|
@ -8,6 +8,7 @@ local classes = {
|
|||
"Monitor",
|
||||
"ByteMonitor",
|
||||
"FlagMonitor",
|
||||
"SceneFlagMonitor",
|
||||
"ActorLister",
|
||||
"InputHandler",
|
||||
}
|
||||
|
|
19
Lua/classes/SceneFlagMonitor.lua
Normal file
19
Lua/classes/SceneFlagMonitor.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
local Monitor = require "classes.Monitor"
|
||||
local SceneFlagMonitor = Class(Monitor)
|
||||
|
||||
function SceneFlagMonitor:mark(i, x, x1)
|
||||
if not x1 then return end
|
||||
local now = emu.framecount()
|
||||
local diff = bit.bxor(x, x1)
|
||||
for which = 0, 7 do
|
||||
if bit.band(diff, 2^which) ~= 0 then
|
||||
local state = bit.band(x, 2^which) ~= 0 and 1 or 0
|
||||
local col = (3 - i)*8 + which
|
||||
str = ('%s: %02i=%i'):format(self.name, col, state)
|
||||
printf('%s @%i', str, now)
|
||||
message(str, 180)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return SceneFlagMonitor
|
44
Lua/scene flag monitor.lua
Normal file
44
Lua/scene flag monitor.lua
Normal file
|
@ -0,0 +1,44 @@
|
|||
require "boilerplate"
|
||||
require "addrs.init"
|
||||
require "classes"
|
||||
require "messages"
|
||||
|
||||
local x1 = SceneFlagMonitor('x1', addrs.current_scene_flags_1)
|
||||
local x2 = SceneFlagMonitor('x2', addrs.current_scene_flags_2)
|
||||
local x3 = SceneFlagMonitor('x3', addrs.current_scene_flags_3)
|
||||
local x4 = SceneFlagMonitor('x4', addrs.current_scene_flags_4)
|
||||
local x5 = SceneFlagMonitor('x5', addrs.current_scene_flags_5)
|
||||
local scenes = {}
|
||||
local n1 = -1
|
||||
while mm or oot do
|
||||
local n = addrs.scene_number()
|
||||
if n ~= n1 then
|
||||
if not scenes[n] then
|
||||
scenes[n] = {}
|
||||
printf('new scene %04X',n)--already has {TODO} flags', n)
|
||||
end
|
||||
if not scenes[n1] then
|
||||
scenes[n1] = {}
|
||||
end
|
||||
|
||||
scenes[n1][1] = x1.old_bytes
|
||||
scenes[n1][2] = x2.old_bytes
|
||||
scenes[n1][3] = x3.old_bytes
|
||||
scenes[n1][4] = x4.old_bytes
|
||||
scenes[n1][5] = x5.old_bytes
|
||||
x1.old_bytes = scenes[n][1] or {}
|
||||
x2.old_bytes = scenes[n][2] or {}
|
||||
x3.old_bytes = scenes[n][3] or {}
|
||||
x4.old_bytes = scenes[n][4] or {}
|
||||
x5.old_bytes = scenes[n][5] or {}
|
||||
end
|
||||
n1 = n
|
||||
|
||||
x1:diff()
|
||||
x2:diff()
|
||||
x3:diff()
|
||||
x4:diff()
|
||||
x5:diff()
|
||||
draw_messages()
|
||||
emu.frameadvance()
|
||||
end
|
Loading…
Reference in a new issue