feat: page the minimap through levels the player is not standing on - #563
Conversation
Adds a displayed-level field distinct from the player's own level, three key actions to page it (Page Up / Page Down / Home, alt , . /), and an unexplored panel for a level with no stitched map yet. Both frontends read the displayed level; descending, ascending and hiding the minimap reset it. Also adds the missing KeyCode.F2 display name, so the Controls screen no longer renders "KeyCode.F2" for Toggle NPC/CPC Mode. Closes #559 Closes #562 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ASCII return key Self-review findings. The text minimap is drawn even while showMiniMap is false (the elif beside drawMiniMap), so gating the paging keys on the toggle alone left a --text player with a visible minimap that ignored them; _isMiniMapVisible mirrors both branches of that draw call instead. The status message also always named Home, which a terminal cannot send — it now picks the alt binding in text mode, the way the caption already did. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Self-reviewThe full diff was read against this repository's conventions ( Findings fixed on the branch
Reviewed and considered correct
One residual edge case was left as-is: a paged-to level whose map file exists but fails to load (corrupt PNG) still returns without drawing anything rather than showing the unexplored panel, because "unexplored" would be the wrong explanation for a corrupt file. That path already logs a warning once on the good-to-failed transition. Documentation
Test counts in the PR body and the changelog row were updated for the two added tests: 1229 passing. This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). |
Summary
_miniMapViewZ, was added toWorldScreen, distinct from the player's owncurrentZand resolved through the newgetMiniMapDisplayZ().Nonemeans "follow the player", so a save loaded underground needs no synchronisation, and_descend()/_ascend()reset toNoneso paging never survives a real move between levels.,,.and/respectively.KeyCodegained the six corresponding members with display names._miniMapCachedZinvalidation compare moved to it unchanged) and gains a caption naming the level and the key that returns; the text minimap shows the displayed level's known rooms, marks the center cell+rather than the facing arrow — the player is not on that level, so the marker means "directly above or below you" — and gains the same caption as a second header line.-3floor_descend()had inline was extracted toDEEPEST_Zand is now shared with the paging clamp.KeyCode.F2had no_DISPLAY_NAMESentry, sodisplayName()fell through tostr()and the Controls screen renderedKeyCode.F2in the Toggle NPC/CPC Mode row. The entry was added and the invariant is now covered by a test walkingDEFAULT_BINDINGSagainst the table. It was found while the paging key codes were being added.Decisions on the issue's open questions
0down toDEEPEST_Z), not only visited levels. The range is small and bounded, and the unexplored panel answers "what is down there" more usefully than a keypress that silently skips._isMiniMapVisible(), which mirrors both branches of the draw call — the text minimap is drawn even while the toggle is off, so a--textplayer can still page the grid in front of them.Test plan
python3 -m black --check src tests— 276 files unchangedpython3 -m pytest tests/— 1229 passed (+24)python3 -m pytest tests/rendering/ tests/config/ -q— text-interface unit tests passpython3 -m pytest tests/screen/ tests/ui/ -q— pygame-facing screen tests passpython3 tests/integration/roamScript.py tests/integration/scripts/minimap_level_paging.roamscript— PASS; the new script drives,./end to end in the real text frontend, covering the caption, both clamps and the one-press returnDocumentation
README.md's controls table and its terminal-mode tip, the in-game help overlay (both frontends),CHANGELOG.mdand the z-aware-minimap entry indocs/cave-generation-design.htmlwere all updated.Closes #559
Closes #562
This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).