I just finished watching day 035 where Casey implements the sparse tilemap storage. He seems to end the code with a boxed in room with a single "staircase" and no doors, and I get that result when running from his original source. I got right to the end, and everything seemed fine until he implemented the "staircase".
However, I still get doors generated, with strange results. I get a weird "break" in the stored buffer that's hard to describe, so I've attached some screenshots and my code. I've reduced the tile size and increased the number of drawn columns and rows, so you can see what I mean. My player is drawn in green and I've chosen to draw the invalided area in pink, but all the same concepts still apply.
After I implement the "staircase" (%2 and %3 in the lookup table).
Before I implement the "staircase" (%1 and %2 in the lookup table).
How the original day 035 source runs.
I know it's a problem somewhere within the random number generator and how the choices are being picked, since I can go back to the original behavior via %1 and %2 instead of %2 and %3. It can't be a random bug, because I'm using the exact same lookup table.
My code is heavily commented, so I'd appreciate a fresh set of eyes. I'm sure it's some small detail that I've just missed in the video.
This is my heavily commented code!
This is my build.bat, may or may not be useful.