-erebus,erebus
-erebus.001,shadowhead
+erebus,textures/common/nodraw
+erebus.001,textures/common/nodraw
var float autocvar_cl_eventchase_speed = 1.3;
float autocvar_cl_lerpexcess;
string autocvar__togglezoom;
+float autocvar_cl_playerdetailreduction;
+float autocvar_cl_loddistance1 = 1024;
+float autocvar_cl_loddistance2 = 4096;
--- /dev/null
+.vector glowmod;
+.float modelindex_lod0;
+.float modelindex_lod1;
+.float modelindex_lod2;
+
+void CSQCModels_Hook_PreDraw()
+{
+ // auto glowmod from colormap
+ self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? (self.colormap & 0xFF) : stof(getplayerkey(self.entnum - 1, "colors"))), TRUE) * 2;
+
+ if(self.modelindex != 0)
+ {
+ // LOD
+ if(self.modelindex_lod0 != self.modelindex)
+ {
+ string modelname = self.model;
+ string s;
+
+ // set modelindex
+ self.modelindex_lod0 = self.modelindex;
+ self.modelindex_lod1 = self.modelindex;
+ self.modelindex_lod2 = self.modelindex;
+
+ // FIXME: this only supports 3-letter extensions
+ s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod1", substring(modelname, -4, 4));
+ if(fexists(s))
+ {
+ precache_model(s);
+ setmodel(self, s);
+ if(self.modelindex > 0)
+ self.modelindex_lod1 = self.modelindex;
+ }
+
+ s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod2", substring(modelname, -4, 4));
+ if(fexists(s))
+ {
+ precache_model(s);
+ setmodel(self, s);
+ if(self.modelindex > 0)
+ self.modelindex_lod2 = self.modelindex;
+ }
+
+ setmodel(self, modelname); // make everything normal again
+ }
+
+ if(autocvar_cl_playerdetailreduction <= 0)
+ {
+ if(autocvar_cl_playerdetailreduction <= -2)
+ self.modelindex = self.modelindex_lod2;
+ else if(autocvar_cl_playerdetailreduction <= -1)
+ self.modelindex = self.modelindex_lod1;
+ else
+ self.modelindex = self.modelindex_lod0;
+ }
+ else
+ {
+ float distance = vlen(self.origin - other.origin);
+ float f = (distance + 100.0) * autocvar_cl_playerdetailreduction;
+ if(f > autocvar_cl_loddistance2)
+ self.modelindex = self.modelindex_lod2;
+ else if(f > autocvar_cl_loddistance1)
+ self.modelindex = self.modelindex_lod1;
+ else
+ self.modelindex = self.modelindex_lod0;
+ }
+ }
+}
+
hud.qc
scoreboard.qc
mapvoting.qc
+csqcmodels_hooks.qc
rubble.qc
hook.qc
#define CSQCMODELS_HOOK_PREUPDATE
#define CSQCMODELS_HOOK_POSTUPDATE
#define CSQCMODELS_HOOK_PREDRAW \
- self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? (self.colormap & 0xFF) : stof(getplayerkey(self.entnum - 1, "colors"))), TRUE) * 2;
+ CSQCModels_Hook_PreDraw();
// mod must define:
//vector PL_MIN = ...;
IS_CHEAT(i, 0, 0);
FOR_EACH_PLAYER(e)
{
- get_model_parameters(e.playermodel, e.skinindex);
+ get_model_parameters(e.playermodel, e.skin);
if(get_model_parameters_sex == "Female")
{
makevectors(e.angles);
return plyermodel;
}
-/*
-=============
-Client_customizeentityforclient
-
-LOD reduction
-=============
-*/
-void Client_uncustomizeentityforclient()
+void setplayermodel(entity e, string modelname)
{
- if(self.modelindex == 0) // no need to uncustomize then
- return;
- self.modelindex = self.modelindex_lod0;
- self.skin = self.skinindex;
-}
-
-float Client_customizeentityforclient()
-{
- entity modelsource;
-
- if(self.modelindex == 0)
- return TRUE;
-
- // forcemodel stuff
-
-#ifdef PROFILING
- float t0;
- t0 = gettime(GETTIME_HIRES); // reference
-#endif
-
- modelsource = self;
-
-#ifdef ALLOW_FORCEMODELS
- if(other.cvar_cl_forceplayermodelsfromxonotic)
- if not(self.modelindex_lod0_from_xonotic)
- modelsource = other;
- if(other.cvar_cl_forceplayermodels && sv_clforceplayermodels)
- modelsource = other;
-#endif
-
- self.skin = modelsource.skinindex;
-
-#if 0
- if(modelsource == self)
- self.skin = modelsource.skinindex;
- else
- self.skin = mod(modelsource.skinindex, 3); // forbid the fbskins as forced skins
-#endif
-
- // self: me
- // other: the player viewing me
- float distance;
- float f;
-
- if(other.cvar_cl_playerdetailreduction <= 0)
- {
- if(other.cvar_cl_playerdetailreduction <= -2)
- self.modelindex = modelsource.modelindex_lod2;
- else if(other.cvar_cl_playerdetailreduction <= -1)
- self.modelindex = modelsource.modelindex_lod1;
- else
- self.modelindex = modelsource.modelindex_lod0;
- }
- else
- {
- distance = vlen(self.origin - other.origin);
- f = (distance + 100.0) * other.cvar_cl_playerdetailreduction;
- if(f > sv_loddistance2)
- self.modelindex = modelsource.modelindex_lod2;
- else if(f > sv_loddistance1)
- self.modelindex = modelsource.modelindex_lod1;
- else
- self.modelindex = modelsource.modelindex_lod0;
- }
-
-#ifdef PROFILING
- float t1;
- t1 = gettime(GETTIME_HIRES); // reference
- client_cefc_accumulator += (t1 - t0);
-#endif
-
- return TRUE;
-}
-
-void setmodel_lod(entity e, string modelname)
-{
- string s;
-
- if(sv_loddistance1)
- {
- // FIXME: this only supports 3-letter extensions
- s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod1", substring(modelname, -4, 4));
- if(fexists(s))
- {
- setmodel(e, s); // players have high precision
- self.modelindex_lod1 = self.modelindex;
- }
- else
- self.modelindex_lod1 = -1;
-
- s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod2", substring(modelname, -4, 4));
- if(fexists(s))
- {
- setmodel(e, s); // players have high precision
- self.modelindex_lod2 = self.modelindex;
- }
- else
- self.modelindex_lod2 = -1;
-
- precache_model(modelname);
- setmodel(e, modelname); // players have high precision
- self.modelindex_lod0 = self.modelindex;
-
- if(self.modelindex_lod1 < 0)
- self.modelindex_lod1 = self.modelindex;
-
- if(self.modelindex_lod2 < 0)
- self.modelindex_lod2 = self.modelindex;
- }
- else
- {
- precache_model(modelname);
- setmodel(e, modelname); // players have high precision
- self.modelindex_lod0 = self.modelindex;
- // save it for possible player model forcing
- }
-
- s = whichpack(self.model);
- self.modelindex_lod0_from_xonotic = ((s == "") || (substring(s, 0, 4) == "data"));
-
+ precache_model(modelname);
+ setmodel(e, modelname);
player_setupanimsformodel();
UpdatePlayerSounds();
}
self.oldvelocity = self.velocity;
self.fire_endtime = -1;
- if(sv_loddistance1)
- SetCustomizer(self, Client_customizeentityforclient, Client_uncustomizeentityforclient);
-
if(g_arena)
{
if(self.version_mismatch)
{
m1 = self.mins;
m2 = self.maxs;
- setmodel_lod (self, defaultmodel);
+ setplayermodel (self, defaultmodel);
setsize (self, m1, m2);
chmdl = TRUE;
}
- oldskin = self.skinindex;
- self.skinindex = defaultskin;
+ oldskin = self.skin;
+ self.skin = defaultskin;
} else {
if (self.playermodel != self.model || self.playermodel == "")
{
self.playermodel = CheckPlayerModel(self.playermodel); // this is never "", so no endless loop
m1 = self.mins;
m2 = self.maxs;
- setmodel_lod (self, self.playermodel);
+ setplayermodel (self, self.playermodel);
setsize (self, m1, m2);
chmdl = TRUE;
}
- oldskin = self.skinindex;
- self.skinindex = stof(self.playerskin);
+ oldskin = self.skin;
+ self.skin = stof(self.playerskin);
}
- if(chmdl || oldskin != self.skinindex)
+ if(chmdl || oldskin != self.skin)
self.species = player_getspecies(); // model or skin has changed
if(!teamplay)
WriteByte(MSG_ONE, TE_CSQC_SPAWN);
});
- if(sv_loddistance1)
- SetCustomizer(self, Client_customizeentityforclient, Client_uncustomizeentityforclient);
-
self.model = "";
FixPlayermodel();
self.armortype = oldself.armortype;
self.model = oldself.model;
self.modelindex = oldself.modelindex;
- self.modelindex_lod0 = oldself.modelindex_lod0;
- self.modelindex_lod0_from_xonotic = oldself.modelindex_lod0_from_xonotic;
- self.modelindex_lod1 = oldself.modelindex_lod1;
- self.modelindex_lod2 = oldself.modelindex_lod2;
- self.skinindex = oldself.skinindex;
+ self.skin = oldself.skin;
self.species = oldself.species;
self.movetype = oldself.movetype;
self.nextthink = oldself.nextthink;
float player_getspecies()
{
float s;
- get_model_parameters(self.model, self.skinindex);
+ get_model_parameters(self.model, self.skin);
s = get_model_parameters_species;
get_model_parameters(string_null, 0);
if(s < 0)
}
.float modelindex_for_playersound;
-.float skinindex_for_playersound;
+.float skin_for_playersound;
void UpdatePlayerSounds()
{
if(self.modelindex == self.modelindex_for_playersound)
- if(self.skinindex == self.skinindex_for_playersound)
+ if(self.skin == self.skin_for_playersound)
return;
self.modelindex_for_playersound = self.modelindex;
- self.skinindex_for_playersound = self.skinindex;
+ self.skin_for_playersound = self.skin;
ClearPlayerSounds();
LoadPlayerSounds("sound/player/default.sounds", 1);
if(!autocvar_g_debug_defaultsounds)
- if(!LoadPlayerSounds(get_model_datafilename(self.model, self.skinindex, "sounds"), 0))
+ if(!LoadPlayerSounds(get_model_datafilename(self.model, self.skin, "sounds"), 0))
LoadPlayerSounds(get_model_datafilename(self.model, 0, "sounds"), 0);
}
.float() customizeentityforclient;
.float cvar_cl_handicap;
-.float cvar_cl_playerdetailreduction;
.float cvar_cl_clippedspectating;
.float cvar_cl_autoscreenshot;
.float cvar_cl_movement_track_canjump;
.float cvar_cl_forceplayermodelsfromxonotic;
float sv_clforceplayermodels;
#endif
-float sv_loddistance1;
-float sv_loddistance2;
.float cvar_cl_gunalign;
.float cvar_cl_noantilag;
.float version_nagtime;
-.float modelindex_lod0;
-.float modelindex_lod0_from_xonotic;
-.float skinindex;
-.float modelindex_lod1;
-.float modelindex_lod2;
-
#define NUM_JUMPPADSUSED 3
.float jumppadcount;
.entity jumppadsused[NUM_JUMPPADSUSED];
MUTATOR_CALLHOOK(GetCvars);
GetCvars_handleFloat(s, f, autoswitch, "cl_autoswitch");
GetCvars_handleFloat(s, f, cvar_cl_autoscreenshot, "cl_autoscreenshot");
- GetCvars_handleFloat(s, f, cvar_cl_playerdetailreduction, "cl_playerdetailreduction");
GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion");
GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap");
GetCvars_handleFloat(s, f, cvar_cl_clippedspectating, "cl_clippedspectating");
#ifdef ALLOW_FORCEMODELS
sv_clforceplayermodels = cvar("sv_clforceplayermodels");
#endif
- sv_loddistance1 = cvar("sv_loddistance1");
- sv_loddistance2 = cvar("sv_loddistance2");
-
- if(sv_loddistance2 <= sv_loddistance1)
- sv_loddistance2 = 1073741824; // enough to turn off LOD 2 reliably
sv_clones = cvar("sv_clones");
sv_gentle = cvar("sv_gentle");
if(substring(m, -9,5) == "_lod2")
return;
precache_model(m);
- if(sv_loddistance1)
- {
- f = strcat(substring(m, 0, -5), "_lod1", substring(m, -4, -1));
- if(fexists(f))
- precache_model(f);
- f = strcat(substring(m, 0, -5), "_lod2", substring(m, -4, -1));
- if(fexists(f))
- precache_model(f);
- }
+ f = strcat(substring(m, 0, -5), "_lod1", substring(m, -4, -1));
+ if(fexists(f))
+ precache_model(f);
+ f = strcat(substring(m, 0, -5), "_lod2", substring(m, -4, -1));
+ if(fexists(f))
+ precache_model(f);
globhandle = search_begin(strcat(m, "_*.sounds"), TRUE, FALSE);
if (globhandle < 0)
.vector portal_safe_origin;
.float portal_wants_to_vanish;
.float portal_activatetime;
+.float savemodelindex;
float PlayerEdgeDistance(entity p, vector v)
{
other = other.enemy;
if(other == self.aiment)
{
- self.modelindex = self.modelindex_lod0;
+ self.modelindex = self.savemodelindex;
}
else if(IS_INDEPENDENT_PLAYER(other) || IS_INDEPENDENT_PLAYER(self.aiment))
{
}
else
{
- self.modelindex = self.modelindex_lod0;
+ self.modelindex = self.savemodelindex;
}
return TRUE;
}
portal.fade_time = time + autocvar_g_balance_portal_lifetime;
portal.health = autocvar_g_balance_portal_health;
setmodel(portal, "models/portal.md3");
- portal.modelindex_lod0 = portal.modelindex;
+ portal.savemodelindex = portal.modelindex;
portal.customizeentityforclient = Portal_Customize;
if(!Portal_FindSafeOrigin(portal))