From: Mario Date: Tue, 7 Mar 2017 13:06:02 +0000 (+1000) Subject: Use autocvars for the per-team player models/skins, speedup for a slow function X-Git-Tag: xonotic-v0.8.2~112 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=b0525d436a638e97535d292e64e27c2aad6c5b99;p=xonotic%2Fxonotic-data.pk3dir.git Use autocvars for the per-team player models/skins, speedup for a slow function --- 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)