Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

durformat spec reverses x/y #24

Open
saulpw opened this issue Jan 2, 2024 · 3 comments
Open

durformat spec reverses x/y #24

saulpw opened this issue Jan 2, 2024 · 3 comments
Labels

Comments

@saulpw
Copy link

saulpw commented Jan 2, 2024

I'm trying to write a converter from .dur to .ddw (DarkDraw), and it looks like the specification for colorMap has the x/y coordinates reversed from the actual format.

From durformat.md:

Each element of the colorMap should coordinate with a corresponding line and column in the contents. For example, colorMap[2][3] should describe the foreground and background color for the character at contents[2][3], which is the character at Line 2, Column 3 of the given frame.

This makes sense to me and is what I expected, but looking at e.g. indyz-linuxfire.dur, there are 80 elements in colorMap, which corresponds to the width instead of the height.

@cmang
Copy link
Owner

cmang commented Jan 2, 2024

Hey Saul. Good to see you again. :) Thanks for your report. Much love for DarkDraw here. Thanks for working on a converter.

Yep. The issue is exactly as you described. Many years ago when I wrote the first version of Durdraw I didn't think hard enough about my data structures, and copied the lousy names "x" and "y" from Ncurses standard functions. In retrospect, this was a very bad idea that has led to various confusion, including this bug. Something like "line" and "column" would have been more clear.

There are many places in the source code where these member names are touched. Fixing it has not been the highest priority.

For now, I think the thing to do to is to update the spec file to match reality, with the "rotated" color map. It's kind of lame, but if this is fixed in a future version, then both the .dur file format version number will increment, and the spec file will be updated again.

@saulpw
Copy link
Author

saulpw commented Jan 2, 2024

Yeah that makes sense to just update the spec. Though, you're pre-1.0 now, so if you think you might want to change the format, now (or before 1.0) is the time. It's a hassle but it never gets any easier :)

@cmang
Copy link
Owner

cmang commented Jan 2, 2024

You're right, and I do want this fixed in the next version (8) of the file format. Even if internally Durdraw is a bit confused about X and Y, it doesn't make sense for the file format to have the rotated color map.

I'll work on updating durformat.md to accurately reflect .dur format version 7 (with the rotated color map), and work on the code+spec for version 8 to fix this issue.

Officially, File format 7 contains the rotated color map, so you might want to reflect that in your converter. (I'm sorry for making you write extra code here when version 8 comes out, but you'll probably want compatibility with whatever people are currently making with Durdraw, I'm thinking.)

@cmang cmang added the bug label Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants