[nexuiz-commits] r7065 - in trunk/data: . qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun Jun 21 06:14:37 EDT 2009
Author: div0
Date: 2009-06-21 06:14:36 -0400 (Sun, 21 Jun 2009)
New Revision: 7065
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/server/cl_client.qc
trunk/data/qcsrc/server/cl_player.qc
trunk/data/qcsrc/server/defs.qh
trunk/data/qcsrc/server/miscfunctions.qc
Log:
PLAYER MODEL FORCING. Highly experimental. cl_forcemodels shows all enemies as your current model and skin; cl_forcemodelsfromnexuiz applies that only to players using a model that does not come with Nexuiz (e.g. to not see NSFW models or cows).
cl_forcemodels can be deactivated by the server admin using sv_clforcemodels 0. cl_forcemodelsfromnexuiz is always allowed.
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2009-06-20 21:10:41 UTC (rev 7064)
+++ trunk/data/defaultNexuiz.cfg 2009-06-21 10:14:36 UTC (rev 7065)
@@ -1577,3 +1577,7 @@
set bot_navigation_ignoreplayers 0 // FIXME remove this once the issue is solved
set bot_sound_monopoly 0 "when enabled, only bots can make any noise"
+
+seta cl_forcemodels 0 "force all players to look like you"
+seta cl_forcemodelsfromnexuiz 0 "force models coming from nexuiz"
+set sv_clforcemodels 1 "allow clients to use cl_forcemodels"
Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc 2009-06-20 21:10:41 UTC (rev 7064)
+++ trunk/data/qcsrc/server/cl_client.qc 2009-06-21 10:14:36 UTC (rev 7065)
@@ -398,6 +398,20 @@
*/
float Client_customizeentityforclient()
{
+ entity modelsource;
+
+ if(self.modelindex == 0)
+ return TRUE;
+
+ modelsource = self;
+ if(!self.modelindex_lod0_from_nexuiz)
+ if(self.cvar_cl_forceplayermodelsfromnexuiz)
+ modelsource = other;
+ if(self.cvar_cl_forceplayermodels && sv_clforceplayermodels)
+ modelsource = other;
+
+ self.skin = modelsource.skinindex;
+
#ifdef ALLOW_VARIABLE_LOD
// self: me
// other: the player viewing me
@@ -410,23 +424,25 @@
if(other.cvar_cl_playerdetailreduction <= 0)
{
if(other.cvar_cl_playerdetailreduction <= -2)
- self.modelindex = self.modelindex_lod2;
+ self.modelindex = modelsource.modelindex_lod2;
else if(other.cvar_cl_playerdetailreduction <= -1)
- self.modelindex = self.modelindex_lod1;
+ self.modelindex = modelsource.modelindex_lod1;
else
- self.modelindex = self.modelindex_lod0;
+ self.modelindex = modelsource.modelindex_lod0;
}
else
{
distance = vlen(self.origin - other.origin);
f = (distance + 100.0) * other.cvar_cl_playerdetailreduction;
if(f > 10000)
- self.modelindex = self.modelindex_lod2;
+ self.modelindex = modelsource.modelindex_lod2;
else if(f > 5000)
- self.modelindex = self.modelindex_lod1;
+ self.modelindex = modelsource.modelindex_lod1;
else
- self.modelindex = self.modelindex_lod0;
+ self.modelindex = modelsource.modelindex_lod0;
}
+#else
+ self.modelindex = modelsource.modelindex_lod0;
#endif
return TRUE;
@@ -471,7 +487,14 @@
#else
precache_model(modelname);
setmodel(e, modelname); // players have high precision
+ self.modelindex_lod0 = self.modelindex;
+ // save it for possible player model forcing
#endif
+
+ string s;
+ s = whichpack(self.model);
+ self.modelindex_lod0_from_nexuiz = ((s == "") || (substring(s, 0, 4) == "data"));
+
player_setupanimsformodel();
UpdatePlayerSounds();
}
@@ -661,8 +684,8 @@
chmdl = TRUE;
}
- oldskin = self.skin;
- self.skin = defaultskin;
+ oldskin = self.skinindex;
+ self.skinindex = defaultskin;
} else {
if (self.playermodel != self.model)
{
@@ -674,11 +697,11 @@
chmdl = TRUE;
}
- oldskin = self.skin;
- self.skin = RestrictSkin(stof(self.playerskin));
+ oldskin = self.skinindex;
+ self.skinindex = RestrictSkin(stof(self.playerskin));
}
- if(chmdl || oldskin != self.skin)
+ if(chmdl || oldskin != self.skinindex)
self.species = player_getspecies(); // model or skin has changed
if(!teams_matter)
Modified: trunk/data/qcsrc/server/cl_player.qc
===================================================================
--- trunk/data/qcsrc/server/cl_player.qc 2009-06-20 21:10:41 UTC (rev 7064)
+++ trunk/data/qcsrc/server/cl_player.qc 2009-06-21 10:14:36 UTC (rev 7065)
@@ -44,11 +44,15 @@
self.armorvalue = oldself.armorvalue;
self.armortype = oldself.armortype;
self.model = oldself.model;
- self.modelindex = oldself.modelindex;
+ self.modelindex_lod0 = oldself.modelindex_lod0;
+#ifdef ALLOW_VARIABLE_LOD
+ self.modelindex_lod1 = oldself.modelindex_lod1;
+ self.modelindex_lod2 = oldself.modelindex_lod2;
+#endif
+ self.skinindex = oldself.skinindex;
self.species = oldself.species;
self.movetype = oldself.movetype;
self.nextthink = oldself.nextthink;
- self.skin = oldself.skin;
self.solid = oldself.solid;
self.takedamage = oldself.takedamage;
self.think = oldself.think;
@@ -89,7 +93,7 @@
continue;
fgets(fh); fgets(fh);
sk = stof(fgets(fh));
- if(sk == (j ? 0 : self.skin)) // 2nd pass skips the skin test
+ if(sk == (j ? 0 : self.skinindex)) // 2nd pass skips the skin test
if(fgets(fh) == self.model)
{
l = fgets(fh);
Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh 2009-06-20 21:10:41 UTC (rev 7064)
+++ trunk/data/qcsrc/server/defs.qh 2009-06-21 10:14:36 UTC (rev 7065)
@@ -330,10 +330,15 @@
.string cvar_g_nexuizversion;
.string cvar_cl_weaponpriority;
.string cvar_cl_weaponpriorities[10];
+.float cvar_cl_forceplayermodels;
+.float cvar_cl_forceplayermodelsfromnexuiz;
+float sv_clforceplayermodels;
.float version_nagtime;
.float modelindex_lod0;
+.float modelindex_lod0_from_nexuiz;
+.float skinindex;
#ifdef ALLOW_VARIABLE_LOD
.float modelindex_lod1;
.float modelindex_lod2;
Modified: trunk/data/qcsrc/server/miscfunctions.qc
===================================================================
--- trunk/data/qcsrc/server/miscfunctions.qc 2009-06-20 21:10:41 UTC (rev 7064)
+++ trunk/data/qcsrc/server/miscfunctions.qc 2009-06-21 10:14:36 UTC (rev 7065)
@@ -526,6 +526,8 @@
GetCvars_handleFloat(s, f, cvar_cl_voice_directional, "cl_voice_directional");
GetCvars_handleFloat(s, f, cvar_cl_voice_directional_taunt_attenuation, "cl_voice_directional_taunt_attenuation");
GetCvars_handleFloat(s, f, cvar_cl_hitsound, "cl_hitsound");
+ GetCvars_handleFloat(s, f, cvar_cl_forceplayermodels, "cl_forceplayermodels");
+ GetCvars_handleFloat(s, f, cvar_cl_forceplayermodelsfromnexuiz, "cl_forceplayermodelsfromnexuiz");
// fixup of switchweapon (needed for LMS or when spectating is disabled, as PutClientInServer comes too early)
if(f > 0)
More information about the nexuiz-commits
mailing list