fix NAT flixel cpp bug

This commit is contained in:
2022-09-08 20:46:45 +00:00
parent 74a7a41cae
commit 9ab8bdb96d

View File

@@ -19,24 +19,25 @@
// Also, remove text image files -- now that text sprites // Also, remove text image files -- now that text sprites
// are generated on the fly. // are generated on the fly.
(function :Bool upgradeToVersion2 [:nat.Archive archive :nat.Entry e] (function :Bool upgradeToVersion2 [:nat.Archive archive :nat.Entry e]
(when (hasComponent e Images) (if (hasComponent e Images)
(let [images1 (readComponent e Images) (let [images1 (readComponent e Images)
scale (readComponentOr e Scale 1.0) scale (readComponentOr e Scale 1.0)
pIdx images1.pinnedImageIndex pIdx images1.pinnedImageIndex
textImageFiles (filter images1.imageFiles ->[:String f] (f.startsWith "textImage"))] textImageFiles (filter images1.imageFiles ->[:String f] (f.startsWith "textImage"))]
(removeComponent archive e Images) (removeComponent archive e Images)
(removeFiles archive e textImageFiles) (removeFiles archive e textImageFiles)
(doFor f textImageFiles (images1.imageFiles.remove f)) (doFor f textImageFiles (images1.imageFiles.remove f))
// If all images were removed (the entry only had a text image), don't add Images2 // If all images were removed (the entry only had a text image), don't add Images2
(unless images1.imageFiles (return true)) (unless images1.imageFiles (return true))
(addComponent archive e Images2 (addComponent archive e Images2
(object (object
imageFiles images1.imageFiles imageFiles images1.imageFiles
imageScales (cast (concat imageScales (cast (concat
(for _ (range pIdx) 1.0) (for _ (range pIdx) 1.0)
[scale] [scale]
(for _ (range (- images1.imageFiles.length 1 pIdx)) 1.0))) (for _ (range (- images1.imageFiles.length 1 pIdx)) 1.0)))
pinnedImageIndex pIdx)) pinnedImageIndex pIdx))
(removeComponent archive e Scale) (removeComponent archive e Scale)
true))) true)
false))