-- Adventures in Videoland: Rollercoaster as it ships, driven by videolandDrive.singe and -- traced. PORT_GAME names the title's folder under the library and PORT_SCRIPT its script -- under it; run with -v the title's framefile. local here = ((debug.getinfo(1, "S").source:gsub("^@", "")):match("^(.*[/\\])") or "") local library = os.getenv("SINGE_LIBRARY") or (os.getenv("HOME") .. "/claude/singetest") local game = os.getenv("PORT_GAME") or "Rollercoaster" local script = library .. "/" .. (os.getenv("PORT_SCRIPT") or (game .. "/" .. game .. ".singe")) dofile(here .. "videolandDrive.singe") SINGE_LEGACY_SPRITE_ARGS = true -- The game seeds its random draws from os.time at load: pinned, as the port's is. os.time = function(...) return 12345 end local realScriptPath = singeGetScriptPath singeGetScriptPath = function() return script end local realSkip = discSkipToFrame discSkipToFrame = function(frame) videolandTraceSeek(frame) return realSkip(frame) end local realSearch = discSearch discSearch = function(frame) videolandTraceSeek(frame) return realSearch(frame) end dofile(script) singeGetScriptPath = realScriptPath -- Every line the game prints, counted (the wrapped lines too). local prints = 0 local realPrint = screenPrint screenPrint = function(what) prints = prints + 1 return realPrint(what) end local realUpdate = onOverlayUpdate -- A key, as the engine hands one to a script in the whole keyboard mode. function videolandKey(keysym, scancode) onKeyPressed(keysym, scancode) end local function view() return { state = STATE, next = NEXT_STATE, room = L, turns = T, keyboard = (KEYBOARD_ON == ON), keyhit = (KEYHIT_ON == ON), delay = DELAY, still = (SHOW_JPG ~= -1), endFrame = (END_FRAME ~= -1) and END_FRAME or nil, frame = discGetFrame(), prints = prints, last = SCREEN[SCREEN_LINES], input = INPUT } end onOverlayUpdate = function(...) local result = realUpdate(...) videolandDrive(view()) return result end