63 lines
2.7 KiB
Text
63 lines
2.7 KiB
Text
-- The Forge port of Hologram Time Traveler, driven and traced as the original is.
|
|
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 name = (os.getenv("PORT_SCRIPT") or (game .. "/Script/timetraveler.singe")):gsub("%.singe$", "")
|
|
local stem = name:match("([^/\\]+)$")
|
|
|
|
dofile("Forge/AuthorCompile.singe")
|
|
dofile(here .. "timetravelerDrive.singe")
|
|
|
|
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(authorBuild(library .. "/" .. name .. ".forge", singeGetDataPath() .. stem .. ".port.singe"))
|
|
|
|
local realUpdate = onOverlayUpdate
|
|
|
|
|
|
function ttPress(switch, down)
|
|
if down then
|
|
authorSwitchDown(switch, nil)
|
|
else
|
|
authorSwitchUp(switch, nil)
|
|
end
|
|
end
|
|
|
|
|
|
local function view()
|
|
local q = authorEntity("game").q
|
|
local window, correct = nil, nil
|
|
|
|
if (q.currentLevel == q.levelNormal) and (q.lvlState == q.lvlRunning) and q.move and q.move[q.currentMove] and (q.currentMove <= q.totalMoves) then
|
|
window = { q.move[q.currentMove][q.inputFrmStart], q.move[q.currentMove][q.inputFrmEnd] }
|
|
correct = q.move[q.currentMove][q.correctMove]
|
|
end
|
|
return { flow = q.gameflow, screen = q.currentLevel, step = q.lvlState, alt = q.altState, level = q.iCurPos, seg = q.segID, move = q.currentMove, moves = q.totalMoves,
|
|
frame = discGetFrame(), score = q.iScore, lives = q.iLives, cubes = q.iRevCubes, credits = q.iCredits,
|
|
window = window, correct = correct, turned = q.bTurn,
|
|
intro = (q.gameflow == q.flow_GameRunning) and (q.currentLevel == q.levelIntro),
|
|
dying = (q.currentLevel == q.levelNormal) and (q.lvlState == q.lvlPlayDeath),
|
|
mapWait = (q.currentLevel == q.levelMenuScreen) and (q.lvlState == q.lvlRunning), mapCursor = q.iCurPos,
|
|
trader = (q.currentLevel == q.levelTrader) and ((q.lvlState == q.lvlRunning) or (q.lvlState == q.branch01)),
|
|
hellgate = (q.currentLevel == q.levelHellgate) and (q.lvlState == q.branch01),
|
|
continuing = (q.currentLevel == q.levelContinue) and (q.lvlState == q.lvlRunning),
|
|
board = (q.currentLevel == q.levelHighScore) and (q.lvlState == q.lvlRunning),
|
|
UP = q.UP, DOWN = q.DOWN, LEFT = q.LEFT, RIGHT = q.RIGHT, ACTION = q.ACTION, NOMOVE = q.NOMOVE, TURNRIGHTSHOOT = q.TURNRIGHTSHOOT, TURNLEFTSHOOT = q.TURNLEFTSHOOT, TRADER = q.levelTrader }
|
|
end
|
|
|
|
|
|
onOverlayUpdate = function(...)
|
|
local result = realUpdate(...)
|
|
|
|
ttDrive(view())
|
|
|
|
return result
|
|
end
|