Improved tileset collision

The algorithm for tileset collision is completely redesigned, and now
supports diagonal walls.