4 REGISTER_NET_LINKED(ENT_CLIENT_ENTCS)
6 /** True when private information such as origin is available */
8 /** True when origin is available */
10 /** True when a recent server sent origin has been received */
15 * The point of these entities is to avoid the problems
16 * with clientprediction.
17 * If you add SendEntity to players, the engine will not
18 * do any prediction anymore, and you'd have to write the whole
19 * prediction code in CSQC, you want that? :P
20 * Data can depend on gamemode. For now, it serves as GPS entities
21 * in onslaught... YAY ;)
26 bool entcs_send(entity this, entity to, int sf);
30 void entcs_attach(entity e);
32 void entcs_detach(entity e);
36 /** Force an origin update, for player sounds */
37 #define entcs_force_origin(e) ((e).entcs.m_forceupdate = BIT(2))
46 AL_init(_entcs, 255, NULL, e); // 255 is the engine limit on maxclients
52 #define entcs_receiver(...) EVAL(OVERLOAD(entcs_receiver, __VA_ARGS__))
53 #define entcs_receiver_1(i) AL_gete(_entcs, i)
54 #define entcs_receiver_2(i, v) AL_sete(_entcs, i, v)
55 #define entcs_is_self(e) ((e).sv_entnum == player_localentnum - 1)
58 * @param i zero indexed player
59 * @returns 0 if not teamplay
61 int GetPlayerColorForce(int i)
63 return (!teamplay) ? 0 : stof(getplayerkeyvalue(i, "colors")) & 15;
67 * @param i zero indexed player
68 * @returns 0 if not teamplay | NUM_TEAM_##N | NUM_SPECTATOR
70 int GetPlayerColor(int i)
72 bool unconnected = !playerslots[i].gotscores;
73 bool spec = unconnected || stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR;
74 return (spec) ? NUM_SPECTATOR : GetPlayerColorForce(i);
78 * @param i zero indexed player
80 string GetPlayerName(int i)
82 return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
86 * @param i zero indexed player
88 entity CSQCModel_server2csqc(int i);
93 * @param i zero indexed player
95 float getplayeralpha(int i)
97 entity e = CSQCModel_server2csqc(i);
98 return e ? e.alpha : 1;
102 * @param i zero indexed player
104 vector getcsqcplayercolor(int i)
106 entity e = CSQCModel_server2csqc(i);
107 return (!e || e.colormap <= 0)
109 : colormapPaletteColor(((e.colormap >= 1024)
111 : stof(getplayerkeyvalue(e.colormap - 1, "colors"))) & 15, true)
116 * @param i zero indexed player
118 bool getplayerisdead(int i)
120 entity e = CSQCModel_server2csqc(i);
121 return e ? e.csqcmodel_isdead : false;