From: Rudolf Polzer Date: Fri, 2 Dec 2011 11:44:57 +0000 (+0100) Subject: simplification X-Git-Tag: xonotic-v0.6.0~74^2~100^2~22 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d2d48afbde0ad19f30d8a93439dafcc8e4daa68f;p=xonotic%2Fxonotic-data.pk3dir.git simplification --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index a816d6248..8591eac32 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -15,63 +15,63 @@ void CSQCModel_Hook_PreDraw(float isplayer) self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? (self.colormap & 0xFF) : stof(getplayerkeyvalue(self.colormap - 1, "colors"))), TRUE) * 2; else self.glowmod = '1 1 1'; - } - if(self.modelindex != 0 && isplayer && self.model != "null") - { - // LOD - if(self.lodmodelindex0 != self.modelindex) + if(self.modelindex != 0 && self.model != "null") { - string modelname = self.model; - string s; + // LOD + if(self.lodmodelindex0 != self.modelindex) + { + string modelname = self.model; // NOTE: self.model is ALWAYS true model name, self.modelindex may have been rewritten + string s; - // set modelindex - self.lodmodelindex0 = self.modelindex; - self.lodmodelindex1 = self.modelindex; - self.lodmodelindex2 = self.modelindex; + // set modelindex + self.lodmodelindex0 = self.modelindex; + self.lodmodelindex1 = self.modelindex; + self.lodmodelindex2 = 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) - self.lodmodelindex1 = 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) + self.lodmodelindex1 = 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) + self.lodmodelindex2 = self.modelindex; + } + + setmodel(self, modelname); // make everything normal again } - s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod2", substring(modelname, -4, 4)); - if(fexists(s)) + if(autocvar_cl_playerdetailreduction <= 0) { - precache_model(s); - setmodel(self, s); - if(self.modelindex) - self.lodmodelindex2 = self.modelindex; + if(autocvar_cl_playerdetailreduction <= -2) + self.modelindex = self.lodmodelindex2; + else if(autocvar_cl_playerdetailreduction <= -1) + self.modelindex = self.lodmodelindex1; + else + self.modelindex = self.lodmodelindex0; } - - setmodel(self, modelname); // make everything normal again - } - - if(autocvar_cl_playerdetailreduction <= 0) - { - if(autocvar_cl_playerdetailreduction <= -2) - self.modelindex = self.lodmodelindex2; - else if(autocvar_cl_playerdetailreduction <= -1) - self.modelindex = self.lodmodelindex1; else - self.modelindex = self.lodmodelindex0; - } - else - { - float distance = vlen(self.origin - other.origin); - float f = (distance + 100.0) * autocvar_cl_playerdetailreduction; - f *= 1.0 / bound(0.01, view_quality, 1); - if(f > autocvar_cl_loddistance2) - self.modelindex = self.lodmodelindex2; - else if(f > autocvar_cl_loddistance1) - self.modelindex = self.lodmodelindex1; - else - self.modelindex = self.lodmodelindex0; + { + float distance = vlen(self.origin - other.origin); + float f = (distance + 100.0) * autocvar_cl_playerdetailreduction; + f *= 1.0 / bound(0.01, view_quality, 1); + if(f > autocvar_cl_loddistance2) + self.modelindex = self.lodmodelindex2; + else if(f > autocvar_cl_loddistance1) + self.modelindex = self.lodmodelindex1; + else + self.modelindex = self.lodmodelindex0; + } } }