From: MirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Date: Mon, 30 Jan 2012 15:01:41 +0000 (+0200)
Subject: Make the portrait slide in and out of the left edge
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5acd1fd02bd48d83ad359a95519318509b4d0125;p=voretournament%2Fvoretournament.git

Make the portrait slide in and out of the left edge
---

diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg
index 9246af76..6f1da7dd 100644
--- a/data/defaultVT.cfg
+++ b/data/defaultVT.cfg
@@ -1234,7 +1234,7 @@ seta sbar_ring2_alpha 0.75 "alpha of the second HUD ring"
 seta sbar_vote_alreadyvoted_alpha 0.75 "alpha of the vote dialog after you have voted"
 seta sbar_portrait 1 "enables portraits"
 seta sbar_portrait_time 5 "how long a portrait lasts on the screen"
-seta sbar_portrait_fade 0.25 "amount of time fading the portrait takes from total time"
+seta sbar_portrait_fade 0.1 "amount of time fading the portrait takes from total time"
 
 // for menu server list (eventually make them have engine support?)
 seta menu_slist_showfull 1 "show servers even if they are full and have no slots to join"
diff --git a/data/qcsrc/client/hud.qc b/data/qcsrc/client/hud.qc
index 0ccabe92..75ad88e2 100644
--- a/data/qcsrc/client/hud.qc
+++ b/data/qcsrc/client/hud.qc
@@ -1682,6 +1682,9 @@ void Sbar_DrawRaceStatus(vector pos)
 
 void Sbar_Portrait()
 {
+	// draws the portrait, using the values set in Ent_ReadPortrait
+
+	// make the portrait slide in and out of the left edge
 	float fade_time;
 	float fade1_start, fade1_end, fade2_start, fade2_end;
 	float fade_in, fade_out;
@@ -1696,23 +1699,18 @@ void Sbar_Portrait()
 	fade_in = bound(0, (time / fade1_end - 1) / (fade1_start / fade1_end - 1), 1);
 	fade_out = 1 - bound(0, (time / fade2_end - 1) / (fade2_start / fade2_end - 1), 1);
 
-	dprint(strcat(ftos(fade_in), " IN --------\n"));
-	dprint(strcat(ftos(fade_out), " OUT --------\n"));
-	dprint("________________\n");
-
-	// draws the portrait, using the values set in Ent_ReadPortrait
-
-	vector left;
+	vector left, fade_pos;
 	left_x = 0;
 	left_y = vid_conheight / 2;
+	fade_pos_x = -130 * fade_in * fade_out;
 
 	if(!cvar("sbar_portrait"))
 		return;
 
 	if(portrait_time + cvar("sbar_portrait_time") >= time)
 	{
-		drawpic(left + '10 -80 0', portrait_image, '120 160 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
-		drawcolorcodedstring(left + '10 80 0', portrait_name, '12 12 0', sbar_alpha_fg, DRAWFLAG_NORMAL);
+		drawpic(left - '120 80 0' - fade_pos, portrait_image, '120 160 0', '1 1 1', sbar_alpha_fg, DRAWFLAG_NORMAL);
+		drawcolorcodedstring(left - '120 -80 0' - fade_pos, portrait_name, '12 12 0', sbar_alpha_fg, DRAWFLAG_NORMAL);
 	}
 }