Refactor objects

I hope I haven't broken anything. Anyone wish to confirm this?
Should really define object type once at the start of the function after object_load and use that instead of entry->flags & 0xF throughout.