9 void CSQCModel_Hook_PreDraw(float isplayer)
11 // auto glowmod from colormap
15 self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? (self.colormap & 0xFF) : stof(getplayerkeyvalue(self.colormap - 1, "colors"))), TRUE) * 2;
17 self.glowmod = '1 1 1';
20 if(self.modelindex != 0)
23 if(self.lodmodelindex0 != self.modelindex)
25 string modelname = self.model;
29 self.lodmodelindex0 = self.modelindex;
30 self.lodmodelindex1 = self.modelindex;
31 self.lodmodelindex2 = self.modelindex;
33 // FIXME: this only supports 3-letter extensions
34 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod1", substring(modelname, -4, 4));
39 if(self.modelindex > 0)
40 self.lodmodelindex1 = self.modelindex;
43 s = strcat(substring(modelname, 0, strlen(modelname)-4), "_lod2", substring(modelname, -4, 4));
48 if(self.modelindex > 0)
49 self.lodmodelindex2 = self.modelindex;
52 setmodel(self, modelname); // make everything normal again
55 if(autocvar_cl_playerdetailreduction <= 0)
57 if(autocvar_cl_playerdetailreduction <= -2)
58 self.modelindex = self.lodmodelindex2;
59 else if(autocvar_cl_playerdetailreduction <= -1)
60 self.modelindex = self.lodmodelindex1;
62 self.modelindex = self.lodmodelindex0;
66 float distance = vlen(self.origin - other.origin);
67 float f = (distance + 100.0) * autocvar_cl_playerdetailreduction;
68 f *= 1.0 / bound(0.01, view_quality, 1);
69 if(f > autocvar_cl_loddistance2)
70 self.modelindex = self.lodmodelindex2;
71 else if(f > autocvar_cl_loddistance1)
72 self.modelindex = self.lodmodelindex1;
74 self.modelindex = self.lodmodelindex0;
80 if(self.tag_entity && wasfreed(self.tag_entity))
81 self.tag_entity = world;
83 if(self.tag_networkentity)
86 if(self.tag_entity.entnum == self.tag_networkentity)
89 self.drawmask = MASK_NORMAL;
93 // to something NEW NEW NEW NEW!
94 self.tag_entity = findfloat(world, entnum, self.tag_networkentity);
97 // the best part is: IT EXISTS
98 self.drawmask = MASK_NORMAL;
100 if(substring(self.model, 0, 17) == "models/weapons/v_")
101 if(substring(self.tag_entity.model, 0, 17) == "models/weapons/h_")
103 self.tag_index = gettagindex(self.tag_entity, "weapon");
105 self.tag_index = gettagindex(self.tag_entity, "tag_weapon");
108 // we need to prevent this from 'appening
109 self.tag_entity = world;
111 dprint("h_ model lacks weapon attachment, but v_ model is attached to it\n");
115 if(substring(self.model, 0, 17) == "models/weapons/v_")
116 if(substring(self.tag_entity.model, 0, 14) == "models/player/")
118 self.tag_index = gettagindex(self.tag_entity, "tag_weapon");
120 self.tag_index = gettagindex(self.tag_entity, "bip01 r hand");
123 if(substring(self.tag_entity.model, 0, 17) == "models/weapons/v_")
125 self.tag_index = gettagindex(self.tag_entity, "shot");
127 self.tag_index = gettagindex(self.tag_entity, "tag_shot");
132 // damn, see you next frame
140 self.drawmask = MASK_NORMAL;