From b0525d436a638e97535d292e64e27c2aad6c5b99 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 7 Mar 2017 23:06:02 +1000 Subject: [PATCH] Use autocvars for the per-team player models/skins, speedup for a slow function --- qcsrc/server/autocvars.qh | 4 ++++ qcsrc/server/client.qc | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index c5c844e91..85b767fc9 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -282,6 +282,10 @@ bool autocvar_sv_curl_serverpackages_auto; bool autocvar_sv_db_saveasdump; bool autocvar_sv_defaultcharacter; bool autocvar_sv_defaultcharacterskin; +int autocvar_sv_defaultplayerskin_blue; +int autocvar_sv_defaultplayerskin_pink; +int autocvar_sv_defaultplayerskin_red; +int autocvar_sv_defaultplayerskin_yellow; string autocvar_sv_defaultplayercolors; string autocvar_sv_defaultplayermodel; string autocvar_sv_defaultplayermodel_blue; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 0e84ec824..ddbf0fd1c 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -383,11 +383,12 @@ void FixPlayermodel(entity player) { if(teamplay) { - string s = Static_Team_ColorName_Lower(player.team); - if (s != "neutral") + switch(player.team) { - defaultmodel = cvar_string(strcat("sv_defaultplayermodel_", s)); - defaultskin = cvar(strcat("sv_defaultplayerskin_", s)); + case NUM_TEAM_1: defaultmodel = autocvar_sv_defaultplayermodel_red; defaultskin = autocvar_sv_defaultplayerskin_red; break; + case NUM_TEAM_2: defaultmodel = autocvar_sv_defaultplayermodel_blue; defaultskin = autocvar_sv_defaultplayerskin_blue; break; + case NUM_TEAM_3: defaultmodel = autocvar_sv_defaultplayermodel_yellow; defaultskin = autocvar_sv_defaultplayerskin_yellow; break; + case NUM_TEAM_4: defaultmodel = autocvar_sv_defaultplayermodel_pink; defaultskin = autocvar_sv_defaultplayerskin_pink; break; } } @@ -418,9 +419,13 @@ void FixPlayermodel(entity player) { if(teamplay) { - string s = Static_Team_ColorName_Lower(player.team); - if (s != "neutral") - defaultskin = cvar(strcat("sv_defaultplayerskin_", s)); + switch(player.team) + { + case NUM_TEAM_1: defaultskin = autocvar_sv_defaultplayerskin_red; break; + case NUM_TEAM_2: defaultskin = autocvar_sv_defaultplayerskin_blue; break; + case NUM_TEAM_3: defaultskin = autocvar_sv_defaultplayerskin_yellow; break; + case NUM_TEAM_4: defaultskin = autocvar_sv_defaultplayerskin_pink; break; + } } if(!defaultskin) -- 2.39.2