From 5ecbee94a0f236f3afc6dd84db22945377363c8c Mon Sep 17 00:00:00 2001
From: z411 <z411@omaera.org>
Date: Sun, 20 Mar 2022 00:57:30 -0300
Subject: [PATCH] Show player names in centerprint title in 1v1 games

---
 qcsrc/client/announcer.qc | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/qcsrc/client/announcer.qc b/qcsrc/client/announcer.qc
index 64606a6846..bd89c80452 100644
--- a/qcsrc/client/announcer.qc
+++ b/qcsrc/client/announcer.qc
@@ -5,6 +5,7 @@
 #include <common/notifications/all.qh>
 #include <common/stats.qh>
 #include <common/mapinfo.qh>
+#include <common/ent_cs.qh>
 
 bool announcer_1min;
 bool announcer_5min;
@@ -107,7 +108,18 @@ void Announcer_Gamestart()
 
 			if(!warmup_stage && time < STAT(GAMESTARTTIME))
 			{
-				centerprint_SetTitle(strcat("^BG", MapInfo_Type_ToText(gametype))); // Set centerprint title
+				if (gametype.m_1v1)
+				{
+					entity pl1 = players.sort_next;
+					entity pl2 = pl1.sort_next;
+					string pl1_name = (pl1 && pl1.team != NUM_SPECTATOR ? entcs_GetName(pl1.sv_entnum) : "???");
+					string pl2_name = (pl2 && pl2.team != NUM_SPECTATOR ? entcs_GetName(pl2.sv_entnum) : "???");
+
+					centerprint_SetTitle(sprintf(_("^BG%s^BG vs %s"), pl1_name, pl2_name)); // Show duelers in 1v1 game mode
+				}
+				else
+					centerprint_SetTitle(strcat("^BG", MapInfo_Type_ToText(gametype))); // Show game type as title
+
 				if(time + 5.0 < startTime) // if connecting to server while restart was active don't always play prepareforbattle
 					Local_Notification(MSG_ANNCE, ANNCE_PREPARE);
 			}
-- 
2.39.5