Skip to content
Snippets Groups Projects
Commit 427ecb27 authored by dg's avatar dg
Browse files

Paradox resource bar indicates a bit better that it gets high

git-svn-id: http://svn.net-core.org/repos/t-engine4@5588 51575b47-30f0-44d4-a5cc-537603b46e54
parent 6fc8ceec
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,8 @@ soul_sha = Shader.new("resources", {require_shader=4, delay_load=true, color=sou
equi_c = {0x00/255, 0xff/255, 0x74/255}
equi_sha = Shader.new("resources", {require_shader=4, delay_load=true, color=equi_c, amp=0.8, speed=20000, distort={0.3,0.25}})
paradox_c = {0x2f/255, 0xa0/255, 0xb4/255}
paradox_sha = Shader.new("resources", {require_shader=4, delay_load=true, color=paradox_c, amp=0.8, speed=20000, distort={0.1,0.25}})
paradox_c2 = {0x8f/255, 0x80/255, 0x44/255}
paradox_sha = Shader.new("resources2", {require_shader=4, delay_load=true, color1=paradox_c, color2=paradox_c2, amp=0.8, speed=20000, distort={0.1,0.25}})
pos_c = {colors.GOLD.r/255, colors.GOLD.g/255, colors.GOLD.b/255}
pos_sha = Shader.new("resources", {require_shader=4, delay_load=true, color=pos_c, speed=1000, distort={1.6,0.2}})
neg_c = {colors.DARK_GREY.r/255, colors.DARK_GREY.g/255, colors.DARK_GREY.b/255}
......@@ -849,10 +850,13 @@ function _M:displayResources(scale, bx, by, a)
sshat[1]:toScreenFull(x-6, y+8, sshat[6], sshat[7], sshat[2], sshat[3], 1, 1, 1, a)
bshat[1]:toScreenFull(x, y, bshat[6], bshat[7], bshat[2], bshat[3], 1, 1, 1, a)
local _, chance = player:paradoxFailChance()
local s = math.max(50, 10000 - (math.sqrt(chance) * 2000))
local s = chance
if s > 15 then s = 15 end
s = s / 15
if paradox_sha.shad then
paradox_sha:setUniform("pivot", math.sqrt(s))
paradox_sha:setUniform("a", a)
paradox_sha:setUniform("speed", s)
paradox_sha:setUniform("speed", 10000 - s * 7000)
paradox_sha.shad:use(true)
end
local p = 1 - chance / 100
......
// Most source from http://www.geeks3d.com/20100831/shader-library-noise-and-pseudo-random-number-generator-in-glsl/
// With some changes to make it affect an existing texture
#extension GL_EXT_gpu_shader4: enable
uniform sampler2D tex;
uniform vec3 color1;
uniform vec3 color2;
uniform float tick;
uniform float speed;
uniform vec2 p2;
uniform float a;
uniform float amp;
uniform float pivot;
int LFSR_Rand_Gen(in int n)
{
// <<, ^ and & require GL_EXT_gpu_shader4.
n = (n << 13) ^ n;
return (n * (n*n*15731+789221) + 1376312589) & 0x7fffffff;
}
float LFSR_Rand_Gen_f( in int n )
{
return float(LFSR_Rand_Gen(n));
}
float noise3f(in vec3 p)
{
ivec3 ip = ivec3(floor(p));
vec3 u = fract(p);
u = u*u*(3.0-2.0*u);
int n = ip.x + ip.y*57 + ip.z*113;
float res = mix(mix(mix(LFSR_Rand_Gen_f(n+(0+57*0+113*0)),
LFSR_Rand_Gen_f(n+(1+57*0+113*0)),u.x),
mix(LFSR_Rand_Gen_f(n+(0+57*1+113*0)),
LFSR_Rand_Gen_f(n+(1+57*1+113*0)),u.x),u.y),
mix(mix(LFSR_Rand_Gen_f(n+(0+57*0+113*1)),
LFSR_Rand_Gen_f(n+(1+57*0+113*1)),u.x),
mix(LFSR_Rand_Gen_f(n+(0+57*1+113*1)),
LFSR_Rand_Gen_f(n+(1+57*1+113*1)),u.x),u.y),u.z);
return 1.0 - res*(1.0/1073741824.0);
}
#define ty(x,y) (pow(.5+sin((x)*y*6.2831)/2.0,2.0)-.5)
#define t2(x,y) \
ty(y + 2.0*ty(x+2.0*noise3f(vec3(cos((x)/3.0)+x,y+tick/speed,(x)*.1)),.3),.7)
#define tx(x,y,a,d) \
((t2(x, y) * (a - x) * (d - y) + \
t2(x - a, y) * x * (d - y) + t2(x, y - d) * (a - x) * y + \
t2(x - a, y - d) * x * y) / (a * d))
float fx(vec2 x)
{
float a=0.0,d=32.0;
// Modified FBM functions to generate a blob texture
for(;d>=1.0;d/=2.0)
a += abs(tx(x.x*2.0*d, x.y*2.0*d, 2.0*d, 2.0*d)/(2.0*d));
return a*2.0;
}
void main(void)
{
vec2 uv = gl_TexCoord[0].xy * p2;
float t = uv.x;
uv.x = uv.y;
uv.y = -t;
uv -= floor(uv);
gl_FragColor.a = texture2D(tex, gl_TexCoord[0].xy).a * a;
gl_FragColor.rgb = mix(color1, color2, pivot) * ((1.0 - amp) + fx(uv) * amp);
}
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011, 2012 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return {
frag = "resources2",
vert = nil,
args = {
pivot = pivot or 1,
color1 = color1 or {1,0,0},
color2 = color2 or {0,1,0},
p2 = distort or {1, 1},
speed = speed or 5000,
a = a or 1,
amp = amp or 0.2,
},
clone = false,
}
......@@ -108,3 +108,12 @@ uberTalent{
:format()
end,
}
uberTalent{
name = "Irresistible Sun",
cooldown = 20,
info = function(self, t)
return ([[]])
:format()
end,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment