summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2011-05-16 22:55:06 -0700
committerEric Anholt <eric@anholt.net>2011-05-16 23:00:17 -0700
commitc6a6631fab48817b0bad9f4a6451ee95e65afec0 (patch)
treeb41836f58a9553b9d377891d9ee06cb3be00f232
parentb670b7643c91833bce0486ec1b9ac8bb67affee5 (diff)
shaders/warsow: First import of data from warsow.
-rw-r--r--COPYING35
-rw-r--r--shaders/warsow/1.frag342
-rw-r--r--shaders/warsow/1.vert342
-rw-r--r--shaders/warsow/10.frag342
-rw-r--r--shaders/warsow/10.vert342
-rw-r--r--shaders/warsow/11.frag344
-rw-r--r--shaders/warsow/11.vert344
-rw-r--r--shaders/warsow/12.frag345
-rw-r--r--shaders/warsow/12.vert345
-rw-r--r--shaders/warsow/13.frag346
-rw-r--r--shaders/warsow/13.vert346
-rw-r--r--shaders/warsow/14.frag344
-rw-r--r--shaders/warsow/14.vert344
-rw-r--r--shaders/warsow/15.frag151
-rw-r--r--shaders/warsow/15.vert151
-rw-r--r--shaders/warsow/16.frag110
-rw-r--r--shaders/warsow/16.vert110
-rw-r--r--shaders/warsow/17.frag49
-rw-r--r--shaders/warsow/17.vert49
-rw-r--r--shaders/warsow/18.frag63
-rw-r--r--shaders/warsow/18.vert63
-rw-r--r--shaders/warsow/19.frag345
-rw-r--r--shaders/warsow/19.vert345
-rw-r--r--shaders/warsow/2.frag344
-rw-r--r--shaders/warsow/2.vert344
-rw-r--r--shaders/warsow/20.frag342
-rw-r--r--shaders/warsow/20.vert342
-rw-r--r--shaders/warsow/21.frag344
-rw-r--r--shaders/warsow/21.vert344
-rw-r--r--shaders/warsow/22.frag345
-rw-r--r--shaders/warsow/22.vert345
-rw-r--r--shaders/warsow/23.frag346
-rw-r--r--shaders/warsow/23.vert346
-rw-r--r--shaders/warsow/24.frag344
-rw-r--r--shaders/warsow/24.vert344
-rw-r--r--shaders/warsow/25.frag151
-rw-r--r--shaders/warsow/25.vert151
-rw-r--r--shaders/warsow/26.frag110
-rw-r--r--shaders/warsow/26.vert110
-rw-r--r--shaders/warsow/27.frag49
-rw-r--r--shaders/warsow/27.vert49
-rw-r--r--shaders/warsow/28.frag63
-rw-r--r--shaders/warsow/28.vert63
-rw-r--r--shaders/warsow/3.frag345
-rw-r--r--shaders/warsow/3.vert345
-rw-r--r--shaders/warsow/4.frag346
-rw-r--r--shaders/warsow/4.vert346
-rw-r--r--shaders/warsow/5.frag344
-rw-r--r--shaders/warsow/5.vert344
-rw-r--r--shaders/warsow/6.frag151
-rw-r--r--shaders/warsow/6.vert151
-rw-r--r--shaders/warsow/7.frag110
-rw-r--r--shaders/warsow/7.vert110
-rw-r--r--shaders/warsow/8.frag49
-rw-r--r--shaders/warsow/8.vert49
-rw-r--r--shaders/warsow/9.frag63
-rw-r--r--shaders/warsow/9.vert63
57 files changed, 13289 insertions, 0 deletions
diff --git a/COPYING b/COPYING
index 59b2c86..a01a788 100644
--- a/COPYING
+++ b/COPYING
@@ -61,3 +61,38 @@ along with XreaL source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
+
+shaders/warsow:
+Copyright (C) 1995-1998 Mark Adler
+Copyright (C) 1997-2001 Id Software, Inc.
+Copyright (C) 1997-2004 Sam Lantinga
+Copyright (C) 2000 Jeff Teunissen <d2deek@pmail.net>
+Copyright (C) 2001-2006, William Joseph.
+Copyright (c) 2001 Robert Beml
+Copyright (C) 2002-2007 Victor Luchits
+Copyright (c) 2003 mudGE Entertainment
+Copyright (c) 2005 Brendan Burns
+Copyright (c) 2005 Andreas Schneider
+Copyright (C) 2006 Warsow Team
+Copyright (C) 2006-2007 Pekka ("Medar") Lampila
+Copyright (C) 2006 Damien Deville ("Pb")
+Copyright (C) 2006 German Garcia Fernandez ("Jal")
+Copyright (C) 2007 Daniel Lindenfelser
+Copyright (C) 2007 Will Franklin
+Copyright (C) 2006-2007 Christophe Devine
+Copyright (C) Forest Hale
+Copyright (C) 2006-2007 German Garcia
+Copyright (C) 2005 Stuart Dalton (badcdev@gmail.com)
+ This package is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This package is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
diff --git a/shaders/warsow/1.frag b/shaders/warsow/1.frag
new file mode 100644
index 0000000..dce1c71
--- /dev/null
+++ b/shaders/warsow/1.frag
@@ -0,0 +1,342 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/1.vert b/shaders/warsow/1.vert
new file mode 100644
index 0000000..7cbe02c
--- /dev/null
+++ b/shaders/warsow/1.vert
@@ -0,0 +1,342 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/10.frag b/shaders/warsow/10.frag
new file mode 100644
index 0000000..dce1c71
--- /dev/null
+++ b/shaders/warsow/10.frag
@@ -0,0 +1,342 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/10.vert b/shaders/warsow/10.vert
new file mode 100644
index 0000000..7cbe02c
--- /dev/null
+++ b/shaders/warsow/10.vert
@@ -0,0 +1,342 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/11.frag b/shaders/warsow/11.frag
new file mode 100644
index 0000000..4b7ece2
--- /dev/null
+++ b/shaders/warsow/11.frag
@@ -0,0 +1,344 @@
+#define FRAGMENT_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/11.vert b/shaders/warsow/11.vert
new file mode 100644
index 0000000..d34482c
--- /dev/null
+++ b/shaders/warsow/11.vert
@@ -0,0 +1,344 @@
+#define VERTEX_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/12.frag b/shaders/warsow/12.frag
new file mode 100644
index 0000000..00a170c
--- /dev/null
+++ b/shaders/warsow/12.frag
@@ -0,0 +1,345 @@
+#define FRAGMENT_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_SPECULAR
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/12.vert b/shaders/warsow/12.vert
new file mode 100644
index 0000000..2ddc43a
--- /dev/null
+++ b/shaders/warsow/12.vert
@@ -0,0 +1,345 @@
+#define VERTEX_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_SPECULAR
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/13.frag b/shaders/warsow/13.frag
new file mode 100644
index 0000000..f106fbe
--- /dev/null
+++ b/shaders/warsow/13.frag
@@ -0,0 +1,346 @@
+#define FRAGMENT_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_SPECULAR
+#define APPLY_AMBIENT_COMPENSATION
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/13.vert b/shaders/warsow/13.vert
new file mode 100644
index 0000000..4fe15fd
--- /dev/null
+++ b/shaders/warsow/13.vert
@@ -0,0 +1,346 @@
+#define VERTEX_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_SPECULAR
+#define APPLY_AMBIENT_COMPENSATION
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/14.frag b/shaders/warsow/14.frag
new file mode 100644
index 0000000..4292f6c
--- /dev/null
+++ b/shaders/warsow/14.frag
@@ -0,0 +1,344 @@
+#define FRAGMENT_SHADER
+#define APPLY_DIRECTIONAL_LIGHT
+#define APPLY_CELLSHADING
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/14.vert b/shaders/warsow/14.vert
new file mode 100644
index 0000000..78f8084
--- /dev/null
+++ b/shaders/warsow/14.vert
@@ -0,0 +1,344 @@
+#define VERTEX_SHADER
+#define APPLY_DIRECTIONAL_LIGHT
+#define APPLY_CELLSHADING
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/15.frag b/shaders/warsow/15.frag
new file mode 100644
index 0000000..af536af
--- /dev/null
+++ b/shaders/warsow/15.frag
@@ -0,0 +1,151 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec4 TexCoord;
+varying vec4 ProjVector;
+#ifdef APPLY_EYEDOT
+varying vec3 EyeVector;
+#endif
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+#ifdef APPLY_EYEDOT
+uniform vec3 EyeOrigin;
+uniform float FrontPlane;
+#endif
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+mat4 textureMatrix;
+
+textureMatrix = gl_TextureMatrix[0];
+TexCoord.st = vec2 (textureMatrix * gl_MultiTexCoord0);
+
+textureMatrix = gl_TextureMatrix[0];
+textureMatrix[0] = -textureMatrix[0];
+textureMatrix[1] = -textureMatrix[1];
+TexCoord.pq = vec2 (textureMatrix * gl_MultiTexCoord0);
+
+#ifdef APPLY_EYEDOT
+mat3 strMatrix;
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+vec3 EyeVectorWorld = (EyeOrigin - gl_Vertex.xyz) * FrontPlane;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+gl_Position = ftransform();
+ProjVector = gl_Position;
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_DUDV
+uniform sampler2D DuDvMapTexture;
+#endif
+
+#ifdef APPLY_EYEDOT
+uniform sampler2D NormalmapTexture;
+#endif
+uniform sampler2D ReflectionTexture;
+uniform sampler2D RefractionTexture;
+uniform float TextureWidth, TextureHeight;
+
+void main(void)
+{
+myhalf3 color;
+
+#ifdef APPLY_DUDV
+vec3 displacement = vec3(texture2D(DuDvMapTexture, vec2(TexCoord.pq) * vec2(0.25)));
+vec2 coord = vec2(TexCoord.st) + vec2(displacement) * vec2 (0.2);
+
+vec3 fdist = vec3 (normalize(vec3(texture2D(DuDvMapTexture, coord)) - vec3 (0.5))) * vec3(0.005);
+#else
+vec3 fdist = vec3(0.0);
+#endif
+
+// get projective texcoords
+float scale = float(1.0 / float(ProjVector.w));
+float inv2NW = 1.0 / (2.0 * float (TextureWidth));
+float inv2NH = 1.0 / (2.0 * float (TextureHeight));
+vec2 projCoord = (vec2(ProjVector.xy) * scale + vec2 (1.0)) * vec2 (0.5) + vec2(fdist.xy);
+projCoord.s = float (clamp (float(projCoord.s), inv2NW, 1.0 - inv2NW));
+projCoord.t = float (clamp (float(projCoord.t), inv2NH, 1.0 - inv2NH));
+
+
+myhalf3 refr = myhalf3(0.0);
+myhalf3 refl = myhalf3(0.0);
+
+#ifdef APPLY_EYEDOT
+// calculate dot product between the surface normal and eye vector
+// great for simulating varying water translucency based on the view angle
+myhalf3 surfaceNormal = normalize(myhalf3(texture2D(NormalmapTexture, coord)) - myhalf3 (0.5));
+vec3 eyeNormal = normalize(myhalf3(EyeVector));
+
+float refrdot = float(dot(surfaceNormal, eyeNormal));
+//refrdot = float (clamp (refrdot, 0.0, 1.0));
+float refldot = 1.0 - refrdot;
+// get refraction and reflection
+
+#ifdef APPLY_REFRACTION
+refr = (myhalf3(texture2D(RefractionTexture, projCoord))) * refrdot;
+#endif
+#ifdef APPLY_REFLECTION
+refl = (myhalf3(texture2D(ReflectionTexture, projCoord))) * refldot;
+#endif
+
+#else
+
+#ifdef APPLY_REFRACTION
+refr = (myhalf3(texture2D(RefractionTexture, projCoord)));
+#endif
+#ifdef APPLY_REFLECTION
+refl = (myhalf3(texture2D(ReflectionTexture, projCoord)));
+#endif
+
+#endif
+
+// add reflection and refraction
+#ifdef APPLY_DISTORTION_ALPHA
+color = myhalf3(gl_Color.rgb) + myhalf3(mix (refr, refl, float(gl_Color.a)));
+#else
+color = myhalf3(gl_Color.rgb) + refr + refl;
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),1.0);
+#else
+gl_FragColor = vec4(vec3(color),1.0);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/15.vert b/shaders/warsow/15.vert
new file mode 100644
index 0000000..6ee1e1e
--- /dev/null
+++ b/shaders/warsow/15.vert
@@ -0,0 +1,151 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec4 TexCoord;
+varying vec4 ProjVector;
+#ifdef APPLY_EYEDOT
+varying vec3 EyeVector;
+#endif
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+#ifdef APPLY_EYEDOT
+uniform vec3 EyeOrigin;
+uniform float FrontPlane;
+#endif
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+mat4 textureMatrix;
+
+textureMatrix = gl_TextureMatrix[0];
+TexCoord.st = vec2 (textureMatrix * gl_MultiTexCoord0);
+
+textureMatrix = gl_TextureMatrix[0];
+textureMatrix[0] = -textureMatrix[0];
+textureMatrix[1] = -textureMatrix[1];
+TexCoord.pq = vec2 (textureMatrix * gl_MultiTexCoord0);
+
+#ifdef APPLY_EYEDOT
+mat3 strMatrix;
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+vec3 EyeVectorWorld = (EyeOrigin - gl_Vertex.xyz) * FrontPlane;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+gl_Position = ftransform();
+ProjVector = gl_Position;
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_DUDV
+uniform sampler2D DuDvMapTexture;
+#endif
+
+#ifdef APPLY_EYEDOT
+uniform sampler2D NormalmapTexture;
+#endif
+uniform sampler2D ReflectionTexture;
+uniform sampler2D RefractionTexture;
+uniform float TextureWidth, TextureHeight;
+
+void main(void)
+{
+myhalf3 color;
+
+#ifdef APPLY_DUDV
+vec3 displacement = vec3(texture2D(DuDvMapTexture, vec2(TexCoord.pq) * vec2(0.25)));
+vec2 coord = vec2(TexCoord.st) + vec2(displacement) * vec2 (0.2);
+
+vec3 fdist = vec3 (normalize(vec3(texture2D(DuDvMapTexture, coord)) - vec3 (0.5))) * vec3(0.005);
+#else
+vec3 fdist = vec3(0.0);
+#endif
+
+// get projective texcoords
+float scale = float(1.0 / float(ProjVector.w));
+float inv2NW = 1.0 / (2.0 * float (TextureWidth));
+float inv2NH = 1.0 / (2.0 * float (TextureHeight));
+vec2 projCoord = (vec2(ProjVector.xy) * scale + vec2 (1.0)) * vec2 (0.5) + vec2(fdist.xy);
+projCoord.s = float (clamp (float(projCoord.s), inv2NW, 1.0 - inv2NW));
+projCoord.t = float (clamp (float(projCoord.t), inv2NH, 1.0 - inv2NH));
+
+
+myhalf3 refr = myhalf3(0.0);
+myhalf3 refl = myhalf3(0.0);
+
+#ifdef APPLY_EYEDOT
+// calculate dot product between the surface normal and eye vector
+// great for simulating varying water translucency based on the view angle
+myhalf3 surfaceNormal = normalize(myhalf3(texture2D(NormalmapTexture, coord)) - myhalf3 (0.5));
+vec3 eyeNormal = normalize(myhalf3(EyeVector));
+
+float refrdot = float(dot(surfaceNormal, eyeNormal));
+//refrdot = float (clamp (refrdot, 0.0, 1.0));
+float refldot = 1.0 - refrdot;
+// get refraction and reflection
+
+#ifdef APPLY_REFRACTION
+refr = (myhalf3(texture2D(RefractionTexture, projCoord))) * refrdot;
+#endif
+#ifdef APPLY_REFLECTION
+refl = (myhalf3(texture2D(ReflectionTexture, projCoord))) * refldot;
+#endif
+
+#else
+
+#ifdef APPLY_REFRACTION
+refr = (myhalf3(texture2D(RefractionTexture, projCoord)));
+#endif
+#ifdef APPLY_REFLECTION
+refl = (myhalf3(texture2D(ReflectionTexture, projCoord)));
+#endif
+
+#endif
+
+// add reflection and refraction
+#ifdef APPLY_DISTORTION_ALPHA
+color = myhalf3(gl_Color.rgb) + myhalf3(mix (refr, refl, float(gl_Color.a)));
+#else
+color = myhalf3(gl_Color.rgb) + refr + refl;
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),1.0);
+#else
+gl_FragColor = vec4(vec3(color),1.0);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/16.frag b/shaders/warsow/16.frag
new file mode 100644
index 0000000..d917740
--- /dev/null
+++ b/shaders/warsow/16.frag
@@ -0,0 +1,110 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec4 ProjVector;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+
+mat4 textureMatrix;
+
+textureMatrix = gl_TextureMatrix[0];
+
+gl_Position = ftransform();
+ProjVector = textureMatrix * gl_Vertex;
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform myhalf3 LightAmbient;
+
+uniform float TextureWidth, TextureHeight;
+uniform float ProjDistance;
+uniform sampler2DShadow ShadowmapTexture;
+
+void main(void)
+{
+myhalf color = myhalf(1.0);
+
+if (ProjVector.w <= 0.0 || ProjVector.w >= ProjDistance)
+discard;
+
+float dtW = 1.0 / TextureWidth;
+float dtH = 1.0 / TextureHeight;
+
+vec3 coord = vec3 (ProjVector.xyz / ProjVector.w);
+coord = (coord + vec3 (1.0)) * vec3 (0.5);
+coord.s = float (clamp (float(coord.s), dtW, 1.0 - dtW));
+coord.t = float (clamp (float(coord.t), dtH, 1.0 - dtH));
+coord.r = float (clamp (float(coord.r), 0.0, 1.0));
+
+myhalf shadow0 = myhalf(shadow2D(ShadowmapTexture, coord).r);
+myhalf shadow = shadow0;
+
+#if defined(APPLY_PCF2x2) || defined(APPLY_PCF3x3)
+
+vec3 coord2 = coord + vec3(0.0, dtH, 0.0);
+myhalf shadow1 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, dtH, 0.0);
+myhalf shadow2 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, 0.0, 0.0);
+myhalf shadow3 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+#if defined(APPLY_PCF3x3)
+coord2 = coord + vec3(-dtW, 0.0, 0.0);
+myhalf shadow4 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(-dtW, -dtH, 0.0);
+myhalf shadow5 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(0.0, -dtH, 0.0);
+myhalf shadow6 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, -dtH, 0.0);
+myhalf shadow7 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(-dtW, dtH, 0.0);
+myhalf shadow8 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+shadow = (shadow0 + shadow1 + shadow2 + shadow3 + shadow4 + shadow5 + shadow6 + shadow7 + shadow8) * myhalf(0.11);
+#else
+shadow = (shadow0 + shadow1 + shadow2 + shadow3) * myhalf(0.25);
+#endif
+#else
+shadow = shadow0;
+#endif
+
+float attenuation = float (ProjVector.w) / ProjDistance;
+myhalf compensation = myhalf(0.25) - max(LightAmbient.x, max(LightAmbient.y, LightAmbient.z))
+;compensation = max (compensation, 0.0);
+color = shadow + attenuation + compensation;
+
+gl_FragColor = vec4(vec3(color),1.0);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/16.vert b/shaders/warsow/16.vert
new file mode 100644
index 0000000..f5a1571
--- /dev/null
+++ b/shaders/warsow/16.vert
@@ -0,0 +1,110 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec4 ProjVector;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+
+mat4 textureMatrix;
+
+textureMatrix = gl_TextureMatrix[0];
+
+gl_Position = ftransform();
+ProjVector = textureMatrix * gl_Vertex;
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform myhalf3 LightAmbient;
+
+uniform float TextureWidth, TextureHeight;
+uniform float ProjDistance;
+uniform sampler2DShadow ShadowmapTexture;
+
+void main(void)
+{
+myhalf color = myhalf(1.0);
+
+if (ProjVector.w <= 0.0 || ProjVector.w >= ProjDistance)
+discard;
+
+float dtW = 1.0 / TextureWidth;
+float dtH = 1.0 / TextureHeight;
+
+vec3 coord = vec3 (ProjVector.xyz / ProjVector.w);
+coord = (coord + vec3 (1.0)) * vec3 (0.5);
+coord.s = float (clamp (float(coord.s), dtW, 1.0 - dtW));
+coord.t = float (clamp (float(coord.t), dtH, 1.0 - dtH));
+coord.r = float (clamp (float(coord.r), 0.0, 1.0));
+
+myhalf shadow0 = myhalf(shadow2D(ShadowmapTexture, coord).r);
+myhalf shadow = shadow0;
+
+#if defined(APPLY_PCF2x2) || defined(APPLY_PCF3x3)
+
+vec3 coord2 = coord + vec3(0.0, dtH, 0.0);
+myhalf shadow1 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, dtH, 0.0);
+myhalf shadow2 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, 0.0, 0.0);
+myhalf shadow3 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+#if defined(APPLY_PCF3x3)
+coord2 = coord + vec3(-dtW, 0.0, 0.0);
+myhalf shadow4 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(-dtW, -dtH, 0.0);
+myhalf shadow5 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(0.0, -dtH, 0.0);
+myhalf shadow6 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, -dtH, 0.0);
+myhalf shadow7 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(-dtW, dtH, 0.0);
+myhalf shadow8 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+shadow = (shadow0 + shadow1 + shadow2 + shadow3 + shadow4 + shadow5 + shadow6 + shadow7 + shadow8) * myhalf(0.11);
+#else
+shadow = (shadow0 + shadow1 + shadow2 + shadow3) * myhalf(0.25);
+#endif
+#else
+shadow = shadow0;
+#endif
+
+float attenuation = float (ProjVector.w) / ProjDistance;
+myhalf compensation = myhalf(0.25) - max(LightAmbient.x, max(LightAmbient.y, LightAmbient.z))
+;compensation = max (compensation, 0.0);
+color = shadow + attenuation + compensation;
+
+gl_FragColor = vec4(vec3(color),1.0);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/17.frag b/shaders/warsow/17.frag
new file mode 100644
index 0000000..0e60fc6
--- /dev/null
+++ b/shaders/warsow/17.frag
@@ -0,0 +1,49 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+
+varying vec4 ProjVector;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform float OutlineHeight;
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+vec4 n = vec4(gl_Normal.xyz, 0.0);
+vec4 v = vec4(gl_Vertex) + n * OutlineHeight;
+
+gl_Position = gl_ModelViewProjectionMatrix * v;
+ProjVector = gl_Position;
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * v;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform float OutlineCutOff;
+
+void main(void)
+{
+
+#ifdef APPLY_OUTLINES_CUTOFF
+if (OutlineCutOff > 0.0 && (ProjVector.w > OutlineCutOff))
+discard;
+#endif
+
+gl_FragColor = vec4 (gl_Color);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/17.vert b/shaders/warsow/17.vert
new file mode 100644
index 0000000..368238c
--- /dev/null
+++ b/shaders/warsow/17.vert
@@ -0,0 +1,49 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+
+varying vec4 ProjVector;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform float OutlineHeight;
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+vec4 n = vec4(gl_Normal.xyz, 0.0);
+vec4 v = vec4(gl_Vertex) + n * OutlineHeight;
+
+gl_Position = gl_ModelViewProjectionMatrix * v;
+ProjVector = gl_Position;
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * v;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform float OutlineCutOff;
+
+void main(void)
+{
+
+#ifdef APPLY_OUTLINES_CUTOFF
+if (OutlineCutOff > 0.0 && (ProjVector.w > OutlineCutOff))
+discard;
+#endif
+
+gl_FragColor = vec4 (gl_Color);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/18.frag b/shaders/warsow/18.frag
new file mode 100644
index 0000000..f9d9ae2
--- /dev/null
+++ b/shaders/warsow/18.frag
@@ -0,0 +1,63 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+#define M_TWOPI 6.28318530717958647692
+
+varying vec2 TexCoord;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform float TurbAmplitude, TurbPhase;
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+vec4 turb;
+turb = vec4(gl_MultiTexCoord0);
+turb.s += TurbAmplitude * sin( ((gl_MultiTexCoord0.t / 4.0 + TurbPhase)) * M_TWOPI );
+turb.t += TurbAmplitude * sin( ((gl_MultiTexCoord0.s / 4.0 + TurbPhase)) * M_TWOPI );
+TexCoord = vec2(gl_TextureMatrix[0] * turb);
+
+gl_Position = ftransform();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform sampler2D BaseTexture;
+
+void main(void)
+{
+
+myhalf4 color;
+
+color = myhalf4(gl_Color) * myhalf4(texture2D(BaseTexture, TexCoord));
+
+gl_FragColor = vec4(color);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/18.vert b/shaders/warsow/18.vert
new file mode 100644
index 0000000..27e76e5
--- /dev/null
+++ b/shaders/warsow/18.vert
@@ -0,0 +1,63 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+#define M_TWOPI 6.28318530717958647692
+
+varying vec2 TexCoord;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform float TurbAmplitude, TurbPhase;
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+vec4 turb;
+turb = vec4(gl_MultiTexCoord0);
+turb.s += TurbAmplitude * sin( ((gl_MultiTexCoord0.t / 4.0 + TurbPhase)) * M_TWOPI );
+turb.t += TurbAmplitude * sin( ((gl_MultiTexCoord0.s / 4.0 + TurbPhase)) * M_TWOPI );
+TexCoord = vec2(gl_TextureMatrix[0] * turb);
+
+gl_Position = ftransform();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform sampler2D BaseTexture;
+
+void main(void)
+{
+
+myhalf4 color;
+
+color = myhalf4(gl_Color) * myhalf4(texture2D(BaseTexture, TexCoord));
+
+gl_FragColor = vec4(color);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/19.frag b/shaders/warsow/19.frag
new file mode 100644
index 0000000..28fd36b
--- /dev/null
+++ b/shaders/warsow/19.frag
@@ -0,0 +1,345 @@
+#define FRAGMENT_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_AMBIENT_COMPENSATION
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/19.vert b/shaders/warsow/19.vert
new file mode 100644
index 0000000..2303a5d
--- /dev/null
+++ b/shaders/warsow/19.vert
@@ -0,0 +1,345 @@
+#define VERTEX_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_AMBIENT_COMPENSATION
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/2.frag b/shaders/warsow/2.frag
new file mode 100644
index 0000000..4b7ece2
--- /dev/null
+++ b/shaders/warsow/2.frag
@@ -0,0 +1,344 @@
+#define FRAGMENT_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/2.vert b/shaders/warsow/2.vert
new file mode 100644
index 0000000..d34482c
--- /dev/null
+++ b/shaders/warsow/2.vert
@@ -0,0 +1,344 @@
+#define VERTEX_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/20.frag b/shaders/warsow/20.frag
new file mode 100644
index 0000000..dce1c71
--- /dev/null
+++ b/shaders/warsow/20.frag
@@ -0,0 +1,342 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/20.vert b/shaders/warsow/20.vert
new file mode 100644
index 0000000..7cbe02c
--- /dev/null
+++ b/shaders/warsow/20.vert
@@ -0,0 +1,342 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/21.frag b/shaders/warsow/21.frag
new file mode 100644
index 0000000..4b7ece2
--- /dev/null
+++ b/shaders/warsow/21.frag
@@ -0,0 +1,344 @@
+#define FRAGMENT_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/21.vert b/shaders/warsow/21.vert
new file mode 100644
index 0000000..d34482c
--- /dev/null
+++ b/shaders/warsow/21.vert
@@ -0,0 +1,344 @@
+#define VERTEX_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/22.frag b/shaders/warsow/22.frag
new file mode 100644
index 0000000..00a170c
--- /dev/null
+++ b/shaders/warsow/22.frag
@@ -0,0 +1,345 @@
+#define FRAGMENT_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_SPECULAR
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/22.vert b/shaders/warsow/22.vert
new file mode 100644
index 0000000..2ddc43a
--- /dev/null
+++ b/shaders/warsow/22.vert
@@ -0,0 +1,345 @@
+#define VERTEX_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_SPECULAR
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/23.frag b/shaders/warsow/23.frag
new file mode 100644
index 0000000..f106fbe
--- /dev/null
+++ b/shaders/warsow/23.frag
@@ -0,0 +1,346 @@
+#define FRAGMENT_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_SPECULAR
+#define APPLY_AMBIENT_COMPENSATION
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/23.vert b/shaders/warsow/23.vert
new file mode 100644
index 0000000..4fe15fd
--- /dev/null
+++ b/shaders/warsow/23.vert
@@ -0,0 +1,346 @@
+#define VERTEX_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_SPECULAR
+#define APPLY_AMBIENT_COMPENSATION
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/24.frag b/shaders/warsow/24.frag
new file mode 100644
index 0000000..4292f6c
--- /dev/null
+++ b/shaders/warsow/24.frag
@@ -0,0 +1,344 @@
+#define FRAGMENT_SHADER
+#define APPLY_DIRECTIONAL_LIGHT
+#define APPLY_CELLSHADING
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/24.vert b/shaders/warsow/24.vert
new file mode 100644
index 0000000..78f8084
--- /dev/null
+++ b/shaders/warsow/24.vert
@@ -0,0 +1,344 @@
+#define VERTEX_SHADER
+#define APPLY_DIRECTIONAL_LIGHT
+#define APPLY_CELLSHADING
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/25.frag b/shaders/warsow/25.frag
new file mode 100644
index 0000000..af536af
--- /dev/null
+++ b/shaders/warsow/25.frag
@@ -0,0 +1,151 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec4 TexCoord;
+varying vec4 ProjVector;
+#ifdef APPLY_EYEDOT
+varying vec3 EyeVector;
+#endif
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+#ifdef APPLY_EYEDOT
+uniform vec3 EyeOrigin;
+uniform float FrontPlane;
+#endif
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+mat4 textureMatrix;
+
+textureMatrix = gl_TextureMatrix[0];
+TexCoord.st = vec2 (textureMatrix * gl_MultiTexCoord0);
+
+textureMatrix = gl_TextureMatrix[0];
+textureMatrix[0] = -textureMatrix[0];
+textureMatrix[1] = -textureMatrix[1];
+TexCoord.pq = vec2 (textureMatrix * gl_MultiTexCoord0);
+
+#ifdef APPLY_EYEDOT
+mat3 strMatrix;
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+vec3 EyeVectorWorld = (EyeOrigin - gl_Vertex.xyz) * FrontPlane;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+gl_Position = ftransform();
+ProjVector = gl_Position;
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_DUDV
+uniform sampler2D DuDvMapTexture;
+#endif
+
+#ifdef APPLY_EYEDOT
+uniform sampler2D NormalmapTexture;
+#endif
+uniform sampler2D ReflectionTexture;
+uniform sampler2D RefractionTexture;
+uniform float TextureWidth, TextureHeight;
+
+void main(void)
+{
+myhalf3 color;
+
+#ifdef APPLY_DUDV
+vec3 displacement = vec3(texture2D(DuDvMapTexture, vec2(TexCoord.pq) * vec2(0.25)));
+vec2 coord = vec2(TexCoord.st) + vec2(displacement) * vec2 (0.2);
+
+vec3 fdist = vec3 (normalize(vec3(texture2D(DuDvMapTexture, coord)) - vec3 (0.5))) * vec3(0.005);
+#else
+vec3 fdist = vec3(0.0);
+#endif
+
+// get projective texcoords
+float scale = float(1.0 / float(ProjVector.w));
+float inv2NW = 1.0 / (2.0 * float (TextureWidth));
+float inv2NH = 1.0 / (2.0 * float (TextureHeight));
+vec2 projCoord = (vec2(ProjVector.xy) * scale + vec2 (1.0)) * vec2 (0.5) + vec2(fdist.xy);
+projCoord.s = float (clamp (float(projCoord.s), inv2NW, 1.0 - inv2NW));
+projCoord.t = float (clamp (float(projCoord.t), inv2NH, 1.0 - inv2NH));
+
+
+myhalf3 refr = myhalf3(0.0);
+myhalf3 refl = myhalf3(0.0);
+
+#ifdef APPLY_EYEDOT
+// calculate dot product between the surface normal and eye vector
+// great for simulating varying water translucency based on the view angle
+myhalf3 surfaceNormal = normalize(myhalf3(texture2D(NormalmapTexture, coord)) - myhalf3 (0.5));
+vec3 eyeNormal = normalize(myhalf3(EyeVector));
+
+float refrdot = float(dot(surfaceNormal, eyeNormal));
+//refrdot = float (clamp (refrdot, 0.0, 1.0));
+float refldot = 1.0 - refrdot;
+// get refraction and reflection
+
+#ifdef APPLY_REFRACTION
+refr = (myhalf3(texture2D(RefractionTexture, projCoord))) * refrdot;
+#endif
+#ifdef APPLY_REFLECTION
+refl = (myhalf3(texture2D(ReflectionTexture, projCoord))) * refldot;
+#endif
+
+#else
+
+#ifdef APPLY_REFRACTION
+refr = (myhalf3(texture2D(RefractionTexture, projCoord)));
+#endif
+#ifdef APPLY_REFLECTION
+refl = (myhalf3(texture2D(ReflectionTexture, projCoord)));
+#endif
+
+#endif
+
+// add reflection and refraction
+#ifdef APPLY_DISTORTION_ALPHA
+color = myhalf3(gl_Color.rgb) + myhalf3(mix (refr, refl, float(gl_Color.a)));
+#else
+color = myhalf3(gl_Color.rgb) + refr + refl;
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),1.0);
+#else
+gl_FragColor = vec4(vec3(color),1.0);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/25.vert b/shaders/warsow/25.vert
new file mode 100644
index 0000000..6ee1e1e
--- /dev/null
+++ b/shaders/warsow/25.vert
@@ -0,0 +1,151 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec4 TexCoord;
+varying vec4 ProjVector;
+#ifdef APPLY_EYEDOT
+varying vec3 EyeVector;
+#endif
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+#ifdef APPLY_EYEDOT
+uniform vec3 EyeOrigin;
+uniform float FrontPlane;
+#endif
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+mat4 textureMatrix;
+
+textureMatrix = gl_TextureMatrix[0];
+TexCoord.st = vec2 (textureMatrix * gl_MultiTexCoord0);
+
+textureMatrix = gl_TextureMatrix[0];
+textureMatrix[0] = -textureMatrix[0];
+textureMatrix[1] = -textureMatrix[1];
+TexCoord.pq = vec2 (textureMatrix * gl_MultiTexCoord0);
+
+#ifdef APPLY_EYEDOT
+mat3 strMatrix;
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+vec3 EyeVectorWorld = (EyeOrigin - gl_Vertex.xyz) * FrontPlane;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+gl_Position = ftransform();
+ProjVector = gl_Position;
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_DUDV
+uniform sampler2D DuDvMapTexture;
+#endif
+
+#ifdef APPLY_EYEDOT
+uniform sampler2D NormalmapTexture;
+#endif
+uniform sampler2D ReflectionTexture;
+uniform sampler2D RefractionTexture;
+uniform float TextureWidth, TextureHeight;
+
+void main(void)
+{
+myhalf3 color;
+
+#ifdef APPLY_DUDV
+vec3 displacement = vec3(texture2D(DuDvMapTexture, vec2(TexCoord.pq) * vec2(0.25)));
+vec2 coord = vec2(TexCoord.st) + vec2(displacement) * vec2 (0.2);
+
+vec3 fdist = vec3 (normalize(vec3(texture2D(DuDvMapTexture, coord)) - vec3 (0.5))) * vec3(0.005);
+#else
+vec3 fdist = vec3(0.0);
+#endif
+
+// get projective texcoords
+float scale = float(1.0 / float(ProjVector.w));
+float inv2NW = 1.0 / (2.0 * float (TextureWidth));
+float inv2NH = 1.0 / (2.0 * float (TextureHeight));
+vec2 projCoord = (vec2(ProjVector.xy) * scale + vec2 (1.0)) * vec2 (0.5) + vec2(fdist.xy);
+projCoord.s = float (clamp (float(projCoord.s), inv2NW, 1.0 - inv2NW));
+projCoord.t = float (clamp (float(projCoord.t), inv2NH, 1.0 - inv2NH));
+
+
+myhalf3 refr = myhalf3(0.0);
+myhalf3 refl = myhalf3(0.0);
+
+#ifdef APPLY_EYEDOT
+// calculate dot product between the surface normal and eye vector
+// great for simulating varying water translucency based on the view angle
+myhalf3 surfaceNormal = normalize(myhalf3(texture2D(NormalmapTexture, coord)) - myhalf3 (0.5));
+vec3 eyeNormal = normalize(myhalf3(EyeVector));
+
+float refrdot = float(dot(surfaceNormal, eyeNormal));
+//refrdot = float (clamp (refrdot, 0.0, 1.0));
+float refldot = 1.0 - refrdot;
+// get refraction and reflection
+
+#ifdef APPLY_REFRACTION
+refr = (myhalf3(texture2D(RefractionTexture, projCoord))) * refrdot;
+#endif
+#ifdef APPLY_REFLECTION
+refl = (myhalf3(texture2D(ReflectionTexture, projCoord))) * refldot;
+#endif
+
+#else
+
+#ifdef APPLY_REFRACTION
+refr = (myhalf3(texture2D(RefractionTexture, projCoord)));
+#endif
+#ifdef APPLY_REFLECTION
+refl = (myhalf3(texture2D(ReflectionTexture, projCoord)));
+#endif
+
+#endif
+
+// add reflection and refraction
+#ifdef APPLY_DISTORTION_ALPHA
+color = myhalf3(gl_Color.rgb) + myhalf3(mix (refr, refl, float(gl_Color.a)));
+#else
+color = myhalf3(gl_Color.rgb) + refr + refl;
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),1.0);
+#else
+gl_FragColor = vec4(vec3(color),1.0);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/26.frag b/shaders/warsow/26.frag
new file mode 100644
index 0000000..d917740
--- /dev/null
+++ b/shaders/warsow/26.frag
@@ -0,0 +1,110 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec4 ProjVector;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+
+mat4 textureMatrix;
+
+textureMatrix = gl_TextureMatrix[0];
+
+gl_Position = ftransform();
+ProjVector = textureMatrix * gl_Vertex;
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform myhalf3 LightAmbient;
+
+uniform float TextureWidth, TextureHeight;
+uniform float ProjDistance;
+uniform sampler2DShadow ShadowmapTexture;
+
+void main(void)
+{
+myhalf color = myhalf(1.0);
+
+if (ProjVector.w <= 0.0 || ProjVector.w >= ProjDistance)
+discard;
+
+float dtW = 1.0 / TextureWidth;
+float dtH = 1.0 / TextureHeight;
+
+vec3 coord = vec3 (ProjVector.xyz / ProjVector.w);
+coord = (coord + vec3 (1.0)) * vec3 (0.5);
+coord.s = float (clamp (float(coord.s), dtW, 1.0 - dtW));
+coord.t = float (clamp (float(coord.t), dtH, 1.0 - dtH));
+coord.r = float (clamp (float(coord.r), 0.0, 1.0));
+
+myhalf shadow0 = myhalf(shadow2D(ShadowmapTexture, coord).r);
+myhalf shadow = shadow0;
+
+#if defined(APPLY_PCF2x2) || defined(APPLY_PCF3x3)
+
+vec3 coord2 = coord + vec3(0.0, dtH, 0.0);
+myhalf shadow1 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, dtH, 0.0);
+myhalf shadow2 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, 0.0, 0.0);
+myhalf shadow3 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+#if defined(APPLY_PCF3x3)
+coord2 = coord + vec3(-dtW, 0.0, 0.0);
+myhalf shadow4 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(-dtW, -dtH, 0.0);
+myhalf shadow5 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(0.0, -dtH, 0.0);
+myhalf shadow6 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, -dtH, 0.0);
+myhalf shadow7 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(-dtW, dtH, 0.0);
+myhalf shadow8 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+shadow = (shadow0 + shadow1 + shadow2 + shadow3 + shadow4 + shadow5 + shadow6 + shadow7 + shadow8) * myhalf(0.11);
+#else
+shadow = (shadow0 + shadow1 + shadow2 + shadow3) * myhalf(0.25);
+#endif
+#else
+shadow = shadow0;
+#endif
+
+float attenuation = float (ProjVector.w) / ProjDistance;
+myhalf compensation = myhalf(0.25) - max(LightAmbient.x, max(LightAmbient.y, LightAmbient.z))
+;compensation = max (compensation, 0.0);
+color = shadow + attenuation + compensation;
+
+gl_FragColor = vec4(vec3(color),1.0);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/26.vert b/shaders/warsow/26.vert
new file mode 100644
index 0000000..f5a1571
--- /dev/null
+++ b/shaders/warsow/26.vert
@@ -0,0 +1,110 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec4 ProjVector;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+
+mat4 textureMatrix;
+
+textureMatrix = gl_TextureMatrix[0];
+
+gl_Position = ftransform();
+ProjVector = textureMatrix * gl_Vertex;
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform myhalf3 LightAmbient;
+
+uniform float TextureWidth, TextureHeight;
+uniform float ProjDistance;
+uniform sampler2DShadow ShadowmapTexture;
+
+void main(void)
+{
+myhalf color = myhalf(1.0);
+
+if (ProjVector.w <= 0.0 || ProjVector.w >= ProjDistance)
+discard;
+
+float dtW = 1.0 / TextureWidth;
+float dtH = 1.0 / TextureHeight;
+
+vec3 coord = vec3 (ProjVector.xyz / ProjVector.w);
+coord = (coord + vec3 (1.0)) * vec3 (0.5);
+coord.s = float (clamp (float(coord.s), dtW, 1.0 - dtW));
+coord.t = float (clamp (float(coord.t), dtH, 1.0 - dtH));
+coord.r = float (clamp (float(coord.r), 0.0, 1.0));
+
+myhalf shadow0 = myhalf(shadow2D(ShadowmapTexture, coord).r);
+myhalf shadow = shadow0;
+
+#if defined(APPLY_PCF2x2) || defined(APPLY_PCF3x3)
+
+vec3 coord2 = coord + vec3(0.0, dtH, 0.0);
+myhalf shadow1 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, dtH, 0.0);
+myhalf shadow2 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, 0.0, 0.0);
+myhalf shadow3 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+#if defined(APPLY_PCF3x3)
+coord2 = coord + vec3(-dtW, 0.0, 0.0);
+myhalf shadow4 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(-dtW, -dtH, 0.0);
+myhalf shadow5 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(0.0, -dtH, 0.0);
+myhalf shadow6 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, -dtH, 0.0);
+myhalf shadow7 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(-dtW, dtH, 0.0);
+myhalf shadow8 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+shadow = (shadow0 + shadow1 + shadow2 + shadow3 + shadow4 + shadow5 + shadow6 + shadow7 + shadow8) * myhalf(0.11);
+#else
+shadow = (shadow0 + shadow1 + shadow2 + shadow3) * myhalf(0.25);
+#endif
+#else
+shadow = shadow0;
+#endif
+
+float attenuation = float (ProjVector.w) / ProjDistance;
+myhalf compensation = myhalf(0.25) - max(LightAmbient.x, max(LightAmbient.y, LightAmbient.z))
+;compensation = max (compensation, 0.0);
+color = shadow + attenuation + compensation;
+
+gl_FragColor = vec4(vec3(color),1.0);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/27.frag b/shaders/warsow/27.frag
new file mode 100644
index 0000000..0e60fc6
--- /dev/null
+++ b/shaders/warsow/27.frag
@@ -0,0 +1,49 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+
+varying vec4 ProjVector;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform float OutlineHeight;
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+vec4 n = vec4(gl_Normal.xyz, 0.0);
+vec4 v = vec4(gl_Vertex) + n * OutlineHeight;
+
+gl_Position = gl_ModelViewProjectionMatrix * v;
+ProjVector = gl_Position;
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * v;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform float OutlineCutOff;
+
+void main(void)
+{
+
+#ifdef APPLY_OUTLINES_CUTOFF
+if (OutlineCutOff > 0.0 && (ProjVector.w > OutlineCutOff))
+discard;
+#endif
+
+gl_FragColor = vec4 (gl_Color);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/27.vert b/shaders/warsow/27.vert
new file mode 100644
index 0000000..368238c
--- /dev/null
+++ b/shaders/warsow/27.vert
@@ -0,0 +1,49 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+
+varying vec4 ProjVector;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform float OutlineHeight;
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+vec4 n = vec4(gl_Normal.xyz, 0.0);
+vec4 v = vec4(gl_Vertex) + n * OutlineHeight;
+
+gl_Position = gl_ModelViewProjectionMatrix * v;
+ProjVector = gl_Position;
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * v;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform float OutlineCutOff;
+
+void main(void)
+{
+
+#ifdef APPLY_OUTLINES_CUTOFF
+if (OutlineCutOff > 0.0 && (ProjVector.w > OutlineCutOff))
+discard;
+#endif
+
+gl_FragColor = vec4 (gl_Color);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/28.frag b/shaders/warsow/28.frag
new file mode 100644
index 0000000..f9d9ae2
--- /dev/null
+++ b/shaders/warsow/28.frag
@@ -0,0 +1,63 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+#define M_TWOPI 6.28318530717958647692
+
+varying vec2 TexCoord;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform float TurbAmplitude, TurbPhase;
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+vec4 turb;
+turb = vec4(gl_MultiTexCoord0);
+turb.s += TurbAmplitude * sin( ((gl_MultiTexCoord0.t / 4.0 + TurbPhase)) * M_TWOPI );
+turb.t += TurbAmplitude * sin( ((gl_MultiTexCoord0.s / 4.0 + TurbPhase)) * M_TWOPI );
+TexCoord = vec2(gl_TextureMatrix[0] * turb);
+
+gl_Position = ftransform();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform sampler2D BaseTexture;
+
+void main(void)
+{
+
+myhalf4 color;
+
+color = myhalf4(gl_Color) * myhalf4(texture2D(BaseTexture, TexCoord));
+
+gl_FragColor = vec4(color);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/28.vert b/shaders/warsow/28.vert
new file mode 100644
index 0000000..27e76e5
--- /dev/null
+++ b/shaders/warsow/28.vert
@@ -0,0 +1,63 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+#define M_TWOPI 6.28318530717958647692
+
+varying vec2 TexCoord;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform float TurbAmplitude, TurbPhase;
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+vec4 turb;
+turb = vec4(gl_MultiTexCoord0);
+turb.s += TurbAmplitude * sin( ((gl_MultiTexCoord0.t / 4.0 + TurbPhase)) * M_TWOPI );
+turb.t += TurbAmplitude * sin( ((gl_MultiTexCoord0.s / 4.0 + TurbPhase)) * M_TWOPI );
+TexCoord = vec2(gl_TextureMatrix[0] * turb);
+
+gl_Position = ftransform();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform sampler2D BaseTexture;
+
+void main(void)
+{
+
+myhalf4 color;
+
+color = myhalf4(gl_Color) * myhalf4(texture2D(BaseTexture, TexCoord));
+
+gl_FragColor = vec4(color);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/3.frag b/shaders/warsow/3.frag
new file mode 100644
index 0000000..00a170c
--- /dev/null
+++ b/shaders/warsow/3.frag
@@ -0,0 +1,345 @@
+#define FRAGMENT_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_SPECULAR
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/3.vert b/shaders/warsow/3.vert
new file mode 100644
index 0000000..2ddc43a
--- /dev/null
+++ b/shaders/warsow/3.vert
@@ -0,0 +1,345 @@
+#define VERTEX_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_SPECULAR
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/4.frag b/shaders/warsow/4.frag
new file mode 100644
index 0000000..f106fbe
--- /dev/null
+++ b/shaders/warsow/4.frag
@@ -0,0 +1,346 @@
+#define FRAGMENT_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_SPECULAR
+#define APPLY_AMBIENT_COMPENSATION
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/4.vert b/shaders/warsow/4.vert
new file mode 100644
index 0000000..4fe15fd
--- /dev/null
+++ b/shaders/warsow/4.vert
@@ -0,0 +1,346 @@
+#define VERTEX_SHADER
+#define APPLY_LIGHTSTYLE0
+#define APPLY_FBLIGHTMAP
+#define APPLY_SPECULAR
+#define APPLY_AMBIENT_COMPENSATION
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/5.frag b/shaders/warsow/5.frag
new file mode 100644
index 0000000..4292f6c
--- /dev/null
+++ b/shaders/warsow/5.frag
@@ -0,0 +1,344 @@
+#define FRAGMENT_SHADER
+#define APPLY_DIRECTIONAL_LIGHT
+#define APPLY_CELLSHADING
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/5.vert b/shaders/warsow/5.vert
new file mode 100644
index 0000000..78f8084
--- /dev/null
+++ b/shaders/warsow/5.vert
@@ -0,0 +1,344 @@
+#define VERTEX_SHADER
+#define APPLY_DIRECTIONAL_LIGHT
+#define APPLY_CELLSHADING
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec2 TexCoord;
+#ifdef APPLY_LIGHTSTYLE0
+varying vec4 LightmapTexCoord01;
+#ifdef APPLY_LIGHTSTYLE2
+varying vec4 LightmapTexCoord23;
+#endif
+#endif
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+varying vec3 EyeVector;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+varying vec3 LightVector;
+#endif
+
+varying mat3 strMatrix; // directions of S/T/R texcoords (tangent, binormal, normal)
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform vec3 EyeOrigin;
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform vec3 LightDir;
+#endif
+
+void main()
+{
+gl_FrontColor = gl_Color;
+
+TexCoord = vec2 (gl_TextureMatrix[0] * gl_MultiTexCoord0);
+
+#ifdef APPLY_LIGHTSTYLE0
+LightmapTexCoord01.st = gl_MultiTexCoord4.st;
+#ifdef APPLY_LIGHTSTYLE1
+LightmapTexCoord01.pq = gl_MultiTexCoord5.st;
+#ifdef APPLY_LIGHTSTYLE2
+LightmapTexCoord23.st = gl_MultiTexCoord6.st;
+#ifdef APPLY_LIGHTSTYLE3
+LightmapTexCoord23.pq = gl_MultiTexCoord7.st;
+#endif
+#endif
+#endif
+#endif
+
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+#if defined(APPLY_SPECULAR) || defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+vec3 EyeVectorWorld = EyeOrigin - gl_Vertex.xyz;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+LightVector = LightDir * strMatrix;
+#endif
+
+gl_Position = ftransform ();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_LIGHTSTYLE0
+uniform sampler2D LightmapTexture0;
+uniform float DeluxemapOffset0; // s-offset for LightmapTexCoord
+uniform myhalf3 lsColor0; // lightstyle color
+
+#ifdef APPLY_LIGHTSTYLE1
+uniform sampler2D LightmapTexture1;
+uniform float DeluxemapOffset1;
+uniform myhalf3 lsColor1;
+
+#ifdef APPLY_LIGHTSTYLE2
+uniform sampler2D LightmapTexture2;
+uniform float DeluxemapOffset2;
+uniform myhalf3 lsColor2;
+
+#ifdef APPLY_LIGHTSTYLE3
+uniform sampler2D LightmapTexture3;
+uniform float DeluxemapOffset3;
+uniform myhalf3 lsColor3;
+
+#endif
+#endif
+#endif
+#endif
+
+uniform sampler2D BaseTexture;
+uniform sampler2D NormalmapTexture;
+uniform sampler2D GlossTexture;
+#ifdef APPLY_DECAL
+uniform sampler2D DecalTexture;
+#endif
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+uniform float OffsetMappingScale;
+#endif
+
+uniform myhalf3 LightAmbient;
+#ifdef APPLY_DIRECTIONAL_LIGHT
+uniform myhalf3 LightDiffuse;
+#endif
+
+uniform myhalf GlossIntensity; // gloss scaling factor
+uniform myhalf GlossExponent; // gloss exponent factor
+
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// The following reliefmapping and offsetmapping routine was taken from DarkPlaces
+// The credit goes to LordHavoc (as always)
+vec2 OffsetMapping(vec2 TexCoord)
+{
+#ifdef APPLY_RELIEFMAPPING
+// 14 sample relief mapping: linear search and then binary search
+// this basically steps forward a small amount repeatedly until it finds
+// itself inside solid, then jitters forward and back using decreasing
+// amounts to find the impact
+//vec3 OffsetVector = vec3(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1), -1);
+//vec3 OffsetVector = vec3(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 OffsetVector = vec3(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1), -1);
+vec3 RT = vec3(TexCoord, 1);
+OffsetVector *= 0.1;
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * step(texture2D(NormalmapTexture, RT.xy).a, RT.z);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) - 0.5);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.5 - 0.25);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.25 - 0.125);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.125 - 0.0625);
+RT += OffsetVector * (step(texture2D(NormalmapTexture, RT.xy).a, RT.z) * 0.0625 - 0.03125);
+return RT.xy;
+#else
+// 2 sample offset mapping (only 2 samples because of ATI Radeon 9500-9800/X300 limits)
+// this basically moves forward the full distance, and then backs up based
+// on height of samples
+//vec2 OffsetVector = vec2(EyeVector.xy * ((1.0 / EyeVector.z) * OffsetMappingScale) * vec2(-1, 1));
+//vec2 OffsetVector = vec2(normalize(EyeVector.xy) * OffsetMappingScale * vec2(-1, 1));
+vec2 OffsetVector = vec2(normalize(EyeVector).xy * OffsetMappingScale * vec2(-1, 1));
+TexCoord += OffsetVector;
+OffsetVector *= 0.5;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+TexCoord -= OffsetVector * texture2D(NormalmapTexture, TexCoord).a;
+return TexCoord;
+#endif
+}
+#endif
+
+void main()
+{
+#if defined(APPLY_OFFSETMAPPING) || defined(APPLY_RELIEFMAPPING)
+// apply offsetmapping
+vec2 TexCoordOffset = OffsetMapping(TexCoord);
+#define TexCoord TexCoordOffset
+#endif
+myhalf3 surfaceNormal;
+myhalf3 diffuseNormalModelspace;
+myhalf3 diffuseNormal = myhalf3 (0.0, 0.0, -1.0);
+float diffuseProduct;
+#ifdef APPLY_CELLSHADING
+int lightcell;
+float diffuseProductPositive;
+float diffuseProductNegative;
+float hardShadow;
+#endif
+
+myhalf3 weightedDiffuseNormal;
+myhalf3 specularNormal;
+float specularProduct;
+
+#if !defined(APPLY_DIRECTIONAL_LIGHT) && !defined(APPLY_LIGHTSTYLE0)
+myhalf4 color = myhalf4 (1.0, 1.0, 1.0, 1.0);
+#else
+myhalf4 color = myhalf4 (0.0, 0.0, 0.0, 1.0);
+#endif
+
+// get the surface normal
+surfaceNormal = normalize (myhalf3 (texture2D (NormalmapTexture, TexCoord)) - myhalf3 (0.5));
+
+#ifdef APPLY_DIRECTIONAL_LIGHT
+diffuseNormal = myhalf3 (LightVector);
+weightedDiffuseNormal = diffuseNormal;
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+#ifdef APPLY_CELLSHADING
+hardShadow = 0.0;
+diffuseProductPositive = max (diffuseProduct, 0.0);
+diffuseProductNegative = (-min (diffuseProduct, 0.0) - 0.3);
+
+// smooth the hard shadow edge
+lightcell = int(max(diffuseProduct + 0.1, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(max(diffuseProduct + 0.055, 0.0) * 2.0);
+hardShadow += float(lightcell);
+
+lightcell = int(diffuseProductPositive * 2.0);
+hardShadow += float(lightcell);
+
+color.rgb += myhalf(0.6 + hardShadow * 0.3333333333 * 0.27 + diffuseProductPositive * 0.14);
+
+// backlight
+lightcell = int (diffuseProductNegative * 2.0);
+color.rgb += myhalf (float(lightcell) * 0.085 + diffuseProductNegative * 0.085);
+#else
+color.rgb += LightDiffuse.rgb * myhalf(max (diffuseProduct, 0.0)) + LightAmbient.rgb;
+#endif
+
+#endif
+
+// deluxemapping using light vectors in modelspace
+
+#ifdef APPLY_LIGHTSTYLE0
+
+// get light normal
+diffuseNormalModelspace = myhalf3 (texture2D(LightmapTexture0, vec2(LightmapTexCoord01.s+DeluxemapOffset0,LightmapTexCoord01.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+// calculate directional shading
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+
+#ifdef APPLY_FBLIGHTMAP
+weightedDiffuseNormal = diffuseNormal;
+// apply lightmap color
+color.rgb += myhalf3 (max (diffuseProduct, 0.0) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st)));
+#else
+
+#define NORMALIZE_DIFFUSE_NORMAL
+
+weightedDiffuseNormal = lsColor0 * diffuseNormal;
+// apply lightmap color
+color.rgb += lsColor0 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture0, LightmapTexCoord01.st));
+#endif
+
+#ifdef APPLY_AMBIENT_COMPENSATION
+// compensate for ambient lighting
+color.rgb += myhalf((1.0 - max (diffuseProduct, 0.0))) * LightAmbient;
+#endif
+
+#ifdef APPLY_LIGHTSTYLE1
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture1, vec2(LightmapTexCoord01.p+DeluxemapOffset1,LightmapTexCoord01.q))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor1 * diffuseNormal;
+color.rgb += lsColor1 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture1, LightmapTexCoord01.pq));
+
+#ifdef APPLY_LIGHTSTYLE2
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture2, vec2(LightmapTexCoord23.s+DeluxemapOffset2,LightmapTexCoord23.t))) - myhalf3 (0.5);
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor2 * diffuseNormal;
+color.rgb += lsColor2 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture2, LightmapTexCoord23.st));
+
+#ifdef APPLY_LIGHTSTYLE3
+diffuseNormalModelspace = myhalf3 (texture2D (LightmapTexture3, vec2(LightmapTexCoord23.p+DeluxemapOffset3,LightmapTexCoord23.q))) - myhalf3 (0.5);;
+diffuseNormal = normalize (myhalf3(dot(diffuseNormalModelspace,myhalf3(strMatrix[0])),dot(diffuseNormalModelspace,myhalf3(strMatrix[1])),dot(diffuseNormalModelspace,myhalf3(strMatrix[2]))));
+diffuseProduct = float (dot (surfaceNormal, diffuseNormal));
+weightedDiffuseNormal += lsColor3 * diffuseNormal;
+color.rgb += lsColor3 * myhalf(max (diffuseProduct, 0.0)) * myhalf3 (texture2D (LightmapTexture3, LightmapTexCoord23.pq));
+
+#endif
+#endif
+#endif
+#endif
+
+#ifdef APPLY_SPECULAR
+
+#ifdef NORMALIZE_DIFFUSE_NORMAL
+specularNormal = normalize (myhalf3 (normalize (weightedDiffuseNormal)) + myhalf3 (normalize (EyeVector)));
+#else
+specularNormal = normalize (weightedDiffuseNormal + myhalf3 (normalize (EyeVector)));
+#endif
+
+specularProduct = float (dot (surfaceNormal, specularNormal));
+color.rgb += (myhalf3(texture2D(GlossTexture, TexCoord)) * GlossIntensity) * pow(myhalf(max(specularProduct, 0.0)), GlossExponent);
+#endif
+
+#ifdef APPLY_BASETEX_ALPHA_ONLY
+color = min(color, myhalf4(texture2D(BaseTexture, TexCoord).a));
+#else
+#ifdef APPLY_COLOR_CLAMPING
+color = min(color, myhalf4(1.0));
+#endif
+color = color * myhalf4(texture2D(BaseTexture, TexCoord));
+#endif
+
+#ifdef APPLY_DECAL
+#ifdef APPLY_DECAL_ADD
+myhalf3 decal = myhalf3(gl_Color.rgb) * myhalf3(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb + color.rgb;
+color.a = color.a * myhalf(gl_Color.a);
+#else
+myhalf4 decal = myhalf4(gl_Color.rgba);
+if (decal.a > 0.0)
+{
+decal = decal * myhalf4(texture2D(DecalTexture, TexCoord));
+color.rgb = decal.rgb * decal.a + color.rgb * (1.0-decal.a);
+}
+#endif
+#else
+color = color * myhalf4(gl_Color.rgba);
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),color.a);
+#else
+gl_FragColor = vec4(color);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/6.frag b/shaders/warsow/6.frag
new file mode 100644
index 0000000..af536af
--- /dev/null
+++ b/shaders/warsow/6.frag
@@ -0,0 +1,151 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec4 TexCoord;
+varying vec4 ProjVector;
+#ifdef APPLY_EYEDOT
+varying vec3 EyeVector;
+#endif
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+#ifdef APPLY_EYEDOT
+uniform vec3 EyeOrigin;
+uniform float FrontPlane;
+#endif
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+mat4 textureMatrix;
+
+textureMatrix = gl_TextureMatrix[0];
+TexCoord.st = vec2 (textureMatrix * gl_MultiTexCoord0);
+
+textureMatrix = gl_TextureMatrix[0];
+textureMatrix[0] = -textureMatrix[0];
+textureMatrix[1] = -textureMatrix[1];
+TexCoord.pq = vec2 (textureMatrix * gl_MultiTexCoord0);
+
+#ifdef APPLY_EYEDOT
+mat3 strMatrix;
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+vec3 EyeVectorWorld = (EyeOrigin - gl_Vertex.xyz) * FrontPlane;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+gl_Position = ftransform();
+ProjVector = gl_Position;
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_DUDV
+uniform sampler2D DuDvMapTexture;
+#endif
+
+#ifdef APPLY_EYEDOT
+uniform sampler2D NormalmapTexture;
+#endif
+uniform sampler2D ReflectionTexture;
+uniform sampler2D RefractionTexture;
+uniform float TextureWidth, TextureHeight;
+
+void main(void)
+{
+myhalf3 color;
+
+#ifdef APPLY_DUDV
+vec3 displacement = vec3(texture2D(DuDvMapTexture, vec2(TexCoord.pq) * vec2(0.25)));
+vec2 coord = vec2(TexCoord.st) + vec2(displacement) * vec2 (0.2);
+
+vec3 fdist = vec3 (normalize(vec3(texture2D(DuDvMapTexture, coord)) - vec3 (0.5))) * vec3(0.005);
+#else
+vec3 fdist = vec3(0.0);
+#endif
+
+// get projective texcoords
+float scale = float(1.0 / float(ProjVector.w));
+float inv2NW = 1.0 / (2.0 * float (TextureWidth));
+float inv2NH = 1.0 / (2.0 * float (TextureHeight));
+vec2 projCoord = (vec2(ProjVector.xy) * scale + vec2 (1.0)) * vec2 (0.5) + vec2(fdist.xy);
+projCoord.s = float (clamp (float(projCoord.s), inv2NW, 1.0 - inv2NW));
+projCoord.t = float (clamp (float(projCoord.t), inv2NH, 1.0 - inv2NH));
+
+
+myhalf3 refr = myhalf3(0.0);
+myhalf3 refl = myhalf3(0.0);
+
+#ifdef APPLY_EYEDOT
+// calculate dot product between the surface normal and eye vector
+// great for simulating varying water translucency based on the view angle
+myhalf3 surfaceNormal = normalize(myhalf3(texture2D(NormalmapTexture, coord)) - myhalf3 (0.5));
+vec3 eyeNormal = normalize(myhalf3(EyeVector));
+
+float refrdot = float(dot(surfaceNormal, eyeNormal));
+//refrdot = float (clamp (refrdot, 0.0, 1.0));
+float refldot = 1.0 - refrdot;
+// get refraction and reflection
+
+#ifdef APPLY_REFRACTION
+refr = (myhalf3(texture2D(RefractionTexture, projCoord))) * refrdot;
+#endif
+#ifdef APPLY_REFLECTION
+refl = (myhalf3(texture2D(ReflectionTexture, projCoord))) * refldot;
+#endif
+
+#else
+
+#ifdef APPLY_REFRACTION
+refr = (myhalf3(texture2D(RefractionTexture, projCoord)));
+#endif
+#ifdef APPLY_REFLECTION
+refl = (myhalf3(texture2D(ReflectionTexture, projCoord)));
+#endif
+
+#endif
+
+// add reflection and refraction
+#ifdef APPLY_DISTORTION_ALPHA
+color = myhalf3(gl_Color.rgb) + myhalf3(mix (refr, refl, float(gl_Color.a)));
+#else
+color = myhalf3(gl_Color.rgb) + refr + refl;
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),1.0);
+#else
+gl_FragColor = vec4(vec3(color),1.0);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/6.vert b/shaders/warsow/6.vert
new file mode 100644
index 0000000..6ee1e1e
--- /dev/null
+++ b/shaders/warsow/6.vert
@@ -0,0 +1,151 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec4 TexCoord;
+varying vec4 ProjVector;
+#ifdef APPLY_EYEDOT
+varying vec3 EyeVector;
+#endif
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+#ifdef APPLY_EYEDOT
+uniform vec3 EyeOrigin;
+uniform float FrontPlane;
+#endif
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+mat4 textureMatrix;
+
+textureMatrix = gl_TextureMatrix[0];
+TexCoord.st = vec2 (textureMatrix * gl_MultiTexCoord0);
+
+textureMatrix = gl_TextureMatrix[0];
+textureMatrix[0] = -textureMatrix[0];
+textureMatrix[1] = -textureMatrix[1];
+TexCoord.pq = vec2 (textureMatrix * gl_MultiTexCoord0);
+
+#ifdef APPLY_EYEDOT
+mat3 strMatrix;
+strMatrix[0] = gl_MultiTexCoord1.xyz;
+strMatrix[2] = gl_Normal.xyz;
+strMatrix[1] = gl_MultiTexCoord1.w * cross (strMatrix[2], strMatrix[0]);
+
+vec3 EyeVectorWorld = (EyeOrigin - gl_Vertex.xyz) * FrontPlane;
+EyeVector = EyeVectorWorld * strMatrix;
+#endif
+
+gl_Position = ftransform();
+ProjVector = gl_Position;
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+#ifdef APPLY_DUDV
+uniform sampler2D DuDvMapTexture;
+#endif
+
+#ifdef APPLY_EYEDOT
+uniform sampler2D NormalmapTexture;
+#endif
+uniform sampler2D ReflectionTexture;
+uniform sampler2D RefractionTexture;
+uniform float TextureWidth, TextureHeight;
+
+void main(void)
+{
+myhalf3 color;
+
+#ifdef APPLY_DUDV
+vec3 displacement = vec3(texture2D(DuDvMapTexture, vec2(TexCoord.pq) * vec2(0.25)));
+vec2 coord = vec2(TexCoord.st) + vec2(displacement) * vec2 (0.2);
+
+vec3 fdist = vec3 (normalize(vec3(texture2D(DuDvMapTexture, coord)) - vec3 (0.5))) * vec3(0.005);
+#else
+vec3 fdist = vec3(0.0);
+#endif
+
+// get projective texcoords
+float scale = float(1.0 / float(ProjVector.w));
+float inv2NW = 1.0 / (2.0 * float (TextureWidth));
+float inv2NH = 1.0 / (2.0 * float (TextureHeight));
+vec2 projCoord = (vec2(ProjVector.xy) * scale + vec2 (1.0)) * vec2 (0.5) + vec2(fdist.xy);
+projCoord.s = float (clamp (float(projCoord.s), inv2NW, 1.0 - inv2NW));
+projCoord.t = float (clamp (float(projCoord.t), inv2NH, 1.0 - inv2NH));
+
+
+myhalf3 refr = myhalf3(0.0);
+myhalf3 refl = myhalf3(0.0);
+
+#ifdef APPLY_EYEDOT
+// calculate dot product between the surface normal and eye vector
+// great for simulating varying water translucency based on the view angle
+myhalf3 surfaceNormal = normalize(myhalf3(texture2D(NormalmapTexture, coord)) - myhalf3 (0.5));
+vec3 eyeNormal = normalize(myhalf3(EyeVector));
+
+float refrdot = float(dot(surfaceNormal, eyeNormal));
+//refrdot = float (clamp (refrdot, 0.0, 1.0));
+float refldot = 1.0 - refrdot;
+// get refraction and reflection
+
+#ifdef APPLY_REFRACTION
+refr = (myhalf3(texture2D(RefractionTexture, projCoord))) * refrdot;
+#endif
+#ifdef APPLY_REFLECTION
+refl = (myhalf3(texture2D(ReflectionTexture, projCoord))) * refldot;
+#endif
+
+#else
+
+#ifdef APPLY_REFRACTION
+refr = (myhalf3(texture2D(RefractionTexture, projCoord)));
+#endif
+#ifdef APPLY_REFLECTION
+refl = (myhalf3(texture2D(ReflectionTexture, projCoord)));
+#endif
+
+#endif
+
+// add reflection and refraction
+#ifdef APPLY_DISTORTION_ALPHA
+color = myhalf3(gl_Color.rgb) + myhalf3(mix (refr, refl, float(gl_Color.a)));
+#else
+color = myhalf3(gl_Color.rgb) + refr + refl;
+#endif
+
+#ifdef APPLY_GRAYSCALE
+float grey = dot(color, myhalf3(0.299, 0.587, 0.114));
+gl_FragColor = vec4(vec3(grey),1.0);
+#else
+gl_FragColor = vec4(vec3(color),1.0);
+#endif
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/7.frag b/shaders/warsow/7.frag
new file mode 100644
index 0000000..d917740
--- /dev/null
+++ b/shaders/warsow/7.frag
@@ -0,0 +1,110 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec4 ProjVector;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+
+mat4 textureMatrix;
+
+textureMatrix = gl_TextureMatrix[0];
+
+gl_Position = ftransform();
+ProjVector = textureMatrix * gl_Vertex;
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform myhalf3 LightAmbient;
+
+uniform float TextureWidth, TextureHeight;
+uniform float ProjDistance;
+uniform sampler2DShadow ShadowmapTexture;
+
+void main(void)
+{
+myhalf color = myhalf(1.0);
+
+if (ProjVector.w <= 0.0 || ProjVector.w >= ProjDistance)
+discard;
+
+float dtW = 1.0 / TextureWidth;
+float dtH = 1.0 / TextureHeight;
+
+vec3 coord = vec3 (ProjVector.xyz / ProjVector.w);
+coord = (coord + vec3 (1.0)) * vec3 (0.5);
+coord.s = float (clamp (float(coord.s), dtW, 1.0 - dtW));
+coord.t = float (clamp (float(coord.t), dtH, 1.0 - dtH));
+coord.r = float (clamp (float(coord.r), 0.0, 1.0));
+
+myhalf shadow0 = myhalf(shadow2D(ShadowmapTexture, coord).r);
+myhalf shadow = shadow0;
+
+#if defined(APPLY_PCF2x2) || defined(APPLY_PCF3x3)
+
+vec3 coord2 = coord + vec3(0.0, dtH, 0.0);
+myhalf shadow1 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, dtH, 0.0);
+myhalf shadow2 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, 0.0, 0.0);
+myhalf shadow3 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+#if defined(APPLY_PCF3x3)
+coord2 = coord + vec3(-dtW, 0.0, 0.0);
+myhalf shadow4 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(-dtW, -dtH, 0.0);
+myhalf shadow5 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(0.0, -dtH, 0.0);
+myhalf shadow6 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, -dtH, 0.0);
+myhalf shadow7 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(-dtW, dtH, 0.0);
+myhalf shadow8 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+shadow = (shadow0 + shadow1 + shadow2 + shadow3 + shadow4 + shadow5 + shadow6 + shadow7 + shadow8) * myhalf(0.11);
+#else
+shadow = (shadow0 + shadow1 + shadow2 + shadow3) * myhalf(0.25);
+#endif
+#else
+shadow = shadow0;
+#endif
+
+float attenuation = float (ProjVector.w) / ProjDistance;
+myhalf compensation = myhalf(0.25) - max(LightAmbient.x, max(LightAmbient.y, LightAmbient.z))
+;compensation = max (compensation, 0.0);
+color = shadow + attenuation + compensation;
+
+gl_FragColor = vec4(vec3(color),1.0);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/7.vert b/shaders/warsow/7.vert
new file mode 100644
index 0000000..f5a1571
--- /dev/null
+++ b/shaders/warsow/7.vert
@@ -0,0 +1,110 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+varying vec4 ProjVector;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+
+mat4 textureMatrix;
+
+textureMatrix = gl_TextureMatrix[0];
+
+gl_Position = ftransform();
+ProjVector = textureMatrix * gl_Vertex;
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform myhalf3 LightAmbient;
+
+uniform float TextureWidth, TextureHeight;
+uniform float ProjDistance;
+uniform sampler2DShadow ShadowmapTexture;
+
+void main(void)
+{
+myhalf color = myhalf(1.0);
+
+if (ProjVector.w <= 0.0 || ProjVector.w >= ProjDistance)
+discard;
+
+float dtW = 1.0 / TextureWidth;
+float dtH = 1.0 / TextureHeight;
+
+vec3 coord = vec3 (ProjVector.xyz / ProjVector.w);
+coord = (coord + vec3 (1.0)) * vec3 (0.5);
+coord.s = float (clamp (float(coord.s), dtW, 1.0 - dtW));
+coord.t = float (clamp (float(coord.t), dtH, 1.0 - dtH));
+coord.r = float (clamp (float(coord.r), 0.0, 1.0));
+
+myhalf shadow0 = myhalf(shadow2D(ShadowmapTexture, coord).r);
+myhalf shadow = shadow0;
+
+#if defined(APPLY_PCF2x2) || defined(APPLY_PCF3x3)
+
+vec3 coord2 = coord + vec3(0.0, dtH, 0.0);
+myhalf shadow1 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, dtH, 0.0);
+myhalf shadow2 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, 0.0, 0.0);
+myhalf shadow3 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+#if defined(APPLY_PCF3x3)
+coord2 = coord + vec3(-dtW, 0.0, 0.0);
+myhalf shadow4 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(-dtW, -dtH, 0.0);
+myhalf shadow5 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(0.0, -dtH, 0.0);
+myhalf shadow6 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(dtW, -dtH, 0.0);
+myhalf shadow7 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+coord2 = coord + vec3(-dtW, dtH, 0.0);
+myhalf shadow8 = myhalf (shadow2D (ShadowmapTexture, coord2).r);
+
+shadow = (shadow0 + shadow1 + shadow2 + shadow3 + shadow4 + shadow5 + shadow6 + shadow7 + shadow8) * myhalf(0.11);
+#else
+shadow = (shadow0 + shadow1 + shadow2 + shadow3) * myhalf(0.25);
+#endif
+#else
+shadow = shadow0;
+#endif
+
+float attenuation = float (ProjVector.w) / ProjDistance;
+myhalf compensation = myhalf(0.25) - max(LightAmbient.x, max(LightAmbient.y, LightAmbient.z))
+;compensation = max (compensation, 0.0);
+color = shadow + attenuation + compensation;
+
+gl_FragColor = vec4(vec3(color),1.0);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/8.frag b/shaders/warsow/8.frag
new file mode 100644
index 0000000..0e60fc6
--- /dev/null
+++ b/shaders/warsow/8.frag
@@ -0,0 +1,49 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+
+varying vec4 ProjVector;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform float OutlineHeight;
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+vec4 n = vec4(gl_Normal.xyz, 0.0);
+vec4 v = vec4(gl_Vertex) + n * OutlineHeight;
+
+gl_Position = gl_ModelViewProjectionMatrix * v;
+ProjVector = gl_Position;
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * v;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform float OutlineCutOff;
+
+void main(void)
+{
+
+#ifdef APPLY_OUTLINES_CUTOFF
+if (OutlineCutOff > 0.0 && (ProjVector.w > OutlineCutOff))
+discard;
+#endif
+
+gl_FragColor = vec4 (gl_Color);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/8.vert b/shaders/warsow/8.vert
new file mode 100644
index 0000000..368238c
--- /dev/null
+++ b/shaders/warsow/8.vert
@@ -0,0 +1,49 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+
+varying vec4 ProjVector;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform float OutlineHeight;
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+vec4 n = vec4(gl_Normal.xyz, 0.0);
+vec4 v = vec4(gl_Vertex) + n * OutlineHeight;
+
+gl_Position = gl_ModelViewProjectionMatrix * v;
+ProjVector = gl_Position;
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * v;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform float OutlineCutOff;
+
+void main(void)
+{
+
+#ifdef APPLY_OUTLINES_CUTOFF
+if (OutlineCutOff > 0.0 && (ProjVector.w > OutlineCutOff))
+discard;
+#endif
+
+gl_FragColor = vec4 (gl_Color);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/9.frag b/shaders/warsow/9.frag
new file mode 100644
index 0000000..f9d9ae2
--- /dev/null
+++ b/shaders/warsow/9.frag
@@ -0,0 +1,63 @@
+#define FRAGMENT_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+#define M_TWOPI 6.28318530717958647692
+
+varying vec2 TexCoord;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform float TurbAmplitude, TurbPhase;
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+vec4 turb;
+turb = vec4(gl_MultiTexCoord0);
+turb.s += TurbAmplitude * sin( ((gl_MultiTexCoord0.t / 4.0 + TurbPhase)) * M_TWOPI );
+turb.t += TurbAmplitude * sin( ((gl_MultiTexCoord0.s / 4.0 + TurbPhase)) * M_TWOPI );
+TexCoord = vec2(gl_TextureMatrix[0] * turb);
+
+gl_Position = ftransform();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform sampler2D BaseTexture;
+
+void main(void)
+{
+
+myhalf4 color;
+
+color = myhalf4(gl_Color) * myhalf4(texture2D(BaseTexture, TexCoord));
+
+gl_FragColor = vec4(color);
+}
+
+#endif // FRAGMENT_SHADER
+
+
diff --git a/shaders/warsow/9.vert b/shaders/warsow/9.vert
new file mode 100644
index 0000000..27e76e5
--- /dev/null
+++ b/shaders/warsow/9.vert
@@ -0,0 +1,63 @@
+#define VERTEX_SHADER
+// Warsow GLSL shader
+
+#if !defined(__GLSL_CG_DATA_TYPES)
+#define myhalf float
+#define myhalf2 vec2
+#define myhalf3 vec3
+#define myhalf4 vec4
+#else
+#define myhalf half
+#define myhalf2 half2
+#define myhalf3 half3
+#define myhalf4 half4
+#endif
+
+#define M_TWOPI 6.28318530717958647692
+
+varying vec2 TexCoord;
+
+#ifdef VERTEX_SHADER
+// Vertex shader
+
+uniform float TurbAmplitude, TurbPhase;
+
+void main(void)
+{
+gl_FrontColor = gl_Color;
+
+vec4 turb;
+turb = vec4(gl_MultiTexCoord0);
+turb.s += TurbAmplitude * sin( ((gl_MultiTexCoord0.t / 4.0 + TurbPhase)) * M_TWOPI );
+turb.t += TurbAmplitude * sin( ((gl_MultiTexCoord0.s / 4.0 + TurbPhase)) * M_TWOPI );
+TexCoord = vec2(gl_TextureMatrix[0] * turb);
+
+gl_Position = ftransform();
+#ifdef APPLY_CLIPPING
+#ifdef __GLSL_CG_DATA_TYPES
+gl_ClipVertex = gl_ModelViewMatrix * gl_Vertex;
+#endif
+#endif
+}
+
+#endif // VERTEX_SHADER
+
+
+#ifdef FRAGMENT_SHADER
+// Fragment shader
+
+uniform sampler2D BaseTexture;
+
+void main(void)
+{
+
+myhalf4 color;
+
+color = myhalf4(gl_Color) * myhalf4(texture2D(BaseTexture, TexCoord));
+
+gl_FragColor = vec4(color);
+}
+
+#endif // FRAGMENT_SHADER
+
+