Improve the horrible globals-based design.

This actually fixes a bug that occurs in GTGameEngine.