// Default settings for maps, executed each time the map is loaded.
-if (strcmp $skybox "") [
- skybox "skyboxes/black"
-]
-
-materialreset
-
-texture water "materials/water.png" 0 0 0 0.5
-texture 1 "materials/waterfall.png" 0 0 0 0.5
-texture 1 "materials/water_n.png" 0 0 0 0.5
-texture 1 "materials/water_dudv.png" 0 0 0 0.5
-texture 1 "materials/waterfall_n.png" 0 0 0 0.5
-texture 1 "materials/waterfall_dudv.png" 0 0 0 0.5
-
-texture lava "materials/lava.png" 0 0 0 0.5
-texture 1 "materials/lava.png" 0 0 0 0.5
-
texturereset
setshader "stdworld"
// these default settings get executed whenever "config.cfg" is not available
// do not modify anything below, instead change settings in game, or add to autoexec.cfg
-name "unnamed"
+name "Anonymous"
invmouse 0 // 1 for flightsim mode
sensitivity 3 // similar number to quake
editbind LSHIFT [ editcut ]
editbindmod LCTRL [ passthrough ]
-editbindmod LALT [ hmapedit ]
editbind DELETE [ editdel ]
editbind T [ saycommand ]
editbind Z [ undo; passthroughsel 0]
editbind U [ undo; passthroughsel 0]
editbind I [ redo ]
-editbind H [ if $hmapedit [ editface 1 -1 ] [ hmapedit 1 ] ]
editbind O [ domodifier 15 ] // vSlot: offset H
editbind P [ domodifier 16 ] // vSlot: offset V
delta_edit_4 = [ if $blendpaintmode [rotateblendbrush $arg1] [editrotate $arg1] ] // rotate 90 degrees
delta_edit_5 = [ entproperty 0 $arg1 ] // and the others
delta_edit_6 = [ edittex $arg1 ] // change textures
-delta_edit_9 = [ selectbrush $arg1 ] // change heightmap brushes
delta_edit_10 = [ entautoview $arg1 ]
editbind 1 [ domodifier 11 ]
// fps specific cfg stuff goes here
togglezoom = [ zoom (if (= $zoom 1) -1 1) ]
+
sayteamcommand = [inputcommand (if (>= $numargs 1) [result $arg1] [result ""]) [sayteam $commandbuf] "[team]"]
mapcomplete = [ complete $arg1 packages/maps ogz ]
+
mapcomplete map
modenames = "ffa coop teamplay insta instateam effic efficteam"
+
loop i (listlen $modenames) [
- mname = (at $modenames $i)
- alias $mname [ if (mode @i) [if (> $numargs 0) [map $arg1] [map]] ]
- mapcomplete $mname
+ mname = (at $modenames $i)
+ alias $mname [ if (mode @i) [if (> $numargs 0) [map $arg1] [map]] ]
+ mapcomplete $mname
]
demo = [ stopdemo; if (mode -1) [if (> $numargs 0) [map $arg1] [map]] ]
+
varcomplete demo demodir dmo
playermodelnum = 1
-playermodeldir0 = "mrfixit"
-playermodelicon0 = "mrfixit"
-playermodelname0 = "Mr. Fixit"
+playermodeldir0 = "mrfixit"
+playermodelicon0 = "mrfixit"
+playermodelname0 = "Mr. Fixit"
playermodelstory0 = [Which orc do you choose when the mission calls for an all-purpose wrecking machine? Who do you call when the odds are stacked against you? Mr. Fixit, that's who. Gifted with the ability to perform deconstructive surgery with any weapon, this orc gets the job done fast and with extreme prejudice.]
-playermodeldir = [getalias (concatword "playermodeldir" (if (> $numargs 0) [result $arg1] [result $playermodel]))]
-playermodelicon = [getalias (concatword "playermodelicon" (if (> $numargs 0) [result $arg1] [result $playermodel]))]
-playermodelname = [getalias (concatword "playermodelname" (if (> $numargs 0) [result $arg1] [result $playermodel]))]
+playermodeldir = [getalias (concatword "playermodeldir" (if (> $numargs 0) [result $arg1] [result $playermodel]))]
+playermodelicon = [getalias (concatword "playermodelicon" (if (> $numargs 0) [result $arg1] [result $playermodel]))]
+playermodelname = [getalias (concatword "playermodelname" (if (> $numargs 0) [result $arg1] [result $playermodel]))]
playermodelstory = [getalias (concatword "playermodelstory" (if (> $numargs 0) [result $arg1] [result $playermodel]))]
playsong = [ music (concatword "music/1.ogg") playsong ]
shader 0 "null" [
attribute vec4 vvertex;
void main(void)
- {
+ {
gl_Position = vvertex;
}
] [
- void main(void)
+ void main(void)
{
gl_FragColor = vec4(1.0, 0.0, 1.0, 1.0);
}
}
]
-//////////////////////////////////////////////////////////////////////
-//
-// fogged variants of default shaders
-//
-//////////////////////////////////////////////////////////////////////
-
-shader 0 "fogged" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec2 vtexcoord0;
- uniform mat4 camprojmatrix;
- varying vec2 texcoord0;
- varying vec4 color;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- texcoord0 = vtexcoord0;
- color = vcolor;
- }
-] [
- varying vec2 texcoord0;
- varying vec4 color;
- uniform sampler2D tex0;
- void main(void)
- {
- gl_FragColor = color * texture2D(tex0, texcoord0);
- }
-]
-
-shader 0 "foggednotexture" [
- //:fog
- attribute vec4 vvertex, vcolor;
- uniform mat4 camprojmatrix;
- varying vec4 color;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- }
-] [
- varying vec4 color;
- void main(void)
- {
- gl_FragColor = color;
- }
-]
-
-shader 0 "fogoverlay" [
- attribute vec4 vvertex, vcolor;
- varying vec4 color;
- void main(void)
- {
- gl_Position = vvertex;
- color = vcolor;
- }
-] [
- varying vec4 color;
- void main(void)
- {
- gl_FragColor = color;
- }
-]
-
//////////////////////////////////////////////////////////////////////
//
// for filling the z-buffer only (i.e. multi-pass rendering, OQ)
shader 0 "nocolor" [
attribute vec4 vvertex;
uniform mat4 camprojmatrix;
- void main() { gl_Position = camprojmatrix * vvertex; }
+ void main() { gl_Position = camprojmatrix * vvertex; }
] [
void main() {}
]
diffuse.rgb *= diffuse.a;
//:fog fogcolor * diffuse.a
] [
- vec4 diffuse = vec4(texture2D(diffusemap, texcoord0).rgb, 1.0);
+ vec4 diffuse = vec4(texture2D(diffusemap, texcoord0).rgb, 1.0);
])
vec4 lm = texture2D(lightmap, texcoord1);
]
]
-glareworldshader = [
- variantshader (if (< (strstr $arg1 "env") 0) 4 6) $arg1 4 [
- //:fog
- @(if (>= $numargs 4) [result $arg4])
- attribute vec4 vvertex;
- attribute vec3 vnormal;
- attribute vec2 vtexcoord0, vtexcoord1;
- uniform mat4 camprojmatrix;
- uniform vec2 texgenscroll;
- varying vec2 texcoord0, texcoord1;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- texcoord0 = vtexcoord0 + texgenscroll;
- texcoord1 = vtexcoord1 * @lmcoordscale;
-
- @arg2
- }
- ] [
- @(if (>= $numargs 4) [result $arg4])
- @(if (>= $numargs 5) [result $arg5])
- uniform vec4 colorparams;
- varying vec2 texcoord0, texcoord1;
- void main(void)
- {
- @arg3
- }
- ]
-]
-
worldshader "stdworld" [] []
worldshader "alphaworld" [] []
glareworldshader @arg1 [] [
vec3 glow = texture2D(glowmap, texcoord0).rgb;
glow *= glowcolor.rgb;
- float k = max(glow.r, max(glow.g, glow.b));
+ float k = max(glow.r, max(glow.g, glow.b));
gl_FragColor.rgb = min(k*k*32.0, 1.0) * glow;
- gl_FragColor.a =
+ gl_FragColor.a =
//:variantoverride texture2D(lightmap, texcoord1).a
colorparams.a
;
] [] [
- uniform sampler2D glowmap;
+ uniform sampler2D glowmap;
//:variant uniform sampler2D lightmap;
]
]
defershader 0 "pulseworld" [
defuniformparam "pulsespeed" 1 // pulse frequency (Hz)
worldshader "pulseworld" [
- pulse = abs(fract(millis * pulsespeed.x)*2.0 - 1.0);
+ pulse = abs(fract(millis * pulsespeed.x)*2.0 - 1.0);
] [
- vec3 diffuse2 = texture2D(decal, texcoord0).rgb;
+ vec3 diffuse2 = texture2D(decal, texcoord0).rgb;
diffuse.rgb = mix(diffuse.rgb, diffuse2, pulse);
] [] [uniform float millis; varying float pulse;] [uniform sampler2D decal;]
]
] [
vec3 glow = texture2D(glowmap, texcoord0).rgb;
glow *= pulse;
- float k = max(glow.r, max(glow.g, glow.b));
+ float k = max(glow.r, max(glow.g, glow.b));
gl_FragColor.rgb = min(k*k*32.0, 1.0) * glow;
- gl_FragColor.a =
+ gl_FragColor.a =
//:variantoverride texture2D(lightmap, texcoord1).a
colorparams.a
;
] [uniform float millis; varying vec3 pulse;] [
- uniform sampler2D glowmap;
+ uniform sampler2D glowmap;
//:variant uniform sampler2D lightmap;
]
]
pulseglowshader "pulseglowworld"
pulseglowshader "pulseglowalphaworld"
-shader 0 "fogworld" [
- //:water
- attribute vec4 vvertex;
- uniform mat4 camprojmatrix;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- }
-] [
- uniform vec3 fogcolor;
- void main(void)
- {
- gl_FragColor = vec4(fogcolor, 1.0);
- }
-]
-
shader 0 "noglareworld" [
attribute vec4 vvertex;
uniform mat4 camprojmatrix;
gl_FragColor.a = colorparams.a;
}
]
-
-defershader 2 "envworld" [
- defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
- worldshader "envworld" [
- normal = vnormal;
- camvec = camera - vvertex.xyz;
- ] [
- vec3 reflect = textureCube(envmap, 2.0*normal*dot(camvec, normal) - camvec).rgb;
- ] [
- diffuse *= lm;
- gl_FragColor.rgb = mix(diffuse.rgb, reflect, envscale.rgb);
- gl_FragColor.a = diffuse.a;
- ] [uniform vec3 camera; varying vec3 normal, camvec;] [uniform samplerCube envmap;]
-
- defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
- worldshader "envworldfast" [
- vec3 camvec = camera - vvertex.xyz;
- rvec = 2.0*vnormal*dot(camvec, vnormal) - camvec;
- ] [
- vec3 reflect = textureCube(envmap, rvec).rgb;
- ] [
- diffuse *= lm;
- gl_FragColor.rgb = mix(diffuse.rgb, reflect, envscale.rgb);
- gl_FragColor.a = diffuse.a;
- ] [uniform vec3 camera; varying vec3 rvec;] [uniform samplerCube envmap;]
-
- defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
- worldshader "envworldalt" [] []
-
- altshader envworld envworldalt
- fastshader envworld envworldfast 2
- fastshader envworld envworldalt 1
-]
shader 0 "depthfxworld" [
attribute vec4 vvertex;
]
// bumptype:
-// e -> reserve envmap texture slot
// o -> orthonormalize
// t -> tangent space cam
-// r -> envmap reflection
-// R -> modulate envmap reflection with spec map
// s -> spec
// S -> spec map
// p -> parallax
-// P -> steep parallax (7 steps)
// g -> glow
// G -> pulse glow
-// i -> glare intensity
// a -> alpha map
btopt = [ >= (strstr $bumptype $arg1) 0 ]
if (btopt "R") [
defuniformparam "envscale" 1 1 1 // reflectivity map multiplier
] [if (btopt "r") [
- defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
+ defuniformparam "envscale" 0.2 0.2 0.2 // reflectivity
]]
] [
if (btopt "s") [stype = (+ $stype 8)]
varying vec2 texcoord0, texcoord1;
@(if (|| (btopt "t") (btopt "r")) [result [uniform vec3 camera; varying vec3 camvec;]])
@(if (btopt "G") [result [uniform float millis; varying float pulse;]])
- @(if (btopt "r") [result [varying mat3 world;]])
+ @(if (btopt "r") [result [varying mat3 world;]])
void main(void)
{
gl_Position = camprojmatrix * vvertex;
// calculate tangent -> world transform
world = mat3(vtangent.xyz, bitangent, vnormal);
]])
- ]])
-
+ ]])
+
@(if (btopt "G") [result [
pulse = abs(fract(millis*pulseglowspeed.x)*2.0 - 1.0);
]])
height = texture2D(normalmap, htc.xy);
]])
#define dtc htc.xy
- #define bump height.xyz
+ #define bump height.xyz
]])
@(if (|| (btopt "p") (btopt "P")) [] [result [#define dtc texcoord0]])
if (&& (btopt "a") (btopt "S")) [result [
vec4 normal = texture2D(normalmap, dtc);
#define alpha normal.a
- #define bump normal.rgb
+ #define bump normal.rgb
]] [result [
vec3 bump = texture2D(normalmap, dtc).rgb;
]]
@(if (btopt "s") [result [
vec3 halfangle = normalize(camdir + lmlv);
float spec = pow(clamp(dot(halfangle, bump), 0.0, 1.0), @(? (btopt "i") "128.0" "32.0"));
- @(if (btopt "i") [result [spec = min(spec*64.0, 1.0);]])
+ @(if (btopt "i") [result [spec = min(spec*64.0, 1.0);]])
@(if (btopt "S") [result [spec *= diffuse.a;]])
@(if (btopt "i") [result [
@(? (btopt "S") "diffuse.rgb" "vec3 diffuse") = specscale.xyz*spec;
@(? (|| (btopt "g") (btopt "r")) "diffuse.rgb" "gl_FragColor.rgb") = diffuse.rgb * lmc.rgb;
]])
]])
-
+
@(if (btopt "r") [result [
vec3 rvec;
@(if (btopt "t") [result [
@(if (btopt "a") [result [
@(? (btopt "g") "diffuse.rgb" "gl_FragColor.rgb") *= alpha;
]])
-
+
@(if (btopt "g") [result [
vec3 glow = texture2D(glowmap, dtc).rgb;
@@(if (btopt "G") [result [
gl_FragColor.rgb = glow*k + diffuse.rgb;
]] [result [
gl_FragColor.rgb = glow*k;
- gl_FragColor.a =
+ gl_FragColor.a =
//:variantoverride texture2D(lmcolor, texcoord1).a
colorparams.a
;
fastshader bumpenvspecmapparallaxpulseglowworld bumpenvparallaxpulseglowworldalt 2
fastshader bumpenvspecmapparallaxpulseglowworld bumpenvpulseglowworldalt 1
-//bumpshader "steepworld" "Pot"
-
////////////////////////////////////////////////
//
// model shaders
skelanimdefs = [
skelanimlength = (min (- $maxvsuniforms (+ $reservevpparams 10)) $maxskelanimdata)
result [
- attribute vec4 vboneweight;
+ attribute vec4 vboneweight;
attribute vec4 vboneindex;
//:uniform animdata
uniform vec4 animdata[@@skelanimlength];
void main(void)
{
gl_Position = shadowmatrix * vvertex;
- shadowmapvals = vec4(0.0, 0.0, shadowmapbias.y - gl_Position.z, 0.0);
+ shadowmapvals = vec4(0.0, 0.0, shadowmapbias.y - gl_Position.z, 0.0);
}
] [
varying vec4 shadowmapvals;
]
// mdltype:
-// e -> envmap
// n -> normalmap
// s -> spec
// m -> masks
// b -> dual-quat skeletal animation
// a -> alpha-tested
// q -> qtangents
-// i -> glare intensity
mdlopt = [ >= (strstr $modeltype $arg1) 0 ]
]] [result [
attribute vec3 vnormal;
]])
- uniform mat4 modelmatrix;
+ uniform mat4 modelmatrix;
uniform vec3 modelcamera, lightdir, lightscale;
uniform vec2 texscroll;
varying vec2 texcoord0;
]] [result [
#define mpos vvertex
@(if (mdlopt "q") [result [
- #define mquat vtangent
+ #define mquat vtangent
@(qtangentdecode (mdlopt "n"))
]] [result [
#define mnormal vnormal
color = vcolor;
]])
texcoord0 = vtexcoord0 + texscroll;
-
+
@(if (|| (mdlopt "e") (mdlopt "s")) [result [
vec3 camdir = normalize(modelcamera - mpos.xyz);
]])
vec3 mbitangent = cross(mnormal, mtangent) * (vtangent.w < 0.0 ? -1.0 : 1.0);
lightvec = vec3(dot(lightdir, mtangent), dot(lightdir, mbitangent), dot(lightdir, mnormal));
@(if (mdlopt "s") [result [
- vec3 halfdir = lightdir + camdir;
+ vec3 halfdir = lightdir + camdir;
halfangle = vec3(dot(halfdir, mtangent), dot(halfdir, mbitangent), dot(halfdir, mnormal));
]])
]]
] [result [
@(if (mdlopt "s") [result [
- nvec = mnormal;
+ nvec = mnormal;
halfangle = lightdir + camdir;
]] [if (! (mdlopt "i")) [result [
float intensity = dot(mnormal, lightdir);
@(if (mdlopt "e") [result [
float invfresnel = dot(camdir, mnormal);
rvec = modelworld * (2.0*invfresnel*mnormal - camdir);
- rmod = envmapscale.x*max(invfresnel, 0.0) + envmapscale.y;
+ rmod = envmapscale.x*max(invfresnel, 0.0) + envmapscale.y;
]])
]])
}
- ]
+ ]
]
modelfragmentshader = [
texcoordp@(+ $i 2) = tcp;
texcoordn@(+ $i 2) = tcn;
]])
- }
+ }
] [
uniform float weights[8];
uniform float offsets[8];
]
]
-////////////////////////////////////////////////
-//
-// full screen shaders:
-//
-////////////////////////////////////////////////
-
-fsvs = [result [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- uniform vec2 postfxscale;
- varying vec2 texcoord0;
- @arg2
- void main(void)
- {
- gl_Position = vvertex; // woohoo, no mvp :)
- texcoord0 = vtexcoord0;
- @arg1
- }
-]]
-
-fsps = [result [
- uniform sampler2D tex0;
- varying vec2 texcoord0;
- @arg2
- void main(void)
- {
- vec4 color = texture2D(tex0, texcoord0);
- @arg1
- }
-]]
-
-fsvs4 = [
- fsvs [
- texcoord1 = vtexcoord0 + vec2(-1.5, -1.5)*postfxscale;
- texcoord2 = vtexcoord0 + vec2( 1.5, -1.5)*postfxscale;
- texcoord3 = vtexcoord0 + vec2(-1.5, 1.5)*postfxscale;
- texcoord4 = vtexcoord0 + vec2( 1.5, 1.5)*postfxscale;
- @arg1
- ] [
- varying vec2 texcoord1, texcoord2, texcoord3, texcoord4;
- ]
-]
-
-fsps4 = [
- fsps [
- vec4 s00 = texture2D(tex0, texcoord1);
- vec4 s02 = texture2D(tex0, texcoord2);
- vec4 s20 = texture2D(tex0, texcoord3);
- vec4 s22 = texture2D(tex0, texcoord4);
- @arg1
- ] [
- varying vec2 texcoord1, texcoord2, texcoord3, texcoord4;
- ]
-]
-
-// some simple ones that just do an effect on the RGB value...
-
-lazyshader 0 "invert" (fsvs) (fsps [gl_FragColor = 1.0 - color;])
-lazyshader 0 "gbr" (fsvs) (fsps [gl_FragColor = color.yzxw;])
-lazyshader 0 "bw" (fsvs) (fsps [gl_FragColor = vec4(dot(color.xyz, vec3(0.333)));])
-
-// sobel
-
-lazyshader 0 "sobel" (fsvs4) (fsps4 [
- vec4 t = s00 + s20 - s02 - s22;
- vec4 u = s00 + s02 - s20 - s22;
- gl_FragColor = color + t*t + u*u;
-])
-
-// rotoscope
-
-lazyshader 0 "rotoscope" [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- uniform vec2 postfxscale;
- uniform vec4 params;
- varying vec2 t11, t00, t12, t01, t20, t02, t21, t10, t22;
- void main(void)
- {
- gl_Position = vvertex;
- t11 = vtexcoord0;
- vec2 scale = postfxscale*params.x;
- t00 = vec2(-1.0, -1.0)*scale + vtexcoord0;
- t12 = vec2( 0.0, 1.0)*scale + vtexcoord0;
- t01 = vec2(-1.0, 0.0)*scale + vtexcoord0;
- t20 = vec2( 1.0, -1.0)*scale + vtexcoord0;
- t02 = vec2(-1.0, 1.0)*scale + vtexcoord0;
- t21 = vec2( 1.0, 0.0)*scale + vtexcoord0;
- t10 = vec2( 0.0, -1.0)*scale + vtexcoord0;
- t22 = vec2( 1.0, 1.0)*scale + vtexcoord0;
- }
-] [
- uniform sampler2D tex0;
- varying vec2 t11, t00, t12, t01, t20, t02, t21, t10, t22;
- void main(void)
- {
- vec4 c00 = texture2D(tex0, t00);
- vec4 c01 = texture2D(tex0, t01);
- vec4 c02 = texture2D(tex0, t02);
- vec4 c10 = texture2D(tex0, t10);
- vec4 c11 = texture2D(tex0, t11);
- vec4 c12 = texture2D(tex0, t12);
- vec4 c20 = texture2D(tex0, t20);
- vec4 c21 = texture2D(tex0, t21);
- vec4 c22 = texture2D(tex0, t22);
-
- vec4 diag1 = c00 - c22;
- vec4 diag2 = c02 - c20;
- vec4 xedge = (c01 - c21)*2.0 + diag1 + diag2;
- vec4 yedge = (c10 - c12)*2.0 + diag1 - diag2;
- xedge *= xedge;
- yedge *= yedge;
-
- vec4 xyedge = xedge + yedge;
- float sobel = step(max(xyedge.x, max(xyedge.y, xyedge.z)), 0.1);
-
- float hue = dot(c11.xyz, vec3(1.0));
- c11 /= hue;
- vec3 cc = step(vec3(0.2, 0.8, 1.5), vec3(hue));
- c11 *= dot(cc, vec3(0.5, 0.5, 1.5));
-
- gl_FragColor = c11 * max(cc.z, sobel);
- }
-]
-
blur3shader = [
- lazyshader 0 $arg1 [
+ lazyshader 0 $arg1 [
attribute vec4 vvertex;
@(screentexcoord 0)
uniform vec2 postfxscale;
}
] [
varying vec2 texcoord0, texcoord1;
- uniform sampler2D tex0;
+ uniform sampler2D tex0;
void main(void)
{
gl_FragColor = 0.5*(texture2D(tex0, texcoord0) + texture2D(tex0, texcoord1));
texcoord2 = vtexcoord0 + vec2(@(? $arg2 1.333 0.0), @(? $arg3 1.333 0.0))*postfxscale;
}
] [
- uniform sampler2D tex0;
+ uniform sampler2D tex0;
varying vec2 texcoord0, texcoord1, texcoord2;
void main(void)
{
gl_FragColor = 0.4*texture2D(tex0, texcoord0) + 0.3*(texture2D(tex0, texcoord1) + texture2D(tex0, texcoord2));
- }
+ }
]
]
blur5shader hblur5 1 0
blur5shader vblur5 0 1
-rotoscope = [
- clearpostfx
- if (>= $numargs 1) [addpostfx rotoscope 0 0 0 $arg1]
- if (>= $numargs 2) [
- if (= $arg2 1) [addpostfx hblur3; addpostfx vblur3]
- if (= $arg2 2) [addpostfx hblur5; addpostfx vblur5]
- ]
-]
-
-shader 0 "screenrect" [
- attribute vec4 vvertex, vcolor;
- @(screentexcoord 0)
- varying vec2 texcoord0;
- varying vec4 color;
- void main(void)
- {
- gl_Position = vvertex;
- texcoord0 = vtexcoord0;
- color = vcolor;
- }
-] [
- varying vec2 texcoord0;
- varying vec4 color;
- uniform sampler2D tex0;
- void main(void)
- {
- gl_FragColor = color * texture2D(tex0, texcoord0);
- }
-]
-
-// bloom-ish
-
-lazyshader 0 "bloom_scale" (fsvs4) (fsps4 [
- gl_FragColor = 0.2 * (s02 + s00 + s22 + s20 + color);
-])
-
-lazyshader 0 "bloom_init" (fsvs) (fsps [
- float t = max(color.r, max(color.g, color.b));
- gl_FragColor = t*t*color;
-])
-
-bloomshader = [
- defershader 0 $arg1 [
- forceshader "bloom_scale"
- forceshader "bloom_init"
- shader 0 @arg1 [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = vvertex;
- texcoord0 = vtexcoord0;
- }
- ] [
- uniform vec4 params;
- varying vec2 texcoord0;
- uniform sampler2D tex0 @@(loopconcat i $arg2 [result [, tex@(+ $i 1)]]);
- void main(void)
- {
- vec4 sample = texture2D(tex0, texcoord0);
- @@(loopconcat i $arg2 [result [
- @(? $i "bloom +=" "vec4 bloom =") texture2D(tex@(+ $i 1), texcoord0);
- ]])
- gl_FragColor = bloom*params.x + sample;
- }
- ]
- ]
-]
-
-bloomshader bloom1 1
-bloomshader bloom2 2
-bloomshader bloom3 3
-bloomshader bloom4 4
-bloomshader bloom5 5
-bloomshader bloom6 6
-
-setupbloom = [
- addpostfx bloom_init 1 1 "+0"
- loop i (- $arg1 1) [
- addpostfx bloom_scale (+ $i 2) (+ $i 2) (concatword "+" (+ $i 1))
- ]
- addpostfx (concatword bloom $arg1) 0 0 (loopconcat i (+ $arg1 1) [result $i]) $arg2
-]
-
-bloom = [
- clearpostfx
- if (>= $numargs 1) [setupbloom 6 $arg1]
-]
-
////////////////////////////////////////////////
//
-// miscellaneous effect shaders:
+// miscellaneous effect shaders:
//
////////////////////////////////////////////////
// wobbles the vertices of an explosion sphere
-// and generates all texcoords
+// and generates all texcoords
// and blends the edge color
// and modulates the texture
explosionshader = [
]])
color = vcolor;
-
+
texcoord0 = vtexcoord0;
vec2 texgen = vec2(dot(texgenS, vvertex.xyz), dot(texgenT, vvertex.xyz));
texcoord1 = texgen;
texcoord2 = 0.5*texgen - millis*0.5;
- }
- ] [
+ }
+ ] [
@(if (>= (strstr $arg1 "soft") 0) [result [
uniform sampler2D tex2;
]])
uniform vec2 blendparams;
varying vec4 color;
varying vec2 texcoord0, texcoord1, texcoord2;
- @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec4 texcoord3; ]])
+ @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec4 texcoord3; ]])
@(if (>= (strstr $arg1 "soft8") 0) [result [uniform vec4 depthfxselect;]])
void main(void)
{
diffuse.b += k*k;
]] [result [
diffuse *= blend*4.0; // dup alpha into RGB channels + intensify and over saturate
- diffuse.b += 0.5 - blend*0.5; // blue tint
+ diffuse.b += 0.5 - blend*0.5; // blue tint
]])
@(if (>= (strstr $arg1 "soft") 0) [result [
{
gl_Position = camprojmatrix * vvertex;
color = vcolor * colorscale;
- }
+ }
] [
varying vec4 color;
void main(void)
uniform vec4 colorscale;
varying vec2 texcoord0;
varying vec4 color;
- @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec3 texcoord1, surface; ]])
+ @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec3 texcoord1, surface; ]])
void main(void)
{
gl_Position = camprojmatrix * vvertex;
texcoord0 = vtexcoord0;
- color = vcolor * colorscale;
+ color = vcolor * colorscale;
@(if (>= (strstr $arg1 "soft") 0) [result [
texcoord1 = vec3(0.5*(gl_Position.xy + gl_Position.w), gl_Position.w);
uniform sampler2D tex0;
varying vec2 texcoord0;
varying vec4 color;
- @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec3 texcoord1, surface;]])
+ @(if (>= (strstr $arg1 "soft") 0) [result [uniform vec4 depthfxparams; varying vec3 texcoord1, surface;]])
@(if (>= (strstr $arg1 "soft8") 0) [result [uniform vec4 depthfxselect;]])
void main(void)
{
gl_FragColor = diffuse * color;
}
- ]
+ ]
]
looplist i ["" "soft" "soft8"] [
particleshader [particle@i]
]
-shader 0 "blendbrush" [
- attribute vec4 vvertex, vcolor;
- uniform mat4 camprojmatrix;
- uniform vec4 texgenS, texgenT;
- varying vec4 color;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- texcoord0 = vec2(dot(texgenS, vvertex), dot(texgenT, vvertex));
- }
-] [
- varying vec4 color;
- varying vec2 texcoord0;
- uniform sampler2D tex0;
- void main(void)
- {
- gl_FragColor = texture2D(tex0, texcoord0).r * color;
- }
-]
-
lazyshader 0 "prefab" [
attribute vec4 vvertex, vcolor;
attribute vec3 vnormal;
uniform mat4 prefabmatrix;
uniform mat3 prefabworld;
- varying vec4 color;
+ varying vec4 color;
void main(void)
{
color.rgb *= dot(prefabworld * vnormal, vec3(0.0, -0.447213595, 0.894427191));
}
] [
- varying vec4 color;
+ varying vec4 color;
void main(void)
{
gl_FragColor = color;
}
]
-lazyshader 0 "moviergb" [
- attribute vec4 vvertex;
- @(screentexcoord 0)
+shader 0 "overbrightdecal" [
+ attribute vec4 vvertex, vcolor;
+ attribute vec2 vtexcoord0;
+ uniform mat4 camprojmatrix;
+ varying vec4 color;
varying vec2 texcoord0;
void main(void)
{
- gl_Position = vvertex;
+ gl_Position = camprojmatrix * vvertex;
+ color = vcolor;
texcoord0 = vtexcoord0;
}
] [
+ varying vec4 color;
varying vec2 texcoord0;
uniform sampler2D tex0;
void main(void)
{
- gl_FragColor = texture2D(tex0, texcoord0);
+ vec4 diffuse = texture2D(tex0, texcoord0);
+ gl_FragColor = mix(color, diffuse, color.a);
}
]
-lazyshader 0 "movieyuv" [
- attribute vec4 vvertex;
- @(screentexcoord 0)
+shader 0 "saturatedecal" [
+ attribute vec4 vvertex, vcolor;
+ attribute vec2 vtexcoord0;
+ uniform mat4 camprojmatrix;
+ varying vec4 color;
varying vec2 texcoord0;
void main(void)
{
- gl_Position = vvertex;
+ gl_Position = camprojmatrix * vvertex;
+ color = vcolor;
texcoord0 = vtexcoord0;
}
] [
- varying vec2 texcoord0;
- uniform sampler2D tex0;
- void main(void)
- {
- vec3 sample = texture2D(tex0, texcoord0).rgb;
- gl_FragColor = vec4(dot(sample, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
- dot(sample, vec3(-0.148224, -0.290992, 0.439216)) + 0.501961,
- dot(sample, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
- 0.0);
- }
-]
-
-lazyshader 0 "moviey" [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- uniform vec2 moviescale;
- varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
- void main(void)
- {
- gl_Position = vvertex;
- texcoord0 = vtexcoord0 + vec2(-1.5, 0.0)*moviescale;
- texcoord1 = vtexcoord0 + vec2(-0.5, 0.0)*moviescale;
- texcoord2 = vtexcoord0 + vec2( 0.5, 0.0)*moviescale;
- texcoord3 = vtexcoord0 + vec2( 1.5, 0.0)*moviescale;
- }
-] [
- varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
- uniform sampler2D tex0;
- void main(void)
- {
- vec3 sample1 = texture2D(tex0, texcoord0).rgb;
- vec3 sample2 = texture2D(tex0, texcoord1).rgb;
- vec3 sample3 = texture2D(tex0, texcoord2).rgb;
- vec3 sample4 = texture2D(tex0, texcoord3).rgb;
- gl_FragColor = vec4(dot(sample3, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
- dot(sample2, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
- dot(sample1, vec3(0.256788, 0.504125, 0.097905)) + 0.062745,
- dot(sample4, vec3(0.256788, 0.504125, 0.097905)) + 0.062745);
- }
-]
-
-lazyshader 0 "movieu" [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- uniform vec2 moviescale;
- varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
- void main(void)
- {
- gl_Position = vvertex;
- texcoord0 = vtexcoord0 + vec2(-3.0, 0.0)*moviescale;
- texcoord1 = vtexcoord0 + vec2(-1.0, 0.0)*moviescale;
- texcoord2 = vtexcoord0 + vec2( 1.0, 0.0)*moviescale;
- texcoord3 = vtexcoord0 + vec2( 3.0, 0.0)*moviescale;
- }
-] [
- varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
- uniform sampler2D tex0;
- void main(void)
- {
- vec3 sample1 = texture2D(tex0, texcoord0).rgb;
- vec3 sample2 = texture2D(tex0, texcoord1).rgb;
- vec3 sample3 = texture2D(tex0, texcoord2).rgb;
- vec3 sample4 = texture2D(tex0, texcoord3).rgb;
- gl_FragColor = vec4(dot(sample3, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
- dot(sample2, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
- dot(sample1, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961,
- dot(sample4, vec3(-0.148224, -0.290992, 0.43921)) + 0.501961);
- }
-]
-
-lazyshader 0 "moviev" [
- attribute vec4 vvertex;
- @(screentexcoord 0)
- uniform vec2 moviescale;
- varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
- void main(void)
- {
- gl_Position = vvertex;
- texcoord0 = vtexcoord0 + vec2(-3.0, 0.0)*moviescale;
- texcoord1 = vtexcoord0 + vec2(-1.0, 0.0)*moviescale;
- texcoord2 = vtexcoord0 + vec2( 1.0, 0.0)*moviescale;
- texcoord3 = vtexcoord0 + vec2( 3.0, 0.0)*moviescale;
- }
-] [
- varying vec2 texcoord0, texcoord1, texcoord2, texcoord3;
- uniform sampler2D tex0;
- void main(void)
- {
- vec3 sample1 = texture2D(tex0, texcoord0).rgb;
- vec3 sample2 = texture2D(tex0, texcoord1).rgb;
- vec3 sample3 = texture2D(tex0, texcoord2).rgb;
- vec3 sample4 = texture2D(tex0, texcoord3).rgb;
- gl_FragColor = vec4(dot(sample3, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
- dot(sample2, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
- dot(sample1, vec3(0.439216, -0.367788, -0.071427)) + 0.501961,
- dot(sample4, vec3(0.439216, -0.367788, -0.071427)) + 0.501961);
- }
-]
-
-///////////////////////////////////////////////////
-//
-// reflective/refractive water shaders:
-//
-///////////////////////////////////////////////////
-
-watershader = [
- specular = $arg2
- rgbfog = $arg3
- distort = $arg4
- combine = $arg5
- lazyshader 0 $arg1 [
- attribute vec4 vvertex;
- attribute vec3 vcolor;
- uniform mat4 camprojmatrix;
- uniform vec3 camera;
- uniform mat4 watermatrix;
- uniform float waterheight;
- uniform float millis;
- @(if $specular [result [uniform vec3 lightpos; varying vec3 lightdir;]])
- varying vec3 camdir, color;
- varying vec4 texcoord0;
- varying vec2 texcoord1, texcoord2;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- texcoord0 = watermatrix * vvertex;
- @(if (>= (strstr $arg1 "underwater") 0) [result [
- texcoord0.z = waterheight - vvertex.z;
- ]] [result [
- texcoord0.z = vvertex.z - waterheight;
- ]])
- vec2 tc = vvertex.xy * 0.02;
- texcoord1 = tc + millis*0.05;
- texcoord2 = tc - millis*0.03;
- camdir = camera - vvertex.xyz;
- @(if $specular [result [
- lightdir = lightpos - vvertex.xyz;
- ]])
- }
- ] [
- @(if $rgbfog [result [
- //:fog
- ]] [result [
- //:fogrgba vec4(vec3(0.0), 1.0)
- ]])
- uniform vec2 depth;
- @(if $specular [result [uniform vec3 lightcolor; uniform float lightradius; varying vec3 lightdir;]])
- varying vec3 camdir, color;
- varying vec4 texcoord0;
- varying vec2 texcoord1, texcoord2;
- @(if (>= (strstr $arg1 "env") 0) [result [
- uniform samplerCube tex0;
- ]] [result [
- uniform sampler2D tex0;
- ]])
- uniform sampler2D tex1, tex2, tex3;
- void main(void)
- {
- vec3 camvec = normalize(camdir);
- @(if $specular [result [
- vec3 lightvec = normalize(lightdir);
- vec3 halfangle = normalize(camvec + lightvec);
- ]])
-
- vec2 dudv = texture2D(tex2, texcoord1).xy*2.0 - 1.0;
-
- @distort
-
- @(if $specular [result [
- float spec = pow(clamp(dot(halfangle, bump), 0.0, 1.0), 96.0);
- vec3 light = lightcolor * (1.0 - clamp(length(lightdir)/lightradius, 0.0, 1.0));
- ]])
-
- @combine
- }
- ]
-]
-
-watershader "waterglare" 1 1 [
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- gl_FragColor = vec4(light*spec*spec*32.0, 0.0);
-]
-lazyshader 0 "waterglarefast" [
- //:fog
- attribute vec4 vvertex;
- uniform mat4 camprojmatrix;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- }
-] [
- void main(void)
- {
- gl_FragColor = vec4(0.0);
- }
-]
-fastshader waterglare waterglarefast 2
-altshader waterglare waterglarefast
-
-lazyshader 0 "underwater" [
- attribute vec4 vvertex;
- attribute vec3 vcolor;
- uniform mat4 camprojmatrix;
- varying vec3 color;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- }
-] [
- //:fogrgba vec4(vec3(0.0), 1.0)
- uniform vec2 depth;
- varying vec3 color;
- void main(void)
- {
- gl_FragColor.rgb = 0.8*depth.x*color;
- gl_FragColor.a = 0.5*depth.y;
- }
-]
-
-watershader "underwaterrefract" 0 1 [
- dudv = texture2D(tex2, texcoord2 + 0.025*dudv).xy*2.0 - 1.0;
-
- gl_FragColor = texture2D(tex3, texcoord0.xy/texcoord0.w + 0.007*dudv);
-] []
-watershader "underwaterrefractfast" 0 1 [
- gl_FragColor = texture2DProj(tex3, texcoord0 + vec4(0.3*dudv, 0.0, 0.0));
-] []
-fastshader underwaterrefract underwaterrefractfast 2
-altshader underwaterrefract underwaterrefractfast
-
-watershader "underwaterfade" 0 1 [
- dudv = texture2D(tex2, texcoord2 + 0.025*dudv).xy*2.0 - 1.0;
-
- vec2 projtc = texcoord0.xy/texcoord0.w;
- float fade = texcoord0.z + 4.0*texture2D(tex3, projtc).a;
- gl_FragColor.a = fade * clamp(gl_FragCoord.z, 0.0, 1.0);
- gl_FragColor.rgb = texture2D(tex3, projtc + 0.007*dudv).rgb;
-] []
-watershader "underwaterfadefast" 0 1 [
- gl_FragColor.rgb = texture2DProj(tex3, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
- gl_FragColor.a = texcoord0.z + 4.0*texture2DProj(tex3, texcoord0).a;
-] []
-fastshader underwaterfade underwaterfadefast 2
-altshader underwaterfade underwaterfadefast
-
-watershader "water" 1 0 [
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor.rgb = color*depth.x*mix(0.6, 1.0, invfresnel*0.5+0.5) + spec*light;
- gl_FragColor.a = invfresnel*depth.y;
-]
-watershader "waterfast" 0 0 [
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor.rgb = color*depth.x*mix(0.6, 1.0, invfresnel*0.5+0.5);
- gl_FragColor.a = invfresnel*depth.y;
-]
-fastshader water waterfast 1
-altshader water waterfast
-
-watershader "waterreflect" 1 0 [
- vec3 reflect = texture2DProj(tex0, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor.rgb = mix(reflect, color*depth.x, invfresnel*0.5+0.5) + spec*light;
- gl_FragColor.a = invfresnel*depth.y;
-]
-watershader "waterreflectfast" 0 0 [
- vec3 reflect = texture2DProj(tex0, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor.rgb = mix(reflect, color*depth.x, invfresnel*0.5+0.5);
- gl_FragColor.a = invfresnel*depth.y;
-]
-fastshader waterreflect waterreflectfast 2
-altshader waterreflect waterreflectfast
-
-watershader "waterrefract" 1 1 [
- vec2 dtc = texcoord2 + 0.025*dudv;
- vec3 bump = texture2D(tex1, dtc).rgb*2.0 - 1.0;
- dudv = texture2D(tex2, dtc).xy*2.0 - 1.0;
-
- vec2 rtc = texcoord0.xy/texcoord0.w + 0.007*dudv;
- vec3 reflect = texture2D(tex0, rtc).rgb;
- vec3 refract = texture2D(tex3, rtc).rgb;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor = vec4(mix(reflect, refract, invfresnel*0.5+0.5) + spec*light, 0.0);
-]
-watershader "waterrefractfast" 0 1 [
- vec4 rtc = texcoord0 + vec4(0.3*dudv, 0.0, 0.0);
- vec3 reflect = texture2DProj(tex0, rtc).rgb;
- vec3 refract = texture2DProj(tex3, rtc).rgb;
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor = vec4(mix(reflect, refract, invfresnel*0.5+0.5), 0.0);
-]
-fastshader waterrefract waterrefractfast 2
-altshader waterrefract waterrefractfast
-
-watershader "waterfade" 1 1 [
- vec2 dtc = texcoord2 + 0.025*dudv;
- vec3 bump = texture2D(tex1, dtc).rgb*2.0 - 1.0;
- dudv = texture2D(tex2, dtc).xy*2.0 - 1.0;
-
- vec2 projtc = texcoord0.xy/texcoord0.w;
- vec2 rtc = projtc + 0.007*dudv;
- vec3 reflect = texture2D(tex0, rtc).rgb;
- vec3 refract = texture2D(tex3, rtc).rgb;
- float fade = texcoord0.z + 4.0*texture2D(tex3, projtc).a;
- gl_FragColor.a = fade * clamp(gl_FragCoord.z, 0.0, 1.0);
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor.rgb = mix(reflect, refract, invfresnel*0.5+0.5) + spec*light;
-]
-watershader "waterfadefast" 0 1 [
- vec4 rtc = texcoord0 + vec4(0.3*dudv, 0.0, 0.0);
- vec3 reflect = texture2DProj(tex0, rtc).rgb;
- vec3 refract = texture2DProj(tex3, rtc).rgb;
- gl_FragColor.a = texcoord0.z + 4.0*texture2DProj(tex3, texcoord0).a;
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
-] [
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- gl_FragColor.rgb = mix(reflect, refract, invfresnel*0.5+0.5);
-]
-fastshader waterfade waterfadefast 2
-altshader waterfade waterrefract
-
-watershader "waterenv" 1 0 [
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
-] [
- gl_FragColor.rgb = mix(reflect, color*depth.x, invfresnel*0.5+0.5) + spec*light;
- gl_FragColor.a = invfresnel*depth.y;
-]
-watershader "waterenvfast" 0 0 [
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
-] [
- gl_FragColor.rgb = mix(reflect, color*depth.x, invfresnel*0.5+0.5);
- gl_FragColor.a = invfresnel*depth.y;
-]
-fastshader waterenv waterenvfast 2
-altshader waterenv waterenvfast
-
-watershader "waterenvrefract" 1 1 [
- vec2 dtc = texcoord2 + 0.025*dudv;
- vec3 bump = texture2D(tex1, dtc).rgb*2.0 - 1.0;
- dudv = texture2D(tex2, dtc).xy*2.0 - 1.0;
-
- vec3 refract = texture2D(tex3, texcoord0.xy/texcoord0.w + 0.007*dudv).rgb;
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
-] [
- gl_FragColor = vec4(mix(reflect, refract, invfresnel*0.5+0.5) + spec*light, 0.0);
-]
-watershader "waterenvrefractfast" 0 1 [
- vec3 refract = texture2DProj(tex3, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
-] [
- gl_FragColor = vec4(mix(reflect, refract, invfresnel*0.5+0.5), 0.0);
-]
-fastshader waterenvrefract waterenvrefractfast 2
-altshader waterenvrefract waterenvrefractfast
-
-watershader "waterenvfade" 1 1 [
- vec2 dtc = texcoord2 + 0.025*dudv;
- vec3 bump = texture2D(tex1, dtc).rgb*2.0 - 1.0;
- dudv = texture2D(tex2, dtc).xy*2.0 - 1.0;
-
- vec2 projtc = texcoord0.xy/texcoord0.w;
- vec3 refract = texture2D(tex3, projtc + 0.007*dudv).rgb;
- float fade = texcoord0.z + 4.0*texture2D(tex3, projtc).a;
- gl_FragColor.a = fade * clamp(gl_FragCoord.z, 0.0, 1.0);
-
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
-] [
- gl_FragColor.rgb = mix(reflect, refract, invfresnel*0.5+0.5) + spec*light;
-]
-watershader "waterenvfadefast" 0 1 [
- vec3 refract = texture2DProj(tex3, texcoord0 + vec4(0.3*dudv, 0.0, 0.0)).rgb;
- gl_FragColor.a = texcoord0.z + 4.0*texture2DProj(tex3, texcoord0).a;
- vec3 bump = texture2D(tex1, texcoord2 + 0.025*dudv).rgb*2.0 - 1.0;
- float invfresnel = clamp(dot(camvec, bump), 0.0, 1.0);
- vec3 reflect = textureCube(tex0, camvec - 2.0*invfresnel*bump).rgb;
-] [
- gl_FragColor.rgb = mix(reflect, refract, invfresnel*0.5+0.5);
-]
-fastshader waterenvfade waterenvfadefast 2
-altshader waterenvfade waterenvrefract
-
-causticshader = [
- lazyshader 0 $arg1 [
- attribute vec4 vvertex;
- uniform mat4 camprojmatrix;
- uniform vec3 texgenS, texgenT;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- texcoord0 = vec2(dot(texgenS, vvertex.xyz), dot(texgenT, vvertex.xyz));
- }
- ] [
- //:fog vec3(1.0)
- uniform vec4 frameblend;
- varying vec2 texcoord0;
- uniform sampler2D tex0, tex1;
- void main(void)
- {
- @arg2
- }
- ]
-]
-causticshader caustic [
- gl_FragColor = vec4(vec3(frameblend.x*texture2D(tex0, texcoord0).r + frameblend.y*texture2D(tex1, texcoord0).r + frameblend.w), 1.0);
-]
-
-lazyshader 0 "lava" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec3 vnormal;
- uniform mat4 camprojmatrix;
- varying vec4 color;
- uniform vec4 lavatexgen;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- vec2 tc = mix(vvertex.xz, vvertex.yy, abs(vnormal.xz));
- texcoord0 = (tc + lavatexgen.zw) * lavatexgen.xy;
- }
-] [
- uniform sampler2D tex0;
- varying vec4 color;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_FragColor = color * texture2D(tex0, texcoord0) * 2.0;
- }
-]
-
-lazyshader 0 "lavaglare" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec3 vnormal;
- uniform mat4 camprojmatrix;
- varying vec4 color;
- uniform vec4 lavatexgen;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vec4(vcolor.rgb*2.0 - 1.0, vcolor.a);
- vec2 tc = mix(vvertex.xz, vvertex.yy, abs(vnormal.xz));
- texcoord0 = (tc + lavatexgen.zw) * lavatexgen.xy;
- }
-] [
- uniform sampler2D tex0;
- varying vec4 color;
- varying vec2 texcoord0;
- void main(void)
- {
- vec4 glow = texture2D(tex0, texcoord0) * color;
- float k = max(glow.r, max(glow.g, glow.b));
- gl_FragColor = glow*k*k*32.0;
- }
-]
-
-lazyshader 0 "waterfall" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec3 vnormal;
- uniform mat4 camprojmatrix;
- varying vec4 color;
- uniform vec4 waterfalltexgen;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- vec2 tc = mix(vvertex.xz, vvertex.yy, abs(vnormal.xz));
- texcoord0 = (tc + waterfalltexgen.zw) * waterfalltexgen.xy;
- }
-] [
- uniform sampler2D tex0;
- varying vec4 color;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_FragColor = color * texture2D(tex0, texcoord0);
- }
-]
-
-lazyshader 0 "waterfallrefract" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec3 vnormal;
- uniform mat4 camprojmatrix;
- uniform mat4 watermatrix;
- varying vec4 color;
- uniform vec4 waterfalltexgen;
- varying vec2 texcoord0;
- varying vec4 texcoord1;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- vec2 tc = mix(vvertex.xz, vvertex.yy, abs(vnormal.xz));
- texcoord0 = (tc + waterfalltexgen.zw) * waterfalltexgen.xy;
- texcoord1 = watermatrix * vvertex;
- }
-] [
- uniform vec2 dudvoffset;
- uniform sampler2D tex0, tex2, tex4;
- varying vec4 color;
- varying vec2 texcoord0;
- varying vec4 texcoord1;
- void main(void)
- {
- vec4 diffuse = texture2D(tex0, texcoord0);
- vec2 dudv = texture2D(tex2, texcoord0 + 0.2*diffuse.xy + dudvoffset).xy;
- vec4 refract = texture2DProj(tex4, texcoord1 + vec4(4.0*dudv, 0.0, 0.0));
- gl_FragColor = mix(refract, color, diffuse);
- }
-]
-
-lazyshader 0 "waterfallenvrefract" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec3 vnormal;
- uniform mat4 camprojmatrix;
- uniform mat4 watermatrix;
- uniform vec3 camera;
- varying vec4 color;
- uniform vec4 waterfalltexgen;
- varying vec2 texcoord0;
- varying vec4 texcoord1;
- varying vec3 camdir;
- varying mat3 world;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- camdir = camera - vvertex.xyz;
- vec3 absnorm = abs(vnormal);
- world = mat3(absnorm.yzx, -absnorm.zxy, vnormal);
- vec2 tc = mix(vvertex.xz, vvertex.yy, absnorm.xz);
- texcoord0 = (tc + waterfalltexgen.zw) * waterfalltexgen.xy;
- texcoord1 = watermatrix * vvertex;
- }
-] [
- uniform vec2 dudvoffset;
- uniform sampler2D tex0, tex1, tex2, tex4;
- uniform samplerCube tex3;
- varying vec4 color;
- varying vec2 texcoord0;
- varying vec4 texcoord1;
- varying vec3 camdir;
- varying mat3 world;
- void main(void)
- {
- vec4 diffuse = texture2D(tex0, texcoord0);
- vec2 dudv = texture2D(tex2, texcoord0 + 0.2*diffuse.xy + dudvoffset).xy;
- vec3 normal = world * (texture2D(tex1, texcoord0 + 0.1*dudv).rgb*2.0 - 1.0);
- vec4 refract = texture2DProj(tex4, texcoord1 + vec4(4.0*dudv, 0.0, 0.0));
- vec3 camvec = normalize(camdir);
- float invfresnel = dot(normal, camvec);
- vec4 reflect = textureCube(tex3, 2.0*invfresnel*normal - camvec);
- gl_FragColor = mix(mix(reflect, refract, 1.0 - 0.4*step(0.0, invfresnel)), color, diffuse);
- }
-]
-altshader waterfallenvrefract waterfallrefract
-
-lazyshader 0 "waterfallenv" [
- //:fog
- attribute vec4 vvertex;
- attribute vec3 vcolor, vnormal;
- uniform mat4 camprojmatrix;
- uniform vec3 camera;
- uniform vec4 waterfalltexgen;
- varying vec2 texcoord0;
- varying vec3 color, camdir;
- varying mat3 world;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- camdir = camera - vvertex.xyz;
- vec3 absnorm = abs(vnormal);
- world = mat3(absnorm.yzx, -absnorm.zxy, vnormal);
- vec2 tc = mix(vvertex.xz, vvertex.yy, absnorm.xz);
- texcoord0 = (tc + waterfalltexgen.zw) * waterfalltexgen.xy;
- }
-] [
- uniform vec2 dudvoffset;
- uniform sampler2D tex0, tex1, tex2;
- uniform samplerCube tex3;
- varying vec2 texcoord0;
- varying vec3 color, camdir;
- varying mat3 world;
- void main(void)
- {
- vec4 diffuse = texture2D(tex0, texcoord0);
- vec2 dudv = texture2D(tex2, texcoord0 + 0.2*diffuse.xy + dudvoffset).xy;
- vec3 normal = world * (texture2D(tex1, texcoord0 + 0.1*dudv).rgb*2.0 - 1.0);
- vec3 camvec = normalize(camdir);
- vec4 reflect = textureCube(tex3, 2.0*dot(normal, camvec)*normal - camvec);
- gl_FragColor.rgb = mix(reflect.rgb, color, diffuse.rgb);
- gl_FragColor.a = 0.25 + 0.75*diffuse.r;
- }
-]
-
-lazyshader 0 "glass" [
- attribute vec4 vvertex;
- attribute vec3 vcolor, vnormal;
- uniform mat4 camprojmatrix;
- uniform vec3 camera;
- varying vec3 color, rvec, camdir, normal;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- normal = vnormal;
- camdir = camera - vvertex.xyz;
- rvec = 2.0*dot(camdir, vnormal) * vnormal - camdir;
- }
-] [
- //:fogrgba vec4(vec3(0.0), 1.0)
- uniform samplerCube tex0;
- varying vec3 color, rvec, camdir, normal;
- void main(void)
- {
- vec3 camvec = normalize(camdir);
- vec3 reflect = textureCube(tex0, rvec).rgb;
-
- float invfresnel = max(dot(camvec, normal), 0.70);
- gl_FragColor.rgb = mix(reflect, color*0.05, invfresnel);
- gl_FragColor.a = invfresnel * 0.95;
- }
-]
-lazyshader 0 "glassfast" [
- attribute vec4 vvertex;
- attribute vec3 vcolor, vnormal;
- uniform mat4 camprojmatrix;
- uniform vec3 camera;
- varying vec3 color, rvec;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- vec3 camdir = camera - vvertex.xyz;
- rvec = 2.0*dot(camdir, vnormal) * vnormal - camdir;
- }
-] [
- //:fogrgba vec4(vec3(0.0), 1.0)
- uniform samplerCube tex0;
- varying vec3 color, rvec;
- void main(void)
- {
- vec3 reflect = textureCube(tex0, rvec).rgb;
- const float invfresnel = 0.75;
- gl_FragColor.rgb = mix(reflect, color*0.05, invfresnel);
- gl_FragColor.a = invfresnel * 0.95;
- }
-]
-fastshader glass glassfast 2
-altshader glass glassfast
-
-lazyshader 0 "grass" [
- attribute vec4 vvertex, vcolor;
- attribute vec2 vtexcoord0, vtexcoord1;
- attribute vec4 vtangent;
- uniform mat4 camprojmatrix;
- uniform vec3 camera;
- uniform vec3 grassmargin;
- varying vec4 color;
- varying vec2 texcoord0, texcoord1;
- varying vec2 bounds;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- texcoord0 = vtexcoord0;
- texcoord1 = vtexcoord1 * @lmcoordscale;
- vec2 camdir = (camera.xy - vvertex.xy) * grassmargin.y;
- bounds = vec2(dot(camdir, vtangent.xy), dot(camdir, vtangent.zw)) + grassmargin.z;
- }
-] [
- //:fogrgba vec4(0.0)
- varying vec4 color;
- varying vec2 texcoord0, texcoord1;
- varying vec2 bounds;
- uniform sampler2D tex0, tex1;
- void main(void)
- {
- vec4 diffuse = texture2D(tex0, texcoord0);
- diffuse.rgb *= 2.0;
- vec4 lm = texture2D(tex1, texcoord1) * color;
- lm.rgb *= lm.a;
- float margin = clamp(min(bounds.x, bounds.y), 0.0, 1.0);
- gl_FragColor = diffuse * lm * margin;
- }
-]
-
-shader 0 "overbrightdecal" [
- attribute vec4 vvertex, vcolor;
- attribute vec2 vtexcoord0;
- uniform mat4 camprojmatrix;
- varying vec4 color;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- texcoord0 = vtexcoord0;
- }
-] [
- //:fog vec3(0.5)
- varying vec4 color;
- varying vec2 texcoord0;
- uniform sampler2D tex0;
- void main(void)
- {
- vec4 diffuse = texture2D(tex0, texcoord0);
- gl_FragColor = mix(color, diffuse, color.a);
- }
-]
-
-shader 0 "saturatedecal" [
- //:fog
- attribute vec4 vvertex, vcolor;
- attribute vec2 vtexcoord0;
- uniform mat4 camprojmatrix;
- varying vec4 color;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = camprojmatrix * vvertex;
- color = vcolor;
- texcoord0 = vtexcoord0;
- }
-] [
- varying vec4 color;
+ varying vec4 color;
varying vec2 texcoord0;
uniform sampler2D tex0;
void main(void)
gl_FragColor = diffuse * color;
}
]
-
-shader 0 "skybox" [
- attribute vec4 vvertex, vcolor;
- attribute vec2 vtexcoord0;
- uniform mat4 skymatrix;
- varying vec2 texcoord0;
- varying vec4 color;
- void main(void)
- {
- gl_Position = skymatrix * vvertex;
- texcoord0 = vtexcoord0;
- color = vcolor;
- }
-] [
- varying vec2 texcoord0;
- varying vec4 color;
- uniform sampler2D tex0;
- void main(void)
- {
- gl_FragColor = color * texture2D(tex0, texcoord0);
- }
-]
-
-shader 0 "skyboxglare" [
- attribute vec4 vvertex, vcolor;
- attribute vec2 vtexcoord0;
- uniform mat4 skymatrix;
- varying vec4 color;
- varying vec2 texcoord0;
- void main(void)
- {
- gl_Position = skymatrix * vvertex;
- color = vcolor;
- texcoord0 = vtexcoord0;
- }
-] [
- varying vec4 color;
- varying vec2 texcoord0;
- uniform sampler2D tex0;
- void main(void)
- {
- vec4 glare = texture2D(tex0, texcoord0) * color;
- gl_FragColor.rgb = vec3(dot(glare.rgb, vec3(10.56, 10.88, 10.56)) - 30.4);
- gl_FragColor.a = glare.a;
- }
-]
-
-shader 0 "skyfog" [
- attribute vec4 vvertex, vcolor;
- uniform mat4 skymatrix;
- varying vec4 color;
- void main(void)
- {
- gl_Position = skymatrix * vvertex;
- color = vcolor;
- }
-] [
- varying vec4 color;
- void main(void)
- {
- gl_FragColor = color;
- }
-]
-
-loop i 2 [
- lazyshader 0 (? $i "atmosphereglare" "atmosphere") [
- attribute vec4 vvertex;
- uniform mat4 skymatrix;
- varying vec3 camvec;
- void main(void)
- {
- gl_Position = skymatrix * vvertex;
-
- camvec = vvertex.xyz;
- }
- ] [
- uniform vec4 sunlight;
- uniform vec3 sundir;
- uniform vec3 sunweight;
- uniform vec3 sundiskcolor;
- uniform vec2 sundiskparams;
- uniform vec4 opticaldepthparams;
- uniform vec3 mieparams;
- uniform vec3 betarayleigh, betamie, betaozone;
- varying vec3 camvec;
-
- void main(void)
- {
- vec3 camdir = normalize(camvec);
- float costheta = dot(camdir, sundir);
-
- // sun disk
- float edgeoffset = max(1.0 - (1.0 - max(costheta, 0.0)*costheta)*sundiskparams.x, 0.0);
- // limb darken with distance to edge
- float limbdarken = sqrt(edgeoffset);
- // lighten edges for corona, but limit it to not interfere with limb darkening
- float corona = min(edgeoffset * sundiskparams.y, 1.0);
- corona = max(0.75 / (1.5 - corona * corona) - 0.5, 0.0);
- // apply limb darkening and corona to clamped sunlight color
- vec3 sundisk = sundiskcolor * limbdarken * corona;
-
- // optical depth along view ray
- float offset = camdir.z*opticaldepthparams.w;
- vec3 depth = sqrt(offset*offset + opticaldepthparams.xyz) - offset;
- vec3 rayleighweight = betarayleigh * depth.x;
- vec3 mieweight = betamie * depth.y;
- vec3 ozoneweight = betaozone * (depth.z - depth.x);
-
- // extinction of light along view ray
- vec3 viewweight = sunweight - (rayleighweight + mieweight + ozoneweight);
- vec3 extinction = (exp2(viewweight) - 1.0) / viewweight;
-
- @(? $i [
- // only glare sundisk, excluding other scattering
- // squared (by skipping gamma encode) to limit it
- gl_FragColor = vec4(sundisk * extinction, sunlight.a);
- ] [
- // calculate in-scattering
- float rphase = (1.5 + 0.5*costheta*costheta) * (3.0 / (16.0 * 3.14159265));
- float mphase = inversesqrt(mieparams.x + mieparams.y*min(costheta, mieparams.z));
- vec3 scatter = rayleighweight * rphase + mieweight * (mphase * mphase * mphase);
-
- // combine scattering and extinction with sundisk
- vec3 inscatter = (sunlight.rgb * scatter + sundisk) * extinction;
-
- // gamma encode
- gl_FragColor = vec4(sqrt(inscatter), sunlight.a);
- ])
- }
- ]
-]
-
guitext "http://sauerbraten.org/" 0
]
-genmapitems = [
- looplist curmap $arg1 [
- guibutton $curmap (concat map $curmap) "cube"
- ]
-]
-//17
-
-ffamaps1 = "aard3c abyss academy access albatross akaritori akimiski alithia alloy antel anubis aod aqueducts arbana asenatra asthma averas"
-ffamaps2 = "awoken bvdm_01 carbide cartel castle_trap catacombs cavefire church51 clash collusion colony complex conflict corruption crypta curvedm curvy_castle"
-ffamaps3 = "darkdeath deathtek depot dirtndust dispute DM_BS1 dock dopamine douze duel5 duel7 duel8 dune elegy exist exo fallen"
-ffamaps4 = "fanatic_quake fdm6 ferguson force frag-lab frag2 fragplaza frostbyte frozen fubuki fury ghetto gorge gothic-df guacamole gubo hades"
-ffamaps5 = "hashi hator haze hdm3 headroom helligsted hektik hillfort hog2 horus idyll3 imhotep industry infernal injustice insipid island"
-ffamaps6 = "janela justice kalking1 kastro katrez_d kffa killfactory kmap5 konkuri-to ksauer1 legacy legazzo lost_soul lost_world lostinspace maple masdm"
-ffamaps7 = "mbt2 mbt9 mbt10 memento memoria metl2 metl3 metl4 mood moonlite neondevastation neonpanic nessus nmp8 nmp10 nucleus oasis"
-ffamaps8 = "oddworld ognjen ogrosupply oldschool orbe orion osiris ot outpost paradigm pariah park pgdm phosgene phrantic pitch_black powerplant"
-ffamaps9 = "purgatory refuge renegade rm1 rm5 roughinery ruby ruine saffier sandstorm sauerowalk sauerstruck sdm1 shadowed shindou shinmei1 shiva"
-ffamaps10 = "simplicity skrdm1 skycastle-r slingshot souls spcr2 stahlbox stemple stronghold suburb suisei tartech teahupoo tejen thetowers thor torment"
-ffamaps11 = "toxicity tumwalk turbine turmoil unworld unworld2 ventania waltz wake5 wdcd zamak zavial zdm2 ztn"
-capturemaps1 = "aastha abbey access akimiski akroseum alithia anubis aod arabic asenatra asgard asteroids averas bklyn c_egypt c_lone c_valley"
-capturemaps2 = "campo capture_night caribbean casa collide collusion core_refuge core_transfer corruption croma cwcastle damnation destiny dirtndust disc disruption donya"
-capturemaps3 = "duomo dust2 earthstation eris eternal_valley evilness face-capture fallen fb_capture fc3 fc4 fc5 forge fragnostic frostbyte fusion genesis"
-capturemaps4 = "ghetto gorge gothic-df hades hallo harbor haste hidden imhotep infamy infernal killcore3 kopenhagen laucin lostinspace luna mbt12"
-capturemaps5 = "mc-lab meltdown2 mercury metro monastery nevil_c new_energy nitro nmp4 nmp9 nucleus ogrosupply overdrive ow pandora paradigm pariah"
-capturemaps6 = "ph-capture pul1ctf reissen relic risk river_c river_keep ruby ruebli rust serenity skycastle-r snapper_rocks spcr stadium stronghold subterra"
-capturemaps7 = "suburb surge tempest tortuga triforts turbulence turmoil twinforts urban_c valhalla venice waltz xenon zamak"
-ctfmaps1 = "aastha abbey akimiski akroseum arbana asgard authentic autumn bad_moon berlin_wall bklyn breakout bt_falls campo capture_night casa catch22"
-ctfmaps2 = "collide core_refuge core_transfer croma ctf_suite daemex damnation desecration destiny disc disruption divine duomo dust2 earthsea earthstation enigma"
-ctfmaps3 = "eris eternal_valley europium evilness face-capture fire_keep flagstone forge forgotten fortress fragnostic fusion garden hallo harbor haste hidden"
-ctfmaps4 = "idris infamy kiryu kopenhagen l_ctf laucin luna mach2 mbt1 mbt4 mbt12 mc-lab meltdown2 mercury metro mill new_energy"
-ctfmaps5 = "nitro nucleus overdrive ow pandora pul1ctf ra recovery redemption regal reissen risk river_keep ruebli rust sacrifice shellshock2"
-ctfmaps6 = "shipwreck siberia snapper_rocks spcr stadium stronghold subterra suburb surge tatooine tectonic tejen tempest tortuga triforts tubes turbulence"
-ctfmaps7 = "twinforts unworld3 urban_c valhalla warlock wdcd xenon"
-conceptmaps = "box_demo canyon door_demo firstevermap ladder platform_demo sauerbraten secondevermap spiralz"
-spmaps = "mpsp6a mpsp6b mpsp6c mpsp9a mpsp9b mpsp9c mpsp10 lost level9 skrsp1 crnsp1"
-rpgmaps = "k_rpg1 rpg_01"
-allffamaps = (concat $ffamaps1 $ffamaps2 $ffamaps3 $ffamaps4 $ffamaps5 $ffamaps6 $ffamaps7 $ffamaps8 $ffamaps9 $ffamaps10 $ffamaps11)
-allcapturemaps = (concat $capturemaps1 $capturemaps2 $capturemaps3 $capturemaps4 $capturemaps5 $capturemaps6 $capturemaps7)
-allctfmaps = (concat $ctfmaps1 $ctfmaps2 $ctfmaps3 $ctfmaps4 $ctfmaps5 $ctfmaps6 $ctfmaps7)
-allmaps = (concat $allffamaps $allcapturemaps $allctfmaps $conceptmaps $spmaps $rpgmaps)
-
guirollovername = ""
guirolloveraction = ""
guirolloverimgpath = ""
]
]
-newgui maps [
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $ffamaps1 ]
- guilist [ guistrut 15 1; genmapitems $ffamaps2 ]
- guilist [ guistrut 15 1; genmapitems $ffamaps3 ]
- showmapshot
- ]
- guitab 2
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $ffamaps4 ]
- guilist [ guistrut 15 1; genmapitems $ffamaps5 ]
- guilist [ guistrut 15 1; genmapitems $ffamaps6 ]
- showmapshot
- ]
- guitab 3
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $ffamaps7 ]
- guilist [ guistrut 15 1; genmapitems $ffamaps8 ]
- guilist [ guistrut 15 1; genmapitems $ffamaps9 ]
- showmapshot
- ]
- guitab 4
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $ffamaps10 ]
- guilist [ guistrut 15 1; genmapitems $ffamaps11 ]
- guilist [ guistrut 15 1 ]
- showmapshot
- ]
- guitab capture
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $capturemaps1 ]
- guilist [ guistrut 15 1; genmapitems $capturemaps2 ]
- guilist [ guistrut 15 1; genmapitems $capturemaps3 ]
- showmapshot
- ]
- guitab 2
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $capturemaps4 ]
- guilist [ guistrut 15 1; genmapitems $capturemaps5 ]
- guilist [ guistrut 15 1; genmapitems $capturemaps6 ]
- showmapshot
- ]
- guitab 3
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $capturemaps7 ]
- guilist [ guistrut 15 1 ]
- guilist [ guistrut 15 1 ]
- showmapshot
- ]
- guitab ctf
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $ctfmaps1 ]
- guilist [ guistrut 15 1; genmapitems $ctfmaps2 ]
- guilist [ guistrut 15 1; genmapitems $ctfmaps3 ]
- showmapshot
- ]
- guitab 2
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $ctfmaps4 ]
- guilist [ guistrut 15 1; genmapitems $ctfmaps5 ]
- guilist [ guistrut 15 1; genmapitems $ctfmaps6 ]
- showmapshot
- ]
- guitab 3
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $ctfmaps7 ]
- guilist [ guistrut 15 1 ]
- guilist [ guistrut 15 1 ]
- showmapshot
- ]
-
- guitab concept
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $conceptmaps ]
- guilist [ guistrut 15 1 ]
- guilist [ guistrut 15 1 ]
- showmapshot
- ]
-]
-
-newgui capturemaps [
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $capturemaps1 ]
- guilist [ guistrut 15 1; genmapitems $capturemaps2 ]
- guilist [ guistrut 15 1; genmapitems $capturemaps3 ]
- showmapshot
- ]
- guitab 2
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $capturemaps4 ]
- guilist [ guistrut 15 1; genmapitems $capturemaps5 ]
- guilist [ guistrut 15 1; genmapitems $capturemaps6 ]
- showmapshot
- ]
- guitab 3
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $capturemaps7 ]
- guilist [ guistrut 15 1 ]
- guilist [ guistrut 15 1 ]
- showmapshot
- ]
-] "capture maps"
-
-newgui ctfmaps [
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $ctfmaps1 ]
- guilist [ guistrut 15 1; genmapitems $ctfmaps2 ]
- guilist [ guistrut 15 1; genmapitems $ctfmaps3 ]
- showmapshot
- ]
- guitab 2
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $ctfmaps4 ]
- guilist [ guistrut 15 1; genmapitems $ctfmaps5 ]
- guilist [ guistrut 15 1; genmapitems $ctfmaps6 ]
- showmapshot
- ]
- guitab 3
- guilist [
- guistrut 17 1
- guilist [ guistrut 15 1; genmapitems $ctfmaps7 ]
- guilist [ guistrut 15 1 ]
- guilist [ guistrut 15 1 ]
- showmapshot
- ]
-] "ctf maps"
-
-custommaps = ""
-newgui custommaps [
- looplist curmap $custommaps [
- guibutton $curmap (concat map $curmap) "cube"
- ]
-] "custom maps"
-showcustommaps = [
- custommaps = ""
- loopfiles curmap "packages/maps" "ogz" [
- if (< (indexof $allmaps $curmap) 0) [
- custommaps = (concat $custommaps (escape $curmap))
- ]
- ]
- custommaps = (sortlist $custommaps x y [naturalsort $x $y])
- showgui custommaps
-]
-
crosshairs = [
"data/crosshair.png data/crosshair_hit.png"
"packages/crosshairs/crosshair_0.png packages/crosshairs/crosshair_hit_0.png"
pastebuffer = [showgui pastebuffer]
-newgui scratchpad [
- guinoautotab [
- guieditor "#scratchpad" -80 20
- guistayopen [
- guilist [
- guibutton "exec" [textfocus "#scratchpad"; textexec]
- guibar
- guibutton "copy" [textfocus "#scratchpad"; textcopy]
- guibar
- guibutton "paste" [textfocus "#scratchpad"; textpaste]
- guibar
- guibutton "select" [textfocus "#scratchpad"; textselectall]
- guibar
- guibutton "clear" [textfocus "#scratchpad"; textclear]
- ]
- ]
- ]
-]
-
-scratchpad = [showgui scratchpad]
-
newmapsize = 12
savemap_name = temp
-newgui "editing" [ ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- guikeeptab 1
-
- guibutton "toggle edit mode^t^t^f2[E]" "edittoggle"
- guibar //-------------------------------------------------------------------------
- guilist [
- guilist [
- guitext "select^t^t^t^t^f2[mouse-left *drag]^t"
- guitext "extend selection^t^t^f2[mouse-right]"
- guitext "move selection^t^t^t^f2[mouse-right *drag]"
- guitext "deselect^t^t^t^t^f2[SPACE]"
- guitext "select all ents in box^t^f2[keypad-ENTER]"
- ]
- guilist [
- guitext "select corners^t^t^t^f2[mouse-middle *drag]"
- guitext "reorient^t^t^t^t^f2[mouse-right]"
- guitext "passthrough^t^t^t^f2[LCTRL *hold]"
- guitext "center view on ent^t^t^f2[COMMA + mousewheel]"
- guitext "select all ents matching^t^f2[N]"
- ]
- ]
- guibar //-------------------------------------------------------------------------
- guilist [
- guilist [
- guitext "push/pull selection^t^t^f2[mousewheel]^t^t"
- guitext "change gridsize^t^t^f2[G + mousewheel]"
- guitext "mirror on selected axis^t^f2[X]"
- ]
- guilist [
- guitext "push cube face^t^t^f2[F + mousewheel]"
- guitext "push corner with cursor^t^f2[Q + mousewheel]"
- guitext "rotate^t^t^t^t^f2[R + mousewheel]"
- ]
- ]
- guibar //-------------------------------------------------------------------------
- guilist [
- guilist [
- guitext "undo^t^t^t^t^t^f2[U] [Z]^t^t^t"
- guitext "copy^t^t^t^t^t^f2[C]"
- guitext "delete^t^t^t^t^f2[DELETE]"
- ]
- guilist [
- guitext "redo^t^t^t^t^t^f2[I]"
- guitext "paste^t^t^t^t^f2[V]"
- ]
- ]
- guibar //-------------------------------------------------------------------------
- guilist [
- guilist [
- guitext "change textures^t^t^f2[Y + mousewheel]^t"
- guicheckbox "texture all faces^t^t^f2[0]" "allfaces"
- guicheckbox "toggle outline^t^t^t^f2[7]" "outline"
- ]
- guilist [
- guibutton "texture palette..^t^t^f2[F2]" "showtexgui"
- guibutton "materials.." "showgui materials"
- guicheckbox "toggle wireframe^t^t^f2[8]" "wireframe"
- ]
- ]
-
-guitab "ents" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- guilist [
- guilist [
- guibutton "edit selected ent..^t^t^f2[F3]^t^t^t" "showentgui"
- guicheckbox "entity snap-to-grid^t^t^f2[6]" "entselsnap"
- ]
- guilist [
- guibutton "edit selected entity in console^t^f2[PERIOD]" "selentedit"
- guicheckbox "entity selection" "entediting"
- ]
- ]
- guibar //-------------------------------------------------------------------------
- guitext "drop entities"
- guilist [
- guilist [
- guiradio "at selection^t^t^t^t^t^t" entdrop 2
- guiradio "at selection & to the floor" entdrop 3
- ]
- guilist [
- guiradio "at current position" entdrop 0
- guiradio "at current position & to the floor" entdrop 1
- ]
- ]
- guibar //-------------------------------------------------------------------------
- guitext "newent *"
- guilist [
- guilist [
- guibutton "light..^t^t^t^t^t" "resetlight;showgui newlight"
- guibutton "playerstart" "newent playerstart"
- ]
- guilist [
- guibutton "mapmodel..^t^t^f2[F4]^t^t" "showgui mapmodels"
- guibutton "playerstart team-1" "newent playerstart 1"
- ]
- guilist [
- guibutton "teleport.." "showgui newteleport"
- ]
- ]
- guitext "pickup entities:"
- guilist [
- guilist [
- guibutton "shells^t^t^t^t^t^t^t" "newent shells"
- guibutton "bullets" "newent bullets"
- guibutton "rockets" "newent rockets"
- guibutton "riflerounds" "newent riflerounds"
- guibutton "grenades" "newent grenades"
- guibutton "cartridges" "newent cartridges"
- ]
- guilist [
- guibutton "tinyhealth" "newent tinyhealth"
- guibutton "tinyarmour" "newent tinyarmour"
- guibutton "health" "newent health"
- guibutton "healthboost" "newent healthboost"
- guibutton "greenarmour" "newent greenarmour"
- guibutton "yellowarmour" "newent yellowarmour"
- guibutton "quaddamage" "newent quaddamage"
- guibutton "select all pickup ents ^f2/findpickupents" "findpickupents"
- ]
- ]
-
-guitab "lighting" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- guibutton "maplighting.. ^f2/maplighting" "showgui _maplighting"
- guibar //-------------------------------------------------------------------------
- lightingstuff
-
-guitab "skybox" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- guilist [
- guistayopen [
- guilist [ genskyitems $skies1 ]
- guilist [ genskyitems $skies2 ]
- guilist [ genskyitems $skies3 ]
- showskyshot
- ]
- ]
-
-guitab "sky" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- _skyboxcolour_r = (& (>> $skyboxcolour 16) 0xFF)
- _skyboxcolour_g = (& (>> $skyboxcolour 8) 0xFF)
- _skyboxcolour_b = (& (>> $skyboxcolour 0) 0xFF)
- guilist [
- guitext "skyboxcolour "
- guicolor $skyboxcolour
- ]
- guislider _skyboxcolour_r 0 255 [skyboxcolour $_skyboxcolour_r $_skyboxcolour_g $_skyboxcolour_b]
- guislider _skyboxcolour_g 0 255 [skyboxcolour $_skyboxcolour_r $_skyboxcolour_g $_skyboxcolour_b]
- guislider _skyboxcolour_b 0 255 [skyboxcolour $_skyboxcolour_r $_skyboxcolour_g $_skyboxcolour_b]
- guibar //-------------------------------------------------------------------------
- guilist [
- guitext "spinsky "
- guifield spinsky 5
- guistayopen [ guibutton "- " [spinsky (+fround $spinsky -0.1)] ]
- guistayopen [ guibutton "+" [spinsky (+fround $spinsky 0.1)] ]
- ]
- guibar //-------------------------------------------------------------------------
- guitext "yawsky"
- guislider yawsky
-
-
-guitab "cloudlayer" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- guistayopen [
- guilist [
- guilist [
- guitext "cloudlayer^t^t^t^t^t^t"
- guibutton "clouds/clouds01.png" [cloudlayer "clouds/clouds01.png"]
- guibutton "clouds/clouds02.png" [cloudlayer "clouds/clouds02.png"]
- guibutton "clouds/clouds03.png" [cloudlayer "clouds/clouds03.png"]
- ]
- guilist [
- guibutton "*no clouds*" [cloudlayer ""]
- guibutton "clouds/cloud_ring.png" [cloudlayer "clouds/cloud_ring.png"]
- ]
- ]
- ]
- guibar //-------------------------------------------------------------------------
- _cloudcolour_r = (& (>> $cloudcolour 16) 0xFF)
- _cloudcolour_g = (& (>> $cloudcolour 8) 0xFF)
- _cloudcolour_b = (& (>> $cloudcolour 0) 0xFF)
- guilist [
- guitext "cloudcolour "
- guicolor $cloudcolour
- ]
- guislider _cloudcolour_r 0 255 [cloudcolour $_cloudcolour_r $_cloudcolour_g $_cloudcolour_b]
- guislider _cloudcolour_g 0 255 [cloudcolour $_cloudcolour_r $_cloudcolour_g $_cloudcolour_b]
- guislider _cloudcolour_b 0 255 [cloudcolour $_cloudcolour_r $_cloudcolour_g $_cloudcolour_b]
- guibar //-------------------------------------------------------------------------
- guilist [
- guilist [
- guilist [
- guitext "cloudalpha^t"
- guifield cloudalpha 5
- guistayopen [ guibutton "- " [cloudalpha (+fround $cloudalpha -0.05)] ]
- guistayopen [ guibutton "+^t^t" [cloudalpha (+fround $cloudalpha 0.05)] ]
- ]
-
- guilist [
- guitext "cloudfade^t^t"
- guifield cloudfade 5
- guistayopen [ guibutton "- " [cloudfade (+fround $cloudfade -0.05)] ]
- guistayopen [ guibutton "+^t^t" [cloudfade (+fround $cloudfade 0.05)] ]
- ]
- ]
- guilist [
- guilist [
- guitext "cloudheight^t"
- guifield cloudheight 5
- guistayopen [ guibutton "- " [cloudheight (+fround $cloudheight -0.01)] ]
- guistayopen [ guibutton "+^t^t" [cloudheight (+fround $cloudheight 0.01)] ]
- ]
-
- guilist [
- guitext "cloudscale^t^t"
- guifield cloudscale 5
- guistayopen [ guibutton "- " [cloudscale (+fround $cloudscale -0.0625)] ]
- guistayopen [ guibutton "+^t^t" [cloudscale (+fround $cloudscale 0.0625)] ]
- ]
- ]
- ]
- guibar //-------------------------------------------------------------------------
- guilist [
- guilist [
- guilist [
- guitext "cloudoffsetx^t"
- guifield cloudoffsetx 5
- guistayopen [ guibutton "- " [cloudoffsetx (+fround $cloudoffsetx -0.01)] ]
- guistayopen [ guibutton "+^t^t" [cloudoffsetx (+fround $cloudoffsetx 0.01)] ]
- ]
- guilist [
- guitext "cloudoffsety^t"
- guifield cloudoffsety 5
- guistayopen [ guibutton "- " [cloudoffsety (+fround $cloudoffsety -0.01)] ]
- guistayopen [ guibutton "+" [cloudoffsety (+fround $cloudoffsety 0.01)] ]
- ]
- ]
- guilist [
- guilist [
- guitext "cloudscrollx^t"
- guifield cloudscrollx 5
- guistayopen [ guibutton "- " [cloudscrollx (+fround $cloudscrollx -0.01)] ]
- guistayopen [ guibutton "+^t^t" [cloudscrollx (+fround $cloudscrollx 0.01)] ]
- ]
- guilist [
- guitext "cloudscrolly^t"
- guifield cloudscrolly 5
- guistayopen [ guibutton "- " [cloudscrolly (+fround $cloudscrolly -0.01)] ]
- guistayopen [ guibutton "+" [cloudscrolly (+fround $cloudscrolly 0.01)] ]
- ]
- guilist [
- guitext "spincloudlayer^t"
- guifield spincloudlayer 5
- guistayopen [ guibutton "- " [spincloudlayer (+fround $spincloudlayer -0.1)] ]
- guistayopen [ guibutton "+" [spincloudlayer (+fround $spincloudlayer 0.1)] ]
- ]
- ]
- ]
-
-guitab "fog" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- guitext "fog"
- guislider fog 128 8192
- _fogcolour_r = (& (>> $fogcolour 16) 0xFF)
- _fogcolour_g = (& (>> $fogcolour 8) 0xFF)
- _fogcolour_b = (& (>> $fogcolour 0) 0xFF)
- guilist [
- guitext "fogcolour "
- guicolor $fogcolour
- ]
- guislider _fogcolour_r 0 255 [fogcolour $_fogcolour_r $_fogcolour_g $_fogcolour_b]
- guislider _fogcolour_g 0 255 [fogcolour $_fogcolour_r $_fogcolour_g $_fogcolour_b]
- guislider _fogcolour_b 0 255 [fogcolour $_fogcolour_r $_fogcolour_g $_fogcolour_b]
- guibar //-------------------------------------------------------------------------
- _fogdomecolour_r = (& (>> $fogdomecolour 16) 0xFF)
- _fogdomecolour_g = (& (>> $fogdomecolour 8) 0xFF)
- _fogdomecolour_b = (& (>> $fogdomecolour 0) 0xFF)
- guilist [
- guitext "fogdomecolour (0 = use fogcolour) "
- guicolor $fogdomecolour
- ]
- guislider _fogdomecolour_r 0 255 [fogdomecolour $_fogdomecolour_r $_fogdomecolour_g $_fogdomecolour_b]
- guislider _fogdomecolour_g 0 255 [fogdomecolour $_fogdomecolour_r $_fogdomecolour_g $_fogdomecolour_b]
- guislider _fogdomecolour_b 0 255 [fogdomecolour $_fogdomecolour_r $_fogdomecolour_g $_fogdomecolour_b]
- guilist [
- guilist [
- guilist [
- guitext "fogdomemax^t"
- guifield fogdomemax 5
- guistayopen [ guibutton "- " [fogdomemax (+fround $fogdomemax -0.01)] ]
- guistayopen [ guibutton "+^t^t" [fogdomemax (+fround $fogdomemax 0.01)] ]
- ]
- guilist [
- guitext "fogdomemin^t"
- guifield fogdomemin 5
- guistayopen [ guibutton "- " [fogdomemin (+fround $fogdomemin -0.01)] ]
- guistayopen [ guibutton "+" [fogdomemin (+fround $fogdomemin 0.01)] ]
- ]
- ]
- guilist [
- guilist [
- guitext "fogdomeclip^t"
- guifield fogdomeclip 5
- guistayopen [ guibutton "- " [fogdomeclip (+fround $fogdomeclip -0.01)] ]
- guistayopen [ guibutton "+" [fogdomeclip (+fround $fogdomeclip 0.01)] ]
- ]
-
- guilist [
- guitext "fogdomeheight^t"
- guifield fogdomeheight 5
- guistayopen [ guibutton "- " [fogdomeheight (+fround $fogdomeheight -0.01)] ]
- guistayopen [ guibutton "+" [fogdomeheight (+fround $fogdomeheight 0.01)] ]
- ]
- ]
- ]
- guilist [
- guicheckbox "fogdomecap^t^t^t^t^t^t" "fogdomecap"
- guicheckbox "fogdomeclouds" "fogdomeclouds"
- ]
-
-guitab "height&blendmap" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- guilist [
- guilist [
- guitext "toggle heightmap mode^t^t^f2[H]^t^t^t"
- guitext "push/pull heightmap^t^t^t^f2[mousewheel]"
- ]
- guilist [
- guitext "select heightmap brush^t^f2[B + mousewheel]"
- ]
- ]
- guibar //-------------------------------------------------------------------------
- guitext "blend paint mode"
- guilist [
- guilist [
- guiradio "off^t^t^t^t^t^t^f2[keypad 0]^t" blendpaintmode 0
- guiradio "dig^t^t^t^t^t^t^f2[keypad 2]" blendpaintmode 2
- guiradio "inverted dig^t^t^t^t^f2[keypad 4]" blendpaintmode 4
- ]
- guilist [
- guiradio "replace^t^t^t^t^f2[keypad 1]" blendpaintmode 1
- guiradio "fill^t^t^t^t^t^f2[keypad 3]" blendpaintmode 3
- guiradio "inverted fill^t^t^t^f2[keypad 5]" blendpaintmode 5
- ]
- ]
- guitext "paint blendmap^t^t^t^f2[mouse-left]"
- guibutton "change blend brush^t^t^t^f2[mousewheel]" "nextblendbrush"
- guibutton "rotate blend brush^t^t^t^f2[mouse-right]" "rotateblendbrush"
- guibutton "clear entire blendmap^t^t^f2/clearblendmap" "clearblendmap"
- guibutton "clear blendmap in selection^t^f2/clearblendmapsel" "clearblendmapsel"
-
-guitab "map" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- guitext "save map:"
- guifield savemap_name 20 [ savemap $savemap_name ]
- guibutton [load @savemap_name map] "map $savemap_name"
- guibutton "newmap (default size: 12)" "newmap $newmapsize"
- guislider "newmapsize" 10 16
- guibutton "increase mapsize (2x)" "mapenlarge"
- guitext "max undo size (default: 8 MB)"
- guislider "undomegs" 1 20
- guibutton "optimize geometry" "remip"
- guibutton "set map title/author" "saycommand [/maptitle @maptitle]"
- guibutton "show custom maps" "showcustommaps"
-
-guitab "cfg" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- guitext (mapcfgname)
- showfileeditor (mapcfgname) -80 17
-]
-
-skies1 = [
- skyboxes/black
-]
-
-genskyitems = [
- looplist cursky $arg1 [
- guibutton $cursky (concat skybox $cursky) //"cube"
- ]
-]
-
-showskyshot = [
- guibar
- skyshotname = (checkrolloveraction "skybox " [if (> $numargs 0) [result $arg1] [at $guirollovername 0]])
- guiimage (concatword "<thumbnail:128>packages/" $skyshotname "_ft") (checkrolloveraction "skybox ") 4 1 "data/cube.png" (chopstr $skyshotname -16 "..")
-]
-
-lightingstuff = [
- guitext "lightprecision"
- guilistslider lightprecision "8 16 32 48 64 128 256"
- guitext "lightlod (>= use lightprecision, < use lightprecision/2)"
- guislider lightlod
- guitext "lighterror"
- guislider lighterror
- guitext "lightthreads"
- guislider lightthreads
- guilist [
- guitext "blurskylight^t"
- guiradio "0 " blurskylight 0
- guiradio "1 " blurskylight 1
- guiradio "2 " blurskylight 2
- ]
- guilist [
- guitext "blurlightmaps^t"
- guiradio "0 " blurlms 0
- guiradio "1 " blurlms 1
- guiradio "2 " blurlms 2
- ]
- guibar //-------------------------------------------------------------------------
- guibutton "calclight 1 (slow: 8xAA)" "calclight 1"
- guibutton "calclight -1 (quick: no AA, no model shadows)" "calclight -1"
- guicheckbox "fullbright ^f2[L]" fullbright
-]
-
-maplighting = [showgui _maplighting]
-newgui _maplighting [ ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- _sunlight_r = (& (>> $sunlight 16) 0xFF)
- _sunlight_g = (& (>> $sunlight 8) 0xFF)
- _sunlight_b = (& (>> $sunlight 0) 0xFF)
- guilist [
- guitext "sunlight^t^t^t^t^t^t^t^t"
- guicolor $sunlight
- ]
- guislider _sunlight_r 0 255 [sunlight $_sunlight_r $_sunlight_g $_sunlight_b]
- guislider _sunlight_g 0 255 [sunlight $_sunlight_r $_sunlight_g $_sunlight_b]
- guislider _sunlight_b 0 255 [sunlight $_sunlight_r $_sunlight_g $_sunlight_b]
-
- guilist [
- guitext "sunlightscale "
- guifield sunlightscale 8
- ]
- guitext "sunlightpitch "
- guislider sunlightpitch
- guitext "sunlightyaw "
- guislider sunlightyaw
- guibutton "Get sun pitch & yaw from camera. ^f2/getsundir" "getsundir"
-
- guibar //-------------------------------------------------------------------------
-
- _skylight_r = (& (>> $skylight 16) 0xFF)
- _skylight_g = (& (>> $skylight 8) 0xFF)
- _skylight_b = (& (>> $skylight 0) 0xFF)
- guilist [
- guitext "skylight^t^t^t^t^t^t^t^t"
- guicolor $skylight
- ]
- guislider _skylight_r 0 255 [skylight $_skylight_r $_skylight_g $_skylight_b]
- guislider _skylight_g 0 255 [skylight $_skylight_r $_skylight_g $_skylight_b]
- guislider _skylight_b 0 255 [skylight $_skylight_r $_skylight_g $_skylight_b]
-
- guibar //-------------------------------------------------------------------------
-
- _ambient_r = (& (>> $ambient 16) 0xFF)
- _ambient_g = (& (>> $ambient 8) 0xFF)
- _ambient_b = (& (>> $ambient 0) 0xFF)
- guilist [
- guitext "ambient^t^t^t^t^t^t^t^t"
- guicolor $ambient
- ]
- guislider _ambient_r 0 255 [ambient $_ambient_r $_ambient_g $_ambient_b]
- guislider _ambient_g 0 255 [ambient $_ambient_r $_ambient_g $_ambient_b]
- guislider _ambient_b 0 255 [ambient $_ambient_r $_ambient_g $_ambient_b]
-
-guitab "settings" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- lightingstuff
-
-] "maplighting"
-
-newgui materials [
- guibutton "air" "editmat air"
- guibutton "water" "editmat water"
- guibutton "lava" "editmat lava"
- guibutton "clip" "editmat clip"
- guibutton "glass" "editmat glass"
- guibutton "noclip" "editmat noclip"
- guibutton "gameclip" "editmat gameclip"
- guibutton "death" "editmat death"
- guibutton "alpha" "editmat alpha"
-
- guicheckbox "show material volumes" showmat
-
- //guibutton "waterlod very high (3)" "waterlod 3"
- //guibutton "waterlod high (2)" "waterlod 2"
- //guibutton "waterlod default (1)" "waterlod 1"
- //guibutton "waterlod low (0)" "waterlod 0"
-
- //guibutton "watersubdiv very fine (0)" "watersubdiv 0"
- //guibutton "watersubdiv fine (1)" "watersubdiv 1"
- //guibutton "watersubdiv default (2)" "watersubdiv 2"
- //guibutton "watersubdiv coarse (3)" "watersubdiv 3"
-
- //guibutton "water waves on" "waterwaves 1"
- //guibutton "water waves off" "waterwaves 0"
-]
-
-resetlight = [
- lightcolour = 0
- lightbright = 1
- lightset 255 255 255
- lightradius = 128
-]
-
-lightset = [
- lightr = $arg1
- lightg = $arg2
- lightb = $arg3
- if (= $lightbright 0) lightscale
-]
-
-lightscale = [
- if (= $lightbright 0) [
- lightr = (div $lightr 2); lightg = (div $lightg 2); lightb = (div $lightb 2)
- ] [
- lightr = (min 255 (* $lightr 2)); lightg = (min 255 (* $lightg 2)); lightb = (min 255 (* $lightb 2))
- ]
-]
-
-lightcmd = [
- result (concat newent light $lightradius $lightr $lightg $lightb)
-]
-
-newgui newlight [
- guibutton (lightcmd)
- guibar
- guitext "color:"
- guicolor (+ (* (+ (* $lightr 256) $lightg) 256) $lightb)
- guislider lightr 0 255
- guislider lightg 0 255
- guislider lightb 0 255
- guilist [
- guicheckbox "bright" lightbright 1 0 [lightscale]
- guibar
- guiradio "white" lightcolour 0 [lightset 255 255 255]
- guiradio "blue" lightcolour 1 [lightset 192 192 255]
- guiradio "red" lightcolour 2 [lightset 255 192 192]
- guiradio "green" lightcolour 3 [lightset 192 255 192]
- guiradio "yellow" lightcolour 4 [lightset 255 255 192]
- guiradio "purple" lightcolour 5 [lightset 255 192 255]
- guiradio "turquoise" lightcolour 6 [lightset 192 255 255]
- ]
- guitext "radius:"
- guislider lightradius 0 512
-]
-
-newgui newteleport [
- guibutton "newent teleport 1"
- guibutton "newent teledest 1"
- guibutton "newent teleport 2"
- guibutton "newent teledest 2"
- guibutton "newent teleport 3"
- guibutton "newent teledest 3"
- guibutton "newent teleport 4"
- guibutton "newent teledest 4"
-]
-
getmapmodels = [
loopconcat i $nummapmodels [
if $arg2 [ if (mapmodelloaded $i) [ $arg1 $i ] ] [ $arg1 $i ]
]
]
-newgui postfx [
- guibutton "(effect OFF)" "clearpostfx"
- guibutton "bloom (subtle: 30%)" "bloom 0.3"
- guibutton "bloom (bright: 55%)" "bloom 0.55"
- guibutton "bloom (intense: 80%)" "bloom 0.8"
- guibutton "rotoscope" "rotoscope 1"
- guibutton "rotoscope + blur3" "rotoscope 1 1"
- guibutton "rotoscope + blur5" "rotoscope 1 2"
- guibutton "sobel" "setpostfx sobel"
- guibutton "invert" "setpostfx invert"
- guibutton "gbr" "setpostfx gbr"
- guibutton "bw" "setpostfx bw"
- guibutton "blur3" "setpostfx hblur3; addpostfx vblur3"
- guibutton "blur5" "setpostfx hblur5; addpostfx vblur5"
-]
-
macro resbutton [
guibutton "%1x%2" "screenres %1 %2" (if (&& (= $scr_w %1) (= $scr_h %2)) [result "radio_on"] [result "radio_off"])
]
guitab "hud" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
guicheckbox "show FPS" showfps
guilist [
- guicheckbox "wall clock" wallclock
- if $wallclock [
- guibar
- guicheckbox "24 hour" wallclock24
- guibar
- guicheckbox "seconds" wallclocksecs
- ]
- ]
- guilist [
- guicheckbox "damage screen" damagescreen
- guibar
guicheckbox "damage compass" damagecompass
]
guilist [
guicheckbox "hits" hitcrosshair 425
]
]
- guilist [
- guicheckbox "outline capture meters" outlinemeters
- guibar
- guicheckbox "numbered capture bases" basenumbers
- guibar
- guicheckbox "show teammates" radarteammates 1
- ]
guibar
guilist [
guicheckbox "ammobar^t^t" ammobar
guibar
guiradio "^f2high detail" shaderdetail 3
]
- guilist [
- guitext "water^t^t"
- guibar
- guicheckbox "^f2refraction" waterrefract
- guibar
- guicheckbox "^f3reflection" waterreflect
- guibar
- guicheckbox "^f0caustics" caustics
- guibar
- guicheckbox "^f2animation" vertwater
- ]
- guilist [
- guitext "waterfalls^t^t"
- guibar
- guicheckbox "^f2refraction" waterfallrefract
- guibar
- guicheckbox "^f0reflection" waterfallenv
- ]
guilist [
guicheckbox "^f3soft shadows^t" shadowmap
if $shadowmap [
guibar
]
]
- if $glare [
- glarepreset = 0
- if (= $glarescale 1) [
- if (= $blurglare 4) [glarepreset = 1]
- if (= $blurglare 7) [glarepreset = 3]
- ]
- if (= $glarescale 2) [
- if (= $blurglare 3) [glarepreset = 2]
- if (= $blurglare 7) [glarepreset = 4]
- ]
- guilist [
- guicheckbox "^f3glare^t^t^t" glare
- guibar
- guiradio "^f2subtle" glarepreset 1 [blurglare 4; glarescale 1]
- guibar
- guiradio "^f2glowy" glarepreset 2 [blurglare 3; glarescale 2]
- guibar
- guiradio "^f3soft" glarepreset 3 [blurglare 7; glarescale 1]
- guibar
- guiradio "^f3intense" glarepreset 4 [blurglare 7; glarescale 2]
- ]
- ] [
- guicheckbox "^f3glare" glare
- ]
- guilist [
- guicheckbox "^f3motion blur^t" motionblur
- if $motionblur [
- guibar
- guiradio "^f3subtle" motionblurscale 0.5
- guibar
- guiradio "^f3moderate" motionblurscale 0.65
- guibar
- guiradio "^f3intense" motionblurscale 0.8
- ]
- ]
guilist [
guicheckbox "^f0dynamic lights^t" maxdynlights 3 0
if $maxdynlights [
guiradio "^f3high quality" depthfxsize 12 [blurdepthfx 0]
]
]
- guicheckbox "^f0glass reflection" glassenv
guilist [
guicheckbox "^f0decals^t^t" decals
if $decals [
guilist [
guitext "models^t^t"
guibar
- guicheckbox "^f0reflection" envmapmodels
- guibar
guicheckbox "^f2bumpmap" bumpmodels
]
guitab "display" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
- guitext "field of view (default: 100)"
+ guitext "field of view"
guislider fov
guicheckbox "v-sync" vsync 1 0
guicheckbox "fullscreen" fullscreen
guilistslider soundfreq "11025 22050 44100"
guitext "sound buffer length"
guislider soundbufferlen
- guicheckbox "Mumble positional audio" mumble
guitab "mouse" ////////////////////////////////////////////////////////////////////////////////////////////////////////////
guicheckbox "invert mouse" invmouse
]
] "HUDScore"
-
bindactions = [forward backward left right jump attack togglezoom saycommand sayteamcommand showscores toggleconsole screenshot edittoggle "setweapon FI" "setweapon SG" "setweapon CG" "setweapon RL" "setweapon RI" "setweapon GL" "setweapon PI" "weapon" "universaldelta 1" "universaldelta -1" dropflag addbot delbot]
-entupdate = [ entset $entguitype $entguiattr0 $entguiattr1 $entguiattr2 $entguiattr3 $entguiattr4 ]
-
-initentgui = [
- entguitype = (enttype)
- @(loopconcat i 5 [result [
- entguiattr@i = (entattr @i)
- ]])
-]
-
-genentattributes = [
- entattributes = (loopconcat i (listlen $arg2) [
- entattribname = (at $arg2 $i)
- entattriblimits = (at $arg3 (* 2 $i))
- entattriblimits2 = (at $arg3 (+ 1 (* 2 $i)))
- if (=s (at $entattriblimits 0) $entattriblimits) [
- result [
- guitext @entattribname
- guislider entguiattr@i @entattriblimits @entattriblimits2 entupdate
- ]
- ] [
- result [
- guitext @entattribname
- guinameslider entguiattr@i [@@entattriblimits] [@@entattriblimits2] entupdate
- ]
- ]
- ])
-]
-
guilistsplit = [
guilist [
z = (div (+ (listlen $arg3) (- $arg2 1)) $arg2)
]
]
]
-
-quickeditmenu = [
- guitext "Quick Commands:"
- guibar
- guifield savemap_name 10 [ savemap $savemap_name ]
- guibutton "quick light" "calclight -1"
- guibutton "optimize map" "remip"
- guibutton "new entity" "newent shells"
- guibar
- guibutton newmap
- guibar
- guibutton help "showgui editing"
-]
-
-matmenu = [
- guibutton "air" "editmat air"
- guibutton "water" "editmat water"
- guibutton "lava" "editmat lava"
- guibutton "clip" "editmat clip"
- guibutton "glass" "editmat glass"
- guibutton "noclip" "editmat noclip"
- guibutton "gameclip" "editmat gameclip"
- guibutton "death" "editmat death"
- guibutton "alpha" "editmat alpha"
- guicheckbox "show material volumes" showmat
-]
-
-brushmenu = [
- guilist [ // diamonds
- guiimage "packages/icons/brush_1c.png" brush_0
- guiimage "packages/icons/brush_21c.png" brush_1
- guiimage "packages/icons/brush_421c.png" brush_2
- ]
- guilist [ // squares
- guiimage "packages/icons/brush_3s.png" brush_3
- guiimage "packages/icons/brush_5s.png" brush_4
- guiimage "packages/icons/brush_7s.png" brush_5
- ]
- guititle smooth
- guilist [ // smooth
- guiimage "packages/icons/brush_3s.png" brush_6
- guiimage "packages/icons/brush_5s.png" brush_7
- guiimage "packages/icons/brush_7s.png" brush_8
- ]
-]
-
-newentgui = [
- genentattributes $arg1 $arg2 $arg3
- newgui $arg1 [
- guitext $entguitype
- guibar
- @entattributes
- guitab type
- guilistsplit n 2 $enttypelist [
- guibutton $n [ entset @n ]
- ]
- guitab misc
- @quickeditmenu
- ] "" [initentgui]
-]
-
-looplist i $enttypelist [
- newentgui $i "" ""
-]
-
-newgui materials [
- @matmenu
- guitab misc
- @quickeditmenu
-]
-
-newgui brushes [
- @brushmenu
- guitab misc
- @quickeditmenu
-]
-
-newgui quickedit [
- @quickeditmenu
- guitab materials
- @matmenu
-]
-
-newentgui light "radius red green blue" "1 400 0 255 0 255 0 255"
-newentgui spotlight "radius" "0 200"
-newentgui playerstart "direction" "0 360"
-newentgui teleport "tag" "0 20"
-newentgui teledest "direction tag" "0 360 0 20"
-newentgui monster "direction type" "0 360 0 7"
-newentgui mapmodel "direction model" "0 360 0 372"
-newentgui envmap "radius" "0 512"
-newentgui jumppad "Z Y X" "-128 128 -128 127 -128 127"
-newentgui sound "type radius size" "0 20 0 500 0 500"
-newentgui particles "type" "0 13"
-
-contexteditgui = [
- if $hmapedit [showgui brushes] [
- if (enthavesel) [
- showgui (enttype)
- ] [showgui (? (havesel) materials quickedit)]
- ]
-]
-
-showentgui = [ contexteditgui ] // legacy bind
-
-newgui seltexinfo [
- guitext (concatword "Slot: " (getseltex))
- guilist [ loop x 5 [
- texname = (gettexname (getseltex) $x)
- texname = (substr $texname (+ (strstr $texname ">") 1)) // chop off any leading commands
- guiimage (concatword "packages/" $texname) "" 1 1
- ]]
- loop x 5 [ tex = (gettexname (getseltex) $x); if (strcmp $tex "") [] [guitext $tex]]
-]
-
// implements some editing commands
-
//////// Entity Editing ///////////////
=enttype = [
]
enttypelist = [
- light mapmodel playerstart envmap particles sound
+ light mapmodel playerstart particles sound
shells bullets rockets riflerounds grenades cartridges
- health healthboost greenarmour yellowarmour quaddamage
- teleport teledest
- monster carrot jumppad
- base respawnpoint
+ health healthboost tinyhealth tinyarmour greenarmour yellowarmour quaddamage
+ teleport teledest jumppad
spotlight
- box barrel platform elevator
- flag
]
enttypeselect = [
////// Entity primary actions /////////
-ent_action_base = [ entproperty 0 ( * $arg1 1 ) ]
ent_action_teleport = [ entproperty 0 ( * $arg1 1 ) ]
ent_action_teledest = [ entproperty 1 ( * $arg1 1 ) ]
ent_action_mapmodel = [ entproperty 1 ( * $arg1 1 ) ]
ent_action_spotlight = [ entproperty 0 ( * $arg1 5 ) ]
ent_action_light = [ entproperty 0 ( * $arg1 5 ) ]
ent_action_jumppad = [ entproperty 0 ( * $arg1 5 ) ]
-ent_action_respawnpoint = [ entproperty 0 ( * $arg1 15 ) ]
ent_action_playerstart = [ entproperty 0 ( * $arg1 15 ) ]
-ent_action_envmap = [ entproperty 0 ( * $arg1 5 ) ]
ent_action_particles = [ entproperty 0 ( * $arg1 1 ) ]
ent_action_sound = [ entproperty 0 ( * $arg1 1 ) ]
-ent_action_cycle = [ entset ( if ( > $arg1 -1 ) [ result $arg2 ] [ result $arg3 ] ) ]
-ent_action_shells = [ ent_action_cycle $arg1 bullets quaddamage ]
-ent_action_bullets = [ ent_action_cycle $arg1 rockets shells ]
-ent_action_rockets = [ ent_action_cycle $arg1 riflerounds bullets ]
-ent_action_riflerounds = [ ent_action_cycle $arg1 grenades rockets ]
-ent_action_grenades = [ ent_action_cycle $arg1 cartridges riflerounds ]
-ent_action_cartridges = [ ent_action_cycle $arg1 quaddamage grenades ]
-ent_action_quaddamage = [ ent_action_cycle $arg1 shells cartridges ]
-ent_action_health = [ ent_action_cycle $arg1 healthboost yellowarmour ]
-ent_action_healthboost = [ ent_action_cycle $arg1 greenarmour health ]
-ent_action_greenarmour = [ ent_action_cycle $arg1 yellowarmour healthboost ]
-ent_action_yellowarmour = [ ent_action_cycle $arg1 health greenarmour ]
-ent_action_monster = [ entproperty 1 ( * $arg1 1 ) ]
-ent_action_box = [ entproperty 1 ( * $arg1 1 ) ]
-ent_action_barrel = [ entproperty 1 ( * $arg1 1 ) ]
-ent_action_platform = [ entproperty 1 ( * $arg1 1 ) ]
-ent_action_elevator = [ entproperty 1 ( * $arg1 1 ) ]
//////// Copy and Paste //////////////
// select ents with given properties
// '*' is wildcard
-entfind = [
+entfind = [
if (= $numargs 0) [
entselect 1
] [
]
]
-lse = [
+lse = [
line = ""
count = 0
entloop [
editmove = [ moving 1; onrelease [ moving 0 ]; result $moving ]
entdrag = [ entmoving 1; onrelease [entmoving 0]; result $entmoving ]
editdrag = [ cancelsel; || [entdrag] [ drag ] ]
-selcorners = [ if $hmapedit [ hmapselect ] [ cancelsel; || [entdrag] [ corners ] ] ]
+selcorners = [ cancelsel; || [entdrag] [ corners ] ]
editextend = [ || [entdrag] [ selextend; reorient; editmove ] ]
editmovewith = [
]
]
-entswithdirection = "playerstart teledest mapmodel flag monster box barrel platform elevator"
+entswithdirection = "playerstart teledest mapmodel"
entdirection = [
if ( && [enthavesel] [ = (havesel) 0 ] ) [
if $entselsnap [format "^f2entselsnap"][format "^f4entselsnap"]
)(
if $dropwaypoints [format "^f0dropwaypoints"][]
- )(
- if $hmapedit [format "brush^f2 %1 ^f7:^f2 %2^n" $brushindex $brushname] [
- if $blendpaintmode [
- format "blendpaint mode: ^f2%1^f7^nblend brush: ^f2%2^n" (at $blendpaintmodes $blendpaintmode) (getblendbrushname (curblendbrush))
- ] [if (! (enthavesel)) [
- texnum = (? (>= $texguinum 0) $texguinum (getseltex))
- format "^f2%1 ^f7:^f2 %2^n" (max 0 $texnum) (gettexname $texnum)
- ]]
- ]
)(
if (enthavesel) [concat (entget) ":^f2" (enthavesel) "^f7selected^n"]
)
entcomplete entfind
entcomplete clearents
-listcomplete editmat "air water clip glass noclip lava gameclip death alpha"
+listcomplete editmat "air clip noclip gameclip death alpha"
air = [ editmat air $arg1 ]
-loop i 4 [
- [water@(? $i (+ $i 1))] = [ editmat water@(? $i (+ $i 1)) $arg1 ]
- [lava@(? $i (+ $i 1))] = [ editmat lava@(? $i (+ $i 1)) $arg1 ]
- [glass@(? $i (+ $i 1))] = [ editmat glass@(? $i (+ $i 1)) $arg1 ]
-]
clip = [ editmat clip $arg1 ]
noclip = [ editmat noclip $arg1 ]
gameclip = [ editmat gameclip $arg1 ]
death = [ editmat death $arg1 ]
alpha = [ editmat alpha $arg1 ]
-blendpaintmodes = ["off" "replace" "dig" "fill" "inverted dig" "inverted fill"]
-setblendpaintmode = [
- if (> $numargs 0) [blendpaintmode $arg1] [blendpaintmode 0]
- echo "blend paint mode set to:" (at $blendpaintmodes $blendpaintmode)
-]
-scrollblendbrush = [
- if (> $numargs 0) [nextblendbrush $arg1] [nextblendbrush]
- echo "blend brush set to:" (getblendbrushname (curblendbrush))
-]
-
-minimaphere = [minimapheight (at (getcampos) 2)]
-
-getsundir = [sunlightyaw (getcamyaw); sunlightpitch (getcampitch)]
-
echovcolor = [echo ***vcolor (getvcolor $getseltex)]
echovrotate = [echo ***vrotate (getvrotate $getseltex)]
echovoffset = [echo ***voffset (getvoffset $getseltex)]
echovscale = [echo ***vscale (getvscale $getseltex)]
echovlayer = [echo ***vlayer (getvlayer $getseltex)]
echovalpha = [echo ***valpha (getvalpha $getseltex)]
-
-// echovshaderparamname = [echo (getvshaderparamnames $getseltex)] // Echoes the name of altered vshaderparam, if used. Only works with vshaderparam, not params set in map.cfg
-echovshaderparam = [echo ***vshaderparam (getvshaderparamnames $getseltex) (getvshaderparam $getseltex (getvshaderparamnames $getseltex))] // Only works with vshaderparam, not params set in map.cfg
-// echovshaderparamenvscale = [echo ***shaderparam envscale (getvshaderparam $getseltex envscale)]
-// echovshaderparamglowcolor = [echo ***shaderparam glowcolor (getvshaderparam $getseltex glowcolor)]
-// echovshaderparamparallaxscale = [echo ***shaderparam parallaxscale (getvshaderparam $getseltex parallaxscale)]
-// echovshaderparampulseglowcolor = [echo ***shaderparam pulseglowcolor (getvshaderparam $getseltex pulseglowcolor)]
-// echovshaderparampulseglowspeed = [echo ***shaderparam pulseglowspeed (getvshaderparam $getseltex pulseglowspeed)]
-// echovshaderparampulsespeed = [echo ***shaderparam pulsespeed (getvshaderparam $getseltex pulsespeed)]
-// echovshaderparamspecscale = [echo ***shaderparam specscale (getvshaderparam $getseltex specscale)]
-
-findpickupents = [entfind shells;entfind bullets;entfind rockets;entfind riflerounds;entfind grenades;entfind cartridges;entfind greenarmour;entfind yellowarmour;entfind health;entfind healthboost;entfind quaddamage;]
-
-prettysky = [
- skybox "skyboxes/remus/sky01"
- ambient 25 21 23
- skylight 148 153 163
- blurskylight 2
- sunlight 255 252 250
- sunlightscale 1.3
- sunlightpitch 43
- sunlightyaw 53
-]
-
]
quine = [ echo (format "quine = [%1]" $quine) ]
-
-loadsky = [
- skybox $arg1
- if (> $numargs 1) [
- spinsky $arg2
- ] [
- if (!=f $spinsky 0) [spinsky 0]
- ]
-]
-
-mapmsg = [ maptitle $arg1 ]
#undef GENFACEVERT
}
}
- else if(cu.texture[orient] == DEFAULT_SKY) return;
else if(cu.ext && (numverts = cu.ext->surfaces[orient].numverts&MAXFACEVERTS))
{
vertinfo *verts = cu.ext->verts() + cu.ext->surfaces[orient].verts;
extern uchar *loadalphamask(Texture *t);
extern void loadlayermasks();
extern Texture *cubemapload(const char *name, bool mipit = true, bool msg = true, bool transient = false);
-extern void drawcubemap(int size, const vec &o, float yaw, float pitch, const cubemapside &side, bool onlysky = false);
extern void loadshaders();
extern void setuptexparameters(int tnum, void *pixels, int clamp, int filter, GLenum format = GL_RGB, GLenum target = GL_TEXTURE_2D, bool swizzle = false);
extern void createtexture(int tnum, int w, int h, void *pixels, int clamp, int filter, GLenum component = GL_RGB, GLenum target = GL_TEXTURE_2D, int pw = 0, int ph = 0, int pitch = 0, bool resize = true, GLenum format = GL_FALSE, bool swizzle = false);
extern void setvfcP(float z = -1, const vec &bbmin = vec(-1, -1, -1), const vec &bbmax = vec(1, 1, 1));
extern void savevfcP();
extern void restorevfcP();
-extern void rendergeom(bool fogpass = false);
-extern void renderalphageom(bool fogpass = false);
+extern void rendergeom(void);
+extern void renderalphageom(void);
extern void rendermapmodels();
extern void renderoutline();
-extern bool rendersky(bool explicitonly = false);
extern int isvisiblesphere(float rad, const vec &cv);
extern bool bboccluded(const ivec &bo, const ivec &br);
int aasample = min(1 << lmaa, 4);
int stride = aasample*(w->w+1);
vec *sample = w->colordata;
- uchar *skylight = w->ambient;
+ uchar *amb = w->ambient;
lerpbounds start, end;
initlerpbounds(-blurlms, -blurlms, lv, numv, start, end);
float sidex = side0 + blurlms*sidestep;
vec normal, nstep;
lerpnormal(-blurlms, y - blurlms, lv, numv, start, end, normal, nstep);
- for(int x = 0; x < w->w; ++x, normal.add(nstep), skylight += w->bpp)
+ for(int x = 0; x < w->w; ++x, normal.add(nstep), amb += w->bpp)
{
#define EDGE_TOLERANCE(x, y) \
(x < blurlms \
}
}
int usefacemask = 0;
- loopj(6) if(c[i].texture[j] != DEFAULT_SKY && (!(c[i].merged&(1<<j)) || (c[i].ext && c[i].ext->surfaces[j].numverts&MAXFACEVERTS)))
+ loopj(6) if(!(c[i].merged&(1<<j)) || (c[i].ext && c[i].ext->surfaces[j].numverts&MAXFACEVERTS))
{
usefacemask |= visibletris(c[i], j, o, size)<<(4*j);
}
if(isempty(c) || c.material&MAT_ALPHA) return false;
int usefacemask = 0;
- loopi(6) if(c.texture[i] != DEFAULT_SKY && lookupvslot(c.texture[i], false).layer)
+ loopi(6) if(lookupvslot(c.texture[i], false).layer)
usefacemask |= visibletris(c, i, co, size)<<(4*i);
if(!usefacemask) return false;
extern void cleanupva();
extern void cleanupparticles();
extern void cleanupdecals();
- extern void cleanupsky();
extern void cleanupmodels();
extern void cleanupprefabs();
extern void cleanuplightmaps();
cleanupva();
cleanupparticles();
cleanupdecals();
- cleanupsky();
cleanupmodels();
cleanupprefabs();
cleanuptextures();
execfile("data/stdedit.cfg");
execfile("data/sounds.cfg");
execfile("data/menus.cfg");
- execfile("data/heightmap.cfg");
- execfile("data/brushes.cfg");
execfile("data/game.cfg");
execfile("data/custom_maps_menu.cfg");
if(game::savedservers()) execfile(game::savedservers(), false);
} materials[] =
{
{"air", MAT_AIR},
- {"water", MAT_WATER}, {"water1", MAT_WATER}, {"water2", MAT_WATER+1}, {"water3", MAT_WATER+2}, {"water4", MAT_WATER+3},
- {"glass", MAT_GLASS}, {"glass1", MAT_GLASS}, {"glass2", MAT_GLASS+1}, {"glass3", MAT_GLASS+2}, {"glass4", MAT_GLASS+3},
- {"lava", MAT_LAVA}, {"lava1", MAT_LAVA}, {"lava2", MAT_LAVA+1}, {"lava3", MAT_LAVA+2}, {"lava4", MAT_LAVA+3},
{"clip", MAT_CLIP},
{"noclip", MAT_NOCLIP},
{"gameclip", MAT_GAMECLIP},
case MAT_AIR:
break;
- case MAT_LAVA:
- case MAT_WATER:
- if(visibleface(c, orient, co, size, mat, MAT_AIR, matmask))
- return (orient != O_BOTTOM ? MATSURF_VISIBLE : MATSURF_EDIT_ONLY);
- break;
-
- case MAT_GLASS:
- if(visibleface(c, orient, co, size, MAT_GLASS, MAT_AIR, matmask))
- return MATSURF_VISIBLE;
- break;
-
default:
if(visibleface(c, orient, co, size, mat, MAT_AIR, matmask))
return MATSURF_EDIT_ONLY;
cur->visible == start->visible &&
cur->o[dim] == start->o[dim])
++cur;
- if(start->orient != O_TOP || !vertwater)
+ if(start->orient != O_TOP)
{
if(start!=matbuf) memmove(matbuf, start, (cur-start)*sizeof(materialsurface));
matbuf += mergemats(matbuf, cur-start);
static inline bool vismatcmp(const materialsurface *xm, const materialsurface *ym)
{
const materialsurface &x = *xm, &y = *ym;
- if(!sortedit)
- {
- if((x.material&MATF_VOLUME) == MAT_LAVA) { if((y.material&MATF_VOLUME) != MAT_LAVA) return true; }
- else if((y.material&MATF_VOLUME) == MAT_LAVA) return false;
- }
int xdim = dimension(x.orient), ydim = dimension(y.orient);
loopi(3)
{
{
int matvol = m.material&MATF_VOLUME;
if(m.visible == MATSURF_EDIT_ONLY) { i += m.skip; continue; }
- if(glaring && matvol!=MAT_LAVA) { i += m.skip; continue; }
}
else if(glaring) continue;
vismats.add(&m);
{
switch(m.material&~MATF_INDEX)
{
- case MAT_WATER: color = bvec4( 0, 0, 85, 255); break; // blue
case MAT_CLIP: color = bvec4(85, 0, 0, 255); break; // red
- case MAT_GLASS: color = bvec4( 0, 85, 85, 255); break; // cyan
case MAT_NOCLIP: color = bvec4( 0, 85, 0, 255); break; // green
- case MAT_LAVA: color = bvec4(85, 40, 0, 255); break; // orange
case MAT_GAMECLIP: color = bvec4(85, 85, 0, 255); break; // yellow
case MAT_DEATH: color = bvec4(40, 40, 40, 255); break; // black
case MAT_ALPHA: color = bvec4(85, 0, 85, 255); break; // pink
disablepolygonoffset(GL_POLYGON_OFFSET_LINE);
}
-#define GLASSVARS(name) \
- bvec name##color(0x20, 0x80, 0xC0); \
- HVARFR(name##colour, 0, 0x2080C0, 0xFFFFFF, \
- { \
- if(!name##colour) name##colour = 0x2080C0; \
- name##color = bvec((name##colour>>16)&0xFF, (name##colour>>8)&0xFF, name##colour&0xFF); \
- });
-
-GLASSVARS(glass)
-GLASSVARS(glass2)
-GLASSVARS(glass3)
-GLASSVARS(glass4)
-
-GETMATIDXVAR(glass, colour, int)
-GETMATIDXVAR(glass, color, const bvec &)
-
-VARP(glassenv, 0, 1, 1);
-
-static void drawglass(const materialsurface &m, float offset)
-{
- if(gle::attribbuf.empty())
- {
- gle::defvertex();
- gle::defnormal(4, GL_BYTE);
- gle::begin(GL_QUADS);
- }
- float x = m.o.x, y = m.o.y, z = m.o.z, csize = m.csize, rsize = m.rsize;
- switch(m.orient)
- {
- #define GENFACEORIENT(orient, v0, v1, v2, v3) \
- case orient: v0 v1 v2 v3 break;
- #define GENFACEVERT(orient, vert, mx,my,mz, sx,sy,sz) \
- { \
- gle::attribf(mx sx, my sy, mz sz); \
- gle::attrib(matnormals[orient]); \
- }
- GENFACEVERTS(x, x, y, y, z, z, /**/, + csize, /**/, + rsize, + offset, - offset)
- #undef GENFACEORIENT
- #undef GENFACEVERT
- }
-}
-
-static inline void changematerial(int mat, int orient)
-{
- switch(mat&~MATF_INDEX)
- {
- case MAT_LAVA:
- if(orient==O_TOP) flushlava();
- else xtraverts += gle::end();
- break;
- default:
- xtraverts += gle::end();
- break;
- }
-}
-
void rendermaterials()
{
vector<materialsurface *> vismats;
{
switch(m.material&~MATF_INDEX)
{
- case MAT_WATER: color = bvec4(255, 128, 0, 255); break; // blue
case MAT_CLIP: color = bvec4( 0, 255, 255, 255); break; // red
- case MAT_GLASS: color = bvec4(255, 0, 0, 255); break; // cyan
case MAT_NOCLIP: color = bvec4(255, 0, 255, 255); break; // green
- case MAT_LAVA: color = bvec4( 0, 128, 255, 255); break; // orange
case MAT_GAMECLIP: color = bvec4( 0, 0, 255, 255); break; // yellow
case MAT_DEATH: color = bvec4(192, 192, 192, 255); break; // black
case MAT_ALPHA: color = bvec4( 0, 255, 0, 255); break; // pink
xtraverts += gle::end();
}
- if(lastorient >= 0) changematerial(lastmat, lastorient);
+ if(lastorient >= 0)
+ if(lastmat&~MATF_INDEX)
+ xtraverts += gle::end();
if(!depth) glDepthMask(GL_TRUE);
if(blended) glDisable(GL_BLEND);
extern int wireframe;
if(editmode && showmat && !drawtex && !wireframe)
- {
rendermatgrid(vismats);
- }
glEnable(GL_CULL_FACE);
}
loopi(6) if((vis = visibletris(c, i, o, size)))
{
CHECK_CALCLIGHT_PROGRESS(return, show_addnormals_progress);
- if(c.texture[i] == DEFAULT_SKY) continue;
vec planes[2];
int numverts = c.ext ? c.ext->surfaces[i].numverts&MAXFACEVERTS : 0, convex = 0, numplanes = 0;
continue;
}
int tex = c[n].texture[orient];
- if(tex > DEFAULT_SKY) loopi(numtexs) if(texs[i] == tex) return tex;
+ loopi(numtexs) if(texs[i] == tex) return tex;
texs[numtexs++] = tex;
}
- loopirev(numtexs) if(!i || texs[i] > DEFAULT_SKY) return texs[i];
+ loopirev(numtexs) if(!i) return texs[i];
return DEFAULT_GEOM;
}
{
if(nmat != MAT_AIR && (o.material&matmask) == nmat) return true;
if(isentirelysolid(o)) return false;
- if(mat != MAT_AIR && ((o.material&matmask) == mat || ((o.material&MATF_VOLUME) == MAT_GLASS))) return false;
if(isempty(o) || notouchingface(o, opp)) return true;
if(touchingface(o, opp) && faceedges(o, opp) == F_SOLID) return false;
{
EMID_NONE = 0,
EMID_CUSTOM,
- EMID_SKY,
EMID_RESERVED
};
vtxarray *next, *rnext; // linked list of visible VOBs
vertex *vdata; // vertex data
ushort voffset; // offset into vertex data
- ushort *edata, *skydata; // vertex indices
- GLuint vbuf, ebuf, skybuf; // VBOs
+ ushort *edata; // vertex indices
+ GLuint vbuf, ebuf; // VBOs
ushort minvert, maxvert; // DRE info
elementset *eslist; // List of element indices sets (range) per texture
materialsurface *matbuf; // buffer of material surfaces
- int verts, tris, texs, blendtris, blends, alphabacktris, alphaback, alphafronttris, alphafront, alphatris, texmask, sky, explicitsky, skyfaces, skyclip, matsurfs, distance;
- double skyarea;
+ int verts, tris, texs, blendtris, blends, alphabacktris, alphaback, alphafronttris, alphafront, alphatris, texmask, matsurfs, distance;
ivec o;
int size; // location and size of cube.
ivec geommin, geommax; // BB of geom
{
VFC_FULL_VISIBLE = 0,
VFC_PART_VISIBLE,
- VFC_FOGGED,
VFC_NOT_VISIBLE,
PVS_FULL_VISIBLE,
- PVS_PART_VISIBLE,
- PVS_FOGGED
+ PVS_PART_VISIBLE
};
#define GENCUBEVERTS(x0,x1, y0,y1, z0,z1) \
extern int entediting;
bool editmode = false;
bool havesel = false;
-bool hmapsel = false;
-int horient = 0;
extern int entmoving;
VAR(passthroughsel, 0, 0, 1);
VAR(editing, 1, 0, 0);
VAR(selectcorners, 0, 0, 1);
-VARF(hmapedit, 0, 0, 1, horient = sel.orient);
void forcenextundo() { lastsel.orient = -1; }
-extern void hmapcancel();
-
void cubecancel()
{
havesel = false;
- moving = dragging = hmapedit = passthroughsel = 0;
+ moving = dragging = passthroughsel = 0;
forcenextundo();
- hmapcancel();
}
void cancelsel()
return true;
}
-inline bool isheightmap(int orient, int d, bool empty, cube *c);
extern void entdrag(const vec &ray);
extern bool hoveringonent(int ent, int orient);
extern void renderentselection(const vec &o, const vec &ray, bool entmoving);
odc = dimcoord(orient);
bool hidecursor = g3d_windowhit(true, false) || blendpaintmode, hovering = false;
- hmapsel = false;
if(moving)
{
| RAY_SKIPFIRST
| (passthroughcube || passthrough ? RAY_PASS : 0), gridsize, entorient, ent);
- if((havesel || dragging) && !passthroughsel && !hmapedit) // now try selecting the selection
+ if((havesel || dragging) && !passthroughsel) // now try selecting the selection
if(rayboxintersect(vec(sel.o), vec(sel.s).mul(sel.grid), player->o, camdir, sdist, orient))
{ // and choose the nearest of the two
if(sdist < wdist)
}
}
cube *c = &lookupcube(ivec(w));
- if(gridlookup && !dragging && !moving && !havesel && hmapedit!=1) gridsize = lusize;
+ if(gridlookup && !dragging && !moving && !havesel) gridsize = lusize;
int mag = lusize / gridsize;
normalizelookupcube(ivec(w));
if(sdist == 0 || sdist > wdist) rayboxintersect(vec(lu), vec(gridsize), player->o, camdir, t=0, orient); // just getting orient
od = dimension(orient);
d = dimension(sel.orient);
- if(hmapedit==1 && dimcoord(horient) == (camdir[dimension(horient)]<0))
- {
- hmapsel = isheightmap(horient, dimension(horient), false, c);
- if(hmapsel)
- od = dimension(orient = horient);
- }
-
if(dragging)
{
updateselection();
if(!moving && !hovering && !hidecursor)
{
- if(hmapedit==1)
- gle::colorub(0, hmapsel ? 255 : 40, 0);
- else
- gle::colorub(120,120,120);
+ gle::colorub(120,120,120);
boxs(orient, vec(lu), vec(lusize));
}
cs[C[d]] = 0.5f*(sel.cys*gridsize);
cs[D[d]] *= gridsize;
boxs(sel.orient, co, cs);
- if(hmapedit==1) // 3D selection box
- gle::colorub(0,120,0);
- else
- gle::colorub(0,0,120);
+ gle::colorub(0,0,120);
boxs3D(vec(sel.o), vec(sel.s), sel.grid);
}
freeundo(u);
}
commitchanges();
- if(!hmapsel)
- {
- sel = l;
- reorient();
- }
+ sel = l;
+ reorient();
forcenextundo();
}
VSlot &vs = *lookupslot(hdr.slot, false).variants;
VSlot ds;
if(!unpackvslot(buf, ds, false)) break;
- if(vs.index < 0 || vs.index == DEFAULT_SKY) continue;
+ if(vs.index < 0) continue;
VSlot *edit = editvslot(vs, ds);
unpackingvslots.add(vslotmap(hdr.index, edit ? edit : &vs));
}
compactvslots(u->block()->c(), u->block()->size());
}
-///////////// height maps ////////////////
-
-#define MAXBRUSH 64
-#define MAXBRUSHC 63
-#define MAXBRUSH2 32
-int brush[MAXBRUSH][MAXBRUSH];
-VAR(brushx, 0, MAXBRUSH2, MAXBRUSH);
-VAR(brushy, 0, MAXBRUSH2, MAXBRUSH);
-bool paintbrush = 0;
-int brushmaxx = 0, brushminx = MAXBRUSH;
-int brushmaxy = 0, brushminy = MAXBRUSH;
-
-void clearbrush()
-{
- memset(brush, 0, sizeof brush);
- brushmaxx = brushmaxy = 0;
- brushminx = brushminy = MAXBRUSH;
- paintbrush = false;
-}
-
-void brushvert(int *x, int *y, int *v)
-{
- *x += MAXBRUSH2 - brushx + 1; // +1 for automatic padding
- *y += MAXBRUSH2 - brushy + 1;
- if(*x<0 || *y<0 || *x>=MAXBRUSH || *y>=MAXBRUSH) return;
- brush[*x][*y] = clamp(*v, 0, 8);
- paintbrush = paintbrush || (brush[*x][*y] > 0);
- brushmaxx = min(MAXBRUSH-1, max(brushmaxx, *x+1));
- brushmaxy = min(MAXBRUSH-1, max(brushmaxy, *y+1));
- brushminx = max(0, min(brushminx, *x-1));
- brushminy = max(0, min(brushminy, *y-1));
-}
-
-vector<int> htextures;
-
-COMMAND(clearbrush, "");
-COMMAND(brushvert, "iii");
-void hmapcancel() { htextures.setsize(0); }
-COMMAND(hmapcancel, "");
-ICOMMAND(hmapselect, "", (),
- int t = lookupcube(cur).texture[orient];
- int i = htextures.find(t);
- if(i<0)
- htextures.add(t);
- else
- htextures.remove(i);
-);
-
-inline bool isheightmap(int o, int d, bool empty, cube *c)
-{
- return havesel ||
- (empty && isempty(*c)) ||
- htextures.empty() ||
- htextures.find(c->texture[o]) >= 0;
-}
-
-namespace hmap
-{
-# define PAINTED 1
-# define NOTHMAP 2
-# define MAPPED 16
- uchar flags[MAXBRUSH][MAXBRUSH];
- cube *cmap[MAXBRUSHC][MAXBRUSHC][4];
- int mapz[MAXBRUSHC][MAXBRUSHC];
- int map [MAXBRUSH][MAXBRUSH];
-
- selinfo changes;
- bool selecting;
- int d, dc, dr, dcr, biasup, br, hws, fg;
- int gx, gy, gz, mx, my, mz, nx, ny, nz, bmx, bmy, bnx, bny;
- uint fs;
- selinfo hundo;
-
- cube *getcube(ivec t, int f)
- {
- t[d] += dcr*f*gridsize;
- if(t[d] > nz || t[d] < mz) return NULL;
- cube *c = &lookupcube(t, gridsize);
- if(c->children) forcemip(*c, false);
- discardchildren(*c, true);
- if(!isheightmap(sel.orient, d, true, c)) return NULL;
- if (t.x < changes.o.x) changes.o.x = t.x;
- else if(t.x > changes.s.x) changes.s.x = t.x;
- if (t.y < changes.o.y) changes.o.y = t.y;
- else if(t.y > changes.s.y) changes.s.y = t.y;
- if (t.z < changes.o.z) changes.o.z = t.z;
- else if(t.z > changes.s.z) changes.s.z = t.z;
- return c;
- }
-
- uint getface(cube *c, int d)
- {
- return 0x0f0f0f0f & ((dc ? c->faces[d] : 0x88888888 - c->faces[d]) >> fs);
- }
-
- void pushside(cube &c, int d, int x, int y, int z)
- {
- ivec a;
- getcubevector(c, d, x, y, z, a);
- a[R[d]] = 8 - a[R[d]];
- setcubevector(c, d, x, y, z, a);
- }
-
- void addpoint(int x, int y, int z, int v)
- {
- if(!(flags[x][y] & MAPPED))
- map[x][y] = v + (z*8);
- flags[x][y] |= MAPPED;
- }
-
- void select(int x, int y, int z)
- {
- if((NOTHMAP & flags[x][y]) || (PAINTED & flags[x][y])) return;
- ivec t(d, x+gx, y+gy, dc ? z : hws-z);
- t.shl(gridpower);
-
- // selections may damage; must makeundo before
- hundo.o = t;
- hundo.o[D[d]] -= dcr*gridsize*2;
- makeundo(hundo);
-
- cube **c = cmap[x][y];
- loopk(4) c[k] = NULL;
- c[1] = getcube(t, 0);
- if(!c[1] || !isempty(*c[1]))
- { // try up
- c[2] = c[1];
- c[1] = getcube(t, 1);
- if(!c[1] || isempty(*c[1])) { c[0] = c[1]; c[1] = c[2]; c[2] = NULL; }
- else { z++; t[d]+=fg; }
- }
- else // drop down
- {
- z--;
- t[d]-= fg;
- c[0] = c[1];
- c[1] = getcube(t, 0);
- }
-
- if(!c[1] || isempty(*c[1])) { flags[x][y] |= NOTHMAP; return; }
-
- flags[x][y] |= PAINTED;
- mapz [x][y] = z;
-
- if(!c[0]) c[0] = getcube(t, 1);
- if(!c[2]) c[2] = getcube(t, -1);
- c[3] = getcube(t, -2);
- c[2] = !c[2] || isempty(*c[2]) ? NULL : c[2];
- c[3] = !c[3] || isempty(*c[3]) ? NULL : c[3];
-
- uint face = getface(c[1], d);
- if(face == 0x08080808 && (!c[0] || !isempty(*c[0]))) { flags[x][y] |= NOTHMAP; return; }
- if(c[1]->faces[R[d]] == F_SOLID) // was single
- face += 0x08080808;
- else // was pair
- face += c[2] ? getface(c[2], d) : 0x08080808;
- face += 0x08080808; // c[3]
- uchar *f = (uchar*)&face;
- addpoint(x, y, z, f[0]);
- addpoint(x+1, y, z, f[1]);
- addpoint(x, y+1, z, f[2]);
- addpoint(x+1, y+1, z, f[3]);
-
- if(selecting) // continue to adjacent cubes
- {
- if(x>bmx) select(x-1, y, z);
- if(x<bnx) select(x+1, y, z);
- if(y>bmy) select(x, y-1, z);
- if(y<bny) select(x, y+1, z);
- }
- }
-
- void ripple(int x, int y, int z, bool force)
- {
- if(force) select(x, y, z);
- if((NOTHMAP & flags[x][y]) || !(PAINTED & flags[x][y])) return;
-
- bool changed = false;
- int *o[4], best, par, q = 0;
- loopi(2) loopj(2) o[i+j*2] = &map[x+i][y+j];
- #define pullhmap(I, LT, GT, M, N, A) do { \
- best = I; \
- loopi(4) if(*o[i] LT best) best = *o[q = i] - M; \
- par = (best&(~7)) + N; \
- /* dual layer for extra smoothness */ \
- if(*o[q^3] GT par && !(*o[q^1] LT par || *o[q^2] LT par)) { \
- if(*o[q^3] GT par A 8 || *o[q^1] != par || *o[q^2] != par) { \
- *o[q^3] = (*o[q^3] GT par A 8 ? par A 8 : *o[q^3]); \
- *o[q^1] = *o[q^2] = par; \
- changed = true; \
- } \
- /* single layer */ \
- } else { \
- loopj(4) if(*o[j] GT par) { \
- *o[j] = par; \
- changed = true; \
- } \
- } \
- } while(0)
-
- if(biasup)
- pullhmap(0, >, <, 1, 0, -);
- else
- pullhmap(worldsize*8, <, >, 0, 8, +);
-
- cube **c = cmap[x][y];
- int e[2][2];
- int notempty = 0;
-
- loopk(4) if(c[k]) {
- loopi(2) loopj(2) {
- e[i][j] = min(8, map[x+i][y+j] - (mapz[x][y]+3-k)*8);
- notempty |= e[i][j] > 0;
- }
- if(notempty)
- {
- c[k]->texture[sel.orient] = c[1]->texture[sel.orient];
- solidfaces(*c[k]);
- loopi(2) loopj(2)
- {
- int f = e[i][j];
- if(f<0 || (f==0 && e[1-i][j]==0 && e[i][1-j]==0))
- {
- f=0;
- pushside(*c[k], d, i, j, 0);
- pushside(*c[k], d, i, j, 1);
- }
- edgeset(cubeedge(*c[k], d, i, j), dc, dc ? f : 8-f);
- }
- }
- else
- emptyfaces(*c[k]);
- }
-
- if(!changed) return;
- if(x>mx) ripple(x-1, y, mapz[x][y], true);
- if(x<nx) ripple(x+1, y, mapz[x][y], true);
- if(y>my) ripple(x, y-1, mapz[x][y], true);
- if(y<ny) ripple(x, y+1, mapz[x][y], true);
-
-#define DIAGONAL_RIPPLE(a,b,exp) if(exp) { \
- if(flags[x a][ y] & PAINTED) \
- ripple(x a, y b, mapz[x a][y], true); \
- else if(flags[x][y b] & PAINTED) \
- ripple(x a, y b, mapz[x][y b], true); \
- }
-
- DIAGONAL_RIPPLE(-1, -1, (x>mx && y>my)); // do diagonals because adjacents
- DIAGONAL_RIPPLE(-1, +1, (x>mx && y<ny)); // won't unless changed
- DIAGONAL_RIPPLE(+1, +1, (x<nx && y<ny));
- DIAGONAL_RIPPLE(+1, -1, (x<nx && y>my));
- }
-
-#define loopbrush(i) for(int x=bmx; x<=bnx+i; x++) for(int y=bmy; y<=bny+i; y++)
-
- void paint()
- {
- loopbrush(1)
- map[x][y] -= dr * brush[x][y];
- }
-
- void smooth()
- {
- int sum, div;
- loopbrush(-2)
- {
- sum = 0;
- div = 9;
- loopi(3) loopj(3)
- if(flags[x+i][y+j] & MAPPED)
- sum += map[x+i][y+j];
- else div--;
- if(div)
- map[x+1][y+1] = sum / div;
- }
- }
-
- void rippleandset()
- {
- loopbrush(0)
- ripple(x, y, gz, false);
- }
-
- void run(int dir, int mode)
- {
- d = dimension(sel.orient);
- dc = dimcoord(sel.orient);
- dcr= dc ? 1 : -1;
- dr = dir>0 ? 1 : -1;
- br = dir>0 ? 0x08080808 : 0;
- // biasup = mode == dir<0;
- biasup = dir<0;
- bool paintme = paintbrush;
- int cx = (sel.corner&1 ? 0 : -1);
- int cy = (sel.corner&2 ? 0 : -1);
- hws= (worldsize>>gridpower);
- gx = (cur[R[d]] >> gridpower) + cx - MAXBRUSH2;
- gy = (cur[C[d]] >> gridpower) + cy - MAXBRUSH2;
- gz = (cur[D[d]] >> gridpower);
- fs = dc ? 4 : 0;
- fg = dc ? gridsize : -gridsize;
- mx = max(0, -gx); // ripple range
- my = max(0, -gy);
- nx = min(MAXBRUSH-1, hws-gx) - 1;
- ny = min(MAXBRUSH-1, hws-gy) - 1;
- if(havesel)
- { // selection range
- bmx = mx = max(mx, (sel.o[R[d]]>>gridpower)-gx);
- bmy = my = max(my, (sel.o[C[d]]>>gridpower)-gy);
- bnx = nx = min(nx, (sel.s[R[d]]+(sel.o[R[d]]>>gridpower))-gx-1);
- bny = ny = min(ny, (sel.s[C[d]]+(sel.o[C[d]]>>gridpower))-gy-1);
- }
- if(havesel && mode<0) // -ve means smooth selection
- paintme = false;
- else
- { // brush range
- bmx = max(mx, brushminx);
- bmy = max(my, brushminy);
- bnx = min(nx, brushmaxx-1);
- bny = min(ny, brushmaxy-1);
- }
- nz = worldsize-gridsize;
- mz = 0;
- hundo.s = ivec(d,1,1,5);
- hundo.orient = sel.orient;
- hundo.grid = gridsize;
- forcenextundo();
-
- changes.grid = gridsize;
- changes.s = changes.o = cur;
- memset(map, 0, sizeof map);
- memset(flags, 0, sizeof flags);
-
- selecting = true;
- select(clamp(MAXBRUSH2-cx, bmx, bnx),
- clamp(MAXBRUSH2-cy, bmy, bny),
- dc ? gz : hws - gz);
- selecting = false;
- if(paintme)
- paint();
- else
- smooth();
- rippleandset(); // pull up points to cubify, and set
- changes.s.sub(changes.o).shr(gridpower).add(1);
- changed(changes);
- }
-}
-
-void edithmap(int dir, int mode) {
- if((nompedit && multiplayer()) || !hmapsel) return;
- hmap::run(dir, mode);
-}
-
///////////// main cube edit ////////////////
int bounded(int n) { return n<0 ? 0 : (n>8 ? 8 : n); }
void editface(int *dir, int *mode)
{
if(noedit(moving!=0)) return;
- if(hmapedit!=1)
- mpeditface(*dir, *mode, sel, true);
- else
- edithmap(*dir, *mode);
+ mpeditface(*dir, *mode, sel, true);
}
VAR(selectionsurf, 0, 0, 1);
{
loopv(remappedvslots) if(remappedvslots[i].index == index) return remappedvslots[i].vslot;
VSlot &vs = lookupvslot(index, false);
- if(vs.index < 0 || vs.index == DEFAULT_SKY) return NULL;
+ if(vs.index < 0) return NULL;
VSlot *edit = NULL;
if(delta)
{
VSlot ds;
if(!unpackvslot(buf, ds, false)) return false;
VSlot &vs = *lookupslot(tex & 0xFFFF, false).variants;
- if(vs.index < 0 || vs.index == DEFAULT_SKY) return false;
+ if(vs.index < 0) return false;
VSlot *edit = insert ? editvslot(vs, ds) : findvslot(*vs.slot, vs, ds);
if(!edit) return false;
tex = edit->index;
{
VBO_VBUF = 0,
VBO_EBUF,
- VBO_SKYBUF,
NUMVBO
};
case VBO_EBUF:
va->ebuf = vbo;
break;
- case VBO_SKYBUF:
- va->skybuf = vbo;
- break;
}
}
}
vector<sortkey> texs;
vector<materialsurface> matsurfs;
vector<octaentities *> mapmodels;
- vector<ushort> skyindices, explicitskyindices;
- vector<facebounds> skyfaces[6];
- int worldtris, skytris, skymask, skyclip, skyarea;
+ int worldtris;
void clear()
{
clearverts();
- worldtris = skytris = 0;
- skymask = 0;
- skyclip = INT_MAX;
- skyarea = 0;
+ worldtris = 0;
indices.clear();
- skyindices.setsize(0);
- explicitskyindices.setsize(0);
matsurfs.setsize(0);
mapmodels.setsize(0);
texs.setsize(0);
- loopi(6) skyfaces[i].setsize(0);
}
void remapunlit(vector<sortkey> &remap)
if(va->verts)
{
if(vbosize[VBO_VBUF] + verts.length() > maxvbosize ||
- vbosize[VBO_EBUF] + worldtris > USHRT_MAX ||
- vbosize[VBO_SKYBUF] + skytris > USHRT_MAX)
+ vbosize[VBO_EBUF] + worldtris > USHRT_MAX)
flushvbo();
va->voffset = vbosize[VBO_VBUF];
memcpy(va->matbuf, matsurfs.getbuf(), matsurfs.length()*sizeof(materialsurface));
}
- va->skybuf = 0;
- va->skydata = 0;
- va->sky = skyindices.length();
- va->explicitsky = explicitskyindices.length();
- if(va->sky + va->explicitsky)
- {
- va->skydata += vbosize[VBO_SKYBUF];
- ushort *skydata = (ushort *)addvbo(va, VBO_SKYBUF, va->sky+va->explicitsky, sizeof(ushort));
- memcpy(skydata, skyindices.getbuf(), va->sky*sizeof(ushort));
- memcpy(skydata+va->sky, explicitskyindices.getbuf(), va->explicitsky*sizeof(ushort));
- if(va->voffset) loopi(va->sky+va->explicitsky) skydata[i] += va->voffset;
- }
-
va->eslist = NULL;
va->texs = texs.length();
va->blendtris = 0;
bool emptyva()
{
- return verts.empty() && matsurfs.empty() && skyindices.empty() && explicitskyindices.empty() && mapmodels.empty();
+ return verts.empty() && matsurfs.empty() && mapmodels.empty();
}
} vc;
void addtris(const sortkey &key, int orient, vertex *verts, int *index, int numverts, int convex, int shadowmask, int tj)
{
- int &total = key.tex==DEFAULT_SKY ? vc.skytris : vc.worldtris;
+ int &total = vc.worldtris;
int edge = orient*(MAXFACEVERTS+1);
loopi(numverts-2) if(index[0]!=index[i+1] && index[i+1]!=index[i+2] && index[i+2]!=index[0])
{
- vector<ushort> &idxs = key.tex==DEFAULT_SKY ? vc.explicitskyindices : vc.indices[key].tris[(shadowmask>>i)&1];
+ vector<ushort> &idxs = vc.indices[key].tris[(shadowmask>>i)&1];
int left = index[0], mid = index[i+1], right = index[i+2], start = left, i0 = left, i1 = -1;
loopk(4)
{
{
(void) grassy;
int dim = dimension(orient);
- int shadowmask = texture==DEFAULT_SKY || alpha ? 0 : calcshadowmask(pos, numverts);
+ int shadowmask = alpha ? 0 : calcshadowmask(pos, numverts);
LightMap *lm = NULL;
LightMapTexture *lmtex = NULL;
if(index[k] < 0) return;
}
- if(texture == DEFAULT_SKY)
- {
- loopk(numverts) vc.skyclip = min(vc.skyclip, int(pos[k].z*8)>>3);
- vc.skymask |= 0x3F&~(1<<orient);
- }
-
if(lmid >= LMID_RESERVED) lmid = lm ? lm->tex : LMID_AMBIENT;
sortkey key(texture, lmid, !vslot.scroll.iszero() ? dim : 3, layer == LAYER_BLEND ? LAYER_BLEND : LAYER_TOP, envmap, alpha ? (vslot.alphaback ? ALPHA_BACK : (vslot.alphafront ? ALPHA_FRONT : NO_ALPHA)) : NO_ALPHA);
}
}
-static inline bool skyoccluded(cube &c, int orient)
-{
- return touchingface(c, orient) && faceedges(c, orient) == F_SOLID;
-}
-
-static int dummyskyfaces[6];
-static inline int hasskyfaces(cube &c, const ivec &co, int size, int faces[6] = dummyskyfaces)
-{
- int numfaces = 0;
- if(isempty(c) || c.material&MAT_ALPHA)
- {
- if(co.x == 0) faces[numfaces++] = O_LEFT;
- if(co.x + size == worldsize) faces[numfaces++] = O_RIGHT;
- if(co.y == 0) faces[numfaces++] = O_BACK;
- if(co.y + size == worldsize) faces[numfaces++] = O_FRONT;
- if(co.z == 0) faces[numfaces++] = O_BOTTOM;
- if(co.z + size == worldsize) faces[numfaces++] = O_TOP;
- }
- else if(!isentirelysolid(c))
- {
- if(co.x == 0 && !skyoccluded(c, O_LEFT)) faces[numfaces++] = O_LEFT;
- if(co.x + size == worldsize && !skyoccluded(c, O_RIGHT)) faces[numfaces++] = O_RIGHT;
- if(co.y == 0 && !skyoccluded(c, O_BACK)) faces[numfaces++] = O_BACK;
- if(co.y + size == worldsize && !skyoccluded(c, O_FRONT)) faces[numfaces++] = O_FRONT;
- if(co.z == 0 && !skyoccluded(c, O_BOTTOM)) faces[numfaces++] = O_BOTTOM;
- if(co.z + size == worldsize && !skyoccluded(c, O_TOP)) faces[numfaces++] = O_TOP;
- }
- return numfaces;
-}
-
-void minskyface(cube &cu, int orient, const ivec &co, int size, facebounds &orig)
-{
- facebounds mincf;
- mincf.u1 = orig.u2;
- mincf.u2 = orig.u1;
- mincf.v1 = orig.v2;
- mincf.v2 = orig.v1;
- mincubeface(cu, orient, co, size, orig, mincf, MAT_ALPHA, MAT_ALPHA);
- orig.u1 = max(mincf.u1, orig.u1);
- orig.u2 = min(mincf.u2, orig.u2);
- orig.v1 = max(mincf.v1, orig.v1);
- orig.v2 = min(mincf.v2, orig.v2);
-}
-
-void genskyfaces(cube &c, const ivec &o, int size)
-{
- int faces[6], numfaces = hasskyfaces(c, o, size, faces);
- if(!numfaces) return;
-
- loopi(numfaces)
- {
- int orient = faces[i], dim = dimension(orient);
- facebounds m;
- m.u1 = (o[C[dim]]&0xFFF)<<3;
- m.u2 = m.u1 + (size<<3);
- m.v1 = (o[R[dim]]&0xFFF)<<3;
- m.v2 = m.v1 + (size<<3);
- minskyface(c, orient, o, size, m);
- if(m.u1 >= m.u2 || m.v1 >= m.v2) continue;
- vc.skyarea += (int(m.u2-m.u1)*int(m.v2-m.v1) + (1<<(2*3))-1)>>(2*3);
- vc.skyfaces[orient].add(m);
- }
-}
-
-void addskyverts(const ivec &o, int size)
-{
- loopi(6)
- {
- int dim = dimension(i), c = C[dim], r = R[dim];
- vector<facebounds> &sf = vc.skyfaces[i];
- if(sf.empty()) continue;
- vc.skymask |= 0x3F&~(1<<opposite(i));
- sf.setsize(mergefaces(i, sf.getbuf(), sf.length()));
- loopvj(sf)
- {
- facebounds &m = sf[j];
- int index[4];
- loopk(4)
- {
- const ivec &coords = facecoords[opposite(i)][k];
- vec v;
- v[dim] = o[dim];
- if(coords[dim]) v[dim] += size;
- v[c] = (o[c]&~0xFFF) + (coords[c] ? m.u2 : m.u1)/8.0f;
- v[r] = (o[r]&~0xFFF) + (coords[r] ? m.v2 : m.v1)/8.0f;
- index[k] = vc.addvert(v);
- if(index[k] < 0) goto nextskyface;
- vc.skyclip = min(vc.skyclip, int(v.z*8)>>3);
- }
- if(vc.skytris + 6 > USHRT_MAX) break;
- vc.skytris += 6;
- vc.skyindices.add(index[0]);
- vc.skyindices.add(index[1]);
- vc.skyindices.add(index[2]);
-
- vc.skyindices.add(index[0]);
- vc.skyindices.add(index[2]);
- vc.skyindices.add(index[3]);
- nextskyface:;
- }
- }
-}
-
////////// Vertex Arrays //////////////
int allocva = 0;
va->parent = NULL;
va->o = co;
va->size = size;
- va->skyarea = vc.skyarea;
- va->skyfaces = vc.skymask;
- va->skyclip = vc.skyclip < INT_MAX ? vc.skyclip : INT_MAX;
va->curvfc = VFC_NOT_VISIBLE;
va->occluded = OCCLUDE_NOTHING;
va->query = NULL;
}
if(va->vbuf) destroyvbo(va->vbuf);
if(va->ebuf) destroyvbo(va->ebuf);
- if(va->skybuf) destroyvbo(va->skybuf);
if(va->eslist) delete[] va->eslist;
if(va->matbuf) delete[] va->matbuf;
delete va;
}
va->bbmin.max(va->o);
va->bbmax.min(ivec(va->o).add(va->size));
-
- if(va->skyfaces)
- {
- va->skyfaces |= 0x80;
- if(va->sky) loop(dim, 3) if(va->skyfaces&(3<<(2*dim)))
- {
- int r = R[dim], c = C[dim];
- if((va->skyfaces&(1<<(2*dim)) && va->o[dim] < va->bbmin[dim]) ||
- (va->skyfaces&(2<<(2*dim)) && va->o[dim]+va->size > va->bbmax[dim]) ||
- va->o[r] < va->bbmin[r] || va->o[r]+va->size > va->bbmax[r] ||
- va->o[c] < va->bbmin[c] || va->o[c]+va->size > va->bbmax[c])
- {
- va->skyfaces &= ~0x80;
- break;
- }
- }
- }
}
void updatevabbs(bool force)
return;
}
- genskyfaces(c, co, size);
-
if(!isempty(c))
{
gencubeverts(c, co, size, csi);
loopv(vc.matsurfs)
{
materialsurface &m = vc.matsurfs[i];
- switch(m.material&MATF_VOLUME)
- {
- case MAT_WATER:
- case MAT_GLASS:
- case MAT_LAVA:
- break;
-
- default:
- continue;
- }
int dim = dimension(m.orient),
r = R[dim],
calcgeombb(co, size, bbmin, bbmax);
- addskyverts(co, size);
-
if(size == min(0x1000, worldsize/2) || !vc.emptyva())
{
vtxarray *va = newva(co, size);
else
{
numvis++;
- if(c.texture[i] != DEFAULT_SKY && !(c.ext && c.ext->surfaces[i].numverts&MAXFACEVERTS)) checkmask |= 1<<i;
+ if(!(c.ext && c.ext->surfaces[i].numverts&MAXFACEVERTS)) checkmask |= 1<<i;
}
}
if(facemask&2 && collideface(c, i)) collidemask |= 1<<i;
else
{
if(!isempty(c[i])) count += setcubevisibility(c[i], o, size);
- count += hasskyfaces(c[i], o, size);
}
int tcount = count + (csi <= MAXMERGELEVEL ? vamerges[csi].length() : 0);
if(tcount > vafacemax || (tcount >= vafacemin && size >= vacubesize) || size == min(0x1000, worldsize/2))
loadprogress = 0;
flushvbo();
- explicitsky = 0;
- skyarea = 0;
- loopv(valist)
- {
- vtxarray *va = valist[i];
- explicitsky += va->explicitsky;
- skyarea += va->skyarea;
- }
-
visibleva = NULL;
}
clearvas(worldroot);
resetqueries();
resetclipplanes();
- if(load)
- {
- setupsky();
- }
guessshadowdir();
entitiesinoctanodes();
tjoints.setsize(0);
{
if(isentirelysolid(c))
{
- if(c.texture[side]==DEFAULT_SKY && mode&RAY_SKIPSKY)
- {
- if(mode&RAY_SKYTEX) return radius;
- }
- else return dist;
+ return dist;
}
else
{
INTERSECTBOX(side = (i<<1) + 1 - lsizemask[i], goto nextcube);
if(exitdist >= 0)
{
- if(c.texture[side]==DEFAULT_SKY && mode&RAY_SKIPSKY)
- {
- if(mode&RAY_SKYTEX) return radius;
- }
- else return dist+max(enterdist+0.1f, 0.0f);
+ return dist+max(enterdist+0.1f, 0.0f);
}
}
}
{
if(isentirelysolid(c))
{
- if(c.texture[side]==DEFAULT_SKY && mode&RAY_SKIPSKY)
- {
- if(mode&RAY_SKYTEX) return radius;
- }
- else return dist;
+ return dist;
}
else
{
INTERSECTBOX(side = (i<<1) + 1 - lsizemask[i], goto nextcube);
if(exitdist >= 0)
{
- if(c.texture[side]==DEFAULT_SKY && mode&RAY_SKIPSKY)
- {
- if(mode&RAY_SKYTEX) return radius;
- }
- else return dist+max(enterdist+0.1f, 0.0f);
+ return dist+max(enterdist+0.1f, 0.0f);
}
}
}
return !collided;
}
-bool bounce(physent *d, float secs, float elasticity, float waterfric, float grav)
+bool bounce(physent *d, float secs, float elasticity, float grav)
{
// make sure bouncers don't start inside geometry
if(d->physstate!=PHYS_BOUNCE && collide(d, vec(0, 0, 0), 0, false)) return true;
FVAR(faderoll, 0, 0.95f, 1);
VAR(floatspeed, 1, 100, 10000);
-void modifyvelocity(physent *pl, bool local, bool water, bool floating, int curtime)
+void modifyvelocity(physent *pl, bool local, bool floating, int curtime)
{
bool allowmove = game::allowmove(pl);
if(floating)
pl->vel.z = max(pl->vel.z, JUMPVEL);
}
}
- else if(pl->physstate >= PHYS_SLOPE || water)
+ else if(pl->physstate >= PHYS_SLOPE)
{
- if(water && !pl->inwater) pl->vel.div(8);
+ if(!pl->inwater) pl->vel.div(8);
if(pl->jumping && allowmove)
{
pl->jumping = false;
pl->vel.z = max(pl->vel.z, JUMPVEL); // physics impulse upwards
- if(water) { pl->vel.x /= 8.0f; pl->vel.y /= 8.0f; } // dampen velocity change even harder, gives correct water feel
- game::physicstrigger(pl, local, 1, 0);
+ game::physicstrigger(pl, local, 1);
}
}
if(!floating && pl->physstate == PHYS_FALL) pl->timeinair = min(pl->timeinair + curtime, 1000);
vec m(0.0f, 0.0f, 0.0f);
if((pl->move || pl->strafe) && allowmove)
{
- vecfromyawpitch(pl->yaw, floating || water || pl->type==ENT_CAMERA ? pl->pitch : 0, pl->move, pl->strafe, m);
+ vecfromyawpitch(pl->yaw, floating || pl->type==ENT_CAMERA ? pl->pitch : 0, pl->move, pl->strafe, m);
if(!floating && pl->physstate >= PHYS_SLOPE)
- {
- /* move up or down slopes in air
- * but only move up slopes in water
- */
- float dz = -(m.x*pl->floor.x + m.y*pl->floor.y)/pl->floor.z;
- m.z = water ? max(m.z, dz) : dz;
- }
+ m.z = -(m.x*pl->floor.x + m.y*pl->floor.y)/pl->floor.z; // move up or down slopes in air
m.normalize();
}
{
if(pl==player) d.mul(floatspeed/100.0f);
}
- else if(!water && allowmove) d.mul((pl->move && !pl->strafe ? 1.3f : 1.0f) * (pl->physstate < PHYS_SLOPE ? 1.3f : 1.0f));
+ else if(allowmove) d.mul((pl->move && !pl->strafe ? 1.3f : 1.0f) * (pl->physstate < PHYS_SLOPE ? 1.3f : 1.0f));
}
- float fric = water && !floating ? 20.0f : (pl->physstate >= PHYS_SLOPE || floating ? 6.0f : 30.0f);
+ float fric = !floating ? 20.0f : (pl->physstate >= PHYS_SLOPE || floating ? 6.0f : 30.0f);
pl->vel.lerp(d, pl->vel, pow(1 - 1/fric, curtime/20.0f));
-// old fps friction
-// float friction = water && !floating ? 20.0f : (pl->physstate >= PHYS_SLOPE || floating ? 6.0f : 30.0f);
-// float fpsfric = min(curtime/(20.0f*friction), 1.0f);
-// pl->vel.lerp(pl->vel, d, fpsfric);
}
-void modifygravity(physent *pl, bool water, int curtime)
+void modifygravity(physent *pl, int curtime)
{
float secs = curtime/1000.0f;
vec g(0, 0, 0);
g.normalize();
g.mul(GRAVITY*secs);
}
- if(!water || !game::allowmove(pl) || (!pl->move && !pl->strafe)) pl->falling.add(g);
+ if(!game::allowmove(pl) || (!pl->move && !pl->strafe)) pl->falling.add(g);
- if(water || pl->physstate >= PHYS_SLOPE)
+ if(pl->physstate >= PHYS_SLOPE)
{
- float fric = water ? 2.0f : 6.0f,
- c = water ? 1.0f : clamp((pl->floor.z - SLOPEZ)/(FLOORZ-SLOPEZ), 0.0f, 1.0f);
+ float fric = 6.0f,
+ c = clamp((pl->floor.z - SLOPEZ)/(FLOORZ-SLOPEZ), 0.0f, 1.0f);
pl->falling.mul(pow(1 - c/fric, curtime/20.0f));
}
}
float secs = curtime/1000.f;
// apply gravity
- if(!floating) modifygravity(pl, water, curtime);
+ if(!floating) modifygravity(pl, curtime);
// apply any player generated changes in velocity
- modifyvelocity(pl, local, water, floating, curtime);
+ modifyvelocity(pl, local, floating, curtime);
vec d(pl->vel);
- if(!floating && water) d.mul(0.5f);
+ if(!floating) d.mul(0.5f);
d.add(pl->falling);
d.mul(secs);
d.mul(f);
loopi(moveres) if(!move(pl, d) && ++collisions<5) i--; // discrete steps collision detection & sliding
- if(timeinair > 800 && !pl->timeinair && !water) // if we land after long time must have been a high jump, make thud sound
+ if(timeinair > 800 && !pl->timeinair) // if we land after long time must have been a high jump, make thud sound
{
- game::physicstrigger(pl, local, -1, 0);
+ game::physicstrigger(pl, local, -1);
}
}
if(pl->strafe && maxroll) pl->roll = clamp(pl->roll - pow(clamp(1.0f + pl->strafe*pl->roll/maxroll, 0.0f, 1.0f), 0.33f)*pl->strafe*curtime*straferoll, -maxroll, maxroll);
else pl->roll *= curtime == PHYSFRAMETIME ? faderoll : pow(faderoll, curtime/float(PHYSFRAMETIME));
- if(pl->inwater) game::physicstrigger(pl, local, 0, 1, pl->inwater);
- pl->inwater = water ? material&MATF_VOLUME : MAT_AIR;
+ if(pl->inwater) game::physicstrigger(pl, local, 0, pl->inwater);
+ pl->inwater = MAT_AIR;
if(pl->state==CS_ALIVE && (pl->o.z < 0 || material&MAT_DEATH)) game::suicide(pl);
}
}
-bool bounce(physent *d, float elasticity, float waterfric, float grav)
+bool bounce(physent *d, float elasticity, float grav)
{
if(physsteps <= 0)
{
bool hitplayer = false;
loopi(physsteps-1)
{
- if(bounce(d, physframetime/1000.0f, elasticity, waterfric, grav)) hitplayer = true;
+ if(bounce(d, physframetime/1000.0f, elasticity, grav)) hitplayer = true;
}
d->deltapos = d->o;
- if(bounce(d, physframetime/1000.0f, elasticity, waterfric, grav)) hitplayer = true;
+ if(bounce(d, physframetime/1000.0f, elasticity, grav)) hitplayer = true;
d->newpos = d->o;
d->deltapos.sub(d->newpos);
interppos(d);
return SDL_GL_GetProcAddress(name);
}
-VARP(ati_skybox_bug, 0, 0, 1);
VAR(ati_minmax_bug, 0, 0, 1);
VAR(ati_cubemap_bug, 0, 0, 1);
VAR(intel_vertexarray_bug, 0, 0, 1);
extern int fpdepthfx;
if(ati)
{
- //conoutf(CON_WARN, "WARNING: ATI cards may show garbage in skybox. (use \"/ati_skybox_bug 1\" to fix)");
-
minimizetcusage = 1;
if(hasTF && hasTRG) fpdepthfx = 1;
// On Catalyst 10.2, issuing an occlusion query on the first draw using a given cubemap texture causes a nasty crash
HUDQUAD(x, y, x+w, y+h, tx, ty, tx+tw, ty+th);
}
-static float findsurface(int fogmat, const vec &v, int &abovemat)
+static float findsurface(const vec &v, int &abovemat)
{
ivec o(v), co;
int csize;
int drawtex = 0;
-void drawcubemap(int size, const vec &o, float yaw, float pitch, const cubemapside &side, bool onlysky)
-{
- drawtex = DRAWTEX_ENVMAP;
-
- physent *oldcamera = camera1;
- static physent cmcamera;
- cmcamera = *player;
- cmcamera.reset();
- cmcamera.type = ENT_CAMERA;
- cmcamera.o = o;
- cmcamera.yaw = yaw;
- cmcamera.pitch = pitch;
- cmcamera.roll = 0;
- camera1 = &cmcamera;
-
- int farplane = worldsize*2;
-
- projmatrix.perspective(90.0f, 1.0f, nearplane, farplane);
- if(!side.flipx || !side.flipy) projmatrix.scalexy(!side.flipx ? -1 : 1, !side.flipy ? -1 : 1);
- if(side.swapxy)
- {
- swap(projmatrix.a.x, projmatrix.a.y);
- swap(projmatrix.b.x, projmatrix.b.y);
- swap(projmatrix.c.x, projmatrix.c.y);
- swap(projmatrix.d.x, projmatrix.d.y);
- }
- setcamprojmatrix();
-
- xtravertsva = xtraverts = glde = gbatches = 0;
-
- visiblecubes();
-
- if(onlysky) drawskybox(farplane, false, true);
- else
- {
- glClear(GL_DEPTH_BUFFER_BIT);
-
- glEnable(GL_CULL_FACE);
- glEnable(GL_DEPTH_TEST);
-
- if(limitsky()) drawskybox(farplane, true);
-
- rendergeom();
-
- if(!limitsky()) drawskybox(farplane, false);
-
- rendermapmodels();
- renderalphageom();
-
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_CULL_FACE);
- }
-
- camera1 = oldcamera;
- drawtex = 0;
-}
-
VAR(modelpreviewfov, 10, 20, 100);
VAR(modelpreviewpitch, -90, -15, 90);
if(wireframe && editmode) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- if(limitsky()) drawskybox(farplane, true);
-
rendergeom();
extern int outline;
if(!wireframe && editmode && outline) renderoutline();
- if(!limitsky()) drawskybox(farplane, false);
-
renderdecals(true);
rendermapmodels();
if(dist < rad) v = VFC_PART_VISIBLE;
}
- if(dist > rad) return VFC_FOGGED; //VFC_NOT_VISIBLE; // culling when fog is closer than size of world results in HOM
if(dist > -rad) v = VFC_PART_VISIBLE;
return v;
if(dist < -vfcDnear[i]*size) v = VFC_PART_VISIBLE;
}
- if(dist > -vfcDnear[4]*size) return VFC_FOGGED;
if(dist > -vfcDfar[4]*size) v = VFC_PART_VISIBLE;
return v;
lastvisiblemms = &visiblemms;
for(vtxarray *va = visibleva; va; va = va->next)
{
- if(va->mapmodels.empty() || va->curvfc >= VFC_FOGGED || va->occluded >= OCCLUDE_BB) continue;
+ if(va->mapmodels.empty() || va->occluded >= OCCLUDE_BB) continue;
loopv(va->mapmodels)
{
octaentities *oe = va->mapmodels[i];
if(c[i].ext && c[i].ext->va)
{
vtxarray *va = c[i].ext->va;
- if(va->curvfc >= VFC_FOGGED || (va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va))) continue;
+ if(va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va)) continue;
}
if(c[i].children && bboccluded(bo, br, c[i].children, co, size>>1)) continue;
return false;
if(c->ext && c->ext->va)
{
vtxarray *va = c->ext->va;
- if(va->curvfc >= VFC_FOGGED || (va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va))) return true;
+ if(va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va)) return true;
}
scale--;
while(c->children && !(diff&(1<<scale)))
if(c->ext && c->ext->va)
{
vtxarray *va = c->ext->va;
- if(va->curvfc >= VFC_FOGGED || (va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va))) return true;
+ if(va->occluded >= OCCLUDE_BB && bbinsideva(bo, br, va)) return true;
}
scale--;
}
vtxarray *prev = NULL;
for(vtxarray *va = visibleva; va; va = va->next)
{
- if(!va->texs || va->curvfc >= VFC_FOGGED || !isshadowmapreceiver(va)) continue;
+ if(!va->texs || !isshadowmapreceiver(va)) continue;
if(!prev || va->vbuf != prev->vbuf)
{
{
RENDERPASS_LIGHTMAP = 0,
RENDERPASS_Z,
- RENDERPASS_CAUSTICS,
- RENDERPASS_FOG,
RENDERPASS_LIGHTMAP_BLEND
};
VAR(batchgeom, 0, 1, 1);
-void renderva(renderstate &cur, vtxarray *va, int pass = RENDERPASS_LIGHTMAP, bool fogpass = false, bool doquery = false)
+void renderva(renderstate &cur, vtxarray *va, int pass = RENDERPASS_LIGHTMAP, bool doquery = false)
{
switch(pass)
{
break;
}
- case RENDERPASS_FOG:
- if(cur.vbuf!=va->vbuf) changevbuf(cur, pass, va);
- drawvatris(va, 3*va->tris, va->edata);
- xtravertsva += va->verts;
- break;
-
case RENDERPASS_Z:
if(doquery) startvaquery(va, );
renderzpass(cur, va);
if(cur.vbuf) disablevbuf(cur);
}
-static void rendergeommultipass(renderstate &cur, int pass, bool fogpass)
+static void rendergeommultipass(renderstate &cur, int pass)
{
if(cur.vbuf) disablevbuf(cur);
if(!cur.vattribs) enablevattribs(cur, false);
{
if(!va->texs) continue;
if(va->occluded >= OCCLUDE_GEOM) continue;
- renderva(cur, va, pass, fogpass);
+ renderva(cur, va, pass);
}
if(geombatches.length()) renderbatches(cur, pass);
}
VAR(oqgeom, 0, 1, 1);
-void rendergeom(bool fogpass)
+void rendergeom(void)
{
bool mainpass = !drawtex && !glaring,
doOQ = oqfrags && oqgeom && mainpass,
}
if(!doZP) blends += va->blends;
- renderva(cur, va, doZP ? RENDERPASS_Z : RENDERPASS_LIGHTMAP, fogpass, doOQ);
+ renderva(cur, va, doZP ? RENDERPASS_Z : RENDERPASS_LIGHTMAP, doOQ);
}
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
{
if(!va->texs || va->occluded >= OCCLUDE_GEOM) continue;
blends += va->blends;
- renderva(cur, va, RENDERPASS_LIGHTMAP, fogpass);
+ renderva(cur, va, RENDERPASS_LIGHTMAP);
}
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
for(vtxarray *va = visibleva; va; va = va->next)
}
blends += va->blends;
- renderva(cur, va, RENDERPASS_LIGHTMAP, fogpass);
+ renderva(cur, va, RENDERPASS_LIGHTMAP);
}
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
}
{
if(!va->blends) continue;
if(va->occluded >= OCCLUDE_GEOM) continue;
- renderva(cur, va, RENDERPASS_LIGHTMAP_BLEND, fogpass);
+ renderva(cur, va, RENDERPASS_LIGHTMAP_BLEND);
}
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
cur.blending = false;
cleanupgeom(cur);
}
-void renderalphageom(bool fogpass)
+void renderalphageom(void)
{
static vector<vtxarray *> alphavas;
alphavas.setsize(0);
cur.texgendim = -1;
cur.colorscale = vec(1, 1, 1);
cur.alphascale = -1;
- loopv(alphavas) if(front || alphavas[i]->alphabacktris) renderva(cur, alphavas[i], RENDERPASS_LIGHTMAP, fogpass);
+ loopv(alphavas) if(front || alphavas[i]->alphabacktris) renderva(cur, alphavas[i], RENDERPASS_LIGHTMAP);
if(geombatches.length()) renderbatches(cur, RENDERPASS_LIGHTMAP);
cleanupgeom(cur);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, fading ? GL_FALSE : GL_TRUE);
}
-
-static vtxarray *prevskyva = NULL;
-
-void renderskyva(vtxarray *va, bool explicitonly = false)
-{
- if(!prevskyva || va->vbuf != prevskyva->vbuf)
- {
- gle::bindvbo(va->vbuf);
- gle::bindebo(va->skybuf);
- const vertex *ptr = 0;
- gle::vertexpointer(sizeof(vertex), ptr->pos.v);
- if(!prevskyva) gle::enablevertex();
- }
-
- drawvatris(va, explicitonly ? va->explicitsky : va->sky+va->explicitsky, explicitonly ? va->skydata+va->sky : va->skydata);
-
- if(!explicitonly) xtraverts += va->sky/3;
- xtraverts += va->explicitsky/3;
-
- prevskyva = va;
-}
-
-int renderedsky = 0, renderedexplicitsky = 0, renderedskyfaces = 0, renderedskyclip = INT_MAX;
-
-static inline void updateskystats(vtxarray *va)
-{
- renderedsky += va->sky;
- renderedexplicitsky += va->explicitsky;
- renderedskyfaces |= va->skyfaces&0x3F;
- if(!(va->skyfaces&0x1F) || camera1->o.z < va->skyclip) renderedskyclip = min(renderedskyclip, va->skyclip);
- else renderedskyclip = 0;
-}
-
-bool rendersky(bool explicitonly)
-{
- prevskyva = NULL;
- renderedsky = renderedexplicitsky = renderedskyfaces = 0;
- renderedskyclip = INT_MAX;
-
- for(vtxarray *va = visibleva; va; va = va->next)
- {
- if((va->occluded >= OCCLUDE_BB && va->skyfaces&0x80) || !(va->sky+va->explicitsky)) continue;
-
- // count possibly visible sky even if not actually rendered
- updateskystats(va);
- if(explicitonly && !va->explicitsky) continue;
- renderskyva(va, explicitonly);
- }
-
- if(prevskyva)
- {
- gle::disablevertex();
- gle::clearvbo();
- gle::clearebo();
- }
-
- return renderedsky+renderedexplicitsky > 0;
-}
-
-
enum // hardcoded texture numbers
{
- DEFAULT_SKY = 0,
DEFAULT_GEOM
};
char maptitle[128];
};
-#define WATER_AMPLITUDE 0.4f
-#define WATER_OFFSET 1.1f
-
enum
{
MATSURF_NOT_VISIBLE = 0,
float viewdist(int x)
{
- return x <= 100 ? clamp((SIGHTMIN+(SIGHTMAX-SIGHTMIN))/100.f*float(x), float(SIGHTMIN), float(fog)) : 10000.0f;
+ return x <= 100 ? clamp((SIGHTMIN+(SIGHTMAX-SIGHTMIN))/100.f*float(x), float(SIGHTMIN), 10000.0f) : 10000.0f;
}
float viewfieldx(int x)
return server::modename(gamemode, NULL);
}
- void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material)
+ void physicstrigger(physent *d, bool local, int floorlevel, int material)
{
if(d->type==ENT_INANIMATE) return;
if (floorlevel>0) { if(d==player1 || d->type!=ENT_PLAYER || ((fpsent *)d)->ai) msgsound(S_JUMP, d); }
bool clipped(const vec &o)
{
int material = lookupmaterial(o), clipmat = material&MATF_CLIP;
- return clipmat == MAT_CLIP || material&MAT_DEATH || (material&MATF_VOLUME) == MAT_LAVA;
+ return clipmat == MAT_CLIP || material&MAT_DEATH;
}
int getweight(const vec &o)
weight = int(dist/ai::JUMPMIN);
pos.z -= clamp(dist-8.0f, 0.0f, pos.z);
int trgmat = lookupmaterial(pos);
- if(trgmat&MAT_DEATH || (trgmat&MATF_VOLUME) == MAT_LAVA) weight *= 10;
+ if(trgmat&MAT_DEATH) weight *= 10;
}
return weight;
}
if(d->state != CS_ALIVE) { d->lastnode = -1; return; }
bool dropping = shoulddrop(d);
int mat = lookupmaterial(v);
- if((mat&MATF_CLIP) == MAT_CLIP || (mat&MATF_VOLUME) == MAT_LAVA || mat&MAT_DEATH) dropping = false;
+ if((mat&MATF_CLIP) == MAT_CLIP || mat&MAT_DEATH) dropping = false;
float dist = dropping ? WAYPOINTRADIUS : (d->ai ? WAYPOINTRADIUS : SIGHTMIN);
int curnode = closestwaypoint(v, dist, false, d), prevnode = d->lastnode;
if(!iswaypoint(curnode) && dropping)
extern void lightreaching(const vec &target, vec &color, vec &dir, bool fast = false, extentity *e = 0, float ambient = 0.4f);
extern entity *brightestlight(const vec &target, const vec &dir);
-enum { RAY_BB = 1, RAY_POLY = 3, RAY_ALPHAPOLY = 7, RAY_ENTS = 9, RAY_CLIPMAT = 16, RAY_SKIPFIRST = 32, RAY_EDITMAT = 64, RAY_SHADOW = 128, RAY_PASS = 256, RAY_SKIPSKY = 512, RAY_SKYTEX = 1024 };
+enum { RAY_BB = 1, RAY_POLY = 3, RAY_ALPHAPOLY = 7, RAY_ENTS = 9, RAY_CLIPMAT = 16, RAY_SKIPFIRST = 32, RAY_EDITMAT = 64, RAY_SHADOW = 128, RAY_PASS = 256 };
extern float raycube (const vec &o, const vec &ray, float radius = 0, int mode = RAY_CLIPMAT, int size = 0, extentity *t = 0);
extern float raycubepos(const vec &o, const vec &ray, vec &hit, float radius = 0, int mode = RAY_CLIPMAT, int size = 0);
extern void moveplayer(physent *pl, int moveres, bool local);
extern bool moveplayer(physent *pl, int moveres, bool local, int curtime);
extern bool collide(physent *d, const vec &dir = vec(0, 0, 0), float cutoff = 0.0f, bool playercol = true, bool insideplayercol = false);
-extern bool bounce(physent *d, float secs, float elasticity, float waterfric, float grav);
-extern bool bounce(physent *d, float elasticity, float waterfric, float grav);
+extern bool bounce(physent *d, float secs, float elasticity, float grav);
+extern bool bounce(physent *d, float elasticity, float float grav);
extern void avoidcollision(physent *d, const vec &dir, physent *obstacle, float space);
extern bool overlapsdynent(const vec &o, float radius);
extern bool movecamera(physent *pl, const vec &dir, float dist, float stepdist);
extern void updateworld();
extern void initclient();
- extern void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material = 0);
+ extern void physicstrigger(physent *d, bool local, int floorlevel, int material = 0);
extern void bounced(physent *d, const vec &surface);
extern void edittrigger(const selinfo &sel, int op, int arg1 = 0, int arg2 = 0, int arg3 = 0, const VSlot *vs = NULL);
extern void vartrigger(ident *id);