Commit Graph

36 Commits

Author SHA1 Message Date
cmounce 11339ef6ae Add docs on treatment of strings, World fields 2026-03-18 02:53:52 -07:00
cmounce a1b54b6172 Add crate-level documentation, examples 2026-03-16 02:57:07 -07:00
cmounce c649933afa Rename a few files for clarity 2026-03-15 16:53:38 -07:00
cmounce cb9c0fd68e Update variant names of Element enum
These had been based on the "ZZT file format" wiki article, but Weave
came up with some nicer unofficial names for the elements that ZZT 3.2
left unnamed. The variants are still named in CamelCase; this commit
just makes them a little closer to what they're called in practice.

Also in this commit: capitalize letters when they stand for directions
in names, like `SliderEW` (instead of `SliderEw`, which sounds like
expressing disgust over slider puzzles).
2026-03-15 16:27:44 -07:00
cmounce ba3321fb4f Re-export Keys struct 2026-03-15 14:40:55 -07:00
cmounce bb6358489c Add README v0.1.0 2026-03-14 03:56:43 -07:00
cmounce afcf0cd7e3 Change keys from bool array to Keys struct 2026-03-13 16:57:51 -07:00
cmounce 1c0641e1d6 Don't show terrain in Board Debug impl 2026-03-12 16:12:42 -07:00
cmounce dc7f70e01b Reorganize parse.rs, don't expose Nom in errors 2026-03-10 19:29:49 -07:00
cmounce 113d006518 Add license 2026-03-10 19:02:43 -07:00
cmounce 2e59e9a760 Add encode/decode tests: roundtrip, debug snapshot 2026-03-10 15:24:59 -07:00
cmounce d73faf64c7 Split error enum into Encode vs. Decode errors 2026-03-10 14:19:08 -07:00
cmounce 93339881c5 Clean up element.rs
A lot of this is deleting zztext-specific functionality, such as string
mappings that go beyond official names for things. It's okay, zztext
will cope.
2026-03-09 23:37:07 -07:00
cmounce 8c1c31be56 Initial conversion to Rust library
I'm spinning zztff off as its own Rust crate, separate from my zztext
project (which will soon consume it). This commit is based on running
filter-repo on the zztext project, followed by the minimal work to get
it to build separately.
2026-03-09 18:41:41 -07:00
cmounce 99b70c7578 Replace old text parser with new one 2026-02-17 15:24:38 -08:00
cmounce c442701d5d WIP new parser: parse stats 2026-02-13 16:14:46 -08:00
cmounce 962fbcd5ad WIP text parser: parse board terrain 2026-02-11 02:35:10 -08:00
cmounce 8ee51b14b6 WIP New parser 2026-01-31 12:02:06 -08:00
cmounce b8c20f4f8c Change bind indexes to be NonZero<i16> 2026-01-28 14:57:32 -08:00
cmounce dc349e8b95 Move stuff around to prep for future crates
Eventually, I want to take the code for working with the official binary
formats and split it out into a standalone library. The code for parsing
my unofficial text formats would then use that library as a dependency.

I might also spin off the text format code into its own library someday.
It might be useful to have a common text format.

This commit is just anticipatory prep work; I'm definitely not ready to
split this into a bunch of different crates today! I want to firm up the
data structures and the text format first.
2026-01-28 14:57:32 -08:00
cmounce 6899e11aad Add reciprocal marker to board exit comments 2026-01-28 14:57:32 -08:00
cmounce c58658f0b5 Use NonZero type to represent board edge exits
These are the only board indexes in the ZZT file format that cannot
reference the title screen; 0 is reserved to mean "no connection".
This change encodes that in the type system.
2026-01-28 14:57:32 -08:00
cmounce 0419de7ec8 Add comments after bind indexes, board indexes 2026-01-28 14:57:32 -08:00
cmounce a05805b30c Combine enter_x/enter_y into a single param
This matches what we do for stat coordinates and step values.
2026-01-28 14:57:32 -08:00
cmounce 3a886ee86a Revise format for keys, add test for headers 2026-01-28 14:57:32 -08:00
cmounce 7f0f6421d3 Use single params for stat coordinates, step vals
- Combine `x` and `y` into `at`
- Combine `x_step` and `y_step` into `step`
2026-01-28 14:57:32 -08:00
cmounce f59851e2be Use element names, hex colors for under 2026-01-28 14:57:32 -08:00
cmounce 6d3de543fd Only number board headers inside world files 2026-01-28 14:57:32 -08:00
cmounce fe80d9e349 Fix up empty line padding in the text format
- Two blank lines separate major parts (world header, boards)
- Other groups always separated by a single blank line

The intent is to visually cluster together the top-level parts of the
text format, in the hopes of making it more readable.
2026-01-28 14:57:32 -08:00
cmounce 1db3aa84c2 Allow boards, stats to be reordered 2026-01-28 14:57:32 -08:00
cmounce d1a1801ef8 Fix parsing of # comments in text 2026-01-23 03:38:09 -08:00
cmounce 4f6f8fbc1a Set better defaults for a few values 2026-01-22 23:58:10 -08:00
cmounce 00c2873839 Add snapshot tests for roundtrip conversions
The example data is far from perfect, and there's a bunch of small stuff
I want to tweak about the text format. But now the tests exist, which is
a strict improvement from before!
2026-01-22 23:58:10 -08:00
cmounce 3e152b39a8 Initial parser for parsing text into ZZT/BRD files
I ran some limited tests, and the important data seems to survive
roundtrip conversions. It's a bit tricky to measure because conversion
to text strips out/normalizes some data, such as garbage bytes in the
unused portions of Pascal strings.
2026-01-21 02:24:33 -08:00
cmounce a9af6859f3 Add initial text format for .ZZT/.BRD 2026-01-21 01:16:43 -08:00
cmounce 8da41f5fe4 Adapt ZZT world/board parsing from Marzipan 2026-01-20 18:07:11 -08:00