fix huge texture leak in tiledef
fix minor glitches too
fix memory leak in itemdef
cleanup useless code
fix memory leak on shader shutdown