A somewhat working version, correct colors and correct tiles in many places.
Started investigating how animated tiles work.
Renders foreground correctly.
Pre-refactoring commit.