A lot of the code is redundant, especially between lightmapped and non-lightmapped functions. The defines can also be improved, especially where they depend on each other, eg the `NORMAL_ON` define won't work without `PHONG_ON` defined.