Expand description
Overworld presentation-state machines — pure, frame-counted animation logic for the visual effects classic JRPGs implement as blocking animation routines. The renderer reads these each frame; the game’s update loop ticks them once per frame (freezing gameplay, mirroring the originals’ busy-wait structure).
Everything here is game-agnostic: states depend only on
Direction, injected tuning data (spin facing order, elevator shake
parameters), and frame counters. Sound cues are returned as typed enums
(TeleportSpinSfx, EnterMapSpinSfx, ElevatorShakeSfx,
ShipDepartureSfx); the game maps them to its own audio ids.
Covered effects:
- teleport / escape-item spin-out (
TeleportSpinState) and the matching arrival spin-in (EnterMapSpinState) - elevator rumble (
ElevatorShakeState) - looping water/flower background-tile animation (
TileAnimState) - fishing-rod animation (
FishingAnimState) - boulder-push dust puff (
BoulderDustState) - ship-departure cutscene (
ShipDepartureState) - the all-white palette flash frame count (
FLASH_WHITE_FRAMES)
Structs§
- Boulder
Dust State - The 2×2 smoke-puff block kicked up when a pushed boulder slides one
tile. The block is written once, anchored to the player’s map tile at
push time (the animation outlives the push lockout, so the anchor must
not track the player afterward), then runs
BOULDER_DUST_STEPSsteps ofBOULDER_DUST_STEP_FRAMESframes each. Every step the block drifts 1px against the boulder’s slide direction and the sprite palette toggles, flashing two gray shades. - Elevator
Shake Params - Tuning for the elevator rumble: how many up/down iterations and how far the background scrolls each iteration.
- Elevator
Shake State - Frame-driven elevator rumble: scrolls the background up/down by
±
pixel_offset,iterations× 2 frames, a rattle cue each iteration, then a single arrival ding. - Enter
MapSpin State - State of the arrival spin animation.
- Fishing
Anim State - Frame-driven state of the rod animation. Constructed when a rod use
passes the game’s eligibility gates; ticked once per frame by the update
loop (which freezes gameplay while it runs); when
Self::is_donethe result text is queued. - Ship
Departure State - Frame-driven state of the ship-departure cutscene. Constructed when the game’s departure script fires; ticked once per frame by the update loop (freezing gameplay, matching the classic blocking structure). The renderer reads the scroll offset and puff positions; the game applies the ship erase + warp removal at the erase transition.
- Teleport
Spin State - State of the teleport / escape-item spin-out animation.
- Tile
Anim State - Per-frame water/flower background-tile animation.
Enums§
- Elevator
Shake Sfx - Sound cues
ElevatorShakeState::tickcan request. - Enter
MapSpin Phase - Phase of the arrival spin, the counterpart of
TeleportSpinState: after a teleport-class warp arrival, the player descends from off the top of the screen, then spins in place. - Enter
MapSpin Sfx - Sound cues
EnterMapSpinState::tickcan request. - Fishing
Anim Phase - Phase of the player-side fishing rod animation.
- Ship
Departure Phase - Phase of the ship-departure cutscene.
- Ship
Departure Sfx - Sound cues
ShipDepartureState::tickcan request. - Teleport
Spin Phase - Phase of the leave-map spin animation.
- Teleport
Spin Sfx - Sound cues
TeleportSpinState::tickcan request. - Tile
Anim Kind - Which background tiles a tileset animates (the classic water-rotation / flower-frame system).
Constants§
- BOULDER_
DUST_ STEPS - Number of animation steps of the boulder-dust puff.
- BOULDER_
DUST_ STEP_ FRAMES - Frames each dust step lasts.
- ENTER_
MAP_ SPIN_ DOWN_ FRAMES - Total frames of the spin-down phase: 5 spins with 3-frame delays between (the last step ends immediately).
- ENTER_
MAP_ SPIN_ DOWN_ STEPS - Number of 16px spin-down steps (from offscreen above to the standing position).
- ENTER_
MAP_ SPIN_ DOWN_ STEP_ DELAY - Frames between spin-down steps.
- ENTER_
MAP_ SPIN_ DOWN_ STEP_ PIXELS - Pixels the player sprite descends per spin-down step.
- ENTER_
MAP_ SPIN_ IN_ PLACE_ FRAMES - Total frames of the arrival spin-in-place phase: 8 spins whose delays are 0,1,…,7 (8 + (1+2+…+7)).
- FISHING_
ANIM_ FRAMES - Total frames of the whole animation: 10 + 100 + 30 + 60.
- FISHING_
BUBBLE_ FRAMES - Frames the “!” emotion bubble stays up.
- FISHING_
CAST_ DELAY_ FRAMES - Initial pause before the rod appears.
- FISHING_
ROD_ OUT_ FRAMES - Frames the rod stays out waiting for a bite.
- FISHING_
SHAKE_ ITERATIONS - Shake iterations on a bite.
- FISHING_
SHAKE_ STEP_ FRAMES - Frames per shake iteration.
- FLASH_
WHITE_ FRAMES - Frames of the all-palettes-white flash when a dark area is lit up.
- SHIP_
DEPARTURE_ ERASE_ FRAMES - Final pause after the ship is erased.
- SHIP_
DEPARTURE_ INITIAL_ PAUSE_ FRAMES - Initial pause of the departure cutscene (after the departure music starts).
- SHIP_
DEPARTURE_ ITERATION_ FRAMES - Frames per iteration: 16 smoke-drift substeps × an 8-frame delay each.
- SHIP_
DEPARTURE_ PUFF_ DRIFT_ PX_ PER_ SUBSTEP - Smoke-puff drift: every 8-frame substep all live puffs drift +2px right.
- SHIP_
DEPARTURE_ PUFF_ SPACING_ PX - Smoke-puff spawn spacing: a new 2×2 puff block is emitted above the smokestack every iteration, 16px left of the previous one.
- SHIP_
DEPARTURE_ PUFF_ START_ SCREEN_ X - The first puff’s screen X at departure start.
- SHIP_
DEPARTURE_ SCROLL_ ITERATIONS - View-scroll iterations.
- SHIP_
DEPARTURE_ SCROLL_ PX_ PER_ ITERATION - Pixels the view scrolls east per iteration (the ship slides left).
- SHIP_
DEPARTURE_ SMOKESTACK_ TILE_ X - The smokestack’s map position (tile units) — the puffs’ world anchor.
- SHIP_
DEPARTURE_ SMOKESTACK_ TILE_ Y - SHIP_
DEPARTURE_ SUBSTEPS_ PER_ ITERATION - Substeps per iteration.
- SHIP_
DEPARTURE_ SUBSTEP_ FRAMES - Frames per drift substep.
- SHIP_
DEPARTURE_ TOTAL_ FRAMES - Total frames of the whole cutscene: 120 + 3 + 8×128 + 120.
- SHIP_
DEPARTURE_ WATER_ FILL_ FRAMES - The water-fill commit (pushing the screen tile buffer’s water fill to the background). Kept for frame fidelity; the erase phase below is the visible ship removal.
- SPIN_
IN_ PLACE_ FRAMES - Total frames of the spin-in-place phase: 16+15+…+1.
- SPIN_
POST_ DELAY_ FRAMES - Extra frames after the spin-up when not on a warp pad.
- SPIN_
UP_ STEPS - Number of 16px spin-up steps.
- SPIN_
UP_ STEP_ DELAY - Frames between spin-up steps.
- SPIN_
UP_ STEP_ PIXELS - Pixels the player sprite rises per spin-up step.