X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Flib%2Fcsqcmodel%2Fsv_model.qc;h=70e2c1a15e9bf10f6a4a09bf9378a10f724ba5c8;hp=dc2e4021fbc405283e1de904b13b9546ebbc648a;hb=8e4957c252f8381e37f2a72e227797bf51e5cc2f;hpb=f72821fdcebe3ca01181a99727a06198de65ea08 diff --git a/qcsrc/lib/csqcmodel/sv_model.qc b/qcsrc/lib/csqcmodel/sv_model.qc index dc2e4021f..70e2c1a15 100644 --- a/qcsrc/lib/csqcmodel/sv_model.qc +++ b/qcsrc/lib/csqcmodel/sv_model.qc @@ -22,25 +22,24 @@ #include "sv_model.qh" #include "common.qh" -#include -#include -#include -#include -#include // generic CSQC model code -bool CSQCModel_Send(entity to, int sf) +bool CSQCModel_Send(entity this, entity to, int sf) { - SELFPARAM(); // some nice flags for CSQCMODEL_IF noref bool isplayer = IS_CLIENT(this); noref bool islocalplayer = (this == to); noref bool isnolocalplayer = (isplayer && (this != to)); + int psf = 0; + psf = BITSET(psf, ISPLAYER_CLIENT, isplayer); + psf = BITSET(psf, ISPLAYER_LOCAL, islocalplayer); + psf = BITSET(psf, ISPLAYER_PLAYER, IS_PLAYER(this)); + WriteHeader(MSG_ENTITY, ENT_CLIENT_MODEL); WriteInt24_t(MSG_ENTITY, sf); - WriteByte(MSG_ENTITY, isplayer); + WriteByte(MSG_ENTITY, psf); #define CSQCMODEL_IF(cond) if(cond) { #define CSQCMODEL_ENDIF } @@ -49,7 +48,11 @@ bool CSQCModel_Send(entity to, int sf) { \ w(MSG_ENTITY, this.csqcmodel_##f); \ } -#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) CSQCMODEL_PROPERTY(flag,t,r,w,f) +#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) \ + if(sf & flag) \ + { \ + w(MSG_ENTITY, this.csqcmodel_##f); \ + } ALLPROPERTIES #undef CSQCMODEL_PROPERTY_SCALED #undef CSQCMODEL_PROPERTY @@ -65,13 +68,9 @@ bool CSQCModel_Send(entity to, int sf) void CSQCModel_CheckUpdate(entity e) { // some nice flags for CSQCMODEL_IF - float isplayer = IS_CLIENT(e); - 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 - - unused_float = isplayer; - unused_float = islocalplayer; - unused_float = isnolocalplayer; + noref float isplayer = IS_CLIENT(e); + noref float islocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags + noref float isnolocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags #if CSQCPLAYER_FORCE_UPDATES if(isplayer && time > e.csqcmodel_nextforcedupdate) @@ -122,12 +121,12 @@ void CSQCModel_CheckUpdate(entity e) void CSQCModel_LinkEntity(entity e) { - e.SendEntity = CSQCModel_Send; + setSendEntity(e, CSQCModel_Send); e.SendFlags = 0xFFFFFF; CSQCModel_CheckUpdate(e); } void CSQCModel_UnlinkEntity(entity e) { - e.SendEntity = func_null; + setSendEntity(e, func_null); }