mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-09-29 23:14:53 -04:00
clean up
This commit is contained in:
@@ -1,10 +1,4 @@
|
||||
-- rse-seams e10 spec 5.5/5.6: loadhelp/unloadhelp drive a dedicated help
|
||||
-- MESSAGE window (not the L/R Help browser).
|
||||
-- pret src/scrcmd.c:1274-1280 (loadhelp: ScriptReadWord, fallback ctx->data[0])
|
||||
-- pret src/scrcmd.c:1285-1289 (unloadhelp)
|
||||
-- pret src/new_menu_helpers.c:701-705 (DrawHelpMessageWindowWithText)
|
||||
-- pret src/new_menu_helpers.c:707-710 (DestroyHelpMessageWindow_ — safe when closed)
|
||||
-- lua: luajit tests/engine/game3_help_window_opcode_test.lua
|
||||
-- src/scrcmd.c:1274-1280, src/scrcmd.c:1285-1289, src/new_menu_helpers.c:701-705, src/new_menu_helpers.c:707-710
|
||||
|
||||
package.path = "./?.lua;./?/init.lua;" .. package.path
|
||||
|
||||
@@ -29,8 +23,6 @@ local function vm(texts)
|
||||
adapters = { log = function() end },
|
||||
setPc = function() end,
|
||||
texts = texts or {},
|
||||
-- getText hands the dispatcher an IR table like the real Vm does
|
||||
-- (Vm:getText returns the bundle's parsed text, ops_a then runs toPlain).
|
||||
getText = function(self, key)
|
||||
local s = self.texts[key]
|
||||
return s and TextIR.fromAscii(s)
|
||||
@@ -38,22 +30,17 @@ local function vm(texts)
|
||||
}
|
||||
end
|
||||
|
||||
-- 1. loadhelp opens the window with the resolved string.
|
||||
HelpWindow.close()
|
||||
local v = vm({ [Opcodes.key(0xABC)] = "Some HELP text." })
|
||||
eq(Ops.dispatch(v, { op = "loadhelp", [1] = 0xABC }), false, "loadhelp does not yield")
|
||||
eq(HelpWindow.isOpen(), true, "the help message window is open")
|
||||
eq(HelpWindow.getText(), "Some HELP text.", "the resolved text reached the window")
|
||||
|
||||
-- 2. unloadhelp closes it; closing again with nothing open is a no-op
|
||||
-- (pret DestroyHelpMessageWindow_ is safe either way).
|
||||
eq(Ops.dispatch(v, { op = "unloadhelp" }), false, "unloadhelp does not yield")
|
||||
eq(HelpWindow.isOpen(), false, "the window closed")
|
||||
eq(Ops.dispatch(v, { op = "unloadhelp" }), false, "unloadhelp with no window is a no-op")
|
||||
eq(HelpWindow.isOpen(), false, "still closed")
|
||||
|
||||
-- 3. resolve_text fallback: pointer 0/nil falls back to ctx.data[0] and an
|
||||
-- unresolved pointer opens the window without raising.
|
||||
v.ctx.data = v.ctx.data or {}
|
||||
v.ctx.data[0] = "T_FALLBACK"
|
||||
local v2 = vm()
|
||||
|
||||
Reference in New Issue
Block a user