add missing licence headers, move/rename some declarations, fix sprite ID allocation, update to build on trunk.
Fix some of the whitespace issues http://www.tt-forums.net/viewtopic.php?p=888801#p888801