X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fent_cs.qc;h=41183d85b21d5c505b4becc57bba4f1df396971c;hb=e424ba544c41fc40b241b17bd7c1d9c2fc930705;hp=6367f4068191f768c6808bfe0fa7c9db090c8247;hpb=3650955c7dfb13a6f53fac233b26ffed8e5a4344;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index 6367f4068..41183d85b 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -16,11 +16,11 @@ { vector v = '0 0 0'; v.y = ReadByte() / 256 * 360; this.angles = v; }) \ \ PROP(false, health, \ - { WriteByte(chan, this.health / 10); /* FIXME: use a better scale? */ }, \ + { WriteByte(chan, bound(0, this.health / 10, 255)); /* FIXME: use a better scale? */ }, \ { this.healthvalue = ReadByte() * 10; }) \ \ PROP(false, armorvalue, \ - { WriteByte(chan, this.armorvalue / 10); /* FIXME: use a better scale? */ }, \ + { WriteByte(chan, bound(0, this.armorvalue / 10, 255)); /* FIXME: use a better scale? */ }, \ { this.armorvalue = ReadByte() * 10; }) \ \ PROP(true, netname, \ @@ -34,6 +34,14 @@ PROP(true, skin, \ { WriteByte(chan, this.skin); }, \ { this.skin = ReadByte(); }) \ + \ + PROP(true, clientcolors, \ + { WriteByte(chan, this.clientcolors); }, \ + { this.colormap = ReadByte(); }) \ + \ + PROP(true, frags, \ + { WriteShort(chan, this.frags); }, \ + { this.frags = ReadShort(); }) \ \ /**/ @@ -61,8 +69,9 @@ sf |= this.m_forceupdate; this.m_forceupdate = 0; bool valid = - IS_PLAYER(player) // player must be active - || player == to // player is self + time > game_starttime + && (IS_PLAYER(player) // player must be active + || player == to) // player is self ; if (!valid) sf = 0; if (chan == MSG_ENTITY) @@ -83,9 +92,8 @@ return _entcs_send(this, to, sf, MSG_ENTITY); } - void entcs_think() + void entcs_think(entity this) { - SELFPARAM(); this.nextthink = time + 0.033333333333; // TODO: increase this to like 0.15 once the client can do smoothing entity o = this.owner; int i = 1; @@ -98,27 +106,27 @@ i += 1; ENTCS_NETPROPS(X); #undef X + setorigin(this, this.origin); // relink } void entcs_attach(entity player) { entity e = player.entcs = new(entcs_sender); - make_pure(e); e.owner = player; - e.think = entcs_think; + setthink(e, entcs_think); e.nextthink = time; Net_LinkEntity(e, false, 0, entcs_send); if (!IS_REAL_CLIENT(player)) return; - FOREACH_CLIENT(true, LAMBDA( + FOREACH_CLIENT(true, { assert(it.entcs); _entcs_send(it.entcs, msg_entity = player, BITS(23), MSG_ONE); - )); + }); } void entcs_detach(entity player) { if (!player.entcs) return; - remove(player.entcs); + delete(player.entcs); player.entcs = NULL; } @@ -126,18 +134,16 @@ #ifdef CSQC - void Ent_RemoveEntCS() + void Ent_RemoveEntCS(entity this) { - SELFPARAM(); int n = this.sv_entnum; entity e = entcs_receiver(n); entcs_receiver(n, NULL); - if (e != this) remove(e); + if (e != this) delete(e); } - void entcs_think() + void entcs_think(entity this) { - SELFPARAM(); entity e = CSQCModel_server2csqc(this.sv_entnum); if (e == NULL) { @@ -170,7 +176,7 @@ make_pure(e); } e.sv_entnum = n; - e.think = entcs_think; + setthink(e, entcs_think); entcs_receiver(n, e); } else if (this && e != this) @@ -190,7 +196,7 @@ #undef X this.iflags |= IFLAG_ORIGIN; InterpolateOrigin_Note(this); - WITH(entity, self, this, this.think()); + getthink(this)(this); return true; }