Add inventory size functions, focus handler, etc.

Fixed some more compile-time errors, added and adjusted various
functions, and restored most of the game's original real-time
functionality.