DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
 
cl_ents_qw.c File Reference
#include "quakedef.h"
#include "protocol.h"
+ Include dependency graph for cl_ents_qw.c:

Go to the source code of this file.

Functions

entityframeqw_database_tEntityFrameQW_AllocDatabase (mempool_t *pool)
 
void EntityFrameQW_CL_ReadFrame (qbool delta)
 
void EntityFrameQW_FreeDatabase (entityframeqw_database_t *d)
 
static void EntityStateQW_ReadEntityUpdate (entity_state_t *s, int bits)
 
void EntityStateQW_ReadPlayerUpdate (void)
 
static void QW_TranslateEffects (entity_state_t *s, int qweffects)
 

Variables

cvar_t cl_rollangle
 
cvar_t cl_rollspeed
 

Function Documentation

◆ EntityFrameQW_AllocDatabase()

entityframeqw_database_t * EntityFrameQW_AllocDatabase ( mempool_t * pool)

Definition at line 242 of file cl_ents_qw.c.

243{
245 d = (entityframeqw_database_t *)Mem_Alloc(pool, sizeof(*d));
246 return d;
247}
#define Mem_Alloc(pool, size)
Definition zone.h:92

References Mem_Alloc.

Referenced by EntityFrameQW_CL_ReadFrame().

◆ EntityFrameQW_CL_ReadFrame()

void EntityFrameQW_CL_ReadFrame ( qbool delta)

Definition at line 254 of file cl_ents_qw.c.

255{
256 qbool invalid = false;
257 int number, oldsnapindex, newsnapindex, oldindex, newindex, oldnum, newnum;
258 entity_t *ent;
260 entityframeqw_snapshot_t *oldsnap, *newsnap;
261
262 if (!cl.entitydatabaseqw)
265
266 // there is no cls.netcon in demos, so this reading code can't access
267 // cls.netcon-> at all... so cls.qw_incoming_sequence and
268 // cls.qw_outgoing_sequence are updated every time the corresponding
269 // cls.netcon->qw. variables are updated
270 // read the number of this frame to echo back in next input packet
272 newsnapindex = cl.qw_validsequence & QW_UPDATE_MASK;
273 newsnap = d->snapshot + newsnapindex;
274 memset(newsnap, 0, sizeof(*newsnap));
275 oldsnap = NULL;
276 if (delta)
277 {
278 number = MSG_ReadByte(&cl_message);
279 oldsnapindex = cl.qw_deltasequence[newsnapindex];
280 if ((number & QW_UPDATE_MASK) != (oldsnapindex & QW_UPDATE_MASK))
281 Con_DPrintf("WARNING: from mismatch\n");
282 if (oldsnapindex != -1)
283 {
284 if (cls.qw_outgoing_sequence - oldsnapindex >= QW_UPDATE_BACKUP-1)
285 {
286 Con_DPrintf("delta update too old\n");
287 newsnap->invalid = invalid = true; // too old
288 delta = false;
289 }
290 oldsnap = d->snapshot + (oldsnapindex & QW_UPDATE_MASK);
291 }
292 else
293 delta = false;
294 }
295
296 // if we can't decode this frame properly, report that to the server
297 if (invalid)
299
300 // read entity numbers until we find a 0x0000
301 // (which would be an empty update on world entity, but is actually a terminator)
302 newsnap->num_entities = 0;
303 oldindex = 0;
304 for (;;)
305 {
306 int word = (unsigned short)MSG_ReadShort(&cl_message);
308 return; // just return, the main parser will print an error
309 newnum = word == 0 ? 512 : (word & 511);
310 oldnum = delta ? (oldindex >= oldsnap->num_entities ? 9999 : oldsnap->entities[oldindex].number) : 9999;
311
312 // copy unmodified oldsnap entities
313 while (newnum > oldnum) // delta only
314 {
316 Con_Printf("copy %i\n", oldnum);
317 // copy one of the old entities
318 if (newsnap->num_entities >= QW_MAX_PACKET_ENTITIES)
319 Host_Error("EntityFrameQW_CL_ReadFrame: newsnap->num_entities == MAX_PACKETENTITIES");
320 newsnap->entities[newsnap->num_entities] = oldsnap->entities[oldindex++];
321 newsnap->num_entities++;
322 oldnum = oldindex >= oldsnap->num_entities ? 9999 : oldsnap->entities[oldindex].number;
323 }
324
325 if (word == 0)
326 break;
327
329 {
330 if (word & QW_U_REMOVE)
331 Con_Printf("remove %i\n", newnum);
332 else if (newnum == oldnum)
333 Con_Printf("delta %i\n", newnum);
334 else
335 Con_Printf("baseline %i\n", newnum);
336 }
337
338 if (word & QW_U_REMOVE)
339 {
340 if (newnum != oldnum && !delta && !invalid)
341 {
343 Con_Printf(CON_WARN "WARNING: U_REMOVE %i on full update\n", newnum);
344 }
345 }
346 else
347 {
348 if (newsnap->num_entities >= QW_MAX_PACKET_ENTITIES)
349 Host_Error("EntityFrameQW_CL_ReadFrame: newsnap->num_entities == MAX_PACKETENTITIES");
350 newsnap->entities[newsnap->num_entities] = (newnum == oldnum) ? oldsnap->entities[oldindex] : cl.entities[newnum].state_baseline;
351 EntityStateQW_ReadEntityUpdate(newsnap->entities + newsnap->num_entities, word);
352 newsnap->num_entities++;
353 }
354
355 if (newnum == oldnum)
356 oldindex++;
357 }
358
359 // expand cl.num_entities to include every entity we've seen this game
360 newnum = newsnap->num_entities ? newsnap->entities[newsnap->num_entities - 1].number : 1;
361 if (cl.num_entities <= newnum)
362 {
363 cl.num_entities = newnum + 1;
364 if (cl.max_entities < newnum + 1)
365 CL_ExpandEntities(newnum);
366 }
367
368 // now update the non-player entities from the snapshot states
369 number = cl.maxclients + 1;
370 for (newindex = 0;;newindex++)
371 {
372 newnum = newindex >= newsnap->num_entities ? cl.num_entities : newsnap->entities[newindex].number;
373 // kill any missing entities
374 for (;number < newnum;number++)
375 {
376 if (cl.entities_active[number])
377 {
378 cl.entities_active[number] = false;
380 }
381 }
382 if (number >= cl.num_entities)
383 break;
384 // update the entity
385 ent = &cl.entities[number];
386 ent->state_previous = ent->state_current;
387 ent->state_current = newsnap->entities[newindex];
388 ent->state_current.time = cl.mtime[0];
390 // the entity lives again...
391 cl.entities_active[number] = true;
392 number++;
393 }
394}
entityframeqw_database_t * EntityFrameQW_AllocDatabase(mempool_t *pool)
Definition cl_ents_qw.c:242
static void EntityStateQW_ReadEntityUpdate(entity_state_t *s, int bits)
Definition cl_ents_qw.c:177
client_state_t cl
Definition cl_main.c:117
client_static_t cls
Definition cl_main.c:116
void CL_ExpandEntities(int num)
Definition cl_main.c:300
void CL_MoveLerpEntityStates(entity_t *ent)
Definition cl_parse.c:1991
cvar_t developer_networkentities
Definition cl_parse.c:173
#define MSG_ReadShort
Definition common.h:191
#define MSG_ReadByte(sb)
Definition common.h:188
void Con_DPrintf(const char *fmt,...)
A Con_Printf that only shows up if the "developer" cvar is set.
Definition console.c:1544
void Con_Printf(const char *fmt,...)
Prints to all appropriate console targets.
Definition console.c:1514
#define CON_WARN
Definition console.h:101
void Host_Error(const char *error,...)
Definition host.c:85
sizebuf_t cl_message
Definition netconn.c:71
#define QW_U_REMOVE
Definition protocol.h:996
#define QW_UPDATE_BACKUP
Definition protocol.h:1033
#define QW_UPDATE_MASK
Definition protocol.h:1034
#define QW_MAX_PACKET_ENTITIES
Definition protocol.h:1035
@ ACTIVE_NOT
Definition protocol.h:432
#define NULL
Definition qtypes.h:12
bool qbool
Definition qtypes.h:9
unsigned char * entities_active
Definition client.h:993
entityframeqw_database_t * entitydatabaseqw
Definition client.h:965
entity_t * entities
Definition client.h:991
int max_entities
Definition client.h:980
double mtime[2]
Definition client.h:861
unsigned int qw_validsequence
Definition client.h:1104
unsigned int qw_deltasequence[QW_UPDATE_BACKUP]
Definition client.h:1106
unsigned int qw_outgoing_sequence
Definition client.h:645
unsigned int qw_incoming_sequence
Definition client.h:644
mempool_t * levelmempool
Definition client.h:571
int integer
Definition cvar.h:73
unsigned char active
Definition protocol.h:459
unsigned short number
Definition protocol.h:448
entity_state_t state_current
Definition client.h:471
entity_state_t state_previous
Definition client.h:469
entityframeqw_snapshot_t snapshot[QW_UPDATE_BACKUP]
Definition protocol.h:1070
entity_state_t entities[QW_MAX_PACKET_ENTITIES]
Definition protocol.h:1064
qbool badread
Definition common.h:56

References entity_state_t::active, ACTIVE_NOT, sizebuf_t::badread, cl, CL_ExpandEntities(), cl_message, CL_MoveLerpEntityStates(), cls, Con_DPrintf(), Con_Printf(), CON_WARN, developer_networkentities, client_state_t::entities, entityframeqw_snapshot_t::entities, client_state_t::entities_active, client_state_t::entitydatabaseqw, EntityFrameQW_AllocDatabase(), EntityStateQW_ReadEntityUpdate(), Host_Error(), cvar_t::integer, entityframeqw_snapshot_t::invalid, client_static_t::levelmempool, client_state_t::max_entities, client_state_t::maxclients, MSG_ReadByte, MSG_ReadShort, client_state_t::mtime, NULL, client_state_t::num_entities, entityframeqw_snapshot_t::num_entities, entity_state_t::number, client_state_t::qw_deltasequence, client_static_t::qw_incoming_sequence, QW_MAX_PACKET_ENTITIES, client_static_t::qw_outgoing_sequence, QW_U_REMOVE, QW_UPDATE_BACKUP, QW_UPDATE_MASK, client_state_t::qw_validsequence, entityframeqw_database_t::snapshot, entity_t::state_baseline, entity_t::state_current, entity_t::state_previous, and entity_state_t::time.

Referenced by CL_ParseServerMessage().

◆ EntityFrameQW_FreeDatabase()

void EntityFrameQW_FreeDatabase ( entityframeqw_database_t * d)

Definition at line 249 of file cl_ents_qw.c.

250{
251 Mem_Free(d);
252}
#define Mem_Free(mem)
Definition zone.h:96

References Mem_Free.

◆ EntityStateQW_ReadEntityUpdate()

static void EntityStateQW_ReadEntityUpdate ( entity_state_t * s,
int bits )
static

Definition at line 177 of file cl_ents_qw.c.

178{
179 int qweffects = 0;
181 s->number = bits & 511;
182 bits &= ~511;
183 if (bits & QW_U_MOREBITS)
184 bits |= MSG_ReadByte(&cl_message);
185
186 // store the QW_U_SOLID bit here?
187
188 if (bits & QW_U_MODEL)
190 if (bits & QW_U_FRAME)
192 if (bits & QW_U_COLORMAP)
194 if (bits & QW_U_SKIN)
196 if (bits & QW_U_EFFECTS)
198 if (bits & QW_U_ORIGIN1)
200 if (bits & QW_U_ANGLE1)
202 if (bits & QW_U_ORIGIN2)
204 if (bits & QW_U_ANGLE2)
206 if (bits & QW_U_ORIGIN3)
208 if (bits & QW_U_ANGLE3)
210
212 {
213 Con_Printf("ReadFields e%i", s->number);
214 if (bits & QW_U_MODEL)
215 Con_Printf(" U_MODEL %i", s->modelindex);
216 if (bits & QW_U_FRAME)
217 Con_Printf(" U_FRAME %i", s->frame);
218 if (bits & QW_U_COLORMAP)
219 Con_Printf(" U_COLORMAP %i", s->colormap);
220 if (bits & QW_U_SKIN)
221 Con_Printf(" U_SKIN %i", s->skin);
222 if (bits & QW_U_EFFECTS)
223 Con_Printf(" U_EFFECTS %i", qweffects);
224 if (bits & QW_U_ORIGIN1)
225 Con_Printf(" U_ORIGIN1 %f", s->origin[0]);
226 if (bits & QW_U_ANGLE1)
227 Con_Printf(" U_ANGLE1 %f", s->angles[0]);
228 if (bits & QW_U_ORIGIN2)
229 Con_Printf(" U_ORIGIN2 %f", s->origin[1]);
230 if (bits & QW_U_ANGLE2)
231 Con_Printf(" U_ANGLE2 %f", s->angles[1]);
232 if (bits & QW_U_ORIGIN3)
233 Con_Printf(" U_ORIGIN3 %f", s->origin[2]);
234 if (bits & QW_U_ANGLE3)
235 Con_Printf(" U_ANGLE3 %f", s->angles[2]);
236 if (bits & QW_U_SOLID)
237 Con_Printf(" U_SOLID");
238 Con_Print("\n");
239 }
240}
static void QW_TranslateEffects(entity_state_t *s, int qweffects)
Definition cl_ents_qw.c:4
float MSG_ReadCoord13i(sizebuf_t *sb)
Definition com_msg.c:374
float MSG_ReadAngle8i(sizebuf_t *sb)
Definition com_msg.c:409
void Con_Print(const char *msg)
Prints to all appropriate console targets, and adds timestamps.
Definition console.c:1504
#define QW_U_COLORMAP
Definition protocol.h:1002
#define QW_U_ORIGIN1
Definition protocol.h:991
#define QW_U_ORIGIN2
Definition protocol.h:992
#define QW_U_ANGLE1
Definition protocol.h:999
#define QW_U_FRAME
Definition protocol.h:995
#define QW_U_ANGLE3
Definition protocol.h:1000
#define QW_U_EFFECTS
Definition protocol.h:1004
#define QW_U_MOREBITS
Definition protocol.h:997
#define QW_U_ANGLE2
Definition protocol.h:994
#define QW_U_MODEL
Definition protocol.h:1001
@ ACTIVE_NETWORK
Definition protocol.h:433
#define QW_U_SOLID
Definition protocol.h:1005
#define QW_U_ORIGIN3
Definition protocol.h:993
#define QW_U_SKIN
Definition protocol.h:1003
unsigned char skin
Definition protocol.h:463
float origin[3]
Definition protocol.h:444
unsigned char colormap
Definition protocol.h:462
unsigned short modelindex
Definition protocol.h:449
float angles[3]
Definition protocol.h:445
unsigned short frame
Definition protocol.h:450

References entity_state_t::active, ACTIVE_NETWORK, entity_state_t::angles, cl_message, entity_state_t::colormap, Con_Print(), Con_Printf(), developer_networkentities, entity_state_t::frame, cvar_t::integer, entity_state_t::modelindex, MSG_ReadAngle8i(), MSG_ReadByte, MSG_ReadCoord13i(), entity_state_t::number, entity_state_t::origin, QW_TranslateEffects(), QW_U_ANGLE1, QW_U_ANGLE2, QW_U_ANGLE3, QW_U_COLORMAP, QW_U_EFFECTS, QW_U_FRAME, QW_U_MODEL, QW_U_MOREBITS, QW_U_ORIGIN1, QW_U_ORIGIN2, QW_U_ORIGIN3, QW_U_SKIN, QW_U_SOLID, and entity_state_t::skin.

Referenced by EntityFrameQW_CL_ReadFrame().

◆ EntityStateQW_ReadPlayerUpdate()

void EntityStateQW_ReadPlayerUpdate ( void )

Definition at line 46 of file cl_ents_qw.c.

47{
48 int slot = MSG_ReadByte(&cl_message);
49 int enumber = slot + 1;
50 int weaponframe;
51 int msec;
52 int playerflags;
53 int bits;
55 // look up the entity
56 entity_t *ent = cl.entities + enumber;
57 vec3_t viewangles;
59
60 // slide the current state into the previous
61 ent->state_previous = ent->state_current;
62
63 // read the update
64 s = &ent->state_current;
65 *s = defaultstate;
67 s->number = enumber;
68 s->colormap = enumber;
69 playerflags = MSG_ReadShort(&cl_message);
72
73 VectorClear(viewangles);
75
76 if (playerflags & QW_PF_MSEC)
77 {
78 // time difference between last update this player sent to the server,
79 // and last input we sent to the server (this packet is in response to
80 // our input, so msec is how long ago the last update of this player
81 // entity occurred, compared to our input being received)
82 msec = MSG_ReadByte(&cl_message);
83 }
84 else
85 msec = 0;
86 if (playerflags & QW_PF_COMMAND)
87 {
88 bits = MSG_ReadByte(&cl_message);
89 if (bits & QW_CM_ANGLE1)
90 viewangles[0] = MSG_ReadAngle16i(&cl_message); // cmd->angles[0]
91 if (bits & QW_CM_ANGLE2)
92 viewangles[1] = MSG_ReadAngle16i(&cl_message); // cmd->angles[1]
93 if (bits & QW_CM_ANGLE3)
94 viewangles[2] = MSG_ReadAngle16i(&cl_message); // cmd->angles[2]
95 if (bits & QW_CM_FORWARD)
96 MSG_ReadShort(&cl_message); // cmd->forwardmove
97 if (bits & QW_CM_SIDE)
98 MSG_ReadShort(&cl_message); // cmd->sidemove
99 if (bits & QW_CM_UP)
100 MSG_ReadShort(&cl_message); // cmd->upmove
101 if (bits & QW_CM_BUTTONS)
102 (void) MSG_ReadByte(&cl_message); // cmd->buttons
103 if (bits & QW_CM_IMPULSE)
104 (void) MSG_ReadByte(&cl_message); // cmd->impulse
105 (void) MSG_ReadByte(&cl_message); // cmd->msec
106 }
107 if (playerflags & QW_PF_VELOCITY1)
109 if (playerflags & QW_PF_VELOCITY2)
111 if (playerflags & QW_PF_VELOCITY3)
113 if (playerflags & QW_PF_MODEL)
115 else
117 if (playerflags & QW_PF_SKINNUM)
119 if (playerflags & QW_PF_EFFECTS)
121 if (playerflags & QW_PF_WEAPONFRAME)
123 else
124 weaponframe = 0;
125
126 if (enumber == cl.playerentity)
127 {
128 // if this is an update on our player, update the angles
129 VectorCopy(cl.viewangles, viewangles);
130 }
131
132 // calculate the entity angles from the viewangles
133 s->angles[0] = viewangles[0] * -0.0333;
134 s->angles[1] = viewangles[1];
135 s->angles[2] = 0;
137
138 // if this is an update on our player, update interpolation state
139 if (enumber == cl.playerentity)
140 {
144 cl.mviewzoom[1] = cl.mviewzoom[0];
145
146 cl.idealpitch = 0;
147 cl.mpunchangle[0][0] = 0;
148 cl.mpunchangle[0][1] = 0;
149 cl.mpunchangle[0][2] = 0;
150 cl.mpunchvector[0][0] = 0;
151 cl.mpunchvector[0][1] = 0;
152 cl.mpunchvector[0][2] = 0;
153 cl.mvelocity[0][0] = 0;
154 cl.mvelocity[0][1] = 0;
155 cl.mvelocity[0][2] = 0;
156 cl.mviewzoom[0] = 1;
157
160 if (playerflags & QW_PF_GIB)
162 else if (playerflags & QW_PF_DEAD)
163 cl.stats[STAT_VIEWHEIGHT] = -16;
164 else
166 }
167
168 // set the cl.entities_active flag
169 cl.entities_active[enumber] = (s->active == ACTIVE_NETWORK);
170 // set the update time
171 s->time = cl.mtime[0] - msec * 0.001; // qw has no clock
172 // check if we need to update the lerp stuff
173 if (s->active == ACTIVE_NETWORK)
175}
cvar_t cl_rollangle
Definition view.c:36
cvar_t cl_rollspeed
Definition view.c:35
void MSG_ReadVector(sizebuf_t *sb, vec3_t v, protocolversion_t protocol)
Definition com_msg.c:401
float MSG_ReadAngle16i(sizebuf_t *sb)
Definition com_msg.c:414
float Com_CalcRoll(const vec3_t angles, const vec3_t velocity, const vec_t angleval, const vec_t velocityval)
Definition common.c:890
vector velocity
void() predraw
#define VectorClear(a)
Definition mathlib.h:97
#define VectorCopy(in, out)
Definition mathlib.h:101
float weaponframe
Definition progsdefs.qc:141
entity_state_t defaultstate
Definition protocol.c:4
#define QW_PF_WEAPONFRAME
Definition protocol.h:972
#define QW_PF_VELOCITY1
Definition protocol.h:966
#define QW_CM_UP
Definition protocol.h:984
#define QW_PF_GIB
Definition protocol.h:974
#define QW_CM_FORWARD
Definition protocol.h:982
#define QW_CM_ANGLE1
Definition protocol.h:980
#define QW_CM_BUTTONS
Definition protocol.h:985
#define QW_PF_MSEC
Definition protocol.h:964
#define QW_PF_SKINNUM
Definition protocol.h:970
#define QW_CM_ANGLE2
Definition protocol.h:987
#define QW_PF_VELOCITY3
Definition protocol.h:968
#define QW_PF_VELOCITY2
Definition protocol.h:967
#define QW_CM_ANGLE3
Definition protocol.h:981
#define QW_CM_IMPULSE
Definition protocol.h:986
#define QW_PF_EFFECTS
Definition protocol.h:971
#define QW_PF_DEAD
Definition protocol.h:973
#define QW_PF_COMMAND
Definition protocol.h:965
#define QW_CM_SIDE
Definition protocol.h:983
#define QW_PF_MODEL
Definition protocol.h:969
#define STAT_WEAPONFRAME
Definition qstats.h:13
#define STAT_VIEWHEIGHT
FTE, DP.
Definition qstats.h:24
vec_t vec3_t[3]
Definition qtypes.h:71
float idealpitch
Definition client.h:826
vec3_t viewangles
Definition client.h:786
int qw_modelindex_player
Definition client.h:1091
vec3_t mpunchvector[2]
Definition client.h:790
vec3_t mvelocity[2]
Definition client.h:792
int playerentity
Definition client.h:910
int stats[MAX_CL_STATS]
Definition client.h:758
vec3_t mpunchangle[2]
Definition client.h:788
vec_t mviewzoom[2]
Definition client.h:794
protocolversion_t protocol
Definition client.h:617
float value
Definition cvar.h:74

References entity_state_t::active, ACTIVE_NETWORK, entity_state_t::angles, cl, cl_message, CL_MoveLerpEntityStates(), cl_rollangle, cl_rollspeed, cls, entity_state_t::colormap, Com_CalcRoll(), defaultstate, client_state_t::entities, client_state_t::entities_active, entity_state_t::frame, client_state_t::idealpitch, entity_state_t::modelindex, client_state_t::mpunchangle, client_state_t::mpunchvector, MSG_ReadAngle16i(), MSG_ReadByte, MSG_ReadShort, MSG_ReadVector(), client_state_t::mtime, client_state_t::mvelocity, client_state_t::mviewzoom, entity_state_t::number, entity_state_t::origin, client_state_t::playerentity, client_static_t::protocol, QW_CM_ANGLE1, QW_CM_ANGLE2, QW_CM_ANGLE3, QW_CM_BUTTONS, QW_CM_FORWARD, QW_CM_IMPULSE, QW_CM_SIDE, QW_CM_UP, client_state_t::qw_modelindex_player, QW_PF_COMMAND, QW_PF_DEAD, QW_PF_EFFECTS, QW_PF_GIB, QW_PF_MODEL, QW_PF_MSEC, QW_PF_SKINNUM, QW_PF_VELOCITY1, QW_PF_VELOCITY2, QW_PF_VELOCITY3, QW_PF_WEAPONFRAME, QW_TranslateEffects(), entity_state_t::skin, STAT_VIEWHEIGHT, STAT_WEAPONFRAME, entity_t::state_current, entity_t::state_previous, client_state_t::stats, entity_state_t::time, cvar_t::value, VectorClear, VectorCopy, velocity, client_state_t::viewangles, void(), and weaponframe.

Referenced by CL_ParseServerMessage().

◆ QW_TranslateEffects()

static void QW_TranslateEffects ( entity_state_t * s,
int qweffects )
static

Definition at line 4 of file cl_ents_qw.c.

5{
6 s->effects = 0;
7 s->internaleffects = 0;
8 if (qweffects & QW_EF_BRIGHTFIELD)
10 if (qweffects & QW_EF_MUZZLEFLASH)
12 if (qweffects & QW_EF_FLAG1)
13 {
14 // mimic FTEQW's interpretation of EF_FLAG1 as EF_NODRAW on non-player entities
15 if (s->number > cl.maxclients)
16 s->effects |= EF_NODRAW;
17 else
19 }
20 if (qweffects & QW_EF_FLAG2)
21 {
22 // mimic FTEQW's interpretation of EF_FLAG2 as EF_ADDITIVE on non-player entities
23 if (s->number > cl.maxclients)
24 s->effects |= EF_ADDITIVE;
25 else
27 }
28 if (qweffects & QW_EF_RED)
29 {
30 if (qweffects & QW_EF_BLUE)
31 s->effects |= EF_RED | EF_BLUE;
32 else
33 s->effects |= EF_RED;
34 }
35 else if (qweffects & QW_EF_BLUE)
36 s->effects |= EF_BLUE;
37 else if (qweffects & QW_EF_BRIGHTLIGHT)
39 else if (qweffects & QW_EF_DIMLIGHT)
40 s->effects |= EF_DIMLIGHT;
41}
#define QW_EF_DIMLIGHT
Definition protocol.h:1027
#define INTEF_FLAG2QW
Definition protocol.h:103
#define EF_BRIGHTFIELD
Definition protocol.h:68
#define QW_EF_MUZZLEFLASH
Definition protocol.h:1025
#define EF_ADDITIVE
Definition protocol.h:73
#define QW_EF_BLUE
Definition protocol.h:1030
#define EF_BRIGHTLIGHT
Definition protocol.h:70
#define EF_NODRAW
Definition protocol.h:72
#define QW_EF_BRIGHTLIGHT
Definition protocol.h:1026
#define QW_EF_FLAG2
Definition protocol.h:1029
#define QW_EF_BRIGHTFIELD
Definition protocol.h:1024
#define QW_EF_FLAG1
Definition protocol.h:1028
#define EF_RED
Definition protocol.h:75
#define QW_EF_RED
Definition protocol.h:1031
#define EF_BLUE
Definition protocol.h:74
#define INTEF_FLAG1QW
Definition protocol.h:102
#define EF_MUZZLEFLASH
Definition protocol.h:69
#define EF_DIMLIGHT
Definition protocol.h:71
unsigned char internaleffects
Definition protocol.h:469

References cl, EF_ADDITIVE, EF_BLUE, EF_BRIGHTFIELD, EF_BRIGHTLIGHT, EF_DIMLIGHT, EF_MUZZLEFLASH, EF_NODRAW, EF_RED, entity_state_t::effects, INTEF_FLAG1QW, INTEF_FLAG2QW, entity_state_t::internaleffects, client_state_t::maxclients, entity_state_t::number, QW_EF_BLUE, QW_EF_BRIGHTFIELD, QW_EF_BRIGHTLIGHT, QW_EF_DIMLIGHT, QW_EF_FLAG1, QW_EF_FLAG2, QW_EF_MUZZLEFLASH, and QW_EF_RED.

Referenced by EntityStateQW_ReadEntityUpdate(), and EntityStateQW_ReadPlayerUpdate().

Variable Documentation

◆ cl_rollangle

cvar_t cl_rollangle
extern

Definition at line 36 of file view.c.

36{CF_CLIENT | CF_ARCHIVE, "cl_rollangle", "2.0", "how much to tilt the view when strafing"};
#define CF_CLIENT
cvar/command that only the client can change/execute
Definition cmd.h:48
#define CF_ARCHIVE
cvar should have its set value saved to config.cfg and persist across sessions
Definition cmd.h:53

Referenced by EntityStateQW_ReadPlayerUpdate(), V_CalcRefdefUsing(), and V_Init().

◆ cl_rollspeed

cvar_t cl_rollspeed
extern

Definition at line 35 of file view.c.

35{CF_CLIENT | CF_ARCHIVE, "cl_rollspeed", "200", "how much strafing is necessary to tilt the view"};

Referenced by EntityStateQW_ReadPlayerUpdate(), V_CalcRefdefUsing(), and V_Init().