4 REGISTER_NET_LINKED(ENT_CLIENT_ENTCS)
5 REGISTER_NET_TEMP(CLIENT_ENTCS)
7 /** True when private information such as origin is available */
9 /** True when origin is available */
11 /** True when a recent server sent origin has been received */
16 * The point of these entities is to avoid the problems
17 * with clientprediction.
18 * If you add SendEntity to players, the engine will not
19 * do any prediction anymore, and you'd have to write the whole
20 * prediction code in CSQC, you want that? :P
21 * Data can depend on gamemode. For now, it serves as GPS entities
22 * in onslaught... YAY ;)
27 bool entcs_send(entity this, entity to, int sf);
31 void entcs_attach(entity e);
33 void entcs_detach(entity e);
37 /** Force an origin update, for player sounds */
38 #define entcs_force_origin(e) ((e).entcs.m_forceupdate = BIT(2))
47 AL_NEW(_entcs, 255, NULL, e); // 255 is the engine limit on maxclients
53 #define entcs_receiver(...) EVAL_entcs_receiver(OVERLOAD(entcs_receiver, __VA_ARGS__))
54 #define EVAL_entcs_receiver(...) __VA_ARGS__
55 #define entcs_receiver_1(i) AL_gete(_entcs, i)
56 #define entcs_receiver_2(i, v) AL_sete(_entcs, i, v)
57 #define entcs_is_self(e) ((e).sv_entnum == player_localentnum - 1)
60 * @param i zero indexed player
62 bool entcs_IsSpectating(int i)
64 bool unconnected = !playerslots[i].gotscores;
65 return unconnected || stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR;
69 * @param i zero indexed player
70 * @returns 0 if not teamplay
72 int entcs_GetTeamColor(int i)
74 return (!teamplay) ? 0 : stof(getplayerkeyvalue(i, "colors")) & 15;
78 * @param i zero indexed player
79 * @returns 0 if not teamplay | NUM_TEAM_##N | NUM_SPECTATOR
81 int entcs_GetTeam(int i)
83 return entcs_IsSpectating(i) ? NUM_SPECTATOR : entcs_GetTeamColor(i);
87 * Same as `entcs_GetTeam`, but returns -1 for no team in teamplay
89 int entcs_GetScoreTeam(int i)
91 int t = entcs_GetTeam(i);
92 if (teamplay && !t) t = -1;
97 * @param i zero indexed player
99 string entcs_GetName(int i)
101 return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
105 * @param i zero indexed player
107 entity CSQCModel_server2csqc(int i);
112 * @param i zero indexed player
114 float entcs_GetAlpha(int i)
116 entity e = CSQCModel_server2csqc(i);
117 return e ? e.alpha : 1;
121 * @param i zero indexed player
123 vector entcs_GetColor(int i)
125 entity e = CSQCModel_server2csqc(i);
126 return (!e || e.colormap <= 0)
128 : colormapPaletteColor(((e.colormap >= 1024)
130 : stof(getplayerkeyvalue(e.colormap - 1, "colors"))) & 15, true)
135 * @param i zero indexed player
137 bool entcs_IsDead(int i)
139 entity e = CSQCModel_server2csqc(i);
140 return e ? e.csqcmodel_isdead : false;