Skip to content

Rehearsal: gameplay timing - #1

Draft
carrdylan52 wants to merge 15 commits into
rehearsal/base-f44a7562from
rehearsal/tick60
Draft

carrdylan52 wants to merge 15 commits into
rehearsal/base-f44a7562from
rehearsal/tick60

Conversation

@carrdylan52

Copy link
Copy Markdown
Owner

Rehearsal run inside the fork: gameplay timing (PAL 50 Hz / NTSC 60 Hz) on top of upstream master f44a756. Not for merge.

The PAL release shortened frame counts and sped up per-frame steps to
make up for its 50 Hz fields. Each such value now reads
PAL_TIMING(pal, ntsc): event and camera sequence conversions, fades and
BGM fades, character motion speed, menu, inventory, aquarium, title and
status timers, and play-time differences compared with 1/60 s limits.
The PS2 build keeps the PAL tokens.
…timing

The PAL disc scripts keep the NTSC frame counts and convert them while
they run: the event library scales field counts by 50/60, monster
scripts pass frame counts through conv(n) = ftoi(itof(n) / 30.0f *
25.0f), a few scripts divide by 30 and multiply by 25 in integers, and
some literals were retuned by hand. With the NTSC timing, ResolveFile
now hands every .stb to script_timing::Patch before a loader or the
file cache sees it.

Recipes match decoded instructions inside the script's functions
(program table, CALL targets, unreferenced function blocks) and turn
each conversion into opcode-22 no-ops, which CRunScript::exe() steps
over; the converter keeps its FTOI so callers still get integers. The
lip-sync cue assignment that PAL derives from the scaled timeout is
removed whole. Hand-tuned literals (d03 jump, s03 turn, m06b delay and
wait, i01h01b backpack scene, one e221a turn) and Max's and Monica's
eight motion-ratio window bounds are anchored: the PAL value must be
found once before the NTSC value is written; the attack-window policy
is a constant. A marker no-op records what it replaced, so a converted
script converts to the same bytes again.

script_timing_inventory.inc lists the 906 scripts that hold a
conversion (including the PAL-only language copies) with the count of
each recipe. A listed script that does not match, or an unlisted one
that holds a conversion, stops the game with status 5 and its name.
The PAL timing leaves every script untouched; datapack scripts are not
converted.
Select and save PAL/50 or NTSC/60 together, preserve custom pairs, and
show a restart notice separately from save failures.

Make tick_rate restart-only alongside the timing profile. Applying the
paired row live would change the clock while executable values and
loaded scripts retain the old profile. Latch both at startup and use the
active clock rate for fallback audio, including sound steps before
startup.
Check every indexed script with the load-time recipes before starting
the clock. Include datapack replacements and offer PAL timing for this
session when scripts cannot be converted. Keep saved settings unchanged.
Headless mismatches exit with status 5 and the asset list. Show the
active PAL fallback truthfully in settings, and accept unlisted
undecodable scripts unchanged with a warning once per asset per session.

Convert matching datapack scripts through the normal loader, log each
asset once, and reuse the data index and script keys across real-data
tests. Cover startup rejection, replacement conversion, session state,
and repeated loads with synthetic scripts and a process-exit fixture.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant