Skip to content
Snippets Groups Projects
Commit 782334bb authored by dg's avatar dg
Browse files

Air warning indicator, like the hp warning indicator (corners become bluer)

git-svn-id: http://svn.net-core.org/repos/t-engine4@4898 51575b47-30f0-44d4-a5cc-537603b46e54
parent f23b38f3
No related branches found
No related tags found
No related merge requests found
......@@ -79,6 +79,7 @@ function _M:init(t, no_default)
t.rank = t.rank or 3
t.old_life = 0
t.old_air = 0
t.money_value_multiplier = t.money_value_multiplier or 1 -- changes amounts in gold piles and such
......@@ -248,6 +249,7 @@ function _M:act()
self:updateMainShader()
self.old_life = self.life
self.old_air = self.air
-- Clean log flasher
-- game.flash:empty()
......@@ -277,6 +279,11 @@ function _M:updateMainShader()
if self.life < self.max_life / 2 then game.fbo_shader:setUniform("hp_warning", 1 - (self.life / self.max_life))
else game.fbo_shader:setUniform("hp_warning", 0) end
end
-- Set shader air warning
if self.air ~= self.old_air then
if self.air < self.max_air / 2 then game.fbo_shader:setUniform("air_warning", 1 - (self.air / self.max_air))
else game.fbo_shader:setUniform("air_warning", 0) end
end
-- Colorize shader
if self:attr("stealth") then game.fbo_shader:setUniform("colorize", {0.9,0.9,0.9,0.6})
......@@ -953,7 +960,7 @@ function _M:playerUseItem(object, item, inven)
self:breakStepUp()
self:breakStealth()
self:breakLightningSpeed()
self:breakGatherTheThreads()
self:breakReloading()
self.changed = true
end)
local ok, ret = coroutine.resume(co)
......
uniform float hp_warning;
uniform float air_warning;
uniform float motionblur;
uniform float blur;
uniform float tick;
......@@ -113,6 +114,13 @@ void main(void)
float dist = length(gl_TexCoord[0].xy - vec2(0.5)) / 2.0;
gl_FragColor = mix(gl_FragColor, hp_warning_color, dist);
}
if (air_warning > 0.0)
{
vec4 air_warning_color = vec4(0.0, air_warning / 3.0, air_warning / 1.0, air_warning / 1.3);
float dist = length(gl_TexCoord[0].xy - vec2(0.5)) / 2.0;
gl_FragColor = mix(gl_FragColor, air_warning_color, dist);
}
}
/*uniform sampler2D tex;
......
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