aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPilzAdam <PilzAdam@gmx.de>2013-01-02 21:57:04 +0100
committerPilzAdam <PilzAdam@gmx.de>2013-01-02 23:06:17 +0100
commit8493979d8678f440e11a448349f4e0404e143e95 (patch)
tree580f5c71b5f28ab4f17a7d1b78e3ffed8e9b6c54
parent2c472a66d1d605eefb167f51529c287f868ffa9b (diff)
downloadminetest-8493979d8678f440e11a448349f4e0404e143e95.tar.gz
minetest-8493979d8678f440e11a448349f4e0404e143e95.tar.bz2
minetest-8493979d8678f440e11a448349f4e0404e143e95.zip
Replace constant red hurt screen with fade out red
-rw-r--r--src/game.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 15bf3f09f..05f1da5e0 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1307,7 +1307,7 @@ void the_game(
bool digging = false;
bool ldown_for_dig = false;
- float damage_flash_timer = 0;
+ float damage_flash = 0;
s16 farmesh_range = 20*MAP_BLOCKSIZE;
const float object_hit_delay = 0.2;
@@ -2055,10 +2055,8 @@ void the_game(
{
//u16 damage = event.player_damage.amount;
//infostream<<"Player damage: "<<damage<<std::endl;
- damage_flash_timer = 0.05;
- if(event.player_damage.amount >= 2){
- damage_flash_timer += 0.05 * event.player_damage.amount;
- }
+ damage_flash += 100.0;
+ damage_flash += 8.0 * event.player_damage.amount;
}
else if(event.type == CE_PLAYER_FORCE_MOVE)
{
@@ -2088,7 +2086,7 @@ void the_game(
/* Handle visualization */
- damage_flash_timer = 0;
+ damage_flash = 0;
/*LocalPlayer* player = client.getLocalPlayer();
player->setPosition(player->getPosition() + v3f(0,-BS,0));
@@ -3049,14 +3047,14 @@ void the_game(
/*
Damage flash
*/
- if(damage_flash_timer > 0.0)
+ if(damage_flash > 0.0)
{
- damage_flash_timer -= dtime;
-
- video::SColor color(128,255,0,0);
+ video::SColor color(std::min(damage_flash, 220.0f),180,0,0);
driver->draw2DRectangle(color,
core::rect<s32>(0,0,screensize.X,screensize.Y),
NULL);
+
+ damage_flash -= 100.0*dtime;
}
/*