palette code changes

This might help reduce the screen flash from palette changes on some screens. I'm really not sure any more, though.

By accident, it also fixes the colors in some screens, e.g., a purchase arrival screen immediately after a new construction or research completed screen over the geoscape. It is a mystery. 

It also now makes ResearchState preserve whatever palette was set before it's initialized; that lets it play nicely with the Geoscape and is not a mystery.