.float lip;
.float bgmscriptangular;
+.float lodmodelindex, lodmodelindex2;
+.float loddistance1, loddistance2;
void Ent_Wall_Draw()
{
float f;
+ float d;
vector save;
var .vector fld;
+ if(self.lodmodelindex1)
+ {
+ d = cvar("loddebug");
+ if(d > 0)
+ {
+ if(d == 1)
+ self.modelindex = self.lodmodelindex0;
+ else if(d == 2 || !self.lodmodelindex2)
+ self.modelindex = self.lodmodelindex1;
+ else // if(d == 3)
+ self.modelindex = self.lodmodelindex2;
+ }
+ else
+ {
+ d = vlen(NearestPointOnBox(self, view_origin) - view_origin);
+ if(d < self.loddistance1)
+ self.modelindex = self.lodmodelindex0;
+ else if(!self.lodmodelindex2 || d < self.loddistance2)
+ self.modelindex = self.lodmodelindex1;
+ else
+ self.modelindex = self.lodmodelindex2;
+ }
+ }
+
InterpolateOrigin_Do();
if(self.bgmscriptangular)
if(f & 8)
{
- self.modelindex = ReadShort();
+ if(f & 0x80)
+ {
+ self.lodmodelindex0 = ReadShort();
+ self.loddistance1 = ReadShort();
+ self.lodmodelindex1 = ReadShort();
+ self.loddistance2 = ReadShort();
+ self.lodmodelindex2 = ReadShort();
+ }
+ else
+ {
+ self.modelindex = ReadShort();
+ self.loddistance1 = 0;
+ self.loddistance2 = 0;
+ }
self.solid = ReadByte();
self.scale = ReadShort() / 256.0;
if(f & 0x20)
v_z = 0;
return v;
}
+
+#ifndef MENUQC
+vector NearestPointOnBox(entity box, vector org)
+{
+ vector m1, m2, nearest;
+
+ m1 = box.mins + box.origin;
+ m2 = box.maxs + box.origin;
+
+ nearest_x = bound(m1_x, org_x, m2_x);
+ nearest_y = bound(m1_y, org_y, m2_y);
+ nearest_z = bound(m1_z, org_z, m2_z);
+
+ return nearest;
+}
+#endif
HUD_Panel_GetName_Part2(id)
vector vec2(vector v);
+
+#ifndef MENUQC
+vector NearestPointOnBox(entity box, vector org);
+#endif
}
}
-vector NearestPointOnBox(entity box, vector org)
-{
- vector m1, m2, nearest;
-
- m1 = box.mins + box.origin;
- m2 = box.maxs + box.origin;
-
- nearest_x = bound(m1_x, org_x, m2_x);
- nearest_y = bound(m1_y, org_y, m2_y);
- nearest_z = bound(m1_z, org_z, m2_z);
-
- return nearest;
-}
-
void Damage_RecordDamage(entity attacker, float deathtype, float damage)
{
float weaponid;
sf |= 0x20;
if(self.colormap != 0)
sf |= 0x40;
+ if(self.lodmodelindex1)
+ sf |= 0x80;
WriteByte(MSG_ENTITY, ENT_CLIENT_WALL);
WriteByte(MSG_ENTITY, sf);
if(sf & 8)
{
- WriteShort(MSG_ENTITY, self.modelindex);
+ if(sf & 0x80)
+ {
+ WriteShort(MSG_ENTITY, self.lodmodelindex0);
+ WriteShort(MSG_ENTITY, bound(0, self.loddistance1, 65535));
+ WriteShort(MSG_ENTITY, self.lodmodelindex1);
+ WriteShort(MSG_ENTITY, bound(0, self.loddistance2, 65535));
+ WriteShort(MSG_ENTITY, self.lodmodelindex2);
+ }
+ else
+ WriteShort(MSG_ENTITY, self.modelindex);
WriteByte(MSG_ENTITY, self.solid);
WriteShort(MSG_ENTITY, floor(self.scale * 256));
if(sf & 0x20)
if(!self.solid) self.solid = (sol); else if(self.solid < 0) self.solid = SOLID_NOT;
#define G_CLIENTMODEL_INIT(sol) \
- SetBrushEntityModelNoLOD(); \
+ SetBrushEntityModel(); \
if(!self.scale) self.scale = self.modelscale; \
self.use = g_clientmodel_setcolormaptoactivator; \
InitializeEntity(self, g_clientmodel_dropbyspawnflags, INITPRIO_DROPTOFLOOR); \
.float loddistance1;
.float loddistance2;
-vector NearestPointOnBox(entity box, vector org);
float LOD_customize()
{
float d;
d = cvar("loddebug");
if(d == 1)
self.modelindex = self.lodmodelindex0;
- else if(d == 2)
+ else if(d == 2 || !self.lodmodelindex2)
self.modelindex = self.lodmodelindex1;
else // if(d == 3)
self.modelindex = self.lodmodelindex2;
}
if(self.lodmodelindex1)
- SetCustomizer(self, LOD_customize, LOD_uncustomize);
+ if not(self.SendEntity)
+ SetCustomizer(self, LOD_customize, LOD_uncustomize);
}
void SetBrushEntityModel()