Finally the problem with walls is solved! Took me several months of not thinking about it. I just remembered about it today and did it. Took less work than anticipated because of two dirty tricks:
- The parts of the wall that obscure the player and monsters are really separate sprites. They are all drawn after the other sprites, but their dirty rectangles are not added to the list used for refreshing – this way it’s still fast.
- The lines around the edges of walls are ragged – on purpose, so that I don’t have to draw each and every possible combination of corners.