Changed sprite sorting order

Plus some other minor reformatting and refactoring in r_things.c.