[SP] Update the drawsurf sort code from MP.
Switched MAX_ENTITIES to MAX_REFENTITIES and similar defines.
MAX_SHADERS must remain 13 bits because of the weird sorting stuff with RF_ALPHA_FADE.