float sf;
sf = ReadShort();
+ // some nice flags for CSQCMODEL_IF and the hooks
+ float isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
+ float islocalplayer = (self.entnum == player_localentnum);
+ float isnolocalplayer = (isplayer && (self.entnum != player_localentnum));
+
self.iflags |= IFLAG_ANGLES; // interpolate angles too
{ CSQCMODEL_HOOK_PREUPDATE }
InterpolateOrigin_Undo();
CSQCModel_InterpolateAnimation_PreNote(sf);
+#define CSQCMODEL_IF(cond) if(cond) {
+#define CSQCMODEL_ENDIF }
#define CSQCMODEL_PROPERTY(flag,r,w,f) \
if(sf & flag) \
self.f = r();
ALLPROPERTIES
#undef CSQCMODEL_PROPERTY_SCALED
#undef CSQCMODEL_PROPERTY
+#undef CSQCMODEL_ENDIF
+#undef CSQCMODEL_IF
if(sf & CSQCMODEL_PROPERTY_MODELINDEX)
setmodelindex(self, self.modelindex); // this retrieves the .model key and sets mins/maxs/absmin/absmax
// add properties you want networked to CSQC here
#define CSQCMODEL_EXTRAPROPERTIES \
- 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)
+ CSQCMODEL_IF(isplayer) \
+ 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) \
+ CSQCMODEL_ENDIF
// add hook function calls here
#define CSQCMODEL_HOOK_PREUPDATE
// generic CSQC model code
+#define CSQCMODEL_IF(cond)
+#define CSQCMODEL_ENDIF
#define CSQCMODEL_PROPERTY(flag,r,w,f) \
.float csqcmodel_##f;
#define CSQCMODEL_PROPERTY_SCALED(flag,r,w,f,s,mi,ma) CSQCMODEL_PROPERTY(flag,r,w,f)
ALLPROPERTIES
#undef CSQCMODEL_PROPERTY_SCALED
#undef CSQCMODEL_PROPERTY
+#undef CSQCMODEL_ENDIF
+#undef CSQCMODEL_IF
float CSQCModel_Send(entity to, float sf)
{
+ // some nice flags for CSQCMODEL_IF
+ float isplayer = (self.flags & FL_CLIENT);
+ float islocalplayer = (self == to);
+ float isnolocalplayer = (isplayer && (self != to));
+
WriteByte(MSG_ENTITY, ENT_CLIENT_MODEL);
WriteShort(MSG_ENTITY, sf);
+#define CSQCMODEL_IF(cond) if(cond) {
+#define CSQCMODEL_ENDIF }
#define CSQCMODEL_PROPERTY(flag,r,w,f) \
if(sf & flag) \
{ \
ALLPROPERTIES
#undef CSQCMODEL_PROPERTY_SCALED
#undef CSQCMODEL_PROPERTY
+#undef CSQCMODEL_ENDIF
+#undef CSQCMODEL_IF
return TRUE;
}
void CSQCModel_CheckUpdate()
{
+ // some nice flags for CSQCMODEL_IF
+ float isplayer = (self.flags & FL_CLIENT);
+ float islocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
+ float isnolocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
+
float tmp;
if(self.effects & EF_RESTARTANIM_BIT)
self.effects &~= EF_TELEPORT_BIT;
}
+#define CSQCMODEL_IF(cond) if(cond) {
+#define CSQCMODEL_ENDIF }
#define CSQCMODEL_PROPERTY(flag,r,w,f) \
tmp = self.f; \
if(tmp != self.csqcmodel_##f) \
ALLPROPERTIES
#undef CSQCMODEL_PROPERTY_SCALED
#undef CSQCMODEL_PROPERTY
+#undef CSQCMODEL_ENDIF
+#undef CSQCMODEL_IF
}
void CSQCModel_LinkEntity()
s = "";
n = tokenize_console(cvar_string("sv_curl_serverpackages"));
for(i = 0; i < n; ++i)
- if(substring(argv(i), -14, -1) != ".serverpackage")
+ if(substring(argv(i), -14, -1) != "-serverpackage.txt")
+ if(substring(argv(i), -14, -1) != ".serverpackage") // OLD legacy
s = strcat(s, " ", argv(i));
+ fd = search_begin("*-serverpackage.txt", TRUE, FALSE);
+ if(fd >= 0)
+ {
+ j = search_getsize(fd);
+ for(i = 0; i < j; ++i)
+ s = strcat(s, " ", search_getfilename(fd, i));
+ search_end(fd);
+ }
fd = search_begin("*.serverpackage", TRUE, FALSE);
if(fd >= 0)
{