cl_forcemyplayer*
authorRudolf Polzer <divverent@alientrap.org>
Tue, 3 Jan 2012 15:19:59 +0000 (16:19 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 3 Jan 2012 15:19:59 +0000 (16:19 +0100)
defaultXonotic.cfg
qcsrc/client/autocvars.qh
qcsrc/client/csqcmodel_hooks.qc

index fb50f79..5dcfb3f 100644 (file)
@@ -1923,9 +1923,12 @@ set waypoint_benchmark 0 "quit after waypoint loading to benchmark bot navigatio
 set g_debug_bot_commands 0 "print scripted bot commands before executing"
 set g_debug_defaultsounds 0 "always use default sounds"
 set sv_use_csqc_players 1 "set to 0 to disable CSQC players for better Xonotic 0.5 compat"
-set cl_forceplayermodels 0 "make everyone look like your own model (requires server to have sv_use_csqc_players 1 and sv_defaultcharacter 0)"
-set cl_forceplayercolors 0 "make everyone look like your own color (requires server to have sv_use_csqc_players 1 and sv_defaultcharacter 0, and is ignored in teamplay)"
 set cl_precacheplayermodels 0 "TODO please check if this needs to be 1 or if precaching a model the server already requested is fast enough to do it at runtime"
+seta cl_forceplayermodels 0 "make everyone look like your own model (requires server to have sv_use_csqc_players 1 and sv_defaultcharacter 0)"
+seta cl_forceplayercolors 0 "make everyone look like your own color (requires server to have sv_use_csqc_players 1 and sv_defaultcharacter 0, and is ignored in teamplay)"
+seta cl_forcemyplayermodel "" "set to the model file name you want to show yourself as (requires server to have sv_use_csqc_players 1; does not affect how enemies look with cl_forceplayermodels)"
+seta cl_forcemyplayerskin 0 "set to the skin number you want to show yourself as (requires server to have sv_use_csqc_players 1; does not affect how enemies look with cl_forceplayermodels)"
+seta cl_forcemyplayercolors 0 "set to the color value (encoding is same as _cl_color) for your own player model (requires server to have sv_use_csqc_players 1, and is ignored in teamplay; does not affect how enemies look with cl_forceplayermodels)"
 
 // debug cvars for keyhunt attaching
 set _angles "0 0 0"
index 489f79d..31fe318 100644 (file)
@@ -378,6 +378,9 @@ float autocvar_cl_loddistance1 = 1024;
 float autocvar_cl_loddistance2 = 4096;
 float autocvar_cl_forceplayermodels;
 float autocvar_cl_forceplayercolors;
+string autocvar_cl_forcemyplayermodel;
+float autocvar_cl_forcemyplayerskin;
+float autocvar_cl_forcemyplayercolors;
 float autocvar__cl_playerskin;
 string autocvar__cl_playermodel;
 float autocvar_cl_precacheplayermodels;
index 12cae8e..92b8983 100644 (file)
@@ -74,6 +74,10 @@ void CSQCPlayer_LOD_Apply(void)
 string forceplayermodels_model;
 float forceplayermodels_modelindex;
 float forceplayermodels_skin;
+
+string forceplayermodels_mymodel;
+float forceplayermodels_mymodelindex;
+
 float forceplayermodels_attempted;
 .string forceplayermodels_savemodel;
 .float forceplayermodels_savemodelindex;
@@ -112,6 +116,8 @@ void CSQCPlayer_ForceModel_Apply(float islocalplayer)
        // forcemodel finding
        if(!forceplayermodels_attempted)
        {
+               forceplayermodels_attempted = 1;
+
                // only if this failed, find it out on our own
                entity e;
                e = spawn();
@@ -119,12 +125,27 @@ void CSQCPlayer_ForceModel_Apply(float islocalplayer)
                forceplayermodels_model = e.model;
                forceplayermodels_modelindex = e.modelindex;
                forceplayermodels_skin = autocvar__cl_playerskin;
-               forceplayermodels_attempted = 1;
+               remove(e);
+       }
+
+       if(autocvar_cl_forcemyplayermodel != "" && autocvar_cl_forcemyplayermodel != forceplayermodels_mymodel)
+       {
+               entity e;
+               e = spawn();
+               setmodel(e, autocvar_cl_forcemyplayermodel); // this is harmless, see below
+               forceplayermodels_mymodel = e.model;
+               forceplayermodels_mymodelindex = e.modelindex;
                remove(e);
        }
 
        // apply it
-       if(autocvar_cl_forceplayermodels && forceplayermodels_modelindex)
+       if(autocvar_cl_forcemyplayermodel != "" && forceplayermodels_mymodelindex && self.entnum == player_localnum + 1)
+       {
+               self.model = forceplayermodels_mymodel;
+               self.modelindex = forceplayermodels_mymodelindex;
+               self.skin = autocvar_cl_forcemyplayerskin;
+       }
+       else if(autocvar_cl_forceplayermodels && forceplayermodels_modelindex)
        {
                self.model = forceplayermodels_model;
                self.modelindex = forceplayermodels_modelindex;
@@ -139,8 +160,12 @@ void CSQCPlayer_ForceModel_Apply(float islocalplayer)
 
        // forceplayercolors too
        if(!teamplay)
-               if(autocvar_cl_forceplayercolors)
+       {
+               if(autocvar_cl_forcemyplayercolors && self.entnum == player_localnum + 1)
+                       self.colormap = 1024 + autocvar_cl_forcemyplayercolors;
+               else if(autocvar_cl_forceplayercolors)
                        self.colormap = player_localnum + 1;
+       }
 }
 
 // FEATURE: fallback frames