doodle/pkg/level
Noah 4851730ccf Fix RLE Encoding Off-by-One Errors [PTO]
Levels can now be converted to RLE encoded chunk accessors and be re-saved
continuously without any loss of information.

Off-by-one errors resolved:

* The rle.NewGrid() was adding a +1 everywhere making the 2D grids have 129
  elements to a side for a 128 chunk size.
* In rle.Decompress() the cursor value and translation to X,Y coordinates is
  fixed to avoid a pixel going missing at the end of the first row (128,0)
* The abs.X-- hack in UnmarshalBinary is no longer needed to prevent the
  chunks from scooting a pixel to the right on every save.

Doodad tool updates:

* Remove unused CLI flags in `doodad resave` (actors, chunks, script,
  attachment, verbose) and add a `--output` flag to save to a different file
  name to the original.
* Update `doodad show` to allow debugging of RLE compressed chunks:
    * CLI flag `--chunk=1,2` to specify a single chunk coordinate to debug
    * CLI flag `--visualize-rle` will Visualize() RLE compressed chunks in
      their 2D grid form in your terminal window (VERY noisy for large
      levels! Use the --chunk option to narrow to one chunk).

Bug fixes and misc changes:

* Chunk.Usage() to return a better percentage of chunk utilization.
* Chunker.ChunkFromZipfile() was split out into two functions:
    * RawChunkFromZipfile retrieves the raw bytes of the chunk as well as the
      file extension discovered (.bin or .json) so the caller can interpret
      the bytes correctly.
    * ChunkFromZipfile calls the former function and then depending on file
      extension, unmarshals from binary or json.
    * The Raw function enables the `doodad show` command to debug and visualize
      the raw contents of the RLE compressed chunks.
* Updated the Visualize() function for the RLE encoder: instead of converting
  palette indexes to hex (0-F) which would begin causing problems for palette
  indexes above 16 (as they would use two+ characters), indexes are mapped to
  a wider range of symbols (0-9A-Z) and roll over if you have more than 36
  colors on your level. This at least keeps the Visualize() grid an easy to
  read 128x128 characters in your terminal.
2024-05-24 13:54:41 -07:00
..
giant_screenshot Resolve circular import errors for Doodle++ plugin 2024-04-18 22:12:56 -07:00
publishing Resolve circular import errors for Doodle++ plugin 2024-04-18 22:12:56 -07:00
rle Fix RLE Encoding Off-by-One Errors [PTO] 2024-05-24 13:54:41 -07:00
actor_options.go Slippery Pixels + Update Changelog for 0.13.1 2022-10-10 10:52:28 -07:00
actors.go Slippery Pixels + Update Changelog for 0.13.1 2022-10-10 10:52:28 -07:00
chunk.go Fix RLE Encoding Off-by-One Errors [PTO] 2024-05-24 13:54:41 -07:00
chunk_map.go (Experimental) Run Length Encoding for Levels 2024-05-23 23:02:01 -07:00
chunk_rle.go Fix RLE Encoding Off-by-One Errors [PTO] 2024-05-24 13:54:41 -07:00
chunk_test.go (Experimental) Run Length Encoding for Levels 2024-05-23 23:02:01 -07:00
chunker.go (Experimental) Run Length Encoding for Levels 2024-05-23 23:02:01 -07:00
chunker_migrate.go Fix RLE Encoding Off-by-One Errors [PTO] 2024-05-24 13:54:41 -07:00
chunker_test.go (Experimental) Run Length Encoding for Levels 2024-05-23 23:02:01 -07:00
chunker_zipfile.go Fix RLE Encoding Off-by-One Errors [PTO] 2024-05-24 13:54:41 -07:00
filesystem.go Level Screenshots and Thumbnails 2023-12-08 19:48:02 -08:00
fmt_json.go Unit test fixes and code cleanup 2023-12-02 12:33:14 -08:00
fmt_maintenance.go (Experimental) Run Length Encoding for Levels 2024-05-23 23:02:01 -07:00
fmt_readwrite.go (Experimental) Run Length Encoding for Levels 2024-05-23 23:02:01 -07:00
inflate.go Level Thumbnails on Story Mode Select 2023-12-09 14:59:31 -08:00
page_type.go Add MenuScene with New Level UI 2019-06-25 15:01:37 -07:00
palette.go Binary format for chunks in zipfiles 2023-02-18 12:45:36 -08:00
palette_defaults.go Update default level palettes for new pixel attributes 2022-10-10 11:17:11 -07:00
screenshot.go Level Screenshots and Thumbnails 2023-12-08 19:48:02 -08:00
swatch.go Slippery Pixels + Update Changelog for 0.13.1 2022-10-10 10:52:28 -07:00
types.go D++ Default Author and Embedded Doodads Error 2024-04-18 22:31:11 -07:00