X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fent_cs.qc;h=f308530d50d7d475e020257e67503bc5606dc858;hb=5fb2f3c4e123910e6291d6337fadd61f5199f5a5;hp=a89e84a03725d7f8ff16525ef81faa52e9d81d49;hpb=922354d1191d534b0b12516e28561bc70cbe2a87;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index a89e84a03..f308530d5 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -13,9 +13,9 @@ MACRO_END // #define PROP(public, fld, set, sv, cl) #define ENTCS_NETPROPS(ent, PROP) PROP(false, sv_entnum, ENTCS_SET_NORMAL, {}, {}) /* sentinel */ \ PROP(false, origin, ENTCS_SET_NORMAL, \ - { WriteShort(chan, ent.origin.x); WriteShort(chan, ent.origin.y); \ - WriteShort(chan, ent.origin.z); }, \ - { ent.has_sv_origin = true; vector v; v.x = ReadShort(); v.y = ReadShort(); v.z = ReadShort(); setorigin(ent, v); }) \ + { WriteCoord(chan, ent.origin.x); WriteCoord(chan, ent.origin.y); \ + WriteCoord(chan, ent.origin.z); }, \ + { ent.has_sv_origin = true; vector v; v.x = ReadCoord(); v.y = ReadCoord(); v.z = ReadCoord(); setorigin(ent, v); }) \ \ PROP(false, angles_y, ENTCS_SET_NORMAL, \ { WriteByte(chan, ent.angles.y / 360 * 256); }, \ @@ -64,7 +64,7 @@ MACRO_END i += 1; \ } ENTCS_NETPROPS(this, X); - #undef X + #undef X if (i >= BITS(16 - 1)) LOG_FATAL("Exceeded ENTCS_NETPROPS limit"); } @@ -73,11 +73,15 @@ MACRO_END entity player = this.owner; sf |= BIT(0); // assume private do { - if (radar_showennemies) break; - if (SAME_TEAM(to, player)) break; - if (!(IS_PLAYER(to) || to.caplayer) && time > game_starttime) break; + if (IS_PLAYER(player)) + { + if (radar_showennemies) break; + if (SAME_TEAM(to, player)) break; + if (!(IS_PLAYER(to) || to.caplayer) && time > game_starttime) break; + } sf &= ENTCS_PUBLICMASK; // no private updates } while (0); + sf |= this.m_forceupdate; this.m_forceupdate = 0; if (chan == MSG_ENTITY) @@ -94,7 +98,7 @@ MACRO_END i += 1; \ } ENTCS_NETPROPS(this, X); - #undef X + #undef X return true; } @@ -116,7 +120,7 @@ MACRO_END i += 1; \ } ENTCS_NETPROPS(this, X); - #undef X + #undef X setorigin(this, this.origin); // relink } @@ -150,6 +154,10 @@ MACRO_END int n = this.sv_entnum; entity e = entcs_receiver(n); entcs_receiver(n, NULL); + if (e.netname) strunzone(e.netname); + e.netname = string_null; + if (e.model) strunzone(e.model); + e.model = string_null; if (e != this) delete(e); } @@ -175,33 +183,26 @@ MACRO_END { int n = ReadByte(); entity e = entcs_receiver(n); - #define X(e) { \ - setthink(e, entcs_think); \ - entcs_receiver(n, e); \ - } if (e == NULL) { if (!this) - { // initial = temp e = new_pure(entcs_receiver); - X(e); - } else - { // initial = linked e = this; - X(e); - } + setthink(e, entcs_think); + entcs_receiver(n, e); } else if (e != this && this) { // upgrade to linked delete(e); e = this; - X(e); + setthink(e, entcs_think); + entcs_receiver(n, e); } - #undef X + InterpolateOrigin_Undo(e); e.sv_entnum = n; int sf = ReadShort(); @@ -215,7 +216,7 @@ MACRO_END i += 1; \ } ENTCS_NETPROPS(e, X); - #undef X + #undef X e.iflags |= IFLAG_ORIGIN; InterpolateOrigin_Note(e); getthink(e)(e);