From ada65947f4feafbcbe58977f284944398f585d73 Mon Sep 17 00:00:00 2001
From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Date: Wed, 13 Jul 2011 15:56:02 +0300
Subject: [PATCH] Respawn screen flash

---
 data/defaultVT.cfg                                   |  2 ++
 data/qcsrc/client/View.qc                            | 12 +++++++++++-
 .../menu/voret/dialog_multiplayer_playersetup_hud.c  |  2 +-
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg
index 0fcaf58e..3b7bd6a5 100644
--- a/data/defaultVT.cfg
+++ b/data/defaultVT.cfg
@@ -142,6 +142,8 @@ seta cl_flash_pickup_color "0 0 1" "color of the pickup flash"
 seta cl_flash_vore 0.25 "if enabled, the screen flashes by this amount when eating or getting eaten"
 seta cl_flash_vore_color_prey "1 0 0" "color of the vore flash for prey"
 seta cl_flash_vore_color_pred "0 1 0" "color of the vore flash for predators"
+seta cl_flash_respawn 0.25 "if enabled, the screen flashes by this amount when picking up an item"
+seta cl_flash_respawn_color "1 1 1" "color of the pickup flash"
 fov 90
 seta cl_velocityzoom -0.2	"velocity based zooming of fov, negative values zoom out"
 seta cl_velocityzoomtime 0.3	"time value for averaging speed values"
diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc
index 523538a5..bf89e9a4 100644
--- a/data/qcsrc/client/View.qc
+++ b/data/qcsrc/client/View.qc
@@ -253,7 +253,7 @@ float camera_mode;
 float reticle_type;
 float chase_active_old;
 float artwork_fade;
-float pickup_crosshair_time, pickup_crosshair_size, pickup_flash_time, vore_flash_laststate;
+float pickup_crosshair_time, pickup_crosshair_size, pickup_flash_time, vore_flash_laststate, respawn_flash_lasthealth;
 float myhealth, myhealth_prev, myhealth_flash;
 float contentavgalpha, liquidalpha_prev;
 float old_blurradius, old_bluralpha, old_sharpen_intensity;
@@ -1054,6 +1054,16 @@ void CSQC_UpdateView(float w, float h)
 
 		vore_flash_laststate = vore_flash_state;
 	}
+	if(cvar("cl_flash_respawn"))
+	{
+		float respawn_flash_health;
+		respawn_flash_health = getstati(STAT_HEALTH);
+
+		if(respawn_flash_lasthealth <= 0 && respawn_flash_health > 0)
+			localcmd(strcat("bf ", cvar_string("cl_flash_respawn_color"), " ", cvar_string("cl_flash_respawn"), "\n"));
+
+		respawn_flash_lasthealth = respawn_flash_health;
+	}
 
 	if not(getstati(STAT_VORE_EATEN)) // crosshair is useless if we're in the stomach
 	{
diff --git a/data/qcsrc/menu/voret/dialog_multiplayer_playersetup_hud.c b/data/qcsrc/menu/voret/dialog_multiplayer_playersetup_hud.c
index 8f17ff5c..f3c370ad 100644
--- a/data/qcsrc/menu/voret/dialog_multiplayer_playersetup_hud.c
+++ b/data/qcsrc/menu/voret/dialog_multiplayer_playersetup_hud.c
@@ -35,7 +35,7 @@ void fillVoretHudDialog(entity me)
 	me.TR(me);
 		me.TDempty(me, 0.2);
 		me.TD(me, 1, 0.5, e = makeVoretCheckBoxEx(0.25, 0, "cl_flash_pickup", "Screen flashes"));
-		makeMulti(e, "cl_flash_vore");
+		makeMulti(e, "cl_flash_vore cl_flash_respawn");
 	me.TR(me);
 		me.TDempty(me, 0.2);
 		me.TD(me, 1, 2, e = makeVoretCheckBox(0, "cl_reticle_item_normal", "Zoom reticles"));
-- 
2.39.5