Skip to content

olive-empire: push-scroll at the edges of the view - #95

Closed
ffex wants to merge 2 commits into
olive-empire-harvestfrom
olive-empire-scroll
Closed

ffex wants to merge 2 commits into
olive-empire-harvestfrom
olive-empire-scroll

Conversation

@ffex

@ffex ffex commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Summary

The view now scrolls: the player walks freely in the middle of the screen, and 32 px from a side (the bottom one measured from the HUD) it stays there while the background scrolls 1 px a frame. The 256x256 map wraps around, so the grove goes on forever. Stacked on #93 (harvest): this PR shows only the scroll; it lands in develop after #93.

What changed

  • src/engine/sprites.rs, src/engine/mod.rs, src/prelude.rs: SpriteManager::when_composite_free(id, Direction, distance, hitbox, solid, body) runs any code when a step is free; new public Direction enum. The move_composite_*_blocked moves are built on it and emit the same asm (unit test compares them; no other snapshot changes). Also proposed for refactor in a stacked PR on engine: Var::increment, when_composite_touches, queue_tile_block_write #94.
  • src/bin/olive-empire/inputs.rs: each D-pad direction is when_composite_free { if leading half at the margin: scroll_by(±1) else: move 1 px }; limits are now the 32 px margins (SCROLL_MARGIN). No raw asm.
  • tests/emulator.rs: the trunk test's edge checks now walk to the four margins and check exact SCX/SCY; the free row is found in world coordinates.
  • Task.md, CHANGELOG.md: entries.

How it was verified

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings: clean.
  • cargo test: all pass (478 lib tests, snapshots, doctests).
  • RGBDS_LINK_CHECK=1 cargo test --lib --test emulator: 117 pass, including the scroll checks and the harvest test.
  • scripts/run.sh olive-empire assembles the ROM. Not looked at in a GUI emulator (none installed).

Generated-asm impact

  • examples/olive-empire/main.asm only (the D-pad bindings). Other examples unchanged.

Risks and follow-ups

  • SCX/SCY are written by the input bindings at the start of the main loop, in VBlank, like the map reads.
  • The map wraps: harvested trees come back around bare. Clamping the camera to the map edges would be a later choice.

🤖 Generated with Claude Code

ffex and others added 2 commits October 30, 2026 23:38
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ffex

ffex commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

Already in develop (10d97fd); closing.

@ffex ffex closed this Oct 30, 2026
@ffex
ffex deleted the olive-empire-scroll branch October 30, 2026 23:01
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