In case anyone is trying to do the same (unlikely, I know), the thing that was confusing me was that the 0x61 opcode, which skips to the end of the line, is also required at the end of each line (like a new line character). As such, you don’t need to keep track of the number of tiles in the x direction that have been processed.
Month: August 2007
This is to aid my memory when I come back to this tomorrow. Too late now.
Program segfaults. This is because it goes beyond the end of the image array. This is because it goes beyond the correct number of blocks in y. I do not know why this is, I must have interpreted the file wrong… right?
It seems that when your code is shonky (and you have an inkling that it might be), valgrind is where to look. It’ll point to things, even when your program appears to be working, and say “err, are you sure that’s right? it looks like you’re being a bit of a muppet there”. And you can ignore it (I did, mostly cos it took me a while to figure out what its error messages meant), but eventually they’ll come up and bite you in the seg fault.
In short, I feel it is going to be invaluable. Even more so than it has been tonight.
It’s ok, it was a very easy thing to fix. Phew. Now, where was I…
There is no expletive to express this.
Up until now, I have been working with the smaller GJD files that get installed to the hard drive, but I couldn’t find a delta frame there that had a palette change. So I went for a biggy: the INTRO.GJD file on disc one. It’s good I did, because I’ve discovered that the bit that was easy, the extraction from the GJD file, doesn’t work properly. It gets about two into it (out of a couple of dozen), then falls over.
Still, I’ve already learnt / re-learnt quite a lot since I did that bit, so it might be obvious…
As expected, I’m putting off delving into the delta frames format. As you might expect, it’s pretty complicated, so I’ve been trying to make sure my program is ready for it. I’ve now got a proper image struct for storing the images, which makes it much easier to have a second one to store the new image. Part of me feels I should be doing this properly in C++ classes though… I’ll have to eventually…