add low air post render effect

This commit is contained in:
darkrose 2015-06-19 02:43:55 +10:00
parent a647e71899
commit f67012024d
2 changed files with 25 additions and 0 deletions

BIN
data/textures/low_air.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

View File

@ -3579,6 +3579,31 @@ void ClientMap::renderPostFx()
core::rect<s32> rect(0,0, ss.X, ss.Y);
driver->draw2DRectangle(post_effect_color, rect);
}
if (m_client->getServerSuffocation()) {
u16 a = m_client->getAir();
if (a < 18) {
u8 c = 255-(a*14);
const video::SColor color(c,255,255,255);
const video::SColor colors[] = {color,color,color,color};
std::string tex = getTexturePath("low_air.png");
video::IVideoDriver* driver = SceneManager->getVideoDriver();
v2u32 ss = driver->getScreenSize();
video::ITexture *texture = driver->getTexture(tex.c_str());
core::rect<s32> rect(0,0,ss.X,ss.Y);
driver->draw2DImage(
texture,
rect,
core::rect<s32>(
core::position2d<s32>(0,0),
core::dimension2di(texture->getOriginalSize())
),
NULL,
colors,
true
);
}
}
}
bool ClientMap::setTempMod(v3s16 p, NodeMod mod,