Repository navigation
The simulator's camera moves on Center View - #95
Closed
mstephenhunt wants to merge 1 commit into
Closed
mstephenhunt wants to merge 1 commit into
mstephenhunt wants to merge 1 commit into
Conversation
centerView() in a program left local.camera at 0, 0 in a test: the action was only logged, and only the test's moveCamera() moved the camera. Now Center View sets the camera of the player whose program ran it, centered on the location for a 640 x 480 screen, snapped down to 8 pixels, and kept on the map: 648 pixels short of its right edge and 488 short of its bottom, as played in Classic graphics. The mouse stays where it is on the screen. A test world can be given the map's size (mapSize, in tiles), which the build step fills in from the open map; memory.map.width and .height read it. Fixes scm-js#94 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Closing in favor of #96, which now carries this PR's commits along with the rest of the auto-mining, auto-restore and toggle work, so it can be reviewed and merged as one PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
I'm building an auto-cast toggle for Medics in a Remastered map, and part of it reads
local.cameraafter acenterView(). Inmap build --testthe camera never moved:local.camerastayed at 0, 0, so none of that logic could be covered by a test. In the real game the camera moves.Fixes #94
What changes
local.mousereads the same before and after.TestWorld.mapSize(tiles) is read asmemory.map.width/.heightand used for the clamp; the build step fills it in from the open map. Without it the simulator assumes 128 × 128, as the fog already did.Testing
npm test: 1446 passed, 9 skipped.npm run typecheck: clean.tests/testing.test.tsfails onmain(printsmiddle 0, 0/corner 0, 0) and passes with the change.