--- /dev/null
+.vector glowmod;
+.float lodmodelindex0;
+.float lodmodelindex1;
+.float lodmodelindex2;
+
+void CSQCModel_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.lodmodelindex0 != self.modelindex)
+ {
+ string modelname = self.model;
+ string s;
+
+ // 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 > 0)
+ 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 > 0)
+ self.lodmodelindex2 = self.modelindex;
+ }
+
+ 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;
+ if(f > autocvar_cl_loddistance2)
+ self.modelindex = self.lodmodelindex2;
+ else if(f > autocvar_cl_loddistance1)
+ self.modelindex = self.lodmodelindex1;
+ else
+ self.modelindex = self.lodmodelindex0;
+ }
+ }
+}
+
+++ /dev/null
-.vector glowmod;
-.float lodmodelindex0;
-.float lodmodelindex1;
-.float lodmodelindex2;
-
-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.lodmodelindex0 != self.modelindex)
- {
- string modelname = self.model;
- string s;
-
- // 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 > 0)
- 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 > 0)
- self.lodmodelindex2 = self.modelindex;
- }
-
- 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;
- if(f > autocvar_cl_loddistance2)
- self.modelindex = self.lodmodelindex2;
- else if(f > autocvar_cl_loddistance1)
- self.modelindex = self.lodmodelindex1;
- else
- self.modelindex = self.lodmodelindex0;
- }
- }
-}
-
void CSQCModel_InterpolateAnimation_PreNote(float sf)
{
-#ifdef CSQCMODELS_HAVE_TWO_FRAMES
+#ifdef CSQCMODEL_HAVE_TWO_FRAMES
if(sf & PROPERTY_FRAME)
{
self.frame3 = self.frame;
void CSQCModel_InterpolateAnimation_Note(float sf)
{
-#ifdef CSQCMODELS_HAVE_TWO_FRAMES
+#ifdef CSQCMODEL_HAVE_TWO_FRAMES
if(sf & PROPERTY_FRAME)
{
self.frame1time = time;
void CSQCModel_InterpolateAnimation_Do()
{
-#ifdef CSQCMODELS_HAVE_TWO_FRAMES
+#ifdef CSQCMODEL_HAVE_TWO_FRAMES
if(autocvar_cl_nolerp || (autocvar_cl_lerpanim_maxdelta_framegroups == 0))
{
self.lerpfrac = self.csqcmodel_lerpfrac;
// TODO csqcplayers: run prediction here too
CSQCModel_InterpolateAnimation_Do();
- { CSQCMODELS_HOOK_PREDRAW }
+ { CSQCMODEL_HOOK_PREDRAW }
}
void CSQCModel_Read()
self.iflags |= IFLAG_ANGLES; // interpolate angles too
- { CSQCMODELS_HOOK_PREUPDATE }
+ { CSQCMODEL_HOOK_PREUPDATE }
CSQCPlayer_PreUpdate();
InterpolateOrigin_Undo();
InterpolateOrigin_Note();
CSQCPlayer_PostUpdate();
- { CSQCMODELS_HOOK_POSTUPDATE }
+ { CSQCMODEL_HOOK_POSTUPDATE }
-#ifdef CSQCMODELS_SUPPORT_GETTAGINFO_BEFORE_DRAW
+#ifdef CSQCMODEL_SUPPORT_GETTAGINFO_BEFORE_DRAW
InterpolateOrigin_Do();
CSQCModel_InterpolateAnimation_Do();
#endif
PROPERTY(PROPERTY_PITCHROLL, ReadAngle, WriteAngle, angles_x) \
PROPERTY(PROPERTY_YAW, ReadAngle, WriteAngle, angles_y) \
PROPERTY(PROPERTY_PITCHROLL, ReadAngle, WriteAngle, angles_z) \
- CSQCMODELS_EXTRAPROPERTIES
+ CSQCMODEL_EXTRAPROPERTIES
-#ifdef CSQCMODELS_HAVE_TWO_FRAMES
+#ifdef CSQCMODEL_HAVE_TWO_FRAMES
.float frame3;
.float frame3time;
.float lerpfrac3;
// define this if svqc code wants to use .frame2 and .lerpfrac
-#define CSQCMODELS_HAVE_TWO_FRAMES
+#define CSQCMODEL_HAVE_TWO_FRAMES
// don't define this ever
-//#define CSQCMODELS_SUPPORT_GETTAGINFO_BEFORE_DRAW
+//#define CSQCMODEL_SUPPORT_GETTAGINFO_BEFORE_DRAW
// add properties you want networked to CSQC here
-#define CSQCMODELS_EXTRAPROPERTIES \
+#define CSQCMODEL_EXTRAPROPERTIES \
PROPERTY(1, ReadByte, WriteByte, skin) \
PROPERTY(2, ReadShort, WriteShort, colormap) \
PROPERTY(4, ReadInt24_t, WriteInt24_t, effects) \
PROPERTY_SCALED(8, ReadByte, WriteByte, alpha, 255, 0, 255)
// add hook function calls here
-#define CSQCMODELS_HOOK_PREUPDATE
-#define CSQCMODELS_HOOK_POSTUPDATE
-#define CSQCMODELS_HOOK_PREDRAW \
- CSQCModels_Hook_PreDraw();
+#define CSQCMODEL_HOOK_PREUPDATE
+#define CSQCMODEL_HOOK_POSTUPDATE
+#define CSQCMODEL_HOOK_PREDRAW \
+ CSQCModel_Hook_PreDraw();
#define CSQCPLAYER_HOOK_POSTCAMERASETUP
// mod must define: