Lots of fixes to previous AI code.
Move bglayer water logic to transform.c, water effect for fglayer is enabled. Use lookup table for 16 and 32bit (32bit is not as efficient). And lots of other major/minor changes.
Authored by: utunnels 2011-09-19
Parent: [r3453]
Child: [r3455]