* IN THE SOFTWARE.
*/
-// generic CSQC model code
-
var float autocvar_cl_lerpanim_maxdelta_framegroups = 0.1;
var float autocvar_cl_nolerp = 0;
void CSQCModel_InterpolateAnimation_PreNote(float sf)
{
#ifdef CSQCMODEL_HAVE_TWO_FRAMES
- if(sf & PROPERTY_FRAME)
+ if(sf & CSQCMODEL_PROPERTY_FRAME)
{
self.frame3 = self.frame;
self.frame3time = self.frame1time;
}
- if(sf & PROPERTY_FRAME2)
+ if(sf & CSQCMODEL_PROPERTY_FRAME2)
{
self.frame4 = self.frame2;
self.frame4time = self.frame2time;
}
- if(sf & PROPERTY_LERPFRAC)
+ if(sf & CSQCMODEL_PROPERTY_LERPFRAC)
{
self.csqcmodel_lerpfrac2 = self.csqcmodel_lerpfrac;
self.csqcmodel_lerpfrac2time = self.csqcmodel_lerpfractime;
self.lerpfrac = self.csqcmodel_lerpfrac;
}
#else
- if(sf & PROPERTY_FRAME)
+ if(sf & CSQCMODEL_PROPERTY_FRAME)
{
self.frame2 = self.frame;
self.frame2time = self.frame1time;
void CSQCModel_InterpolateAnimation_Note(float sf)
{
#ifdef CSQCMODEL_HAVE_TWO_FRAMES
- if(sf & PROPERTY_FRAME)
+ if(sf & CSQCMODEL_PROPERTY_FRAME)
{
self.frame1time = time;
}
- if(sf & PROPERTY_FRAME2)
+ if(sf & CSQCMODEL_PROPERTY_FRAME2)
{
self.frame2time = time;
}
- if(sf & PROPERTY_LERPFRAC)
+ if(sf & CSQCMODEL_PROPERTY_LERPFRAC)
{
self.csqcmodel_lerpfrac = self.lerpfrac;
self.csqcmodel_lerpfractime = time;
}
#else
- if(sf & PROPERTY_FRAME)
+ if(sf & CSQCMODEL_PROPERTY_FRAME)
{
self.frame1time = time;
}
InterpolateOrigin_Undo();
CSQCModel_InterpolateAnimation_PreNote(sf);
-#define PROPERTY(flag,r,w,f) \
+#define CSQCMODEL_PROPERTY(flag,r,w,f) \
if(sf & flag) \
self.f = r();
-#define PROPERTY_SCALED(flag,r,w,f,s,mi,ma) \
+#define CSQCMODEL_PROPERTY_SCALED(flag,r,w,f,s,mi,ma) \
if(sf & flag) \
self.f = r() / s;
ALLPROPERTIES
-#undef PROPERTY_SCALED
-#undef PROPERTY
+#undef CSQCMODEL_PROPERTY_SCALED
+#undef CSQCMODEL_PROPERTY
- if(sf & PROPERTY_MODELINDEX)
+ if(sf & CSQCMODEL_PROPERTY_MODELINDEX)
setmodelindex(self, self.modelindex); // this retrieves the .model key and sets mins/maxs/absmin/absmax
- if(sf & PROPERTY_TELEPORTED)
+ if(sf & CSQCMODEL_PROPERTY_TELEPORTED)
{
self.iflags |= IFLAG_TELEPORTED;
self.csqcmodel_teleported = 1;
* IN THE SOFTWARE.
*/
-// generic CSQC model code
-
void CSQCModel_Read();
var float autocvar_chase_active;
var float autocvar_chase_back;
+// engine stuff
.float pmove_flags;
float pmove_onground; // weird engine flag we shouldn't really use but have to for now
-
#define PMF_DUCKED 4
#define PMF_TELEPORTED 16
#define PMF_ONGROUND 32
.float frame2time;
.float lerpfrac;
-#define PROPERTY_FRAME 32768
-#define PROPERTY_FRAME2 16384
-#define PROPERTY_LERPFRAC 8192
-#define PROPERTY_TELEPORTED 4096 // the "teleport bit" cancelling interpolation
-#define PROPERTY_MODELINDEX 2048
-#define PROPERTY_ORIGIN 1024
-#define PROPERTY_YAW 512
-#define PROPERTY_PITCHROLL 256
+#define CSQCMODEL_PROPERTY_FRAME 32768
+#define CSQCMODEL_PROPERTY_FRAME2 16384
+#define CSQCMODEL_PROPERTY_LERPFRAC 8192
+#define CSQCMODEL_PROPERTY_TELEPORTED 4096 // the "teleport bit" cancelling interpolation
+#define CSQCMODEL_PROPERTY_MODELINDEX 2048
+#define CSQCMODEL_PROPERTY_ORIGIN 1024
+#define CSQCMODEL_PROPERTY_YAW 512
+#define CSQCMODEL_PROPERTY_PITCHROLL 256
#define ALLPROPERTIES_COMMON \
- PROPERTY(PROPERTY_FRAME, ReadByte, WriteByte, frame) \
- PROPERTY(PROPERTY_MODELINDEX, ReadShort, WriteShort, modelindex) \
- PROPERTY(PROPERTY_ORIGIN, ReadCoord, WriteCoord, origin_x) \
- PROPERTY(PROPERTY_ORIGIN, ReadCoord, WriteCoord, origin_y) \
- PROPERTY(PROPERTY_ORIGIN, ReadCoord, WriteCoord, origin_z) \
- PROPERTY(PROPERTY_PITCHROLL, ReadAngle, WriteAngle, angles_x) \
- PROPERTY(PROPERTY_YAW, ReadAngle, WriteAngle, angles_y) \
- PROPERTY(PROPERTY_PITCHROLL, ReadAngle, WriteAngle, angles_z) \
+ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME, ReadByte, WriteByte, frame) \
+ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_MODELINDEX, ReadShort, WriteShort, modelindex) \
+ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, ReadCoord, WriteCoord, origin_x) \
+ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, ReadCoord, WriteCoord, origin_y) \
+ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_ORIGIN, ReadCoord, WriteCoord, origin_z) \
+ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_PITCHROLL, ReadAngle, WriteAngle, angles_x) \
+ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_YAW, ReadAngle, WriteAngle, angles_y) \
+ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_PITCHROLL, ReadAngle, WriteAngle, angles_z) \
CSQCMODEL_EXTRAPROPERTIES
#ifdef CSQCMODEL_HAVE_TWO_FRAMES
.float frame4time;
.float lerpfrac4;
#define ALLPROPERTIES ALLPROPERTIES_COMMON \
- PROPERTY(PROPERTY_FRAME2, ReadByte, WriteByte, frame2) \
- PROPERTY_SCALED(PROPERTY_LERPFRAC, ReadByte, WriteByte, lerpfrac, 255, 0, 255)
+ CSQCMODEL_PROPERTY(CSQCMODEL_PROPERTY_FRAME2, ReadByte, WriteByte, frame2) \
+ CSQCMODEL_PROPERTY_SCALED(CSQCMODEL_PROPERTY_LERPFRAC, ReadByte, WriteByte, lerpfrac, 255, 0, 255)
#else
#define ALLPROPERTIES ALLPROPERTIES_COMMON
#endif
// add properties you want networked to CSQC here
#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)
+ CSQCMODEL_PROPERTY(1, ReadByte, WriteByte, skin) \
+ CSQCMODEL_PROPERTY(2, ReadShort, WriteShort, colormap) \
+ CSQCMODEL_PROPERTY(4, ReadInt24_t, WriteInt24_t, effects) \
+ CSQCMODEL_PROPERTY_SCALED(8, ReadByte, WriteByte, alpha, 255, 0, 255)
// add hook function calls here
#define CSQCMODEL_HOOK_PREUPDATE
// generic CSQC model code
-#define PROPERTY(flag,r,w,f) \
+#define CSQCMODEL_PROPERTY(flag,r,w,f) \
.float csqcmodel_##f;
-#define PROPERTY_SCALED(flag,r,w,f,s,mi,ma) PROPERTY(flag,r,w,f)
+#define CSQCMODEL_PROPERTY_SCALED(flag,r,w,f,s,mi,ma) CSQCMODEL_PROPERTY(flag,r,w,f)
ALLPROPERTIES
-#undef PROPERTY_SCALED
-#undef PROPERTY
+#undef CSQCMODEL_PROPERTY_SCALED
+#undef CSQCMODEL_PROPERTY
float CSQCModel_Send(entity to, float sf)
{
WriteByte(MSG_ENTITY, ENT_CLIENT_MODEL);
WriteShort(MSG_ENTITY, sf);
-#define PROPERTY(flag,r,w,f) \
+#define CSQCMODEL_PROPERTY(flag,r,w,f) \
if(sf & flag) \
{ \
w(MSG_ENTITY, self.csqcmodel_##f); \
}
-#define PROPERTY_SCALED(flag,r,w,f,s,mi,ma) PROPERTY(flag,r,w,f)
+#define CSQCMODEL_PROPERTY_SCALED(flag,r,w,f,s,mi,ma) CSQCMODEL_PROPERTY(flag,r,w,f)
ALLPROPERTIES
-#undef PROPERTY_SCALED
-#undef PROPERTY
+#undef CSQCMODEL_PROPERTY_SCALED
+#undef CSQCMODEL_PROPERTY
return TRUE;
}
if(self.effects & EF_RESTARTANIM_BIT)
{
- self.SendFlags |= PROPERTY_FRAME | PROPERTY_FRAME2; // full anim resend please
+ self.SendFlags |= CSQCMODEL_PROPERTY_FRAME | CSQCMODEL_PROPERTY_FRAME2; // full anim resend please
self.effects &~= EF_RESTARTANIM_BIT;
}
if(self.effects & EF_TELEPORT_BIT)
{
- self.SendFlags |= PROPERTY_TELEPORTED; // no interpolation please
+ self.SendFlags |= CSQCMODEL_PROPERTY_TELEPORTED; // no interpolation please
self.effects &~= EF_TELEPORT_BIT;
}
-#define PROPERTY(flag,r,w,f) \
+#define CSQCMODEL_PROPERTY(flag,r,w,f) \
tmp = self.f; \
if(tmp != self.csqcmodel_##f) \
{ \
self.csqcmodel_##f = tmp; \
self.SendFlags |= flag; \
}
-#define PROPERTY_SCALED(flag,r,w,f,s,mi,ma) \
+#define CSQCMODEL_PROPERTY_SCALED(flag,r,w,f,s,mi,ma) \
tmp = bound(mi, s * self.f, ma); \
if(tmp != self.csqcmodel_##f) \
{ \
self.SendFlags |= flag; \
}
ALLPROPERTIES
-#undef PROPERTY_SCALED
-#undef PROPERTY
+#undef CSQCMODEL_PROPERTY_SCALED
+#undef CSQCMODEL_PROPERTY
}
void CSQCModel_LinkEntity()