Merge branch 'master' of https://github.com/supertuxkart/stk-code
This commit is contained in:
commit
c54fed411f
1
.gitignore
vendored
1
.gitignore
vendored
@ -44,3 +44,4 @@ src/html
|
||||
packets_log.txt
|
||||
history.dat
|
||||
README.dependencies
|
||||
xx
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D Albedo;
|
||||
layout(bindless_sampler) uniform sampler2D Detail;
|
||||
layout(bindless_sampler) uniform sampler2D SpecMap;
|
||||
@ -23,7 +23,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
|
||||
void main(void)
|
||||
{
|
||||
vec4 color = texture(Albedo, uv);
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
#ifdef SRGBBindlessFix
|
||||
color.xyz = pow(color.xyz, vec3(2.2));
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D Albedo;
|
||||
layout(bindless_sampler) uniform sampler2D dtex;
|
||||
layout(bindless_sampler) uniform sampler2D SpecMap;
|
||||
@ -17,7 +17,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
|
||||
void main(void)
|
||||
{
|
||||
vec4 color = texture(Albedo, uv);
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
#ifdef SRGBBindlessFix
|
||||
color.xyz = pow(color.xyz, vec3(2.2));
|
||||
#endif
|
||||
|
@ -1,10 +1,10 @@
|
||||
#ifndef GL_ARB_bindless_texture
|
||||
#ifndef Use_Bindless_Texture
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D Detail;
|
||||
uniform sampler2D SpecMap;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D handle;
|
||||
flat in sampler2D secondhandle;
|
||||
flat in sampler2D thirdhandle;
|
||||
@ -17,7 +17,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 color = texture(handle, uv);
|
||||
float specmap = texture(secondhandle, uv).g;
|
||||
#ifdef SRGBBindlessFix
|
||||
|
@ -9,7 +9,7 @@ layout(location = 3) in vec2 Texcoord;
|
||||
layout(location = 7) in vec3 Origin;
|
||||
layout(location = 8) in vec3 Orientation;
|
||||
layout(location = 9) in vec3 Scale;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(location = 10) in sampler2D Handle;
|
||||
layout(location = 11) in sampler2D SecondHandle;
|
||||
#endif
|
||||
@ -27,7 +27,7 @@ in vec3 Scale;
|
||||
|
||||
out vec3 nor;
|
||||
out vec2 uv;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat out sampler2D handle;
|
||||
flat out sampler2D secondhandle;
|
||||
#endif
|
||||
@ -42,7 +42,7 @@ void main()
|
||||
gl_Position = ProjectionViewMatrix * ModelMatrix * vec4(Position, 1.);
|
||||
nor = (TransposeInverseModelView * vec4(Normal, 0.)).xyz;
|
||||
uv = Texcoord;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
handle = Handle;
|
||||
secondhandle = SecondHandle;
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D dtex;
|
||||
#else
|
||||
uniform sampler2D Albedo;
|
||||
@ -6,7 +6,7 @@ uniform sampler2D SpecMap;
|
||||
uniform sampler2D dtex;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D handle;
|
||||
flat in sampler2D secondhandle;
|
||||
#endif
|
||||
@ -18,7 +18,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 color = texture(handle, uv);
|
||||
float specmap = texture(secondhandle, uv).g;
|
||||
#ifdef SRGBBindlessFix
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef GL_ARB_bindless_texture
|
||||
#ifndef Use_Bindless_Texture
|
||||
uniform sampler2D normalMap;
|
||||
uniform sampler2D glossMap;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D secondhandle;
|
||||
flat in sampler2D thirdhandle;
|
||||
#endif
|
||||
@ -17,7 +17,7 @@ vec2 EncodeNormal(vec3 n);
|
||||
void main()
|
||||
{
|
||||
// normal in Tangent Space
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec3 TS_normal = 2.0 * texture(thirdhandle, uv).rgb - 1.0;
|
||||
float gloss = texture(secondhandle, uv).x;
|
||||
#else
|
||||
|
@ -10,7 +10,7 @@ layout(location = 6) in vec3 Bitangent;
|
||||
layout(location = 7) in vec3 Origin;
|
||||
layout(location = 8) in vec3 Orientation;
|
||||
layout(location = 9) in vec3 Scale;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(location = 10) in sampler2D Handle;
|
||||
layout(location = 11) in sampler2D SecondHandle;
|
||||
layout(location = 13) in sampler2D ThirdHandle;
|
||||
@ -36,7 +36,7 @@ out vec3 bitangent;
|
||||
out vec2 uv;
|
||||
out vec2 uv_bis;
|
||||
out vec4 color;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat out sampler2D handle;
|
||||
flat out sampler2D secondhandle;
|
||||
flat out sampler2D thirdhandle;
|
||||
@ -56,7 +56,7 @@ void main(void)
|
||||
uv = Texcoord;
|
||||
uv_bis = SecondTexcoord;
|
||||
color = Color.zyxw;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
handle = Handle;
|
||||
secondhandle = SecondHandle;
|
||||
thirdhandle = ThirdHandle;
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef GL_ARB_bindless_texture
|
||||
#ifndef Use_Bindless_Texture
|
||||
uniform sampler2D glosstex;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D secondhandle;
|
||||
#endif
|
||||
in vec3 nor;
|
||||
@ -13,7 +13,7 @@ vec2 EncodeNormal(vec3 n);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
float glossmap = texture(secondhandle, uv).x;
|
||||
#else
|
||||
float glossmap = texture(glosstex, uv).x;
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef GL_ARB_bindless_texture
|
||||
#ifndef Use_Bindless_Texture
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D SpecMap;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D handle;
|
||||
flat in sampler2D secondhandle;
|
||||
#endif
|
||||
@ -15,7 +15,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 col = texture(handle, uv);
|
||||
float specmap = texture(secondhandle, uv).g;
|
||||
float emitmap = texture(secondhandle, uv).b;
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef GL_ARB_bindless_texture
|
||||
#ifndef Use_Bindless_Texture
|
||||
uniform sampler2D tex;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D handle;
|
||||
#endif
|
||||
|
||||
@ -12,7 +12,7 @@ out vec4 FragColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 col = texture(handle, uv);
|
||||
#ifdef SRGBBindlessFix
|
||||
col.xyz = pow(col.xyz, vec3(2.2));
|
||||
|
@ -1,10 +1,10 @@
|
||||
// See http://www.ozone3d.net/tutorials/glsl_texturing_p04.php for ref
|
||||
|
||||
#ifndef GL_ARB_bindless_texture
|
||||
#ifndef Use_Bindless_Texture
|
||||
uniform sampler2D tex;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D handle;
|
||||
#endif
|
||||
in vec3 nor;
|
||||
@ -21,7 +21,7 @@ void main() {
|
||||
|
||||
float m = 2.0 * sqrt(r.x * r.x + r.y * r.y + (r.z + 1.0) * (r.z + 1.0));
|
||||
r.y = - r.y;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 detail0 = texture(handle, r.xy / m + .5);
|
||||
#ifdef SRGBBindlessFix
|
||||
detail0.xyz = pow(detail0.xyz, vec3(2.2));
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef GL_ARB_bindless_texture
|
||||
#ifndef Use_Bindless_Texture
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D glosstex;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D handle;
|
||||
flat in sampler2D secondhandle;
|
||||
#endif
|
||||
@ -14,7 +14,7 @@ out vec3 EncodedNormal;
|
||||
vec2 EncodeNormal(vec3 n);
|
||||
|
||||
void main() {
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 col = texture(handle, uv);
|
||||
float glossmap = texture(secondhandle, uv).x;
|
||||
#else
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef GL_ARB_bindless_texture
|
||||
#ifndef Use_Bindless_Texture
|
||||
uniform sampler2D Albedo;
|
||||
uniform sampler2D SpecMap;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in sampler2D handle;
|
||||
flat in sampler2D secondhandle;
|
||||
#endif
|
||||
@ -15,7 +15,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 col = texture(handle, uv);
|
||||
float specmap = texture(secondhandle, uv).g;
|
||||
#ifdef SRGBBindlessFix
|
||||
|
@ -1,11 +1,11 @@
|
||||
#ifndef GL_ARB_bindless_texture
|
||||
#ifndef Use_Bindless_Texture
|
||||
uniform sampler2D tex;
|
||||
#endif
|
||||
|
||||
in vec2 uv;
|
||||
in vec3 nor;
|
||||
in vec4 color;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in uvec2 handle;
|
||||
#endif
|
||||
layout (location = 0) out vec3 RSMColor;
|
||||
@ -13,7 +13,7 @@ layout (location = 1) out vec3 RSMNormals;
|
||||
|
||||
void main()
|
||||
{
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 col = texture(sampler2D(handle), uv);
|
||||
#ifdef SRGBBindlessFix
|
||||
col.xyz = pow(col.xyz, vec3(2.2));
|
||||
|
@ -8,7 +8,7 @@ layout(location = 4) in vec2 SecondTexcoord;
|
||||
layout(location = 7) in vec3 Origin;
|
||||
layout(location = 8) in vec3 Orientation;
|
||||
layout(location = 9) in vec3 Scale;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(location = 10) in uvec2 Handle;
|
||||
#endif
|
||||
|
||||
@ -16,7 +16,7 @@ out vec3 nor;
|
||||
out vec2 uv;
|
||||
out vec2 uv_bis;
|
||||
out vec4 color;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat out uvec2 handle;
|
||||
#endif
|
||||
|
||||
@ -33,7 +33,7 @@ void main(void)
|
||||
nor = (TransposeInverseModel * vec4(Normal, 0.)).xyz;
|
||||
uv = Texcoord;
|
||||
color = Color.zyxw;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
handle = Handle;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,21 +1,21 @@
|
||||
layout(triangles) in;
|
||||
layout(triangle_strip, max_vertices=3) out;
|
||||
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in uvec2 hdle[3];
|
||||
#endif
|
||||
in vec2 tc[3];
|
||||
in int layerId[3];
|
||||
|
||||
out vec2 uv;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
out flat uvec2 handle;
|
||||
#endif
|
||||
|
||||
void main(void)
|
||||
{
|
||||
gl_Layer = layerId[0];
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
handle = hdle[0];
|
||||
#endif
|
||||
for(int i=0; i<3; i++)
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef GL_ARB_bindless_texture
|
||||
#ifndef Use_Bindless_Texture
|
||||
uniform sampler2D tex;
|
||||
#endif
|
||||
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat in uvec2 handle;
|
||||
#endif
|
||||
in vec2 uv;
|
||||
@ -11,7 +11,7 @@ out vec4 FragColor;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 col = texture(sampler2D(handle), uv);
|
||||
#else
|
||||
vec4 col = texture(tex, uv);
|
||||
|
@ -9,7 +9,7 @@ layout(location = 3) in vec2 Texcoord;
|
||||
layout(location = 7) in vec3 Origin;
|
||||
layout(location = 8) in vec3 Orientation;
|
||||
layout(location = 9) in vec3 Scale;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(location = 10) in uvec2 Handle;
|
||||
#endif
|
||||
|
||||
@ -25,13 +25,13 @@ in vec3 Scale;
|
||||
|
||||
#ifdef VSLayer
|
||||
out vec2 uv;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat out uvec2 handle;
|
||||
#endif
|
||||
#else
|
||||
out vec2 tc;
|
||||
out int layerId;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat out uvec2 hdle;
|
||||
#endif
|
||||
#endif
|
||||
@ -46,14 +46,14 @@ void main(void)
|
||||
gl_Layer = layer;
|
||||
gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position + windDir * Color.r, 1.);
|
||||
uv = Texcoord;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
handle = Handle;
|
||||
#endif
|
||||
#else
|
||||
layerId = layer;
|
||||
gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position + windDir * Color.r, 1.);
|
||||
tc = Texcoord;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
hdle = Handle;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -7,7 +7,7 @@ layout(location = 3) in vec2 Texcoord;
|
||||
layout(location = 7) in vec3 Origin;
|
||||
layout(location = 8) in vec3 Orientation;
|
||||
layout(location = 9) in vec3 Scale;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(location = 10) in uvec2 Handle;
|
||||
#endif
|
||||
|
||||
@ -22,13 +22,13 @@ in vec3 Scale;
|
||||
|
||||
#ifdef VSLayer
|
||||
out vec2 uv;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat out uvec2 handle;
|
||||
#endif
|
||||
#else
|
||||
out vec2 tc;
|
||||
out int layerId;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
flat out uvec2 hdle;
|
||||
#endif
|
||||
#endif
|
||||
@ -43,14 +43,14 @@ void main(void)
|
||||
gl_Layer = layer;
|
||||
gl_Position = ShadowViewProjMatrixes[gl_Layer] * ModelMatrix * vec4(Position, 1.);
|
||||
uv = Texcoord;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
handle = Handle;
|
||||
#endif
|
||||
#else
|
||||
layerId = layer;
|
||||
gl_Position = ShadowViewProjMatrixes[layerId] * ModelMatrix * vec4(Position, 1.);
|
||||
tc = Texcoord;
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
hdle = Handle;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D normalMap;
|
||||
layout(bindless_sampler) uniform sampler2D DiffuseForAlpha;
|
||||
#else
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D tex;
|
||||
#else
|
||||
uniform sampler2D tex;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D Albedo;
|
||||
layout(bindless_sampler) uniform sampler2D SpecMap;
|
||||
#else
|
||||
@ -14,7 +14,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
|
||||
|
||||
void main(void)
|
||||
{
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
vec4 col = texture(Albedo, uv);
|
||||
#ifdef SRGBBindlessFix
|
||||
col.xyz = pow(col.xyz, vec3(2.2));
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D tex;
|
||||
#else
|
||||
uniform sampler2D tex;
|
||||
@ -11,7 +11,7 @@ out vec4 FragColor;
|
||||
void main(void)
|
||||
{
|
||||
vec4 col = texture(tex, uv);
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
#ifdef SRGBBindlessFix
|
||||
col.xyz = pow(col.xyz, vec3(2.2));
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
// See http://www.ozone3d.net/tutorials/glsl_texturing_p04.php for ref
|
||||
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D tex;
|
||||
#else
|
||||
uniform sampler2D tex;
|
||||
@ -25,7 +25,7 @@ void main() {
|
||||
float m = 2.0 * sqrt(r.x * r.x + r.y * r.y + (r.z + 1.0) * (r.z + 1.0));
|
||||
r.y = - r.y;
|
||||
vec4 detail0 = texture(tex, r.xy / m + .5);
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
#ifdef SRGBBindlessFix
|
||||
detail0.xyz = pow(detail0.xyz, vec3(2.2));
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D tex;
|
||||
layout(bindless_sampler) uniform sampler2D glosstex;
|
||||
#else
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D Albedo;
|
||||
layout(bindless_sampler) uniform sampler2D SpecMap;
|
||||
#else
|
||||
@ -15,7 +15,7 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
|
||||
void main(void)
|
||||
{
|
||||
vec4 col = texture(Albedo, uv);
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
#ifdef SRGBBindlessFix
|
||||
col.xyz = pow(col.xyz, vec3(2.2));
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D tex;
|
||||
#else
|
||||
uniform sampler2D tex;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D tex_layout;
|
||||
layout(bindless_sampler) uniform sampler2D tex_detail0;
|
||||
layout(bindless_sampler) uniform sampler2D tex_detail1;
|
||||
@ -32,7 +32,7 @@ void main() {
|
||||
vec4 detail2 = texture(tex_detail2, uv);
|
||||
vec4 detail3 = texture(tex_detail3, uv);
|
||||
vec4 detail4 = vec4(0.0);
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
#ifdef SRGBBindlessFix
|
||||
detail0.xyz = pow(detail0.xyz, vec3(2.2));
|
||||
detail1.xyz = pow(detail1.xyz, vec3(2.2));
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D tex;
|
||||
#else
|
||||
uniform sampler2D tex;
|
||||
@ -12,7 +12,7 @@ out vec4 FragColor;
|
||||
void main()
|
||||
{
|
||||
vec4 Color = texture(tex, uv);
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
Color.xyz = pow(Color.xyz, vec3(2.2));
|
||||
#endif
|
||||
Color.xyz *= pow(color.xyz, vec3(2.2));
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D tex;
|
||||
#else
|
||||
uniform sampler2D tex;
|
||||
@ -20,7 +20,7 @@ out vec4 FragColor;
|
||||
void main()
|
||||
{
|
||||
vec4 diffusecolor = texture(tex, uv);
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
diffusecolor.xyz = pow(diffusecolor.xyz, vec3(2.2));
|
||||
#endif
|
||||
diffusecolor.xyz *= pow(color.xyz, vec3(2.2));
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D DiffuseMap;
|
||||
layout(bindless_sampler) uniform sampler2D SpecularMap;
|
||||
layout(bindless_sampler) uniform sampler2D SSAO;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
layout(bindless_sampler) uniform sampler2D tex;
|
||||
#else
|
||||
uniform sampler2D tex;
|
||||
@ -20,7 +20,7 @@ out vec4 FragColor;
|
||||
void main()
|
||||
{
|
||||
vec4 diffusecolor = texture(tex, uv);
|
||||
#ifdef GL_ARB_bindless_texture
|
||||
#ifdef Use_Bindless_Texture
|
||||
diffusecolor.xyz = pow(diffusecolor.xyz, vec3(2.2));
|
||||
#endif
|
||||
diffusecolor.xyz *= pow(color.xyz, vec3(2.2));
|
||||
|
@ -1,565 +0,0 @@
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 1) /* gzwrite.c -- zlib functions for writing gzip files
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 2) * Copyright (C) 2004, 2005, 2010, 2011, 2012 Mark Adler
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 3) * For conditions of distribution and use, see copyright notice in zlib.h
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 4) */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 5)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 6) #include "gzguts.h"
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 7)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 8) /* Local functions */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 9) local int gz_init OF((gz_statep));
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 10) local int gz_comp OF((gz_statep, int));
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 11) local int gz_zero OF((gz_statep, z_off64_t));
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 12)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 13) /* Initialize state for writing a gzip file. Mark initialization by setting
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 14) state->size to non-zero. Return -1 on failure or 0 on success. */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 15) local int gz_init(state)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 16) gz_statep state;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 17) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 18) int ret;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 19) z_streamp strm = &(state->strm);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 20)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 21) /* allocate input buffer */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 22) state->in = malloc(state->want);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 23) if (state->in == NULL) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 24) gz_error(state, Z_MEM_ERROR, "out of memory");
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 25) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 26) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 27)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 28) /* only need output buffer and deflate state if compressing */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 29) if (!state->direct) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 30) /* allocate output buffer */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 31) state->out = malloc(state->want);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 32) if (state->out == NULL) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 33) free(state->in);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 34) gz_error(state, Z_MEM_ERROR, "out of memory");
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 35) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 36) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 37)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 38) /* allocate deflate memory, set up for gzip compression */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 39) strm->zalloc = Z_NULL;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 40) strm->zfree = Z_NULL;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 41) strm->opaque = Z_NULL;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 42) ret = deflateInit2(strm, state->level, Z_DEFLATED,
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 43) MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 44) if (ret != Z_OK) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 45) free(state->out);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 46) free(state->in);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 47) gz_error(state, Z_MEM_ERROR, "out of memory");
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 48) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 49) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 50) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 51)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 52) /* mark state as initialized */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 53) state->size = state->want;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 54)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 55) /* initialize write buffer if compressing */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 56) if (!state->direct) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 57) strm->avail_out = state->size;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 58) strm->next_out = state->out;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 59) state->x.next = strm->next_out;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 60) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 61) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 62) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 63)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 64) /* Compress whatever is at avail_in and next_in and write to the output file.
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 65) Return -1 if there is an error writing to the output file, otherwise 0.
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 66) flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH,
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 67) then the deflate() state is reset to start a new gzip stream. If gz->direct
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 68) is true, then simply write to the output file without compressing, and
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 69) ignore flush. */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 70) local int gz_comp(state, flush)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 71) gz_statep state;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 72) int flush;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 73) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 74) int ret, got;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 75) unsigned have;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 76) z_streamp strm = &(state->strm);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 77)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 78) /* allocate memory if this is the first time through */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 79) if (state->size == 0 && gz_init(state) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 80) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 81)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 82) /* write directly if requested */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 83) if (state->direct) {
|
||||
d95f7835 (Timothy Hamlett 2014-11-30 22:29:52 -0600 84) got = _write(state->fd, strm->next_in, strm->avail_in);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 85) if (got < 0 || (unsigned)got != strm->avail_in) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 86) gz_error(state, Z_ERRNO, zstrerror());
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 87) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 88) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 89) strm->avail_in = 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 90) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 91) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 92)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 93) /* run deflate() on provided input until it produces no more output */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 94) ret = Z_OK;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 95) do {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 96) /* write out current buffer contents if full, or if flushing, but if
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 97) doing Z_FINISH then don't write until we get to Z_STREAM_END */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 98) if (strm->avail_out == 0 || (flush != Z_NO_FLUSH &&
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 99) (flush != Z_FINISH || ret == Z_STREAM_END))) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 100) have = (unsigned)(strm->next_out - state->x.next);
|
||||
d95f7835 (Timothy Hamlett 2014-11-30 22:29:52 -0600 101) if (have && ((got = _write(state->fd, state->x.next, have)) < 0 ||
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 102) (unsigned)got != have)) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 103) gz_error(state, Z_ERRNO, zstrerror());
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 104) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 105) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 106) if (strm->avail_out == 0) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 107) strm->avail_out = state->size;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 108) strm->next_out = state->out;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 109) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 110) state->x.next = strm->next_out;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 111) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 112)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 113) /* compress */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 114) have = strm->avail_out;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 115) ret = deflate(strm, flush);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 116) if (ret == Z_STREAM_ERROR) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 117) gz_error(state, Z_STREAM_ERROR,
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 118) "internal error: deflate stream corrupt");
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 119) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 120) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 121) have -= strm->avail_out;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 122) } while (have);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 123)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 124) /* if that completed a deflate stream, allow another to start */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 125) if (flush == Z_FINISH)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 126) deflateReset(strm);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 127)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 128) /* all done, no errors */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 129) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 130) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 131)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 132) /* Compress len zeros to output. Return -1 on error, 0 on success. */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 133) local int gz_zero(state, len)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 134) gz_statep state;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 135) z_off64_t len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 136) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 137) int first;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 138) unsigned n;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 139) z_streamp strm = &(state->strm);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 140)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 141) /* consume whatever's left in the input buffer */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 142) if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 143) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 144)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 145) /* compress len zeros (len guaranteed > 0) */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 146) first = 1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 147) while (len) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 148) n = GT_OFF(state->size) || (z_off64_t)state->size > len ?
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 149) (unsigned)len : state->size;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 150) if (first) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 151) memset(state->in, 0, n);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 152) first = 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 153) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 154) strm->avail_in = n;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 155) strm->next_in = state->in;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 156) state->x.pos += n;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 157) if (gz_comp(state, Z_NO_FLUSH) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 158) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 159) len -= n;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 160) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 161) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 162) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 163)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 164) /* -- see zlib.h -- */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 165) int ZEXPORT gzwrite(file, buf, len)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 166) gzFile file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 167) voidpc buf;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 168) unsigned len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 169) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 170) unsigned put = len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 171) unsigned n;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 172) gz_statep state;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 173) z_streamp strm;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 174)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 175) /* get internal structure */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 176) if (file == NULL)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 177) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 178) state = (gz_statep)file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 179) strm = &(state->strm);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 180)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 181) /* check that we're writing and that there's no error */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 182) if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 183) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 184)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 185) /* since an int is returned, make sure len fits in one, otherwise return
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 186) with an error (this avoids the flaw in the interface) */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 187) if ((int)len < 0) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 188) gz_error(state, Z_DATA_ERROR, "requested length does not fit in int");
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 189) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 190) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 191)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 192) /* if len is zero, avoid unnecessary operations */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 193) if (len == 0)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 194) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 195)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 196) /* allocate memory if this is the first time through */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 197) if (state->size == 0 && gz_init(state) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 198) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 199)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 200) /* check for seek request */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 201) if (state->seek) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 202) state->seek = 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 203) if (gz_zero(state, state->skip) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 204) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 205) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 206)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 207) /* for small len, copy to input buffer, otherwise compress directly */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 208) if (len < state->size) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 209) /* copy to input buffer, compress when full */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 210) do {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 211) if (strm->avail_in == 0)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 212) strm->next_in = state->in;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 213) n = state->size - strm->avail_in;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 214) if (n > len)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 215) n = len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 216) memcpy(strm->next_in + strm->avail_in, buf, n);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 217) strm->avail_in += n;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 218) state->x.pos += n;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 219) buf = (char *)buf + n;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 220) len -= n;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 221) if (len && gz_comp(state, Z_NO_FLUSH) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 222) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 223) } while (len);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 224) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 225) else {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 226) /* consume whatever's left in the input buffer */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 227) if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 228) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 229)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 230) /* directly compress user buffer to file */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 231) strm->avail_in = len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 232) strm->next_in = (voidp)buf;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 233) state->x.pos += len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 234) if (gz_comp(state, Z_NO_FLUSH) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 235) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 236) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 237)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 238) /* input was all buffered or compressed (put will fit in int) */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 239) return (int)put;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 240) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 241)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 242) /* -- see zlib.h -- */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 243) int ZEXPORT gzputc(file, c)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 244) gzFile file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 245) int c;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 246) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 247) unsigned char buf[1];
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 248) gz_statep state;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 249) z_streamp strm;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 250)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 251) /* get internal structure */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 252) if (file == NULL)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 253) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 254) state = (gz_statep)file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 255) strm = &(state->strm);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 256)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 257) /* check that we're writing and that there's no error */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 258) if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 259) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 260)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 261) /* check for seek request */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 262) if (state->seek) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 263) state->seek = 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 264) if (gz_zero(state, state->skip) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 265) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 266) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 267)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 268) /* try writing to input buffer for speed (state->size == 0 if buffer not
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 269) initialized) */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 270) if (strm->avail_in < state->size) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 271) if (strm->avail_in == 0)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 272) strm->next_in = state->in;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 273) strm->next_in[strm->avail_in++] = c;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 274) state->x.pos++;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 275) return c & 0xff;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 276) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 277)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 278) /* no room in buffer or not initialized, use gz_write() */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 279) buf[0] = c;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 280) if (gzwrite(file, buf, 1) != 1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 281) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 282) return c & 0xff;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 283) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 284)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 285) /* -- see zlib.h -- */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 286) int ZEXPORT gzputs(file, str)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 287) gzFile file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 288) const char *str;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 289) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 290) int ret;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 291) unsigned len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 292)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 293) /* write string */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 294) len = (unsigned)strlen(str);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 295) ret = gzwrite(file, str, len);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 296) return ret == 0 && len != 0 ? -1 : ret;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 297) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 298)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 299) #if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 300) #include <stdarg.h>
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 301)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 302) /* -- see zlib.h -- */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 303) int ZEXPORTVA gzprintf (gzFile file, const char *format, ...)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 304) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 305) int size, len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 306) gz_statep state;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 307) z_streamp strm;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 308) va_list va;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 309)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 310) /* get internal structure */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 311) if (file == NULL)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 312) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 313) state = (gz_statep)file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 314) strm = &(state->strm);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 315)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 316) /* check that we're writing and that there's no error */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 317) if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 318) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 319)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 320) /* make sure we have some buffer space */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 321) if (state->size == 0 && gz_init(state) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 322) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 323)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 324) /* check for seek request */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 325) if (state->seek) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 326) state->seek = 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 327) if (gz_zero(state, state->skip) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 328) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 329) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 330)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 331) /* consume whatever's left in the input buffer */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 332) if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 333) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 334)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 335) /* do the printf() into the input buffer, put length in len */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 336) size = (int)(state->size);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 337) state->in[size - 1] = 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 338) va_start(va, format);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 339) #ifdef NO_vsnprintf
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 340) # ifdef HAS_vsprintf_void
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 341) (void)vsprintf((char *)(state->in), format, va);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 342) va_end(va);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 343) for (len = 0; len < size; len++)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 344) if (state->in[len] == 0) break;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 345) # else
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 346) len = vsprintf((char *)(state->in), format, va);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 347) va_end(va);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 348) # endif
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 349) #else
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 350) # ifdef HAS_vsnprintf_void
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 351) (void)vsnprintf((char *)(state->in), size, format, va);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 352) va_end(va);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 353) len = strlen((char *)(state->in));
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 354) # else
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 355) len = vsnprintf((char *)(state->in), size, format, va);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 356) va_end(va);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 357) # endif
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 358) #endif
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 359)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 360) /* check that printf() results fit in buffer */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 361) if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 362) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 363)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 364) /* update buffer and position, defer compression until needed */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 365) strm->avail_in = (unsigned)len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 366) strm->next_in = state->in;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 367) state->x.pos += len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 368) return len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 369) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 370)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 371) #else /* !STDC && !Z_HAVE_STDARG_H */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 372)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 373) /* -- see zlib.h -- */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 374) int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 375) a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 376) gzFile file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 377) const char *format;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 378) int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 379) a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 380) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 381) int size, len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 382) gz_statep state;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 383) z_streamp strm;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 384)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 385) /* get internal structure */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 386) if (file == NULL)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 387) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 388) state = (gz_statep)file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 389) strm = &(state->strm);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 390)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 391) /* check that can really pass pointer in ints */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 392) if (sizeof(int) != sizeof(void *))
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 393) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 394)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 395) /* check that we're writing and that there's no error */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 396) if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 397) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 398)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 399) /* make sure we have some buffer space */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 400) if (state->size == 0 && gz_init(state) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 401) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 402)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 403) /* check for seek request */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 404) if (state->seek) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 405) state->seek = 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 406) if (gz_zero(state, state->skip) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 407) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 408) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 409)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 410) /* consume whatever's left in the input buffer */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 411) if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 412) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 413)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 414) /* do the printf() into the input buffer, put length in len */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 415) size = (int)(state->size);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 416) state->in[size - 1] = 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 417) #ifdef NO_snprintf
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 418) # ifdef HAS_sprintf_void
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 419) sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 420) a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 421) for (len = 0; len < size; len++)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 422) if (state->in[len] == 0) break;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 423) # else
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 424) len = sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8,
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 425) a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 426) # endif
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 427) #else
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 428) # ifdef HAS_snprintf_void
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 429) snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8,
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 430) a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 431) len = strlen((char *)(state->in));
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 432) # else
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 433) len = snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6,
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 434) a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18,
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 435) a19, a20);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 436) # endif
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 437) #endif
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 438)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 439) /* check that printf() results fit in buffer */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 440) if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 441) return 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 442)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 443) /* update buffer and position, defer compression until needed */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 444) strm->avail_in = (unsigned)len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 445) strm->next_in = state->in;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 446) state->x.pos += len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 447) return len;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 448) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 449)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 450) #endif
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 451)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 452) /* -- see zlib.h -- */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 453) int ZEXPORT gzflush(file, flush)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 454) gzFile file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 455) int flush;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 456) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 457) gz_statep state;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 458)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 459) /* get internal structure */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 460) if (file == NULL)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 461) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 462) state = (gz_statep)file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 463)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 464) /* check that we're writing and that there's no error */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 465) if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 466) return Z_STREAM_ERROR;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 467)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 468) /* check flush parameter */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 469) if (flush < 0 || flush > Z_FINISH)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 470) return Z_STREAM_ERROR;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 471)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 472) /* check for seek request */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 473) if (state->seek) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 474) state->seek = 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 475) if (gz_zero(state, state->skip) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 476) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 477) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 478)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 479) /* compress remaining data with requested flush */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 480) gz_comp(state, flush);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 481) return state->err;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 482) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 483)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 484) /* -- see zlib.h -- */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 485) int ZEXPORT gzsetparams(file, level, strategy)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 486) gzFile file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 487) int level;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 488) int strategy;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 489) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 490) gz_statep state;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 491) z_streamp strm;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 492)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 493) /* get internal structure */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 494) if (file == NULL)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 495) return Z_STREAM_ERROR;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 496) state = (gz_statep)file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 497) strm = &(state->strm);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 498)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 499) /* check that we're writing and that there's no error */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 500) if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 501) return Z_STREAM_ERROR;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 502)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 503) /* if no change is requested, then do nothing */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 504) if (level == state->level && strategy == state->strategy)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 505) return Z_OK;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 506)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 507) /* check for seek request */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 508) if (state->seek) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 509) state->seek = 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 510) if (gz_zero(state, state->skip) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 511) return -1;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 512) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 513)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 514) /* change compression parameters for subsequent input */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 515) if (state->size) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 516) /* flush previous input with previous parameters before changing */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 517) if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 518) return state->err;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 519) deflateParams(strm, level, strategy);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 520) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 521) state->level = level;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 522) state->strategy = strategy;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 523) return Z_OK;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 524) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 525)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 526) /* -- see zlib.h -- */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 527) int ZEXPORT gzclose_w(file)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 528) gzFile file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 529) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 530) int ret = Z_OK;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 531) gz_statep state;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 532)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 533) /* get internal structure */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 534) if (file == NULL)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 535) return Z_STREAM_ERROR;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 536) state = (gz_statep)file;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 537)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 538) /* check that we're writing */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 539) if (state->mode != GZ_WRITE)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 540) return Z_STREAM_ERROR;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 541)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 542) /* check for seek request */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 543) if (state->seek) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 544) state->seek = 0;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 545) if (gz_zero(state, state->skip) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 546) ret = state->err;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 547) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 548)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 549) /* flush, free memory, and close file */
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 550) if (state->size) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 551) if (gz_comp(state, Z_FINISH) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 552) ret = state->err;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 553) if (!state->direct) {
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 554) (void)deflateEnd(&(state->strm));
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 555) free(state->out);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 556) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 557) free(state->in);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 558) }
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 559) gz_error(state, Z_OK, NULL);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 560) free(state->path);
|
||||
d95f7835 (Timothy Hamlett 2014-11-30 22:29:52 -0600 561) if (_close(state->fd) == -1)
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 562) ret = Z_ERRNO;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 563) free(state);
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 564) return ret;
|
||||
974deca5 (hikerstk 2012-11-01 02:00:02 +0000 565) }
|
@ -46,8 +46,6 @@ AchievementsManager::AchievementsManager()
|
||||
for (unsigned int i = 0; i < num_nodes; i++)
|
||||
{
|
||||
const XMLNode *node = root->getNode(i);
|
||||
std::string type("");
|
||||
node->get("type", &type);
|
||||
AchievementInfo * achievement_info = new AchievementInfo(node);
|
||||
m_achievements_info[achievement_info->getID()] = achievement_info;
|
||||
}
|
||||
|
@ -496,16 +496,17 @@ void IrrDriver::initDevice()
|
||||
m_need_srgb_workaround = false;
|
||||
m_support_sdsm = true;
|
||||
m_support_texture_compression = true;
|
||||
#ifdef WIN32
|
||||
if (strstr((const char *)glGetString(GL_VENDOR), "Intel") != NULL)
|
||||
{
|
||||
// Intel on windows doesnt support srgb compressed textures properly
|
||||
m_support_texture_compression = false;
|
||||
#ifdef WIN32
|
||||
// Fix for Intel Sandy Bridge on Windows which supports GL up to 3.1 only
|
||||
if (m_gl_major_version == 3 && m_gl_minor_version == 1)
|
||||
m_need_ubo_workaround = true;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Fix for Nvidia and instanced RH
|
||||
if (strstr((const char *)glGetString(GL_VENDOR), "NVIDIA") != NULL)
|
||||
{
|
||||
|
@ -147,12 +147,12 @@ GLuint LoadShader(const char * file, unsigned type)
|
||||
char versionString[20];
|
||||
sprintf(versionString, "#version %d\n", irr_driver->getGLSLVersion());
|
||||
std::string Code = versionString;
|
||||
if (irr_driver->hasVSLayerExtension())
|
||||
Code += "#extension GL_AMD_vertex_shader_layer : enable\n";
|
||||
if (irr_driver->useAZDO())
|
||||
Code += "#extension GL_ARB_bindless_texture : enable\n";
|
||||
else if (irr_driver->hasARBBindlessTexture())
|
||||
{
|
||||
Code += "#extension GL_ARB_bindless_texture : disable\n";
|
||||
Code += "#undef GL_ARB_bindless_texture\n";
|
||||
Code += "#extension GL_ARB_bindless_texture : enable\n";
|
||||
Code += "#define Use_Bindless_Texture\n";
|
||||
}
|
||||
std::ifstream Stream(file, std::ios::in);
|
||||
Code += "//" + std::string(file) + "\n";
|
||||
|
@ -82,15 +82,15 @@ KartStatsWidget::KartStatsWidget(core::recti area, const int player_id,
|
||||
}
|
||||
|
||||
m_skills[SKILL_MASS]->setValue((int)(props->getMass()/5));
|
||||
m_skills[SKILL_MASS]->setLabel("WEIGHT");
|
||||
m_skills[SKILL_MASS]->setLabel(_("WEIGHT"));
|
||||
m_skills[SKILL_MASS]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_mass", m_player_id);
|
||||
|
||||
m_skills[SKILL_SPEED]->setValue((int)((props->getAbsMaxSpeed()-20)*9));
|
||||
m_skills[SKILL_SPEED]->setLabel("SPEED");
|
||||
m_skills[SKILL_SPEED]->setLabel(_("SPEED"));
|
||||
m_skills[SKILL_SPEED]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_speed", m_player_id);
|
||||
|
||||
m_skills[SKILL_POWER]->setValue((int)(props->getAvgPower()));
|
||||
m_skills[SKILL_POWER]->setLabel("POWER");
|
||||
m_skills[SKILL_POWER]->setLabel(_("POWER"));
|
||||
m_skills[SKILL_POWER]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_power", m_player_id);
|
||||
|
||||
move(area.UpperLeftCorner.X, area.UpperLeftCorner.Y,
|
||||
|
@ -2163,7 +2163,7 @@ void Kart::updateEngineSFX()
|
||||
if(isOnGround())
|
||||
{
|
||||
float max_speed = m_max_speed->getCurrentMaxSpeed();
|
||||
assert(max_speed>0);
|
||||
|
||||
// Engine noise is based half in total speed, half in fake gears:
|
||||
// With a sawtooth graph like /|/|/| we get 3 even spaced gears,
|
||||
// ignoring the gear settings from stk_config, but providing a
|
||||
|
@ -51,6 +51,8 @@ MaxSpeed::MaxSpeed(AbstractKart *kart)
|
||||
// Initialise m_add_engine_force since it might be queried before
|
||||
// update() is called.
|
||||
m_add_engine_force = 0;
|
||||
// This can be used if command line option -N is used
|
||||
m_current_max_speed = 0;
|
||||
} // MaxSpeed
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
105
src/main.cpp
105
src/main.cpp
@ -730,41 +730,26 @@ int handleCmdLine()
|
||||
|
||||
if(CommandLine::has("--kart", &s))
|
||||
{
|
||||
const PlayerProfile *player = PlayerManager::getCurrentPlayer();
|
||||
|
||||
if(player && !player->isLocked(s))
|
||||
const KartProperties *prop = kart_properties_manager->getKart(s);
|
||||
if (prop)
|
||||
{
|
||||
const KartProperties *prop =
|
||||
kart_properties_manager->getKart(s);
|
||||
if(prop)
|
||||
{
|
||||
UserConfigParams::m_default_kart = s;
|
||||
UserConfigParams::m_default_kart = s;
|
||||
|
||||
// if a player was added with -N, change its kart.
|
||||
// Otherwise, nothing to do, kart choice will be picked
|
||||
// up upon player creation.
|
||||
if (StateManager::get()->activePlayerCount() > 0)
|
||||
{
|
||||
race_manager->setLocalKartInfo(0, s);
|
||||
}
|
||||
Log::verbose("main", "You chose to use kart '%s'.",
|
||||
s.c_str() ) ;
|
||||
}
|
||||
else
|
||||
// if a player was added with -N, change its kart.
|
||||
// Otherwise, nothing to do, kart choice will be picked
|
||||
// up upon player creation.
|
||||
if (StateManager::get()->activePlayerCount() > 0)
|
||||
{
|
||||
Log::warn("main", "Kart '%s' not found, ignored.",
|
||||
s.c_str());
|
||||
race_manager->setLocalKartInfo(0, s);
|
||||
}
|
||||
Log::verbose("main", "You chose to use kart '%s'.",
|
||||
s.c_str());
|
||||
}
|
||||
else // kart locked
|
||||
else
|
||||
{
|
||||
if (player)
|
||||
Log::warn("main", "Kart '%s' has not been unlocked yet.",
|
||||
s.c_str());
|
||||
else
|
||||
Log::warn("main",
|
||||
"A default player must exist in order to use --kart.");
|
||||
} // if kart locked
|
||||
Log::warn("main", "Kart '%s' not found, ignored.",
|
||||
s.c_str());
|
||||
}
|
||||
} // if --kart
|
||||
|
||||
if(CommandLine::has("--ai", &s))
|
||||
@ -802,49 +787,35 @@ int handleCmdLine()
|
||||
|
||||
if(CommandLine::has("--track", &s) || CommandLine::has("-t", &s))
|
||||
{
|
||||
const PlayerProfile *player = PlayerManager::getCurrentPlayer();
|
||||
if (player && !player->isLocked(s))
|
||||
{
|
||||
race_manager->setTrack(s);
|
||||
Log::verbose("main", "You choose to start in track '%s'.",
|
||||
s.c_str());
|
||||
race_manager->setTrack(s);
|
||||
Log::verbose("main", "You choose to start in track '%s'.",
|
||||
s.c_str());
|
||||
|
||||
Track* t = track_manager->getTrack(s);
|
||||
if (!t)
|
||||
{
|
||||
Log::warn("main", "Can't find track named '%s'.", s.c_str());
|
||||
}
|
||||
else if (t->isArena())
|
||||
{
|
||||
//if it's arena, don't create ai karts
|
||||
const std::vector<std::string> l;
|
||||
race_manager->setDefaultAIKartList(l);
|
||||
// Add 1 for the player kart
|
||||
race_manager->setNumKarts(1);
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES);
|
||||
}
|
||||
else if(t->isSoccer())
|
||||
{
|
||||
//if it's soccer, don't create ai karts
|
||||
const std::vector<std::string> l;
|
||||
race_manager->setDefaultAIKartList(l);
|
||||
// Add 1 for the player kart
|
||||
race_manager->setNumKarts(1);
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_SOCCER);
|
||||
}
|
||||
}
|
||||
else
|
||||
Track* t = track_manager->getTrack(s);
|
||||
if (!t)
|
||||
{
|
||||
if (player)
|
||||
Log::warn("main", "Track '%s' has not been unlocked yet.",
|
||||
s.c_str());
|
||||
else
|
||||
Log::warn("main",
|
||||
"A default player must exist in order to use --track.");
|
||||
Log::warn("main", "Can't find track named '%s'.", s.c_str());
|
||||
}
|
||||
else if (t->isArena())
|
||||
{
|
||||
//if it's arena, don't create ai karts
|
||||
const std::vector<std::string> l;
|
||||
race_manager->setDefaultAIKartList(l);
|
||||
// Add 1 for the player kart
|
||||
race_manager->setNumKarts(1);
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_3_STRIKES);
|
||||
}
|
||||
else if (t->isSoccer())
|
||||
{
|
||||
//if it's soccer, don't create ai karts
|
||||
const std::vector<std::string> l;
|
||||
race_manager->setDefaultAIKartList(l);
|
||||
// Add 1 for the player kart
|
||||
race_manager->setNumKarts(1);
|
||||
race_manager->setMinorMode(RaceManager::MINOR_MODE_SOCCER);
|
||||
}
|
||||
} // --track
|
||||
|
||||
|
||||
if(CommandLine::has("--gp", &s))
|
||||
{
|
||||
race_manager->setMajorMode(RaceManager::MAJOR_MODE_GRAND_PRIX);
|
||||
|
@ -53,7 +53,7 @@ void UserInfoDialog::load()
|
||||
m_name_widget->setText(m_online_profile->getUserName(),false);
|
||||
m_info_widget->setText(m_info, false);
|
||||
if(m_remove_widget->isVisible() && !m_online_profile->isFriend())
|
||||
m_remove_widget->setLabel("Cancel Request");
|
||||
m_remove_widget->setLabel(_("Cancel Request"));
|
||||
} // load
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user