singe/testScripts/ports/timetravelerOriginal.singe
2026-09-22 18:32:07 -05:00

66 lines
2.6 KiB
Text

-- Hologram Time Traveler as it ships, driven by timetravelerDrive.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 video.
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 "HologramTimeTraveler"
local script = library .. "/" .. (os.getenv("PORT_SCRIPT") or (game .. "/Script/timetraveler.singe"))
dofile(here .. "timetravelerDrive.singe")
SINGE_LEGACY_SPRITE_ARGS = true
local realScriptPath = singeGetScriptPath
singeGetScriptPath = function() return script end
local realSkip = discSkipToFrame
discSkipToFrame = function(frame)
ttTraceSeek(frame)
return realSkip(frame)
end
local realSearch = discSearch
discSearch = function(frame)
ttTraceSeek(frame)
return realSearch(frame)
end
dofile(script)
singeGetScriptPath = realScriptPath
local realUpdate = onOverlayUpdate
function ttPress(switch, down)
if down then
onInputPressed(switch)
else
onInputReleased(switch)
end
end
local function view()
local window, correct = nil, nil
if (currentLevel == levelNormal) and (lvlState == lvlRunning) and move and move[currentMove] and (currentMove <= totalMoves) then
window = { move[currentMove][inputFrmStart], move[currentMove][inputFrmEnd] }
correct = move[currentMove][correctMove]
end
return { flow = gameflow, screen = currentLevel, step = lvlState, alt = altState, level = iCurPos, seg = segID, move = currentMove, moves = totalMoves,
frame = discGetFrame(), score = iScore, lives = iLives, cubes = iRevCubes, credits = iCredits,
window = window, correct = correct, turned = bTurn,
intro = (gameflow == flow_GameRunning) and (currentLevel == levelIntro),
dying = (currentLevel == levelNormal) and (lvlState == lvlPlayDeath),
mapWait = (currentLevel == levelMenuScreen) and (lvlState == lvlRunning), mapCursor = iCurPos,
trader = (currentLevel == levelTrader) and ((lvlState == lvlRunning) or (lvlState == branch01)),
hellgate = (currentLevel == levelHellgate) and (lvlState == branch01),
continuing = (currentLevel == levelContinue) and (lvlState == lvlRunning),
board = (currentLevel == levelHighScore) and (lvlState == lvlRunning),
UP = UP, DOWN = DOWN, LEFT = LEFT, RIGHT = RIGHT, ACTION = ACTION, NOMOVE = NOMOVE, TURNRIGHTSHOOT = TURNRIGHTSHOOT, TURNLEFTSHOOT = TURNLEFTSHOOT, TRADER = levelTrader }
end
onOverlayUpdate = function(...)
local result = realUpdate(...)
ttDrive(view())
return result
end