Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
david-pfx committed Aug 1, 2024
2 parents 06bec4c + 0b87190 commit 8eb4e4d
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 22 deletions.
28 changes: 16 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,27 @@ PuzzleScript Next is a combination of the work of many authors:
* and ongoing development work inspired by its many users (like you).

## New Features and Fixes
The latest version is Release v-24g30.
The latest version is Release v-24h02.
It includes a beta release of canvas sprites based on canvas API calls.
See below. Please try.

New fixes/updates:
* The title screen menu now works correctly on mobile
* The editor no longer crashes when source code changes make the code invalid
* The level editor no longer crashes when a new program is loaded
* Title screen treats as continue if set checkpoint before winning first level
* Highlight of selected level now less intrusive
* `skip_title_screen` is now working
* Solve symbol default now "X" in code and docs
* Fix parsing of non-alpha transform args
* Fix menu click on level 1 to not go to title
* Fix crash on menu click on non-menu lines
Recent fixes/updates:
* The title screen and level select menus now work correctly with mouse and on mobile.
* `runtime_metadata_twiddling` with a level of more than 1024 cells no longer triggers an error on undo.
* Metadata twiddle values are now saved and restored by a checkpoint.
* The editor no longer crashes when source code changes make the code invalid.
* The level editor no longer crashes when a new program is loaded.
* Title screen treats as continue if set checkpoint before winning first level.
* Highlight of selected level now less intrusive.
* `skip_title_screen` is now working.
* Solve symbol default now "X" in code and docs.
* Fix parsing of non-alpha transform args.
* Fix menu click on level 1 to not go to title.
* Fix crash on menu click on non-menu lines.
* The display of upper case `text:` sprites has been corrected.
* Deleting and replacing a script in the editor by cut and paste no longer causes a crash.

Older fixes/updates:
* Editing objects that contain tags in the LEGEND and elsewhere no longer causes a crash.
* The ordering of expanding relative directions (`<>^v`) has been corrected (Pattern:Script compatibility).
* Using `rot:` or other transforms with no or bad arguments no longer causes a crash.
Expand Down
51 changes: 49 additions & 2 deletions src/demo/test/test_min_cmd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ title test min
author polyomino
homepage www.polyomino.com

// minimal program as base for tests
// minimal program for testing commands
runtime_metadata_twiddling

verbose_logging
debug
debug_switch undo

========
OBJECTS
========
Expand Down Expand Up @@ -56,11 +59,14 @@ RULES
======

[ > p | r ] -> [ > p | > r ]
[ > p | g ] -> Background_color green
[ > p | b ] -> Background_color blue
[ p k ] -> checkpoint message Checkpoint!
late [ p | r ] -> log P is next to r
late [ p | y ] -> log P is next to y
late [ p | g ] -> log P is next to g
late [ p | k ] -> log P is next to k

[ action p ] win

==============
WINCONDITIONS
Expand All @@ -85,3 +91,44 @@ message second level
....pry...
..........

level 40x40 to trigger diff undo twiddle bug
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r..................p...................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
r......................................r
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
7 changes: 5 additions & 2 deletions src/js/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ function generateLevelSelectScreen(hoverLine, scrollIncrement, selectLine) {

const showLines = lines.slice(levelSelectScrollPos,levelSelectScrollPos + amountOfLevelsOnScreen);
const screen = getLevelSelectScreen(showLines);
if (debugSwitch.includes('menu')) console.log(screen, levelSelectScrollPos, levelHighlightLine, hoverLine, selectLine, titleSelection);
if (debugSwitch.includes('menu')) console.log(`generateLevelSelectScreen2 titleSelection=${titleSelection}`, `levelSelectScrollPos=${levelSelectScrollPos}`, screen);
titleImage = fillAndHighlight(screen, levelHighlightLine, hoverLine, selectLine);

titleImage[0] = (hoverLine == 0 ? "[ ESC:Back ]" : " [ ESC:Back ] ").padEnd(TITLE_WIDTH);
Expand Down Expand Up @@ -1278,11 +1278,13 @@ function consolidateDiff(before,after){
dat : result,
width : before.width,
height : before.height,
oldflickscreendat: before.oldflickscreendat
oldflickscreendat: before.oldflickscreendat,
metadata: before.metadata,
}
}

function addUndoState(bak){
if (debugSwitch.includes('undo')) console.log(`addUndoState length=${backups.length} bak=`, bak);
backups.push(bak);
if(backups.length>2 && !backups[backups.length-1].hasOwnProperty("diff")){
backups[backups.length-3]=consolidateDiff(backups[backups.length-3],backups[backups.length-2]);
Expand Down Expand Up @@ -1355,6 +1357,7 @@ function DoUndo(force,ignoreDuplicates, resetTween = true, resetAutoTick = true,

if (backups.length>0) {
var torestore = backups[backups.length-1];
if (debugSwitch.includes('undo')) console.log(`DoUndo length=${backups.length} torestore=`, torestore);
restoreLevel(torestore, null, resetTween, resetAutoTick);
backups = backups.splice(0,backups.length-1);
// look for undo across link
Expand Down
28 changes: 22 additions & 6 deletions src/js/inputoutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,29 @@ function mouseAction(event,click,id) {
if (titleSelection)
titleButtonSelected();
} else if (titleMode===2) { //Level select
generateLevelSelectScreen(-1, 0, mouseCoordY);
if (mouseCoordY == 0) // dodgy but it works
generateLevelSelectScreen(mouseCoordY);
if (mouseCoordY == 0) { // ESC back
goToTitleScreen();
else if (titleSelection >= 0) {
titleSelected=true;
timer=0;
quittingTitleScreen=true;
tryPlayTitleSound();
} else if (mouseCoordY == 2) {
if (levelSelectScrollPos != 0) {
levelSelectScroll(-3)
}
} else if (mouseCoordY == 12) {
if (state.sections.length - amountOfLevelsOnScreen > levelSelectScrollPos) {
levelSelectScroll(3)
}
} else if (mouseCoordY > 2 && mouseCoordY < 12) {
const clickedLevel = mouseCoordY - 3 + levelSelectScrollPos;
if (clickedLevel < state.sections.length) {
generateLevelSelectScreen(-1, 0, mouseCoordY);
if (titleSelection != null) {
titleSelected=true;
messageselected=false;
timer=0;
quittingTitleScreen=true;
}
}
}
} else if (titleMode == 3) { // pause screen select
generatePauseScreen(mouseCoordY);
Expand Down

0 comments on commit 8eb4e4d

Please sign in to comment.