;v0: RGB=diffuse, A=free
;v1: RGB=specular, A=free
;c0: RGB=terrain lightmap tint, A=far blending
;t0: RGB=color, A<127-0>=Selfillumination mask, A<128-255>=Specular, Reflection mask
;t1: RGB=Reflection

ps.1.1

def c1, 0, 0, 0, 0.25		;RGB: free, A:ambient

tex t0
tex t1

mul			r0.rgb, v0, c0		;shadow tint to diffuse
+mul		r0.a, v1.b, c0.b		;shadow tint to specular

add_sat		r1.rgb, t1, r0.a		;add tinted specular to reflection
+mov_sat	r1.a, -t0_bx2.a			;Selfillumination mask extraction

mul_sat		r1.rgb, r1, t0_bx2.a	;mask specular & reflection
+add_sat	r1.a, r1.a, c1.a		;add ambient to SI mask

add_sat		r0.rgb, t0, r1			;add specular & reflection to color
+add_sat	r0.a, r0.b, r1.a		;add ambient & SI mask to tinted diffuse

mul			r0.rgb, r0, r0.a		;apply diffues
+mov		r0.a, c0.a				;farblending

//mov		r0, r0.a