Commit Graph

1492 Commits

Author SHA1 Message Date
ISSOtm 0df07d3688 Add note on supporting extra pal formats 2022-07-02 17:04:17 +02:00
ISSOtm 3f70372308 Implement slicing input image 2022-07-02 17:04:17 +02:00
ISSOtm 9646f15b59 Add error message for nigh-impossible proto-palette overflow 2022-07-02 17:04:17 +02:00
ISSOtm 973fbb91bc Improve error message when a tile has too many colors 2022-07-02 17:04:17 +02:00
ISSOtm 3f5983358c Add proper error message for bad manual palettes 2022-07-02 17:04:17 +02:00
ISSOtm 7a7126f3b8 Implement bit flipping with a lookup table
Should improve performance.
This version is cooler, and also does not suffer from iteration limits
2022-07-02 17:04:17 +02:00
ISSOtm b4dadd35b6 Use an iterator zip
Simplifies iterating over tiles and attributes at the same time
2022-07-02 17:04:17 +02:00
ISSOtm d9b1402ef8 Fix RGBGFX number parsing 2022-07-02 17:04:17 +02:00
ISSOtm 832e0ec972 Report position in color errors 2022-07-02 17:04:17 +02:00
ISSOtm a5ed0292b1 Reject colors with ambiguous alpha channel 2022-07-02 17:04:17 +02:00
ISSOtm 05e36767b0 Implement "palette map" output 2022-07-02 17:04:17 +02:00
ISSOtm c4359c1058 Ignore -b and -N when reversing without tilemap
These offsets should only be applied to a tile ID read as input... but this ain't one!
2022-07-02 17:04:17 +02:00
ISSOtm cbf6fadcdb Add RGBGFX tests 2022-07-02 17:04:17 +02:00
ISSOtm a77b0b396a Fix grayscale sorting not setting palette size
A black+white palette would turn into white+transparent, removing black pixels
from the palette (the third slot would be empty, and the 4th slot be set directly)
2022-07-02 17:04:17 +02:00
ISSOtm 568fb5e4c8 Only report "fusing" different colors once per pair 2022-07-02 17:04:17 +02:00
ISSOtm 57ac07b03e Correctly handle fully-transparent tiles when outputting unoptimized tilemap 2022-07-02 17:04:17 +02:00
ISSOtm c521233499 Fix ProtoPalette::compare
Some disjoint sets were mistakenly reported not as such
For example, {0} was considered to include {1}.
2022-07-02 17:04:17 +02:00
ISSOtm fcce42d3d2 Avoid sorting proto-palettes breaking mappings
The sorting was performed without updating the mappings, which broke the world.
We can instead sort the IDs as they are inserted into the packing queue,
which should also be faster than moving the actual proto-pal objects around.
2022-07-02 17:04:17 +02:00
ISSOtm f5d4126303 Report when an input "tile" contains too many colors
Which otherwise trips a later assertion in debug mode (phew!)
and crashes in release mode (oops)
2022-07-02 17:04:17 +02:00
ISSOtm 78e751f022 Fix reading interlaced PNGs
Either we let libpng handle the transform, or we don't.
But make up your mind!
2022-07-02 17:04:17 +02:00
ISSOtm d569c6392c Avoid initializing the PNG row
It gets overwritten right after, and uncovers an error in the interlaced read
2022-07-02 17:04:17 +02:00
ISSOtm 5be2b96b40 Remove incorrect check for reversed image width
That check was when the image width was in tiles, and another check right below
is the correct equivalent for the new pixel-unit argument
2022-07-02 17:04:17 +02:00
ISSOtm 7fdfbbbbba Fix inverted condition in tile dedup warning 2022-07-02 17:04:17 +02:00
ISSOtm 7fdc6cbced Fix erroneous tabs in rgbgfx usage text
Thanks @GreenAndEievui!
2022-07-02 17:04:17 +02:00
ISSOtm 7927dfd2e3 Remove negative values in parseNumber checking
Including removal of a dead & useless check.
By the way, fuck integer promotion.
2022-07-02 17:04:17 +02:00
ISSOtm b1aec91912 Assert that row size is not null
Silences some static analysis warning
2022-07-02 17:04:17 +02:00
ISSOtm 02d957278d Document output formats 2022-07-02 17:04:17 +02:00
ISSOtm 6feb1fb73a Retire -f 2022-07-02 17:04:17 +02:00
ISSOtm 913c3dd711 Accept both colons and semicolons in inline pal spec 2022-07-02 17:04:17 +02:00
ISSOtm 32242e0ff2 Switch from colon separators to semicolon
As documented, oops
2022-07-02 17:04:17 +02:00
ISSOtm 91071009a8 Implement some external palette specs
PSP, ACT, and ACO are complete
2022-07-02 17:04:17 +02:00
ISSOtm 1da884db15 Handle processing errors appropriately
Alter the return status accordingly, and print the error counts on exit
2022-07-02 17:04:17 +02:00
ISSOtm ef473de75a Explicitly error out if no input image is given 2022-07-02 17:04:17 +02:00
ISSOtm 6b0cab32a6 Implement inline palette spec parsing 2022-07-02 17:04:17 +02:00
ISSOtm cc27169ecd Implement preliminary version of "reverse" feature
Not hooked to all RGBGFX flags yet, but good enough for most use cases
(and as a base for future development, should I need to `reset --hard`.)

TODOs marked appropriately.
2022-07-02 17:04:17 +02:00
ISSOtm 75f8b16f33 Implement "at-files" for RGBGFX
Useful for persisting flags outside of the build system
2022-07-02 17:04:17 +02:00
ISSOtm 188027bccc Rename convert to process
More consistent with its "main" function's name
2022-07-02 17:04:17 +02:00
ISSOtm 7311fc9ef8 Fix transparency handling
Ensure that the color count is properly used, and that
transparency is not counted as a color when packing palettes
2022-07-02 17:04:17 +02:00
ISSOtm 6ed220b4c1 Make some style corrections
Co-Authored-By: Rangi <remy.oukaour+rangi42@gmail.com>
2022-07-02 17:04:17 +02:00
ISSOtm e49fb457ea Factor out row bitplanes extraction into a common function 2022-07-02 17:04:17 +02:00
ISSOtm 3c9d5b05d6 Implement transparency handling
Though none of this has been tested so far...
2022-07-02 17:04:17 +02:00
ISSOtm e86eb9337a Check the range of the CLI-specified palette size 2022-07-02 17:04:17 +02:00
ISSOtm b0f8e04fb7 Do not do anything if option parsing goes wrong 2022-07-02 17:04:17 +02:00
ISSOtm 493b94919f Fix -TAP being non-functional 2022-07-02 17:04:17 +02:00
ISSOtm 71e22f3bfe Correct "is this palette empty?" function
This notably caused decantation to delete non-empty palettes, which crashes
2022-07-02 17:04:17 +02:00
ISSOtm ac02382632 Clean up palette packing a bit
Rename a poorly-named attribute, and add a bunch of debug logging
2022-07-02 17:04:17 +02:00
ISSOtm 943d631701 Implement max palette count 2022-07-02 17:04:17 +02:00
ISSOtm 76bb950be5 Parse bank capacities 2022-07-02 17:04:17 +02:00
ISSOtm f29c5d81ec Provide a per-option sane default when number parsing fails 2022-07-02 17:04:17 +02:00
ISSOtm 2307981878 Parse base tile IDs 2022-07-02 17:04:17 +02:00