Drag this into more modern times

And have it compatible with the newer parts of the .tmx.

Terrain support follows.