Path and region caching for efficiency on larger maps.

Not quite as polished/stable as I'd like, but seems to be giving
results.  (Also some unfinished work on mag lines, dialogue, and other
miscellanea.)