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

36 lines
1.4 KiB
Text

-- The inputs both the original ActionMax emulator and its Forge port are driven with, by frame
-- of the script's own clock, so the two can be compared move for move (FORGE.md section 14.1).
-- A shot is a pointer position and a trigger pull. The title takes one pull, the menu one on
-- the left half (a standard game), and then the picture is shot at from a dozen places while
-- it plays.
PORT_INPUTS = {
{ at = 40, x = 300, y = 200 }, -- Title: pull to start.
{ at = 140, x = 100, y = 240 }, -- Menu: the left half, a standard game.
}
-- In .38 Ambush Alley the picture flickers with the sensor -- targets -- at 240,140 from disc
-- frame 2968, at 220,140 from 2591, and at 220,80 from 2577, all left of the sensor's own corner,
-- which the game reaches about 2740 frames in. Most shots go there, a few elsewhere, so good
-- and bad judgments both come up.
local TARGETS = { { x = 240, y = 140 }, { x = 220, y = 140 }, { x = 220, y = 80 } }
for shot = 1, 40 do
local target = TARGETS[(shot % 3) + 1]
local input = { at = 2740 + shot * 28, x = target.x, y = target.y }
if shot % 4 == 0 then
input.x, input.y = 40 + (shot * 97) % 240, 20 + (shot * 53) % 150
end
PORT_INPUTS[#PORT_INPUTS + 1] = input
end
PORT_LAST = 2740 + 41 * 28 + 200
-- The input due this frame, if any.
function portInputAt(frame)
for _, input in ipairs(PORT_INPUTS) do
if input.at == frame then
return input
end
end
return nil
end