From 1903b497e4c4acb968bed76b5a40b233674db2eb Mon Sep 17 00:00:00 2001 From: div0 Date: Fri, 11 Aug 2006 16:43:09 +0000 Subject: [PATCH] "impulse 18" now shows the player you point to git-svn-id: svn://svn.icculus.org/nexuiz/trunk/data@1814 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- qcsrc/server/cl_impulse.qc | 17 +++++++++++++++++ qcsrc/server/clientcommands.qc | 11 +---------- qcsrc/server/constants.qh | 5 +++++ qcsrc/server/miscfunctions.qc | 13 +++++++++++++ qcsrc/server/teamplay.qc | 6 ------ 5 files changed, 36 insertions(+), 16 deletions(-) diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index 44fdcfa05..2ff06ed2f 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -113,6 +113,23 @@ void ImpulseCommands (void) && !cvar("g_rocketarena") && !cvar("g_lms") && cvar("g_pickup_items") && !cvar("g_nixnex")) W_ThrowWeapon(self.velocity * 0.5 + v_forward * 750, '0 0 0', TRUE); } + else if (imp == 18) + { + if(self.cursor_trace_ent.classname == "player") + { + string t; + string h; + t = "^3"; + h = ""; + if(teams_matter) + { + t = Team_ColorCode(self.cursor_trace_ent.team); + if(self.team == self.cursor_trace_ent.team) + h = strcat(" (", ftos(self.cursor_trace_ent.health), "% health)"); + } + centermsg_set(CENTERMSG_KILL, strcat(t, self.cursor_trace_ent.netname, h)); + } + } else { if (cvar("sv_cheats")) diff --git a/qcsrc/server/clientcommands.qc b/qcsrc/server/clientcommands.qc index 12981d47b..a3413d8e1 100644 --- a/qcsrc/server/clientcommands.qc +++ b/qcsrc/server/clientcommands.qc @@ -12,16 +12,7 @@ void Say(entity source, float teamsay, string msgin) if(msgin == "") return; - if(source.team == COLOR_TEAM1) - colorstr = "^1"; - else if(source.team == COLOR_TEAM2) - colorstr = "^4"; - else if(source.team == COLOR_TEAM3) - colorstr = "^6"; - else if(source.team == COLOR_TEAM4) - colorstr = "^3"; - else - colorstr = "^7"; + colorstr = Team_ColorCode(source.team); if(!teams_matter) teamsay = FALSE; diff --git a/qcsrc/server/constants.qh b/qcsrc/server/constants.qh index 55d5871fb..143bfbe5b 100644 --- a/qcsrc/server/constants.qh +++ b/qcsrc/server/constants.qh @@ -210,3 +210,8 @@ float FLAG_CARRY = 2; float FLAG_DROPPED = 3; float MAX_SHOT_DISTANCE = 32768; + +float COLOR_TEAM1 = 5; // red +float COLOR_TEAM2 = 14; // blue +float COLOR_TEAM3 = 10; // pink +float COLOR_TEAM4 = 13; // yellow diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index e4f931083..9493d4065 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -475,3 +475,16 @@ void DistributeFragsAmongTeam(entity p, float targetteam, float factor) error(strcat("There were ", ftos(f), " frags left. BAD!")); } +string Team_ColorCode(float team) +{ + if(team == COLOR_TEAM1) + return "^1"; + else if(team == COLOR_TEAM2) + return "^4"; + else if(team == COLOR_TEAM3) + return "^6"; + else if(team == COLOR_TEAM4) + return "^3"; + else + return "^7"; +} diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 85743a85a..c8906adfc 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -1,9 +1,3 @@ -float COLOR_TEAM1 = 5; // red -float COLOR_TEAM2 = 14; // blue -float COLOR_TEAM3 = 10; // pink -float COLOR_TEAM4 = 13; // yellow - - float GAME_DEATHMATCH = 1; float GAME_TEAM_DEATHMATCH = 2; float GAME_DOMINATION = 3; -- 2.39.2