More efficient handling of keys

What keys and the types of keys that are available in a level are now
determined when the level starts rather than each time the player tries
to open a locked door, or use the IDKFA cheat.