From: z411 <z411@omaera.org>
Date: Sun, 22 Nov 2020 00:31:54 +0000 (-0300)
Subject: Added Telefrag medal
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ee1741dcff74be4cb9cb62c7dcf538a527007858;p=xonotic%2Fxonotic-data.pk3dir.git

Added Telefrag medal
---

diff --git a/qcsrc/client/hud/panel/scoreboard.qc b/qcsrc/client/hud/panel/scoreboard.qc
index 2391ceadc..9d973bbfa 100644
--- a/qcsrc/client/hud/panel/scoreboard.qc
+++ b/qcsrc/client/hud/panel/scoreboard.qc
@@ -1519,8 +1519,10 @@ vector Scoreboard_MedalStats_Draw(vector pos)
 	pos = Scoreboard_DrawMedal(pos, "gfx/medal/humiliation",	height, pl.(scores(SP_MEDAL_HUMILIATION)));
 	pos = Scoreboard_DrawMedal(pos, "gfx/medal/impressive",		height, pl.(scores(SP_MEDAL_IMPRESSIVE)));
 	pos = Scoreboard_DrawMedal(pos, "gfx/medal/yoda", 			height, pl.(scores(SP_MEDAL_YODA)));
+	pos = Scoreboard_DrawMedal(pos, "gfx/medal/telefrag",		height, pl.(scores(SP_MEDAL_TELEFRAG)));
 	
-	pos.x += hud_fontsize.x;
+	if(total_medals)
+		pos.x += hud_fontsize.x;
 	
 	pos = Scoreboard_DrawMedal(pos, "gfx/medal/accuracy", 		height, pl.(scores(SP_MEDAL_ACCURACY)));
 	pos = Scoreboard_DrawMedal(pos, "gfx/medal/assist", 		height, pl.(scores(SP_MEDAL_ASSIST)));
diff --git a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
index d5ec7521d..c0c39485b 100644
--- a/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
+++ b/qcsrc/common/gamemodes/gamemode/clanarena/sv_clanarena.qc
@@ -111,7 +111,9 @@ float CA_CheckWinner()
 	bool perfect = false;
 	if(winner_team > 0)
 	{
+		entity tm = Team_GetTeam(winner_team);
 		entity last_pl = ca_LastPlayer(winner_team);
+		
 		if(last_pl && Team_GetNumberOfPlayers(tm) >= 3) {
 			Give_Medal(last_pl, DEFENSE);
 		}
@@ -121,8 +123,6 @@ float CA_CheckWinner()
 		if(fragsleft > 1) Send_Notification(NOTIF_ALL, NULL, MSG_ANNCE, APP_TEAM_NUM(winner_team, ANNCE_ROUND_TEAM_WIN));
 		TeamScore_AddToTeam(winner_team, ST_CA_ROUNDS, +1);
 		
-		entity tm = Team_GetTeam(winner_team);
-		
 		if (Team_GetNumberOfPlayers(tm) >= 3 &&
 			Team_GetNumberOfAlivePlayers(tm) == Team_GetNumberOfPlayers(tm))
 				perfect = true;
diff --git a/qcsrc/common/notifications/all.inc b/qcsrc/common/notifications/all.inc
index 540a64d61..efa3d03da 100644
--- a/qcsrc/common/notifications/all.inc
+++ b/qcsrc/common/notifications/all.inc
@@ -115,6 +115,7 @@
     MSG_ANNCE_NOTIF(ACHIEVEMENT_YODA,           N_GNTLOFF, "yoda",              CH_INFO, VOL_BASEVOICE, ATTEN_NONE, ANNCE_DEFTIME)
 	MSG_ANNCE_NOTIF(ACHIEVEMENT_PERFECT,        N_GNTLOFF, "perfect",           CH_INFO, VOL_BASEVOICE, ATTEN_NONE, ANNCE_DEFTIME)
 	MSG_ANNCE_NOTIF(ACHIEVEMENT_ACCURACY,       N_GNTLOFF, "accuracy",          CH_INFO, VOL_BASEVOICE, ATTEN_NONE, ANNCE_DEFTIME)
+	MSG_ANNCE_NOTIF(ACHIEVEMENT_TELEFRAG,       N_GNTLOFF, "telefrag",          CH_INFO, VOL_BASEVOICE, ATTEN_NONE, ANNCE_DEFTIME)
 
     MSG_ANNCE_NOTIF(BEGIN,                      N__ALWAYS, "begin",             CH_INFO, VOL_BASEVOICE, ATTEN_NONE, -1)
 
@@ -254,6 +255,7 @@
 	MSG_MEDAL_NOTIF(HUMILIATION, N__ALWAYS,    "humiliation",   ANNCE_HUMILIATION)
 	MSG_MEDAL_NOTIF(IMPRESSIVE, N__ALWAYS,     "impressive",    ANNCE_ACHIEVEMENT_IMPRESSIVE)
 	MSG_MEDAL_NOTIF(YODA, N__ALWAYS,           "yoda",          ANNCE_ACHIEVEMENT_YODA)
+	MSG_MEDAL_NOTIF(TELEFRAG, N__ALWAYS,       "telefrag",      ANNCE_ACHIEVEMENT_TELEFRAG)
 	
 	MSG_MEDAL_NOTIF(CAPTURE, N__ALWAYS,        "capture",       NULL)
 	MSG_MEDAL_NOTIF(PERFECT, N__ALWAYS,        "perfect",       ANNCE_ACHIEVEMENT_PERFECT)
diff --git a/qcsrc/common/scores.qh b/qcsrc/common/scores.qh
index 669af3d27..2869541b7 100644
--- a/qcsrc/common/scores.qh
+++ b/qcsrc/common/scores.qh
@@ -95,6 +95,7 @@ REGISTER_SP(MEDAL_HEADSHOT);
 REGISTER_SP(MEDAL_HUMILIATION);
 REGISTER_SP(MEDAL_IMPRESSIVE);
 REGISTER_SP(MEDAL_YODA);
+REGISTER_SP(MEDAL_TELEFRAG);
 
 REGISTER_SP(MEDAL_ACCURACY);
 REGISTER_SP(MEDAL_ASSIST);
diff --git a/qcsrc/server/damage.qc b/qcsrc/server/damage.qc
index 9d1fadc00..30c6cdca0 100644
--- a/qcsrc/server/damage.qc
+++ b/qcsrc/server/damage.qc
@@ -126,6 +126,7 @@ void LogDeath(string mode, int deathtype, entity killer, entity killed)
 
 void Obituary_SpecialDeath(
 	entity notif_target,
+	entity attacker,
 	float murder,
 	int deathtype,
 	string s1, string s2, string s3,
@@ -167,6 +168,10 @@ void Obituary_SpecialDeath(
 			f1, f2, f3, 0
 		);
 	}
+	
+	if(deathtype != DEATH_TELEFRAG.m_id) {
+		Give_Medal(attacker, TELEFRAG);
+	}
 }
 
 float Obituary_WeaponDeath(
@@ -287,7 +292,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en
 		{
 			if(deathtype == DEATH_TEAMCHANGE.m_id || deathtype == DEATH_AUTOTEAMCHANGE.m_id)
 			{
-				Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", targ.team, 0, 0);
+				Obituary_SpecialDeath(targ, NULL, false, deathtype, targ.netname, deathlocation, "", targ.team, 0, 0);
 			}
 			else
 			{
@@ -295,13 +300,13 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en
 				{
 					case DEATH_MIRRORDAMAGE:
 					{
-						Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", CS(targ).killcount, 0, 0);
+						Obituary_SpecialDeath(targ, NULL, false, deathtype, targ.netname, deathlocation, "", CS(targ).killcount, 0, 0);
 						break;
 					}
 
 					default:
 					{
-						Obituary_SpecialDeath(targ, false, deathtype, targ.netname, deathlocation, "", CS(targ).killcount, 0, 0);
+						Obituary_SpecialDeath(targ, NULL, false, deathtype, targ.netname, deathlocation, "", CS(targ).killcount, 0, 0);
 						break;
 					}
 				}
@@ -441,7 +446,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en
 				f3 = buff_FirstFromFlags(STAT(BUFFS, attacker)).m_id;
 
 			if (!Obituary_WeaponDeath(targ, attacker, true, deathtype, playername(targ.netname, targ.team, true), playername(attacker_name, attacker.team, true), deathlocation, CS(targ).killcount, kill_count_to_attacker))
-				Obituary_SpecialDeath(targ, true, deathtype, playername(targ.netname, targ.team, true), playername(attacker_name, attacker.team, true), deathlocation, CS(targ).killcount, kill_count_to_attacker, f3);
+				Obituary_SpecialDeath(targ, attacker, true, deathtype, playername(targ.netname, targ.team, true), playername(attacker_name, attacker.team, true), deathlocation, CS(targ).killcount, kill_count_to_attacker, f3);
 		}
 	}
 
@@ -457,7 +462,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en
 			// and there will be a REAL DEATH_VOID implementation which mappers will use.
 			case DEATH_HURTTRIGGER:
 			{
-				Obituary_SpecialDeath(targ, false, deathtype,
+				Obituary_SpecialDeath(targ, NULL, false, deathtype,
 					playername(targ.netname, targ.team, true),
 					inflictor.message,
 					deathlocation,
@@ -469,7 +474,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en
 
 			case DEATH_CUSTOM:
 			{
-				Obituary_SpecialDeath(targ, false, deathtype,
+				Obituary_SpecialDeath(targ, NULL, false, deathtype,
 					playername(targ.netname, targ.team, true),
 					((strstrofs(deathmessage, "%", 0) < 0) ? strcat("%s ", deathmessage) : deathmessage),
 					deathlocation,
@@ -481,7 +486,7 @@ void Obituary(entity attacker, entity inflictor, entity targ, int deathtype, .en
 
 			default:
 			{
-				Obituary_SpecialDeath(targ, false, deathtype, playername(targ.netname, targ.team, true), deathlocation, "", CS(targ).killcount, 0, 0);
+				Obituary_SpecialDeath(targ, NULL, false, deathtype, playername(targ.netname, targ.team, true), deathlocation, "", CS(targ).killcount, 0, 0);
 				break;
 			}
 		}
diff --git a/qcsrc/server/damage.qh b/qcsrc/server/damage.qh
index 314074824..848e9773a 100644
--- a/qcsrc/server/damage.qh
+++ b/qcsrc/server/damage.qh
@@ -90,6 +90,7 @@ void LogDeath(string mode, int deathtype, entity killer, entity killed);
 
 void Obituary_SpecialDeath(
 	entity notif_target,
+	entity attacker,
 	float murder,
 	int deathtype,
 	string s1, string s2, string s3,