bugfixing from frc demo

This commit is contained in:
2022-08-29 15:51:53 +00:00
parent 45aaa96c1d
commit b456e2d2fd
2 changed files with 27 additions and 21 deletions

View File

@@ -244,7 +244,7 @@
(set puzzleUnlocked nextStartingPoints)) (set puzzleUnlocked nextStartingPoints))
(break))))) (break)))))
((and m.rewardFiles .skipped (last m.rewardFiles)) ((and m.rewardFiles .skipped (last m.rewardFiles))
(set puzzleUnlocked (- p 1))) (set puzzleUnlocked (max 0 (- p 1))))
(true (true
(set puzzleUnlocked 0)))) (set puzzleUnlocked 0))))
@@ -561,7 +561,8 @@
(method _makeText [:String s :Int points &opt :Action action] (method _makeText [:String s :Int points &opt :Action action]
(entryWindow.makeText (+ s (pointsStr points)) action)) (entryWindow.makeText (+ s (pointsStr points)) action))
(method log [:String message] (method :Void log [:String message]
(when (> message.length 100) (log (message.substr 0 100)) (return))
(trace message) (trace message)
(prop &mut logTextY 0) (prop &mut logTextY 0)
(#when debug (#when debug
@@ -576,25 +577,28 @@
(logTexts.add text)))) (logTexts.add text))))
(method :FlxRect matchZone [:KissExtendedSprite s compass] (method :FlxRect matchZone [:KissExtendedSprite s compass]
(let [bubblePoints (dictGet .bubblePoints (dictGet pieceData (dictGet indexMap s)) compass)] (assertLet [id (dictGet indexMap s)
(unless bubblePoints jig (dictGet pieceData id)]
(return (new FlxRect 0 0 0 0))) (let [bubblePoints (dictGet jig.bubblePoints compass)]
(let [ros (roughOptimalScale) (unless bubblePoints
pointsX (for point bubblePoints point.x) (return (new FlxRect 0 0 0 0)))
pointsY (for point bubblePoints point.y) (printLocalNulls)
minX (/ (apply min pointsX) ros) (let [ros (roughOptimalScale)
minY (/ (apply min pointsY) ros) pointsX (for point bubblePoints point.x)
maxX (/ (apply max pointsX) ros) pointsY (for point bubblePoints point.y)
maxY (/ (apply max pointsY) ros) minX (/ (apply min pointsX) ros)
tlc (.add (new FlxPoint minX minY) ROT_PADDING ROT_PADDING) minY (/ (apply min pointsY) ros)
brc (.add (new FlxPoint maxX maxY) ROT_PADDING ROT_PADDING) maxX (/ (apply max pointsX) ros)
rotationPadding (s.getRotationPadding) maxY (/ (apply max pointsY) ros)
rect (.fromTwoPoints (new FlxRect) (tlc.addPoint rotationPadding) (brc.addPoint rotationPadding)) tlc (.add (new FlxPoint minX minY) ROT_PADDING ROT_PADDING)
originOffset (new FlxPoint (- s.origin.x rect.x) (- s.origin.y rect.y)) brc (.add (new FlxPoint maxX maxY) ROT_PADDING ROT_PADDING)
rotated (rect.getRotatedBounds s.angle originOffset)] rotationPadding (s.getRotationPadding)
(+= rotated.x s.x) rect (.fromTwoPoints (new FlxRect) (tlc.addPoint rotationPadding) (brc.addPoint rotationPadding))
(+= rotated.y s.y) originOffset (new FlxPoint (- s.origin.x rect.x) (- s.origin.y rect.y))
rotated))) rotated (rect.getRotatedBounds s.angle originOffset)]
(+= rotated.x s.x)
(+= rotated.y s.y)
rotated))))
(method :FlxRect matchZoneLeft [:KissExtendedSprite s] (method :FlxRect matchZoneLeft [:KissExtendedSprite s]
(matchZone s WEST)) (matchZone s WEST))

View File

@@ -20,6 +20,8 @@ class Main extends Sprite
var habitFile = Prelude.joinPath(saveFolder, "habits.txt"); var habitFile = Prelude.joinPath(saveFolder, "habits.txt");
if (!(FileSystem.exists(saveFolder) && FileSystem.isDirectory(saveFolder))) { if (!(FileSystem.exists(saveFolder) && FileSystem.isDirectory(saveFolder))) {
FileSystem.createDirectory(saveFolder); FileSystem.createDirectory(saveFolder);
}
if (!FileSystem.exists(habitFile)) {
File.saveContent(habitFile, File.getContent("assets/default.txt")); File.saveContent(habitFile, File.getContent("assets/default.txt"));
} }